diff options
author | Ben Murdoch <benm@google.com> | 2009-08-18 15:36:45 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2009-08-18 19:20:06 +0100 |
commit | d227fc870c7a697500a3c900c31baf05fb9a8524 (patch) | |
tree | a3fa109aa5bf52fef562ac49d97a2f723889cc71 | |
parent | f2c627513266faa73f7669058d98c60769fb3524 (diff) | |
download | external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.zip external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.gz external_webkit-d227fc870c7a697500a3c900c31baf05fb9a8524.tar.bz2 |
Merge WebKit r47420
633 files changed, 22594 insertions, 7208 deletions
diff --git a/JavaScriptCore/API/JSCallbackConstructor.h b/JavaScriptCore/API/JSCallbackConstructor.h index 1f06249..1e28aaf 100644 --- a/JavaScriptCore/API/JSCallbackConstructor.h +++ b/JavaScriptCore/API/JSCallbackConstructor.h @@ -41,7 +41,7 @@ public: static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark)); } private: diff --git a/JavaScriptCore/API/JSCallbackFunction.cpp b/JavaScriptCore/API/JSCallbackFunction.cpp index 1b3217b..b7dd768 100644 --- a/JavaScriptCore/API/JSCallbackFunction.cpp +++ b/JavaScriptCore/API/JSCallbackFunction.cpp @@ -28,6 +28,7 @@ #include "JSCallbackFunction.h" #include "APICast.h" +#include "CodeBlock.h" #include "JSFunction.h" #include "FunctionPrototype.h" #include <runtime/JSGlobalObject.h> diff --git a/JavaScriptCore/API/JSCallbackFunction.h b/JavaScriptCore/API/JSCallbackFunction.h index 7dd87b5..3a17fa2 100644 --- a/JavaScriptCore/API/JSCallbackFunction.h +++ b/JavaScriptCore/API/JSCallbackFunction.h @@ -41,7 +41,7 @@ public: // refactor the code so this override isn't necessary static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); } private: diff --git a/JavaScriptCore/API/JSObjectRef.cpp b/JavaScriptCore/API/JSObjectRef.cpp index 87d36ec..06ef578 100644 --- a/JavaScriptCore/API/JSObjectRef.cpp +++ b/JavaScriptCore/API/JSObjectRef.cpp @@ -28,6 +28,7 @@ #include "JSObjectRef.h" #include "APICast.h" +#include "CodeBlock.h" #include "DateConstructor.h" #include "ErrorConstructor.h" #include "FunctionConstructor.h" diff --git a/JavaScriptCore/Android.mk b/JavaScriptCore/Android.mk index 6973fa1..c27c703 100644 --- a/JavaScriptCore/Android.mk +++ b/JavaScriptCore/Android.mk @@ -108,6 +108,7 @@ LOCAL_SRC_FILES := \ runtime/ErrorInstance.cpp \ runtime/ErrorPrototype.cpp \ runtime/ExceptionHelpers.cpp \ + runtime/Executable.cpp \ runtime/FunctionConstructor.cpp \ runtime/FunctionPrototype.cpp \ runtime/GetterSetter.cpp \ diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 1afea5f..f67d27d 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,1229 @@ +2009-08-17 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Sam Weinig. + + No, silly runtime, AST nodes are not for you. + + We still use AST nodes (ScopeNodes, particularly FunctionBodyNodes) within + the runtime, which means that these nodes must be persisted outside of the + arena, contain both parser & runtime data, etc. This is all a bit of a mess. + + Move functionality into a new FunctionExecutable class. + + * API/JSCallbackFunction.cpp: + * API/JSObjectRef.cpp: + * JavaScriptCore.exp: + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::CodeBlock): + (JSC::CodeBlock::markAggregate): + (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): + (JSC::CodeBlock::lineNumberForBytecodeOffset): + (JSC::CodeBlock::shrinkToFit): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::getBytecodeIndex): + (JSC::CodeBlock::discardBytecode): + (JSC::CodeBlock::instructionCount): + (JSC::CodeBlock::getJITCode): + (JSC::CodeBlock::executablePool): + (JSC::CodeBlock::ownerExecutable): + (JSC::CodeBlock::extractExceptionInfo): + (JSC::CodeBlock::addFunctionDecl): + (JSC::CodeBlock::functionDecl): + (JSC::CodeBlock::numberOfFunctionDecls): + (JSC::CodeBlock::addFunctionExpr): + (JSC::CodeBlock::functionExpr): + (JSC::GlobalCodeBlock::GlobalCodeBlock): + (JSC::ProgramCodeBlock::ProgramCodeBlock): + (JSC::EvalCodeBlock::EvalCodeBlock): + (JSC::FunctionCodeBlock::FunctionCodeBlock): + (JSC::NativeCodeBlock::NativeCodeBlock): + * bytecode/EvalCodeCache.h: + * bytecode/SamplingTool.cpp: + (JSC::SamplingTool::doRun): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * interpreter/CachedCall.h: + (JSC::CachedCall::CachedCall): + * interpreter/CallFrameClosure.h: + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + (JSC::Interpreter::throwException): + (JSC::Interpreter::execute): + (JSC::Interpreter::prepareForRepeatCall): + (JSC::Interpreter::debug): + (JSC::Interpreter::privateExecute): + (JSC::Interpreter::retrieveLastCaller): + * interpreter/Interpreter.h: + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + * jit/JIT.h: + (JSC::JIT::compile): + * jit/JITOpcodes.cpp: + (JSC::JIT::privateCompileCTIMachineTrampolines): + (JSC::JIT::emit_op_new_func): + (JSC::JIT::emit_op_new_func_exp): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): + * parser/Nodes.cpp: + (JSC::FunctionBodyNode::reparseDataIfNecessary): + * parser/Nodes.h: + (JSC::EvalNode::partialDestroyData): + * parser/Parser.h: + * profiler/ProfileGenerator.cpp: + * profiler/Profiler.cpp: + (JSC::Profiler::createCallIdentifier): + (JSC::createCallIdentifierFromFunctionImp): + * runtime/Arguments.h: + (JSC::Arguments::getArgumentsData): + (JSC::Arguments::Arguments): + (JSC::JSActivation::copyRegisters): + * runtime/ArrayPrototype.cpp: + (JSC::isNumericCompareFunction): + * runtime/CallData.h: + (JSC::): + * runtime/Collector.cpp: + (JSC::Heap::collect): + * runtime/ConstructData.h: + (JSC::): + * runtime/ExceptionHelpers.cpp: + (JSC::createUndefinedVariableError): + (JSC::createInvalidParamError): + (JSC::createNotAConstructorError): + (JSC::createNotAFunctionError): + (JSC::createNotAnObjectError): + * runtime/Executable.cpp: Added. + (JSC::EvalExecutable::generateBytecode): + (JSC::ProgramExecutable::generateBytecode): + (JSC::FunctionExecutable::generateBytecode): + (JSC::EvalExecutable::generateJITCode): + (JSC::ProgramExecutable::generateJITCode): + (JSC::FunctionExecutable::generateJITCode): + (JSC::FunctionExecutable::isHostFunction): + (JSC::FunctionExecutable::markAggregate): + (JSC::FunctionExecutable::reparseExceptionInfo): + (JSC::EvalExecutable::reparseExceptionInfo): + (JSC::FunctionExecutable::recompile): + (JSC::FunctionExecutable::FunctionExecutable): + * runtime/Executable.h: + (JSC::ExecutableBase::~ExecutableBase): + (JSC::ExecutableBase::ExecutableBase): + (JSC::ExecutableBase::source): + (JSC::ExecutableBase::sourceID): + (JSC::ExecutableBase::lastLine): + (JSC::ExecutableBase::usesEval): + (JSC::ExecutableBase::usesArguments): + (JSC::ExecutableBase::needsActivation): + (JSC::ExecutableBase::astNode): + (JSC::ExecutableBase::generatedJITCode): + (JSC::ExecutableBase::getExecutablePool): + (JSC::EvalExecutable::EvalExecutable): + (JSC::EvalExecutable::bytecode): + (JSC::EvalExecutable::varStack): + (JSC::EvalExecutable::evalNode): + (JSC::EvalExecutable::jitCode): + (JSC::ProgramExecutable::ProgramExecutable): + (JSC::ProgramExecutable::reparseExceptionInfo): + (JSC::ProgramExecutable::bytecode): + (JSC::ProgramExecutable::programNode): + (JSC::ProgramExecutable::jitCode): + (JSC::FunctionExecutable::FunctionExecutable): + (JSC::FunctionExecutable::name): + (JSC::FunctionExecutable::bytecode): + (JSC::FunctionExecutable::generatedBytecode): + (JSC::FunctionExecutable::usesEval): + (JSC::FunctionExecutable::usesArguments): + (JSC::FunctionExecutable::parameterCount): + (JSC::FunctionExecutable::paramString): + (JSC::FunctionExecutable::isGenerated): + (JSC::FunctionExecutable::body): + (JSC::FunctionExecutable::jitCode): + (JSC::FunctionExecutable::createNativeThunk): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSActivation.cpp: + (JSC::JSActivation::JSActivation): + (JSC::JSActivation::markChildren): + (JSC::JSActivation::isDynamicScope): + (JSC::JSActivation::argumentsGetter): + * runtime/JSActivation.h: + (JSC::JSActivation::JSActivationData::JSActivationData): + * runtime/JSFunction.cpp: + (JSC::JSFunction::isHostFunction): + (JSC::JSFunction::JSFunction): + (JSC::JSFunction::~JSFunction): + (JSC::JSFunction::markChildren): + (JSC::JSFunction::getCallData): + (JSC::JSFunction::call): + (JSC::JSFunction::lengthGetter): + (JSC::JSFunction::getConstructData): + (JSC::JSFunction::construct): + * runtime/JSFunction.h: + (JSC::JSFunction::executable): + (JSC::FunctionExecutable::make): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + (JSC::JSGlobalData::numericCompareFunction): + * runtime/JSGlobalData.h: + +2009-08-17 Mark Rowe <mrowe@apple.com> + + Reviewed by Darin Adler. + + Fix 300,000+ leaks seen during the regression tests. + + EvalCodeCache::get was heap-allocating an EvalExecutable instance without adopting the initial reference. + While fixing this we noticed that EvalExecutable was a RefCounted type that was sometimes stack allocated. + To make this cleaner and to prevent clients from attempting to ref a stack-allocated instance, we move the + refcounting down to a new CacheableEvalExecutable class that derives from EvalExecutable. EvalCodeCache::get + now uses CacheableEvalExecutable::create and avoids the leak. + + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + * runtime/Executable.h: + (JSC::CacheableEvalExecutable::create): + (JSC::CacheableEvalExecutable::CacheableEvalExecutable): + +2009-08-17 Oliver Hunt <oliver@apple.com> + + RS=Mark Rowe. + + REGRESSION (r47292): Prototype.js is broken by ES5 Arguments changes + https://bugs.webkit.org/show_bug.cgi?id=28341 + <rdar://problem/7145615> + + Reverting r47292. Alas Prototype.js breaks with Arguments inheriting + from Array as ES5 attempted. Prototype.js defines $A in terms of a + function it places on (among other global objects) the Array prototype, + thus breaking $A for arrays. + + * runtime/Arguments.h: + (JSC::Arguments::Arguments): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): + * runtime/ObjectPrototype.h: + * tests/mozilla/ecma_3/Function/arguments-001.js: + +2009-08-17 Peter Kasting <pkasting@google.com> + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj: + * JavaScriptCore.vcproj/WTF/WTFCommon.vsprops: + * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: + * JavaScriptCore.vcproj/testapi/testapiCommon.vsprops: + +2009-08-17 Xan Lopez <xlopez@igalia.com> + + Reviewed by Mark Rowe. + + Fix build with FAST_MALLOC_MATCH_VALIDATION enabled. + + * wtf/FastMalloc.cpp: + (WTF::fastMalloc): + (WTF::fastCalloc): + (WTF::fastRealloc): + +2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Mark Rowe. + + Fix crash on ./ecma_2/RegExp/exec-002.js. + https://bugs.webkit.org/show_bug.cgi?id=28353 + + Change the order of freeParenthesesDisjunctionContext and + popParenthesesDisjunctionContext on all call sites as the pop + method is accessing backTrack->lastContext which is the context + that is about to be freed. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::parenthesesDoBacktrack): + (JSC::Yarr::Interpreter::backtrackParentheses): + +2009-08-16 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Mark Rowe. + + https://bugs.webkit.org/show_bug.cgi?id=28352 + + Fix coding style violations. Use m_ for C++ class members. Remove + trailing whitespace on empty lines. + + * yarr/RegexInterpreter.cpp: + (JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::ParenthesesDisjunctionContext): + (JSC::Yarr::Interpreter::tryConsumeCharacter): + (JSC::Yarr::Interpreter::tryConsumeBackReference): + (JSC::Yarr::Interpreter::parenthesesDoBacktrack): + (JSC::Yarr::Interpreter::backtrackParentheses): + (JSC::Yarr::ByteCompiler::ByteCompiler): + (JSC::Yarr::ByteCompiler::compile): + (JSC::Yarr::ByteCompiler::checkInput): + (JSC::Yarr::ByteCompiler::assertionBOL): + (JSC::Yarr::ByteCompiler::assertionEOL): + (JSC::Yarr::ByteCompiler::assertionWordBoundary): + (JSC::Yarr::ByteCompiler::atomPatternCharacter): + (JSC::Yarr::ByteCompiler::atomCharacterClass): + (JSC::Yarr::ByteCompiler::atomBackReference): + (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternBegin): + (JSC::Yarr::ByteCompiler::atomParentheticalAssertionBegin): + (JSC::Yarr::ByteCompiler::popParenthesesStack): + (JSC::Yarr::ByteCompiler::closeAlternative): + (JSC::Yarr::ByteCompiler::closeBodyAlternative): + (JSC::Yarr::ByteCompiler::atomParenthesesEnd): + (JSC::Yarr::ByteCompiler::regexBegin): + (JSC::Yarr::ByteCompiler::alterantiveBodyDisjunction): + (JSC::Yarr::ByteCompiler::alterantiveDisjunction): + (JSC::Yarr::ByteCompiler::emitDisjunction): + +2009-08-15 Mark Rowe <mrowe@apple.com> + + Fix the build with JIT disabled. + + * runtime/Arguments.h: Only compile the jitCode method when the JIT is enabled. + * runtime/Executable.h: Include PrototypeFunction.h so the compiler knows what + NativeFunctionWrapper is when the JIT is disabled. + +2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com> + + Reviewed by Sam Weinig. + + Added ENABLE_EVENTSOURCE flag. + https://bugs.webkit.org/show_bug.cgi?id=14997 + + * Configurations/FeatureDefines.xcconfig: + +2009-08-14 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (build fix). + + * parser/Parser.h: + (JSC::EvalExecutable::parse): + (JSC::ProgramExecutable::parse): + * runtime/Executable.h: + +2009-08-14 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Remove AST nodes from use within the Runtime (outside of parsing), stage 1 + https://bugs.webkit.org/show_bug.cgi?id=28330 + + Remove the EvalNode and ProgramNode from use in the runtime. They still exist + after this patch, but are hidden behind EvalExecutable and FunctionExecutable, + and are also still reachable behind CodeBlock::m_ownerNode. + + The next step will be to beat back FunctionBodyNode in the same fashion. + Then remove the usage via CodeBlock, then only construct these nodes only on + demand during bytecode generation. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * bytecode/CodeBlock.h: + (JSC::GlobalCodeBlock::GlobalCodeBlock): + (JSC::GlobalCodeBlock::~GlobalCodeBlock): + (JSC::ProgramCodeBlock::ProgramCodeBlock): + (JSC::EvalCodeBlock::EvalCodeBlock): + (JSC::FunctionCodeBlock::FunctionCodeBlock): + (JSC::NativeCodeBlock::NativeCodeBlock): + * bytecode/EvalCodeCache.h: + (JSC::EvalCodeCache::get): + * debugger/Debugger.cpp: + (JSC::evaluateInGlobalCallFrame): + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::evaluate): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::callEval): + (JSC::Interpreter::execute): + * interpreter/Interpreter.h: + * parser/Nodes.cpp: + (JSC::FunctionBodyNode::createNativeThunk): + (JSC::FunctionBodyNode::generateBytecode): + (JSC::FunctionBodyNode::bytecodeForExceptionInfoReparse): + * parser/Parser.h: + (JSC::Parser::parse): + (JSC::Parser::reparse): + (JSC::Parser::parseFunctionFromGlobalCode): + (JSC::::parse): + * runtime/Completion.cpp: + (JSC::checkSyntax): + (JSC::evaluate): + * runtime/Error.cpp: + (JSC::throwError): + * runtime/Error.h: + * runtime/Executable.h: Added. + (JSC::TemplateExecutable::TemplateExecutable): + (JSC::TemplateExecutable::markAggregate): + (JSC::TemplateExecutable::sourceURL): + (JSC::TemplateExecutable::lineNo): + (JSC::TemplateExecutable::bytecode): + (JSC::TemplateExecutable::jitCode): + (JSC::EvalExecutable::EvalExecutable): + (JSC::ProgramExecutable::ProgramExecutable): + * runtime/FunctionConstructor.cpp: + (JSC::constructFunction): + * runtime/FunctionConstructor.h: + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::numericCompareFunction): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::~JSGlobalObject): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::codeBlocks): + * runtime/JSGlobalObjectFunctions.cpp: + (JSC::globalFuncEval): + +2009-08-14 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Rename the confusing isObject(<class>) to inherits(<class>). + It still works on non-objects, returning false. + + * runtime/ArrayConstructor.cpp: + (JSC::arrayConstructorIsArray): Removed unneeded isObject call + and updated remaining isObject call to new name, inherits. + + * runtime/JSCell.h: Renamed isObject(<class>) to inherits(<class>) + but more importantly, made it non-virtual (it was already inline) + so it is now as fast as JSObject::inherits was. + + * runtime/JSObject.h: Removed inherits function since the one + in the base class is fine as-is. Also made various JSCell functions + that should not be called on JSObject uncallable by making them + both private and not implemented. + (JSC::JSCell::inherits): Updated name. + (JSC::JSValue::inherits): Ditto. + + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): + * interpreter/Interpreter.cpp: + (JSC::Interpreter::unwindCallFrame): + * runtime/ArrayPrototype.cpp: + (JSC::arrayProtoFuncToString): + (JSC::arrayProtoFuncToLocaleString): + (JSC::arrayProtoFuncConcat): + * runtime/BooleanPrototype.cpp: + (JSC::booleanProtoFuncToString): + (JSC::booleanProtoFuncValueOf): + * runtime/DateConstructor.cpp: + (JSC::constructDate): + * 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::dateProtoFuncSetYear): + (JSC::dateProtoFuncGetYear): + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): + * runtime/JSActivation.cpp: + (JSC::JSActivation::argumentsGetter): + * runtime/JSValue.h: + * runtime/RegExpConstructor.cpp: + (JSC::constructRegExp): + * runtime/RegExpPrototype.cpp: + (JSC::regExpProtoFuncTest): + (JSC::regExpProtoFuncExec): + (JSC::regExpProtoFuncCompile): + (JSC::regExpProtoFuncToString): + * runtime/ScopeChain.cpp: + (JSC::ScopeChain::localDepth): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncReplace): + (JSC::stringProtoFuncToString): + (JSC::stringProtoFuncMatch): + (JSC::stringProtoFuncSearch): + (JSC::stringProtoFuncSplit): + Updated to new name, inherits, from old name, isObject. + +2009-07-31 Harald Fernengel <harald.fernengel@nokia.com> + + Reviewed by Simon Hausmann. + + Adding QNX as a platform. Currently only tested with Qt. + + https://bugs.webkit.org/show_bug.cgi?id=27885 + + * JavaScriptCore/runtime/Collector.cpp: Added retrieving of stack base + since QNX doesn't have the pthread _nt functions + * JavaScriptCore/wtf/Platform.h: Added WTF_PLATFORM_QNX and corresponding + defines + * WebCore/bridge/npapi.h: Build fix for missing typedefs on QNX + +2009-08-14 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + Currently generic ARM and ARMv7 platforms work only with JSVALUE32 + https://bugs.webkit.org/show_bug.cgi?id=28300 + + * wtf/Platform.h: + +2009-08-14 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + Enable JIT on ARM for QT by default + https://bugs.webkit.org/show_bug.cgi?id=28259 + + * wtf/Platform.h: + +2009-08-14 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Simon Hausmann. + + Enable YARR_JIT on ARM for QT by default + https://bugs.webkit.org/show_bug.cgi?id=28259 + + * wtf/Platform.h: + +2009-08-14 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + [ES5] Arguments object should inherit from Array + https://bugs.webkit.org/show_bug.cgi?id=28298 + + Make the Arguments object conform to the behaviour specified in ES5. + The simple portion of this is to make Arguments use Array.prototype + as its prototype rather than Object.prototype. + + The spec then requires us to set instance.constructor to the pristine + Object constructor, and instance.toString and instance.toLocaleString + to the pristine versions from Object.prototype. To do this we now + make the ObjectPrototype constructor return its toString and + toLocaleString functions (similar to the call and apply functions + from FunctionPrototype). + + Oddly enough this reports itself as a slight win, but given the code + isn't hit in the tests that claim to have improved I put this down to + code motion. + + * runtime/Arguments.h: + (JSC::Arguments::Arguments): + (JSC::Arguments::initializeStandardProperties): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + (JSC::JSGlobalObject::markChildren): + * runtime/JSGlobalObject.h: + (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): + (JSC::JSGlobalObject::objectConstructor): + (JSC::JSGlobalObject::objectToStringFunction): + (JSC::JSGlobalObject::objectToLocaleStringFunction): + * runtime/ObjectPrototype.cpp: + (JSC::ObjectPrototype::ObjectPrototype): + * runtime/ObjectPrototype.h: + * tests/mozilla/ecma_3/Function/arguments-001.js: + Update test to new es5 behaviour + +2009-08-14 Oliver Hunt <oliver@apple.com> + + Reviewed by NOBODY (Build fix). + + Remove MarkStack::drain from the JSC exports file + + MarkStack::drain is now marked inline, the including it in the exports file + produces an ld warning + + * JavaScriptCore.exp: + +2009-08-13 Sam Weinig <sam@webkit.org> + + Reviewed by Oliver Hunt. + + Remove accidentally left in debugging statement. + + * runtime/JSArray.h: + (JSC::MarkStack::drain): + +2009-08-13 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + [ES5] Implement Array.isArray + https://bugs.webkit.org/show_bug.cgi?id=28296 + + Add support for Array.isArray to the Array constructor + + * runtime/ArrayConstructor.cpp: + (JSC::ArrayConstructor::ArrayConstructor): + (JSC::arrayConstructorIsArray): + * runtime/ArrayConstructor.h: + * runtime/CommonIdentifiers.h: + * runtime/JSArray.h: + (JSC::MarkStack::drain): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::reset): + +2009-08-13 Oliver Hunt <oliver@apple.com> + + Reviewed by NOBODY (Buildfix). + + Attempt to fix windows build + + * runtime/Collector.cpp: + +2009-08-13 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + Devirtualise marking + https://bugs.webkit.org/show_bug.cgi?id=28294 + + Add a bit to TypeInfo to indicate that an object uses the standard + JSObject::markChildren method. This allows us to devirtualise marking + of most objects (though a branch is still needed). We also add a branch + to identify arrays thus devirtualising marking in that case as well. + + In order to make the best use of this devirtualisation I've also reworked + the MarkStack::drain() logic to make the iteration more efficient. + + * API/JSCallbackConstructor.h: + (JSC::JSCallbackConstructor::createStructure): + * API/JSCallbackFunction.h: + (JSC::JSCallbackFunction::createStructure): + * JavaScriptCore.exp: + * runtime/BooleanObject.h: + (JSC::BooleanObject::createStructure): + * runtime/FunctionPrototype.h: + (JSC::FunctionPrototype::createStructure): + * runtime/InternalFunction.h: + (JSC::InternalFunction::createStructure): + * runtime/JSAPIValueWrapper.h: + (JSC::JSAPIValueWrapper::JSAPIValueWrapper): + * runtime/JSArray.cpp: + (JSC::JSArray::markChildren): + * runtime/JSArray.h: + (JSC::JSArray::markChildrenDirect): + (JSC::MarkStack::drain): + * runtime/JSByteArray.cpp: + (JSC::JSByteArray::createStructure): + * runtime/JSCell.h: + (JSC::MarkStack::append): + * runtime/JSGlobalData.cpp: + (JSC::JSGlobalData::JSGlobalData): + * runtime/JSNumberCell.h: + (JSC::JSNumberCell::createStructure): + * runtime/JSONObject.h: + (JSC::JSONObject::createStructure): + * runtime/JSObject.cpp: + (JSC::JSObject::markChildren): + * runtime/JSObject.h: + (JSC::JSObject::markChildrenDirect): + (JSC::JSObject::createStructure): + * runtime/JSString.h: + (JSC::JSString::createStructure): + * runtime/JSType.h: + (JSC::): + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStack): + (JSC::MarkStack::MarkSet::MarkSet): + (JSC::MarkStack::MarkStackArray::last): + * runtime/MathObject.h: + (JSC::MathObject::createStructure): + * runtime/NumberConstructor.h: + (JSC::NumberConstructor::createStructure): + * runtime/NumberObject.h: + (JSC::NumberObject::createStructure): + * runtime/RegExpConstructor.h: + (JSC::RegExpConstructor::createStructure): + * runtime/RegExpObject.h: + (JSC::RegExpObject::createStructure): + * runtime/StringObjectThatMasqueradesAsUndefined.h: + (JSC::StringObjectThatMasqueradesAsUndefined::createStructure): + * runtime/TypeInfo.h: + (JSC::TypeInfo::hasDefaultMark): + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by Mark Rowe. + + Some small bits of housekeeping. + + * JavaScriptCore.xcodeproj/project.pbxproj: Make Parser.h + project instead of private. Remove JSONObject.lut.h. + + * assembler/ARMAssembler.h: Remove unneeded WTF prefix. + * assembler/AssemblerBufferWithConstantPool.h: Ditto. + * bytecompiler/BytecodeGenerator.h: Ditto. + + * wtf/SegmentedVector.h: Add a "using" statement as we do + with the other WTF headers. + +2009-08-13 Darin Adler <darin@apple.com> + + Fix Tiger build. + + * parser/Grammar.y: Use a template function so we can compile + setStatementLocation even if it comes before YYLTYPE is defined. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + Too much use of void* in Grammar.y + https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Changed all the helper functions to + take a JSGlobalData* instead of a void*. A couple formatting + tweaks that I missed when breaking this into pieces. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Reduced and sorted includes. Tweaked comment + format. Marked a few more functions inline. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Pass the number to the PropertyNode instead of + first turning it into an Identifier. + + * parser/NodeConstructors.h: + (JSC::PropertyNode::PropertyNode): Add an overload that takes a double + so the code to convert to a string can be here instead of Grammar.y. + * parser/Nodes.h: Ditto. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Eliminate the DBG macro. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + Another part of https://bugs.webkit.org/show_bug.cgi?id=28287 + + * parser/Grammar.y: Eliminate the SET_EXCEPTION_LOCATION macro. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by George Staikos. + + George asked me to break the patch from + https://bugs.webkit.org/show_bug.cgi?id=28287 + into smaller pieces and land it in stages. + + * parser/Grammar.y: Eliminate the LEXER macro. + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Try some more to fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto. + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Try and fix the Windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Export a new symbol. + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Ditto. + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by David Levin. + + JavaScriptCore tweaks to get ready for the parser arena + https://bugs.webkit.org/show_bug.cgi?id=28243 + + Eliminate dependencies on Nodes.h outside JavaScriptCore, + and cut down on them inside JavaScriptCore. + + Change regular expression parsing to use identifiers as + with other strings we parse. + + Fix a couple things that are needed to use const Identifier + more, which will be part of the parser arena work. + + * JavaScriptCore.exp: Resorted and updated. + + * JavaScriptCore.xcodeproj/project.pbxproj: Changed + CollectorHeapIterator.h to be project-internal. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::emitPushNewScope): Added const. + * bytecompiler/BytecodeGenerator.h: Ditto. + + * debugger/Debugger.cpp: + (JSC::Debugger::recompileAllJSFunctions): Moved this function + here from WebCore. Here is better since it uses so many internals. + Removed unimportant optimization for the no listener case. + * debugger/Debugger.h: Ditto. Also removed unneeded include + and tweaked formatting and comments. + + * debugger/DebuggerCallFrame.cpp: + (JSC::DebuggerCallFrame::functionName): Call asFunction instead + of doing the unchecked static_cast. + (JSC::DebuggerCallFrame::calculatedFunctionName): Ditto. + + * jit/JITStubs.cpp: + (JSC::op_call_JSFunction): Call isHostFunction on the body rather + than on the JSFunction. + (JSC::vm_lazyLinkCall): Ditto. + (JSC::op_construct_JSConstruct): Ditto. + + * parser/Grammar.y: Changed callers to use new scanRegExp with + out arguments instead of relying on state in the Lexer. And + callers that just want to skip a regular expression to use + skipRegExp. + + * parser/Lexer.cpp: + (JSC::Lexer::scanRegExp): Changed to use out arguments, and to + add a prefix argument so we can add in the "=" character as needed. + Also rewrote to streamline the logic a bit inspired by suggestions + by David Levin. + (JSC::Lexer::skipRegExp): Added. Version of the function above that + does not actually put the regular expression into a string. + (JSC::Lexer::clear): Removed code to clear m_pattern and m_flags. + * parser/Lexer.h: Changed scanRegExp to have out arguments. Added + skipRegExp. Eliminated pattern, flags, m_pattern, and m_flags. + + * parser/NodeConstructors.h: + (JSC::RegExpNode::RegExpNode): Changed to take const Identifier&. + * parser/Nodes.cpp: + (JSC::RegExpNode::emitBytecode): Changed since m_pattern and + m_flags are now Identifier instead of UString. + (JSC::FunctionBodyNode::make): Moved this function here instead + of putting it in the JSFunction.h header. + * parser/Nodes.h: Changed RegExpNode to use Identifier. + + * profiler/Profiler.cpp: + (JSC::Profiler::createCallIdentifier): Changed to use isHostFunction + on the body instead of on the JSFunction object. + * runtime/FunctionPrototype.cpp: + (JSC::functionProtoFuncToString): Ditto. + + * runtime/JSFunction.cpp: + (JSC::JSFunction::isHostFunction): Moved here from header. + (JSC::JSFunction::isHostFunctionNonInline): Added. + (JSC::JSFunction::JSFunction): Removed unneeded initialization of + m_body to 0. + (JSC::JSFunction::setBody): Moved here from header. + + * runtime/JSFunction.h: Removed unneeded includes. Moved private + constructor down to the private section. Made virtual functions + private. Removed unneeded overload of setBody and moved the body + of the function into the .cpp file. Changed assertions to use + the non-inline version of isHostFunction. + + * runtime/PropertySlot.cpp: + (JSC::PropertySlot::functionGetter): Use asFunction instead + of doing the unchecked static_cast. + + * wtf/SegmentedVector.h: + (WTF::SegmentedVector::isEmpty): Added. + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Rubber-stamped by Darin Adler. + + Use the version of operator new that takes a JSGlobalData when allocating FuncDeclNode and FuncExprNode + from within the grammar to prevent these nodes from being leaked. + + * parser/Grammar.y: + +2009-08-13 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Ariya Hidayat. + + Remove the special-case for Qt wrt JSVALUE_32 introduced in + r46709. It must've been a dependency issue on the bot, as + after a manual build all the tests pass on amd64 and ia32. + + * wtf/Platform.h: + +2009-08-12 Gabor Loki <loki@inf.u-szeged.hu> + + Reviewed by Gavin Barraclough. + + Add optimize call and property access support for ARM JIT. + https://bugs.webkit.org/show_bug.cgi?id=24986 + + For tightly coupled sequences the BEGIN_UNINTERRUPTED_SEQUENCE and + END_UNINTERRUPTED_SEQUENCE macros have been introduced which ensure + space for instructions and constants of the named sequence. This + method is vital for those architecture which are using constant pool. + + The 'latePatch' method - which was linked to JmpSrc - is replaced with + a port specific solution (each calls are marked to place their address + on the constant pool). + + * assembler/ARMAssembler.cpp: + (JSC::ARMAssembler::linkBranch): + (JSC::ARMAssembler::executableCopy): Add extra align for constant pool. + * assembler/ARMAssembler.h: + (JSC::ARMAssembler::JmpSrc::JmpSrc): + (JSC::ARMAssembler::sizeOfConstantPool): + (JSC::ARMAssembler::jmp): + (JSC::ARMAssembler::linkCall): + * assembler/ARMv7Assembler.h: + * assembler/AbstractMacroAssembler.h: + * assembler/AssemblerBufferWithConstantPool.h: + (JSC::AssemblerBufferWithConstantPool::flushIfNoSpaceFor): Fix the + computation of the remaining space. + * assembler/MacroAssemblerARM.h: + (JSC::MacroAssemblerARM::branch32): + (JSC::MacroAssemblerARM::nearCall): + (JSC::MacroAssemblerARM::call): + (JSC::MacroAssemblerARM::branchPtrWithPatch): + (JSC::MacroAssemblerARM::ensureSpace): + (JSC::MacroAssemblerARM::sizeOfConstantPool): + (JSC::MacroAssemblerARM::prepareCall): + * assembler/X86Assembler.h: + * jit/JIT.h: + * jit/JITCall.cpp: + (JSC::JIT::compileOpCall): + * jit/JITInlineMethods.h: + (JSC::JIT::beginUninterruptedSequence): + (JSC::JIT::endUninterruptedSequence): + * jit/JITPropertyAccess.cpp: + (JSC::JIT::emit_op_method_check): + (JSC::JIT::compileGetByIdHotPath): + (JSC::JIT::compileGetByIdSlowCase): + (JSC::JIT::emit_op_put_by_id): + +2009-08-12 Gavin Barraclough <barraclough@apple.com> + + Rubber Stamped by Dave Kilzer. + + Disable WTF_USE_JSVALUE32_64 on iPhone for now (support not yet added for ARMv7). + + * wtf/Platform.h: + +2009-08-12 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Maciej Stachoviak. + + Ooops - moved code that had been accidentally added to op_new_func instead of + op_new_func_exp, to where it shoulds be. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::privateExecute): + * wtf/Platform.h: + +2009-08-12 Ada Chan <adachan@apple.com> + + Added workaround for the limitation that VirtualFree with MEM_RELEASE + can only accept the base address returned by VirtualAlloc when the region + was reserved and it can only free the entire region, and not a part of it. + + Reviewed by Oliver Hunt. + + * runtime/MarkStack.h: + (JSC::MarkStack::MarkStackArray::shrinkAllocation): + * runtime/MarkStackWin.cpp: + (JSC::MarkStack::releaseStack): + +2009-08-12 Balazs Kelemen <kelemen.balazs.3@stud.u-szeged.hu> + + Reviewed by Ariya Hidayat. + + Build fix: use std::numeric_limits<long long>::min() instead of LLONG_MIN + since LLONG_MIN is not defined in standard c++. + + * runtime/UString.cpp: + (JSC::UString::from): + +2009-08-12 Benjamin Otte <otte@gnome.org> + + Reviewed by Jan Alonzo. + + Buildfix for Gtk platforms debug builds. + + * GNUmakefile.am: Choose MarkStackPosix.cpp or MarkStackWin.cpp + depending on platform. + +2009-08-12 Simon Hausmann <simon.hausmann@nokia.com> + + Prospective build fix for Mac and 32-bit Windows. + + * runtime/UString.cpp: Include wtf/StringExtras.h for snprintf. + (JSC::UString::from): Use %lld instead of %I64d for snprintf + on non-windows platforms. + +2009-08-12 Prasanth Ullattil <prasanth.ullattil@nokia.com> + + Reviewed by Simon Hausmann. + + Fix compile error on 64Bit Windows, when UString::from + is called with an intptr_t. + + Added new UString::From overload with long long parameter. + + Thanks to Holger for the long long idea. + + * runtime/UString.cpp: + (JSC::UString::from): + * runtime/UString.h: + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Mark Rowe. + + Minor style fixes. + + * runtime/UString.h: + (JSC::UString::Rep::createEmptyBuffer): + * wtf/FastMalloc.h: + (WTF::TryMallocReturnValue::getValue): + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Make it harder to misuse try* allocation routines + https://bugs.webkit.org/show_bug.cgi?id=27469 + + Jump through a few hoops to make it much harder to accidentally + miss null-checking of values returned by the try-* allocation + routines. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + * JavaScriptCore.xcodeproj/project.pbxproj: + * runtime/JSArray.cpp: + (JSC::JSArray::putSlowCase): + (JSC::JSArray::increaseVectorLength): + * runtime/StringPrototype.cpp: + (JSC::stringProtoFuncFontsize): + (JSC::stringProtoFuncLink): + * runtime/UString.cpp: + (JSC::allocChars): + (JSC::reallocChars): + (JSC::expandCapacity): + (JSC::UString::Rep::reserveCapacity): + (JSC::UString::expandPreCapacity): + (JSC::createRep): + (JSC::concatenate): + (JSC::UString::spliceSubstringsWithSeparators): + (JSC::UString::replaceRange): + (JSC::UString::append): + (JSC::UString::operator=): + * runtime/UString.h: + (JSC::UString::Rep::createEmptyBuffer): + * wtf/FastMalloc.cpp: + (WTF::tryFastZeroedMalloc): + (WTF::tryFastMalloc): + (WTF::tryFastCalloc): + (WTF::tryFastRealloc): + (WTF::TCMallocStats::tryFastMalloc): + (WTF::TCMallocStats::tryFastCalloc): + (WTF::TCMallocStats::tryFastRealloc): + * wtf/FastMalloc.h: + (WTF::TryMallocReturnValue::TryMallocReturnValue): + (WTF::TryMallocReturnValue::~TryMallocReturnValue): + (WTF::TryMallocReturnValue::operator PossiblyNull<T>): + (WTF::TryMallocReturnValue::getValue): + * wtf/Platform.h: + * wtf/PossiblyNull.h: Added. + (WTF::PossiblyNull::PossiblyNull): + (WTF::PossiblyNull::~PossiblyNull): + (WTF::::getValue): + +2009-08-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (build fix part deux). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by NOBODY (build fix). + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Restrict use of FuncDeclNode & FuncExprNode to the parser. + https://bugs.webkit.org/show_bug.cgi?id=28209 + + These objects were also being referenced from the CodeBlock. By changing this + to just retain pointers to FunctionBodyNodes these classes can be restricted to + use during parsing. + + No performance impact (or sub-percent progression). + + * JavaScriptCore.exp: + Update symbols. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::mark): + (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): + (JSC::CodeBlock::shrinkToFit): + * bytecode/CodeBlock.h: + (JSC::CodeBlock::addFunction): + (JSC::CodeBlock::function): + Unify m_functions & m_functionExpressions into a single Vector<RefPtr<FuncExprNode> >. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + (JSC::BytecodeGenerator::addConstant): + (JSC::BytecodeGenerator::emitNewFunction): + (JSC::BytecodeGenerator::emitNewFunctionExpression): + * bytecompiler/BytecodeGenerator.h: + FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + (JSC::Interpreter::privateExecute): + Update to reflect chnages in CodeBlock. + + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_new_func_exp): + * jit/JITStubs.cpp: + (JSC::DEFINE_STUB_FUNCTION): + * jit/JITStubs.h: + (JSC::): + Update to reflect chnages in CodeBlock. + + * parser/Grammar.y: + FunctionStacks now contain FunctionBodyNodes not FuncDeclNodes. + + * parser/NodeConstructors.h: + (JSC::FuncExprNode::FuncExprNode): + (JSC::FuncDeclNode::FuncDeclNode): + * parser/Nodes.cpp: + (JSC::ScopeNodeData::mark): + (JSC::FunctionBodyNode::finishParsing): + * parser/Nodes.h: + (JSC::FunctionBodyNode::ident): + Move m_ident & make methods from FuncDeclNode & FuncExprNode to FunctionBodyNode. + + * runtime/JSFunction.h: + (JSC::FunctionBodyNode::make): + Make this method inline (was FuncDeclNode::makeFunction). + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Native JSON.stringify does not omit functions + https://bugs.webkit.org/show_bug.cgi?id=28117 + + Objects that are callable should be treated as undefined when + serialising to JSON. + + * runtime/JSONObject.cpp: + (JSC::Stringifier::appendStringifiedValue): + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Geoff Garen. + + REGRESSION: Hang/crash in BytecodeGenerator::constRegisterFor loading simple page + https://bugs.webkit.org/show_bug.cgi?id=28169 + + Handle the case where someone has attempted to shadow a property + on the global object with a constant. + + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::constRegisterFor): + * parser/Nodes.cpp: + (JSC::ConstDeclNode::emitCodeSingle): + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25463 + + Adds ENABLE_NOTIFICATION flag. + + * Configurations/FeatureDefines.xcconfig: + * wtf/Platform.h: + +2009-08-11 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + Modifications on JavaScriptCore to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28121 + + * runtime/Collector.cpp: Haiku doesn't have sys/mman.h, using OS.h instead. + (JSC::currentThreadStackBase): Haiku uses its own threading system. + * wtf/Platform.h: Defining all Haiku platform values. + * wtf/haiku/MainThreadHaiku.cpp: Adding a missing header (NotImplemented.h). + +2009-08-11 Jessie Berlin <jberlin@apple.com> + + Reviewed by Adam Roben. + + Fix windows build. + + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: + +2009-08-11 Csaba Osztrogonac <oszi@inf.u-szeged.hu> + + Reviewed by Tor Arne Vestbø. + + Buildfix for Qt-win platforms. + + * JavaScriptCore.pri: Choose MarkStackPosix.cpp or MarkStackWin.cpp depend on platform. + 2009-08-10 Oliver Hunt <oliver@apple.com> Reviewed by NOBODY (And another build fix). diff --git a/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 10328e8..d4ec563 100644 --- a/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -36,10 +36,12 @@ ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ENABLE_DATAGRID; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; +ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ; ENABLE_GEOLOCATION = ; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; +ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_RUBY = ENABLE_RUBY; ENABLE_SHARED_WORKERS = ; @@ -57,4 +59,4 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am index 6b4dc6d..b20c0cd 100644 --- a/JavaScriptCore/GNUmakefile.am +++ b/JavaScriptCore/GNUmakefile.am @@ -193,7 +193,6 @@ javascriptcore_sources += \ JavaScriptCore/runtime/LiteralParser.h \ JavaScriptCore/runtime/MarkStack.cpp \ JavaScriptCore/runtime/MarkStack.h \ - JavaScriptCore/runtime/MarkStackPosix.cpp \ JavaScriptCore/runtime/SmallStrings.cpp \ JavaScriptCore/runtime/SmallStrings.h \ JavaScriptCore/runtime/Structure.cpp \ @@ -288,10 +287,12 @@ javascriptcore_sources += \ if TARGET_WIN32 javascriptcore_sources += \ JavaScriptCore/wtf/ThreadSpecificWin.cpp \ - JavaScriptCore/jit/ExecutableAllocatorWin.cpp + JavaScriptCore/jit/ExecutableAllocatorWin.cpp \ + JavaScriptCore/runtime/MarkStackWin.cpp else javascriptcore_sources += \ - JavaScriptCore/jit/ExecutableAllocatorPosix.cpp + JavaScriptCore/jit/ExecutableAllocatorPosix.cpp \ + JavaScriptCore/runtime/MarkStackPosix.cpp endif # ---- @@ -393,6 +394,7 @@ javascriptcore_sources += \ JavaScriptCore/runtime/ErrorInstance.h \ JavaScriptCore/runtime/ErrorPrototype.cpp \ JavaScriptCore/runtime/ErrorPrototype.h \ + JavaScriptCore/runtime/Executable.cpp \ JavaScriptCore/runtime/FunctionConstructor.cpp \ JavaScriptCore/runtime/FunctionConstructor.h \ JavaScriptCore/runtime/FunctionPrototype.cpp \ @@ -439,9 +441,6 @@ javascriptcore_sources += \ JavaScriptCore/runtime/JSWrapperObject.h \ JavaScriptCore/runtime/Lookup.cpp \ JavaScriptCore/runtime/Lookup.h \ - JavaScriptCore/runtime/MarkStack.cpp \ - JavaScriptCore/runtime/MarkStack.h \ - JavaScriptCore/runtime/MarkStackWin.cpp \ JavaScriptCore/runtime/MathObject.cpp \ JavaScriptCore/runtime/MathObject.h \ JavaScriptCore/runtime/NativeErrorConstructor.cpp \ diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp index 3a2acd7..8351f83 100644 --- a/JavaScriptCore/JavaScriptCore.exp +++ b/JavaScriptCore/JavaScriptCore.exp @@ -95,7 +95,6 @@ __ZN3JSC10Identifier24checkSameIdentifierTableEPNS_12JSGlobalDataEPNS_7UString3R __ZN3JSC10Identifier24checkSameIdentifierTableEPNS_9ExecStateEPNS_7UString3RepE __ZN3JSC10Identifier3addEPNS_9ExecStateEPKc __ZN3JSC10Identifier5equalEPKNS_7UString3RepEPKc -__ZN3JSC10JSFunction4infoE __ZN3JSC10JSFunctionC1EPNS_9ExecStateEN3WTF10PassRefPtrINS_9StructureEEEiRKNS_10IdentifierEPFNS_7JSValueES2_PNS_8JSObjectESA_RKNS_7ArgListEE __ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeE __ZN3JSC10throwErrorEPNS_9ExecStateENS_9ErrorTypeEPKc @@ -143,9 +142,9 @@ __ZN3JSC14TimeoutChecker5resetEv __ZN3JSC14constructArrayEPNS_9ExecStateERKNS_7ArgListE __ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE __ZN3JSC15toInt32SlowCaseEdRb -__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEm +__ZN3JSC16FunctionBodyNode13finishParsingEPNS_10IdentifierEmRKS1_ __ZN3JSC16FunctionBodyNode14copyParametersEv -__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPNS_12FuncDeclNodeELm0EEERKNS_10SourceCodeEji +__ZN3JSC16FunctionBodyNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm0EEEPNS6_IPS0_Lm0EEERKNS_10SourceCodeEji __ZN3JSC16InternalFunction4infoE __ZN3JSC16InternalFunction4nameEPNS_12JSGlobalDataE __ZN3JSC16InternalFunctionC2EPNS_12JSGlobalDataEN3WTF10PassRefPtrINS_9StructureEEERKNS_10IdentifierE @@ -196,8 +195,8 @@ __ZN3JSC6JSCell3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutProper __ZN3JSC6JSCell3putEPNS_9ExecStateEjNS_7JSValueE __ZN3JSC6JSCell9getObjectEv __ZN3JSC6JSCellnwEmPNS_9ExecStateE -__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE __ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE +__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE __ZN3JSC6JSLock12DropAllLocksD1Ev __ZN3JSC6JSLock4lockENS_14JSLockBehaviorE __ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE @@ -227,9 +226,9 @@ __ZN3JSC7UString6appendERKS0_ __ZN3JSC7UStringC1EPKc __ZN3JSC7UStringC1EPKti __ZN3JSC7UStringaSEPKc +__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE __ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE __ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE -__ZN3JSC8DebuggerC2Ev __ZN3JSC8DebuggerD2Ev __ZN3JSC8JSObject11hasInstanceEPNS_9ExecStateENS_7JSValueES3_ __ZN3JSC8JSObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPS0_ @@ -324,14 +323,13 @@ __ZN3WTF8CollatorC1EPKc __ZN3WTF8CollatorD1Ev __ZN3WTF8fastFreeEPv __ZN3WTF9ByteArray6createEm +__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv __ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_16InternalFunctionE __ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE __ZNK3JSC12DateInstance7getTimeERdRi __ZNK3JSC12StringObject12toThisStringEPNS_9ExecStateE __ZNK3JSC12StringObject8toStringEPNS_9ExecStateE __ZNK3JSC14JSGlobalObject14isDynamicScopeEv - -__ZNK3JSC16FunctionBodyNode14isHostFunctionEv __ZNK3JSC16InternalFunction9classInfoEv __ZNK3JSC16JSVariableObject16isVariableObjectEv __ZNK3JSC16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj @@ -379,6 +377,7 @@ __ZTVN3JSC15JSWrapperObjectE __ZTVN3JSC16InternalFunctionE __ZTVN3JSC16JSVariableObjectE __ZTVN3JSC17JSAPIValueWrapperE +__ZTVN3JSC8DebuggerE __ZTVN3JSC8JSObjectE __ZTVN3JSC8JSStringE _jscore_fastmalloc_introspection diff --git a/JavaScriptCore/JavaScriptCore.pri b/JavaScriptCore/JavaScriptCore.pri index dd48c9a..490f020 100644 --- a/JavaScriptCore/JavaScriptCore.pri +++ b/JavaScriptCore/JavaScriptCore.pri @@ -99,7 +99,6 @@ SOURCES += \ runtime/JSONObject.cpp \ runtime/LiteralParser.cpp \ runtime/MarkStack.cpp \ - runtime/MarkStackPosix.cpp \ runtime/TimeoutChecker.cpp \ bytecode/CodeBlock.cpp \ bytecode/StructureStubInfo.cpp \ @@ -123,8 +122,13 @@ SOURCES += \ yarr/RegexJIT.cpp \ interpreter/RegisterFile.cpp -win32-*: SOURCES += jit/ExecutableAllocatorWin.cpp -else: SOURCES += jit/ExecutableAllocatorPosix.cpp +win32-* { + SOURCES += jit/ExecutableAllocatorWin.cpp \ + runtime/MarkStackWin.cpp +} else { + SOURCES += jit/ExecutableAllocatorPosix.cpp \ + runtime/MarkStackPosix.cpp +} # AllInOneFile.cpp helps gcc analize and optimize code # Other compilers may be able to do this at link time @@ -154,6 +158,7 @@ SOURCES += \ runtime/ErrorInstance.cpp \ runtime/ErrorPrototype.cpp \ interpreter/CallFrame.cpp \ + runtime/Executable.cpp \ runtime/FunctionConstructor.cpp \ runtime/FunctionPrototype.cpp \ runtime/GetterSetter.cpp \ diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 0de51bf..9f73d6d 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -1,13 +1,7 @@ LIBRARY "JavaScriptCore" EXPORTS - ?from@UString@JSC@@SA?AV12@N@Z - ?nonInlineNaN@JSC@@YANXZ - ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z - ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z - ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ??0Collator@WTF@@QAE@PBD@Z - ??0Debugger@JSC@@QAE@XZ ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z @@ -47,7 +41,6 @@ EXPORTS ?allocate@Heap@JSC@@QAEPAXI@Z ?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z ?allocateStack@MarkStack@JSC@@CAPAXI@Z - ?allocateStack@MarkStack@JSC@@CAPAXI@Z ?append@UString@JSC@@QAEAAV12@ABV12@@Z ?append@UString@JSC@@QAEAAV12@PBD@Z ?ascii@UString@JSC@@QBEPADXZ @@ -75,7 +68,7 @@ EXPORTS ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z ?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ ?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z - ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z + ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFunctionBodyNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z ?create@Rep@UString@JSC@@SA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PA_WHV?$PassRefPtr@V?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@@5@@Z @@ -120,10 +113,11 @@ EXPORTS ?fastRealloc@WTF@@YAPAXPAXI@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z - ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@I@Z + ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@IABV32@@Z ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z ?from@UString@JSC@@SA?AV12@H@Z ?from@UString@JSC@@SA?AV12@I@Z + ?from@UString@JSC@@SA?AV12@N@Z ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ ?get@Structure@JSC@@QAEIPBURep@UString@2@AAIAAPAVJSCell@2@@Z ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z @@ -164,7 +158,7 @@ EXPORTS ?isBusy@Heap@JSC@@QAE_NXZ ?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ ?isGetterSetter@JSCell@JSC@@UBE_NXZ - ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ + ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ ?isMainThread@WTF@@YA_NXZ ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ ?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z @@ -183,6 +177,7 @@ EXPORTS ?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@2@@Z ?materializePropertyMap@Structure@JSC@@AAEXXZ ?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z + ?nonInlineNaN@JSC@@YANXZ ?objectCount@Heap@JSC@@QAEIXZ ?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z ?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z @@ -206,6 +201,7 @@ EXPORTS ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z ?randomNumber@WTF@@YANXZ + ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z ?recordExtraCost@Heap@JSC@@AAEXI@Z ?releaseStack@MarkStack@JSC@@CAXPAXI@Z ?reset@ParserArena@JSC@@QAEXXZ @@ -228,6 +224,7 @@ EXPORTS ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z ?strtod@WTF@@YANPBDPAPAD@Z ?substr@UString@JSC@@QBE?AV12@HH@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 @@ -245,6 +242,7 @@ EXPORTS ?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z ?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z ?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z + ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ?toPrimitive@JSAPIValueWrapper@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z ?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z ?toStrictUInt32@UString@JSC@@QBEIPA_N@Z @@ -258,13 +256,14 @@ EXPORTS ?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z ?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z ?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z + ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ?toThisString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z ?toThisString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z ?toThisString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z ?toUInt32@UString@JSC@@QBEIPA_N@Z ?toUInt32@UString@JSC@@QBEIPA_N_N@Z ?toUInt32SlowCase@JSC@@YAINAA_N@Z - ?tryFastCalloc@WTF@@YAPAXII@Z + ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z ?tryLock@Mutex@WTF@@QAE_NXZ ?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ ?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index 1c5e963..4aae5b2 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -644,6 +644,10 @@ >
</File>
<File
+ RelativePath="..\..\runtime\Executable.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\runtime\FunctionConstructor.cpp"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops index 5f90011..ba6bbfd 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops @@ -21,7 +21,7 @@ /> <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCPreLinkEventTool" diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj index 954045e..eb8e44c 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.vcproj @@ -23,9 +23,9 @@ > <Tool Name="VCNMakeTool" - BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

nmake /nologo -f JavaScriptCoreGenerated.make" - ReBuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

nmake /nologo -f JavaScriptCoreGenerated.make clean
nmake -f JavaScriptCoreGenerated.make" - CleanCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

nmake /nologo -f JavaScriptCoreGenerated.make clean" + BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

nmake /nologo -f JavaScriptCoreGenerated.make" + ReBuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

nmake /nologo -f JavaScriptCoreGenerated.make clean
nmake -f JavaScriptCoreGenerated.make" + CleanCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

nmake /nologo -f JavaScriptCoreGenerated.make clean" Output="" PreprocessorDefinitions="WIN32;NDEBUG" IncludeSearchPath="" diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def index 65998ca..8ec1aec 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def @@ -1,13 +1,7 @@ LIBRARY "JavaScriptCore_debug" EXPORTS - ?from@UString@JSC@@SA?AV12@N@Z - ?nonInlineNaN@JSC@@YANXZ - ?synthesizePrototype@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z - ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z - ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ??0Collator@WTF@@QAE@PBD@Z - ??0Debugger@JSC@@QAE@XZ ??0DropAllLocks@JSLock@JSC@@QAE@W4JSLockBehavior@2@@Z ??0InternalFunction@JSC@@IAE@PAVJSGlobalData@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@ABVIdentifier@1@@Z ??0JSByteArray@JSC@@QAE@PAVExecState@1@V?$PassRefPtr@VStructure@JSC@@@WTF@@PAVByteArray@4@PBUClassInfo@1@@Z @@ -46,6 +40,7 @@ EXPORTS ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PAVJSGlobalData@2@PAURep@UString@2@@Z ?allocate@Heap@JSC@@QAEPAXI@Z ?allocatePropertyStorage@JSObject@JSC@@QAEXII@Z + ?allocateStack@MarkStack@JSC@@CAPAXI@Z ?append@UString@JSC@@QAEAAV12@ABV12@@Z ?append@UString@JSC@@QAEAAV12@PBD@Z ?ascii@UString@JSC@@QBEPADXZ @@ -73,7 +68,7 @@ EXPORTS ?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z ?copyParameters@FunctionBodyNode@JSC@@QAEPAVIdentifier@2@XZ ?create@ByteArray@WTF@@SA?AV?$PassRefPtr@VByteArray@WTF@@@2@I@Z - ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFuncDeclNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z + ?create@FunctionBodyNode@JSC@@SA?AV?$PassRefPtr@VFunctionBodyNode@JSC@@@WTF@@PAVJSGlobalData@2@PAVSourceElements@2@PAV?$Vector@U?$pair@VIdentifier@JSC@@I@std@@$0A@@4@PAV?$Vector@PAVFunctionBodyNode@JSC@@$0A@@4@ABVSourceCode@2@IH@Z ?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@_N@Z ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z ?create@Rep@UString@JSC@@SA?AV?$PassRefPtr@URep@UString@JSC@@@WTF@@PA_WHV?$PassRefPtr@V?$CrossThreadRefCounted@V?$OwnFastMallocPtr@_W@WTF@@@WTF@@@5@@Z @@ -118,10 +113,11 @@ EXPORTS ?fastRealloc@WTF@@YAPAXPAXI@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z - ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@I@Z + ?finishParsing@FunctionBodyNode@JSC@@QAEXPAVIdentifier@2@IABV32@@Z ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z ?from@UString@JSC@@SA?AV12@H@Z ?from@UString@JSC@@SA?AV12@I@Z + ?from@UString@JSC@@SA?AV12@N@Z ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ ?get@Structure@JSC@@QAEIPBURep@UString@2@AAIAAPAVJSCell@2@@Z ?getCallData@JSCell@JSC@@UAE?AW4CallType@2@AATCallData@2@@Z @@ -162,7 +158,7 @@ EXPORTS ?isBusy@Heap@JSC@@QAE_NXZ ?isDynamicScope@JSGlobalObject@JSC@@UBE_NXZ ?isGetterSetter@JSCell@JSC@@UBE_NXZ - ?isHostFunction@FunctionBodyNode@JSC@@QBE_NXZ + ?isHostFunctionNonInline@JSFunction@JSC@@ABE_NXZ ?isMainThread@WTF@@YA_NXZ ?isVariableObject@JSVariableObject@JSC@@UBE_NXZ ?jsNumberCell@JSC@@YA?AVJSValue@1@PAVExecState@1@N@Z @@ -181,6 +177,7 @@ EXPORTS ?markChildren@JSWrapperObject@JSC@@UAEXAAVMarkStack@2@@Z ?materializePropertyMap@Structure@JSC@@AAEXXZ ?name@InternalFunction@JSC@@QAEABVUString@2@PAVJSGlobalData@2@@Z + ?nonInlineNaN@JSC@@YANXZ ?objectCount@Heap@JSC@@QAEIXZ ?objectProtoFuncToString@JSC@@YI?AVJSValue@1@PAVExecState@1@PAVJSObject@1@V21@ABVArgList@1@@Z ?parse@Parser@JSC@@AAEXPAVJSGlobalData@2@PAHPAVUString@2@@Z @@ -204,6 +201,7 @@ EXPORTS ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@ABVIdentifier@2@VJSValue@2@I_NAAVPutPropertySlot@2@@Z ?putWithAttributes@JSObject@JSC@@UAEXPAVExecState@2@IVJSValue@2@I@Z ?randomNumber@WTF@@YANXZ + ?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z ?recordExtraCost@Heap@JSC@@AAEXI@Z ?releaseStack@MarkStack@JSC@@CAXPAXI@Z ?reset@ParserArena@JSC@@QAEXXZ @@ -226,6 +224,7 @@ EXPORTS ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z ?strtod@WTF@@YANPBDPAPAD@Z ?substr@UString@JSC@@QBE?AV12@HH@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 @@ -243,6 +242,7 @@ EXPORTS ?toObject@JSAPIValueWrapper@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z ?toObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z ?toObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z + ?toObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ?toPrimitive@JSAPIValueWrapper@JSC@@UBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z ?toPrimitive@JSString@JSC@@EBE?AVJSValue@2@PAVExecState@2@W4PreferredPrimitiveType@2@@Z ?toStrictUInt32@UString@JSC@@QBEIPA_N@Z @@ -256,13 +256,14 @@ EXPORTS ?toThisObject@JSCell@JSC@@UBEPAVJSObject@2@PAVExecState@2@@Z ?toThisObject@JSObject@JSC@@UBEPAV12@PAVExecState@2@@Z ?toThisObject@JSString@JSC@@EBEPAVJSObject@2@PAVExecState@2@@Z + ?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z ?toThisString@JSCell@JSC@@UBE?AVUString@2@PAVExecState@2@@Z ?toThisString@JSString@JSC@@EBE?AVUString@2@PAVExecState@2@@Z ?toThisString@StringObject@JSC@@EBE?AVUString@2@PAVExecState@2@@Z ?toUInt32@UString@JSC@@QBEIPA_N@Z ?toUInt32@UString@JSC@@QBEIPA_N_N@Z ?toUInt32SlowCase@JSC@@YAINAA_N@Z - ?tryFastCalloc@WTF@@YAPAXII@Z + ?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z ?tryLock@Mutex@WTF@@QAE_NXZ ?type@DebuggerCallFrame@JSC@@QBE?AW4Type@12@XZ ?unlock@JSLock@JSC@@SAXW4JSLockBehavior@2@@Z diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops index 20b32f3..d78ff43 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops +++ b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTFCommon.vsprops @@ -1,26 +1,26 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioPropertySheet - ProjectType="Visual C++" - Version="8.00" - Name="WTFCommon" - OutputDirectory="$(WebKitOutputDir)\lib" - > - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads"" - PreprocessorDefinitions="__STD_C" - /> - <Tool - Name="VCLibrarianTool" - AdditionalDependencies="user32.lib" - OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib" - /> - <Tool - Name="VCPostBuildEventTool" - CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"" - /> - <Tool - Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%" - /> -</VisualStudioPropertySheet> +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioPropertySheet
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="WTFCommon"
+ OutputDirectory="$(WebKitOutputDir)\lib"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(WebKitOutputDir)\obj\JavaScriptCore\$(ConfigurationName)\DerivedSources\";../../;"../../os-win32/";../../pcre/;../../parser/;../../wtf/;../../wtf/unicode/;"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\icu";../../../icu/include;../../bindings;../../bindings/c;../../bindings/jni;"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\include\pthreads""
+ PreprocessorDefinitions="__STD_C"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ AdditionalDependencies="user32.lib"
+ OutputFile="$(OutDir)\$(ProjectName)$(WebKitConfigSuffix).lib"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed""
+ />
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c"
+ />
+</VisualStudioPropertySheet>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops index 3a1e42e..7e8a193 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops +++ b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jscCommon.vsprops @@ -20,6 +20,6 @@ /> <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
" /> </VisualStudioPropertySheet> diff --git a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops index 2a36c18..738d4d5 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops +++ b/JavaScriptCore/JavaScriptCore.vcproj/testapi/testapiCommon.vsprops @@ -21,6 +21,6 @@ /> <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"
" /> </VisualStudioPropertySheet> diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 6c3d49f..973e3a3 100644 --- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -95,7 +95,7 @@ 14BD5A300A3E91F600BAF59C /* JSContextRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A290A3E91F600BAF59C /* JSContextRef.cpp */; }; 14BD5A320A3E91F600BAF59C /* JSValueRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14BD5A2B0A3E91F600BAF59C /* JSValueRef.cpp */; }; 14C5242B0F5355E900BA3D04 /* JITStubs.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A6581A0F4E36F4000150FD /* JITStubs.h */; settings = {ATTRIBUTES = (Private, ); }; }; - 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 14F3488F0E95EF8A003648BC /* CollectorHeapIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3488E0E95EF8A003648BC /* CollectorHeapIterator.h */; settings = {ATTRIBUTES = (); }; }; 180B9B080F16D94F009BDBC5 /* CurrentTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 180B9AF00F16C569009BDBC5 /* CurrentTime.h */; settings = {ATTRIBUTES = (Private, ); }; }; 180B9BFE0F16E94D009BDBC5 /* CurrentTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 180B9AEF0F16C569009BDBC5 /* CurrentTime.cpp */; }; 1C61516C0EBAC7A00031376F /* ProfilerServer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C61516A0EBAC7A00031376F /* ProfilerServer.mm */; settings = {COMPILER_FLAGS = "-fno-strict-aliasing"; }; }; @@ -132,6 +132,8 @@ 86ADD1450FDDEA980006EEC2 /* ARMv7Assembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */; }; 86ADD1460FDDEA980006EEC2 /* MacroAssemblerARMv7.h in Headers */ = {isa = PBXBuildFile; fileRef = 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */; }; 86C36EEA0EE1289D00B3DF59 /* MacroAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */; }; + 86CA032E1038E8440028A609 /* Executable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CA032D1038E8440028A609 /* Executable.cpp */; }; + 86CAFEE31035DDE60028A609 /* Executable.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CAFEE21035DDE60028A609 /* Executable.h */; settings = {ATTRIBUTES = (Private, ); }; }; 86CC85A10EE79A4700288682 /* JITInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = 86CC85A00EE79A4700288682 /* JITInlineMethods.h */; }; 86CC85A30EE79B7400288682 /* JITCall.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85A20EE79B7400288682 /* JITCall.cpp */; }; 86CC85C40EE7A89400288682 /* JITPropertyAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */; }; @@ -207,11 +209,11 @@ A7A1F7AD0F252B3C00E184E2 /* ByteArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A7A1F7AB0F252B3C00E184E2 /* ByteArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7B48F490EE8936F00DCBDB6 /* ExecutableAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */; }; A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */; }; + A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D649A91015224E009B2E1B /* PossiblyNull.h */; settings = {ATTRIBUTES = (Private, ); }; }; A7E2EA6B0FB460CF00601F06 /* LiteralParser.h in Headers */ = {isa = PBXBuildFile; fileRef = A7E2EA690FB460CF00601F06 /* LiteralParser.h */; }; A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */; }; A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9935D0FD7325100A0B2D0 /* JSONObject.h */; }; A7F993600FD7325100A0B2D0 /* JSONObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7F9935E0FD7325100A0B2D0 /* JSONObject.cpp */; }; - A7F9949B0FD746A300A0B2D0 /* JSONObject.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = A7F9949A0FD746A300A0B2D0 /* JSONObject.lut.h */; }; BC02E90D0E1839DB000F9297 /* ErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9050E1839DB000F9297 /* ErrorConstructor.h */; }; BC02E90F0E1839DB000F9297 /* ErrorPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9070E1839DB000F9297 /* ErrorPrototype.h */; }; BC02E9110E1839DB000F9297 /* NativeErrorConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC02E9090E1839DB000F9297 /* NativeErrorConstructor.h */; }; @@ -304,7 +306,7 @@ BC18C4480E16F5CD00B34460 /* Operations.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8780255597D01FF60F7 /* Operations.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C4490E16F5CD00B34460 /* OwnArrayPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F5A409911A5800AD71B8 /* OwnArrayPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C44A0E16F5CD00B34460 /* OwnPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 9303F567099118FA00AD71B8 /* OwnPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; - BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (Private, ); }; }; + BC18C44B0E16F5CD00B34460 /* Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F0B3AA09BB4DC00068FCE3 /* Parser.h */; settings = {ATTRIBUTES = (); }; }; BC18C44C0E16F5CD00B34460 /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6580F795094070560082C219 /* PassRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C44D0E16F5CD00B34460 /* pcre.h in Headers */ = {isa = PBXBuildFile; fileRef = 6541720F039E08B90058BFEB /* pcre.h */; settings = {ATTRIBUTES = (Private, ); }; }; BC18C44E0E16F5CD00B34460 /* pcre_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E26BE508B1517100F85226 /* pcre_internal.h */; }; @@ -646,6 +648,8 @@ 86ADD1430FDDEA980006EEC2 /* ARMv7Assembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARMv7Assembler.h; sourceTree = "<group>"; }; 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerARMv7.h; sourceTree = "<group>"; }; 86C36EE90EE1289D00B3DF59 /* MacroAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssembler.h; sourceTree = "<group>"; }; + 86CA032D1038E8440028A609 /* Executable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Executable.cpp; sourceTree = "<group>"; }; + 86CAFEE21035DDE60028A609 /* Executable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Executable.h; sourceTree = "<group>"; }; 86CC85A00EE79A4700288682 /* JITInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITInlineMethods.h; sourceTree = "<group>"; }; 86CC85A20EE79B7400288682 /* JITCall.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITCall.cpp; sourceTree = "<group>"; }; 86CC85C30EE7A89400288682 /* JITPropertyAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JITPropertyAccess.cpp; sourceTree = "<group>"; }; @@ -752,6 +756,7 @@ A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecutableAllocator.h; sourceTree = "<group>"; }; A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocator.cpp; sourceTree = "<group>"; }; A7C530E3102A3813005BC741 /* MarkStackPosix.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStackPosix.cpp; sourceTree = "<group>"; }; + A7D649A91015224E009B2E1B /* PossiblyNull.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PossiblyNull.h; sourceTree = "<group>"; }; A7E2EA690FB460CF00601F06 /* LiteralParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiteralParser.h; sourceTree = "<group>"; }; A7E2EA6A0FB460CF00601F06 /* LiteralParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LiteralParser.cpp; sourceTree = "<group>"; }; A7E42C180E3938830065A544 /* JSStaticScopeObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStaticScopeObject.h; sourceTree = "<group>"; }; @@ -1242,6 +1247,7 @@ 44DD48520FAEA85000D6B4EB /* PassOwnPtr.h */, 6580F795094070560082C219 /* PassRefPtr.h */, 65D6D87E09B5A32E0002E4D7 /* Platform.h */, + A7D649A91015224E009B2E1B /* PossiblyNull.h */, 0B1F921B0F17502D0036468E /* PtrAndFlags.h */, 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */, 088FA5BA0EF76D4300578E6F /* RandomNumber.h */, @@ -1375,6 +1381,8 @@ BC02E9070E1839DB000F9297 /* ErrorPrototype.h */, 1429D8770ED21ACD00B89619 /* ExceptionHelpers.cpp */, A72701B30DADE94900E548D7 /* ExceptionHelpers.h */, + 86CA032D1038E8440028A609 /* Executable.cpp */, + 86CAFEE21035DDE60028A609 /* Executable.h */, BC2680C00E16D4E900A06E92 /* FunctionConstructor.cpp */, BC2680C10E16D4E900A06E92 /* FunctionConstructor.h */, F692A85C0255597D01FF60F7 /* FunctionPrototype.cpp */, @@ -1760,7 +1768,6 @@ BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */, BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */, A7F9935F0FD7325100A0B2D0 /* JSONObject.h in Headers */, - A7F9949B0FD746A300A0B2D0 /* JSONObject.lut.h in Headers */, 9534AAFB0E5B7A9600B8A45B /* JSProfilerPrivate.h in Headers */, BC18C4260E16F5CD00B34460 /* JSRetainPtr.h in Headers */, BC18C4270E16F5CD00B34460 /* JSString.h in Headers */, @@ -1902,6 +1909,8 @@ 1429DABF0ED263E700B89619 /* WRECParser.h in Headers */, 9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */, A7795590101A74D500114E55 /* MarkStack.h in Headers */, + A7D649AA1015224E009B2E1B /* PossiblyNull.h in Headers */, + 86CAFEE31035DDE60028A609 /* Executable.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2270,6 +2279,7 @@ 1429DAC00ED263E700B89619 /* WRECParser.cpp in Sources */, A7C530E4102A3813005BC741 /* MarkStackPosix.cpp in Sources */, A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */, + 86CA032E1038E8440028A609 /* Executable.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/JavaScriptCore/assembler/ARMAssembler.cpp b/JavaScriptCore/assembler/ARMAssembler.cpp index 69daa16..c8b07fc 100644 --- a/JavaScriptCore/assembler/ARMAssembler.cpp +++ b/JavaScriptCore/assembler/ARMAssembler.cpp @@ -49,11 +49,11 @@ ARMWord* ARMAssembler::getLdrImmAddress(ARMWord* insn, uint32_t* constPool) return reinterpret_cast<ARMWord*>(addr - (*insn & SDT_OFFSET_MASK)); } -void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to) +void ARMAssembler::linkBranch(void* code, JmpSrc from, void* to, int useConstantPool) { ARMWord* insn = reinterpret_cast<ARMWord*>(code) + (from.m_offset / sizeof(ARMWord)); - if (!from.m_latePatch) { + if (!useConstantPool) { int diff = reinterpret_cast<ARMWord*>(to) - reinterpret_cast<ARMWord*>(insn + 2); if ((diff <= BOFFSET_MAX && diff >= BOFFSET_MIN)) { @@ -367,13 +367,22 @@ void ARMAssembler::doubleTransfer(bool isLoad, FPRegisterID srcDst, RegisterID b void* ARMAssembler::executableCopy(ExecutablePool* allocator) { + // 64-bit alignment is required for next constant pool and JIT code as well + m_buffer.flushWithoutBarrier(true); + if (m_buffer.uncheckedSize() & 0x7) + bkpt(0); + char* data = reinterpret_cast<char*>(m_buffer.executableCopy(allocator)); for (Jumps::Iterator iter = m_jumps.begin(); iter != m_jumps.end(); ++iter) { - ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + *iter); - ARMWord* offset = getLdrImmAddress(ldrAddr); - if (*offset != 0xffffffff) - linkBranch(data, JmpSrc(*iter), data + *offset); + // The last bit is set if the constant must be placed on constant pool. + int pos = (*iter) & (~0x1); + ARMWord* ldrAddr = reinterpret_cast<ARMWord*>(data + pos); + ARMWord offset = *getLdrImmAddress(ldrAddr); + if (offset != 0xffffffff) { + JmpSrc jmpSrc(pos); + linkBranch(data, jmpSrc, data + offset, ((*iter) & 1)); + } } return data; diff --git a/JavaScriptCore/assembler/ARMAssembler.h b/JavaScriptCore/assembler/ARMAssembler.h index d3fe782..0206770 100644 --- a/JavaScriptCore/assembler/ARMAssembler.h +++ b/JavaScriptCore/assembler/ARMAssembler.h @@ -77,7 +77,7 @@ namespace ARM { typedef ARM::RegisterID RegisterID; typedef ARM::FPRegisterID FPRegisterID; typedef AssemblerBufferWithConstantPool<2048, 4, 4, ARMAssembler> ARMBuffer; - typedef WTF::SegmentedVector<int, 64> Jumps; + typedef SegmentedVector<int, 64> Jumps; ARMAssembler() { } @@ -180,20 +180,16 @@ namespace ARM { public: JmpSrc() : m_offset(-1) - , m_latePatch(false) { } - void enableLatePatch() { m_latePatch = true; } private: JmpSrc(int offset) : m_offset(offset) - , m_latePatch(false) { } - int m_offset : 31; - int m_latePatch : 1; + int m_offset; }; class JmpDst { @@ -567,6 +563,11 @@ namespace ARM { m_buffer.ensureSpace(insnSpace, constSpace); } + int sizeOfConstantPool() + { + return m_buffer.sizeOfConstantPool(); + } + JmpDst label() { return JmpDst(m_buffer.size()); @@ -580,11 +581,12 @@ namespace ARM { return label(); } - JmpSrc jmp(Condition cc = AL) + JmpSrc jmp(Condition cc = AL, int useConstantPool = 0) { - int s = size(); + ensureSpace(sizeof(ARMWord), sizeof(ARMWord)); + int s = m_buffer.uncheckedSize(); ldr_un_imm(ARM::pc, 0xffffffff, cc); - m_jumps.append(s); + m_jumps.append(s | (useConstantPool & 0x1)); return JmpSrc(s); } @@ -593,7 +595,7 @@ namespace ARM { // Patching helpers static ARMWord* getLdrImmAddress(ARMWord* insn, uint32_t* constPool = 0); - static void linkBranch(void* code, JmpSrc from, void* to); + static void linkBranch(void* code, JmpSrc from, void* to, int useConstantPool = 0); static void patchPointerInternal(intptr_t from, void* to) { @@ -660,7 +662,7 @@ namespace ARM { static void linkCall(void* code, JmpSrc from, void* to) { - linkBranch(code, from, to); + linkBranch(code, from, to, true); } static void relinkCall(void* from, void* to) diff --git a/JavaScriptCore/assembler/ARMv7Assembler.h b/JavaScriptCore/assembler/ARMv7Assembler.h index f7e2fb4..7cf8873 100644 --- a/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/JavaScriptCore/assembler/ARMv7Assembler.h @@ -442,7 +442,6 @@ public: { } - void enableLatePatch() { } private: JmpSrc(int offset) : m_offset(offset) diff --git a/JavaScriptCore/assembler/AbstractMacroAssembler.h b/JavaScriptCore/assembler/AbstractMacroAssembler.h index f927ed2..525fe98 100644 --- a/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -320,11 +320,6 @@ public: return Call(jump.m_jmp, Linkable); } - void enableLatePatch() - { - m_jmp.enableLatePatch(); - } - JmpSrc m_jmp; private: Flags m_flags; @@ -361,11 +356,6 @@ public: masm->m_assembler.linkJump(m_jmp, label.m_label); } - void enableLatePatch() - { - m_jmp.enableLatePatch(); - } - private: JmpSrc m_jmp; }; diff --git a/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h b/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h index f15b7f3..af3c3be 100644 --- a/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h +++ b/JavaScriptCore/assembler/AssemblerBufferWithConstantPool.h @@ -34,6 +34,8 @@ #include "AssemblerBuffer.h" #include <wtf/SegmentedVector.h> +#define ASSEMBLER_HAS_CONSTANT_POOL 1 + namespace JSC { /* @@ -84,7 +86,7 @@ namespace JSC { template <int maxPoolSize, int barrierSize, int maxInstructionSize, class AssemblerType> class AssemblerBufferWithConstantPool: public AssemblerBuffer { - typedef WTF::SegmentedVector<uint32_t, 512> LoadOffsets; + typedef SegmentedVector<uint32_t, 512> LoadOffsets; public: enum { UniqueConst, @@ -177,6 +179,11 @@ public: return AssemblerBuffer::size(); } + int uncheckedSize() + { + return AssemblerBuffer::size(); + } + void* executableCopy(ExecutablePool* allocator) { flushConstantPool(false); @@ -207,10 +214,10 @@ public: } // This flushing mechanism can be called after any unconditional jumps. - void flushWithoutBarrier() + void flushWithoutBarrier(bool isForced = false) { // Flush if constant pool is more than 60% full to avoid overuse of this function. - if (5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t)) + if (isForced || 5 * m_numConsts > 3 * maxPoolSize / sizeof(uint32_t)) flushConstantPool(false); } @@ -219,6 +226,11 @@ public: return m_pool; } + int sizeOfConstantPool() + { + return m_numConsts; + } + private: void correctDeltas(int insnSize) { @@ -276,7 +288,8 @@ private: { if (m_numConsts == 0) return; - if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t))) + int lastConstDelta = m_lastConstDelta > nextInsnSize ? m_lastConstDelta - nextInsnSize : 0; + if ((m_maxDistance < nextInsnSize + lastConstDelta + barrierSize + (int)sizeof(uint32_t))) flushConstantPool(); } @@ -284,8 +297,8 @@ private: { if (m_numConsts == 0) return; - if ((m_maxDistance < nextInsnSize + m_lastConstDelta + barrierSize + (int)sizeof(uint32_t)) || - (m_numConsts + nextConstSize / sizeof(uint32_t) >= maxPoolSize)) + if ((m_maxDistance < nextInsnSize + m_lastConstDelta + nextConstSize + barrierSize + (int)sizeof(uint32_t)) || + (m_numConsts * sizeof(uint32_t) + nextConstSize >= maxPoolSize)) flushConstantPool(); } diff --git a/JavaScriptCore/assembler/MacroAssemblerARM.h b/JavaScriptCore/assembler/MacroAssemblerARM.h index b04ed13..19cbfcb 100644 --- a/JavaScriptCore/assembler/MacroAssemblerARM.h +++ b/JavaScriptCore/assembler/MacroAssemblerARM.h @@ -324,20 +324,20 @@ public: move(src, dest); } - Jump branch32(Condition cond, RegisterID left, RegisterID right) + Jump branch32(Condition cond, RegisterID left, RegisterID right, int useConstantPool = 0) { m_assembler.cmp_r(left, right); - return Jump(m_assembler.jmp(ARMCondition(cond))); + return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool)); } - Jump branch32(Condition cond, RegisterID left, Imm32 right) + Jump branch32(Condition cond, RegisterID left, Imm32 right, int useConstantPool = 0) { if (right.m_isPointer) { m_assembler.ldr_un_imm(ARM::S0, right.m_value); m_assembler.cmp_r(left, ARM::S0); } else m_assembler.cmp_r(left, m_assembler.getImm(right.m_value, ARM::S0)); - return Jump(m_assembler.jmp(ARMCondition(cond))); + return Jump(m_assembler.jmp(ARMCondition(cond), useConstantPool)); } Jump branch32(Condition cond, RegisterID left, Address right) @@ -497,7 +497,7 @@ public: Call nearCall() { prepareCall(); - return Call(m_assembler.jmp(), Call::LinkableNear); + return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::LinkableNear); } Call call(RegisterID target) @@ -587,7 +587,7 @@ public: Call call() { prepareCall(); - return Call(m_assembler.jmp(), Call::Linkable); + return Call(m_assembler.jmp(ARMAssembler::AL, true), Call::Linkable); } Call tailRecursiveCall() @@ -610,8 +610,7 @@ public: Jump branchPtrWithPatch(Condition cond, RegisterID left, DataLabelPtr& dataLabel, ImmPtr initialRightValue = ImmPtr(0)) { dataLabel = moveWithPatch(initialRightValue, ARM::S1); - Jump jump = branch32(cond, left, ARM::S1); - jump.enableLatePatch(); + Jump jump = branch32(cond, left, ARM::S1, true); return jump; } @@ -619,8 +618,7 @@ public: { load32(left, ARM::S1); dataLabel = moveWithPatch(initialRightValue, ARM::S0); - Jump jump = branch32(cond, ARM::S0, ARM::S1); - jump.enableLatePatch(); + Jump jump = branch32(cond, ARM::S0, ARM::S1, true); return jump; } @@ -722,9 +720,19 @@ protected: return static_cast<ARMAssembler::Condition>(cond); } + void ensureSpace(int insnSpace, int constSpace) + { + m_assembler.ensureSpace(insnSpace, constSpace); + } + + int sizeOfConstantPool() + { + return m_assembler.sizeOfConstantPool(); + } + void prepareCall() { - m_assembler.ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); + ensureSpace(3 * sizeof(ARMWord), sizeof(ARMWord)); // S0 might be used for parameter passing m_assembler.add_r(ARM::S1, ARM::pc, ARMAssembler::OP2_IMM | 0x4); diff --git a/JavaScriptCore/assembler/X86Assembler.h b/JavaScriptCore/assembler/X86Assembler.h index fb58361..b5b8808 100644 --- a/JavaScriptCore/assembler/X86Assembler.h +++ b/JavaScriptCore/assembler/X86Assembler.h @@ -231,7 +231,6 @@ public: { } - void enableLatePatch() { } private: JmpSrc(int offset) : m_offset(offset) diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp index e22f25a..b63e826 100644 --- a/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/JavaScriptCore/bytecode/CodeBlock.cpp @@ -33,6 +33,8 @@ #include "JIT.h" #include "JSValue.h" #include "Interpreter.h" +#include "JSFunction.h" +#include "JSStaticScopeObject.h" #include "Debugger.h" #include "BytecodeGenerator.h" #include <stdio.h> @@ -1246,11 +1248,11 @@ void CodeBlock::dumpStatistics() #endif } -CodeBlock::CodeBlock(ScopeNode* ownerNode) +CodeBlock::CodeBlock(ExecutableBase* ownerExecutable) : m_numCalleeRegisters(0) , m_numVars(0) , m_numParameters(0) - , m_ownerNode(ownerNode) + , m_ownerExecutable(ownerExecutable) , m_globalData(0) #ifndef NDEBUG , m_instructionCount(0) @@ -1268,17 +1270,17 @@ CodeBlock::CodeBlock(ScopeNode* ownerNode) #endif } -CodeBlock::CodeBlock(ScopeNode* ownerNode, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) +CodeBlock::CodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) : m_numCalleeRegisters(0) , m_numVars(0) , m_numParameters(0) - , m_ownerNode(ownerNode) + , m_ownerExecutable(ownerExecutable) , m_globalData(0) #ifndef NDEBUG , m_instructionCount(0) #endif - , m_needsFullScopeChain(ownerNode->needsActivation()) - , m_usesEval(ownerNode->usesEval()) + , m_needsFullScopeChain(ownerExecutable->needsActivation()) + , m_usesEval(ownerExecutable->usesEval()) , m_isNumericCompareFunction(false) , m_codeType(codeType) , m_source(sourceProvider) @@ -1435,15 +1437,10 @@ void CodeBlock::markAggregate(MarkStack& markStack) markStack.append(m_constantRegisters[i].jsValue()); } - for (size_t i = 0; i < m_functionExpressions.size(); ++i) - m_functionExpressions[i]->body()->markAggregate(markStack); - - if (m_rareData) { - for (size_t i = 0; i < m_rareData->m_functions.size(); ++i) - m_rareData->m_functions[i]->body()->markAggregate(markStack); - - m_rareData->m_evalCodeCache.markAggregate(markStack); - } + for (size_t i = 0; i < m_functionExprs.size(); ++i) + m_functionExprs[i]->markAggregate(markStack); + for (size_t i = 0; i < m_functionDecls.size(); ++i) + m_functionDecls[i]->markAggregate(markStack); } void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame) @@ -1465,56 +1462,7 @@ void CodeBlock::reparseForExceptionInfoIfNecessary(CallFrame* callFrame) scopeChain = scopeChain->next; } - switch (m_codeType) { - case FunctionCode: { - FunctionBodyNode* ownerFunctionBodyNode = static_cast<FunctionBodyNode*>(m_ownerNode); - RefPtr<FunctionBodyNode> newFunctionBody = m_globalData->parser->reparse<FunctionBodyNode>(m_globalData, ownerFunctionBodyNode); - ASSERT(newFunctionBody); - newFunctionBody->finishParsing(ownerFunctionBodyNode->copyParameters(), ownerFunctionBodyNode->parameterCount()); - - m_globalData->scopeNodeBeingReparsed = newFunctionBody.get(); - - CodeBlock& newCodeBlock = newFunctionBody->bytecodeForExceptionInfoReparse(scopeChain, this); - ASSERT(newCodeBlock.m_exceptionInfo); - ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); - -#if ENABLE(JIT) - JIT::compile(m_globalData, &newCodeBlock); - ASSERT(newFunctionBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); -#endif - - m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); - - m_globalData->scopeNodeBeingReparsed = 0; - - break; - } - case EvalCode: { - EvalNode* ownerEvalNode = static_cast<EvalNode*>(m_ownerNode); - RefPtr<EvalNode> newEvalBody = m_globalData->parser->reparse<EvalNode>(m_globalData, ownerEvalNode); - - m_globalData->scopeNodeBeingReparsed = newEvalBody.get(); - - EvalCodeBlock& newCodeBlock = newEvalBody->bytecodeForExceptionInfoReparse(scopeChain, this); - ASSERT(newCodeBlock.m_exceptionInfo); - ASSERT(newCodeBlock.m_instructionCount == m_instructionCount); - -#if ENABLE(JIT) - JIT::compile(m_globalData, &newCodeBlock); - ASSERT(newEvalBody->generatedJITCode().size() == ownerNode()->generatedJITCode().size()); -#endif - - m_exceptionInfo.set(newCodeBlock.m_exceptionInfo.release()); - - m_globalData->scopeNodeBeingReparsed = 0; - - break; - } - default: - // CodeBlocks for Global code blocks are transient and therefore to not gain from - // from throwing out there exception information. - ASSERT_NOT_REACHED(); - } + m_exceptionInfo.set(m_ownerExecutable->reparseExceptionInfo(m_globalData, scopeChain, this)); } HandlerInfo* CodeBlock::handlerForBytecodeOffset(unsigned bytecodeOffset) @@ -1545,7 +1493,7 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco ASSERT(m_exceptionInfo); if (!m_exceptionInfo->m_lineInfo.size()) - return m_ownerNode->source().firstLine(); // Empty function + return m_ownerExecutable->source().firstLine(); // Empty function int low = 0; int high = m_exceptionInfo->m_lineInfo.size(); @@ -1558,7 +1506,7 @@ int CodeBlock::lineNumberForBytecodeOffset(CallFrame* callFrame, unsigned byteco } if (!low) - return m_ownerNode->source().firstLine(); + return m_ownerExecutable->source().firstLine(); return m_exceptionInfo->m_lineInfo[low - 1].lineNumber; } @@ -1701,18 +1649,6 @@ bool CodeBlock::hasGlobalResolveInfoAtBytecodeOffset(unsigned bytecodeOffset) } #endif -#if ENABLE(JIT) -void CodeBlock::setJITCode(JITCode jitCode) -{ - ASSERT(m_codeType != NativeCode); - ownerNode()->setJITCode(jitCode); -#if !ENABLE(OPCODE_SAMPLING) - if (!BytecodeGenerator::dumpsGeneratedCode()) - m_instructions.clear(); -#endif -} -#endif - void CodeBlock::shrinkToFit() { m_instructions.shrinkToFit(); @@ -1728,7 +1664,8 @@ void CodeBlock::shrinkToFit() #endif m_identifiers.shrinkToFit(); - m_functionExpressions.shrinkToFit(); + m_functionDecls.shrinkToFit(); + m_functionExprs.shrinkToFit(); m_constantRegisters.shrinkToFit(); if (m_exceptionInfo) { @@ -1739,7 +1676,6 @@ void CodeBlock::shrinkToFit() if (m_rareData) { m_rareData->m_exceptionHandlers.shrinkToFit(); - m_rareData->m_functions.shrinkToFit(); m_rareData->m_regexps.shrinkToFit(); m_rareData->m_immediateSwitchJumpTables.shrinkToFit(); m_rareData->m_characterSwitchJumpTables.shrinkToFit(); diff --git a/JavaScriptCore/bytecode/CodeBlock.h b/JavaScriptCore/bytecode/CodeBlock.h index 39b1db3..fdeb4db 100644 --- a/JavaScriptCore/bytecode/CodeBlock.h +++ b/JavaScriptCore/bytecode/CodeBlock.h @@ -248,11 +248,22 @@ namespace JSC { } #endif + struct ExceptionInfo : FastAllocBase { + Vector<ExpressionRangeInfo> m_expressionInfo; + Vector<LineInfo> m_lineInfo; + Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo; + +#if ENABLE(JIT) + Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector; +#endif + }; + class CodeBlock : public FastAllocBase { friend class JIT; + protected: + CodeBlock(ExecutableBase* ownerExecutable); + CodeBlock(ExecutableBase* ownerExecutable, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset); public: - CodeBlock(ScopeNode* ownerNode); - CodeBlock(ScopeNode* ownerNode, CodeType, PassRefPtr<SourceProvider>, unsigned sourceOffset); ~CodeBlock(); void markAggregate(MarkStack&); @@ -329,7 +340,7 @@ namespace JSC { unsigned getBytecodeIndex(CallFrame* callFrame, ReturnAddressPtr returnAddress) { reparseForExceptionInfoIfNecessary(callFrame); - return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerNode()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex; + return binaryChop<CallReturnOffsetToBytecodeIndex, unsigned, getCallReturnOffset>(callReturnIndexVector().begin(), callReturnIndexVector().size(), ownerExecutable()->generatedJITCode().offsetOf(returnAddress.value()))->bytecodeIndex; } bool functionRegisterForBytecodeOffset(unsigned bytecodeOffset, int& functionRegisterIndex); @@ -339,17 +350,19 @@ namespace JSC { bool isNumericCompareFunction() { return m_isNumericCompareFunction; } Vector<Instruction>& instructions() { return m_instructions; } + void discardBytecode() { m_instructions.clear(); } + #ifndef NDEBUG + unsigned instructionCount() { return m_instructionCount; } void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; } #endif #if ENABLE(JIT) - JITCode& getJITCode() { return ownerNode()->generatedJITCode(); } - void setJITCode(JITCode); - ExecutablePool* executablePool() { return ownerNode()->getExecutablePool(); } + JITCode& getJITCode() { return ownerExecutable()->generatedJITCode(); } + ExecutablePool* executablePool() { return ownerExecutable()->getExecutablePool(); } #endif - ScopeNode* ownerNode() const { return m_ownerNode; } + ExecutableBase* ownerExecutable() const { return m_ownerExecutable; } void setGlobalData(JSGlobalData* globalData) { m_globalData = globalData; } @@ -404,6 +417,7 @@ namespace JSC { bool hasExceptionInfo() const { return m_exceptionInfo; } void clearExceptionInfo() { m_exceptionInfo.clear(); } + ExceptionInfo* extractExceptionInfo() { ASSERT(m_exceptionInfo); return m_exceptionInfo.release(); } void addExpressionInfo(const ExpressionRangeInfo& expressionInfo) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_expressionInfo.append(expressionInfo); } void addGetByIdExceptionInfo(const GetByIdExceptionInfo& info) { ASSERT(m_exceptionInfo); m_exceptionInfo->m_getByIdExceptionInfo.append(info); } @@ -428,13 +442,11 @@ namespace JSC { ALWAYS_INLINE bool isConstantRegisterIndex(int index) { return index >= FirstConstantRegisterIndex; } ALWAYS_INLINE JSValue getConstant(int index) const { return m_constantRegisters[index - FirstConstantRegisterIndex].jsValue(); } - unsigned addFunctionExpression(FuncExprNode* n) { unsigned size = m_functionExpressions.size(); m_functionExpressions.append(n); return size; } - FuncExprNode* functionExpression(int index) const { return m_functionExpressions[index].get(); } - - unsigned addFunction(FuncDeclNode* n) { createRareDataIfNecessary(); unsigned size = m_rareData->m_functions.size(); m_rareData->m_functions.append(n); return size; } - FuncDeclNode* function(int index) const { ASSERT(m_rareData); return m_rareData->m_functions[index].get(); } - - bool hasFunctions() const { return m_functionExpressions.size() || (m_rareData && m_rareData->m_functions.size()); } + unsigned addFunctionDecl(PassRefPtr<FunctionExecutable> n) { unsigned size = m_functionDecls.size(); m_functionDecls.append(n); return size; } + FunctionExecutable* functionDecl(int index) { return m_functionDecls[index].get(); } + int numberOfFunctionDecls() { return m_functionDecls.size(); } + unsigned addFunctionExpr(PassRefPtr<FunctionExecutable> n) { unsigned size = m_functionExprs.size(); m_functionExprs.append(n); return size; } + FunctionExecutable* functionExpr(int index) { return m_functionExprs[index].get(); } unsigned addRegExp(RegExp* r) { createRareDataIfNecessary(); unsigned size = m_rareData->m_regexps.size(); m_rareData->m_regexps.append(r); return size; } RegExp* regexp(int index) const { ASSERT(m_rareData); return m_rareData->m_regexps[index].get(); } @@ -481,7 +493,7 @@ namespace JSC { m_rareData.set(new RareData); } - ScopeNode* m_ownerNode; + ExecutableBase* m_ownerExecutable; JSGlobalData* m_globalData; Vector<Instruction> m_instructions; @@ -517,26 +529,17 @@ namespace JSC { // Constant Pool Vector<Identifier> m_identifiers; Vector<Register> m_constantRegisters; - Vector<RefPtr<FuncExprNode> > m_functionExpressions; + Vector<RefPtr<FunctionExecutable> > m_functionDecls; + Vector<RefPtr<FunctionExecutable> > m_functionExprs; SymbolTable m_symbolTable; - struct ExceptionInfo : FastAllocBase { - Vector<ExpressionRangeInfo> m_expressionInfo; - Vector<LineInfo> m_lineInfo; - Vector<GetByIdExceptionInfo> m_getByIdExceptionInfo; - -#if ENABLE(JIT) - Vector<CallReturnOffsetToBytecodeIndex> m_callReturnIndexVector; -#endif - }; OwnPtr<ExceptionInfo> m_exceptionInfo; struct RareData : FastAllocBase { Vector<HandlerInfo> m_exceptionHandlers; // Rare Constants - Vector<RefPtr<FuncDeclNode> > m_functions; Vector<RefPtr<RegExp> > m_regexps; // Jump Tables @@ -556,16 +559,16 @@ namespace JSC { // Program code is not marked by any function, so we make the global object // responsible for marking it. - class ProgramCodeBlock : public CodeBlock { + class GlobalCodeBlock : public CodeBlock { public: - ProgramCodeBlock(ScopeNode* ownerNode, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider) - : CodeBlock(ownerNode, codeType, sourceProvider, 0) + GlobalCodeBlock(ExecutableBase* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset, JSGlobalObject* globalObject) + : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset) , m_globalObject(globalObject) { m_globalObject->codeBlocks().add(this); } - ~ProgramCodeBlock() + ~GlobalCodeBlock() { if (m_globalObject) m_globalObject->codeBlocks().remove(this); @@ -577,10 +580,18 @@ namespace JSC { JSGlobalObject* m_globalObject; // For program and eval nodes, the global object that marks the constant pool. }; - class EvalCodeBlock : public ProgramCodeBlock { + class ProgramCodeBlock : public GlobalCodeBlock { public: - EvalCodeBlock(ScopeNode* ownerNode, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth) - : ProgramCodeBlock(ownerNode, EvalCode, globalObject, sourceProvider) + ProgramCodeBlock(ProgramExecutable* ownerExecutable, CodeType codeType, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider) + : GlobalCodeBlock(ownerExecutable, codeType, sourceProvider, 0, globalObject) + { + } + }; + + class EvalCodeBlock : public GlobalCodeBlock { + public: + EvalCodeBlock(EvalExecutable* ownerExecutable, JSGlobalObject* globalObject, PassRefPtr<SourceProvider> sourceProvider, int baseScopeDepth) + : GlobalCodeBlock(ownerExecutable, EvalCode, sourceProvider, 0, globalObject) , m_baseScopeDepth(baseScopeDepth) { } @@ -591,6 +602,22 @@ namespace JSC { int m_baseScopeDepth; }; + class FunctionCodeBlock : public CodeBlock { + public: + FunctionCodeBlock(FunctionExecutable* ownerExecutable, CodeType codeType, PassRefPtr<SourceProvider> sourceProvider, unsigned sourceOffset) + : CodeBlock(ownerExecutable, codeType, sourceProvider, sourceOffset) + { + } + }; + + class NativeCodeBlock : public CodeBlock { + public: + NativeCodeBlock(FunctionExecutable* ownerExecutable) + : CodeBlock(ownerExecutable) + { + } + }; + inline Register& ExecState::r(int index) { CodeBlock* codeBlock = this->codeBlock(); diff --git a/JavaScriptCore/bytecode/EvalCodeCache.h b/JavaScriptCore/bytecode/EvalCodeCache.h index 986525c..c486e42 100644 --- a/JavaScriptCore/bytecode/EvalCodeCache.h +++ b/JavaScriptCore/bytecode/EvalCodeCache.h @@ -29,6 +29,7 @@ #ifndef EvalCodeCache_h #define EvalCodeCache_h +#include "Executable.h" #include "JSGlobalObject.h" #include "Nodes.h" #include "Parser.h" @@ -41,44 +42,33 @@ namespace JSC { class EvalCodeCache { public: - PassRefPtr<EvalNode> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) + PassRefPtr<CacheableEvalExecutable> get(ExecState* exec, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue) { - RefPtr<EvalNode> evalNode; + RefPtr<CacheableEvalExecutable> evalExecutable; if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject()) - evalNode = m_cacheMap.get(evalSource.rep()); + evalExecutable = m_cacheMap.get(evalSource.rep()); - if (!evalNode) { - int errorLine; - UString errorMessage; - - SourceCode source = makeSource(evalSource); - evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errorLine, &errorMessage); - if (evalNode) { - if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) - m_cacheMap.set(evalSource.rep(), evalNode); - } else { - exceptionValue = Error::create(exec, SyntaxError, errorMessage, errorLine, source.provider()->asID(), 0); + if (!evalExecutable) { + evalExecutable = CacheableEvalExecutable::create(makeSource(evalSource)); + exceptionValue = evalExecutable->parse(exec); + if (exceptionValue) return 0; - } + + if (evalSource.size() < maxCacheableSourceLength && (*scopeChain->begin())->isVariableObject() && m_cacheMap.size() < maxCacheEntries) + m_cacheMap.set(evalSource.rep(), evalExecutable); } - return evalNode.release(); + return evalExecutable.release(); } bool isEmpty() const { return m_cacheMap.isEmpty(); } - void markAggregate(MarkStack& markStack) - { - EvalCacheMap::iterator end = m_cacheMap.end(); - for (EvalCacheMap::iterator ptr = m_cacheMap.begin(); ptr != end; ++ptr) - ptr->second->markAggregate(markStack); - } private: static const int maxCacheableSourceLength = 256; static const int maxCacheEntries = 64; - typedef HashMap<RefPtr<UString::Rep>, RefPtr<EvalNode> > EvalCacheMap; + typedef HashMap<RefPtr<UString::Rep>, RefPtr<CacheableEvalExecutable> > EvalCacheMap; EvalCacheMap m_cacheMap; }; diff --git a/JavaScriptCore/bytecode/SamplingTool.cpp b/JavaScriptCore/bytecode/SamplingTool.cpp index 8651723..8d0faa1 100644 --- a/JavaScriptCore/bytecode/SamplingTool.cpp +++ b/JavaScriptCore/bytecode/SamplingTool.cpp @@ -197,7 +197,7 @@ void SamplingTool::doRun() #if ENABLE(CODEBLOCK_SAMPLING) if (CodeBlock* codeBlock = sample.codeBlock()) { MutexLocker locker(m_scopeSampleMapMutex); - ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerNode()); + ScopeSampleRecord* record = m_scopeSampleMap->get(codeBlock->ownerExecutable()); ASSERT(record); record->sample(codeBlock, sample.vPC()); } diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 59537b6..a4fd0d3 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -256,9 +256,9 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d m_nextGlobalIndex -= symbolTable->size(); for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - globalObject->removeDirect(funcDecl->m_ident); // Make sure our new function is not shadowed by an old property. - emitNewFunction(addGlobalVar(funcDecl->m_ident, false), funcDecl); + FunctionBodyNode* function = functionStack[i]; + globalObject->removeDirect(function->ident()); // Make sure our new function is not shadowed by an old property. + emitNewFunction(addGlobalVar(function->ident(), false), function); } Vector<RegisterID*, 32> newVars; @@ -272,8 +272,8 @@ BytecodeGenerator::BytecodeGenerator(ProgramNode* programNode, const Debugger* d emitLoad(newVars[i], jsUndefined()); } else { for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - globalObject->putWithAttributes(exec, funcDecl->m_ident, funcDecl->makeFunction(exec, scopeChain.node()), DontDelete); + FunctionBodyNode* function = functionStack[i]; + globalObject->putWithAttributes(exec, function->ident(), new (exec) JSFunction(exec, adoptRef(new FunctionExecutable(function->ident(), function)), scopeChain.node()), DontDelete); } for (size_t i = 0; i < varStack.size(); ++i) { if (globalObject->hasProperty(exec, varStack[i].first)) @@ -339,10 +339,10 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, const Debug const DeclarationStacks::FunctionStack& functionStack = functionBody->functionStack(); for (size_t i = 0; i < functionStack.size(); ++i) { - FuncDeclNode* funcDecl = functionStack[i]; - const Identifier& ident = funcDecl->m_ident; + FunctionBodyNode* function = functionStack[i]; + const Identifier& ident = function->ident(); m_functions.add(ident.ustring().rep()); - emitNewFunction(addVar(ident, false), funcDecl); + emitNewFunction(addVar(ident, false), function); } const DeclarationStacks::VarStack& varStack = functionBody->varStack(); @@ -397,6 +397,12 @@ BytecodeGenerator::BytecodeGenerator(EvalNode* evalNode, const Debugger* debugge codeBlock->setGlobalData(m_globalData); m_codeBlock->m_numParameters = 1; // Allocate space for "this" + const DeclarationStacks::FunctionStack& functionStack = evalNode->functionStack(); + for (size_t i = 0; i < functionStack.size(); ++i) { + FunctionBodyNode* function = functionStack[i]; + m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function))); + } + preserveLastVar(); } @@ -470,7 +476,8 @@ RegisterID* BytecodeGenerator::constRegisterFor(const Identifier& ident) return 0; SymbolTableEntry entry = symbolTable().get(ident.ustring().rep()); - ASSERT(!entry.isNull()); + if (entry.isNull()) + return 0; return ®isterFor(entry.getIndex()); } @@ -765,18 +772,6 @@ PassRefPtr<Label> BytecodeGenerator::emitJumpIfNotFunctionApply(RegisterID* cond return target; } -unsigned BytecodeGenerator::addConstant(FuncDeclNode* n) -{ - // No need to explicitly unique function body nodes -- they're unique already. - return m_codeBlock->addFunction(n); -} - -unsigned BytecodeGenerator::addConstant(FuncExprNode* n) -{ - // No need to explicitly unique function expression nodes -- they're unique already. - return m_codeBlock->addFunctionExpression(n); -} - unsigned BytecodeGenerator::addConstant(const Identifier& ident) { UString::Rep* rep = ident.ustring().rep(); @@ -1313,11 +1308,13 @@ RegisterID* BytecodeGenerator::emitNewArray(RegisterID* dst, ElementNode* elemen return dst; } -RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FuncDeclNode* n) +RegisterID* BytecodeGenerator::emitNewFunction(RegisterID* dst, FunctionBodyNode* function) { + unsigned index = m_codeBlock->addFunctionDecl(adoptRef(new FunctionExecutable(function->ident(), function))); + emitOpcode(op_new_func); instructions().append(dst->index()); - instructions().append(addConstant(n)); + instructions().append(index); return dst; } @@ -1332,9 +1329,12 @@ RegisterID* BytecodeGenerator::emitNewRegExp(RegisterID* dst, RegExp* regExp) RegisterID* BytecodeGenerator::emitNewFunctionExpression(RegisterID* r0, FuncExprNode* n) { + FunctionBodyNode* function = n->body(); + unsigned index = m_codeBlock->addFunctionExpr(adoptRef(new FunctionExecutable(function->ident(), function))); + emitOpcode(op_new_func_exp); instructions().append(r0->index()); - instructions().append(addConstant(n)); + instructions().append(index); return r0; } @@ -1805,7 +1805,7 @@ void BytecodeGenerator::emitSubroutineReturn(RegisterID* retAddrSrc) instructions().append(retAddrSrc->index()); } -void BytecodeGenerator::emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value) +void BytecodeGenerator::emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value) { ControlFlowContext context; context.isFinallyBlock = false; diff --git a/JavaScriptCore/bytecompiler/BytecodeGenerator.h b/JavaScriptCore/bytecompiler/BytecodeGenerator.h index c273597..79f0093 100644 --- a/JavaScriptCore/bytecompiler/BytecodeGenerator.h +++ b/JavaScriptCore/bytecompiler/BytecodeGenerator.h @@ -61,7 +61,7 @@ namespace JSC { FinallyContext finallyContext; }; - class BytecodeGenerator : public WTF::FastAllocBase { + class BytecodeGenerator : public FastAllocBase { public: typedef DeclarationStacks::VarStack VarStack; typedef DeclarationStacks::FunctionStack FunctionStack; @@ -254,7 +254,7 @@ namespace JSC { RegisterID* emitNewObject(RegisterID* dst); RegisterID* emitNewArray(RegisterID* dst, ElementNode*); // stops at first elision - RegisterID* emitNewFunction(RegisterID* dst, FuncDeclNode* func); + RegisterID* emitNewFunction(RegisterID* dst, FunctionBodyNode* body); RegisterID* emitNewFunctionExpression(RegisterID* dst, FuncExprNode* func); RegisterID* emitNewRegExp(RegisterID* dst, RegExp* regExp); @@ -318,7 +318,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); - void emitPushNewScope(RegisterID* dst, Identifier& property, RegisterID* value); + void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value); RegisterID* emitPushScope(RegisterID* scope); void emitPopScope(); @@ -413,8 +413,6 @@ namespace JSC { return m_globals[-index - 1]; } - unsigned addConstant(FuncDeclNode*); - unsigned addConstant(FuncExprNode*); unsigned addConstant(const Identifier&); RegisterID* addConstantValue(JSValue); unsigned addRegExp(RegExp*); @@ -445,12 +443,12 @@ namespace JSC { RegisterID m_thisRegister; RegisterID m_argumentsRegister; int m_activationRegisterIndex; - WTF::SegmentedVector<RegisterID, 32> m_constantPoolRegisters; - WTF::SegmentedVector<RegisterID, 32> m_calleeRegisters; - WTF::SegmentedVector<RegisterID, 32> m_parameters; - WTF::SegmentedVector<RegisterID, 32> m_globals; - WTF::SegmentedVector<Label, 32> m_labels; - WTF::SegmentedVector<LabelScope, 8> m_labelScopes; + SegmentedVector<RegisterID, 32> m_constantPoolRegisters; + SegmentedVector<RegisterID, 32> m_calleeRegisters; + SegmentedVector<RegisterID, 32> m_parameters; + SegmentedVector<RegisterID, 32> m_globals; + SegmentedVector<Label, 32> m_labels; + SegmentedVector<LabelScope, 8> m_labelScopes; RefPtr<RegisterID> m_lastVar; int m_finallyDepth; int m_dynamicScopeDepth; diff --git a/JavaScriptCore/debugger/Debugger.cpp b/JavaScriptCore/debugger/Debugger.cpp index 7d791e7..dcc6ef7 100644 --- a/JavaScriptCore/debugger/Debugger.cpp +++ b/JavaScriptCore/debugger/Debugger.cpp @@ -22,16 +22,16 @@ #include "config.h" #include "Debugger.h" -#include "JSGlobalObject.h" +#include "CollectorHeapIterator.h" +#include "Error.h" #include "Interpreter.h" +#include "JSFunction.h" +#include "JSGlobalObject.h" #include "Parser.h" +#include "Protect.h" namespace JSC { -Debugger::Debugger() -{ -} - Debugger::~Debugger() { HashSet<JSGlobalObject*>::iterator end = m_globalObjects.end(); @@ -53,18 +53,60 @@ void Debugger::detach(JSGlobalObject* globalObject) globalObject->setDebugger(0); } +void Debugger::recompileAllJSFunctions(JSGlobalData* globalData) +{ + // If JavaScript is running, it's not safe to recompile, since we'll end + // up throwing away code that is live on the stack. + ASSERT(!globalData->dynamicGlobalObject); + if (globalData->dynamicGlobalObject) + return; + + typedef HashSet<FunctionExecutable*> FunctionExecutableSet; + typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap; + + FunctionExecutableSet functionExecutables; + SourceProviderMap sourceProviders; + + Heap::iterator heapEnd = globalData->heap.primaryHeapEnd(); + for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) { + if (!(*it)->inherits(&JSFunction::info)) + continue; + + JSFunction* function = asFunction(*it); + if (function->executable()->isHostFunction()) + continue; + + FunctionExecutable* executable = function->executable(); + + // Check if the function is already in the set - if so, + // we've already retranslated it, nothing to do here. + if (!functionExecutables.add(executable).second) + continue; + + ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec(); + executable->recompile(exec); + if (function->scope().globalObject()->debugger() == this) + sourceProviders.add(executable->source().provider(), exec); + } + + + // Call sourceParsed() after reparsing all functions because it will execute + // JavaScript in the inspector. + SourceProviderMap::const_iterator end = sourceProviders.end(); + for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter) + sourceParsed(iter->second, SourceCode(iter->first), -1, 0); +} + JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject) { CallFrame* globalCallFrame = globalObject->globalExec(); - int errLine; - UString errMsg; - SourceCode source = makeSource(script); - RefPtr<EvalNode> evalNode = globalObject->globalData()->parser->parse<EvalNode>(globalCallFrame, globalObject->debugger(), source, &errLine, &errMsg); - if (!evalNode) - return Error::create(globalCallFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); + EvalExecutable eval(makeSource(script)); + JSObject* error = eval.parse(globalCallFrame); + if (error) + return error; - return globalObject->globalData()->interpreter->execute(evalNode.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception); + return globalObject->globalData()->interpreter->execute(&eval, globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception); } } // namespace JSC diff --git a/JavaScriptCore/debugger/Debugger.h b/JavaScriptCore/debugger/Debugger.h index 98d0935..3ee9767 100644 --- a/JavaScriptCore/debugger/Debugger.h +++ b/JavaScriptCore/debugger/Debugger.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) * Copyright (C) 2001 Peter Kelly (pmk@post.com) - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 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 Lesser General Public @@ -22,40 +22,42 @@ #ifndef Debugger_h #define Debugger_h -#include "Protect.h" +#include <wtf/HashSet.h> namespace JSC { class DebuggerCallFrame; class ExecState; + class JSGlobalData; class JSGlobalObject; + class JSValue; class SourceCode; class UString; class Debugger { public: - Debugger(); virtual ~Debugger(); void attach(JSGlobalObject*); virtual void detach(JSGlobalObject*); - virtual void sourceParsed(ExecState*, const SourceCode&, int errorLine, const UString& errorMsg) = 0; - virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; - virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; - virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; - virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; + virtual void sourceParsed(ExecState*, const SourceCode&, int errorLineNumber, const UString& errorMessage) = 0; + virtual void exception(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + virtual void atStatement(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + virtual void callEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + virtual void returnEvent(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; - virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; - virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; - virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineno) = 0; + virtual void willExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + virtual void didExecuteProgram(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + virtual void didReachBreakpoint(const DebuggerCallFrame&, intptr_t sourceID, int lineNumber) = 0; + + void recompileAllJSFunctions(JSGlobalData*); private: HashSet<JSGlobalObject*> m_globalObjects; }; - // This method exists only for backwards compatibility with existing - // WebScriptDebugger clients + // This function exists only for backwards compatibility with existing WebScriptDebugger clients. JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*); } // namespace JSC diff --git a/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/JavaScriptCore/debugger/DebuggerCallFrame.cpp index cd8702b..f2afba6 100644 --- a/JavaScriptCore/debugger/DebuggerCallFrame.cpp +++ b/JavaScriptCore/debugger/DebuggerCallFrame.cpp @@ -41,7 +41,7 @@ const UString* DebuggerCallFrame::functionName() const if (!m_callFrame->codeBlock()) return 0; - JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee()); + JSFunction* function = asFunction(m_callFrame->callee()); if (!function) return 0; return &function->name(&m_callFrame->globalData()); @@ -52,7 +52,7 @@ UString DebuggerCallFrame::calculatedFunctionName() const if (!m_callFrame->codeBlock()) return 0; - JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee()); + JSFunction* function = asFunction(m_callFrame->callee()); if (!function) return 0; return function->calculatedDisplayName(&m_callFrame->globalData()); @@ -79,14 +79,12 @@ JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) c if (!m_callFrame->codeBlock()) return JSValue(); - int errLine; - UString errMsg; - SourceCode source = makeSource(script); - RefPtr<EvalNode> evalNode = m_callFrame->scopeChain()->globalData->parser->parse<EvalNode>(m_callFrame, m_callFrame->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - if (!evalNode) - return Error::create(m_callFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); + EvalExecutable eval(makeSource(script)); + JSObject* error = eval.parse(m_callFrame); + if (error) + return error; - return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception); + return m_callFrame->scopeChain()->globalData->interpreter->execute(&eval, m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception); } } // namespace JSC diff --git a/JavaScriptCore/interpreter/CachedCall.h b/JavaScriptCore/interpreter/CachedCall.h index 767c262..b22753e 100644 --- a/JavaScriptCore/interpreter/CachedCall.h +++ b/JavaScriptCore/interpreter/CachedCall.h @@ -40,7 +40,7 @@ namespace JSC { , m_exception(exception) , m_globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : function->scope().node()->globalObject()) { - m_closure = m_interpreter->prepareForRepeatCall(function->body(), callFrame, function, argCount, function->scope().node(), exception); + m_closure = m_interpreter->prepareForRepeatCall(function->executable(), callFrame, function, argCount, function->scope().node(), exception); m_valid = !*exception; } diff --git a/JavaScriptCore/interpreter/CallFrameClosure.h b/JavaScriptCore/interpreter/CallFrameClosure.h index 9085327..a301060 100644 --- a/JavaScriptCore/interpreter/CallFrameClosure.h +++ b/JavaScriptCore/interpreter/CallFrameClosure.h @@ -32,7 +32,7 @@ struct CallFrameClosure { CallFrame* oldCallFrame; CallFrame* newCallFrame; JSFunction* function; - FunctionBodyNode* functionBody; + FunctionExecutable* functionExecutable; JSGlobalData* globalData; Register* oldEnd; ScopeChainNode* scopeChain; diff --git a/JavaScriptCore/interpreter/Interpreter.cpp b/JavaScriptCore/interpreter/Interpreter.cpp index f102739..5175e16 100644 --- a/JavaScriptCore/interpreter/Interpreter.cpp +++ b/JavaScriptCore/interpreter/Interpreter.cpp @@ -350,15 +350,14 @@ NEVER_INLINE JSValue Interpreter::callEval(CallFrame* callFrame, RegisterFile* r LiteralParser preparser(callFrame, programSource, LiteralParser::NonStrictJSON); if (JSValue parsedObject = preparser.tryLiteralParse()) return parsedObject; - - + ScopeChainNode* scopeChain = callFrame->scopeChain(); CodeBlock* codeBlock = callFrame->codeBlock(); - RefPtr<EvalNode> evalNode = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue); + RefPtr<CacheableEvalExecutable> eval = codeBlock->evalCodeCache().get(callFrame, programSource, scopeChain, exceptionValue); JSValue result = jsUndefined(); - if (evalNode) - result = callFrame->globalData().interpreter->execute(evalNode.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue); + if (eval) + result = callFrame->globalData().interpreter->execute(eval.get(), callFrame, callFrame->thisValue().toThisObject(callFrame), callFrame->registers() - registerFile->start() + registerOffset, scopeChain, &exceptionValue); return result; } @@ -490,21 +489,21 @@ NEVER_INLINE bool Interpreter::unwindCallFrame(CallFrame*& callFrame, JSValue ex if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) { DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); if (callFrame->callee()) - debugger->returnEvent(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine()); + debugger->returnEvent(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine()); else - debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->lastLine()); + debugger->didExecuteProgram(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->lastLine()); } if (Profiler* profiler = *Profiler::enabledProfilerReference()) { if (callFrame->callee()) profiler->didExecute(callFrame, callFrame->callee()); else - profiler->didExecute(callFrame, codeBlock->ownerNode()->sourceURL(), codeBlock->ownerNode()->lineNo()); + profiler->didExecute(callFrame, codeBlock->ownerExecutable()->sourceURL(), codeBlock->ownerExecutable()->lineNo()); } // If this call frame created an activation or an 'arguments' object, tear it off. if (oldCodeBlock->codeType() == FunctionCode && oldCodeBlock->needsFullScopeChain()) { - while (!scopeChain->object->isObject(&JSActivation::info)) + while (!scopeChain->object->inherits(&JSActivation::info)) scopeChain = scopeChain->pop(); static_cast<JSActivation*>(scopeChain->object)->copyRegisters(callFrame->optionalCalleeArguments()); } else if (Arguments* arguments = callFrame->optionalCalleeArguments()) { @@ -555,8 +554,8 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV exception->putWithAttributes(callFrame, Identifier(callFrame, expressionEndOffsetPropertyName), jsNumber(callFrame, divotPoint + endOffset), ReadOnly | DontDelete); } else exception->putWithAttributes(callFrame, Identifier(callFrame, "line"), jsNumber(callFrame, codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)), ReadOnly | DontDelete); - exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceId"), jsNumber(callFrame, codeBlock->ownerNode()->sourceID()), ReadOnly | DontDelete); - exception->putWithAttributes(callFrame, Identifier(callFrame, "sourceURL"), jsOwnedString(callFrame, codeBlock->ownerNode()->sourceURL()), 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); } if (exception->isWatchdogException()) { @@ -570,7 +569,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV if (Debugger* debugger = callFrame->dynamicGlobalObject()->debugger()) { DebuggerCallFrame debuggerCallFrame(callFrame, exceptionValue); - debugger->exception(debuggerCallFrame, codeBlock->ownerNode()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)); + debugger->exception(debuggerCallFrame, codeBlock->ownerExecutable()->sourceID(), codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset)); } // If we throw in the middle of a call instruction, we need to notify @@ -610,7 +609,7 @@ NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSV return handler; } -JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception) +JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, ScopeChainNode* scopeChain, JSObject* thisObj, JSValue* exception) { ASSERT(!scopeChain->globalData->exception); @@ -621,7 +620,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco } } - CodeBlock* codeBlock = &programNode->bytecode(scopeChain); + CodeBlock* codeBlock = &program->bytecode(scopeChain); Register* oldEnd = m_registerFile.end(); Register* newEnd = oldEnd + codeBlock->m_numParameters + RegisterFile::CallFrameHeaderSize + codeBlock->m_numCalleeRegisters; @@ -645,7 +644,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco Profiler** profiler = Profiler::enabledProfilerReference(); if (*profiler) - (*profiler)->willExecute(newCallFrame, programNode->sourceURL(), programNode->lineNo()); + (*profiler)->willExecute(newCallFrame, program->sourceURL(), program->lineNo()); JSValue result; { @@ -653,7 +652,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco m_reentryDepth++; #if ENABLE(JIT) - result = programNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); + result = program->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); #else result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); #endif @@ -661,7 +660,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco } if (*profiler) - (*profiler)->didExecute(callFrame, programNode->sourceURL(), programNode->lineNo()); + (*profiler)->didExecute(callFrame, program->sourceURL(), program->lineNo()); if (m_reentryDepth && lastGlobalObject && globalObject != lastGlobalObject) lastGlobalObject->copyGlobalsTo(m_registerFile); @@ -671,7 +670,7 @@ JSValue Interpreter::execute(ProgramNode* programNode, CallFrame* callFrame, Sco return result; } -JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception) +JSValue Interpreter::execute(FunctionExecutable* functionExecutable, CallFrame* callFrame, JSFunction* function, JSObject* thisObj, const ArgList& args, ScopeChainNode* scopeChain, JSValue* exception) { ASSERT(!scopeChain->globalData->exception); @@ -699,7 +698,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call for (ArgList::const_iterator it = args.begin(); it != end; ++it) newCallFrame->r(++dst) = *it; - CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain); + CodeBlock* codeBlock = &functionExecutable->bytecode(scopeChain); newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc); if (UNLIKELY(!newCallFrame)) { *exception = createStackOverflowError(callFrame); @@ -719,7 +718,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call m_reentryDepth++; #if ENABLE(JIT) - result = functionBodyNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); + result = functionExecutable->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); #else result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); #endif @@ -733,7 +732,7 @@ JSValue Interpreter::execute(FunctionBodyNode* functionBodyNode, CallFrame* call return result; } -CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBodyNode, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception) +CallFrameClosure Interpreter::prepareForRepeatCall(FunctionExecutable* FunctionExecutable, CallFrame* callFrame, JSFunction* function, int argCount, ScopeChainNode* scopeChain, JSValue* exception) { ASSERT(!scopeChain->globalData->exception); @@ -757,7 +756,7 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBod for (int i = 0; i < argc; ++i) newCallFrame->r(++dst) = jsUndefined(); - CodeBlock* codeBlock = &functionBodyNode->bytecode(scopeChain); + CodeBlock* codeBlock = &FunctionExecutable->bytecode(scopeChain); newCallFrame = slideRegisterWindowForCall(codeBlock, &m_registerFile, newCallFrame, argc + RegisterFile::CallFrameHeaderSize, argc); if (UNLIKELY(!newCallFrame)) { *exception = createStackOverflowError(callFrame); @@ -767,10 +766,10 @@ CallFrameClosure Interpreter::prepareForRepeatCall(FunctionBodyNode* functionBod // a 0 codeBlock indicates a built-in caller newCallFrame->init(codeBlock, 0, scopeChain, callFrame->addHostCallFrameFlag(), 0, argc, function); #if ENABLE(JIT) - functionBodyNode->jitCode(scopeChain); + FunctionExecutable->jitCode(scopeChain); #endif - CallFrameClosure result = { callFrame, newCallFrame, function, functionBodyNode, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc }; + CallFrameClosure result = { callFrame, newCallFrame, function, FunctionExecutable, scopeChain->globalData, oldEnd, scopeChain, codeBlock->m_numParameters, argc }; return result; } @@ -787,7 +786,7 @@ JSValue Interpreter::execute(CallFrameClosure& closure, JSValue* exception) m_reentryDepth++; #if ENABLE(JIT) - result = closure.functionBody->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception); + result = closure.functionExecutable->generatedJITCode().execute(&m_registerFile, closure.newCallFrame, closure.globalData, exception); #else result = privateExecute(Normal, &m_registerFile, closure.newCallFrame, exception); #endif @@ -804,12 +803,12 @@ void Interpreter::endRepeatCall(CallFrameClosure& closure) m_registerFile.shrink(closure.oldEnd); } -JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception) +JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception) { - return execute(evalNode, callFrame, thisObj, m_registerFile.size() + evalNode->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception); + return execute(eval, callFrame, thisObj, m_registerFile.size() + eval->bytecode(scopeChain).m_numParameters + RegisterFile::CallFrameHeaderSize, scopeChain, exception); } -JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception) +JSValue Interpreter::execute(EvalExecutable* eval, CallFrame* callFrame, JSObject* thisObj, int globalRegisterOffset, ScopeChainNode* scopeChain, JSValue* exception) { ASSERT(!scopeChain->globalData->exception); @@ -822,7 +821,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* DynamicGlobalObjectScope globalObjectScope(callFrame, callFrame->globalData().dynamicGlobalObject ? callFrame->globalData().dynamicGlobalObject : scopeChain->globalObject()); - EvalCodeBlock* codeBlock = &evalNode->bytecode(scopeChain); + EvalCodeBlock* codeBlock = &eval->bytecode(scopeChain); JSVariableObject* variableObject; for (ScopeChainNode* node = scopeChain; ; node = node->next) { @@ -837,7 +836,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* BatchedTransitionOptimizer optimizer(variableObject); - const DeclarationStacks::VarStack& varStack = codeBlock->ownerNode()->varStack(); + const DeclarationStacks::VarStack& varStack = static_cast<EvalExecutable*>(codeBlock->ownerExecutable())->varStack(); DeclarationStacks::VarStack::const_iterator varStackEnd = varStack.end(); for (DeclarationStacks::VarStack::const_iterator it = varStack.begin(); it != varStackEnd; ++it) { const Identifier& ident = (*it).first; @@ -847,11 +846,11 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* } } - const DeclarationStacks::FunctionStack& functionStack = codeBlock->ownerNode()->functionStack(); - DeclarationStacks::FunctionStack::const_iterator functionStackEnd = functionStack.end(); - for (DeclarationStacks::FunctionStack::const_iterator it = functionStack.begin(); it != functionStackEnd; ++it) { + int numFunctions = codeBlock->numberOfFunctionDecls(); + for (int i = 0; i < numFunctions; ++i) { + FunctionExecutable* function = codeBlock->functionDecl(i); PutPropertySlot slot; - variableObject->put(callFrame, (*it)->m_ident, (*it)->makeFunction(callFrame, scopeChain), slot); + variableObject->put(callFrame, function->name(), function->make(callFrame, scopeChain), slot); } } @@ -874,7 +873,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* Profiler** profiler = Profiler::enabledProfilerReference(); if (*profiler) - (*profiler)->willExecute(newCallFrame, evalNode->sourceURL(), evalNode->lineNo()); + (*profiler)->willExecute(newCallFrame, eval->sourceURL(), eval->lineNo()); JSValue result; { @@ -882,7 +881,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* m_reentryDepth++; #if ENABLE(JIT) - result = evalNode->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); + result = eval->jitCode(scopeChain).execute(&m_registerFile, newCallFrame, scopeChain->globalData, exception); #else result = privateExecute(Normal, &m_registerFile, newCallFrame, exception); #endif @@ -890,7 +889,7 @@ JSValue Interpreter::execute(EvalNode* evalNode, CallFrame* callFrame, JSObject* } if (*profiler) - (*profiler)->didExecute(callFrame, evalNode->sourceURL(), evalNode->lineNo()); + (*profiler)->didExecute(callFrame, eval->sourceURL(), eval->lineNo()); m_registerFile.shrink(oldEnd); return result; @@ -904,22 +903,22 @@ NEVER_INLINE void Interpreter::debug(CallFrame* callFrame, DebugHookID debugHook switch (debugHookID) { case DidEnterCallFrame: - debugger->callEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); + debugger->callEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine); return; case WillLeaveCallFrame: - debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); + debugger->returnEvent(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine); return; case WillExecuteStatement: - debugger->atStatement(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); + debugger->atStatement(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine); return; case WillExecuteProgram: - debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), firstLine); + debugger->willExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), firstLine); return; case DidExecuteProgram: - debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); + debugger->didExecuteProgram(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine); return; case DidReachBreakpoint: - debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerNode()->sourceID(), lastLine); + debugger->didReachBreakpoint(callFrame, callFrame->codeBlock()->ownerExecutable()->sourceID(), lastLine); return; } } @@ -2921,7 +2920,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi int dst = (++vPC)->u.operand; int func = (++vPC)->u.operand; - callFrame->r(dst) = JSValue(callFrame->codeBlock()->function(func)->makeFunction(callFrame, callFrame->scopeChain())); + callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionDecl(func)->make(callFrame, callFrame->scopeChain())); ++vPC; NEXT_INSTRUCTION(); @@ -2935,9 +2934,24 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi puts the result in register dst. */ int dst = (++vPC)->u.operand; - int func = (++vPC)->u.operand; + int funcIndex = (++vPC)->u.operand; + + FunctionExecutable* function = callFrame->codeBlock()->functionExpr(funcIndex); + JSFunction* func = function->make(callFrame, callFrame->scopeChain()); + + /* + The Identifier in a FunctionExpression can be referenced from inside + the FunctionExpression's FunctionBody to allow the function to call + itself recursively. However, unlike in a FunctionDeclaration, the + Identifier in a FunctionExpression cannot be referenced from and + does not affect the scope enclosing the FunctionExpression. + */ + if (!function->name().isNull()) { + JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete); + func->scope().push(functionScopeObject); + } - callFrame->r(dst) = JSValue(callFrame->codeBlock()->functionExpression(func)->makeFunction(callFrame, callFrame->scopeChain())); + callFrame->r(dst) = JSValue(func); ++vPC; NEXT_INSTRUCTION(); @@ -3003,8 +3017,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (callType == CallTypeJS) { ScopeChainNode* callDataScopeChain = callData.js.scopeChain; - FunctionBodyNode* functionBodyNode = callData.js.functionBody; - CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain); + CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callDataScopeChain); CallFrame* previousCallFrame = callFrame; @@ -3070,7 +3083,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi exceptionValue = createStackOverflowError(callFrame); goto vm_throw; } - int32_t expectedParams = callFrame->callee()->body()->parameterCount(); + int32_t expectedParams = callFrame->callee()->executable()->parameterCount(); int32_t inplaceArgs = min(argCount, expectedParams); int32_t i = 0; Register* argStore = callFrame->registers() + argsOffset; @@ -3157,8 +3170,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (callType == CallTypeJS) { ScopeChainNode* callDataScopeChain = callData.js.scopeChain; - FunctionBodyNode* functionBodyNode = callData.js.functionBody; - CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain); + CodeBlock* newCodeBlock = &callData.js.functionExecutable->bytecode(callDataScopeChain); CallFrame* previousCallFrame = callFrame; @@ -3320,7 +3332,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi callFrame->r(i) = jsUndefined(); int dst = (++vPC)->u.operand; - JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionBodyNode*>(codeBlock->ownerNode())); + JSActivation* activation = new (globalData) JSActivation(callFrame, static_cast<FunctionExecutable*>(codeBlock->ownerExecutable())); callFrame->r(dst) = JSValue(activation); callFrame->setScopeChain(callFrame->scopeChain()->copy()->push(activation)); @@ -3406,8 +3418,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi if (constructType == ConstructTypeJS) { ScopeChainNode* callDataScopeChain = constructData.js.scopeChain; - FunctionBodyNode* functionBodyNode = constructData.js.functionBody; - CodeBlock* newCodeBlock = &functionBodyNode->bytecode(callDataScopeChain); + CodeBlock* newCodeBlock = &constructData.js.functionExecutable->bytecode(callDataScopeChain); Structure* structure; JSValue prototype = callFrame->r(proto).jsValue(); @@ -3657,7 +3668,7 @@ JSValue Interpreter::privateExecute(ExecutionFlag flag, RegisterFile* registerFi int message = (++vPC)->u.operand; CodeBlock* codeBlock = callFrame->codeBlock(); - callFrame->r(dst) = JSValue(Error::create(callFrame, (ErrorType)type, callFrame->r(message).jsValue().toString(callFrame), codeBlock->lineNumberForBytecodeOffset(callFrame, vPC - codeBlock->instructions().begin()), codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL())); + 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())); ++vPC; NEXT_INSTRUCTION(); @@ -3885,8 +3896,8 @@ void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intp unsigned bytecodeOffset = bytecodeOffsetForPC(callerFrame, callerCodeBlock, callFrame->returnPC()); lineNumber = callerCodeBlock->lineNumberForBytecodeOffset(callerFrame, bytecodeOffset - 1); - sourceID = callerCodeBlock->ownerNode()->sourceID(); - sourceURL = callerCodeBlock->ownerNode()->sourceURL(); + sourceID = callerCodeBlock->ownerExecutable()->sourceID(); + sourceURL = callerCodeBlock->ownerExecutable()->sourceURL(); function = callerFrame->callee(); } diff --git a/JavaScriptCore/interpreter/Interpreter.h b/JavaScriptCore/interpreter/Interpreter.h index 519c508..8cb75d2 100644 --- a/JavaScriptCore/interpreter/Interpreter.h +++ b/JavaScriptCore/interpreter/Interpreter.h @@ -42,12 +42,12 @@ namespace JSC { class CodeBlock; - class EvalNode; - class FunctionBodyNode; + class EvalExecutable; + class FunctionExecutable; class InternalFunction; class JSFunction; class JSGlobalObject; - class ProgramNode; + class ProgramExecutable; class Register; class ScopeChainNode; class SamplingTool; @@ -95,9 +95,9 @@ namespace JSC { bool isOpcode(Opcode); - JSValue execute(ProgramNode*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception); - JSValue execute(FunctionBodyNode*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception); - JSValue execute(EvalNode* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception); + JSValue execute(ProgramExecutable*, CallFrame*, ScopeChainNode*, JSObject* thisObj, JSValue* exception); + JSValue execute(FunctionExecutable*, CallFrame*, JSFunction*, JSObject* thisObj, const ArgList& args, ScopeChainNode*, JSValue* exception); + JSValue execute(EvalExecutable* evalNode, CallFrame* exec, JSObject* thisObj, ScopeChainNode* scopeChain, JSValue* exception); JSValue retrieveArguments(CallFrame*, JSFunction*) const; JSValue retrieveCaller(CallFrame*, InternalFunction*) const; @@ -115,11 +115,11 @@ namespace JSC { private: enum ExecutionFlag { Normal, InitializeAndReturn }; - CallFrameClosure prepareForRepeatCall(FunctionBodyNode*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception); + CallFrameClosure prepareForRepeatCall(FunctionExecutable*, CallFrame*, JSFunction*, int argCount, ScopeChainNode*, JSValue* exception); void endRepeatCall(CallFrameClosure&); JSValue execute(CallFrameClosure&, JSValue* exception); - JSValue execute(EvalNode*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception); + JSValue execute(EvalExecutable*, CallFrame*, JSObject* thisObject, int globalRegisterOffset, ScopeChainNode*, JSValue* exception); #if USE(INTERPRETER) NEVER_INLINE bool resolve(CallFrame*, Instruction*, JSValue& exceptionValue); diff --git a/JavaScriptCore/jit/JIT.cpp b/JavaScriptCore/jit/JIT.cpp index 0d6d1b8..c50b6de 100644 --- a/JavaScriptCore/jit/JIT.cpp +++ b/JavaScriptCore/jit/JIT.cpp @@ -438,7 +438,7 @@ void JIT::privateCompileSlowCases() #endif } -void JIT::privateCompile() +JITCode JIT::privateCompile() { sampleCodeBlock(m_codeBlock); #if ENABLE(OPCODE_SAMPLING) @@ -552,7 +552,7 @@ void JIT::privateCompile() info.callReturnLocation = m_codeBlock->structureStubInfo(m_methodCallCompilationInfo[i].propertyAccessIndex).callReturnLocation; } - m_codeBlock->setJITCode(patchBuffer.finalizeCode()); + return patchBuffer.finalizeCode(); } #if !USE(JSVALUE32_64) diff --git a/JavaScriptCore/jit/JIT.h b/JavaScriptCore/jit/JIT.h index 93f47d9..5c6607c 100644 --- a/JavaScriptCore/jit/JIT.h +++ b/JavaScriptCore/jit/JIT.h @@ -277,10 +277,9 @@ namespace JSC { static const int patchGetByIdDefaultOffset = 256; public: - static void compile(JSGlobalData* globalData, CodeBlock* codeBlock) + static JITCode compile(JSGlobalData* globalData, CodeBlock* codeBlock) { - JIT jit(globalData, codeBlock); - jit.privateCompile(); + return JIT(globalData, codeBlock).privateCompile(); } static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress) @@ -353,7 +352,7 @@ namespace JSC { void privateCompileMainPass(); void privateCompileLinkPass(); void privateCompileSlowCases(); - void privateCompile(); + JITCode privateCompile(); void privateCompileGetByIdProto(StructureStubInfo*, Structure*, Structure* prototypeStructure, size_t cachedOffset, ReturnAddressPtr returnAddress, CallFrame* callFrame); void privateCompileGetByIdSelfList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, size_t cachedOffset); void privateCompileGetByIdProtoList(StructureStubInfo*, PolymorphicAccessStructureList*, int, Structure*, Structure* prototypeStructure, size_t cachedOffset, CallFrame* callFrame); @@ -595,9 +594,62 @@ namespace JSC { static const int patchOffsetMethodCheckProtoObj = 18; static const int patchOffsetMethodCheckProtoStruct = 28; static const int patchOffsetMethodCheckPutFunction = 46; +#elif PLATFORM(ARM) + // These architecture specific value are used to enable patching - see comment on op_put_by_id. + static const int patchOffsetPutByIdStructure = 4; + static const int patchOffsetPutByIdExternalLoad = 16; + static const int patchLengthPutByIdExternalLoad = 4; + static const int patchOffsetPutByIdPropertyMapOffset = 20; + // These architecture specific value are used to enable patching - see comment on op_get_by_id. + static const int patchOffsetGetByIdStructure = 4; + static const int patchOffsetGetByIdBranchToSlowCase = 16; + static const int patchOffsetGetByIdExternalLoad = 16; + static const int patchLengthGetByIdExternalLoad = 4; + static const int patchOffsetGetByIdPropertyMapOffset = 20; + static const int patchOffsetGetByIdPutResult = 28; +#if ENABLE(OPCODE_SAMPLING) + #error "OPCODE_SAMPLING is not yet supported" +#else + static const int patchOffsetGetByIdSlowCaseCall = 36; +#endif + static const int patchOffsetOpCallCompareToJump = 12; + + static const int patchOffsetMethodCheckProtoObj = 12; + static const int patchOffsetMethodCheckProtoStruct = 20; + static const int patchOffsetMethodCheckPutFunction = 32; #endif #endif // USE(JSVALUE32_64) +#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) + // sequenceOpCall + static const int sequenceOpCallInstructionSpace = 12; + static const int sequenceOpCallConstantSpace = 2; + // sequenceMethodCheck + static const int sequenceMethodCheckInstructionSpace = 40; + static const int sequenceMethodCheckConstantSpace = 6; + // sequenceGetByIdHotPath + static const int sequenceGetByIdHotPathInstructionSpace = 28; + static const int sequenceGetByIdHotPathConstantSpace = 3; + // sequenceGetByIdSlowCase + static const int sequenceGetByIdSlowCaseInstructionSpace = 40; + static const int sequenceGetByIdSlowCaseConstantSpace = 2; + // sequencePutById + static const int sequencePutByIdInstructionSpace = 28; + static const int sequencePutByIdConstantSpace = 3; +#endif + +#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL +#define BEGIN_UNINTERRUPTED_SEQUENCE(name) beginUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace) +#define END_UNINTERRUPTED_SEQUENCE(name) endUninterruptedSequence(name ## InstructionSpace, name ## ConstantSpace) + + void beginUninterruptedSequence(int, int); + void endUninterruptedSequence(int, int); + +#else +#define BEGIN_UNINTERRUPTED_SEQUENCE(name) +#define END_UNINTERRUPTED_SEQUENCE(name) +#endif + void emit_op_add(Instruction*); void emit_op_bitand(Instruction*); void emit_op_bitnot(Instruction*); @@ -835,6 +887,13 @@ namespace JSC { int m_lastResultBytecodeRegister; unsigned m_jumpTargetsPosition; #endif + +#ifndef NDEBUG +#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL + Label m_uninterruptedInstructionSequenceBegin; + int m_uninterruptedConstantSequenceBegin; +#endif +#endif } JIT_CLASS_ALIGNMENT; } // namespace JSC diff --git a/JavaScriptCore/jit/JITCall.cpp b/JavaScriptCore/jit/JITCall.cpp index 7fdb845..a19fae8 100644 --- a/JavaScriptCore/jit/JITCall.cpp +++ b/JavaScriptCore/jit/JITCall.cpp @@ -617,7 +617,13 @@ void JIT::compileOpCall(OpcodeID opcodeID, Instruction* instruction, unsigned ca // This deliberately leaves the callee in ecx, used when setting up the stack frame below emitGetVirtualRegister(callee, regT2); DataLabelPtr addressOfLinkedFunctionCheck; + + BEGIN_UNINTERRUPTED_SEQUENCE(sequenceOpCall); + Jump jumpToSlow = branchPtrWithPatch(NotEqual, regT2, addressOfLinkedFunctionCheck, ImmPtr(JSValue::encode(JSValue()))); + + END_UNINTERRUPTED_SEQUENCE(sequenceOpCall); + addSlowCase(jumpToSlow); ASSERT(differenceBetween(addressOfLinkedFunctionCheck, jumpToSlow) == patchOffsetOpCallCompareToJump); m_callStructureStubCompilationInfo[callLinkInfoIndex].hotPathBegin = addressOfLinkedFunctionCheck; diff --git a/JavaScriptCore/jit/JITInlineMethods.h b/JavaScriptCore/jit/JITInlineMethods.h index b5aaafc..ca34502 100644 --- a/JavaScriptCore/jit/JITInlineMethods.h +++ b/JavaScriptCore/jit/JITInlineMethods.h @@ -102,6 +102,39 @@ ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr function) return nakedCall; } +#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL + +ALWAYS_INLINE void JIT::beginUninterruptedSequence(int insnSpace, int constSpace) +{ +#if PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) +#ifndef NDEBUG + // Ensure the label after the sequence can also fit + insnSpace += sizeof(ARMWord); + constSpace += sizeof(uint64_t); +#endif + + ensureSpace(insnSpace, constSpace); + +#endif + +#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL +#ifndef NDEBUG + m_uninterruptedInstructionSequenceBegin = label(); + m_uninterruptedConstantSequenceBegin = sizeOfConstantPool(); +#endif +#endif +} + +ALWAYS_INLINE void JIT::endUninterruptedSequence(int insnSpace, int constSpace) +{ +#if defined(ASSEMBLER_HAS_CONSTANT_POOL) && ASSEMBLER_HAS_CONSTANT_POOL + ASSERT(differenceBetween(m_uninterruptedInstructionSequenceBegin, label()) == insnSpace); + ASSERT(sizeOfConstantPool() - m_uninterruptedConstantSequenceBegin == constSpace); +#endif +} + +#endif + #if PLATFORM(X86) || PLATFORM(X86_64) || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7)) ALWAYS_INLINE void JIT::preserveReturnAddressAfterCall(RegisterID reg) diff --git a/JavaScriptCore/jit/JITOpcodes.cpp b/JavaScriptCore/jit/JITOpcodes.cpp index 13fc981..5a9be28 100644 --- a/JavaScriptCore/jit/JITOpcodes.cpp +++ b/JavaScriptCore/jit/JITOpcodes.cpp @@ -68,8 +68,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable Label virtualCallLinkBegin = align(); // regT0 holds callee, regT1 holds argCount. - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2); - loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); + loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT2); Jump hasCodeBlock2 = branchTestPtr(NonZero, regT2); // Lazily generate a CodeBlock. @@ -114,8 +114,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable Label virtualCallBegin = align(); // regT0 holds callee, regT1 holds argCount. - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT2); - loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT2); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT2); + loadPtr(Address(regT2, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT2); Jump hasCodeBlock3 = branchTestPtr(NonZero, regT2); // Lazily generate a CodeBlock. @@ -146,8 +146,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable arityCheckOkay3.link(this); isNativeFunc3.link(this); compileOpCallInitializeCallFrame(); - loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_body)), regT0); - loadPtr(Address(regT0, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0); + loadPtr(Address(regT0, OBJECT_OFFSETOF(JSFunction, m_executable)), regT0); + loadPtr(Address(regT0, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0); jump(regT0); #if PLATFORM(X86) @@ -544,7 +544,7 @@ void JIT::emitSlow_op_instanceof(Instruction* currentInstruction, Vector<SlowCas void JIT::emit_op_new_func(Instruction* currentInstruction) { JITStubCall stubCall(this, cti_op_new_func); - stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand))); + stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand))); stubCall.call(currentInstruction[1].u.operand); } @@ -1180,7 +1180,7 @@ void JIT::emit_op_resolve_with_base(Instruction* currentInstruction) void JIT::emit_op_new_func_exp(Instruction* currentInstruction) { JITStubCall stubCall(this, cti_op_new_func_exp); - stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand))); + stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand))); stubCall.call(currentInstruction[1].u.operand); } @@ -1487,8 +1487,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable Label virtualCallLinkBegin = align(); // Load the callee CodeBlock* into eax - loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); - loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0); + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); + loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT0); Jump hasCodeBlock2 = branchTestPtr(NonZero, regT0); preserveReturnAddressAfterCall(regT3); restoreArgumentReference(); @@ -1527,8 +1527,8 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable Label virtualCallBegin = align(); // Load the callee CodeBlock* into eax - loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); - loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_code)), regT0); + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); + loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_codeBlock)), regT0); Jump hasCodeBlock3 = branchTestPtr(NonZero, regT0); preserveReturnAddressAfterCall(regT3); restoreArgumentReference(); @@ -1536,7 +1536,7 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable emitGetJITStubArg(1, regT2); emitGetJITStubArg(3, regT1); restoreReturnAddressBeforeReturn(regT3); - loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer. + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); // reload the function body nody, so we can reload the code pointer. hasCodeBlock3.link(this); Jump isNativeFunc3 = branch32(Equal, Address(regT0, OBJECT_OFFSETOF(CodeBlock, m_codeType)), Imm32(NativeCode)); @@ -1552,12 +1552,12 @@ void JIT::privateCompileCTIMachineTrampolines(RefPtr<ExecutablePool>* executable emitGetJITStubArg(1, regT2); emitGetJITStubArg(3, regT1); restoreReturnAddressBeforeReturn(regT3); - loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_body)), regT3); // reload the function body nody, so we can reload the code pointer. + loadPtr(Address(regT2, OBJECT_OFFSETOF(JSFunction, m_executable)), regT3); // reload the function body nody, so we can reload the code pointer. arityCheckOkay3.link(this); isNativeFunc3.link(this); // load ctiCode from the new codeBlock. - loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionBodyNode, m_jitCode)), regT0); + loadPtr(Address(regT3, OBJECT_OFFSETOF(FunctionExecutable, m_jitCode)), regT0); compileOpCallInitializeCallFrame(); jump(regT0); @@ -1971,7 +1971,7 @@ void JIT::emit_op_instanceof(Instruction* currentInstruction) void JIT::emit_op_new_func(Instruction* currentInstruction) { JITStubCall stubCall(this, cti_op_new_func); - stubCall.addArgument(ImmPtr(m_codeBlock->function(currentInstruction[2].u.operand))); + stubCall.addArgument(ImmPtr(m_codeBlock->functionDecl(currentInstruction[2].u.operand))); stubCall.call(currentInstruction[1].u.operand); } @@ -2325,7 +2325,7 @@ void JIT::emit_op_resolve_with_base(Instruction* currentInstruction) void JIT::emit_op_new_func_exp(Instruction* currentInstruction) { JITStubCall stubCall(this, cti_op_new_func_exp); - stubCall.addArgument(ImmPtr(m_codeBlock->functionExpression(currentInstruction[2].u.operand))); + stubCall.addArgument(ImmPtr(m_codeBlock->functionExpr(currentInstruction[2].u.operand))); stubCall.call(currentInstruction[1].u.operand); } diff --git a/JavaScriptCore/jit/JITPropertyAccess.cpp b/JavaScriptCore/jit/JITPropertyAccess.cpp index 9dba2e2..85a731d 100644 --- a/JavaScriptCore/jit/JITPropertyAccess.cpp +++ b/JavaScriptCore/jit/JITPropertyAccess.cpp @@ -1122,13 +1122,20 @@ void JIT::emit_op_method_check(Instruction* currentInstruction) // Do the method check - check the object & its prototype's structure inline (this is the common case). m_methodCallCompilationInfo.append(MethodCallCompilationInfo(m_propertyAccessInstructionIndex)); MethodCallCompilationInfo& info = m_methodCallCompilationInfo.last(); + Jump notCell = emitJumpIfNotJSCell(regT0); + + BEGIN_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck); + Jump structureCheck = branchPtrWithPatch(NotEqual, Address(regT0, OBJECT_OFFSETOF(JSCell, m_structure)), info.structureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); DataLabelPtr protoStructureToCompare, protoObj = moveWithPatch(ImmPtr(0), regT1); Jump protoStructureCheck = branchPtrWithPatch(NotEqual, Address(regT1, OBJECT_OFFSETOF(JSCell, m_structure)), protoStructureToCompare, ImmPtr(reinterpret_cast<void*>(patchGetByIdDefaultStructure))); // This will be relinked to load the function without doing a load. DataLabelPtr putFunction = moveWithPatch(ImmPtr(0), regT0); + + END_UNINTERRUPTED_SEQUENCE(sequenceMethodCheck); + Jump match = jump(); ASSERT(differenceBetween(info.structureToCompare, protoObj) == patchOffsetMethodCheckProtoObj); @@ -1192,6 +1199,8 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); + BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); + Label hotPathBegin(this); m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin; @@ -1210,6 +1219,9 @@ void JIT::compileGetByIdHotPath(int, int baseVReg, Identifier*, unsigned propert ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetGetByIdPropertyMapOffset); Label putResult(this); + + END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdHotPath); + ASSERT(differenceBetween(hotPathBegin, putResult) == patchOffsetGetByIdPutResult); } @@ -1233,6 +1245,8 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident linkSlowCaseIfNotJSCell(iter, baseVReg); linkSlowCase(iter); + BEGIN_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase); + #ifndef NDEBUG Label coldPathBegin(this); #endif @@ -1241,6 +1255,8 @@ void JIT::compileGetByIdSlowCase(int resultVReg, int baseVReg, Identifier* ident stubCall.addArgument(ImmPtr(ident)); Call call = stubCall.call(resultVReg); + END_UNINTERRUPTED_SEQUENCE(sequenceGetByIdSlowCase); + ASSERT(differenceBetween(coldPathBegin, call) == patchOffsetGetByIdSlowCaseCall); // Track the location of the call; this will be used to recover patch information. @@ -1264,6 +1280,8 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction) // Jump to a slow case if either the base object is an immediate, or if the Structure does not match. emitJumpSlowCaseIfNotJSCell(regT0, baseVReg); + BEGIN_UNINTERRUPTED_SEQUENCE(sequencePutById); + Label hotPathBegin(this); m_propertyAccessCompilationInfo[propertyAccessInstructionIndex].hotPathBegin = hotPathBegin; @@ -1279,6 +1297,9 @@ void JIT::emit_op_put_by_id(Instruction* currentInstruction) ASSERT(differenceBetween(externalLoad, externalLoadComplete) == patchLengthPutByIdExternalLoad); DataLabel32 displacementLabel = storePtrWithAddressOffsetPatch(regT1, Address(regT0, patchGetByIdDefaultOffset)); + + END_UNINTERRUPTED_SEQUENCE(sequencePutById); + ASSERT(differenceBetween(hotPathBegin, displacementLabel) == patchOffsetPutByIdPropertyMapOffset); } diff --git a/JavaScriptCore/jit/JITStubs.cpp b/JavaScriptCore/jit/JITStubs.cpp index d563f58..55dab0b 100644 --- a/JavaScriptCore/jit/JITStubs.cpp +++ b/JavaScriptCore/jit/JITStubs.cpp @@ -1467,7 +1467,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_func) { STUB_INIT_STACK_FRAME(stackFrame); - return stackFrame.args[0].funcDeclNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain()); + return stackFrame.args[0].function()->make(stackFrame.callFrame, stackFrame.callFrame->scopeChain()); } DEFINE_STUB_FUNCTION(void*, op_call_JSFunction) @@ -1480,12 +1480,12 @@ DEFINE_STUB_FUNCTION(void*, op_call_JSFunction) #endif JSFunction* function = asFunction(stackFrame.args[0].jsValue()); - ASSERT(!function->isHostFunction()); - FunctionBodyNode* body = function->body(); + FunctionExecutable* executable = function->executable(); + ASSERT(!executable->isHostFunction()); ScopeChainNode* callDataScopeChain = function->scope().node(); - body->jitCode(callDataScopeChain); + executable->jitCode(callDataScopeChain); - return &(body->generatedBytecode()); + return &executable->generatedBytecode(); } DEFINE_STUB_FUNCTION(VoidPtrPair, op_call_arityCheck) @@ -1539,13 +1539,14 @@ DEFINE_STUB_FUNCTION(void*, vm_lazyLinkCall) { STUB_INIT_STACK_FRAME(stackFrame); JSFunction* callee = asFunction(stackFrame.args[0].jsValue()); - JITCode& jitCode = callee->body()->generatedJITCode(); + FunctionExecutable* executable = callee->executable(); + JITCode& jitCode = executable->generatedJITCode(); CodeBlock* codeBlock = 0; - if (!callee->isHostFunction()) - codeBlock = &callee->body()->bytecode(callee->scope().node()); + if (!executable->isHostFunction()) + codeBlock = &executable->bytecode(callee->scope().node()); else - codeBlock = &callee->body()->generatedBytecode(); + codeBlock = &executable->generatedBytecode(); CallLinkInfo* callLinkInfo = &stackFrame.callFrame->callerFrame()->codeBlock()->getCallLinkInfo(stackFrame.args[1].returnAddress()); if (!callLinkInfo->seenOnce()) @@ -1561,7 +1562,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_push_activation) { STUB_INIT_STACK_FRAME(stackFrame); - JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionBodyNode*>(stackFrame.callFrame->codeBlock()->ownerNode())); + JSActivation* activation = new (stackFrame.globalData) JSActivation(stackFrame.callFrame, static_cast<FunctionExecutable*>(stackFrame.callFrame->codeBlock()->ownerExecutable())); stackFrame.callFrame->setScopeChain(stackFrame.callFrame->scopeChain()->copy()->push(activation)); return activation; } @@ -1715,7 +1716,8 @@ DEFINE_STUB_FUNCTION(JSObject*, op_construct_JSConstruct) STUB_INIT_STACK_FRAME(stackFrame); JSFunction* constructor = asFunction(stackFrame.args[0].jsValue()); - if (constructor->isHostFunction()) { + FunctionExecutable* executable = constructor->executable(); + if (executable && executable->isHostFunction()) { CallFrame* callFrame = stackFrame.callFrame; CodeBlock* codeBlock = callFrame->codeBlock(); unsigned vPCIndex = codeBlock->getBytecodeIndex(callFrame, STUB_RETURN_ADDRESS); @@ -2042,7 +2044,7 @@ DEFINE_STUB_FUNCTION(int, op_load_varargs) stackFrame.globalData->exception = createStackOverflowError(callFrame); VM_THROW_EXCEPTION(); } - int32_t expectedParams = callFrame->callee()->body()->parameterCount(); + int32_t expectedParams = callFrame->callee()->executable()->parameterCount(); int32_t inplaceArgs = min(providedParams, expectedParams); Register* inplaceArgsDst = callFrame->registers() + argsOffset; @@ -2517,8 +2519,24 @@ DEFINE_STUB_FUNCTION(EncodedJSValue, op_resolve_with_base) DEFINE_STUB_FUNCTION(JSObject*, op_new_func_exp) { STUB_INIT_STACK_FRAME(stackFrame); + CallFrame* callFrame = stackFrame.callFrame; + + FunctionExecutable* function = stackFrame.args[0].function(); + JSFunction* func = function->make(callFrame, callFrame->scopeChain()); + + /* + The Identifier in a FunctionExpression can be referenced from inside + the FunctionExpression's FunctionBody to allow the function to call + itself recursively. However, unlike in a FunctionDeclaration, the + Identifier in a FunctionExpression cannot be referenced from and + does not affect the scope enclosing the FunctionExpression. + */ + if (!function->name().isNull()) { + JSStaticScopeObject* functionScopeObject = new (callFrame) JSStaticScopeObject(callFrame, function->name(), func, ReadOnly | DontDelete); + func->scope().push(functionScopeObject); + } - return stackFrame.args[0].funcExprNode()->makeFunction(stackFrame.callFrame, stackFrame.callFrame->scopeChain()); + return func; } DEFINE_STUB_FUNCTION(EncodedJSValue, op_mod) @@ -2978,7 +2996,7 @@ DEFINE_STUB_FUNCTION(JSObject*, op_new_error) unsigned bytecodeOffset = stackFrame.args[2].int32(); unsigned lineNumber = codeBlock->lineNumberForBytecodeOffset(callFrame, bytecodeOffset); - return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + return Error::create(callFrame, static_cast<ErrorType>(type), message.toString(callFrame), lineNumber, codeBlock->ownerExecutable()->sourceID(), codeBlock->ownerExecutable()->sourceURL()); } DEFINE_STUB_FUNCTION(void, op_debug) diff --git a/JavaScriptCore/jit/JITStubs.h b/JavaScriptCore/jit/JITStubs.h index 8f02435..1dbdeaa 100644 --- a/JavaScriptCore/jit/JITStubs.h +++ b/JavaScriptCore/jit/JITStubs.h @@ -42,6 +42,7 @@ namespace JSC { class CodeBlock; class ExecutablePool; + class FunctionExecutable; class Identifier; class JSGlobalData; class JSGlobalData; @@ -53,8 +54,6 @@ namespace JSC { class PropertySlot; class PutPropertySlot; class RegisterFile; - class FuncDeclNode; - class FuncExprNode; class JSGlobalObject; class RegExp; @@ -67,8 +66,7 @@ namespace JSC { Identifier& identifier() { return *static_cast<Identifier*>(asPointer); } int32_t int32() { return asInt32; } CodeBlock* codeBlock() { return static_cast<CodeBlock*>(asPointer); } - FuncDeclNode* funcDeclNode() { return static_cast<FuncDeclNode*>(asPointer); } - FuncExprNode* funcExprNode() { return static_cast<FuncExprNode*>(asPointer); } + FunctionExecutable* function() { return static_cast<FunctionExecutable*>(asPointer); } RegExp* regExp() { return static_cast<RegExp*>(asPointer); } JSPropertyNameIterator* propertyNameIterator() { return static_cast<JSPropertyNameIterator*>(asPointer); } JSGlobalObject* globalObject() { return static_cast<JSGlobalObject*>(asPointer); } diff --git a/JavaScriptCore/parser/Grammar.y b/JavaScriptCore/parser/Grammar.y index 354c786..227fdb5 100644 --- a/JavaScriptCore/parser/Grammar.y +++ b/JavaScriptCore/parser/Grammar.y @@ -25,18 +25,12 @@ #include "config.h" -#include <string.h> -#include <stdlib.h> -#include "JSValue.h" #include "JSObject.h" -#include "NodeConstructors.h" -#include "Lexer.h" #include "JSString.h" -#include "JSGlobalData.h" -#include "CommonIdentifiers.h" +#include "NodeConstructors.h" #include "NodeInfo.h" -#include "Parser.h" -#include <wtf/FastMalloc.h> +#include <stdlib.h> +#include <string.h> #include <wtf/MathExtras.h> #define YYMALLOC fastMalloc @@ -45,46 +39,44 @@ #define YYMAXDEPTH 10000 #define YYENABLE_NLS 0 -/* default values for bison */ +// Default values for bison. #define YYDEBUG 0 // Set to 1 to debug a parse error. #define jscyydebug 0 // Set to 1 to debug a parse error. #if !PLATFORM(DARWIN) - // avoid triggering warnings in older bison +// Avoid triggering warnings in older bison by not setting this on the Darwin platform. +// FIXME: Is this still needed? #define YYERROR_VERBOSE #endif int jscyylex(void* lvalp, void* llocp, void* globalPtr); int jscyyerror(const char*); + static inline bool allowAutomaticSemicolon(JSC::Lexer&, int); #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr) -#define LEXER (GLOBAL_DATA->lexer) - -#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0) -#define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot)) -#define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line) +#define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*GLOBAL_DATA->lexer, yychar)) YYABORT; } while (0) using namespace JSC; using namespace std; -static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end); -static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end); -static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end); -static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&); -static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end); -static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*); -static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end); -static ExpressionNode* makeNegateNode(void*, ExpressionNode*); -static NumberNode* makeNumberNode(void*, double); -static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*); -static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); -static StatementNode* makeVarStatementNode(void*, ExpressionNode*); -static ExpressionNode* combineCommaNodes(void*, ExpressionNode* list, ExpressionNode* init); +static ExpressionNode* makeAssignNode(JSGlobalData*, ExpressionNode* left, Operator, ExpressionNode* right, bool leftHasAssignments, bool rightHasAssignments, int start, int divot, int end); +static ExpressionNode* makePrefixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end); +static ExpressionNode* makePostfixNode(JSGlobalData*, ExpressionNode*, Operator, int start, int divot, int end); +static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData*, const Identifier& getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&); +static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData*, ExpressionNodeInfo function, ArgumentsNodeInfo, int start, int divot, int end); +static ExpressionNode* makeTypeOfNode(JSGlobalData*, ExpressionNode*); +static ExpressionNode* makeDeleteNode(JSGlobalData*, ExpressionNode*, int start, int divot, int end); +static ExpressionNode* makeNegateNode(JSGlobalData*, ExpressionNode*); +static NumberNode* makeNumberNode(JSGlobalData*, double); +static ExpressionNode* makeBitwiseNotNode(JSGlobalData*, ExpressionNode*); +static ExpressionNode* makeMultNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static ExpressionNode* makeDivNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static ExpressionNode* makeAddNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static ExpressionNode* makeSubNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static ExpressionNode* makeLeftShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static ExpressionNode* makeRightShiftNode(JSGlobalData*, ExpressionNode* left, ExpressionNode* right, bool rightHasAssignments); +static StatementNode* makeVarStatementNode(JSGlobalData*, ExpressionNode*); +static ExpressionNode* combineCommaNodes(JSGlobalData*, ExpressionNode* list, ExpressionNode* init); #if COMPILER(MSVC) @@ -97,17 +89,17 @@ static ExpressionNode* combineCommaNodes(void*, ExpressionNode* list, Expression #define YYPARSE_PARAM globalPtr #define YYLEX_PARAM globalPtr -template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserArenaData<DeclarationStacks::VarStack>* varDecls, - ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls, - CodeFeatures info, - int numConstants) +template <typename T> inline NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, + ParserArenaData<DeclarationStacks::VarStack>* varDecls, + ParserArenaData<DeclarationStacks::FunctionStack>* funcDecls, + CodeFeatures info, int numConstants) { ASSERT((info & ~AllFeatures) == 0); NodeDeclarationInfo<T> result = { node, varDecls, funcDecls, info, numConstants }; return result; } -template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants) +template <typename T> inline NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants) { ASSERT((info & ~AllFeatures) == 0); NodeInfo<T> result = { node, info, numConstants }; @@ -133,21 +125,21 @@ template <typename T> inline T mergeDeclarationLists(T decls1, T decls2) return decls1; } -static void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs) +static void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs) { if (!varDecls) - varDecls = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>; + varDecls = new (globalData) ParserArenaData<DeclarationStacks::VarStack>; varDecls->data.append(make_pair(ident, attrs)); } -static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl) +static inline void appendToVarDeclarationList(JSGlobalData* globalData, ParserArenaData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl) { unsigned attrs = DeclarationStacks::IsConstant; if (decl->hasInitializer()) attrs |= DeclarationStacks::HasInitializer; - appendToVarDeclarationList(globalPtr, varDecls, decl->ident(), attrs); + appendToVarDeclarationList(globalData, varDecls, decl->ident(), attrs); } %} @@ -184,6 +176,20 @@ static inline void appendToVarDeclarationList(void* globalPtr, ParserArenaData<D Operator op; } +%{ + +template <typename T> inline void setStatementLocation(StatementNode* statement, const T& start, const T& end) +{ + statement->setLoc(start.first_line, end.last_line); +} + +static inline void setExceptionLocation(ThrowableExpressionData* node, unsigned start, unsigned divot, unsigned end) +{ + node->setExceptionSourceCode(divot, divot - start, end - divot); +} + +%} + %start Program /* literals */ @@ -291,21 +297,25 @@ Literal: | NUMBER { $$ = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, $1), 0, 1); } | STRING { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) StringNode(GLOBAL_DATA, *$1), 0, 1); } | '/' /* regexp */ { - Lexer& l = *LEXER; - if (!l.scanRegExp()) + Lexer& l = *GLOBAL_DATA->lexer; + const Identifier* pattern; + const Identifier* flags; + if (!l.scanRegExp(pattern, flags)) YYABORT; - RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, l.pattern(), l.flags()); - int size = l.pattern().size() + 2; // + 2 for the two /'s - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size); + RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags); + int size = pattern->size() + 2; // + 2 for the two /'s + setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size); $$ = createNodeInfo<ExpressionNode*>(node, 0, 0); } | DIVEQUAL /* regexp with /= */ { - Lexer& l = *LEXER; - if (!l.scanRegExp()) + Lexer& l = *GLOBAL_DATA->lexer; + const Identifier* pattern; + const Identifier* flags; + if (!l.scanRegExp(pattern, flags, '=')) YYABORT; - RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags()); - int size = l.pattern().size() + 2; // + 2 for the two /'s - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.first_column + size, @1.first_column + size); + RegExpNode* node = new (GLOBAL_DATA) RegExpNode(GLOBAL_DATA, *pattern, *flags); + int size = pattern->size() + 2; // + 2 for the two /'s + setExceptionLocation(node, @1.first_column, @1.first_column + size, @1.first_column + size); $$ = createNodeInfo<ExpressionNode*>(node, 0, 0); } ; @@ -313,14 +323,14 @@ Literal: Property: IDENT ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } | STRING ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, *$1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } - | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from($1)), $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } - | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, 0, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); if (!$$.m_node) YYABORT; } + | NUMBER ':' AssignmentExpr { $$ = createNodeInfo<PropertyNode*>(new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, $1, $3.m_node, PropertyNode::Constant), $3.m_features, $3.m_numConstants); } + | IDENT IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, 0, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); if (!$$.m_node) YYABORT; } | IDENT IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE { - $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *$1, *$2, $4.m_node.head, $7, LEXER->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0); + $$ = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(GLOBAL_DATA, *$1, *$2, $4.m_node.head, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line)), $4.m_features | ClosureFeature, 0); if ($4.m_features & ArgumentsFeature) $7->setUsesArguments(); - DBG($7, @6, @8); + setStatementLocation($7, @6, @8); if (!$$.m_node) YYABORT; } @@ -385,15 +395,15 @@ MemberExpr: PrimaryExpr | FunctionExpr { $$ = createNodeInfo<ExpressionNode*>($1.m_node, $1.m_features, $1.m_numConstants); } | MemberExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | MemberExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); } | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants); } ; @@ -401,15 +411,15 @@ MemberExpr: MemberExprNoBF: PrimaryExprNoBrace | MemberExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | MemberExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); } | NEW MemberExpr Arguments { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node, $3.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features | $3.m_features, $2.m_numConstants + $3.m_numConstants); } ; @@ -417,7 +427,7 @@ MemberExprNoBF: NewExpr: MemberExpr | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants); } ; @@ -425,32 +435,32 @@ NewExpr: NewExprNoBF: MemberExprNoBF | NEW NewExpr { NewExprNode* node = new (GLOBAL_DATA) NewExprNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $2.m_features, $2.m_numConstants); } ; CallExpr: - MemberExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); } - | CallExpr Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); } + MemberExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); } + | CallExpr Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); } | CallExpr '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | CallExpr '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); } ; CallExprNoBF: - MemberExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); } - | CallExprNoBF Arguments { $$ = makeFunctionCallNode(globalPtr, $1, $2, @1.first_column, @1.last_column, @2.last_column); } + MemberExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); } + | CallExprNoBF Arguments { $$ = makeFunctionCallNode(GLOBAL_DATA, $1, $2, @1.first_column, @1.last_column, @2.last_column); } | CallExprNoBF '[' Expr ']' { BracketAccessorNode* node = new (GLOBAL_DATA) BracketAccessorNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @4.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @4.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | CallExprNoBF '.' IDENT { DotAccessorNode* node = new (GLOBAL_DATA) DotAccessorNode(GLOBAL_DATA, $1.m_node, *$3); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features, $1.m_numConstants); } ; @@ -568,10 +578,10 @@ RelationalExpr: | RelationalExpr LE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) LessEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExpr GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExpr INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExpr INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } ; @@ -583,7 +593,7 @@ RelationalExprNoIn: | RelationalExprNoIn GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExprNoIn INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } ; @@ -595,11 +605,11 @@ RelationalExprNoBF: | RelationalExprNoBF GE ShiftExpr { $$ = createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) GreaterEqNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature), $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExprNoBF INSTANCEOF ShiftExpr { InstanceOfNode* node = new (GLOBAL_DATA) InstanceOfNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } | RelationalExprNoBF INTOKEN ShiftExpr { InNode* node = new (GLOBAL_DATA) InNode(GLOBAL_DATA, $1.m_node, $3.m_node, $3.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @3.first_column, @3.last_column); + setExceptionLocation(node, @1.first_column, @3.first_column, @3.last_column); $$ = createNodeInfo<ExpressionNode*>(node, $1.m_features | $3.m_features, $1.m_numConstants + $3.m_numConstants); } ; @@ -810,17 +820,17 @@ Statement: ; Block: - OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); - DBG($$.m_node, @1, @2); } - | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - DBG($$.m_node, @1, @3); } + OPENBRACE CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); + setStatementLocation($$.m_node, @1, @2); } + | OPENBRACE SourceElements CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BlockNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); + setStatementLocation($$.m_node, @1, @3); } ; VariableStatement: VAR VariableDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - DBG($$.m_node, @1, @3); } + setStatementLocation($$.m_node, @1, @3); } | VAR VariableDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, $2.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - DBG($$.m_node, @1, @2); + setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; @@ -833,7 +843,7 @@ VariableDeclarationList: $$.m_numConstants = 0; } | IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column); $$.m_node = node; $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>; appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer); @@ -851,7 +861,7 @@ VariableDeclarationList: } | VariableDeclarationList ',' IDENT Initializer { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column); + setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column); $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node); $$.m_varDeclarations = $1.m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer); @@ -870,7 +880,7 @@ VariableDeclarationListNoIn: $$.m_numConstants = 0; } | IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$1, $2.m_node, $2.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.first_column + 1, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.first_column + 1, @2.last_column); $$.m_node = node; $$.m_varDeclarations = new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::VarStack>; appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$1, DeclarationStacks::HasInitializer); @@ -888,7 +898,7 @@ VariableDeclarationListNoIn: } | VariableDeclarationListNoIn ',' IDENT InitializerNoIn { AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, *$3, $4.m_node, $4.m_features & AssignFeature); - SET_EXCEPTION_LOCATION(node, @3.first_column, @4.first_column + 1, @4.last_column); + setExceptionLocation(node, @3.first_column, @4.first_column + 1, @4.last_column); $$.m_node = combineCommaNodes(GLOBAL_DATA, $1.m_node, node); $$.m_varDeclarations = $1.m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, $$.m_varDeclarations, *$3, DeclarationStacks::HasInitializer); @@ -900,10 +910,10 @@ VariableDeclarationListNoIn: ConstStatement: CONSTTOKEN ConstDeclarationList ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - DBG($$.m_node, @1, @3); } + setStatementLocation($$.m_node, @1, @3); } | CONSTTOKEN ConstDeclarationList error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ConstStatementNode(GLOBAL_DATA, $2.m_node.head), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features, $2.m_numConstants); - DBG($$.m_node, @1, @2); AUTO_SEMICOLON; } + setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; ConstDeclarationList: @@ -945,36 +955,36 @@ EmptyStatement: ExprStatement: ExprNoBF ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } | ExprNoBF error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ExprStatementNode(GLOBAL_DATA, $1.m_node), 0, 0, $1.m_features, $1.m_numConstants); - DBG($$.m_node, @1, @1); AUTO_SEMICOLON; } + setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } ; IfStatement: IF '(' Expr ')' Statement %prec IF_WITHOUT_ELSE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @4); } + setStatementLocation($$.m_node, @1, @4); } | IF '(' Expr ')' Statement ELSE Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) IfElseNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node), mergeDeclarationLists($5.m_varDeclarations, $7.m_varDeclarations), mergeDeclarationLists($5.m_funcDeclarations, $7.m_funcDeclarations), $3.m_features | $5.m_features | $7.m_features, $3.m_numConstants + $5.m_numConstants + $7.m_numConstants); - DBG($$.m_node, @1, @4); } + setStatementLocation($$.m_node, @1, @4); } ; IterationStatement: DO Statement WHILE '(' Expr ')' ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @3); } + setStatementLocation($$.m_node, @1, @3); } | DO Statement WHILE '(' Expr ')' error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DoWhileNode(GLOBAL_DATA, $2.m_node, $5.m_node), $2.m_varDeclarations, $2.m_funcDeclarations, $2.m_features | $5.m_features, $2.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @3); } // Always performs automatic semicolon insertion. + setStatementLocation($$.m_node, @1, @3); } // Always performs automatic semicolon insertion. | WHILE '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WhileNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @4); } + setStatementLocation($$.m_node, @1, @4); } | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node, $9.m_node, false), $9.m_varDeclarations, $9.m_funcDeclarations, $3.m_features | $5.m_features | $7.m_features | $9.m_features, $3.m_numConstants + $5.m_numConstants + $7.m_numConstants + $9.m_numConstants); - DBG($$.m_node, @1, @8); + setStatementLocation($$.m_node, @1, @8); } | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) ForNode(GLOBAL_DATA, $4.m_node, $6.m_node, $8.m_node, $10.m_node, true), @@ -982,30 +992,30 @@ IterationStatement: mergeDeclarationLists($4.m_funcDeclarations, $10.m_funcDeclarations), $4.m_features | $6.m_features | $8.m_features | $10.m_features, $4.m_numConstants + $6.m_numConstants + $8.m_numConstants + $10.m_numConstants); - DBG($$.m_node, @1, @9); } + setStatementLocation($$.m_node, @1, @9); } | FOR '(' LeftHandSideExpr INTOKEN Expr ')' Statement { ForInNode* node = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, $3.m_node, $5.m_node, $7.m_node); - SET_EXCEPTION_LOCATION(node, @3.first_column, @3.last_column, @5.last_column); + setExceptionLocation(node, @3.first_column, @3.last_column, @5.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, $7.m_varDeclarations, $7.m_funcDeclarations, $3.m_features | $5.m_features | $7.m_features, $3.m_numConstants + $5.m_numConstants + $7.m_numConstants); - DBG($$.m_node, @1, @6); + setStatementLocation($$.m_node, @1, @6); } | FOR '(' VAR IDENT INTOKEN Expr ')' Statement { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, 0, $6.m_node, $8.m_node, @5.first_column, @5.first_column - @4.first_column, @6.last_column - @5.first_column); - SET_EXCEPTION_LOCATION(forIn, @4.first_column, @5.first_column + 1, @6.last_column); + setExceptionLocation(forIn, @4.first_column, @5.first_column + 1, @6.last_column); appendToVarDeclarationList(GLOBAL_DATA, $8.m_varDeclarations, *$4, DeclarationStacks::HasInitializer); $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $8.m_varDeclarations, $8.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $6.m_features | $8.m_features, $6.m_numConstants + $8.m_numConstants); - DBG($$.m_node, @1, @7); } + setStatementLocation($$.m_node, @1, @7); } | FOR '(' VAR IDENT InitializerNoIn INTOKEN Expr ')' Statement { ForInNode *forIn = new (GLOBAL_DATA) ForInNode(GLOBAL_DATA, *$4, $5.m_node, $7.m_node, $9.m_node, @5.first_column, @5.first_column - @4.first_column, @5.last_column - @5.first_column); - SET_EXCEPTION_LOCATION(forIn, @4.first_column, @6.first_column + 1, @7.last_column); + setExceptionLocation(forIn, @4.first_column, @6.first_column + 1, @7.last_column); appendToVarDeclarationList(GLOBAL_DATA, $9.m_varDeclarations, *$4, DeclarationStacks::HasInitializer); $$ = createNodeDeclarationInfo<StatementNode*>(forIn, $9.m_varDeclarations, $9.m_funcDeclarations, ((*$4 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $5.m_features | $7.m_features | $9.m_features, $5.m_numConstants + $7.m_numConstants + $9.m_numConstants); - DBG($$.m_node, @1, @8); } + setStatementLocation($$.m_node, @1, @8); } ; ExprOpt: @@ -1020,63 +1030,63 @@ ExprNoInOpt: ContinueStatement: CONTINUE ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } | CONTINUE error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); - DBG($$.m_node, @1, @1); AUTO_SEMICOLON; } + setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } | CONTINUE IDENT ';' { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); - DBG($$.m_node, @1, @3); } + setStatementLocation($$.m_node, @1, @3); } | CONTINUE IDENT error { ContinueNode* node = new (GLOBAL_DATA) ContinueNode(GLOBAL_DATA, *$2); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); - DBG($$.m_node, @1, @2); AUTO_SEMICOLON; } + setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; BreakStatement: BREAK ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); } + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); } | BREAK error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; } + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } | BREAK IDENT ';' { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @3); } + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @3); } | BREAK IDENT error { BreakNode* node = new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; } + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) BreakNode(GLOBAL_DATA, *$2), 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; ReturnStatement: RETURN ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @2); } + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @2); } | RETURN error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, 0); - SET_EXCEPTION_LOCATION(node, @1.first_column, @1.last_column, @1.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG($$.m_node, @1, @1); AUTO_SEMICOLON; } + setExceptionLocation(node, @1.first_column, @1.last_column, @1.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } | RETURN Expr ';' { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @3); } + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @3); } | RETURN Expr error { ReturnNode* node = new (GLOBAL_DATA) ReturnNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; } + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; WithStatement: WITH '(' Expr ')' Statement { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) WithNode(GLOBAL_DATA, $3.m_node, $5.m_node, @3.last_column, @3.last_column - @3.first_column), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features | WithFeature, $3.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @4); } + setStatementLocation($$.m_node, @1, @4); } ; SwitchStatement: SWITCH '(' Expr ')' CaseBlock { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) SwitchNode(GLOBAL_DATA, $3.m_node, $5.m_node), $5.m_varDeclarations, $5.m_funcDeclarations, $3.m_features | $5.m_features, $3.m_numConstants + $5.m_numConstants); - DBG($$.m_node, @1, @4); } + setStatementLocation($$.m_node, @1, @4); } ; CaseBlock: @@ -1090,7 +1100,7 @@ CaseBlock: ; CaseClausesOpt: -/* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; } + /* nothing */ { $$.m_node.head = 0; $$.m_node.tail = 0; $$.m_varDeclarations = 0; $$.m_funcDeclarations = 0; $$.m_features = 0; $$.m_numConstants = 0; } | CaseClauses ; @@ -1122,18 +1132,18 @@ DefaultClause: LabelledStatement: IDENT ':' Statement { LabelNode* node = new (GLOBAL_DATA) LabelNode(GLOBAL_DATA, *$1, $3.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); $$ = createNodeDeclarationInfo<StatementNode*>(node, $3.m_varDeclarations, $3.m_funcDeclarations, $3.m_features, $3.m_numConstants); } ; ThrowStatement: THROW Expr ';' { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); } | THROW Expr error { ThrowNode* node = new (GLOBAL_DATA) ThrowNode(GLOBAL_DATA, $2.m_node); - SET_EXCEPTION_LOCATION(node, @1.first_column, @2.last_column, @2.last_column); - $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); DBG($$.m_node, @1, @2); AUTO_SEMICOLON; + setExceptionLocation(node, @1.first_column, @2.last_column, @2.last_column); + $$ = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, $2.m_features, $2.m_numConstants); setStatementLocation($$.m_node, @1, @2); AUTO_SEMICOLON; } ; @@ -1143,57 +1153,57 @@ TryStatement: mergeDeclarationLists($2.m_funcDeclarations, $4.m_funcDeclarations), $2.m_features | $4.m_features, $2.m_numConstants + $4.m_numConstants); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } | TRY Block CATCH '(' IDENT ')' Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, 0), mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $2.m_features | $7.m_features | CatchFeature, $2.m_numConstants + $7.m_numConstants); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } | TRY Block CATCH '(' IDENT ')' Block FINALLY Block { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) TryNode(GLOBAL_DATA, $2.m_node, *$5, ($7.m_features & EvalFeature) != 0, $7.m_node, $9.m_node), mergeDeclarationLists(mergeDeclarationLists($2.m_varDeclarations, $7.m_varDeclarations), $9.m_varDeclarations), mergeDeclarationLists(mergeDeclarationLists($2.m_funcDeclarations, $7.m_funcDeclarations), $9.m_funcDeclarations), $2.m_features | $7.m_features | $9.m_features | CatchFeature, $2.m_numConstants + $7.m_numConstants + $9.m_numConstants); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } ; DebuggerStatement: DEBUGGER ';' { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); - DBG($$.m_node, @1, @2); } + setStatementLocation($$.m_node, @1, @2); } | DEBUGGER error { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); - DBG($$.m_node, @1, @1); AUTO_SEMICOLON; } + setStatementLocation($$.m_node, @1, @1); AUTO_SEMICOLON; } ; FunctionDeclaration: - FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); } + FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); setStatementLocation($6, @5, @7); $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); } | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE - { - $$ = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0); + { + $$ = createNodeDeclarationInfo<StatementNode*>(new (GLOBAL_DATA) FuncDeclNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), 0, new (GLOBAL_DATA) ParserArenaData<DeclarationStacks::FunctionStack>, ((*$2 == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | $4.m_features | ClosureFeature, 0); if ($4.m_features & ArgumentsFeature) - $7->setUsesArguments(); - DBG($7, @6, @8); - $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)); + $7->setUsesArguments(); + setStatementLocation($7, @6, @8); + $$.m_funcDeclarations->data.append(static_cast<FuncDeclNode*>($$.m_node)->body()); } ; FunctionExpr: - FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, LEXER->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); DBG($5, @4, @6); } - | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE - { - $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, LEXER->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0); - if ($3.m_features & ArgumentsFeature) + FUNCTION '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $5, GLOBAL_DATA->lexer->sourceCode($4, $6, @4.first_line)), ClosureFeature, 0); setStatementLocation($5, @4, @6); } + | FUNCTION '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE + { + $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line), $3.m_node.head), $3.m_features | ClosureFeature, 0); + if ($3.m_features & ArgumentsFeature) $6->setUsesArguments(); - DBG($6, @5, @7); + setStatementLocation($6, @5, @7); } - | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $6, LEXER->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); DBG($6, @5, @7); } - | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE - { - $$ = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *$2, $7, LEXER->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0); + | FUNCTION IDENT '(' ')' OPENBRACE FunctionBody CLOSEBRACE { $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $6, GLOBAL_DATA->lexer->sourceCode($5, $7, @5.first_line)), ClosureFeature, 0); setStatementLocation($6, @5, @7); } + | FUNCTION IDENT '(' FormalParameterList ')' OPENBRACE FunctionBody CLOSEBRACE + { + $$ = createNodeInfo(new (GLOBAL_DATA) FuncExprNode(GLOBAL_DATA, *$2, $7, GLOBAL_DATA->lexer->sourceCode($6, $8, @6.first_line), $4.m_node.head), $4.m_features | ClosureFeature, 0); if ($4.m_features & ArgumentsFeature) $7->setUsesArguments(); - DBG($7, @6, @8); + setStatementLocation($7, @6, @8); } ; @@ -1241,8 +1251,8 @@ Literal_NoNode: | FALSETOKEN | NUMBER { } | STRING { } - | '/' /* regexp */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; } - | DIVEQUAL /* regexp with /= */ { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; } + | '/' /* regexp */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; } + | DIVEQUAL /* regexp with /= */ { if (!GLOBAL_DATA->lexer->skipRegExp()) YYABORT; } ; Property_NoNode: @@ -1824,26 +1834,28 @@ SourceElements_NoNode: %% -static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) +#undef GLOBAL_DATA + +static ExpressionNode* makeAssignNode(JSGlobalData* globalData, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) { if (!loc->isLocation()) - return new (GLOBAL_DATA) AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot); + return new (globalData) AssignErrorNode(globalData, loc, op, expr, divot, divot - start, end - divot); if (loc->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(loc); if (op == OpEqual) { - AssignResolveNode* node = new (GLOBAL_DATA) AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments); - SET_EXCEPTION_LOCATION(node, start, divot, end); + AssignResolveNode* node = new (globalData) AssignResolveNode(globalData, resolve->identifier(), expr, exprHasAssignments); + setExceptionLocation(node, start, divot, end); return node; } else - return new (GLOBAL_DATA) ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); + return new (globalData) ReadModifyResolveNode(globalData, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); } if (loc->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc); if (op == OpEqual) - return new (GLOBAL_DATA) AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot()); + return new (globalData) AssignBracketNode(globalData, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot()); else { - ReadModifyBracketNode* node = new (GLOBAL_DATA) ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot); + ReadModifyBracketNode* node = new (globalData) ReadModifyBracketNode(globalData, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return node; } @@ -1851,117 +1863,117 @@ static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Oper ASSERT(loc->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc); if (op == OpEqual) - return new (GLOBAL_DATA) AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot()); + return new (globalData) AssignDotNode(globalData, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot()); - ReadModifyDotNode* node = new (GLOBAL_DATA) ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); + ReadModifyDotNode* node = new (globalData) ReadModifyDotNode(globalData, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return node; } -static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end) +static ExpressionNode* makePrefixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end) { if (!expr->isLocation()) - return new (GLOBAL_DATA) PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot); + return new (globalData) PrefixErrorNode(globalData, expr, op, divot, divot - start, end - divot); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); - return new (GLOBAL_DATA) PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot); + return new (globalData) PrefixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); - PrefixBracketNode* node = new (GLOBAL_DATA) PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); + PrefixBracketNode* node = new (globalData) PrefixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->startOffset()); return node; } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); - PrefixDotNode* node = new (GLOBAL_DATA) PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); + PrefixDotNode* node = new (globalData) PrefixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->startOffset()); return node; } -static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end) +static ExpressionNode* makePostfixNode(JSGlobalData* globalData, ExpressionNode* expr, Operator op, int start, int divot, int end) { if (!expr->isLocation()) - return new (GLOBAL_DATA) PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot); + return new (globalData) PostfixErrorNode(globalData, expr, op, divot, divot - start, end - divot); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); - return new (GLOBAL_DATA) PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot); + return new (globalData) PostfixResolveNode(globalData, resolve->identifier(), op, divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); - PostfixBracketNode* node = new (GLOBAL_DATA) PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); + PostfixBracketNode* node = new (globalData) PostfixBracketNode(globalData, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return node; } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); - PostfixDotNode* node = new (GLOBAL_DATA) PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); + PostfixDotNode* node = new (globalData) PostfixDotNode(globalData, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return node; } -static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end) +static ExpressionNodeInfo makeFunctionCallNode(JSGlobalData* globalData, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end) { CodeFeatures features = func.m_features | args.m_features; int numConstants = func.m_numConstants + args.m_numConstants; if (!func.m_node->isLocation()) - return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants); + return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallValueNode(globalData, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants); if (func.m_node->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node); const Identifier& identifier = resolve->identifier(); - if (identifier == GLOBAL_DATA->propertyNames->eval) - return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants); - return createNodeInfo<ExpressionNode*>(new (GLOBAL_DATA) FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants); + if (identifier == globalData->propertyNames->eval) + return createNodeInfo<ExpressionNode*>(new (globalData) EvalFunctionCallNode(globalData, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants); + return createNodeInfo<ExpressionNode*>(new (globalData) FunctionCallResolveNode(globalData, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants); } if (func.m_node->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node); - FunctionCallBracketNode* node = new (GLOBAL_DATA) FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot); + FunctionCallBracketNode* node = new (globalData) FunctionCallBracketNode(globalData, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return createNodeInfo<ExpressionNode*>(node, features, numConstants); } ASSERT(func.m_node->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node); FunctionCallDotNode* node; - if (dot->identifier() == GLOBAL_DATA->propertyNames->call) - node = new (GLOBAL_DATA) CallFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); - else if (dot->identifier() == GLOBAL_DATA->propertyNames->apply) - node = new (GLOBAL_DATA) ApplyFunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); + if (dot->identifier() == globalData->propertyNames->call) + node = new (globalData) CallFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); + else if (dot->identifier() == globalData->propertyNames->apply) + node = new (globalData) ApplyFunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); else - node = new (GLOBAL_DATA) FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); + node = new (globalData) FunctionCallDotNode(globalData, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return createNodeInfo<ExpressionNode*>(node, features, numConstants); } -static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr) +static ExpressionNode* makeTypeOfNode(JSGlobalData* globalData, ExpressionNode* expr) { if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); - return new (GLOBAL_DATA) TypeOfResolveNode(GLOBAL_DATA, resolve->identifier()); + return new (globalData) TypeOfResolveNode(globalData, resolve->identifier()); } - return new (GLOBAL_DATA) TypeOfValueNode(GLOBAL_DATA, expr); + return new (globalData) TypeOfValueNode(globalData, expr); } -static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end) +static ExpressionNode* makeDeleteNode(JSGlobalData* globalData, ExpressionNode* expr, int start, int divot, int end) { if (!expr->isLocation()) - return new (GLOBAL_DATA) DeleteValueNode(GLOBAL_DATA, expr); + return new (globalData) DeleteValueNode(globalData, expr); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); - return new (GLOBAL_DATA) DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot); + return new (globalData) DeleteResolveNode(globalData, resolve->identifier(), divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); - return new (GLOBAL_DATA) DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); + return new (globalData) DeleteBracketNode(globalData, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); - return new (GLOBAL_DATA) DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot); + return new (globalData) DeleteDotNode(globalData, dot->base(), dot->identifier(), divot, divot - start, end - divot); } -static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source) +static PropertyNode* makeGetterOrSetterPropertyNode(JSGlobalData* globalData, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source) { PropertyNode::Type type; if (getOrSet == "get") @@ -1970,10 +1982,10 @@ static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Ident type = PropertyNode::Setter; else return 0; - return new (GLOBAL_DATA) PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type); + return new (globalData) PropertyNode(globalData, name, new (globalData) FuncExprNode(globalData, globalData->propertyNames->nullIdentifier, body, source, params), type); } -static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n) +static ExpressionNode* makeNegateNode(JSGlobalData* globalData, ExpressionNode* n) { if (n->isNumber()) { NumberNode* number = static_cast<NumberNode*>(n); @@ -1984,92 +1996,92 @@ static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n) } } - return new (GLOBAL_DATA) NegateNode(GLOBAL_DATA, n); + return new (globalData) NegateNode(globalData, n); } -static NumberNode* makeNumberNode(void* globalPtr, double d) +static NumberNode* makeNumberNode(JSGlobalData* globalData, double d) { - return new (GLOBAL_DATA) NumberNode(GLOBAL_DATA, d); + return new (globalData) NumberNode(globalData, d); } -static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr) +static ExpressionNode* makeBitwiseNotNode(JSGlobalData* globalData, ExpressionNode* expr) { if (expr->isNumber()) - return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value())); - return new (GLOBAL_DATA) BitwiseNotNode(GLOBAL_DATA, expr); + return makeNumberNode(globalData, ~toInt32(static_cast<NumberNode*>(expr)->value())); + return new (globalData) BitwiseNotNode(globalData, expr); } -static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeMultNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value()); + return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value()); if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1) - return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr2); + return new (globalData) UnaryPlusNode(globalData, expr2); if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1) - return new (GLOBAL_DATA) UnaryPlusNode(GLOBAL_DATA, expr1); + return new (globalData) UnaryPlusNode(globalData, expr1); - return new (GLOBAL_DATA) MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return new (globalData) MultNode(globalData, expr1, expr2, rightHasAssignments); } -static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeDivNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value()); - return new (GLOBAL_DATA) DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value()); + return new (globalData) DivNode(globalData, expr1, expr2, rightHasAssignments); } -static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeAddNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value()); - return new (GLOBAL_DATA) AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value()); + return new (globalData) AddNode(globalData, expr1, expr2, rightHasAssignments); } -static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeSubNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value()); - return new (GLOBAL_DATA) SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return makeNumberNode(globalData, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value()); + return new (globalData) SubNode(globalData, expr1, expr2, rightHasAssignments); } -static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeLeftShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); - return new (GLOBAL_DATA) LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); + return new (globalData) LeftShiftNode(globalData, expr1, expr2, rightHasAssignments); } -static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) +static ExpressionNode* makeRightShiftNode(JSGlobalData* globalData, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) - return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); - return new (GLOBAL_DATA) RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); + return makeNumberNode(globalData, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); + return new (globalData) RightShiftNode(globalData, expr1, expr2, rightHasAssignments); } -/* called by yyparse on error */ -int yyerror(const char *) +// Called by yyparse on error. +int yyerror(const char*) { return 1; } -/* may we automatically insert a semicolon ? */ +// May we automatically insert a semicolon? static bool allowAutomaticSemicolon(Lexer& lexer, int yychar) { return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator(); } -static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list, ExpressionNode* init) +static ExpressionNode* combineCommaNodes(JSGlobalData* globalData, ExpressionNode* list, ExpressionNode* init) { if (!list) return init; @@ -2077,17 +2089,15 @@ static ExpressionNode* combineCommaNodes(void* globalPtr, ExpressionNode* list, static_cast<CommaNode*>(list)->append(init); return list; } - return new (GLOBAL_DATA) CommaNode(GLOBAL_DATA, list, init); + return new (globalData) CommaNode(globalData, list, init); } // We turn variable declarations into either assignments or empty // statements (which later get stripped out), because the actual // declaration work is hoisted up to the start of the function body -static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr) +static StatementNode* makeVarStatementNode(JSGlobalData* globalData, ExpressionNode* expr) { if (!expr) - return new (GLOBAL_DATA) EmptyStatementNode(GLOBAL_DATA); - return new (GLOBAL_DATA) VarStatementNode(GLOBAL_DATA, expr); + return new (globalData) EmptyStatementNode(globalData); + return new (globalData) VarStatementNode(globalData, expr); } - -#undef GLOBAL_DATA diff --git a/JavaScriptCore/parser/Lexer.cpp b/JavaScriptCore/parser/Lexer.cpp index 8e89c18..febd9a4 100644 --- a/JavaScriptCore/parser/Lexer.cpp +++ b/JavaScriptCore/parser/Lexer.cpp @@ -908,45 +908,107 @@ returnError: return -1; } -bool Lexer::scanRegExp() +bool Lexer::scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix) { ASSERT(m_buffer16.isEmpty()); bool lastWasEscape = false; bool inBrackets = false; + if (patternPrefix) { + ASSERT(!isLineTerminator(patternPrefix)); + ASSERT(patternPrefix != '/'); + ASSERT(patternPrefix != '['); + record16(patternPrefix); + } + while (true) { - if (isLineTerminator(m_current) || m_current == -1) - return false; - if (m_current != '/' || lastWasEscape || inBrackets) { - // keep track of '[' and ']' - if (!lastWasEscape) { - if (m_current == '[' && !inBrackets) - inBrackets = true; - if (m_current == ']' && inBrackets) - inBrackets = false; - } - record16(m_current); - lastWasEscape = !lastWasEscape && m_current == '\\'; - } else { // end of regexp - m_pattern = UString(m_buffer16); + int current = m_current; + + if (isLineTerminator(current) || current == -1) { m_buffer16.resize(0); - shift1(); - break; + return false; } + shift1(); + + if (current == '/' && !lastWasEscape && !inBrackets) + break; + + record16(current); + + if (lastWasEscape) { + lastWasEscape = false; + continue; + } + + switch (current) { + case '[': + inBrackets = true; + break; + case ']': + inBrackets = false; + break; + case '\\': + lastWasEscape = true; + break; + } } + pattern = makeIdentifier(m_buffer16.data(), m_buffer16.size()); + m_buffer16.resize(0); + while (isIdentPart(m_current)) { record16(m_current); shift1(); } - m_flags = UString(m_buffer16); + + flags = makeIdentifier(m_buffer16.data(), m_buffer16.size()); m_buffer16.resize(0); return true; } +bool Lexer::skipRegExp() +{ + bool lastWasEscape = false; + bool inBrackets = false; + + while (true) { + int current = m_current; + + if (isLineTerminator(current) || current == -1) + return false; + + shift1(); + + if (current == '/' && !lastWasEscape && !inBrackets) + break; + + if (lastWasEscape) { + lastWasEscape = false; + continue; + } + + switch (current) { + case '[': + inBrackets = true; + break; + case ']': + inBrackets = false; + break; + case '\\': + lastWasEscape = true; + break; + } + } + + while (isIdentPart(m_current)) + shift1(); + + return true; +} + void Lexer::clear() { m_identifiers.clear(); @@ -961,9 +1023,6 @@ void Lexer::clear() m_buffer16.swap(newBuffer16); m_isReparsing = false; - - m_pattern = UString(); - m_flags = UString(); } SourceCode Lexer::sourceCode(int openBrace, int closeBrace, int firstLine) diff --git a/JavaScriptCore/parser/Lexer.h b/JavaScriptCore/parser/Lexer.h index 2583162..23c2890 100644 --- a/JavaScriptCore/parser/Lexer.h +++ b/JavaScriptCore/parser/Lexer.h @@ -50,9 +50,8 @@ namespace JSC { int lineNumber() const { return m_lineNumber; } bool prevTerminator() const { return m_terminator; } SourceCode sourceCode(int openBrace, int closeBrace, int firstLine); - bool scanRegExp(); - const UString& pattern() const { return m_pattern; } - const UString& flags() const { return m_flags; } + bool scanRegExp(const Identifier*& pattern, const Identifier*& flags, UChar patternPrefix = 0); + bool skipRegExp(); // Functions for use after parsing. bool sawError() const { return m_error; } @@ -112,9 +111,6 @@ namespace JSC { JSGlobalData* m_globalData; - UString m_pattern; - UString m_flags; - const HashTable m_keywordTable; Vector<UChar> m_codeWithoutBOMs; diff --git a/JavaScriptCore/parser/NodeConstructors.h b/JavaScriptCore/parser/NodeConstructors.h index 780a624..0052746 100644 --- a/JavaScriptCore/parser/NodeConstructors.h +++ b/JavaScriptCore/parser/NodeConstructors.h @@ -89,7 +89,7 @@ namespace JSC { { } - inline RegExpNode::RegExpNode(JSGlobalData* globalData, const UString& pattern, const UString& flags) + inline RegExpNode::RegExpNode(JSGlobalData* globalData, const Identifier& pattern, const Identifier& flags) : ExpressionNode(globalData) , m_pattern(pattern) , m_flags(flags) @@ -154,6 +154,13 @@ namespace JSC { { } + inline PropertyNode::PropertyNode(JSGlobalData* globalData, double name, ExpressionNode* assign, Type type) + : m_name(Identifier(globalData, UString::from(name))) + , m_assign(assign) + , m_type(type) + { + } + inline PropertyListNode::PropertyListNode(JSGlobalData* globalData, PropertyNode* node) : Node(globalData) , m_node(node) @@ -814,20 +821,16 @@ namespace JSC { inline FuncExprNode::FuncExprNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) : ExpressionNode(globalData) - , ParserArenaRefCounted(globalData) - , m_ident(ident) , m_body(body) { - m_body->finishParsing(source, parameter); + m_body->finishParsing(source, parameter, ident); } inline FuncDeclNode::FuncDeclNode(JSGlobalData* globalData, const Identifier& ident, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter) : StatementNode(globalData) - , ParserArenaRefCounted(globalData) - , m_ident(ident) , m_body(body) { - m_body->finishParsing(source, parameter); + m_body->finishParsing(source, parameter, ident); } inline CaseClauseNode::CaseClauseNode(JSGlobalData*, ExpressionNode* expr) diff --git a/JavaScriptCore/parser/Nodes.cpp b/JavaScriptCore/parser/Nodes.cpp index 4324a06..11a24b5 100644 --- a/JavaScriptCore/parser/Nodes.cpp +++ b/JavaScriptCore/parser/Nodes.cpp @@ -138,7 +138,7 @@ RegisterID* StringNode::emitBytecode(BytecodeGenerator& generator, RegisterID* d RegisterID* RegExpNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { - RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern, m_flags); + RefPtr<RegExp> regExp = RegExp::create(generator.globalData(), m_pattern.ustring(), m_flags.ustring()); if (!regExp->isValid()) return emitThrowError(generator, SyntaxError, ("Invalid regular expression: " + UString(regExp->errorMessage())).UTF8String().c_str()); if (dst == generator.ignoredResult()) @@ -1205,7 +1205,13 @@ RegisterID* ConstDeclNode::emitCodeSingle(BytecodeGenerator& generator) return generator.emitNode(local, m_init); } - + + if (generator.codeType() != EvalCode) { + if (m_init) + return generator.emitNode(m_init); + else + return generator.emitResolve(generator.newTemporary(), m_ident); + } // FIXME: While this code should only be hit in eval code, it will potentially // assign to the wrong base if m_ident exists in an intervening dynamic scope. RefPtr<RegisterID> base = generator.emitResolveBase(generator.newTemporary(), m_ident); @@ -1818,17 +1824,6 @@ ScopeNodeData::ScopeNodeData(ParserArena& arena, SourceElements* children, VarSt children->releaseContentsIntoVector(m_children); } -void ScopeNodeData::markAggregate(MarkStack& markStack) -{ - FunctionStack::iterator end = m_functionStack.end(); - for (FunctionStack::iterator ptr = m_functionStack.begin(); ptr != end; ++ptr) { - FunctionBodyNode* body = (*ptr)->body(); - if (!body->isGenerated()) - continue; - body->generatedBytecode().markAggregate(markStack); - } -} - // ------------------------------ ScopeNode ----------------------------- ScopeNode::ScopeNode(JSGlobalData* globalData) @@ -1886,30 +1881,6 @@ RegisterID* ProgramNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) return 0; } -void ProgramNode::generateBytecode(ScopeChainNode* scopeChainNode) -{ - ScopeChain scopeChain(scopeChainNode); - JSGlobalObject* globalObject = scopeChain.globalObject(); - - m_code.set(new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider())); - - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_code.get())); - generator->generate(); - - destroyData(); -} - -#if ENABLE(JIT) -void ProgramNode::generateJITCode(ScopeChainNode* scopeChainNode) -{ - bytecode(scopeChainNode); - ASSERT(m_code); - ASSERT(!m_jitCode); - JIT::compile(scopeChainNode->globalData, m_code.get()); - ASSERT(m_jitCode); -} -#endif - // ------------------------------ EvalNode ----------------------------- inline EvalNode::EvalNode(JSGlobalData* globalData, SourceElements* children, VarStack* varStack, FunctionStack* funcStack, const SourceCode& source, CodeFeatures features, int numConstants) @@ -1941,54 +1912,6 @@ RegisterID* EvalNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) return 0; } -void EvalNode::generateBytecode(ScopeChainNode* scopeChainNode) -{ - ScopeChain scopeChain(scopeChainNode); - JSGlobalObject* globalObject = scopeChain.globalObject(); - - m_code.set(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())); - - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get())); - generator->generate(); - - // Eval code needs to hang on to its declaration stacks to keep declaration info alive until Interpreter::execute time, - // so the entire ScopeNodeData cannot be destoyed. - children().clear(); -} - -EvalCodeBlock& EvalNode::bytecodeForExceptionInfoReparse(ScopeChainNode* scopeChainNode, CodeBlock* codeBlockBeingRegeneratedFrom) -{ - ASSERT(!m_code); - - ScopeChain scopeChain(scopeChainNode); - JSGlobalObject* globalObject = scopeChain.globalObject(); - - m_code.set(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())); - - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get())); - generator->setRegeneratingForExceptionInfo(codeBlockBeingRegeneratedFrom); - generator->generate(); - - return *m_code; -} - -void EvalNode::markAggregate(MarkStack& markStack) -{ - // We don't need to mark our own CodeBlock as the JSGlobalObject takes care of that - data()->markAggregate(markStack); -} - -#if ENABLE(JIT) -void EvalNode::generateJITCode(ScopeChainNode* scopeChainNode) -{ - bytecode(scopeChainNode); - ASSERT(m_code); - ASSERT(!m_jitCode); - JIT::compile(scopeChainNode->globalData, m_code.get()); - ASSERT(m_jitCode); -} -#endif - // ------------------------------ FunctionBodyNode ----------------------------- inline FunctionBodyNode::FunctionBodyNode(JSGlobalData* globalData) @@ -2012,7 +1935,7 @@ FunctionBodyNode::~FunctionBodyNode() fastFree(m_parameters); } -void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter) +void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* firstParameter, const Identifier& ident) { Vector<Identifier> parameters; for (ParameterNode* parameter = firstParameter; parameter; parameter = parameter->nextParam()) @@ -2020,36 +1943,15 @@ void FunctionBodyNode::finishParsing(const SourceCode& source, ParameterNode* fi size_t count = parameters.size(); setSource(source); - finishParsing(parameters.releaseBuffer(), count); + finishParsing(parameters.releaseBuffer(), count, ident); } -void FunctionBodyNode::finishParsing(Identifier* parameters, size_t parameterCount) +void FunctionBodyNode::finishParsing(Identifier* parameters, size_t parameterCount, const Identifier& ident) { ASSERT(!source().isNull()); m_parameters = parameters; m_parameterCount = parameterCount; -} - -void FunctionBodyNode::markAggregate(MarkStack& markStack) -{ - if (m_code) - m_code->markAggregate(markStack); -} - -#if ENABLE(JIT) -PassRefPtr<FunctionBodyNode> FunctionBodyNode::createNativeThunk(JSGlobalData* globalData) -{ - RefPtr<FunctionBodyNode> body = new FunctionBodyNode(globalData); - globalData->parser->arena().reset(); - body->m_code.set(new CodeBlock(body.get())); - body->m_jitCode = JITCode(JITCode::HostFunction(globalData->jitStubs.ctiNativeCallThunk())); - return body.release(); -} -#endif - -bool FunctionBodyNode::isHostFunction() const -{ - return m_code && m_code->codeType() == NativeCode; + m_ident = ident; } FunctionBodyNode* FunctionBodyNode::create(JSGlobalData* globalData) @@ -2068,50 +1970,13 @@ PassRefPtr<FunctionBodyNode> FunctionBodyNode::create(JSGlobalData* globalData, return node.release(); } -void FunctionBodyNode::generateBytecode(ScopeChainNode* scopeChainNode) +void FunctionBodyNode::reparseDataIfNecessary(ScopeChainNode* scopeChainNode) { // This branch is only necessary since you can still create a non-stub FunctionBodyNode by // calling Parser::parse<FunctionBodyNode>(). if (!data()) scopeChainNode->globalData->parser->reparseInPlace(scopeChainNode->globalData, this); ASSERT(data()); - - ScopeChain scopeChain(scopeChainNode); - JSGlobalObject* globalObject = scopeChain.globalObject(); - - m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset())); - - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get())); - generator->generate(); - - destroyData(); -} - -#if ENABLE(JIT) -void FunctionBodyNode::generateJITCode(ScopeChainNode* scopeChainNode) -{ - bytecode(scopeChainNode); - ASSERT(m_code); - ASSERT(!m_jitCode); - JIT::compile(scopeChainNode->globalData, m_code.get()); - ASSERT(m_jitCode); -} -#endif - -CodeBlock& FunctionBodyNode::bytecodeForExceptionInfoReparse(ScopeChainNode* scopeChainNode, CodeBlock* codeBlockBeingRegeneratedFrom) -{ - ASSERT(!m_code); - - ScopeChain scopeChain(scopeChainNode); - JSGlobalObject* globalObject = scopeChain.globalObject(); - - m_code.set(new CodeBlock(this, FunctionCode, source().provider(), source().startOffset())); - - OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(this, globalObject->debugger(), scopeChain, &m_code->symbolTable(), m_code.get())); - generator->setRegeneratingForExceptionInfo(codeBlockBeingRegeneratedFrom); - generator->generate(); - - return *m_code; } RegisterID* FunctionBodyNode::emitBytecode(BytecodeGenerator& generator, RegisterID*) @@ -2151,11 +2016,6 @@ Identifier* FunctionBodyNode::copyParameters() // ------------------------------ FuncDeclNode --------------------------------- -JSFunction* FuncDeclNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain) -{ - return new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain); -} - RegisterID* FuncDeclNode::emitBytecode(BytecodeGenerator& generator, RegisterID* dst) { if (dst == generator.ignoredResult()) @@ -2170,24 +2030,4 @@ RegisterID* FuncExprNode::emitBytecode(BytecodeGenerator& generator, RegisterID* return generator.emitNewFunctionExpression(generator.finalDestination(dst), this); } -JSFunction* FuncExprNode::makeFunction(ExecState* exec, ScopeChainNode* scopeChain) -{ - JSFunction* func = new (exec) JSFunction(exec, m_ident, m_body.get(), scopeChain); - - /* - The Identifier in a FunctionExpression can be referenced from inside - the FunctionExpression's FunctionBody to allow the function to call - itself recursively. However, unlike in a FunctionDeclaration, the - Identifier in a FunctionExpression cannot be referenced from and - does not affect the scope enclosing the FunctionExpression. - */ - - if (!m_ident.isNull()) { - JSStaticScopeObject* functionScopeObject = new (exec) JSStaticScopeObject(exec, m_ident, func, ReadOnly | DontDelete); - func->scope().push(functionScopeObject); - } - - return func; -} - } // namespace JSC diff --git a/JavaScriptCore/parser/Nodes.h b/JavaScriptCore/parser/Nodes.h index 703b384..58caa19 100644 --- a/JavaScriptCore/parser/Nodes.h +++ b/JavaScriptCore/parser/Nodes.h @@ -39,12 +39,16 @@ namespace JSC { class ArgumentListNode; - class CodeBlock; class BytecodeGenerator; - class FuncDeclNode; + class CodeBlock; class EvalCodeBlock; + class EvalExecutable; + class FuncDeclNode; + class FunctionBodyNode; + class FunctionCodeBlock; class JSFunction; class ProgramCodeBlock; + class ProgramExecutable; class PropertyListNode; class ReadModifyResolveNode; class RegisterID; @@ -87,7 +91,7 @@ namespace JSC { namespace DeclarationStacks { enum VarAttrs { IsConstant = 1, HasInitializer = 2 }; typedef Vector<std::pair<Identifier, unsigned> > VarStack; - typedef Vector<FuncDeclNode*> FunctionStack; + typedef Vector<FunctionBodyNode*> FunctionStack; } struct SwitchInfo { @@ -357,13 +361,13 @@ namespace JSC { class RegExpNode : public ExpressionNode, public ThrowableExpressionData { public: - RegExpNode(JSGlobalData*, const UString& pattern, const UString& flags); + RegExpNode(JSGlobalData*, const Identifier& pattern, const Identifier& flags); private: virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0); - UString m_pattern; - UString m_flags; + Identifier m_pattern; + Identifier m_flags; }; class ThisNode : public ExpressionNode { @@ -429,6 +433,7 @@ namespace JSC { enum Type { Constant, Getter, Setter }; PropertyNode(JSGlobalData*, const Identifier& name, ExpressionNode* value, Type); + PropertyNode(JSGlobalData*, double name, ExpressionNode* value, Type); const Identifier& name() const { return m_name; } @@ -1389,8 +1394,6 @@ namespace JSC { FunctionStack m_functionStack; int m_numConstants; StatementVector m_children; - - void markAggregate(MarkStack&); }; class ScopeNode : public StatementNode, public ParserArenaRefCounted { @@ -1436,33 +1439,9 @@ namespace JSC { return m_data->m_numConstants + 2; } - virtual void markAggregate(MarkStack&) { } - -#if ENABLE(JIT) - JITCode& generatedJITCode() - { - ASSERT(m_jitCode); - return m_jitCode; - } - - ExecutablePool* getExecutablePool() - { - return m_jitCode.getExecutablePool(); - } - - void setJITCode(const JITCode jitCode) - { - m_jitCode = jitCode; - } -#endif - protected: void setSource(const SourceCode& source) { m_source = source; } -#if ENABLE(JIT) - JITCode m_jitCode; -#endif - private: OwnPtr<ScopeNodeData> m_data; CodeFeatures m_features; @@ -1473,78 +1452,32 @@ namespace JSC { public: static PassRefPtr<ProgramNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); - ProgramCodeBlock& bytecode(ScopeChainNode* scopeChain) - { - if (!m_code) - generateBytecode(scopeChain); - return *m_code; - } - -#if ENABLE(JIT) - JITCode& jitCode(ScopeChainNode* scopeChain) - { - if (!m_jitCode) - generateJITCode(scopeChain); - return m_jitCode; - } -#endif - private: ProgramNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); - void generateBytecode(ScopeChainNode*); virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0); - -#if ENABLE(JIT) - void generateJITCode(ScopeChainNode*); -#endif - - OwnPtr<ProgramCodeBlock> m_code; }; class EvalNode : public ScopeNode { public: static PassRefPtr<EvalNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); - EvalCodeBlock& bytecode(ScopeChainNode* scopeChain) - { - if (!m_code) - generateBytecode(scopeChain); - return *m_code; - } - - EvalCodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*); - - virtual void markAggregate(MarkStack&); - -#if ENABLE(JIT) - JITCode& jitCode(ScopeChainNode* scopeChain) + void partialDestroyData() { - if (!m_jitCode) - generateJITCode(scopeChain); - return m_jitCode; + // Eval code needs to hang on to its declaration stacks to keep declaration info alive until Interpreter::execute time, + // so the entire ScopeNodeData cannot be destoyed. + children().clear(); } -#endif private: EvalNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); - void generateBytecode(ScopeChainNode*); virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0); - -#if ENABLE(JIT) - void generateJITCode(ScopeChainNode*); -#endif - - OwnPtr<EvalCodeBlock> m_code; }; class FunctionBodyNode : public ScopeNode { friend class JIT; public: -#if ENABLE(JIT) - static PassRefPtr<FunctionBodyNode> createNativeThunk(JSGlobalData*); -#endif static FunctionBodyNode* create(JSGlobalData*); static PassRefPtr<FunctionBodyNode> create(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); virtual ~FunctionBodyNode(); @@ -1556,63 +1489,25 @@ namespace JSC { virtual RegisterID* emitBytecode(BytecodeGenerator&, RegisterID* = 0); - bool isGenerated() const - { - return m_code; - } - - bool isHostFunction() const; - - virtual void markAggregate(MarkStack&); - - void finishParsing(const SourceCode&, ParameterNode*); - void finishParsing(Identifier* parameters, size_t parameterCount); + void finishParsing(const SourceCode&, ParameterNode*, const Identifier& ident); + void finishParsing(Identifier* parameters, size_t parameterCount, const Identifier& ident); - UString toSourceString() const { return source().toString(); } + const Identifier& ident() { return m_ident; } - CodeBlock& bytecodeForExceptionInfoReparse(ScopeChainNode*, CodeBlock*); -#if ENABLE(JIT) - JITCode& jitCode(ScopeChainNode* scopeChain) - { - if (!m_jitCode) - generateJITCode(scopeChain); - return m_jitCode; - } -#endif + void reparseDataIfNecessary(ScopeChainNode* scopeChainNode); - CodeBlock& bytecode(ScopeChainNode* scopeChain) - { - ASSERT(scopeChain); - if (!m_code) - generateBytecode(scopeChain); - return *m_code; - } - - CodeBlock& generatedBytecode() - { - ASSERT(m_code); - return *m_code; - } - private: FunctionBodyNode(JSGlobalData*); FunctionBodyNode(JSGlobalData*, SourceElements*, VarStack*, FunctionStack*, const SourceCode&, CodeFeatures, int numConstants); - - void generateBytecode(ScopeChainNode*); -#if ENABLE(JIT) - void generateJITCode(ScopeChainNode*); -#endif + Identifier m_ident; Identifier* m_parameters; size_t m_parameterCount; - OwnPtr<CodeBlock> m_code; }; - class FuncExprNode : public ExpressionNode, public ParserArenaRefCounted { + class FuncExprNode : public ExpressionNode { public: FuncExprNode(JSGlobalData*, const Identifier&, FunctionBodyNode* body, const SourceCode& source, ParameterNode* parameter = 0); - JSFunction* makeFunction(ExecState*, ScopeChainNode*); - FunctionBodyNode* body() { return m_body.get(); } private: @@ -1620,18 +1515,13 @@ namespace JSC { virtual bool isFuncExprNode() const { return true; } - Identifier m_ident; RefPtr<FunctionBodyNode> m_body; }; - class FuncDeclNode : public StatementNode, public ParserArenaRefCounted { + class FuncDeclNode : public StatementNode { public: FuncDeclNode(JSGlobalData*, const Identifier&, FunctionBodyNode*, const SourceCode&, ParameterNode* = 0); - JSFunction* makeFunction(ExecState*, ScopeChainNode*); - - Identifier m_ident; - FunctionBodyNode* body() { return m_body.get(); } private: diff --git a/JavaScriptCore/parser/Parser.h b/JavaScriptCore/parser/Parser.h index 373dc00..6166bb2 100644 --- a/JavaScriptCore/parser/Parser.h +++ b/JavaScriptCore/parser/Parser.h @@ -24,6 +24,8 @@ #define Parser_h #include "Debugger.h" +#include "Executable.h" +#include "JSGlobalObject.h" #include "Nodes.h" #include "SourceProvider.h" #include <wtf/Forward.h> @@ -41,9 +43,12 @@ namespace JSC { class Parser : public Noncopyable { public: - template <class ParsedNode> PassRefPtr<ParsedNode> parse(ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); - template <class ParsedNode> PassRefPtr<ParsedNode> reparse(JSGlobalData*, ParsedNode*); + template <class ParsedNode> + PassRefPtr<ParsedNode> parse(ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); + template <class ParsedNode> + PassRefPtr<ParsedNode> reparse(JSGlobalData*, ParsedNode*); void reparseInPlace(JSGlobalData*, FunctionBodyNode*); + PassRefPtr<FunctionBodyNode> parseFunctionFromGlobalCode(ExecState*, Debugger*, const SourceCode&, int* errLine = 0, UString* errMsg = 0); void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*, ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures features, int lastLine, int numConstants); @@ -63,7 +68,8 @@ namespace JSC { int m_numConstants; }; - template <class ParsedNode> PassRefPtr<ParsedNode> Parser::parse(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg) + template <class ParsedNode> + PassRefPtr<ParsedNode> Parser::parse(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg) { m_source = &source; parse(&exec->globalData(), errLine, errMsg); @@ -90,7 +96,8 @@ namespace JSC { return result.release(); } - template <class ParsedNode> PassRefPtr<ParsedNode> Parser::reparse(JSGlobalData* globalData, ParsedNode* oldParsedNode) + template <class ParsedNode> + PassRefPtr<ParsedNode> Parser::reparse(JSGlobalData* globalData, ParsedNode* oldParsedNode) { m_source = &oldParsedNode->source(); parse(globalData, 0, 0); @@ -115,6 +122,54 @@ namespace JSC { return result.release(); } + inline PassRefPtr<FunctionBodyNode> Parser::parseFunctionFromGlobalCode(ExecState* exec, Debugger* debugger, const SourceCode& source, int* errLine, UString* errMsg) + { + RefPtr<ProgramNode> program = parse<ProgramNode>(exec, debugger, source, errLine, errMsg); + + if (!program) + return 0; + + StatementVector& children = program->children(); + if (children.size() != 1) + return 0; + + StatementNode* exprStatement = children[0]; + ASSERT(exprStatement); + ASSERT(exprStatement->isExprStatement()); + if (!exprStatement || !exprStatement->isExprStatement()) + return 0; + + ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr(); + ASSERT(funcExpr); + ASSERT(funcExpr->isFuncExprNode()); + if (!funcExpr || !funcExpr->isFuncExprNode()) + return 0; + + RefPtr<FunctionBodyNode> body = static_cast<FuncExprNode*>(funcExpr)->body(); + ASSERT(body); + return body.release(); + } + + inline JSObject* EvalExecutable::parse(ExecState* exec, bool allowDebug) + { + int errLine; + UString errMsg; + m_node = exec->globalData().parser->parse<EvalNode>(exec, allowDebug ? exec->dynamicGlobalObject()->debugger() : 0, m_source, &errLine, &errMsg); + if (!m_node) + return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url()); + return 0; + } + + inline JSObject* ProgramExecutable::parse(ExecState* exec, bool allowDebug) + { + int errLine; + UString errMsg; + m_node = exec->globalData().parser->parse<ProgramNode>(exec, allowDebug ? exec->dynamicGlobalObject()->debugger() : 0, m_source, &errLine, &errMsg); + if (!m_node) + return Error::create(exec, SyntaxError, errMsg, errLine, m_source.provider()->asID(), m_source.provider()->url()); + return 0; + } + } // namespace JSC #endif // Parser_h diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp index 1a061cb..dc68ecb 100644 --- a/JavaScriptCore/profiler/ProfileGenerator.cpp +++ b/JavaScriptCore/profiler/ProfileGenerator.cpp @@ -27,6 +27,7 @@ #include "ProfileGenerator.h" #include "CallFrame.h" +#include "CodeBlock.h" #include "JSGlobalObject.h" #include "JSStringRef.h" #include "JSFunction.h" diff --git a/JavaScriptCore/profiler/Profiler.cpp b/JavaScriptCore/profiler/Profiler.cpp index e103fd1..4565fe6 100644 --- a/JavaScriptCore/profiler/Profiler.cpp +++ b/JavaScriptCore/profiler/Profiler.cpp @@ -31,6 +31,7 @@ #include "CommonIdentifiers.h" #include "CallFrame.h" +#include "CodeBlock.h" #include "JSFunction.h" #include "JSGlobalObject.h" #include "Nodes.h" @@ -134,26 +135,26 @@ void Profiler::didExecute(ExecState* exec, const UString& sourceURL, int startin dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup()); } -CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue function, const UString& defaultSourceURL, int defaultLineNumber) +CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue functionValue, const UString& defaultSourceURL, int defaultLineNumber) { - if (!function) + if (!functionValue) return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber); - if (!function.isObject()) + if (!functionValue.isObject()) return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber); - if (asObject(function)->inherits(&JSFunction::info)) { - JSFunction* func = asFunction(function); - if (!func->isHostFunction()) - return createCallIdentifierFromFunctionImp(globalData, func); + if (asObject(functionValue)->inherits(&JSFunction::info)) { + JSFunction* function = asFunction(functionValue); + if (!function->executable()->isHostFunction()) + return createCallIdentifierFromFunctionImp(globalData, function); } - if (asObject(function)->inherits(&InternalFunction::info)) - return CallIdentifier(static_cast<InternalFunction*>(asObject(function))->name(globalData), defaultSourceURL, defaultLineNumber); - return CallIdentifier("(" + asObject(function)->className() + " object)", defaultSourceURL, defaultLineNumber); + if (asObject(functionValue)->inherits(&InternalFunction::info)) + return CallIdentifier(static_cast<InternalFunction*>(asObject(functionValue))->name(globalData), defaultSourceURL, defaultLineNumber); + return CallIdentifier("(" + asObject(functionValue)->className() + " object)", defaultSourceURL, defaultLineNumber); } CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function) { const UString& name = function->calculatedDisplayName(globalData); - return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->body()->sourceURL(), function->body()->lineNo()); + return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->executable()->sourceURL(), function->executable()->lineNo()); } } // namespace JSC diff --git a/JavaScriptCore/runtime/Arguments.h b/JavaScriptCore/runtime/Arguments.h index 79fe720..390f7e2 100644 --- a/JavaScriptCore/runtime/Arguments.h +++ b/JavaScriptCore/runtime/Arguments.h @@ -28,6 +28,8 @@ #include "JSFunction.h" #include "JSGlobalObject.h" #include "Interpreter.h" +#include "ObjectConstructor.h" +#include "PrototypeFunction.h" namespace JSC { @@ -114,7 +116,7 @@ namespace JSC { { function = callFrame->callee(); - CodeBlock* codeBlock = &function->body()->generatedBytecode(); + CodeBlock* codeBlock = &function->executable()->generatedBytecode(); int numParameters = codeBlock->m_numParameters; argc = callFrame->argumentCount(); @@ -137,7 +139,7 @@ namespace JSC { int numArguments; getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments); - d->numParameters = callee->body()->parameterCount(); + d->numParameters = callee->executable()->parameterCount(); d->firstParameterIndex = firstParameterIndex; d->numArguments = numArguments; @@ -168,7 +170,7 @@ namespace JSC { : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure()) , d(new ArgumentsData) { - ASSERT(!callFrame->callee()->body()->parameterCount()); + ASSERT(!callFrame->callee()->executable()->parameterCount()); unsigned numArguments = callFrame->argumentCount() - 1; @@ -214,8 +216,8 @@ namespace JSC { { ASSERT(!d()->registerArray); - size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; - size_t numVars = d()->functionBody->generatedBytecode().m_numVars; + size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1; + size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars; size_t numLocals = numVars + numParametersMinusThis; if (!numLocals) diff --git a/JavaScriptCore/runtime/ArrayConstructor.cpp b/JavaScriptCore/runtime/ArrayConstructor.cpp index e96bdfc..c60cb0e 100644 --- a/JavaScriptCore/runtime/ArrayConstructor.cpp +++ b/JavaScriptCore/runtime/ArrayConstructor.cpp @@ -25,15 +25,19 @@ #include "ArrayConstructor.h" #include "ArrayPrototype.h" +#include "Error.h" #include "JSArray.h" #include "JSFunction.h" #include "Lookup.h" +#include "PrototypeFunction.h" namespace JSC { ASSERT_CLASS_FITS_IN_CELL(ArrayConstructor); + +static JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList&); -ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype) +ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> structure, ArrayPrototype* arrayPrototype, Structure* prototypeFunctionStructure) : InternalFunction(&exec->globalData(), structure, Identifier(exec, arrayPrototype->classInfo()->className)) { // ECMA 15.4.3.1 Array.prototype @@ -41,6 +45,9 @@ ArrayConstructor::ArrayConstructor(ExecState* exec, PassRefPtr<Structure> struct // no. of arguments for constructor putDirectWithoutTransition(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly | DontEnum | DontDelete); + + // ES5 + putDirectFunctionWithoutTransition(exec, new (exec) NativeFunctionWrapper(exec, prototypeFunctionStructure, 1, exec->propertyNames().isArray, arrayConstructorIsArray), DontEnum); } static JSObject* constructArrayWithSizeQuirk(ExecState* exec, const ArgList& args) @@ -82,4 +89,9 @@ CallType ArrayConstructor::getCallData(CallData& callData) return CallTypeHost; } +JSValue JSC_HOST_CALL arrayConstructorIsArray(ExecState*, JSObject*, JSValue, const ArgList& args) +{ + return jsBoolean(args.at(0).inherits(&JSArray::info)); +} + } // namespace JSC diff --git a/JavaScriptCore/runtime/ArrayConstructor.h b/JavaScriptCore/runtime/ArrayConstructor.h index 8300d8c..2b79510 100644 --- a/JavaScriptCore/runtime/ArrayConstructor.h +++ b/JavaScriptCore/runtime/ArrayConstructor.h @@ -29,7 +29,7 @@ namespace JSC { class ArrayConstructor : public InternalFunction { public: - ArrayConstructor(ExecState*, PassRefPtr<Structure>, ArrayPrototype*); + ArrayConstructor(ExecState*, PassRefPtr<Structure>, ArrayPrototype*, Structure*); virtual ConstructType getConstructData(ConstructData&); virtual CallType getCallData(CallData&); diff --git a/JavaScriptCore/runtime/ArrayPrototype.cpp b/JavaScriptCore/runtime/ArrayPrototype.cpp index 807e59a..95d3ffc 100644 --- a/JavaScriptCore/runtime/ArrayPrototype.cpp +++ b/JavaScriptCore/runtime/ArrayPrototype.cpp @@ -75,10 +75,10 @@ static inline bool isNumericCompareFunction(CallType callType, const CallData& c #if ENABLE(JIT) // If the JIT is enabled then we need to preserve the invariant that every // function with a CodeBlock also has JIT code. - callData.js.functionBody->jitCode(callData.js.scopeChain); - CodeBlock& codeBlock = callData.js.functionBody->generatedBytecode(); + callData.js.functionExecutable->jitCode(callData.js.scopeChain); + CodeBlock& codeBlock = callData.js.functionExecutable->generatedBytecode(); #else - CodeBlock& codeBlock = callData.js.functionBody->bytecode(callData.js.scopeChain); + CodeBlock& codeBlock = callData.js.functionExecutable->bytecode(callData.js.scopeChain); #endif return codeBlock.isNumericCompareFunction(); @@ -144,7 +144,7 @@ static void putProperty(ExecState* exec, JSObject* obj, const Identifier& proper JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&JSArray::info)) + if (!thisValue.inherits(&JSArray::info)) return throwError(exec, TypeError); JSObject* thisObj = asArray(thisValue); @@ -190,7 +190,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncToString(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&JSArray::info)) + if (!thisValue.inherits(&JSArray::info)) return throwError(exec, TypeError); JSObject* thisObj = asArray(thisValue); @@ -298,7 +298,7 @@ JSValue JSC_HOST_CALL arrayProtoFuncConcat(ExecState* exec, JSObject*, JSValue t ArgList::const_iterator it = args.begin(); ArgList::const_iterator end = args.end(); while (1) { - if (curArg.isObject(&JSArray::info)) { + if (curArg.inherits(&JSArray::info)) { unsigned length = curArg.get(exec, exec->propertyNames().length).toUInt32(exec); JSObject* curObject = curArg.toObject(exec); for (unsigned k = 0; k < length; ++k) { diff --git a/JavaScriptCore/runtime/BooleanObject.h b/JavaScriptCore/runtime/BooleanObject.h index cfd55fe..1361e46 100644 --- a/JavaScriptCore/runtime/BooleanObject.h +++ b/JavaScriptCore/runtime/BooleanObject.h @@ -31,6 +31,11 @@ namespace JSC { virtual const ClassInfo* classInfo() const { return &info; } static const ClassInfo info; + + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); + } }; BooleanObject* asBooleanObject(JSValue); diff --git a/JavaScriptCore/runtime/BooleanPrototype.cpp b/JavaScriptCore/runtime/BooleanPrototype.cpp index 703a568..cf4fbd7 100644 --- a/JavaScriptCore/runtime/BooleanPrototype.cpp +++ b/JavaScriptCore/runtime/BooleanPrototype.cpp @@ -59,7 +59,7 @@ JSValue JSC_HOST_CALL booleanProtoFuncToString(ExecState* exec, JSObject*, JSVal if (thisValue == jsBoolean(true)) return jsNontrivialString(exec, "true"); - if (!thisValue.isObject(&BooleanObject::info)) + if (!thisValue.inherits(&BooleanObject::info)) return throwError(exec, TypeError); if (asBooleanObject(thisValue)->internalValue() == jsBoolean(false)) @@ -74,7 +74,7 @@ JSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState* exec, JSObject*, JSValu if (thisValue.isBoolean()) return thisValue; - if (!thisValue.isObject(&BooleanObject::info)) + if (!thisValue.inherits(&BooleanObject::info)) return throwError(exec, TypeError); return asBooleanObject(thisValue)->internalValue(); diff --git a/JavaScriptCore/runtime/CallData.h b/JavaScriptCore/runtime/CallData.h index d5b0172..24c19f9 100644 --- a/JavaScriptCore/runtime/CallData.h +++ b/JavaScriptCore/runtime/CallData.h @@ -35,7 +35,7 @@ namespace JSC { class ArgList; class ExecState; - class FunctionBodyNode; + class FunctionExecutable; class JSObject; class JSValue; class ScopeChainNode; @@ -53,7 +53,7 @@ namespace JSC { NativeFunction function; } native; struct { - FunctionBodyNode* functionBody; + FunctionExecutable* functionExecutable; ScopeChainNode* scopeChain; } js; }; diff --git a/JavaScriptCore/runtime/Collector.cpp b/JavaScriptCore/runtime/Collector.cpp index c188016..f48e243 100644 --- a/JavaScriptCore/runtime/Collector.cpp +++ b/JavaScriptCore/runtime/Collector.cpp @@ -23,8 +23,10 @@ #include "ArgList.h" #include "CallFrame.h" +#include "CodeBlock.h" #include "CollectorHeapIterator.h" #include "Interpreter.h" +#include "JSArray.h" #include "JSGlobalObject.h" #include "JSLock.h" #include "JSONObject.h" @@ -59,10 +61,16 @@ #include <windows.h> +#elif PLATFORM(HAIKU) + +#include <OS.h> + #elif PLATFORM(UNIX) #include <stdlib.h> +#if !PLATFORM(HAIKU) #include <sys/mman.h> +#endif #include <unistd.h> #if PLATFORM(SOLARIS) @@ -75,6 +83,13 @@ #include <pthread_np.h> #endif +#if PLATFORM(QNX) +#include <fcntl.h> +#include <sys/procfs.h> +#include <stdio.h> +#include <errno.h> +#endif + #endif #define DEBUG_COLLECTOR 0 @@ -486,6 +501,33 @@ static void* getStackBase(void* previousFrame) } #endif +#if PLATFORM(QNX) +static inline void *currentThreadStackBaseQNX() +{ + static void* stackBase = 0; + static size_t stackSize = 0; + static pthread_t stackThread; + pthread_t thread = pthread_self(); + if (stackBase == 0 || thread != stackThread) { + struct _debug_thread_info threadInfo; + memset(&threadInfo, 0, sizeof(threadInfo)); + threadInfo.tid = pthread_self(); + int fd = open("/proc/self", O_RDONLY); + if (fd == -1) { + LOG_ERROR("Unable to open /proc/self (errno: %d)", errno); + return 0; + } + devctl(fd, DCMD_PROC_TIDSTATUS, &threadInfo, sizeof(threadInfo), 0); + close(fd); + stackBase = reinterpret_cast<void*>(threadInfo.stkbase); + stackSize = threadInfo.stksize; + ASSERT(stackBase); + stackThread = thread; + } + return static_cast<char*>(stackBase) + stackSize; +} +#endif + static inline void* currentThreadStackBase() { #if PLATFORM(DARWIN) @@ -511,6 +553,8 @@ static inline void* currentThreadStackBase() : "=r" (pTib) ); return static_cast<void*>(pTib->StackBase); +#elif PLATFORM(QNX) + return currentThreadStackBaseQNX(); #elif PLATFORM(SOLARIS) stack_t s; thr_stksegment(&s); @@ -529,6 +573,10 @@ static inline void* currentThreadStackBase() stackBase = (void*)info.iBase; } return (void*)stackBase; +#elif PLATFORM(HAIKU) + thread_info threadInfo; + get_thread_info(find_thread(NULL), &threadInfo); + return threadInfo.stack_end; #elif PLATFORM(UNIX) static void* stackBase = 0; static size_t stackSize = 0; @@ -1091,8 +1139,8 @@ bool Heap::collect() markStack.append(m_globalData->exception); m_globalData->interpreter->registerFile().markCallFrames(markStack, this); m_globalData->smallStrings.mark(); - if (m_globalData->scopeNodeBeingReparsed) - m_globalData->scopeNodeBeingReparsed->markAggregate(markStack); + if (m_globalData->functionCodeBlockBeingReparsed) + m_globalData->functionCodeBlockBeingReparsed->markAggregate(markStack); if (m_globalData->firstStringifierToMark) JSONObject::markStringifiers(markStack, m_globalData->firstStringifierToMark); diff --git a/JavaScriptCore/runtime/CommonIdentifiers.h b/JavaScriptCore/runtime/CommonIdentifiers.h index 148d3dd..678e109 100644 --- a/JavaScriptCore/runtime/CommonIdentifiers.h +++ b/JavaScriptCore/runtime/CommonIdentifiers.h @@ -47,6 +47,7 @@ macro(ignoreCase) \ macro(index) \ macro(input) \ + macro(isArray) \ macro(isPrototypeOf) \ macro(length) \ macro(message) \ diff --git a/JavaScriptCore/runtime/Completion.cpp b/JavaScriptCore/runtime/Completion.cpp index b8b1581..6ae5aa2 100644 --- a/JavaScriptCore/runtime/Completion.cpp +++ b/JavaScriptCore/runtime/Completion.cpp @@ -41,30 +41,27 @@ Completion checkSyntax(ExecState* exec, const SourceCode& source) { JSLock lock(exec); - int errLine; - UString errMsg; + ProgramExecutable program(source); + JSObject* error = program.parse(exec); + if (error) + return Completion(Throw, error); - RefPtr<ProgramNode> progNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - if (!progNode) - return Completion(Throw, Error::create(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url())); return Completion(Normal); } Completion evaluate(ExecState* exec, ScopeChain& scopeChain, const SourceCode& source, JSValue thisValue) { JSLock lock(exec); - - int errLine; - UString errMsg; - RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - if (!programNode) - return Completion(Throw, Error::create(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url())); + ProgramExecutable program(source); + JSObject* error = program.parse(exec); + if (error) + return Completion(Throw, error); JSObject* thisObj = (!thisValue || thisValue.isUndefinedOrNull()) ? exec->dynamicGlobalObject() : thisValue.toObject(exec); JSValue exception; - JSValue result = exec->interpreter()->execute(programNode.get(), exec, scopeChain.node(), thisObj, &exception); + JSValue result = exec->interpreter()->execute(&program, exec, scopeChain.node(), thisObj, &exception); if (exception) { if (exception.isObject() && asObject(exception)->isWatchdogException()) diff --git a/JavaScriptCore/runtime/ConstructData.h b/JavaScriptCore/runtime/ConstructData.h index 9d580d5..6b954a6 100644 --- a/JavaScriptCore/runtime/ConstructData.h +++ b/JavaScriptCore/runtime/ConstructData.h @@ -33,7 +33,7 @@ namespace JSC { class ArgList; class ExecState; - class FunctionBodyNode; + class FunctionExecutable; class JSObject; class JSValue; class ScopeChainNode; @@ -51,7 +51,7 @@ namespace JSC { NativeConstructor function; } native; struct { - FunctionBodyNode* functionBody; + FunctionExecutable* functionExecutable; ScopeChainNode* scopeChain; } js; }; diff --git a/JavaScriptCore/runtime/DateConstructor.cpp b/JavaScriptCore/runtime/DateConstructor.cpp index 2f52cff..1879c3f 100644 --- a/JavaScriptCore/runtime/DateConstructor.cpp +++ b/JavaScriptCore/runtime/DateConstructor.cpp @@ -79,7 +79,7 @@ JSObject* constructDate(ExecState* exec, const ArgList& args) if (numArgs == 0) // new Date() ECMA 15.9.3.3 value = getCurrentUTCTime(); else if (numArgs == 1) { - if (args.at(0).isObject(&DateInstance::info)) + if (args.at(0).inherits(&DateInstance::info)) value = asDateInstance(args.at(0))->internalNumber(); else { JSValue primitive = args.at(0).toPrimitive(exec); diff --git a/JavaScriptCore/runtime/DatePrototype.cpp b/JavaScriptCore/runtime/DatePrototype.cpp index e2482f4..54d3cf3 100644 --- a/JavaScriptCore/runtime/DatePrototype.cpp +++ b/JavaScriptCore/runtime/DatePrototype.cpp @@ -411,7 +411,7 @@ bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& proper JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -428,7 +428,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToString(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -445,7 +445,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToUTCString(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -467,7 +467,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToISOString(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -484,7 +484,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToDateString(ExecState* exec, JSObject*, JSVa JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -501,7 +501,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToTimeString(ExecState* exec, JSObject*, JSVa JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -514,7 +514,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleString(ExecState* exec, JSObject*, JS JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -527,7 +527,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleDateString(ExecState* exec, JSObject* JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -540,7 +540,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToLocaleTimeString(ExecState* exec, JSObject* JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -553,7 +553,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTime(ExecState* exec, JSObject*, JSValue t JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -570,7 +570,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetFullYear(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -587,7 +587,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCFullYear(ExecState* exec, JSObject*, JS JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -604,7 +604,7 @@ JSValue JSC_HOST_CALL dateProtoFuncToGMTString(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -621,7 +621,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMonth(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -638,7 +638,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMonth(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -655,7 +655,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDate(ExecState* exec, JSObject*, JSValue t JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -672,7 +672,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDate(ExecState* exec, JSObject*, JSValu JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -689,7 +689,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetDay(ExecState* exec, JSObject*, JSValue th JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -706,7 +706,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCDay(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -723,7 +723,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetHours(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -740,7 +740,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCHours(ExecState* exec, JSObject*, JSVal JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -757,7 +757,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMinutes(ExecState* exec, JSObject*, JSValu JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -774,7 +774,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMinutes(ExecState* exec, JSObject*, JSV JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -791,7 +791,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetSeconds(ExecState* exec, JSObject*, JSValu JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = true; @@ -808,7 +808,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCSeconds(ExecState* exec, JSObject*, JSV JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -823,7 +823,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetMilliSeconds(ExecState* exec, JSObject*, J JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -838,7 +838,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetUTCMilliseconds(ExecState* exec, JSObject* JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -855,7 +855,7 @@ JSValue JSC_HOST_CALL dateProtoFuncGetTimezoneOffset(ExecState* exec, JSObject*, JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -868,7 +868,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetTime(ExecState* exec, JSObject*, JSValue t static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -899,7 +899,7 @@ static JSValue setNewValueFromTimeArgs(ExecState* exec, JSValue thisValue, const static JSValue setNewValueFromDateArgs(ExecState* exec, JSValue thisValue, const ArgList& args, int numArgsToUse, bool inputIsUTC) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); DateInstance* thisDateObj = asDateInstance(thisValue); @@ -1020,7 +1020,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetUTCFullYear(ExecState* exec, JSObject*, JS JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; @@ -1062,7 +1062,7 @@ JSValue JSC_HOST_CALL dateProtoFuncSetYear(ExecState* exec, JSObject*, JSValue t JSValue JSC_HOST_CALL dateProtoFuncGetYear(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&DateInstance::info)) + if (!thisValue.inherits(&DateInstance::info)) return throwError(exec, TypeError); const bool utc = false; diff --git a/JavaScriptCore/runtime/Error.cpp b/JavaScriptCore/runtime/Error.cpp index db1d8cc..ddd4bc4 100644 --- a/JavaScriptCore/runtime/Error.cpp +++ b/JavaScriptCore/runtime/Error.cpp @@ -97,6 +97,12 @@ JSObject* Error::create(ExecState* exec, ErrorType type, const char* message) return create(exec, type, message, -1, -1, NULL); } +JSObject* throwError(ExecState* exec, JSObject* error) +{ + exec->setException(error); + return error; +} + JSObject* throwError(ExecState* exec, ErrorType type) { JSObject* error = Error::create(exec, type, UString(), -1, -1, NULL); diff --git a/JavaScriptCore/runtime/Error.h b/JavaScriptCore/runtime/Error.h index adf7fdf..e959cff 100644 --- a/JavaScriptCore/runtime/Error.h +++ b/JavaScriptCore/runtime/Error.h @@ -59,6 +59,7 @@ namespace JSC { JSObject* throwError(ExecState*, ErrorType, const UString& message); JSObject* throwError(ExecState*, ErrorType, const char* message); JSObject* throwError(ExecState*, ErrorType); + JSObject* throwError(ExecState*, JSObject*); } // namespace JSC diff --git a/JavaScriptCore/runtime/ExceptionHelpers.cpp b/JavaScriptCore/runtime/ExceptionHelpers.cpp index e63594c..cc18b95 100644 --- a/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -74,7 +74,7 @@ JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, u int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset); UString message = "Can't find variable: "; message.append(ident.ustring()); - JSObject* exception = Error::create(exec, ReferenceError, message, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + JSObject* exception = Error::create(exec, ReferenceError, message, 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); @@ -136,7 +136,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, message); - JSObject* exception = Error::create(exec, TypeError, errorMessage, line, codeBlock->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + 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); @@ -157,7 +157,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->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + 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); @@ -171,7 +171,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->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + 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); @@ -201,7 +201,7 @@ 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->ownerNode()->sourceID(), codeBlock->ownerNode()->sourceURL()); + 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); diff --git a/JavaScriptCore/runtime/Executable.cpp b/JavaScriptCore/runtime/Executable.cpp new file mode 100644 index 0000000..053dbfb --- /dev/null +++ b/JavaScriptCore/runtime/Executable.cpp @@ -0,0 +1,216 @@ +/* + * 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 "Executable.h" + +#include "BytecodeGenerator.h" +#include "CodeBlock.h" +#include "JIT.h" +#include "Parser.h" + +namespace JSC { + +EvalExecutable::~EvalExecutable() +{ + delete m_evalCodeBlock; +} + +ProgramExecutable::~ProgramExecutable() +{ + delete m_programCodeBlock; +} + +FunctionExecutable::~FunctionExecutable() +{ + delete m_codeBlock; +} + +void EvalExecutable::generateBytecode(ScopeChainNode* scopeChainNode) +{ + ScopeChain scopeChain(scopeChainNode); + JSGlobalObject* globalObject = scopeChain.globalObject(); + + ASSERT(!m_evalCodeBlock); + m_evalCodeBlock = new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth()); + OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(evalNode(), globalObject->debugger(), scopeChain, &m_evalCodeBlock->symbolTable(), m_evalCodeBlock)); + generator->generate(); + + evalNode()->partialDestroyData(); +} + +void ProgramExecutable::generateBytecode(ScopeChainNode* scopeChainNode) +{ + ScopeChain scopeChain(scopeChainNode); + JSGlobalObject* globalObject = scopeChain.globalObject(); + + ASSERT(!m_programCodeBlock); + m_programCodeBlock = new ProgramCodeBlock(this, GlobalCode, globalObject, source().provider()); + OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(programNode(), globalObject->debugger(), scopeChain, &globalObject->symbolTable(), m_programCodeBlock)); + generator->generate(); + + programNode()->destroyData(); +} + +void FunctionExecutable::generateBytecode(ScopeChainNode* scopeChainNode) +{ + body()->reparseDataIfNecessary(scopeChainNode); + + ScopeChain scopeChain(scopeChainNode); + JSGlobalObject* globalObject = scopeChain.globalObject(); + + ASSERT(!m_codeBlock); + m_codeBlock = new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset()); + OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(body(), globalObject->debugger(), scopeChain, &m_codeBlock->symbolTable(), m_codeBlock)); + generator->generate(); + + body()->destroyData(); +} + +#if ENABLE(JIT) + +void EvalExecutable::generateJITCode(ScopeChainNode* scopeChainNode) +{ + CodeBlock* codeBlock = &bytecode(scopeChainNode); + m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock); + +#if !ENABLE(OPCODE_SAMPLING) + if (!BytecodeGenerator::dumpsGeneratedCode()) + codeBlock->discardBytecode(); +#endif +} + +void ProgramExecutable::generateJITCode(ScopeChainNode* scopeChainNode) +{ + CodeBlock* codeBlock = &bytecode(scopeChainNode); + m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock); + +#if !ENABLE(OPCODE_SAMPLING) + if (!BytecodeGenerator::dumpsGeneratedCode()) + codeBlock->discardBytecode(); +#endif +} + +void FunctionExecutable::generateJITCode(ScopeChainNode* scopeChainNode) +{ + CodeBlock* codeBlock = &bytecode(scopeChainNode); + m_jitCode = JIT::compile(scopeChainNode->globalData, codeBlock); + +#if !ENABLE(OPCODE_SAMPLING) + if (!BytecodeGenerator::dumpsGeneratedCode()) + codeBlock->discardBytecode(); +#endif +} + +#endif + +bool FunctionExecutable::isHostFunction() const +{ + return m_codeBlock && m_codeBlock->codeType() == NativeCode; +} + +void FunctionExecutable::markAggregate(MarkStack& markStack) +{ + if (m_codeBlock) + m_codeBlock->markAggregate(markStack); +} + +ExceptionInfo* FunctionExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) +{ + RefPtr<FunctionBodyNode> newFunctionBody = globalData->parser->reparse<FunctionBodyNode>(globalData, body()); + ASSERT(newFunctionBody); + newFunctionBody->finishParsing(body()->copyParameters(), body()->parameterCount(), body()->ident()); + + ScopeChain scopeChain(scopeChainNode); + JSGlobalObject* globalObject = scopeChain.globalObject(); + + OwnPtr<CodeBlock> newCodeBlock(new FunctionCodeBlock(this, FunctionCode, source().provider(), source().startOffset())); + globalData->functionCodeBlockBeingReparsed = newCodeBlock.get(); + + OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newFunctionBody.get(), globalObject->debugger(), scopeChain, &newCodeBlock->symbolTable(), newCodeBlock.get())); + generator->setRegeneratingForExceptionInfo(static_cast<FunctionCodeBlock*>(codeBlock)); + generator->generate(); + + ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount()); + +#if ENABLE(JIT) + JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); + ASSERT(newJITCode.size() == generatedJITCode().size()); +#endif + + globalData->functionCodeBlockBeingReparsed = 0; + + return newCodeBlock->extractExceptionInfo(); +} + +ExceptionInfo* EvalExecutable::reparseExceptionInfo(JSGlobalData* globalData, ScopeChainNode* scopeChainNode, CodeBlock* codeBlock) +{ + RefPtr<EvalNode> newEvalBody = globalData->parser->reparse<EvalNode>(globalData, evalNode()); + + ScopeChain scopeChain(scopeChainNode); + JSGlobalObject* globalObject = scopeChain.globalObject(); + + OwnPtr<EvalCodeBlock> newCodeBlock(new EvalCodeBlock(this, globalObject, source().provider(), scopeChain.localDepth())); + + OwnPtr<BytecodeGenerator> generator(new BytecodeGenerator(newEvalBody.get(), globalObject->debugger(), scopeChain, &newCodeBlock->symbolTable(), newCodeBlock.get())); + generator->setRegeneratingForExceptionInfo(static_cast<EvalCodeBlock*>(codeBlock)); + generator->generate(); + + ASSERT(newCodeBlock->instructionCount() == codeBlock->instructionCount()); + +#if ENABLE(JIT) + JITCode newJITCode = JIT::compile(globalData, newCodeBlock.get()); + ASSERT(newJITCode.size() == generatedJITCode().size()); +#endif + + return newCodeBlock->extractExceptionInfo(); +} + +void FunctionExecutable::recompile(ExecState* exec) +{ + FunctionBodyNode* oldBody = body(); + RefPtr<FunctionBodyNode> newBody = exec->globalData().parser->parse<FunctionBodyNode>(exec, 0, m_source); + ASSERT(newBody); + newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount(), oldBody->ident()); + m_node = newBody; + delete m_codeBlock; + m_codeBlock = 0; +#if ENABLE(JIT) + m_jitCode = JITCode(); +#endif +} + +#if ENABLE(JIT) +FunctionExecutable::FunctionExecutable(ExecState* exec) + : m_codeBlock(new NativeCodeBlock(this)) + , m_name(Identifier(exec, "<native thunk>")) +{ + m_jitCode = JITCode(JITCode::HostFunction(exec->globalData().jitStubs.ctiNativeCallThunk())); +} +#endif + +}; + + diff --git a/JavaScriptCore/runtime/Executable.h b/JavaScriptCore/runtime/Executable.h new file mode 100644 index 0000000..29288df --- /dev/null +++ b/JavaScriptCore/runtime/Executable.h @@ -0,0 +1,268 @@ +/* + * 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 Executable_h +#define Executable_h + +#include "Nodes.h" + +namespace JSC { + + class CodeBlock; + class EvalCodeBlock; + class ProgramCodeBlock; + class ScopeChainNode; + + struct ExceptionInfo; + + class ExecutableBase { + friend class JIT; + public: + virtual ~ExecutableBase() {} + + ExecutableBase(const SourceCode& source) + : m_source(source) + { + } + + const SourceCode& source() { return m_source; } + intptr_t sourceID() const { return m_node->sourceID(); } + const UString& sourceURL() const { return m_node->sourceURL(); } + int lineNo() const { return m_node->lineNo(); } + int lastLine() const { return m_node->lastLine(); } + + bool usesEval() const { return m_node->usesEval(); } + bool usesArguments() const { return m_node->usesArguments(); } + bool needsActivation() const { return m_node->needsActivation(); } + + virtual ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) = 0; + + ScopeNode* astNode() { return m_node.get(); } + + protected: + RefPtr<ScopeNode> m_node; + SourceCode m_source; + + private: + // For use making native thunk. + friend class FunctionExecutable; + ExecutableBase() + { + } + +#if ENABLE(JIT) + public: + JITCode& generatedJITCode() + { + ASSERT(m_jitCode); + return m_jitCode; + } + + ExecutablePool* getExecutablePool() + { + return m_jitCode.getExecutablePool(); + } + + protected: + JITCode m_jitCode; +#endif + }; + + class EvalExecutable : public ExecutableBase { + public: + EvalExecutable(const SourceCode& source) + : ExecutableBase(source) + , m_evalCodeBlock(0) + { + } + + ~EvalExecutable(); + + JSObject* parse(ExecState* exec, bool allowDebug = true); + + EvalCodeBlock& bytecode(ScopeChainNode* scopeChainNode) + { + if (!m_evalCodeBlock) + generateBytecode(scopeChainNode); + return *m_evalCodeBlock; + } + + DeclarationStacks::VarStack& varStack() { return m_node->varStack(); } + + ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); + + private: + EvalNode* evalNode() { return static_cast<EvalNode*>(m_node.get()); } + + void generateBytecode(ScopeChainNode*); + + EvalCodeBlock* m_evalCodeBlock; + +#if ENABLE(JIT) + public: + JITCode& jitCode(ScopeChainNode* scopeChainNode) + { + if (!m_jitCode) + generateJITCode(scopeChainNode); + return m_jitCode; + } + + private: + void generateJITCode(ScopeChainNode*); +#endif + }; + + class CacheableEvalExecutable : public EvalExecutable, public RefCounted<CacheableEvalExecutable> { + public: + static PassRefPtr<CacheableEvalExecutable> create(const SourceCode& source) { return adoptRef(new CacheableEvalExecutable(source)); } + + private: + CacheableEvalExecutable(const SourceCode& source) + : EvalExecutable(source) + { + } + }; + + class ProgramExecutable : public ExecutableBase { + public: + ProgramExecutable(const SourceCode& source) + : ExecutableBase(source) + , m_programCodeBlock(0) + { + } + + ~ProgramExecutable(); + + JSObject* parse(ExecState* exec, bool allowDebug = true); + + // CodeBlocks for program code are transient and therefore to not gain from from throwing out there exception information. + ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*) { ASSERT_NOT_REACHED(); return 0; } + + ProgramCodeBlock& bytecode(ScopeChainNode* scopeChainNode) + { + if (!m_programCodeBlock) + generateBytecode(scopeChainNode); + return *m_programCodeBlock; + } + + private: + ProgramNode* programNode() { return static_cast<ProgramNode*>(m_node.get()); } + + void generateBytecode(ScopeChainNode*); + + ProgramCodeBlock* m_programCodeBlock; + +#if ENABLE(JIT) + public: + JITCode& jitCode(ScopeChainNode* scopeChainNode) + { + if (!m_jitCode) + generateJITCode(scopeChainNode); + return m_jitCode; + } + + private: + void generateJITCode(ScopeChainNode*); +#endif + }; + + class FunctionExecutable : public ExecutableBase, public RefCounted<FunctionExecutable> { + friend class JIT; + public: + FunctionExecutable(const Identifier& name, FunctionBodyNode* body) + : ExecutableBase(body->source()) + , m_codeBlock(0) + , m_name(name) + { + m_node = body; + } + + ~FunctionExecutable(); + + const Identifier& name() { return m_name; } + + JSFunction* make(ExecState* exec, ScopeChainNode* scopeChain); + + CodeBlock& bytecode(ScopeChainNode* scopeChainNode) + { + ASSERT(scopeChainNode); + if (!m_codeBlock) + generateBytecode(scopeChainNode); + return *m_codeBlock; + } + CodeBlock& generatedBytecode() + { + ASSERT(m_codeBlock); + return *m_codeBlock; + } + + bool usesEval() const { return body()->usesEval(); } + bool usesArguments() const { return body()->usesArguments(); } + size_t parameterCount() const { return body()->parameterCount(); } + UString paramString() const { return body()->paramString(); } + + bool isHostFunction() const; + bool isGenerated() const + { + return m_codeBlock; + } + + void recompile(ExecState* exec); + + ExceptionInfo* reparseExceptionInfo(JSGlobalData*, ScopeChainNode*, CodeBlock*); + + void markAggregate(MarkStack& markStack); + + private: + FunctionBodyNode* body() const { return static_cast<FunctionBodyNode*>(m_node.get()); } + + void generateBytecode(ScopeChainNode*); + + CodeBlock* m_codeBlock; + const Identifier& m_name; + +#if ENABLE(JIT) + public: + JITCode& jitCode(ScopeChainNode* scopeChainNode) + { + if (!m_jitCode) + generateJITCode(scopeChainNode); + return m_jitCode; + } + + static PassRefPtr<FunctionExecutable> createNativeThunk(ExecState* exec) + { + return adoptRef(new FunctionExecutable(exec)); + } + + private: + FunctionExecutable(ExecState* exec); + void generateJITCode(ScopeChainNode*); +#endif + }; + +}; + +#endif diff --git a/JavaScriptCore/runtime/FunctionConstructor.cpp b/JavaScriptCore/runtime/FunctionConstructor.cpp index f4f5cc8..2783b35 100644 --- a/JavaScriptCore/runtime/FunctionConstructor.cpp +++ b/JavaScriptCore/runtime/FunctionConstructor.cpp @@ -66,32 +66,6 @@ CallType FunctionConstructor::getCallData(CallData& callData) return CallTypeHost; } -FunctionBodyNode* extractFunctionBody(ProgramNode* program) -{ - if (!program) - return 0; - - StatementVector& children = program->children(); - if (children.size() != 1) - return 0; - - StatementNode* exprStatement = children[0]; - ASSERT(exprStatement); - ASSERT(exprStatement->isExprStatement()); - if (!exprStatement || !exprStatement->isExprStatement()) - return 0; - - ExpressionNode* funcExpr = static_cast<ExprStatementNode*>(exprStatement)->expr(); - ASSERT(funcExpr); - ASSERT(funcExpr->isFuncExprNode()); - if (!funcExpr || !funcExpr->isFuncExprNode()) - return 0; - - FunctionBodyNode* body = static_cast<FuncExprNode*>(funcExpr)->body(); - ASSERT(body); - return body; -} - // ECMA 15.3.2 The Function Constructor JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifier& functionName, const UString& sourceURL, int lineNumber) { @@ -113,15 +87,13 @@ JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifi int errLine; UString errMsg; SourceCode source = makeSource(program, sourceURL, lineNumber); - RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - - FunctionBodyNode* body = extractFunctionBody(programNode.get()); + RefPtr<FunctionBodyNode> body = exec->globalData().parser->parseFunctionFromGlobalCode(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); if (!body) return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); JSGlobalObject* globalObject = exec->lexicalGlobalObject(); ScopeChain scopeChain(globalObject, globalObject->globalData(), exec->globalThisValue()); - return new (exec) JSFunction(exec, functionName, body, scopeChain.node()); + return new (exec) JSFunction(exec, adoptRef(new FunctionExecutable(functionName, body.get())), scopeChain.node()); } // ECMA 15.3.2 The Function Constructor diff --git a/JavaScriptCore/runtime/FunctionConstructor.h b/JavaScriptCore/runtime/FunctionConstructor.h index 124b354..e8486dc 100644 --- a/JavaScriptCore/runtime/FunctionConstructor.h +++ b/JavaScriptCore/runtime/FunctionConstructor.h @@ -26,8 +26,6 @@ namespace JSC { class FunctionPrototype; - class ProgramNode; - class FunctionBodyNode; class FunctionConstructor : public InternalFunction { public: @@ -41,8 +39,6 @@ namespace JSC { JSObject* constructFunction(ExecState*, const ArgList&, const Identifier& functionName, const UString& sourceURL, int lineNumber); JSObject* constructFunction(ExecState*, const ArgList&); - FunctionBodyNode* extractFunctionBody(ProgramNode*); - } // namespace JSC #endif // FunctionConstructor_h diff --git a/JavaScriptCore/runtime/FunctionPrototype.cpp b/JavaScriptCore/runtime/FunctionPrototype.cpp index 9ba2144..d911f2f 100644 --- a/JavaScriptCore/runtime/FunctionPrototype.cpp +++ b/JavaScriptCore/runtime/FunctionPrototype.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 Lesser General Public @@ -84,16 +84,17 @@ static inline void insertSemicolonIfNeeded(UString& functionBody) JSValue JSC_HOST_CALL functionProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (thisValue.isObject(&JSFunction::info)) { + if (thisValue.inherits(&JSFunction::info)) { JSFunction* function = asFunction(thisValue); - if (!function->isHostFunction()) { - UString functionBody = function->body()->toSourceString(); - insertSemicolonIfNeeded(functionBody); - return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + function->body()->paramString() + ") " + functionBody); + FunctionExecutable* executable = function->executable(); + if (!executable->isHostFunction()) { + UString sourceString = executable->source().toString(); + insertSemicolonIfNeeded(sourceString); + return jsString(exec, "function " + function->name(&exec->globalData()) + "(" + executable->paramString() + ") " + sourceString); } } - if (thisValue.isObject(&InternalFunction::info)) { + if (thisValue.inherits(&InternalFunction::info)) { InternalFunction* function = asInternalFunction(thisValue); return jsString(exec, "function " + function->name(&exec->globalData()) + "() {\n [native code]\n}"); } diff --git a/JavaScriptCore/runtime/FunctionPrototype.h b/JavaScriptCore/runtime/FunctionPrototype.h index 607ddab..4f674f5 100644 --- a/JavaScriptCore/runtime/FunctionPrototype.h +++ b/JavaScriptCore/runtime/FunctionPrototype.h @@ -34,7 +34,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); } private: diff --git a/JavaScriptCore/runtime/InternalFunction.h b/JavaScriptCore/runtime/InternalFunction.h index 310644c..37077f6 100644 --- a/JavaScriptCore/runtime/InternalFunction.h +++ b/JavaScriptCore/runtime/InternalFunction.h @@ -42,7 +42,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot)); + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasStandardGetOwnPropertySlot | HasDefaultMark)); } protected: diff --git a/JavaScriptCore/runtime/JSAPIValueWrapper.h b/JavaScriptCore/runtime/JSAPIValueWrapper.h index 21a9710..5cd4bdd 100644 --- a/JavaScriptCore/runtime/JSAPIValueWrapper.h +++ b/JavaScriptCore/runtime/JSAPIValueWrapper.h @@ -54,6 +54,7 @@ namespace JSC { : JSCell(exec->globalData().apiWrapperStructure.get()) , m_value(value) { + ASSERT(!value.isCell()); } JSValue m_value; diff --git a/JavaScriptCore/runtime/JSActivation.cpp b/JavaScriptCore/runtime/JSActivation.cpp index 87adbcd..d025abb 100644 --- a/JavaScriptCore/runtime/JSActivation.cpp +++ b/JavaScriptCore/runtime/JSActivation.cpp @@ -39,8 +39,8 @@ ASSERT_CLASS_FITS_IN_CELL(JSActivation); const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 }; -JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionBodyNode> functionBody) - : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame->registers())) +JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionExecutable> functionExecutable) + : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers())) { } @@ -57,12 +57,12 @@ void JSActivation::markChildren(MarkStack& markStack) if (!registerArray) return; - size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; + size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1; size_t count = numParametersMinusThis; markStack.appendValues(registerArray, count); - size_t numVars = d()->functionBody->generatedBytecode().m_numVars; + size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars; // Skip the call frame, which sits between the parameters and vars. markStack.appendValues(registerArray + count + RegisterFile::CallFrameHeaderSize, numVars, MayContainNullValues); @@ -136,14 +136,14 @@ JSObject* JSActivation::toThisObject(ExecState* exec) const bool JSActivation::isDynamicScope() const { - return d()->functionBody->usesEval(); + return d()->functionExecutable->usesEval(); } JSValue JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) { JSActivation* activation = asActivation(slot.slotBase()); - if (activation->d()->functionBody->usesArguments()) { + if (activation->d()->functionExecutable->usesArguments()) { PropertySlot slot; activation->symbolTableGet(exec->propertyNames().arguments, slot); return slot.getValue(exec, exec->propertyNames().arguments); @@ -156,7 +156,7 @@ JSValue JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const arguments->copyRegisters(); callFrame->setCalleeArguments(arguments); } - ASSERT(arguments->isObject(&Arguments::info)); + ASSERT(arguments->inherits(&Arguments::info)); return arguments; } diff --git a/JavaScriptCore/runtime/JSActivation.h b/JavaScriptCore/runtime/JSActivation.h index 6a08439..285ae67 100644 --- a/JavaScriptCore/runtime/JSActivation.h +++ b/JavaScriptCore/runtime/JSActivation.h @@ -43,7 +43,7 @@ namespace JSC { class JSActivation : public JSVariableObject { typedef JSVariableObject Base; public: - JSActivation(CallFrame*, PassRefPtr<FunctionBodyNode>); + JSActivation(CallFrame*, PassRefPtr<FunctionExecutable>); virtual ~JSActivation(); virtual void markChildren(MarkStack&); @@ -70,13 +70,13 @@ namespace JSC { private: struct JSActivationData : public JSVariableObjectData { - JSActivationData(PassRefPtr<FunctionBodyNode> functionBody, Register* registers) - : JSVariableObjectData(&functionBody->generatedBytecode().symbolTable(), registers) - , functionBody(functionBody) + JSActivationData(PassRefPtr<FunctionExecutable> functionExecutable, Register* registers) + : JSVariableObjectData(&functionExecutable->generatedBytecode().symbolTable(), registers) + , functionExecutable(functionExecutable) { } - RefPtr<FunctionBodyNode> functionBody; + RefPtr<FunctionExecutable> functionExecutable; }; static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&); diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp index 7d7d4c4..90e0434 100644 --- a/JavaScriptCore/runtime/JSArray.cpp +++ b/JavaScriptCore/runtime/JSArray.cpp @@ -25,6 +25,7 @@ #include "ArrayPrototype.h" #include "CachedCall.h" +#include "Error.h" #include "PropertyNameArray.h" #include <wtf/AVLTree.h> #include <wtf/Assertions.h> @@ -348,8 +349,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu } } - storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength))); - if (!storage) { + if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) { throwOutOfMemoryError(exec); return; } @@ -467,8 +467,7 @@ bool JSArray::increaseVectorLength(unsigned newLength) ASSERT(newLength <= MAX_STORAGE_VECTOR_INDEX); unsigned newVectorLength = increasedVectorLength(newLength); - storage = static_cast<ArrayStorage*>(tryFastRealloc(storage, storageSize(newVectorLength))); - if (!storage) + if (!tryFastRealloc(storage, storageSize(newVectorLength)).getValue(storage)) return false; Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); @@ -603,18 +602,7 @@ void JSArray::push(ExecState* exec, JSValue value) void JSArray::markChildren(MarkStack& markStack) { - JSObject::markChildren(markStack); - - ArrayStorage* storage = m_storage; - - unsigned usedVectorLength = min(storage->m_length, storage->m_vectorLength); - markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues); - - if (SparseArrayValueMap* map = storage->m_sparseValueMap) { - SparseArrayValueMap::iterator end = map->end(); - for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) - markStack.append(it->second); - } + markChildrenDirect(markStack); } static int compareNumbersForQSort(const void* a, const void* b) diff --git a/JavaScriptCore/runtime/JSArray.h b/JavaScriptCore/runtime/JSArray.h index 49df6c4..88d8ee4 100644 --- a/JavaScriptCore/runtime/JSArray.h +++ b/JavaScriptCore/runtime/JSArray.h @@ -82,6 +82,8 @@ namespace JSC { { return Structure::create(prototype, TypeInfo(ObjectType)); } + + inline void markChildrenDirect(MarkStack& markStack); protected: virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); @@ -125,6 +127,77 @@ namespace JSC { inline bool isJSArray(JSGlobalData* globalData, JSValue v) { return v.isCell() && v.asCell()->vptr() == globalData->jsArrayVPtr; } + void JSArray::markChildrenDirect(MarkStack& markStack) { + JSObject::markChildrenDirect(markStack); + + ArrayStorage* storage = m_storage; + + unsigned usedVectorLength = std::min(storage->m_length, storage->m_vectorLength); + markStack.appendValues(storage->m_vector, usedVectorLength, MayContainNullValues); + + if (SparseArrayValueMap* map = storage->m_sparseValueMap) { + SparseArrayValueMap::iterator end = map->end(); + for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) + markStack.append(it->second); + } + } + + inline void MarkStack::drain() + { + while (!m_markSets.isEmpty() || !m_values.isEmpty()) { + while (!m_markSets.isEmpty() && m_values.size() < 50) { + ASSERT(!m_markSets.isEmpty()); + MarkSet& current = m_markSets.last(); + ASSERT(current.m_values); + JSValue* end = current.m_end; + ASSERT(current.m_values); + ASSERT(current.m_values != end); + findNextUnmarkedNullValue: + ASSERT(current.m_values != end); + JSValue v = *current.m_values; + current.m_values++; + + if (!v || v.marked()) { + if (current.m_values == end) { + m_markSets.removeLast(); + continue; + } + goto findNextUnmarkedNullValue; + } + + JSCell* currentCell = v.asCell(); + currentCell->markCellDirect(); + if (currentCell->structure()->typeInfo().type() < CompoundType) { + if (current.m_values == end) { + m_markSets.removeLast(); + continue; + } + goto findNextUnmarkedNullValue; + } + + if (current.m_values == end) + m_markSets.removeLast(); + + if (currentCell->structure()->typeInfo().hasDefaultMark()) + static_cast<JSObject*>(currentCell)->markChildrenDirect(*this); + else if (currentCell->vptr() == m_jsArrayVPtr) + static_cast<JSArray*>(currentCell)->markChildrenDirect(*this); + else + currentCell->markChildren(*this); + } + while (!m_values.isEmpty()) { + JSCell* current = m_values.removeLast(); + ASSERT(current->marked()); + if (current->structure()->typeInfo().hasDefaultMark()) + static_cast<JSObject*>(current)->markChildrenDirect(*this); + else if (current->vptr() == m_jsArrayVPtr) + static_cast<JSArray*>(current)->markChildrenDirect(*this); + else + current->markChildren(*this); + } + } + } + } // namespace JSC #endif // JSArray_h diff --git a/JavaScriptCore/runtime/JSByteArray.cpp b/JavaScriptCore/runtime/JSByteArray.cpp index 2a5e72f..f832578 100644 --- a/JavaScriptCore/runtime/JSByteArray.cpp +++ b/JavaScriptCore/runtime/JSByteArray.cpp @@ -45,7 +45,7 @@ JSByteArray::JSByteArray(ExecState* exec, PassRefPtr<Structure> structure, ByteA PassRefPtr<Structure> JSByteArray::createStructure(JSValue prototype) { - PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType)); + PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark)); return result; } diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h index 75ccf7f..485ad2e 100644 --- a/JavaScriptCore/runtime/JSCell.h +++ b/JavaScriptCore/runtime/JSCell.h @@ -55,7 +55,7 @@ namespace JSC { bool isString() const; bool isObject() const; virtual bool isGetterSetter() const; - virtual bool isObject(const ClassInfo*) const; + bool inherits(const ClassInfo*) const; virtual bool isAPIValueWrapper() const { return false; } Structure* structure() const; @@ -379,30 +379,6 @@ namespace JSC { if (cell->structure()->typeInfo().type() >= CompoundType) m_values.append(cell); } - - inline void MarkStack::drain() { - while (!m_markSets.isEmpty() || !m_values.isEmpty()) { - while ((!m_markSets.isEmpty()) && m_values.size() < 50) { - const MarkSet& current = m_markSets.removeLast(); - JSValue* ptr = current.m_values; - JSValue* end = current.m_end; - if (current.m_properties == NoNullValues) { - while (ptr != end) - append(*ptr++); - } else { - while (ptr != end) { - if (JSValue value = *ptr++) - append(value); - } - } - } - while (!m_values.isEmpty()) { - JSCell* current = m_values.removeLast(); - ASSERT(current->marked()); - current->markChildren(*this); - } - } - } } // namespace JSC #endif // JSCell_h diff --git a/JavaScriptCore/runtime/JSFunction.cpp b/JavaScriptCore/runtime/JSFunction.cpp index 84c6263..f8e3d82 100644 --- a/JavaScriptCore/runtime/JSFunction.cpp +++ b/JavaScriptCore/runtime/JSFunction.cpp @@ -45,12 +45,26 @@ ASSERT_CLASS_FITS_IN_CELL(JSFunction); const ClassInfo JSFunction::info = { "Function", &InternalFunction::info, 0, 0 }; +inline bool JSFunction::isHostFunction() const +{ + return m_executable && m_executable->isHostFunction(); +} + +bool JSFunction::isHostFunctionNonInline() const +{ + return isHostFunction(); +} + +JSFunction::JSFunction(PassRefPtr<Structure> structure) + : Base(structure) +{ + clearScopeChain(); +} + JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func) : Base(&exec->globalData(), structure, name) #if ENABLE(JIT) - , m_body(FunctionBodyNode::createNativeThunk(&exec->globalData())) -#else - , m_body(0) + , m_executable(FunctionExecutable::createNativeThunk(exec)) #endif { #if ENABLE(JIT) @@ -63,9 +77,9 @@ JSFunction::JSFunction(ExecState* exec, PassRefPtr<Structure> structure, int len #endif } -JSFunction::JSFunction(ExecState* exec, const Identifier& name, FunctionBodyNode* body, ScopeChainNode* scopeChainNode) - : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), name) - , m_body(body) +JSFunction::JSFunction(ExecState* exec, PassRefPtr<FunctionExecutable> executable, ScopeChainNode* scopeChainNode) + : Base(&exec->globalData(), exec->lexicalGlobalObject()->functionStructure(), executable->name()) + , m_executable(executable) { setScopeChain(scopeChainNode); } @@ -76,8 +90,8 @@ JSFunction::~JSFunction() // are based on a check for the this pointer value for this JSFunction - which will no longer be valid once // this memory is freed and may be reused (potentially for another, different JSFunction). #if ENABLE(JIT_OPTIMIZE_CALL) - if (m_body && m_body->isGenerated()) - m_body->generatedBytecode().unlinkCallers(); + if (m_executable && m_executable->isGenerated()) + m_executable->generatedBytecode().unlinkCallers(); #endif if (!isHostFunction()) scopeChain().~ScopeChain(); // FIXME: Don't we need to do this in the interpreter too? @@ -86,7 +100,7 @@ JSFunction::~JSFunction() void JSFunction::markChildren(MarkStack& markStack) { Base::markChildren(markStack); - m_body->markAggregate(markStack); + m_executable->markAggregate(markStack); if (!isHostFunction()) scopeChain().markAggregate(markStack); } @@ -97,7 +111,7 @@ CallType JSFunction::getCallData(CallData& callData) callData.native.function = nativeFunction(); return CallTypeHost; } - callData.js.functionBody = m_body.get(); + callData.js.functionExecutable = m_executable.get(); callData.js.scopeChain = scopeChain().node(); return CallTypeJS; } @@ -105,7 +119,7 @@ CallType JSFunction::getCallData(CallData& callData) JSValue JSFunction::call(ExecState* exec, JSValue thisValue, const ArgList& args) { ASSERT(!isHostFunction()); - return exec->interpreter()->execute(m_body.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot()); + return exec->interpreter()->execute(m_executable.get(), exec, this, thisValue.toThisObject(exec), args, scopeChain().node(), exec->exceptionSlot()); } JSValue JSFunction::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) @@ -126,7 +140,7 @@ JSValue JSFunction::lengthGetter(ExecState* exec, const Identifier&, const Prope { JSFunction* thisObj = asFunction(slot.slotBase()); ASSERT(!thisObj->isHostFunction()); - return jsNumber(exec, thisObj->m_body->parameterCount()); + return jsNumber(exec, thisObj->m_executable->parameterCount()); } bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -190,7 +204,7 @@ ConstructType JSFunction::getConstructData(ConstructData& constructData) { if (isHostFunction()) return ConstructTypeNone; - constructData.js.functionBody = m_body.get(); + constructData.js.functionExecutable = m_executable.get(); constructData.js.scopeChain = scopeChain().node(); return ConstructTypeJS; } @@ -206,7 +220,7 @@ JSObject* JSFunction::construct(ExecState* exec, const ArgList& args) structure = exec->lexicalGlobalObject()->emptyObjectStructure(); JSObject* thisObj = new (exec) JSObject(structure); - JSValue result = exec->interpreter()->execute(m_body.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot()); + JSValue result = exec->interpreter()->execute(m_executable.get(), exec, this, thisObj, args, scopeChain().node(), exec->exceptionSlot()); if (exec->hadException() || !result.isObject()) return thisObj; return asObject(result); diff --git a/JavaScriptCore/runtime/JSFunction.h b/JavaScriptCore/runtime/JSFunction.h index cab1e5b..71998dc 100644 --- a/JavaScriptCore/runtime/JSFunction.h +++ b/JavaScriptCore/runtime/JSFunction.h @@ -24,15 +24,11 @@ #ifndef JSFunction_h #define JSFunction_h +#include "Executable.h" #include "InternalFunction.h" -#include "JSVariableObject.h" -#include "SymbolTable.h" -#include "Nodes.h" -#include "JSObject.h" namespace JSC { - class FunctionBodyNode; class FunctionPrototype; class JSActivation; class JSGlobalObject; @@ -43,20 +39,10 @@ namespace JSC { typedef InternalFunction Base; - JSFunction(PassRefPtr<Structure> structure) - : InternalFunction(structure) - { - clearScopeChain(); - } - public: JSFunction(ExecState*, PassRefPtr<Structure>, int length, const Identifier&, NativeFunction); - JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*); - ~JSFunction(); - - virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); - virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); - virtual bool deleteProperty(ExecState*, const Identifier& propertyName); + JSFunction(ExecState*, PassRefPtr<FunctionExecutable>, ScopeChainNode*); + virtual ~JSFunction(); JSObject* construct(ExecState*, const ArgList&); JSValue call(ExecState*, JSValue thisValue, const ArgList&); @@ -64,11 +50,7 @@ namespace JSC { void setScope(const ScopeChain& scopeChain) { setScopeChain(scopeChain); } ScopeChain& scope() { return scopeChain(); } - void setBody(FunctionBodyNode* body) { m_body = body; } - void setBody(PassRefPtr<FunctionBodyNode> body) { m_body = body; } - FunctionBodyNode* body() const { return m_body.get(); } - - virtual void markChildren(MarkStack&); + FunctionExecutable* executable() const { return m_executable.get(); } static JS_EXPORTDATA const ClassInfo info; @@ -77,11 +59,6 @@ namespace JSC { return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance)); } -#if ENABLE(JIT) - bool isHostFunction() const { return m_body && m_body->isHostFunction(); } -#else - bool isHostFunction() const { return false; } -#endif NativeFunction nativeFunction() { return *reinterpret_cast<NativeFunction*>(m_data); @@ -91,31 +68,42 @@ namespace JSC { virtual CallType getCallData(CallData&); private: + JSFunction(PassRefPtr<Structure>); + + bool isHostFunction() const; + bool isHostFunctionNonInline() const; + + virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); + virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + virtual bool deleteProperty(ExecState*, const Identifier& propertyName); + + virtual void markChildren(MarkStack&); + virtual const ClassInfo* classInfo() const { return &info; } static JSValue argumentsGetter(ExecState*, const Identifier&, const PropertySlot&); static JSValue callerGetter(ExecState*, const Identifier&, const PropertySlot&); static JSValue lengthGetter(ExecState*, const Identifier&, const PropertySlot&); - RefPtr<FunctionBodyNode> m_body; + RefPtr<FunctionExecutable> m_executable; ScopeChain& scopeChain() { - ASSERT(!isHostFunction()); + ASSERT(!isHostFunctionNonInline()); return *reinterpret_cast<ScopeChain*>(m_data); } void clearScopeChain() { - ASSERT(!isHostFunction()); + ASSERT(!isHostFunctionNonInline()); new (m_data) ScopeChain(NoScopeChain()); } void setScopeChain(ScopeChainNode* sc) { - ASSERT(!isHostFunction()); + ASSERT(!isHostFunctionNonInline()); new (m_data) ScopeChain(sc); } void setScopeChain(const ScopeChain& sc) { - ASSERT(!isHostFunction()); + ASSERT(!isHostFunctionNonInline()); *reinterpret_cast<ScopeChain*>(m_data) = sc; } void setNativeFunction(NativeFunction func) @@ -133,6 +121,11 @@ namespace JSC { return static_cast<JSFunction*>(asObject(value)); } + inline JSFunction* FunctionExecutable::make(ExecState* exec, ScopeChainNode* scopeChain) + { + return new (exec) JSFunction(exec, this, scopeChain); + } + } // namespace JSC #endif // JSFunction_h diff --git a/JavaScriptCore/runtime/JSGlobalData.cpp b/JavaScriptCore/runtime/JSGlobalData.cpp index 03df41d..38ee1d0 100644 --- a/JavaScriptCore/runtime/JSGlobalData.cpp +++ b/JavaScriptCore/runtime/JSGlobalData.cpp @@ -144,8 +144,9 @@ JSGlobalData::JSGlobalData(bool isShared, const VPtrSet& vptrSet) , initializingLazyNumericCompareFunction(false) , head(0) , dynamicGlobalObject(0) - , scopeNodeBeingReparsed(0) + , functionCodeBlockBeingReparsed(0) , firstStringifierToMark(0) + , markStack(vptrSet.jsArrayVPtr) { #if PLATFORM(MAC) startProfilerServerIfNeeded(); @@ -235,9 +236,9 @@ const Vector<Instruction>& JSGlobalData::numericCompareFunction(ExecState* exec) { if (!lazyNumericCompareFunction.size() && !initializingLazyNumericCompareFunction) { initializingLazyNumericCompareFunction = true; - RefPtr<ProgramNode> programNode = parser->parse<ProgramNode>(exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0); - RefPtr<FunctionBodyNode> functionBody = extractFunctionBody(programNode.get()); - lazyNumericCompareFunction = functionBody->bytecode(exec->scopeChain()).instructions(); + RefPtr<FunctionBodyNode> functionBody = parser->parseFunctionFromGlobalCode(exec, 0, makeSource(UString("(function (v1, v2) { return v1 - v2; })")), 0, 0); + FunctionExecutable function(functionBody->ident(), functionBody.get()); + lazyNumericCompareFunction = function.bytecode(exec->scopeChain()).instructions(); initializingLazyNumericCompareFunction = false; } diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h index 88cb516..77556b7 100644 --- a/JavaScriptCore/runtime/JSGlobalData.h +++ b/JavaScriptCore/runtime/JSGlobalData.h @@ -45,15 +45,14 @@ struct OpaqueJSClassContextData; namespace JSC { + class CodeBlock; class CommonIdentifiers; - class FunctionBodyNode; class IdentifierTable; class Interpreter; class JSGlobalObject; class JSObject; class Lexer; class Parser; - class ScopeNode; class Stringifier; class Structure; class UString; @@ -145,7 +144,7 @@ namespace JSC { HashSet<JSObject*> arrayVisitedElements; - ScopeNode* scopeNodeBeingReparsed; + CodeBlock* functionCodeBlockBeingReparsed; Stringifier* firstStringifierToMark; MarkStack markStack; diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp index a90f18f..3a1909d 100644 --- a/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -112,8 +112,8 @@ JSGlobalObject::~JSGlobalObject() if (headObject == this) headObject = 0; - HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end(); - for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) + HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end(); + for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) (*it)->clearGlobalObject(); RegisterFile& registerFile = globalData()->interpreter->registerFile(); @@ -258,7 +258,7 @@ void JSGlobalObject::reset(JSValue prototype) JSCell* objectConstructor = new (exec) ObjectConstructor(exec, ObjectConstructor::createStructure(d()->functionPrototype), d()->objectPrototype, d()->prototypeFunctionStructure.get()); JSCell* functionConstructor = new (exec) FunctionConstructor(exec, FunctionConstructor::createStructure(d()->functionPrototype), d()->functionPrototype); - JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype); + JSCell* arrayConstructor = new (exec) ArrayConstructor(exec, ArrayConstructor::createStructure(d()->functionPrototype), d()->arrayPrototype, d()->prototypeFunctionStructure.get()); JSCell* stringConstructor = new (exec) StringConstructor(exec, StringConstructor::createStructure(d()->functionPrototype), d()->prototypeFunctionStructure.get(), d()->stringPrototype); JSCell* booleanConstructor = new (exec) BooleanConstructor(exec, BooleanConstructor::createStructure(d()->functionPrototype), d()->booleanPrototype); JSCell* numberConstructor = new (exec) NumberConstructor(exec, NumberConstructor::createStructure(d()->functionPrototype), d()->numberPrototype); @@ -361,8 +361,8 @@ void JSGlobalObject::markChildren(MarkStack& markStack) { JSVariableObject::markChildren(markStack); - HashSet<ProgramCodeBlock*>::const_iterator end = codeBlocks().end(); - for (HashSet<ProgramCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) + HashSet<GlobalCodeBlock*>::const_iterator end = codeBlocks().end(); + for (HashSet<GlobalCodeBlock*>::const_iterator it = codeBlocks().begin(); it != end; ++it) (*it)->markAggregate(markStack); RegisterFile& registerFile = globalData()->interpreter->registerFile(); diff --git a/JavaScriptCore/runtime/JSGlobalObject.h b/JavaScriptCore/runtime/JSGlobalObject.h index cda49bd..cc36ada 100644 --- a/JavaScriptCore/runtime/JSGlobalObject.h +++ b/JavaScriptCore/runtime/JSGlobalObject.h @@ -38,6 +38,7 @@ namespace JSC { class Debugger; class ErrorConstructor; class FunctionPrototype; + class GlobalCodeBlock; class GlobalEvalFunction; class NativeErrorConstructor; class ProgramCodeBlock; @@ -144,7 +145,7 @@ namespace JSC { RefPtr<JSGlobalData> globalData; - HashSet<ProgramCodeBlock*> codeBlocks; + HashSet<GlobalCodeBlock*> codeBlocks; }; public: @@ -246,7 +247,7 @@ namespace JSC { virtual bool isDynamicScope() const; - HashSet<ProgramCodeBlock*>& codeBlocks() { return d()->codeBlocks; } + HashSet<GlobalCodeBlock*>& codeBlocks() { return d()->codeBlocks; } void copyGlobalsFrom(RegisterFile&); void copyGlobalsTo(RegisterFile&); diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp index affb99c..50ea27f 100644 --- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp +++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp @@ -286,16 +286,12 @@ JSValue JSC_HOST_CALL globalFuncEval(ExecState* exec, JSObject* function, JSValu if (JSValue parsedObject = preparser.tryLiteralParse()) return parsedObject; - int errLine; - UString errMsg; + EvalExecutable eval(makeSource(s)); + JSObject* error = eval.parse(exec); + if (error) + return throwError(exec, error); - SourceCode source = makeSource(s); - RefPtr<EvalNode> evalNode = exec->globalData().parser->parse<EvalNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg); - - if (!evalNode) - return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), NULL); - - return exec->interpreter()->execute(evalNode.get(), exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()); + return exec->interpreter()->execute(&eval, exec, thisObject, static_cast<JSGlobalObject*>(unwrappedObject)->globalScopeChain().node(), exec->exceptionSlot()); } JSValue JSC_HOST_CALL globalFuncParseInt(ExecState* exec, JSObject*, JSValue, const ArgList& args) diff --git a/JavaScriptCore/runtime/JSNumberCell.h b/JavaScriptCore/runtime/JSNumberCell.h index 04cccef..6a48081 100644 --- a/JavaScriptCore/runtime/JSNumberCell.h +++ b/JavaScriptCore/runtime/JSNumberCell.h @@ -84,7 +84,7 @@ namespace JSC { #endif } - static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, NeedsThisConversion)); } + static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(NumberType, NeedsThisConversion | HasDefaultMark)); } private: JSNumberCell(JSGlobalData* globalData, double value) diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp index d643808..fed9fc3 100644 --- a/JavaScriptCore/runtime/JSONObject.cpp +++ b/JavaScriptCore/runtime/JSONObject.cpp @@ -381,6 +381,15 @@ Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& JSObject* object = asObject(value); + CallData callData; + if (object->getCallData(callData) != CallTypeNone) { + if (holder->inherits(&JSArray::info)) { + builder.append("null"); + return StringifySucceeded; + } + return StringifyFailedDueToUndefinedValue; + } + // 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."); diff --git a/JavaScriptCore/runtime/JSONObject.h b/JavaScriptCore/runtime/JSONObject.h index faca7c7..c61b0dd 100644 --- a/JavaScriptCore/runtime/JSONObject.h +++ b/JavaScriptCore/runtime/JSONObject.h @@ -41,7 +41,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType)); + return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark)); } static void markStringifiers(MarkStack&, Stringifier*); diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp index 419dfe9..57624fb 100644 --- a/JavaScriptCore/runtime/JSObject.cpp +++ b/JavaScriptCore/runtime/JSObject.cpp @@ -37,26 +37,6 @@ #include <math.h> #include <wtf/Assertions.h> -#define JSOBJECT_MARK_TRACING 0 - -#if JSOBJECT_MARK_TRACING - -#define JSOBJECT_MARK_BEGIN() \ - static int markStackDepth = 0; \ - for (int i = 0; i < markStackDepth; i++) \ - putchar('-'); \ - printf("%s (%p)\n", className().UTF8String().c_str(), this); \ - markStackDepth++; \ - -#define JSOBJECT_MARK_END() \ - markStackDepth--; - -#else // JSOBJECT_MARK_TRACING - -#define JSOBJECT_MARK_BEGIN() -#define JSOBJECT_MARK_END() - -#endif // JSOBJECT_MARK_TRACING namespace JSC { @@ -64,16 +44,7 @@ ASSERT_CLASS_FITS_IN_CELL(JSObject); void JSObject::markChildren(MarkStack& markStack) { - JSOBJECT_MARK_BEGIN(); - - JSCell::markChildren(markStack); - m_structure->markAggregate(markStack); - - PropertyStorage storage = propertyStorage(); - size_t storageSize = m_structure->propertyStorageSize(); - markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize); - - JSOBJECT_MARK_END(); + markChildrenDirect(markStack); } UString JSObject::className() const diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h index decd5e9..856c5a1 100644 --- a/JavaScriptCore/runtime/JSObject.h +++ b/JavaScriptCore/runtime/JSObject.h @@ -27,7 +27,9 @@ #include "ClassInfo.h" #include "CommonIdentifiers.h" #include "CallFrame.h" +#include "JSCell.h" #include "JSNumberCell.h" +#include "MarkStack.h" #include "PropertySlot.h" #include "PutPropertySlot.h" #include "ScopeChain.h" @@ -74,13 +76,12 @@ namespace JSC { explicit JSObject(PassRefPtr<Structure>); virtual void markChildren(MarkStack&); + ALWAYS_INLINE void markChildrenDirect(MarkStack& markStack); // The inline virtual destructor cannot be the first virtual function declared // in the class as it results in the vtable being generated as a weak symbol virtual ~JSObject(); - bool inherits(const ClassInfo* classInfo) const { return JSCell::isObject(classInfo); } - JSValue prototype() const; void setPrototype(JSValue prototype); @@ -201,10 +202,22 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot)); + return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); } private: + // Nobody should ever ask any of these questions on something already known to be a JSObject. + using JSCell::isAPIValueWrapper; + using JSCell::isGetterSetter; + using JSCell::toObject; + void getObject(); + void getString(); + void isObject(); + void isString(); +#if USE(JSVALUE32) + void isNumber(); +#endif + ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); } PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); } @@ -293,7 +306,7 @@ inline bool Structure::isUsingInlineStorage() const return (propertyStorageCapacity() == JSObject::inlineStorageCapacity); } -inline bool JSCell::isObject(const ClassInfo* info) const +inline bool JSCell::inherits(const ClassInfo* info) const { for (const ClassInfo* ci = classInfo(); ci; ci = ci->parentClass) { if (ci == info) @@ -302,10 +315,10 @@ inline bool JSCell::isObject(const ClassInfo* info) const return false; } -// this method is here to be after the inline declaration of JSCell::isObject -inline bool JSValue::isObject(const ClassInfo* classInfo) const +// this method is here to be after the inline declaration of JSCell::inherits +inline bool JSValue::inherits(const ClassInfo* classInfo) const { - return isCell() && asCell()->isObject(classInfo); + return isCell() && asCell()->inherits(classInfo); } ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -627,6 +640,16 @@ ALWAYS_INLINE void JSObject::allocatePropertyStorageInline(size_t oldSize, size_ m_externalStorage = newPropertyStorage; } +ALWAYS_INLINE void JSObject::markChildrenDirect(MarkStack& markStack) +{ + JSCell::markChildren(markStack); + m_structure->markAggregate(markStack); + + PropertyStorage storage = propertyStorage(); + size_t storageSize = m_structure->propertyStorageSize(); + markStack.appendValues(reinterpret_cast<JSValue*>(storage), storageSize); +} + } // namespace JSC #endif // JSObject_h diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h index 3daf58a..f9b0a8f 100644 --- a/JavaScriptCore/runtime/JSString.h +++ b/JavaScriptCore/runtime/JSString.h @@ -90,7 +90,7 @@ namespace JSC { bool canGetIndex(unsigned i) { return i < static_cast<unsigned>(m_value.size()); } JSString* getIndex(JSGlobalData*, unsigned); - static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, NeedsThisConversion)); } + static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, NeedsThisConversion | HasDefaultMark)); } private: enum VPtrStealingHackType { VPtrStealingHack }; diff --git a/JavaScriptCore/runtime/JSType.h b/JavaScriptCore/runtime/JSType.h index a118b87..882b218 100644 --- a/JavaScriptCore/runtime/JSType.h +++ b/JavaScriptCore/runtime/JSType.h @@ -33,7 +33,6 @@ namespace JSC { NumberType = 3, NullType = 4, StringType = 5, - // The CompoundType value must come before any JSType that may have children CompoundType = 6, ObjectType = 7, diff --git a/JavaScriptCore/runtime/JSValue.h b/JavaScriptCore/runtime/JSValue.h index 408c187..b72cc6e 100644 --- a/JavaScriptCore/runtime/JSValue.h +++ b/JavaScriptCore/runtime/JSValue.h @@ -130,7 +130,7 @@ namespace JSC { bool isString() const; bool isGetterSetter() const; bool isObject() const; - bool isObject(const ClassInfo*) const; + bool inherits(const ClassInfo*) const; // Extracting the value. bool getBoolean(bool&) const; diff --git a/JavaScriptCore/runtime/MarkStack.h b/JavaScriptCore/runtime/MarkStack.h index 7a7b3af..a97aa7e 100644 --- a/JavaScriptCore/runtime/MarkStack.h +++ b/JavaScriptCore/runtime/MarkStack.h @@ -31,15 +31,15 @@ #include <wtf/Noncopyable.h> namespace JSC { + class JSGlobalData; class Register; enum MarkSetProperties { MayContainNullValues, NoNullValues }; class MarkStack : Noncopyable { public: - MarkStack() - : m_markSets() - , m_values() + MarkStack(void* jsArrayVPtr) + : m_jsArrayVPtr(jsArrayVPtr) { } @@ -82,6 +82,7 @@ namespace JSC { , m_end(end) , m_properties(properties) { + ASSERT(values); } JSValue* m_values; JSValue* m_end; @@ -136,6 +137,12 @@ namespace JSC { ASSERT(m_top); return m_data[--m_top]; } + + inline T& last() + { + ASSERT(m_top); + return m_data[m_top - 1]; + } inline bool isEmpty() { @@ -150,7 +157,14 @@ namespace JSC { ASSERT(0 == (size % MarkStack::pageSize())); if (size == m_allocated) return; +#if PLATFORM(WIN) + // We cannot release a part of a region with VirtualFree. To get around this, + // we'll release the entire region and reallocate the size that we want. + releaseStack(m_data, m_allocated); + m_data = reinterpret_cast<T*>(allocateStack(size)); +#else releaseStack(reinterpret_cast<char*>(m_data) + size, m_allocated - size); +#endif m_allocated = size; m_capacity = m_allocated / sizeof(T); } @@ -162,6 +176,7 @@ namespace JSC { T* m_data; }; + void* m_jsArrayVPtr; MarkStackArray<MarkSet> m_markSets; MarkStackArray<JSCell*> m_values; static size_t s_pageSize; diff --git a/JavaScriptCore/runtime/MarkStackWin.cpp b/JavaScriptCore/runtime/MarkStackWin.cpp index dbc3306..1fdd06a 100644 --- a/JavaScriptCore/runtime/MarkStackWin.cpp +++ b/JavaScriptCore/runtime/MarkStackWin.cpp @@ -43,9 +43,11 @@ void* MarkStack::allocateStack(size_t size) { return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); } -void MarkStack::releaseStack(void* addr, size_t size) +void MarkStack::releaseStack(void* addr, size_t) { - VirtualFree(addr, size, MEM_RELEASE); + // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx, + // dwSize must be 0 if dwFreeType is MEM_RELEASE. + VirtualFree(addr, 0, MEM_RELEASE); } } diff --git a/JavaScriptCore/runtime/MathObject.h b/JavaScriptCore/runtime/MathObject.h index 3557d1e..06aa54b 100644 --- a/JavaScriptCore/runtime/MathObject.h +++ b/JavaScriptCore/runtime/MathObject.h @@ -36,7 +36,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType)); + return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark)); } }; diff --git a/JavaScriptCore/runtime/NumberConstructor.h b/JavaScriptCore/runtime/NumberConstructor.h index b1224ec..6e67840 100644 --- a/JavaScriptCore/runtime/NumberConstructor.h +++ b/JavaScriptCore/runtime/NumberConstructor.h @@ -38,7 +38,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance)); + return Structure::create(proto, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark)); } enum { NaNValue, NegInfinity, PosInfinity, MaxValue, MinValue }; diff --git a/JavaScriptCore/runtime/NumberObject.h b/JavaScriptCore/runtime/NumberObject.h index d354b9b..07a013f 100644 --- a/JavaScriptCore/runtime/NumberObject.h +++ b/JavaScriptCore/runtime/NumberObject.h @@ -30,6 +30,11 @@ namespace JSC { explicit NumberObject(PassRefPtr<Structure>); static const ClassInfo info; + + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultMark)); + } private: virtual const ClassInfo* classInfo() const { return &info; } diff --git a/JavaScriptCore/runtime/ObjectConstructor.cpp b/JavaScriptCore/runtime/ObjectConstructor.cpp index 70c7cd1..b05b910 100644 --- a/JavaScriptCore/runtime/ObjectConstructor.cpp +++ b/JavaScriptCore/runtime/ObjectConstructor.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "ObjectConstructor.h" +#include "Error.h" #include "JSFunction.h" #include "JSGlobalObject.h" #include "ObjectPrototype.h" diff --git a/JavaScriptCore/runtime/PropertySlot.cpp b/JavaScriptCore/runtime/PropertySlot.cpp index 36fa5d8..a0a2f48 100644 --- a/JavaScriptCore/runtime/PropertySlot.cpp +++ b/JavaScriptCore/runtime/PropertySlot.cpp @@ -23,7 +23,6 @@ #include "JSFunction.h" #include "JSGlobalObject.h" -#include "JSObject.h" namespace JSC { @@ -39,7 +38,7 @@ JSValue PropertySlot::functionGetter(ExecState* exec, const Identifier&, const P return callData.native.function(exec, slot.m_data.getterFunc, slot.slotBase(), exec->emptyList()); ASSERT(callType == CallTypeJS); // FIXME: Can this be done more efficiently using the callData? - return static_cast<JSFunction*>(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList()); + return asFunction(slot.m_data.getterFunc)->call(exec, slot.slotBase(), exec->emptyList()); } } // namespace JSC diff --git a/JavaScriptCore/runtime/RegExpConstructor.cpp b/JavaScriptCore/runtime/RegExpConstructor.cpp index 6a8089d..62d56e9 100644 --- a/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -23,6 +23,7 @@ #include "RegExpConstructor.h" #include "ArrayPrototype.h" +#include "Error.h" #include "JSArray.h" #include "JSFunction.h" #include "JSString.h" @@ -329,7 +330,7 @@ JSObject* constructRegExp(ExecState* exec, const ArgList& args) JSValue arg0 = args.at(0); JSValue arg1 = args.at(1); - if (arg0.isObject(&RegExpObject::info)) { + if (arg0.inherits(&RegExpObject::info)) { if (!arg1.isUndefined()) return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another."); return asObject(arg0); diff --git a/JavaScriptCore/runtime/RegExpConstructor.h b/JavaScriptCore/runtime/RegExpConstructor.h index 6823f3f..30b9750 100644 --- a/JavaScriptCore/runtime/RegExpConstructor.h +++ b/JavaScriptCore/runtime/RegExpConstructor.h @@ -36,7 +36,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance)); + return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance | HasDefaultMark)); } virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); diff --git a/JavaScriptCore/runtime/RegExpObject.h b/JavaScriptCore/runtime/RegExpObject.h index e83e0ac..5ca3b3f 100644 --- a/JavaScriptCore/runtime/RegExpObject.h +++ b/JavaScriptCore/runtime/RegExpObject.h @@ -48,7 +48,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue prototype) { - return Structure::create(prototype, TypeInfo(ObjectType)); + return Structure::create(prototype, TypeInfo(ObjectType, HasDefaultMark)); } private: diff --git a/JavaScriptCore/runtime/RegExpPrototype.cpp b/JavaScriptCore/runtime/RegExpPrototype.cpp index b1ab889..30420e9 100644 --- a/JavaScriptCore/runtime/RegExpPrototype.cpp +++ b/JavaScriptCore/runtime/RegExpPrototype.cpp @@ -22,6 +22,7 @@ #include "RegExpPrototype.h" #include "ArrayPrototype.h" +#include "Error.h" #include "JSArray.h" #include "JSFunction.h" #include "JSObject.h" @@ -58,28 +59,28 @@ RegExpPrototype::RegExpPrototype(ExecState* exec, PassRefPtr<Structure> structur JSValue JSC_HOST_CALL regExpProtoFuncTest(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::info)) return throwError(exec, TypeError); return asRegExpObject(thisValue)->test(exec, args); } JSValue JSC_HOST_CALL regExpProtoFuncExec(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::info)) return throwError(exec, TypeError); return asRegExpObject(thisValue)->exec(exec, args); } JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&RegExpObject::info)) + if (!thisValue.inherits(&RegExpObject::info)) return throwError(exec, TypeError); RefPtr<RegExp> regExp; JSValue arg0 = args.at(0); JSValue arg1 = args.at(1); - if (arg0.isObject(&RegExpObject::info)) { + if (arg0.inherits(&RegExpObject::info)) { if (!arg1.isUndefined()) return throwError(exec, TypeError, "Cannot supply flags when constructing one RegExp from another."); regExp = asRegExpObject(arg0)->regExp(); @@ -99,8 +100,8 @@ JSValue JSC_HOST_CALL regExpProtoFuncCompile(ExecState* exec, JSObject*, JSValue JSValue JSC_HOST_CALL regExpProtoFuncToString(ExecState* exec, JSObject*, JSValue thisValue, const ArgList&) { - if (!thisValue.isObject(&RegExpObject::info)) { - if (thisValue.isObject(&RegExpPrototype::info)) + if (!thisValue.inherits(&RegExpObject::info)) { + if (thisValue.inherits(&RegExpPrototype::info)) return jsNontrivialString(exec, "//"); return throwError(exec, TypeError); } diff --git a/JavaScriptCore/runtime/ScopeChain.cpp b/JavaScriptCore/runtime/ScopeChain.cpp index 5c2edab..960c525 100644 --- a/JavaScriptCore/runtime/ScopeChain.cpp +++ b/JavaScriptCore/runtime/ScopeChain.cpp @@ -56,7 +56,7 @@ int ScopeChain::localDepth() const int scopeDepth = 0; ScopeChainIterator iter = this->begin(); ScopeChainIterator end = this->end(); - while (!(*iter)->isObject(&JSActivation::info)) { + while (!(*iter)->inherits(&JSActivation::info)) { ++iter; if (iter == end) break; diff --git a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h index bc5c0a5..1d2e03f 100644 --- a/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h +++ b/JavaScriptCore/runtime/StringObjectThatMasqueradesAsUndefined.h @@ -44,7 +44,7 @@ namespace JSC { static PassRefPtr<Structure> createStructure(JSValue proto) { - return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined)); + return Structure::create(proto, TypeInfo(ObjectType, MasqueradesAsUndefined | HasDefaultMark)); } virtual bool toBoolean(ExecState*) const { return false; } diff --git a/JavaScriptCore/runtime/StringPrototype.cpp b/JavaScriptCore/runtime/StringPrototype.cpp index 531a302..b4f7634 100644 --- a/JavaScriptCore/runtime/StringPrototype.cpp +++ b/JavaScriptCore/runtime/StringPrototype.cpp @@ -23,6 +23,7 @@ #include "StringPrototype.h" #include "CachedCall.h" +#include "Error.h" #include "JSArray.h" #include "JSFunction.h" #include "ObjectPrototype.h" @@ -220,7 +221,7 @@ JSValue JSC_HOST_CALL stringProtoFuncReplace(ExecState* exec, JSObject*, JSValue if (callType == CallTypeNone) replacementString = replacement.toString(exec); - if (pattern.isObject(&RegExpObject::info)) { + if (pattern.inherits(&RegExpObject::info)) { RegExp* reg = asRegExpObject(pattern)->regExp(); bool global = reg->global(); @@ -365,7 +366,7 @@ JSValue JSC_HOST_CALL stringProtoFuncToString(ExecState* exec, JSObject*, JSValu if (thisValue.isString()) return thisValue; - if (thisValue.isObject(&StringObject::info)) + if (thisValue.inherits(&StringObject::info)) return asStringObject(thisValue)->internalValue(); return throwError(exec, TypeError); @@ -466,7 +467,7 @@ JSValue JSC_HOST_CALL stringProtoFuncMatch(ExecState* exec, JSObject*, JSValue t UString u = s; RefPtr<RegExp> reg; RegExpObject* imp = 0; - if (a0.isObject(&RegExpObject::info)) + if (a0.inherits(&RegExpObject::info)) reg = asRegExpObject(a0)->regExp(); else { /* @@ -516,7 +517,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSearch(ExecState* exec, JSObject*, JSValue UString u = s; RefPtr<RegExp> reg; - if (a0.isObject(&RegExpObject::info)) + if (a0.inherits(&RegExpObject::info)) reg = asRegExpObject(a0)->regExp(); else { /* @@ -568,7 +569,7 @@ JSValue JSC_HOST_CALL stringProtoFuncSplit(ExecState* exec, JSObject*, JSValue t unsigned i = 0; int p0 = 0; unsigned limit = a1.isUndefined() ? 0xFFFFFFFFU : a1.toUInt32(exec); - if (a0.isObject(&RegExpObject::info)) { + if (a0.inherits(&RegExpObject::info)) { RegExp* reg = asRegExpObject(a0)->regExp(); if (s.isEmpty() && reg->match(s, 0) >= 0) { // empty string matched by regexp -> empty array @@ -821,8 +822,8 @@ JSValue JSC_HOST_CALL stringProtoFuncFontsize(ExecState* exec, JSObject*, JSValu if (a0.getUInt32(smallInteger) && smallInteger <= 9) { unsigned stringSize = s.size(); unsigned bufferSize = 22 + stringSize; - UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar))); - if (!buffer) + UChar* buffer; + if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer)) return jsUndefined(); buffer[0] = '<'; buffer[1] = 'f'; @@ -869,8 +870,8 @@ JSValue JSC_HOST_CALL stringProtoFuncLink(ExecState* exec, JSObject*, JSValue th unsigned linkTextSize = linkText.size(); unsigned stringSize = s.size(); unsigned bufferSize = 15 + linkTextSize + stringSize; - UChar* buffer = static_cast<UChar*>(tryFastMalloc(bufferSize * sizeof(UChar))); - if (!buffer) + UChar* buffer; + if (!tryFastMalloc(bufferSize * sizeof(UChar)).getValue(buffer)) return jsUndefined(); buffer[0] = '<'; buffer[1] = 'a'; diff --git a/JavaScriptCore/runtime/TypeInfo.h b/JavaScriptCore/runtime/TypeInfo.h index 70aeed3..20c13ea 100644 --- a/JavaScriptCore/runtime/TypeInfo.h +++ b/JavaScriptCore/runtime/TypeInfo.h @@ -38,6 +38,7 @@ namespace JSC { static const unsigned ImplementsDefaultHasInstance = 1 << 3; static const unsigned NeedsThisConversion = 1 << 4; static const unsigned HasStandardGetOwnPropertySlot = 1 << 5; + static const unsigned HasDefaultMark = 1 << 6; class TypeInfo { friend class JIT; @@ -59,7 +60,7 @@ namespace JSC { bool overridesHasInstance() const { return m_flags & OverridesHasInstance; } bool needsThisConversion() const { return m_flags & NeedsThisConversion; } bool hasStandardGetOwnPropertySlot() const { return m_flags & HasStandardGetOwnPropertySlot; } - + bool hasDefaultMark() const { return m_flags & HasDefaultMark; } unsigned flags() const { return m_flags; } private: diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp index 118751e..9977f12 100644 --- a/JavaScriptCore/runtime/UString.cpp +++ b/JavaScriptCore/runtime/UString.cpp @@ -32,12 +32,14 @@ #include <ctype.h> #include <float.h> #include <limits.h> +#include <limits> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <wtf/ASCIICType.h> #include <wtf/Assertions.h> #include <wtf/MathExtras.h> +#include <wtf/StringExtras.h> #include <wtf/Vector.h> #include <wtf/unicode/UTF8.h> @@ -68,20 +70,20 @@ static const int minLengthToShare = 10; static inline size_t overflowIndicator() { return std::numeric_limits<size_t>::max(); } static inline size_t maxUChars() { return std::numeric_limits<size_t>::max() / sizeof(UChar); } -static inline UChar* allocChars(size_t length) +static inline PossiblyNull<UChar*> allocChars(size_t length) { ASSERT(length); if (length > maxUChars()) return 0; - return static_cast<UChar*>(tryFastMalloc(sizeof(UChar) * length)); + return tryFastMalloc(sizeof(UChar) * length); } -static inline UChar* reallocChars(UChar* buffer, size_t length) +static inline PossiblyNull<UChar*> reallocChars(UChar* buffer, size_t length) { ASSERT(length); if (length > maxUChars()) return 0; - return static_cast<UChar*>(tryFastRealloc(buffer, sizeof(UChar) * length)); + return tryFastRealloc(buffer, sizeof(UChar) * length); } static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters) @@ -480,8 +482,7 @@ static inline bool expandCapacity(UString::Rep* rep, int requiredLength) if (requiredLength > base->capacity) { size_t newCapacity = expandedSize(requiredLength, base->preCapacity); UChar* oldBuf = base->buf; - base->buf = reallocChars(base->buf, newCapacity); - if (!base->buf) { + if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) { base->buf = oldBuf; return false; } @@ -512,8 +513,7 @@ bool UString::Rep::reserveCapacity(int capacity) size_t newCapacity = expandedSize(capacity, base->preCapacity); UChar* oldBuf = base->buf; - base->buf = reallocChars(base->buf, newCapacity); - if (!base->buf) { + if (!reallocChars(base->buf, newCapacity).getValue(base->buf)) { base->buf = oldBuf; return false; } @@ -540,8 +540,8 @@ void UString::expandPreCapacity(int requiredPreCap) size_t newCapacity = expandedSize(requiredPreCap, base->capacity); int delta = newCapacity - base->capacity - base->preCapacity; - UChar* newBuf = allocChars(newCapacity); - if (!newBuf) { + UChar* newBuf; + if (!allocChars(newCapacity).getValue(newBuf)) { makeNull(); return; } @@ -566,8 +566,8 @@ static PassRefPtr<UString::Rep> createRep(const char* c) return &UString::Rep::empty(); size_t length = strlen(c); - UChar* d = allocChars(length); - if (!d) + UChar* d; + if (!allocChars(length).getValue(d)) return &UString::Rep::null(); else { for (size_t i = 0; i < length; i++) @@ -656,8 +656,8 @@ static ALWAYS_INLINE PassRefPtr<UString::Rep> concatenate(PassRefPtr<UString::Re } else { // This is shared in some way that prevents us from modifying base, so we must make a whole new string. size_t newCapacity = expandedSize(length, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) rep = &UString::Rep::null(); else { copyChars(d, rep->data(), thisSize); @@ -712,8 +712,8 @@ static ALWAYS_INLINE PassRefPtr<UString::Rep> concatenate(PassRefPtr<UString::Re } else { // This is shared in some way that prevents us from modifying base, so we must make a whole new string. size_t newCapacity = expandedSize(length, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) rep = &UString::Rep::null(); else { copyChars(d, rep->data(), thisSize); @@ -800,8 +800,8 @@ PassRefPtr<UString::Rep> concatenate(UString::Rep* a, UString::Rep* b) // a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string size_t newCapacity = expandedSize(length, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) return 0; copyChars(d, a->data(), aSize); copyChars(d + aSize, b->data(), bSize); @@ -942,6 +942,39 @@ UString UString::from(int i) return UString(p, static_cast<int>(end - p)); } +UString UString::from(long long i) +{ + UChar buf[1 + sizeof(i) * 3]; + UChar* end = buf + sizeof(buf) / sizeof(UChar); + UChar* p = end; + + if (i == 0) + *--p = '0'; + else if (i == std::numeric_limits<long long>::min()) { + char minBuf[1 + sizeof(i) * 3]; +#if PLATFORM(WIN_OS) + snprintf(minBuf, sizeof(minBuf) - 1, "%I64d", std::numeric_limits<long long>::min()); +#else + snprintf(minBuf, sizeof(minBuf) - 1, "%lld", std::numeric_limits<long long>::min()); +#endif + return UString(minBuf); + } else { + bool negative = false; + if (i < 0) { + negative = true; + i = -i; + } + while (i) { + *--p = static_cast<unsigned short>((i % 10) + '0'); + i /= 10; + } + if (negative) + *--p = '-'; + } + + return UString(p, static_cast<int>(end - p)); +} + UString UString::from(unsigned int u) { UChar buf[sizeof(u) * 3]; @@ -1076,8 +1109,8 @@ UString UString::spliceSubstringsWithSeparators(const Range* substringRanges, in if (totalLength == 0) return ""; - UChar* buffer = allocChars(totalLength); - if (!buffer) + UChar* buffer; + if (!allocChars(totalLength).getValue(buffer)) return null(); int maxCount = max(rangeCount, separatorCount); @@ -1105,8 +1138,8 @@ UString UString::replaceRange(int rangeStart, int rangeLength, const UString& re if (totalLength == 0) return ""; - UChar* buffer = allocChars(totalLength); - if (!buffer) + UChar* buffer; + if (!allocChars(totalLength).getValue(buffer)) return null(); copyChars(buffer, data(), rangeStart); @@ -1153,8 +1186,8 @@ UString& UString::append(const UString &t) } else { // This is shared in some way that prevents us from modifying base, so we must make a whole new string. size_t newCapacity = expandedSize(length, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) makeNull(); else { copyChars(d, data(), thisSize); @@ -1206,8 +1239,8 @@ UString& UString::append(UChar c) if (length == 0) { // this is empty - must make a new m_rep because we don't want to pollute the shared empty one size_t newCapacity = expandedSize(1, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) makeNull(); else { d[0] = c; @@ -1234,8 +1267,8 @@ UString& UString::append(UChar c) } else { // This is shared in some way that prevents us from modifying base, so we must make a whole new string. size_t newCapacity = expandedSize(length + 1, 0); - UChar* d = allocChars(newCapacity); - if (!d) + UChar* d; + if (!allocChars(newCapacity).getValue(d)) makeNull(); else { copyChars(d, data(), length); @@ -1313,8 +1346,7 @@ UString& UString::operator=(const char* c) m_rep->_hash = 0; m_rep->len = l; } else { - d = allocChars(l); - if (!d) { + if (!allocChars(l).getValue(d)) { makeNull(); return *this; } diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h index d01b75d..2dbca1f 100644 --- a/JavaScriptCore/runtime/UString.h +++ b/JavaScriptCore/runtime/UString.h @@ -91,7 +91,8 @@ namespace JSC { { // Guard against integer overflow if (size < (std::numeric_limits<size_t>::max() / sizeof(UChar))) { - if (void * buf = tryFastMalloc(size * sizeof(UChar))) + void* buf = 0; + if (tryFastMalloc(size * sizeof(UChar)).getValue(buf)) return adoptRef(new BaseString(static_cast<UChar*>(buf), 0, size)); } return adoptRef(new BaseString(0, 0, 0)); @@ -256,6 +257,7 @@ namespace JSC { } static UString from(int); + static UString from(long long); static UString from(unsigned int); static UString from(long); static UString from(double); diff --git a/JavaScriptCore/wtf/FastMalloc.cpp b/JavaScriptCore/wtf/FastMalloc.cpp index c14b755..afa48e9 100644 --- a/JavaScriptCore/wtf/FastMalloc.cpp +++ b/JavaScriptCore/wtf/FastMalloc.cpp @@ -178,10 +178,10 @@ void* fastZeroedMalloc(size_t n) return result; } -void* tryFastZeroedMalloc(size_t n) +TryMallocReturnValue tryFastZeroedMalloc(size_t n) { - void* result = tryFastMalloc(n); - if (!result) + void* result; + if (!tryFastMalloc(n).getValue(result)) return 0; memset(result, 0, n); return result; @@ -200,7 +200,7 @@ void* tryFastZeroedMalloc(size_t n) namespace WTF { -void* tryFastMalloc(size_t n) +TryMallocReturnValue tryFastMalloc(size_t n) { ASSERT(!isForbidden()); @@ -226,7 +226,9 @@ void* fastMalloc(size_t n) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastMalloc(n); + TryMallocReturnValue returnValue = tryFastMalloc(n); + void* result; + returnValue.getValue(result); #else void* result = malloc(n); #endif @@ -236,7 +238,7 @@ void* fastMalloc(size_t n) return result; } -void* tryFastCalloc(size_t n_elements, size_t element_size) +TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size) { ASSERT(!isForbidden()); @@ -264,7 +266,9 @@ void* fastCalloc(size_t n_elements, size_t element_size) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastCalloc(n_elements, element_size); + TryMallocReturnValue returnValue = tryFastCalloc(n_elements, element_size); + void* result; + returnValue.getValue(result); #else void* result = calloc(n_elements, element_size); #endif @@ -291,7 +295,7 @@ void fastFree(void* p) #endif } -void* tryFastRealloc(void* p, size_t n) +TryMallocReturnValue tryFastRealloc(void* p, size_t n) { ASSERT(!isForbidden()); @@ -323,7 +327,9 @@ void* fastRealloc(void* p, size_t n) ASSERT(!isForbidden()); #if ENABLE(FAST_MALLOC_MATCH_VALIDATION) - void* result = tryFastRealloc(p, n); + TryMallocReturnValue returnValue = tryFastRealloc(p, n); + void* result; + returnValue.getValue(result); #else void* result = realloc(p, n); #endif @@ -3576,7 +3582,7 @@ void* fastMalloc(size_t size) return malloc<true>(size); } -void* tryFastMalloc(size_t size) +TryMallocReturnValue tryFastMalloc(size_t size) { return malloc<false>(size); } @@ -3637,7 +3643,7 @@ void* fastCalloc(size_t n, size_t elem_size) return calloc<true>(n, elem_size); } -void* tryFastCalloc(size_t n, size_t elem_size) +TryMallocReturnValue tryFastCalloc(size_t n, size_t elem_size) { return calloc<false>(n, elem_size); } @@ -3701,7 +3707,7 @@ void* fastRealloc(void* old_ptr, size_t new_size) return realloc<true>(old_ptr, new_size); } -void* tryFastRealloc(void* old_ptr, size_t new_size) +TryMallocReturnValue tryFastRealloc(void* old_ptr, size_t new_size) { return realloc<false>(old_ptr, new_size); } diff --git a/JavaScriptCore/wtf/FastMalloc.h b/JavaScriptCore/wtf/FastMalloc.h index 787251f..b23e7b0 100644 --- a/JavaScriptCore/wtf/FastMalloc.h +++ b/JavaScriptCore/wtf/FastMalloc.h @@ -22,6 +22,7 @@ #define WTF_FastMalloc_h #include "Platform.h" +#include "PossiblyNull.h" #include <stdlib.h> #include <new> @@ -33,11 +34,42 @@ namespace WTF { void* fastCalloc(size_t numElements, size_t elementSize); void* fastRealloc(void*, size_t); - // These functions return 0 if an allocation fails. - void* tryFastMalloc(size_t); - void* tryFastZeroedMalloc(size_t); - void* tryFastCalloc(size_t numElements, size_t elementSize); - void* tryFastRealloc(void*, size_t); + struct TryMallocReturnValue { + TryMallocReturnValue(void* data) + : m_data(data) + { + } + TryMallocReturnValue(const TryMallocReturnValue& source) + : m_data(source.m_data) + { + source.m_data = 0; + } + ~TryMallocReturnValue() { ASSERT(!m_data); } + template <typename T> bool getValue(T& data) WARN_UNUSED_RETURN; + template <typename T> operator PossiblyNull<T>() + { + T value; + getValue(value); + return PossiblyNull<T>(value); + } + private: + mutable void* m_data; + }; + + template <typename T> bool TryMallocReturnValue::getValue(T& data) + { + union u { void* data; T target; } res; + res.data = m_data; + data = res.target; + bool returnValue = !!m_data; + m_data = 0; + return returnValue; + } + + TryMallocReturnValue tryFastMalloc(size_t n); + TryMallocReturnValue tryFastZeroedMalloc(size_t n); + TryMallocReturnValue tryFastCalloc(size_t n_elements, size_t element_size); + TryMallocReturnValue tryFastRealloc(void* p, size_t n); void fastFree(void*); diff --git a/JavaScriptCore/wtf/Platform.h b/JavaScriptCore/wtf/Platform.h index 845684e..c431629 100644 --- a/JavaScriptCore/wtf/Platform.h +++ b/JavaScriptCore/wtf/Platform.h @@ -108,6 +108,13 @@ #define WTF_PLATFORM_NETBSD 1 #endif +/* PLATFORM(QNX) */ +/* Operating system level dependencies for QNX that should be used */ +/* regardless of operating environment */ +#if defined(__QNXNTO__) +#define WTF_PLATFORM_QNX 1 +#endif + /* PLATFORM(UNIX) */ /* Operating system level dependencies for Unix-like systems that */ /* should be used regardless of operating environment */ @@ -118,7 +125,9 @@ || defined(unix) \ || defined(__unix) \ || defined(__unix__) \ - || defined(_AIX) + || defined(_AIX) \ + || defined(__HAIKU__) \ + || defined(__QNXNTO__) #define WTF_PLATFORM_UNIX 1 #endif @@ -143,6 +152,8 @@ #define WTF_PLATFORM_WX 1 #elif defined(BUILDING_GTK__) #define WTF_PLATFORM_GTK 1 +#elif defined(BUILDING_HAIKU__) +#define WTF_PLATFORM_HAIKU 1 #elif PLATFORM(DARWIN) #define WTF_PLATFORM_MAC 1 #elif PLATFORM(WIN_OS) @@ -189,7 +200,7 @@ /* Makes PLATFORM(WIN) default to PLATFORM(CAIRO) */ /* FIXME: This should be changed from a blacklist to a whitelist */ -#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) +#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(WX) && !PLATFORM(CHROMIUM) && !PLATFORM(WINCE) && !PLATFORM(HAIKU) #define WTF_PLATFORM_CAIRO 1 #endif @@ -455,6 +466,14 @@ #endif #endif +#if PLATFORM(HAIKU) +#define HAVE_POSIX_MEMALIGN 1 +#define WTF_USE_CURL 1 +#define WTF_USE_PTHREADS 1 +#define USE_SYSTEM_MALLOC 1 +#define ENABLE_NETSCAPE_PLUGIN_API 0 +#endif + #if !defined(HAVE_ACCESSIBILITY) #if PLATFORM(IPHONE) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(CHROMIUM) #define HAVE_ACCESSIBILITY 1 @@ -465,7 +484,9 @@ #define HAVE_SIGNAL_H 1 #endif -#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(SYMBIAN) && !COMPILER(RVCT) && !PLATFORM(ANDROID) +#if !PLATFORM(WIN_OS) && !PLATFORM(SOLARIS) && !PLATFORM(QNX) \ + && !PLATFORM(SYMBIAN) && !PLATFORM(HAIKU) && !COMPILER(RVCT) \ + && !PLATFORM(ANDROID) #define HAVE_TM_GMTOFF 1 #define HAVE_TM_ZONE 1 #define HAVE_TIMEGM 1 @@ -525,12 +546,24 @@ #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_TIME_H 1 +#elif PLATFORM(QNX) + +#define HAVE_ERRNO_H 1 +#define HAVE_MMAP 1 +#define HAVE_SBRK 1 +#define HAVE_STRINGS_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_TIME_H 1 + #else /* FIXME: is this actually used or do other platforms generate their own config.h? */ #define HAVE_ERRNO_H 1 +/* As long as Haiku doesn't have a complete support of locale this will be disabled. */ +#if !PLATFORM(HAIKU) #define HAVE_LANGINFO_H 1 +#endif #define HAVE_MMAP 1 #define HAVE_SBRK 1 #define HAVE_STRINGS_H 1 @@ -594,6 +627,10 @@ #define ENABLE_GEOLOCATION 0 #endif +#if !defined(ENABLE_NOTIFICATIONS) +#define ENABLE_NOTIFICATIONS 0 +#endif + #if !defined(ENABLE_TEXT_CARET) #define ENABLE_TEXT_CARET 1 #endif @@ -608,9 +645,9 @@ #endif #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) -#if PLATFORM(X86_64) && (PLATFORM(MAC) || (PLATFORM(LINUX) && !PLATFORM(QT))) +#if PLATFORM(X86_64) && (PLATFORM(MAC) || PLATFORM(LINUX)) #define WTF_USE_JSVALUE64 1 -#elif PLATFORM(PPC64) || PLATFORM(QT) /* All Qt layout tests crash in JSVALUE32_64 mode. */ +#elif PLATFORM(ARM) || PLATFORM(PPC64) #define WTF_USE_JSVALUE32 1 #else #define WTF_USE_JSVALUE32_64 1 @@ -639,18 +676,20 @@ #define ENABLE_JIT 1 #endif -#if PLATFORM(X86) && PLATFORM(QT) -#if PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100 +#if PLATFORM(QT) +#if PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 -#elif PLATFORM(WIN_OS) && COMPILER(MSVC) +#elif PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC) #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1 -#elif PLATFORM(LINUX) && GCC_VERSION >= 40100 +#elif PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100 #define ENABLE_JIT 1 #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1 +#elif PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX) + #define ENABLE_JIT 1 #endif -#endif /* PLATFORM(QT) && PLATFORM(X86) */ +#endif /* PLATFORM(QT) */ #endif /* !defined(ENABLE_JIT) */ @@ -700,10 +739,11 @@ #define ENABLE_YARR_JIT 1 #endif -#if PLATFORM(X86) && PLATFORM(QT) -#if (PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ - || (PLATFORM(WIN_OS) && COMPILER(MSVC)) \ - || (PLATFORM(LINUX) && GCC_VERSION >= 40100) +#if PLATFORM(QT) +#if (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ + || (PLATFORM(X86) && PLATFORM(WIN_OS) && COMPILER(MSVC)) \ + || (PLATFORM(X86) && PLATFORM(LINUX) && GCC_VERSION >= 40100) \ + || (PLATFORM(ARM) && !PLATFORM_ARM_ARCH(7) && PLATFORM(LINUX)) #define ENABLE_YARR 1 #define ENABLE_YARR_JIT 1 #endif @@ -757,4 +797,10 @@ #define WTF_USE_ACCELERATED_COMPOSITING 1 #endif +#if COMPILER(GCC) +#define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result)) +#else +#define WARN_UNUSED_RETURN +#endif + #endif /* WTF_Platform_h */ diff --git a/JavaScriptCore/wtf/PossiblyNull.h b/JavaScriptCore/wtf/PossiblyNull.h new file mode 100644 index 0000000..79c4d82 --- /dev/null +++ b/JavaScriptCore/wtf/PossiblyNull.h @@ -0,0 +1,59 @@ +/* + * 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 PossiblyNull_h +#define PossiblyNull_h + +#include "Assertions.h" + +namespace WTF { + +template <typename T> struct PossiblyNull { + PossiblyNull(T data) + : m_data(data) + { + } + PossiblyNull(const PossiblyNull<T>& source) + : m_data(source.m_data) + { + source.m_data = 0; + } + ~PossiblyNull() { ASSERT(!m_data); } + bool getValue(T& out) WARN_UNUSED_RETURN; +private: + mutable T m_data; +}; + +template <typename T> bool PossiblyNull<T>::getValue(T& out) +{ + out = m_data; + bool result = !!m_data; + m_data = 0; + return result; +} + +} + +#endif diff --git a/JavaScriptCore/wtf/SegmentedVector.h b/JavaScriptCore/wtf/SegmentedVector.h index 065c19c..b1cbc4d 100644 --- a/JavaScriptCore/wtf/SegmentedVector.h +++ b/JavaScriptCore/wtf/SegmentedVector.h @@ -116,6 +116,7 @@ namespace WTF { } size_t size() const { return m_size; } + bool isEmpty() const { return !size(); } T& at(size_t index) { @@ -249,4 +250,6 @@ namespace WTF { } // namespace WTF +using WTF::SegmentedVector; + #endif // SegmentedVector_h diff --git a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp index 4fd7b35..10c4248 100644 --- a/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp +++ b/JavaScriptCore/wtf/haiku/MainThreadHaiku.cpp @@ -30,6 +30,7 @@ #include "config.h" #include "MainThread.h" +#include "NotImplemented.h" namespace WTF { diff --git a/JavaScriptCore/yarr/RegexInterpreter.cpp b/JavaScriptCore/yarr/RegexInterpreter.cpp index b0aae65..aafea3c 100644 --- a/JavaScriptCore/yarr/RegexInterpreter.cpp +++ b/JavaScriptCore/yarr/RegexInterpreter.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" @@ -90,7 +90,7 @@ public: : term(0) { } - + void* operator new(size_t, void* where) { return where; @@ -124,7 +124,7 @@ public: subpatternBackup[i] = output[(firstSubpatternId << 1) + i]; output[(firstSubpatternId << 1) + i] = -1; } - + new(getDisjunctionContext(term)) DisjunctionContext(); } @@ -138,7 +138,7 @@ public: for (unsigned i = 0; i < (numNestedSubpatterns << 1); ++i) output[(firstSubpatternId << 1) + i] = subpatternBackup[i]; } - + DisjunctionContext* getDisjunctionContext(ByteTerm& term) { return reinterpret_cast<DisjunctionContext*>(&(subpatternBackup[term.atom.parenthesesDisjunction->m_numSubpatterns << 1])); @@ -208,7 +208,7 @@ public: return input[pos - 1]; return -1; } - + unsigned getPos() { return pos; @@ -218,7 +218,7 @@ public: { pos = p; } - + bool atStart() { return pos == 0; @@ -284,7 +284,7 @@ public: { if (input.atEnd()) return false; - + int ch = input.read(); if (pattern->m_ignoreCase ? ((Unicode::toLower(testChar) == ch) || (Unicode::toUpper(testChar) == ch)) : (testChar == ch)) { @@ -341,7 +341,7 @@ public: return false; } } - + return true; } @@ -606,10 +606,10 @@ public: if (matchDisjunction(term.atom.parenthesesDisjunction, context->getDisjunctionContext(term), true)) return true; - + resetMatches(term, context); - freeParenthesesDisjunctionContext(context); popParenthesesDisjunctionContext(backTrack); + freeParenthesesDisjunctionContext(context); } return false; @@ -910,8 +910,8 @@ public: } } else { resetMatches(term, context); - freeParenthesesDisjunctionContext(context); popParenthesesDisjunctionContext(backTrack); + freeParenthesesDisjunctionContext(context); } if (backTrack->matchAmount) { @@ -946,11 +946,11 @@ public: } return true; } - + // pop a match off the stack resetMatches(term, context); - freeParenthesesDisjunctionContext(context); popParenthesesDisjunctionContext(backTrack); + freeParenthesesDisjunctionContext(context); } return false; @@ -1266,37 +1266,37 @@ public: ByteCompiler(RegexPattern& pattern) : m_pattern(pattern) { - bodyDisjunction = 0; - currentAlternativeIndex = 0; + m_bodyDisjunction = 0; + m_currentAlternativeIndex = 0; } - + BytecodePattern* compile() { regexBegin(m_pattern.m_numSubpatterns, m_pattern.m_body->m_callFrameSize); emitDisjunction(m_pattern.m_body); regexEnd(); - return new BytecodePattern(bodyDisjunction, m_allParenthesesInfo, m_pattern); + return new BytecodePattern(m_bodyDisjunction, m_allParenthesesInfo, m_pattern); } - + void checkInput(unsigned count) { - bodyDisjunction->terms.append(ByteTerm::CheckInput(count)); + m_bodyDisjunction->terms.append(ByteTerm::CheckInput(count)); } void assertionBOL(int inputPosition) { - bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm::BOL(inputPosition)); } void assertionEOL(int inputPosition) { - bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm::EOL(inputPosition)); } void assertionWordBoundary(bool invert, int inputPosition) { - bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm::WordBoundary(invert, inputPosition)); } void atomPatternCharacter(UChar ch, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType) @@ -1304,60 +1304,60 @@ public: if (m_pattern.m_ignoreCase) { UChar lo = Unicode::toLower(ch); UChar hi = Unicode::toUpper(ch); - + if (lo != hi) { - bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType)); + m_bodyDisjunction->terms.append(ByteTerm(lo, hi, inputPosition, frameLocation, quantityCount, quantityType)); return; } } - bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType)); + m_bodyDisjunction->terms.append(ByteTerm(ch, inputPosition, frameLocation, quantityCount, quantityType)); } - + void atomCharacterClass(CharacterClass* characterClass, bool invert, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType) { - bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm(characterClass, invert, inputPosition)); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount; - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType; - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; } void atomBackReference(unsigned subpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType) { ASSERT(subpatternId); - bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm::BackReference(subpatternId, inputPosition)); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount; - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType; - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityCount = quantityCount; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].atom.quantityType = quantityType; + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; } void atomParenthesesSubpatternBegin(unsigned subpatternId, bool capture, int inputPosition, unsigned frameLocation, unsigned alternativeFrameLocation) { - int beginTerm = bodyDisjunction->terms.size(); + int beginTerm = m_bodyDisjunction->terms.size(); - bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, inputPosition)); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; - bodyDisjunction->terms.append(ByteTerm::AlternativeBegin()); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation; + m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpatternOnceBegin, subpatternId, capture, inputPosition)); + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; + m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin()); + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation; - m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex)); - currentAlternativeIndex = beginTerm + 1; + m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex)); + m_currentAlternativeIndex = beginTerm + 1; } void atomParentheticalAssertionBegin(unsigned subpatternId, bool invert, unsigned frameLocation, unsigned alternativeFrameLocation) { - int beginTerm = bodyDisjunction->terms.size(); + int beginTerm = m_bodyDisjunction->terms.size(); - bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, invert, 0)); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; - bodyDisjunction->terms.append(ByteTerm::AlternativeBegin()); - bodyDisjunction->terms[bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation; + m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParentheticalAssertionBegin, subpatternId, invert, 0)); + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = frameLocation; + m_bodyDisjunction->terms.append(ByteTerm::AlternativeBegin()); + m_bodyDisjunction->terms[m_bodyDisjunction->terms.size() - 1].frameLocation = alternativeFrameLocation; - m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, currentAlternativeIndex)); - currentAlternativeIndex = beginTerm + 1; + m_parenthesesStack.append(ParenthesesStackEntry(beginTerm, m_currentAlternativeIndex)); + m_currentAlternativeIndex = beginTerm + 1; } unsigned popParenthesesStack() @@ -1365,12 +1365,12 @@ public: ASSERT(m_parenthesesStack.size()); int stackEnd = m_parenthesesStack.size() - 1; unsigned beginTerm = m_parenthesesStack[stackEnd].beginTerm; - currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex; + m_currentAlternativeIndex = m_parenthesesStack[stackEnd].savedAlternativeIndex; m_parenthesesStack.shrink(stackEnd); - ASSERT(beginTerm < bodyDisjunction->terms.size()); - ASSERT(currentAlternativeIndex < bodyDisjunction->terms.size()); - + ASSERT(beginTerm < m_bodyDisjunction->terms.size()); + ASSERT(m_currentAlternativeIndex < m_bodyDisjunction->terms.size()); + return beginTerm; } @@ -1387,25 +1387,25 @@ public: void closeAlternative(int beginTerm) { int origBeginTerm = beginTerm; - ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin); - int endIndex = bodyDisjunction->terms.size(); + ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeBegin); + int endIndex = m_bodyDisjunction->terms.size(); - unsigned frameLocation = bodyDisjunction->terms[beginTerm].frameLocation; + unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation; - if (!bodyDisjunction->terms[beginTerm].alternative.next) - bodyDisjunction->terms.remove(beginTerm); + if (!m_bodyDisjunction->terms[beginTerm].alternative.next) + m_bodyDisjunction->terms.remove(beginTerm); else { - while (bodyDisjunction->terms[beginTerm].alternative.next) { - beginTerm += bodyDisjunction->terms[beginTerm].alternative.next; - ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeDisjunction); - bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm; - bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; + while (m_bodyDisjunction->terms[beginTerm].alternative.next) { + beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next; + ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeAlternativeDisjunction); + m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm; + m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; } - - bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm; - bodyDisjunction->terms.append(ByteTerm::AlternativeEnd()); - bodyDisjunction->terms[endIndex].frameLocation = frameLocation; + m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm; + + m_bodyDisjunction->terms.append(ByteTerm::AlternativeEnd()); + m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation; } } @@ -1413,46 +1413,46 @@ public: { int beginTerm = 0; int origBeginTerm = 0; - ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin); - int endIndex = bodyDisjunction->terms.size(); + ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeBegin); + int endIndex = m_bodyDisjunction->terms.size(); - unsigned frameLocation = bodyDisjunction->terms[beginTerm].frameLocation; + unsigned frameLocation = m_bodyDisjunction->terms[beginTerm].frameLocation; - while (bodyDisjunction->terms[beginTerm].alternative.next) { - beginTerm += bodyDisjunction->terms[beginTerm].alternative.next; - ASSERT(bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeDisjunction); - bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm; - bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; + while (m_bodyDisjunction->terms[beginTerm].alternative.next) { + beginTerm += m_bodyDisjunction->terms[beginTerm].alternative.next; + ASSERT(m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeBodyAlternativeDisjunction); + m_bodyDisjunction->terms[beginTerm].alternative.end = endIndex - beginTerm; + m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; } - - bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm; - bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd()); - bodyDisjunction->terms[endIndex].frameLocation = frameLocation; + m_bodyDisjunction->terms[beginTerm].alternative.next = origBeginTerm - beginTerm; + + m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeEnd()); + m_bodyDisjunction->terms[endIndex].frameLocation = frameLocation; } void atomParenthesesEnd(bool doInline, unsigned lastSubpatternId, int inputPosition, unsigned frameLocation, unsigned quantityCount, QuantifierType quantityType, unsigned callFrameSize = 0) { unsigned beginTerm = popParenthesesStack(); closeAlternative(beginTerm + 1); - unsigned endTerm = bodyDisjunction->terms.size(); + unsigned endTerm = m_bodyDisjunction->terms.size(); - bool isAssertion = bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin; - bool invertOrCapture = bodyDisjunction->terms[beginTerm].invertOrCapture; - unsigned subpatternId = bodyDisjunction->terms[beginTerm].atom.subpatternId; + bool isAssertion = m_bodyDisjunction->terms[beginTerm].type == ByteTerm::TypeParentheticalAssertionBegin; + bool invertOrCapture = m_bodyDisjunction->terms[beginTerm].invertOrCapture; + unsigned subpatternId = m_bodyDisjunction->terms[beginTerm].atom.subpatternId; - bodyDisjunction->terms.append(ByteTerm(isAssertion ? ByteTerm::TypeParentheticalAssertionEnd : ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, invertOrCapture, inputPosition)); - bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm; - bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm; - bodyDisjunction->terms[endTerm].frameLocation = frameLocation; + m_bodyDisjunction->terms.append(ByteTerm(isAssertion ? ByteTerm::TypeParentheticalAssertionEnd : ByteTerm::TypeParenthesesSubpatternOnceEnd, subpatternId, invertOrCapture, inputPosition)); + m_bodyDisjunction->terms[beginTerm].atom.parenthesesWidth = endTerm - beginTerm; + m_bodyDisjunction->terms[endTerm].atom.parenthesesWidth = endTerm - beginTerm; + m_bodyDisjunction->terms[endTerm].frameLocation = frameLocation; if (doInline) { - bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount; - bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType; - bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount; - bodyDisjunction->terms[endTerm].atom.quantityType = quantityType; + m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount; + m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType; + m_bodyDisjunction->terms[endTerm].atom.quantityCount = quantityCount; + m_bodyDisjunction->terms[endTerm].atom.quantityType = quantityType; } else { - ByteTerm& parenthesesBegin = bodyDisjunction->terms[beginTerm]; + ByteTerm& parenthesesBegin = m_bodyDisjunction->terms[beginTerm]; ASSERT(parenthesesBegin.type == ByteTerm::TypeParenthesesSubpatternOnceBegin); bool invertOrCapture = parenthesesBegin.invertOrCapture; @@ -1463,26 +1463,26 @@ public: parenthesesDisjunction->terms.append(ByteTerm::SubpatternBegin()); for (unsigned termInParentheses = beginTerm + 1; termInParentheses < endTerm; ++termInParentheses) - parenthesesDisjunction->terms.append(bodyDisjunction->terms[termInParentheses]); + parenthesesDisjunction->terms.append(m_bodyDisjunction->terms[termInParentheses]); parenthesesDisjunction->terms.append(ByteTerm::SubpatternEnd()); - bodyDisjunction->terms.shrink(beginTerm); + m_bodyDisjunction->terms.shrink(beginTerm); m_allParenthesesInfo.append(parenthesesDisjunction); - bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition)); + m_bodyDisjunction->terms.append(ByteTerm(ByteTerm::TypeParenthesesSubpattern, subpatternId, parenthesesDisjunction, invertOrCapture, inputPosition)); - bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount; - bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType; - bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; + m_bodyDisjunction->terms[beginTerm].atom.quantityCount = quantityCount; + m_bodyDisjunction->terms[beginTerm].atom.quantityType = quantityType; + m_bodyDisjunction->terms[beginTerm].frameLocation = frameLocation; } } void regexBegin(unsigned numSubpatterns, unsigned callFrameSize) { - bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize); - bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin()); - bodyDisjunction->terms[0].frameLocation = 0; - currentAlternativeIndex = 0; + m_bodyDisjunction = new ByteDisjunction(numSubpatterns, callFrameSize); + m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeBegin()); + m_bodyDisjunction->terms[0].frameLocation = 0; + m_currentAlternativeIndex = 0; } void regexEnd() @@ -1492,27 +1492,27 @@ public: void alterantiveBodyDisjunction() { - int newAlternativeIndex = bodyDisjunction->terms.size(); - bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex; - bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction()); + int newAlternativeIndex = m_bodyDisjunction->terms.size(); + m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; + m_bodyDisjunction->terms.append(ByteTerm::BodyAlternativeDisjunction()); - currentAlternativeIndex = newAlternativeIndex; + m_currentAlternativeIndex = newAlternativeIndex; } void alterantiveDisjunction() { - int newAlternativeIndex = bodyDisjunction->terms.size(); - bodyDisjunction->terms[currentAlternativeIndex].alternative.next = newAlternativeIndex - currentAlternativeIndex; - bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction()); + int newAlternativeIndex = m_bodyDisjunction->terms.size(); + m_bodyDisjunction->terms[m_currentAlternativeIndex].alternative.next = newAlternativeIndex - m_currentAlternativeIndex; + m_bodyDisjunction->terms.append(ByteTerm::AlternativeDisjunction()); - currentAlternativeIndex = newAlternativeIndex; + m_currentAlternativeIndex = newAlternativeIndex; } void emitDisjunction(PatternDisjunction* disjunction, unsigned inputCountAlreadyChecked = 0, unsigned parenthesesInputCountAlreadyChecked = 0) { for (unsigned alt = 0; alt < disjunction->m_alternatives.size(); ++alt) { unsigned currentCountAlreadyChecked = inputCountAlreadyChecked; - + if (alt) { if (disjunction == m_pattern.m_body) alterantiveBodyDisjunction(); @@ -1586,7 +1586,7 @@ public: case PatternTerm::TypeParentheticalAssertion: { unsigned alternativeFrameLocation = term.inputPosition + RegexStackSpaceForBackTrackInfoParentheticalAssertion; - + atomParentheticalAssertionBegin(term.parentheses.subpatternId, term.invertOrCapture, term.frameLocation, alternativeFrameLocation); emitDisjunction(term.parentheses.disjunction, currentCountAlreadyChecked, 0); atomParenthesesEnd(true, term.parentheses.lastSubpatternId, 0, term.frameLocation, term.quantityCount, term.quantityType); @@ -1599,8 +1599,8 @@ public: private: RegexPattern& m_pattern; - ByteDisjunction* bodyDisjunction; - unsigned currentAlternativeIndex; + ByteDisjunction* m_bodyDisjunction; + unsigned m_currentAlternativeIndex; Vector<ParenthesesStackEntry> m_parenthesesStack; Vector<ByteDisjunction*> m_allParenthesesInfo; }; diff --git a/WEBKIT_MERGE_REVISION b/WEBKIT_MERGE_REVISION index edaf0cb..a58a065 100644 --- a/WEBKIT_MERGE_REVISION +++ b/WEBKIT_MERGE_REVISION @@ -1,5 +1,5 @@ We sync with Chromium release revision, which has both webkit revision and V8 revision. http://src.chromium.org/svn/branches/187/src@18043 - http://svn.webkit.org/repository/webkit/trunk@44544 + http://svn.webkit.org/repository/webkit/trunk@47420 http://v8.googlecode.com/svn/branches/bleeding_edge@2703 diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk index e2d3e13..e69de29 100644 --- a/WebCore/Android.derived.mk +++ b/WebCore/Android.derived.mk @@ -1,741 +0,0 @@ -## -## -## Copyright 2007, The Android Open Source Project -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -## - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following files are intentionally not included -# LOCAL_SRC_FILES_EXCLUDED := \ -# css/RGBColor.idl \ -# dom/EventListener.idl \ -# dom/EventTarget.idl \ -# html/CanvasPixelArray.idl \ -# page/AbstractView.idl \ -# svg/ElementTimeControl.idl \ -# svg/SVGAnimatedPathData.idl \ -# svg/SVGAnimatedPoints.idl \ -# svg/SVGExternalResourcesRequired.idl \ -# svg/SVGFilterPrimitiveStandardAttributes.idl \ -# svg/SVGFitToViewBox.idl \ -# svg/SVGLangSpace.idl \ -# svg/SVGLocatable.idl \ -# svg/SVGStylable.idl \ -# svg/SVGTests.idl \ -# svg/SVGTransformable.idl \ -# svg/SVGURIReference.idl \ -# svg/SVGViewSpec.idl \ -# svg/SVGZoomAndPan.idl \ - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following files are intentionally not generated -# LOCAL_GENERATED_FILES_EXCLUDED := \ -# WMLElementFactory.cpp \ -# WMLNames.cpp \ -# XLinkNames.cpp \ - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# -# The following directory wildcard matches are intentionally not included -# If an entry starts with '/', any subdirectory may match -# If an entry starts with '^', the first directory must match -# LOCAL_DIR_WILDCARD_EXCLUDED := -# - -# This comment block is read by tools/webkitsync/diff.cpp -# Don't remove it or move it. -# If you edit it, keep it in alphabetical order -# -# These files are Android extensions -# LOCAL_ANDROID_SRC_FILES_INCLUDED := \ -# dom/Touch*.idl \ - -LOCAL_SRC_FILES := -# CSS property names and value keywords - -GEN := $(intermediates)/css/CSSPropertyNames.h -$(GEN): SCRIPT := $(LOCAL_PATH)/css/makeprop.pl -$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSPropertyNames.in - @echo "Generating CSSPropertyNames.h <= CSSPropertyNames.in" - @mkdir -p $(dir $@) - @cat $< > $(dir $@)/$(notdir $<) -ifeq ($(ENABLE_SVG),true) - @cat $^ > $(@:%.h=%.in) -endif - @cp -f $(SCRIPT) $(dir $@) - @cd $(dir $@) ; perl ./$(notdir $(SCRIPT)) -LOCAL_GENERATED_SOURCES += $(GEN) - -GEN := $(intermediates)/css/CSSValueKeywords.h -$(GEN): SCRIPT := $(LOCAL_PATH)/css/makevalues.pl -$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.in $(LOCAL_PATH)/css/SVGCSSValueKeywords.in - @echo "Generating CSSValueKeywords.h <= CSSValueKeywords.in" - @mkdir -p $(dir $@) - @cp -f $(SCRIPT) $(dir $@) -ifeq ($(ENABLE_SVG),true) - @perl -ne 'print lc' $^ > $(@:%.h=%.in) -else - @perl -ne 'print lc' $< > $(@:%.h=%.in) -endif - @cd $(dir $@); perl makevalues.pl -LOCAL_GENERATED_SOURCES += $(GEN) - - -# DOCTYPE strings - -GEN := $(intermediates)/html/DocTypeStrings.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $< > $@ -$(GEN): $(LOCAL_PATH)/html/DocTypeStrings.gperf - $(transform-generated-source) -# we have to do this dep by hand: -$(intermediates)/html/HTMLDocument.o : $(GEN) - - -# HTML entity names - -GEN := $(intermediates)/html/HTMLEntityNames.c -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 $< > $@ -$(GEN): $(LOCAL_PATH)/html/HTMLEntityNames.gperf - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -# color names - -GEN := $(intermediates)/platform/ColorData.c -$(GEN): PRIVATE_CUSTOM_TOOL = gperf -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ -$(GEN): $(LOCAL_PATH)/platform/ColorData.gperf - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -# CSS tokenizer - -GEN := $(intermediates)/css/tokenizer.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = $(OLD_FLEX) -t $< | perl $(dir $<)/maketokenizer > $@ -$(GEN): $(LOCAL_PATH)/css/tokenizer.flex $(LOCAL_PATH)/css/maketokenizer - $(transform-generated-source) -# we have to do this dep by hand: -$(intermediates)/css/CSSParser.o : $(GEN) - -# CSS grammar - -GEN := $(intermediates)/CSSGrammar.cpp -$(GEN) : PRIVATE_YACCFLAGS := -p cssyy -$(GEN): $(LOCAL_PATH)/css/CSSGrammar.y - $(call local-transform-y-to-cpp,.cpp) -$(GEN): $(LOCAL_BISON) - -LOCAL_GENERATED_SOURCES += $(GEN) - -# XPath grammar - -GEN := $(intermediates)/XPathGrammar.cpp -$(GEN) : PRIVATE_YACCFLAGS := -p xpathyy -$(GEN): $(LOCAL_PATH)/xml/XPathGrammar.y - $(call local-transform-y-to-cpp,.cpp) -$(GEN): $(LOCAL_BISON) - -LOCAL_GENERATED_SOURCES += $(GEN) - -# user agent style sheets - -style_sheets := $(LOCAL_PATH)/css/html4.css $(LOCAL_PATH)/css/quirks.css $(LOCAL_PATH)/css/view-source.css $(LOCAL_PATH)/css/mediaControls.css -ifeq ($(ENABLE_SVG), true) -style_sheets := $(style_sheets) $(LOCAL_PATH)/css/svg.css -endif -GEN := $(intermediates)/css/UserAgentStyleSheets.h -make_css_file_arrays := $(LOCAL_PATH)/css/make-css-file-arrays.pl -$(GEN): PRIVATE_CUSTOM_TOOL = $< $@ $(basename $@).cpp $(filter %.css,$^) -$(GEN): $(make_css_file_arrays) $(style_sheets) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# character set name table - -#gen_inputs := \ - $(LOCAL_PATH)/platform/make-charset-table.pl \ - $(LOCAL_PATH)/platform/character-sets.txt \ - $(LOCAL_PATH)/platform/android/android-encodings.txt -#GEN := $(intermediates)/platform/CharsetData.cpp -#$(GEN): PRIVATE_CUSTOM_TOOL = $^ "android::Encoding::ENCODING_" > $@ -#$(GEN): $(gen_inputs) -# $(transform-generated-source) -#LOCAL_GENERATED_SOURCES += $(GEN) - -# the above rule will make this build too -$(intermediates)/css/UserAgentStyleSheets.cpp : $(GEN) - - -# lookup tables for old-style JavaScript bindings -create_hash_table := $(LOCAL_PATH)/../JavaScriptCore/create_hash_table - -GEN := $(addprefix $(intermediates)/, \ - bindings/js/JSDOMWindowBase.lut.h \ - bindings/js/JSRGBColor.lut.h \ - ) -$(GEN): PRIVATE_CUSTOM_TOOL = perl $(create_hash_table) $< > $@ -$(GEN): $(intermediates)/bindings/js/%.lut.h: $(LOCAL_PATH)/bindings/js/%.cpp $(create_hash_table) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - - -GEN := $(intermediates)/bindings/js/JSHTMLInputElementBaseTable.cpp -$(GEN): PRIVATE_CUSTOM_TOOL = perl $(create_hash_table) $< > $@ -$(GEN): $(intermediates)/bindings/js/%Table.cpp: $(LOCAL_PATH)/bindings/js/%.cpp $(create_hash_table) - $(transform-generated-source) -$(intermediates)/bindings/js/JSHTMLInputElementBase.o : $(GEN) - -# lookup tables for old-style JavaScript bindings -js_binding_scripts := $(addprefix $(LOCAL_PATH)/,\ - bindings/scripts/CodeGenerator.pm \ - bindings/scripts/IDLParser.pm \ - bindings/scripts/IDLStructure.pm \ - bindings/scripts/generate-bindings.pl \ - ) - -FEATURE_DEFINES := ANDROID_ORIENTATION_SUPPORT ENABLE_TOUCH_EVENTS=1 ENABLE_DATABASE=1 ENABLE_OFFLINE_WEB_APPLICATIONS=1 ENABLE_DOM_STORAGE=1 ENABLE_VIDEO=1 ENABLE_WORKERS=1 ENABLE_GEOLOCATION=1 - -GEN := \ - $(intermediates)/css/JSCSSCharsetRule.h \ - $(intermediates)/css/JSCSSFontFaceRule.h \ - $(intermediates)/css/JSCSSImportRule.h \ - $(intermediates)/css/JSCSSMediaRule.h \ - $(intermediates)/css/JSCSSPageRule.h \ - $(intermediates)/css/JSCSSPrimitiveValue.h \ - $(intermediates)/css/JSCSSRule.h \ - $(intermediates)/css/JSCSSRuleList.h \ - $(intermediates)/css/JSCSSStyleDeclaration.h \ - $(intermediates)/css/JSCSSStyleRule.h \ - $(intermediates)/css/JSCSSStyleSheet.h \ - $(intermediates)/css/JSCSSUnknownRule.h \ - $(intermediates)/css/JSCSSValue.h \ - $(intermediates)/css/JSCSSValueList.h \ - $(intermediates)/css/JSCSSVariablesDeclaration.h \ - $(intermediates)/css/JSCSSVariablesRule.h \ - $(intermediates)/css/JSCounter.h \ - $(intermediates)/css/JSMediaList.h \ - $(intermediates)/css/JSRect.h \ - $(intermediates)/css/JSStyleSheet.h \ - $(intermediates)/css/JSStyleSheetList.h \ - $(intermediates)/css/JSWebKitCSSKeyframeRule.h \ - $(intermediates)/css/JSWebKitCSSKeyframesRule.h \ - $(intermediates)/css/JSWebKitCSSMatrix.h \ - $(intermediates)/css/JSWebKitCSSTransformValue.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/css/JS%.h : $(LOCAL_PATH)/css/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/css/%.cpp : $(intermediates)/css/%.h - -# MANUAL MERGE : I took this out because compiling the result shows: -# out/.../JSEventTarget.cpp: In function 'JSC::JSValue* WebCore::jsEventTargetPrototypeFunctionAddEventListener(JSC::ExecState*, JSC::JSObject*, JSC::JSValue*, const JSC::ArgList&)': -# out/.../JSEventTarget.cpp:90: error: 'toEventListener' was not declared in this scope -# but I can't find toEventListener anywhere, nor can I figure out how toEventListener -# is generated -# $(intermediates)/dom/JSEventTarget.h \ - -GEN := \ - $(intermediates)/dom/JSAttr.h \ - $(intermediates)/dom/JSCDATASection.h \ - $(intermediates)/dom/JSCharacterData.h \ - $(intermediates)/dom/JSClientRect.h \ - $(intermediates)/dom/JSClientRectList.h \ - $(intermediates)/dom/JSClipboard.h \ - $(intermediates)/dom/JSComment.h \ - $(intermediates)/dom/JSDOMCoreException.h \ - $(intermediates)/dom/JSDOMImplementation.h \ - $(intermediates)/dom/JSDOMStringList.h \ - $(intermediates)/dom/JSDocument.h \ - $(intermediates)/dom/JSDocumentFragment.h \ - $(intermediates)/dom/JSDocumentType.h \ - $(intermediates)/dom/JSElement.h \ - $(intermediates)/dom/JSEntity.h \ - $(intermediates)/dom/JSEntityReference.h \ - $(intermediates)/dom/JSEvent.h \ - $(intermediates)/dom/JSEventException.h \ - $(intermediates)/dom/JSKeyboardEvent.h \ - $(intermediates)/dom/JSMessageChannel.h \ - $(intermediates)/dom/JSMessageEvent.h \ - $(intermediates)/dom/JSMessagePort.h \ - $(intermediates)/dom/JSMouseEvent.h \ - $(intermediates)/dom/JSMutationEvent.h \ - $(intermediates)/dom/JSNamedNodeMap.h \ - $(intermediates)/dom/JSNode.h \ - $(intermediates)/dom/JSNodeFilter.h \ - $(intermediates)/dom/JSNodeIterator.h \ - $(intermediates)/dom/JSNodeList.h \ - $(intermediates)/dom/JSNotation.h \ - $(intermediates)/dom/JSOverflowEvent.h \ - $(intermediates)/dom/JSProcessingInstruction.h \ - $(intermediates)/dom/JSProgressEvent.h \ - $(intermediates)/dom/JSRange.h \ - $(intermediates)/dom/JSRangeException.h \ - $(intermediates)/dom/JSText.h \ - $(intermediates)/dom/JSTextEvent.h \ - $(intermediates)/dom/JSTouch.h \ - $(intermediates)/dom/JSTouchEvent.h \ - $(intermediates)/dom/JSTouchList.h \ - $(intermediates)/dom/JSTreeWalker.h \ - $(intermediates)/dom/JSUIEvent.h \ - $(intermediates)/dom/JSWebKitAnimationEvent.h \ - $(intermediates)/dom/JSWebKitTransitionEvent.h \ - $(intermediates)/dom/JSWheelEvent.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/dom/JS%.h : $(LOCAL_PATH)/dom/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/dom/%.cpp : $(intermediates)/dom/%.h - - -GEN := \ - $(intermediates)/html/JSCanvasGradient.h \ - $(intermediates)/html/JSCanvasPattern.h \ - $(intermediates)/html/JSCanvasRenderingContext2D.h \ - $(intermediates)/html/JSFile.h \ - $(intermediates)/html/JSFileList.h \ - $(intermediates)/html/JSHTMLAnchorElement.h \ - $(intermediates)/html/JSHTMLAppletElement.h \ - $(intermediates)/html/JSHTMLAreaElement.h \ - $(intermediates)/html/JSHTMLAudioElement.h \ - $(intermediates)/html/JSHTMLBRElement.h \ - $(intermediates)/html/JSHTMLBaseElement.h \ - $(intermediates)/html/JSHTMLBaseFontElement.h \ - $(intermediates)/html/JSHTMLBlockquoteElement.h \ - $(intermediates)/html/JSHTMLBodyElement.h \ - $(intermediates)/html/JSHTMLButtonElement.h \ - $(intermediates)/html/JSHTMLCanvasElement.h \ - $(intermediates)/html/JSHTMLCollection.h \ - $(intermediates)/html/JSHTMLDListElement.h \ - $(intermediates)/html/JSHTMLDirectoryElement.h \ - $(intermediates)/html/JSHTMLDivElement.h \ - $(intermediates)/html/JSHTMLDocument.h \ - $(intermediates)/html/JSHTMLElement.h \ - $(intermediates)/html/JSHTMLEmbedElement.h \ - $(intermediates)/html/JSHTMLFieldSetElement.h \ - $(intermediates)/html/JSHTMLFontElement.h \ - $(intermediates)/html/JSHTMLFormElement.h \ - $(intermediates)/html/JSHTMLFrameElement.h \ - $(intermediates)/html/JSHTMLFrameSetElement.h \ - $(intermediates)/html/JSHTMLHRElement.h \ - $(intermediates)/html/JSHTMLHeadElement.h \ - $(intermediates)/html/JSHTMLHeadingElement.h \ - $(intermediates)/html/JSHTMLHtmlElement.h \ - $(intermediates)/html/JSHTMLIFrameElement.h \ - $(intermediates)/html/JSHTMLImageElement.h \ - $(intermediates)/html/JSHTMLInputElement.h \ - $(intermediates)/html/JSHTMLIsIndexElement.h \ - $(intermediates)/html/JSHTMLLIElement.h \ - $(intermediates)/html/JSHTMLLabelElement.h \ - $(intermediates)/html/JSHTMLLegendElement.h \ - $(intermediates)/html/JSHTMLLinkElement.h \ - $(intermediates)/html/JSHTMLMapElement.h \ - $(intermediates)/html/JSHTMLMarqueeElement.h \ - $(intermediates)/html/JSHTMLMediaElement.h \ - $(intermediates)/html/JSHTMLMenuElement.h \ - $(intermediates)/html/JSHTMLMetaElement.h \ - $(intermediates)/html/JSHTMLModElement.h \ - $(intermediates)/html/JSHTMLOListElement.h \ - $(intermediates)/html/JSHTMLObjectElement.h \ - $(intermediates)/html/JSHTMLOptGroupElement.h \ - $(intermediates)/html/JSHTMLOptionElement.h \ - $(intermediates)/html/JSHTMLOptionsCollection.h \ - $(intermediates)/html/JSHTMLParagraphElement.h \ - $(intermediates)/html/JSHTMLParamElement.h \ - $(intermediates)/html/JSHTMLPreElement.h \ - $(intermediates)/html/JSHTMLQuoteElement.h \ - $(intermediates)/html/JSHTMLScriptElement.h \ - $(intermediates)/html/JSHTMLSelectElement.h \ - $(intermediates)/html/JSHTMLSourceElement.h \ - $(intermediates)/html/JSHTMLStyleElement.h \ - $(intermediates)/html/JSHTMLTableCaptionElement.h \ - $(intermediates)/html/JSHTMLTableCellElement.h \ - $(intermediates)/html/JSHTMLTableColElement.h \ - $(intermediates)/html/JSHTMLTableElement.h \ - $(intermediates)/html/JSHTMLTableRowElement.h \ - $(intermediates)/html/JSHTMLTableSectionElement.h \ - $(intermediates)/html/JSHTMLTextAreaElement.h \ - $(intermediates)/html/JSHTMLTitleElement.h \ - $(intermediates)/html/JSHTMLUListElement.h \ - $(intermediates)/html/JSHTMLVideoElement.h \ - $(intermediates)/html/JSImageData.h \ - $(intermediates)/html/JSMediaError.h \ - $(intermediates)/html/JSTextMetrics.h \ - $(intermediates)/html/JSTimeRanges.h \ - $(intermediates)/html/JSVoidCallback.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/html/JS%.h : $(LOCAL_PATH)/html/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/html/%.cpp : $(intermediates)/html/%.h - -GEN := \ - $(intermediates)/inspector/JSJavaScriptCallFrame.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/inspector/JS%.h : $(LOCAL_PATH)/inspector/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/inspector/%.cpp : $(intermediates)/inspector/%.h - -GEN := \ - $(intermediates)/loader/appcache/JSDOMApplicationCache.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/loader/appcache/JS%.h : $(LOCAL_PATH)/loader/appcache/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/loader/appcache/%.cpp : $(intermediates)/loader/appcache/%.h - -# MANUAL MERGE : I took this out because compiling the result shows: -# out/.../JSAbstractView.cpp:27:26: error: AbstractView.h: No such file or directory -# I can't find AbstractView.h anywhere -# $(intermediates)/page/JSAbstractView.h \ - -GEN := \ - $(intermediates)/page/JSBarInfo.h \ - $(intermediates)/page/JSConsole.h \ - $(intermediates)/page/JSCoordinates.h \ - $(intermediates)/page/JSDOMSelection.h \ - $(intermediates)/page/JSDOMWindow.h \ - $(intermediates)/page/JSGeolocation.h \ - $(intermediates)/page/JSGeoposition.h \ - $(intermediates)/page/JSHistory.h \ - $(intermediates)/page/JSLocation.h \ - $(intermediates)/page/JSNavigator.h \ - $(intermediates)/page/JSPositionError.h \ - $(intermediates)/page/JSScreen.h \ - $(intermediates)/page/JSWebKitPoint.h \ - $(intermediates)/page/JSWorkerNavigator.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/page/JS%.h : $(LOCAL_PATH)/page/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/page/%.cpp : $(intermediates)/page/%.h - -GEN := \ - $(intermediates)/plugins/JSMimeType.h \ - $(intermediates)/plugins/JSMimeTypeArray.h \ - $(intermediates)/plugins/JSPlugin.h \ - $(intermediates)/plugins/JSPluginArray.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/plugins/JS%.h : $(LOCAL_PATH)/plugins/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/plugins/%.cpp : $(intermediates)/plugins/%.h - -# New section for Database storage API -GEN := \ - $(intermediates)/storage/JSDatabase.h \ - $(intermediates)/storage/JSSQLError.h \ - $(intermediates)/storage/JSSQLResultSet.h \ - $(intermediates)/storage/JSSQLResultSetRowList.h \ - $(intermediates)/storage/JSSQLTransaction.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/storage/JS%.h : $(LOCAL_PATH)/storage/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h - -# new section for DOM Storage APIs -GEN := \ - $(intermediates)/storage/JSStorage.h \ - $(intermediates)/storage/JSStorageEvent.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/storage/JS%.h : $(LOCAL_PATH)/storage/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/storage/%.cpp : $(intermediates)/storage/%.h - -#new section for svg -ifeq ($(ENABLE_SVG), true) -GEN := \ - $(intermediates)/svg/JSSVGAElement.h \ - $(intermediates)/svg/JSSVGAltGlyphElement.h \ - $(intermediates)/svg/JSSVGAngle.h \ - $(intermediates)/svg/JSSVGAnimateColorElement.h \ - $(intermediates)/svg/JSSVGAnimateElement.h \ - $(intermediates)/svg/JSSVGAnimateTransformElement.h \ - $(intermediates)/svg/JSSVGAnimatedAngle.h \ - $(intermediates)/svg/JSSVGAnimatedBoolean.h \ - $(intermediates)/svg/JSSVGAnimatedEnumeration.h \ - $(intermediates)/svg/JSSVGAnimatedInteger.h \ - $(intermediates)/svg/JSSVGAnimatedLength.h \ - $(intermediates)/svg/JSSVGAnimatedLengthList.h \ - $(intermediates)/svg/JSSVGAnimatedNumber.h \ - $(intermediates)/svg/JSSVGAnimatedNumberList.h \ - $(intermediates)/svg/JSSVGAnimatedPreserveAspectRatio.h \ - $(intermediates)/svg/JSSVGAnimatedRect.h \ - $(intermediates)/svg/JSSVGAnimatedString.h \ - $(intermediates)/svg/JSSVGAnimatedTransformList.h \ - $(intermediates)/svg/JSSVGAnimationElement.h \ - $(intermediates)/svg/JSSVGCircleElement.h \ - $(intermediates)/svg/JSSVGClipPathElement.h \ - $(intermediates)/svg/JSSVGColor.h \ - $(intermediates)/svg/JSSVGComponentTransferFunctionElement.h \ - $(intermediates)/svg/JSSVGCursorElement.h \ - $(intermediates)/svg/JSSVGDefinitionSrcElement.h \ - $(intermediates)/svg/JSSVGDefsElement.h \ - $(intermediates)/svg/JSSVGDescElement.h \ - $(intermediates)/svg/JSSVGDocument.h \ - $(intermediates)/svg/JSSVGElement.h \ - $(intermediates)/svg/JSSVGElementInstance.h \ - $(intermediates)/svg/JSSVGElementInstanceList.h \ - $(intermediates)/svg/JSSVGEllipseElement.h \ - $(intermediates)/svg/JSSVGException.h \ - $(intermediates)/svg/JSSVGFEBlendElement.h \ - $(intermediates)/svg/JSSVGFEColorMatrixElement.h \ - $(intermediates)/svg/JSSVGFEComponentTransferElement.h \ - $(intermediates)/svg/JSSVGFECompositeElement.h \ - $(intermediates)/svg/JSSVGFEDiffuseLightingElement.h \ - $(intermediates)/svg/JSSVGFEDisplacementMapElement.h \ - $(intermediates)/svg/JSSVGFEDistantLightElement.h \ - $(intermediates)/svg/JSSVGFEFloodElement.h \ - $(intermediates)/svg/JSSVGFEFuncAElement.h \ - $(intermediates)/svg/JSSVGFEFuncBElement.h \ - $(intermediates)/svg/JSSVGFEFuncGElement.h \ - $(intermediates)/svg/JSSVGFEFuncRElement.h \ - $(intermediates)/svg/JSSVGFEGaussianBlurElement.h \ - $(intermediates)/svg/JSSVGFEImageElement.h \ - $(intermediates)/svg/JSSVGFEMergeElement.h \ - $(intermediates)/svg/JSSVGFEMergeNodeElement.h \ - $(intermediates)/svg/JSSVGFEOffsetElement.h \ - $(intermediates)/svg/JSSVGFEPointLightElement.h \ - $(intermediates)/svg/JSSVGFESpecularLightingElement.h \ - $(intermediates)/svg/JSSVGFESpotLightElement.h \ - $(intermediates)/svg/JSSVGFETileElement.h \ - $(intermediates)/svg/JSSVGFETurbulenceElement.h \ - $(intermediates)/svg/JSSVGFilterElement.h \ - $(intermediates)/svg/JSSVGFontElement.h \ - $(intermediates)/svg/JSSVGFontFaceElement.h \ - $(intermediates)/svg/JSSVGFontFaceFormatElement.h \ - $(intermediates)/svg/JSSVGFontFaceNameElement.h \ - $(intermediates)/svg/JSSVGFontFaceSrcElement.h \ - $(intermediates)/svg/JSSVGFontFaceUriElement.h \ - $(intermediates)/svg/JSSVGForeignObjectElement.h \ - $(intermediates)/svg/JSSVGGElement.h \ - $(intermediates)/svg/JSSVGGlyphElement.h \ - $(intermediates)/svg/JSSVGGradientElement.h \ - $(intermediates)/svg/JSSVGHKernElement.h \ - $(intermediates)/svg/JSSVGImageElement.h \ - $(intermediates)/svg/JSSVGLength.h \ - $(intermediates)/svg/JSSVGLengthList.h \ - $(intermediates)/svg/JSSVGLineElement.h \ - $(intermediates)/svg/JSSVGLinearGradientElement.h \ - $(intermediates)/svg/JSSVGMarkerElement.h \ - $(intermediates)/svg/JSSVGMaskElement.h \ - $(intermediates)/svg/JSSVGMatrix.h \ - $(intermediates)/svg/JSSVGMetadataElement.h \ - $(intermediates)/svg/JSSVGMissingGlyphElement.h \ - $(intermediates)/svg/JSSVGNumber.h \ - $(intermediates)/svg/JSSVGNumberList.h \ - $(intermediates)/svg/JSSVGPaint.h \ - $(intermediates)/svg/JSSVGPathElement.h \ - $(intermediates)/svg/JSSVGPathSeg.h \ - $(intermediates)/svg/JSSVGPathSegArcAbs.h \ - $(intermediates)/svg/JSSVGPathSegArcRel.h \ - $(intermediates)/svg/JSSVGPathSegClosePath.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicSmoothAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoCubicSmoothRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticRel.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticSmoothAbs.h \ - $(intermediates)/svg/JSSVGPathSegCurvetoQuadraticSmoothRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoHorizontalAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoHorizontalRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoRel.h \ - $(intermediates)/svg/JSSVGPathSegLinetoVerticalAbs.h \ - $(intermediates)/svg/JSSVGPathSegLinetoVerticalRel.h \ - $(intermediates)/svg/JSSVGPathSegList.h \ - $(intermediates)/svg/JSSVGPathSegMovetoAbs.h \ - $(intermediates)/svg/JSSVGPathSegMovetoRel.h \ - $(intermediates)/svg/JSSVGPatternElement.h \ - $(intermediates)/svg/JSSVGPoint.h \ - $(intermediates)/svg/JSSVGPointList.h \ - $(intermediates)/svg/JSSVGPolygonElement.h \ - $(intermediates)/svg/JSSVGPolylineElement.h \ - $(intermediates)/svg/JSSVGPreserveAspectRatio.h \ - $(intermediates)/svg/JSSVGRadialGradientElement.h \ - $(intermediates)/svg/JSSVGRect.h \ - $(intermediates)/svg/JSSVGRectElement.h \ - $(intermediates)/svg/JSSVGRenderingIntent.h \ - $(intermediates)/svg/JSSVGSVGElement.h \ - $(intermediates)/svg/JSSVGScriptElement.h \ - $(intermediates)/svg/JSSVGSetElement.h \ - $(intermediates)/svg/JSSVGStopElement.h \ - $(intermediates)/svg/JSSVGStringList.h \ - $(intermediates)/svg/JSSVGStyleElement.h \ - $(intermediates)/svg/JSSVGSwitchElement.h \ - $(intermediates)/svg/JSSVGSymbolElement.h \ - $(intermediates)/svg/JSSVGTRefElement.h \ - $(intermediates)/svg/JSSVGTSpanElement.h \ - $(intermediates)/svg/JSSVGTextContentElement.h \ - $(intermediates)/svg/JSSVGTextElement.h \ - $(intermediates)/svg/JSSVGTextPathElement.h \ - $(intermediates)/svg/JSSVGTextPositioningElement.h \ - $(intermediates)/svg/JSSVGTitleElement.h \ - $(intermediates)/svg/JSSVGTransform.h \ - $(intermediates)/svg/JSSVGTransformList.h \ - $(intermediates)/svg/JSSVGUnitTypes.h \ - $(intermediates)/svg/JSSVGUseElement.h \ - $(intermediates)/svg/JSSVGViewElement.h \ - $(intermediates)/svg/JSSVGZoomEvent.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include external/webkit/WebCore/dom --include external/webkit/WebCore/html --include external/webkit/WebCore/svg --outputdir $(dir $@) $< -$(GEN): $(intermediates)/svg/JS%.h : $(LOCAL_PATH)/svg/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/svg/%.cpp : $(intermediates)/svg/%.h -endif - -# new section for Workers -GEN := \ - $(intermediates)/workers/JSWorker.h \ - $(intermediates)/workers/JSWorkerContext.h \ - $(intermediates)/workers/JSWorkerLocation.h - -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/workers/JS%.h : $(LOCAL_PATH)/workers/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/workers/%.cpp : $(intermediates)/workers/%.h - -#new section for xml/DOMParser.idl -GEN := \ - $(intermediates)/xml/JSDOMParser.h \ - $(intermediates)/xml/JSXMLHttpRequest.h \ - $(intermediates)/xml/JSXMLHttpRequestException.h \ - $(intermediates)/xml/JSXMLHttpRequestProgressEvent.h \ - $(intermediates)/xml/JSXMLHttpRequestUpload.h \ - $(intermediates)/xml/JSXMLSerializer.h \ - $(intermediates)/xml/JSXPathEvaluator.h \ - $(intermediates)/xml/JSXPathException.h \ - $(intermediates)/xml/JSXPathExpression.h \ - $(intermediates)/xml/JSXPathNSResolver.h \ - $(intermediates)/xml/JSXPathResult.h \ - $(intermediates)/xml/JSXSLTProcessor.h -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I$(PRIVATE_PATH)/bindings/scripts $(PRIVATE_PATH)/bindings/scripts/generate-bindings.pl --defines "$(FEATURE_DEFINES) LANGUAGE_JAVASCRIPT" --generator JS --include dom --include html --outputdir $(dir $@) $< -$(GEN): $(intermediates)/xml/JS%.h : $(LOCAL_PATH)/xml/%.idl $(js_binding_scripts) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) $(GEN:%.h=%.cpp) - -# We also need the .cpp files, which are generated as side effects of the -# above rules. Specifying this explicitly makes -j2 work. -$(patsubst %.h,%.cpp,$(GEN)): $(intermediates)/xml/%.cpp : $(intermediates)/xml/%.h -#end - -# HTML tag and attribute names - -GEN:= $(intermediates)/HTMLNames.cpp $(intermediates)/HTMLElementFactory.cpp $(intermediates)/JSHTMLElementWrapperFactory.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --tags $(html_tags) --attrs $(html_attrs) --extraDefines "$(FEATURE_DEFINES)" --factory --wrapperFactory --output $(dir $@) -$(GEN): html_tags := $(LOCAL_PATH)/html/HTMLTagNames.in -$(GEN): html_attrs := $(LOCAL_PATH)/html/HTMLAttributeNames.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(html_tags) $(html_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - -# SVG tag and attribute names - -ifeq ($(ENABLE_SVG), true) -GEN:= $(intermediates)/SVGNames.cpp $(intermediates)/SVGElementFactory.cpp $(intermediates)/JSSVGElementWrapperFactory.cpp -SVG_FLAGS:=ENABLE_SVG_AS_IMAGE=1 ENABLE_SVG_FILTERS=1 ENABLE_SVG_FONTS=1 ENABLE_SVG_FOREIGN_OBJECT=1 ENABLE_SVG_USE=1 -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --tags $(svg_tags) --attrs $(svg_attrs) --extraDefines "$(SVG_FLAGS)" --factory --wrapperFactory --output $(dir $@) -$(GEN): svg_tags := $(LOCAL_PATH)/svg/svgtags.in -$(GEN): svg_attrs := $(LOCAL_PATH)/svg/svgattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(svg_tags) $(svg_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -endif - -# XML attribute names - -GEN:= $(intermediates)/XMLNames.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xml_attrs) --output $(dir $@) -$(GEN): xml_attrs := $(LOCAL_PATH)/xml/xmlattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xml_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) - -# XLink attribute names - -ifeq ($(ENABLE_SVG), true) -GEN:= $(intermediates)/XLinkNames.cpp -$(GEN): PRIVATE_PATH := $(LOCAL_PATH) -$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xlink_attrs) --output $(dir $@) -$(GEN): xlink_attrs := $(LOCAL_PATH)/svg/xlinkattrs.in -$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xlink_attrs) - $(transform-generated-source) -LOCAL_GENERATED_SOURCES += $(GEN) -endif diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 3de7e2f..3564483 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -124,6 +124,7 @@ LOCAL_SRC_FILES := \ bindings/js/JSAudioConstructor.cpp \ bindings/js/JSCDATASectionCustom.cpp \ bindings/js/JSCSSRuleCustom.cpp \ + bindings/js/JSCSSRuleListCustom.cpp \ bindings/js/JSCSSStyleDeclarationCustom.cpp \ bindings/js/JSCSSValueCustom.cpp \ bindings/js/JSCanvasRenderingContext2DCustom.cpp \ @@ -148,15 +149,19 @@ LOCAL_SRC_FILES := \ bindings/js/JSDataGridDataSource.cpp \ bindings/js/JSDatabaseCustom.cpp \ bindings/js/JSDedicatedWorkerContextCustom.cpp \ + bindings/js/JSDesktopNotificationsCustom.cpp \ bindings/js/JSDocumentCustom.cpp \ bindings/js/JSDocumentFragmentCustom.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ bindings/js/JSEventListener.cpp \ + bindings/js/JSEventSourceConstructor.cpp \ + bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSGeolocationCustom.cpp \ bindings/js/JSHTMLAllCollection.cpp \ bindings/js/JSHTMLAppletElementCustom.cpp \ + bindings/js/JSHTMLCanvasElementCustom.cpp \ bindings/js/JSHTMLCollectionCustom.cpp \ bindings/js/JSHTMLDataGridElementCustom.cpp \ bindings/js/JSHTMLDocumentCustom.cpp \ @@ -269,6 +274,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ bridge/runtime_object.cpp \ bridge/runtime_root.cpp \ bridge/testbindings.cpp \ + bridge/testqtbindings.cpp \ \ css/CSSBorderImageValue.cpp \ css/CSSCanvasValue.cpp \ @@ -511,6 +517,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/HTMLDataGridColElement.cpp \ html/HTMLDataGridElement.cpp \ html/HTMLDataGridRowElement.cpp \ + html/HTMLDataListElement.cpp \ html/HTMLDirectoryElement.cpp \ html/HTMLDivElement.cpp \ html/HTMLDocument.cpp \ @@ -583,6 +590,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ html/PreloadScanner.cpp \ html/TimeRanges.cpp \ html/ValidityState.cpp \ + html/canvas/CanvasGradient.cpp \ \ loader/Cache.cpp \ loader/CachedCSSStyleSheet.cpp \ @@ -638,6 +646,8 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ loader/loader.cpp \ \ + notifications/Notification.cpp \ + notifications/NotificationCenter.cpp \ page/BarInfo.cpp \ page/Chrome.cpp \ page/Console.cpp \ @@ -648,6 +658,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ page/DOMWindow.cpp \ page/DragController.cpp \ page/EventHandler.cpp \ + page/EventSource.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameTree.cpp \ @@ -672,18 +683,15 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ page/android/DragControllerAndroid.cpp \ page/android/EventHandlerAndroid.cpp \ - page/android/EventHandlerAndroid.cpp \ - page/android/InspectorControllerAndroid.cpp \ page/android/InspectorControllerAndroid.cpp \ - page/android/DragControllerAndroid.cpp \ \ - page/XSSAuditor.cpp \ page/animation/AnimationBase.cpp \ page/animation/AnimationController.cpp \ page/animation/CompositeAnimation.cpp \ page/animation/ImplicitAnimation.cpp \ page/animation/KeyframeAnimation.cpp \ page/haiku/DragControllerHaiku.cpp \ + page/haiku/EventHandlerHaiku.cpp \ \ platform/Arena.cpp \ platform/ContentType.cpp \ @@ -757,6 +765,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/GraphicsTypes.cpp \ platform/graphics/Image.cpp \ platform/graphics/ImageBuffer.cpp \ + platform/graphics/ImageSource.cpp \ platform/graphics/IntRect.cpp \ platform/graphics/MediaPlayer.cpp \ platform/graphics/Path.cpp \ @@ -792,6 +801,15 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ endif LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ + platform/graphics/haiku/ColorHaiku.cpp \ + platform/graphics/haiku/FloatPointHaiku.cpp \ + platform/graphics/haiku/FloatRectHaiku.cpp \ + platform/graphics/haiku/GradientHaiku.cpp \ + platform/graphics/haiku/GraphicsContextHaiku.cpp \ + platform/graphics/haiku/IntPointHaiku.cpp \ + platform/graphics/haiku/IntRectHaiku.cpp \ + platform/graphics/haiku/IntSizeHaiku.cpp \ + platform/graphics/haiku/PathHaiku.cpp \ platform/graphics/opentype/OpenTypeUtilities.cpp \ platform/graphics/skia/NativeImageSkia.cpp \ \ @@ -804,7 +822,9 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/transforms/TransformOperations.cpp \ platform/graphics/transforms/TransformationMatrix.cpp \ platform/graphics/transforms/TranslateTransformOperation.cpp \ + platform/graphics/wince/ColorWince.cpp \ platform/graphics/wince/FontCacheWince.cpp \ + platform/graphics/wince/FontCustomPlatformData.cpp \ \ platform/haiku/ClipboardHaiku.cpp \ platform/haiku/ContextMenuHaiku.cpp \ @@ -816,14 +836,19 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/haiku/EventLoopHaiku.cpp \ platform/haiku/FileChooserHaiku.cpp \ platform/haiku/FileSystemHaiku.cpp \ + platform/haiku/LocalizedStringsHaiku.cpp \ + platform/haiku/LoggingHaiku.cpp \ platform/haiku/MIMETypeRegistryHaiku.cpp \ platform/haiku/PasteboardHaiku.cpp \ platform/haiku/PlatformKeyboardEventHaiku.cpp \ platform/haiku/PlatformMouseEventHaiku.cpp \ platform/haiku/PlatformWheelEventHaiku.cpp \ platform/haiku/PopupMenuHaiku.cpp \ + platform/haiku/RenderThemeHaiku.cpp \ platform/haiku/ScreenHaiku.cpp \ + platform/haiku/ScrollbarThemeHaiku.cpp \ platform/haiku/SearchPopupMenuHaiku.cpp \ + platform/haiku/SharedBufferHaiku.cpp \ platform/haiku/SoundHaiku.cpp \ platform/haiku/TemporaryLinkStubs.cpp \ platform/haiku/WidgetHaiku.cpp \ @@ -881,6 +906,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ \ platform/text/android/TextBreakIteratorInternalICU.cpp \ platform/text/haiku/StringHaiku.cpp \ + platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp \ \ plugins/MimeType.cpp \ plugins/MimeTypeArray.cpp \ @@ -1060,12 +1086,14 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ storage/SQLResultSetRowList.cpp \ storage/SQLStatement.cpp \ storage/SQLTransaction.cpp \ + storage/SQLTransactionCoordinator.cpp \ storage/Storage.cpp \ storage/StorageAreaImpl.cpp \ storage/StorageAreaSync.cpp \ storage/StorageEvent.cpp \ storage/StorageMap.cpp \ storage/StorageNamespace.cpp \ + storage/StorageNamespaceImpl.cpp \ ifeq ($(ENABLE_SVG), true) LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 53c2690..5175089 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,4247 @@ +2009-08-18 Kent Tamura <tkent@chromium.org> + + Reviewed by Eric Seidel. + + Support for parsing <datalist> element and generating HTMLDataListElement nodes. + https://bugs.webkit.org/show_bug.cgi?id=26915 + + Tests: fast/forms/datalist-nonoption-child.html + fast/forms/datalist.html + + * WebCore.gypi: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/build-generated-files.sh: + * WebCore.xcodeproj/project.pbxproj: + * WebCoreSources.bkl: + * css/html.css: + * html/CollectionType.h: + (WebCore::): + * html/HTMLCollection.cpp: + (WebCore::HTMLCollection::itemAfter): + * html/HTMLDataListElement.cpp: Added. + (WebCore::HTMLDataListElement::HTMLDataListElement): + (WebCore::HTMLDataListElement::~HTMLDataListElement): + (WebCore::HTMLDataListElement::checkDTD): + (WebCore::HTMLDataListElement::options): + * html/HTMLDataListElement.h: Added. + * html/HTMLDataListElement.idl: Added. + * html/HTMLElement.cpp: + (WebCore::inlineTagList): + * html/HTMLParser.cpp: + (WebCore::HTMLParser::isAffectedByResidualStyle): + * html/HTMLTagNames.in: + +2009-08-17 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + -webkit-box-orient:horizontal doesn't work on <button> tag + https://bugs.webkit.org/show_bug.cgi?id=34445 + + Make a flexible button's anonymous child flexible and pass the + parent's box-orient to the anonymous child. + + Also, added a renderName for anonymous flexible boxes. + + Test: fast/flexbox/box-orient-button.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::createAnonymousBlock): + * rendering/RenderBlock.h: + * rendering/RenderButton.cpp: + (WebCore::RenderButton::addChild): + (WebCore::RenderButton::setupInnerStyle): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::renderName): + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Render -webkit-mask via compositing layers when possible + https://bugs.webkit.org/show_bug.cgi?id=28414 + + Implement accelerated compositing of -webkit-mask, when combined + with already-composited content. + + RenderLayerBacking now creates an additional GraphicsLayer for the mask contents, + and sets this as the mask on another GraphicsLayer via the setMaskLayer() method. + GraphicsLayerCA then applies the mask using -[CALayer setMask:]. + + The enum values for GraphicsLayerPaintingPhase were renamed to avoid the + confusion with "mask", and a new value, GraphicsLayerPaintMask, was added which + indicates that just the mask is painting. + + When painting the composited mask, we need to paint with the normal compositing + mode rather than CompositeDestinationIn, so InlineFlowBox and RenderBox now consult + layer()->hasCompositedMask() to pick the mode. If the mask is composited, they no longer + need to make transparency layers. + + We no longer have to throw video rendering into software because of masks. + + When a masked element has composited descendants, that element needs to + become composited so that the mask can be applied via compositing. + + Tests: compositing/masks/masked-ancestor.html + compositing/masks/simple-composited-mask.html + + * platform/graphics/GraphicsLayer.cpp: + (WebCore::GraphicsLayer::GraphicsLayer): + * platform/graphics/GraphicsLayer.h: + (WebCore::GraphicsLayer::maskLayer): + (WebCore::GraphicsLayer::setMaskLayer): + (WebCore::GraphicsLayer::paintingPhase): + (WebCore::GraphicsLayer::setPaintingPhase): + * platform/graphics/GraphicsLayerClient.h: + (WebCore::): + * platform/graphics/mac/GraphicsLayerCA.h: + (WebCore::GraphicsLayerCA::): + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayerCA::setMaskLayer): + (WebCore::GraphicsLayerCA::recursiveCommitChanges): + (WebCore::GraphicsLayerCA::commitLayerChanges): + (WebCore::GraphicsLayerCA::updateMaskLayer): + * rendering/InlineFlowBox.cpp: + (WebCore::InlineFlowBox::paintMask): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::paintMaskImages): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::hasCompositedMask): + * rendering/RenderLayer.h: + (WebCore::RenderLayer::hasCompositedMask): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::~RenderLayerBacking): + (WebCore::RenderLayerBacking::destroyGraphicsLayer): + (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateForegroundLayer): + (WebCore::RenderLayerBacking::updateMaskLayer): + (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer): + (WebCore::RenderLayerBacking::setContentsNeedDisplay): + (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): + (WebCore::RenderLayerBacking::paintIntoLayer): + (WebCore::RenderLayerBacking::paintContents): + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::hasMaskLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + (WebCore::RenderLayerCompositor::canAccelerateVideoRendering): + (WebCore::RenderLayerCompositor::requiresCompositingWhenDescendantsAreCompositing): + * rendering/RenderLayerCompositor.h: + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Layer content misplaced with compositing, z-index and overflow + https://bugs.webkit.org/show_bug.cgi?id=28361 + + The foreground GraphicsLayer (used to render element foreground when the element has + negative z-order children) was misplaced when there is a clipping layer (which clips + children). The foreground layer is parented under the clipping layer so that the foreground + depth-sorts with the layer's children, so its geometry needs to be computed relative to + that clipping layer. + + Also clarified some FIXME comments, and corrected a debug-only layer name. + + Test: compositing/geometry/clipping-foreground.html + + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayerCA::updateSublayerList): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateForegroundLayer): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree): + +2009-08-17 Mark Rowe <mrowe@apple.com> + + Reviewed by Sam Weinig. + + Fix leaks of SVGElementInstance seen during regression tests. + + r47313 made TreeShared types start with a ref-count of 1, but SVGElementInstance was mistakenly + not updated to have a create method that adopted the initial reference. This lead to the instances + of SVGElementInstance allocated by SVGUseElement being leaked. + + * svg/SVGElementInstance.h: + (WebCore::SVGElementInstance::create): + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::buildPendingResource): + (WebCore::SVGUseElement::buildInstanceTree): + (WebCore::SVGUseElement::handleDeepUseReferencing): + +2009-08-17 Brady Eidson <beidson@apple.com> + + Reviewed by Sam Weinig. + + Some cleanup towards https://bugs.webkit.org/show_bug.cgi?id=13631 + Page Cache should support pages with frames. + + - Re-factor all remaining page cache code out of DocumentLoader, as CachedPage/CacheFrame loads + are solely the responsibility of FrameLoader. + - Enhance some page cache related Logging to help development. + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::identifierForInitialRequest): + + * loader/DocumentLoader.cpp: + (WebCore::DocumentLoader::DocumentLoader): + * loader/DocumentLoader.h: + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::FrameLoader): + (WebCore::FrameLoader::commitProvisionalLoad): + (WebCore::FrameLoader::continueLoadAfterWillSubmitForm): + (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): + * loader/FrameLoader.h: + (WebCore::FrameLoader::isLoadingFromCachedPage): + +2009-08-17 Roland Steiner <rolandsteiner@google.com> + + Reviewed by Eric Seidel. + + Moved implementation of isAfterContent to RenderObject + (as inline method to avoid potential performance regressions). + + BUG 28376 - [Cleanup] isAfterContent() implemented twice, should be member of RenderObject + (https://bugs.webkit.org/show_bug.cgi?id=28376) + + * rendering/RenderBox.cpp: + * rendering/RenderBox.h: + * rendering/RenderInline.cpp: + * rendering/RenderObject.h: + (WebCore::RenderObject::isAfterContent): + +2009-08-17 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Darin Adler. + + Assertion failure in WebCore::RenderHTMLCanvas::layout + https://bugs.webkit.org/show_bug.cgi?id=12052 + + Don't handle run-in if the element is not a block element. + + Test: fast/runin/nonblock-runin.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::handleRunInChild): + +2009-08-17 Benjamin C Meyer <benjamin.meyer@torchmobile.com> + + Reviewed by Darin Adler. + + Fix createImageData to raise the NOT_SUPPORTED_ERR exception when + either of the arguments are not finite. + + According to + http://www.whatwg.org/specs/web-apps/current-work/#pixel-manipulation: + "If any of the arguments to createImageData() or getImageData() are + infinite or NaN, or if the createImageData() method is invoked with + only one argument but that argument is null, the method must instead + raise a NOT_SUPPORTED_ERR exception." + + Test: http://philip.html5.org/tests/canvas/suite/tests/2d.imageData.create.nonfinite.html + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::createImageData): + * html/canvas/CanvasRenderingContext2D.h: + * html/canvas/CanvasRenderingContext2D.idl: + +2009-08-17 Jeremy Orlow <jorlow@chromium.org> + + Reviewed by Darin Fisher. + + Add a way to release the storage lock + https://bugs.webkit.org/show_bug.cgi?id=28411 + + Two scripts within the same origin that are accessing LocalStorage must not do + it simultaneously, according to the spec. There are some cases, however, where + a script might want to override this behavior. navigator.getStorageUpdates() + was added for this reason: + http://dev.w3.org/html5/spec/Overview.html#manually-releasing-the-storage-mutex + + Add this function to navigator and hook it up to DOM Storage. + + * page/Navigator.cpp: + (WebCore::Navigator::getStorageUpdates): + * page/Navigator.h: + * page/Navigator.idl: + * storage/StorageNamespace.h: + * storage/StorageNamespaceImpl.cpp: + (WebCore::StorageNamespaceImpl::unlock): + * storage/StorageNamespaceImpl.h: + +2009-08-17 Mark Rowe <mrowe@apple.com> + + Build fix. + + CFNetwork isn't present in the framework search path on Mac OS X so we can't directly include its headers. + We include CoreServices.h, the umbrella framework that contains CFNetwork, from the prefix header which + results in the CFNetwork headers being included on Mac OS X. CoreServices.h doesn't include CFNetwork.h on + Windows though so we explicitly include this header from the prefix header when on Windows. + + * WebCorePrefix.h: + * platform/network/cf/DNSCFNet.cpp: Remove #include that is no longer needed. + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Trying a better build fix (the previous one broke Leopard bots, although it did build for me). + + * platform/network/cf/DNSCFNet.cpp: Include CFNetwork/CFNetwork.h instead. + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Trying to fix Windows build. + + * platform/network/cf/DNSCFNet.cpp: Include CFNetwork/CFHost.h. + +2009-08-17 Peter Kasting <pkasting@google.com> + + Reviewed by Steve Falkenburg. + + https://bugs.webkit.org/show_bug.cgi?id=27323 + Only add Cygwin to the path when it isn't already there. This avoids + causing problems for people who purposefully have non-Cygwin versions of + executables like svn in front of the Cygwin ones in their paths. + + * WebCore.vcproj/QTMovieWin.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/WebCoreGenerated.vcproj: + +2009-08-17 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=28401 + Add support for DNS prefetching with CFNetwork + + This is just an optimization, no behavior change, so no tests. + + * platform/network/cf/DNSCFNet.cpp: + (WebCore::clientCallback): + (WebCore::prefetchDNS): + Use async CFHostStartInfoResolution() for implementation. + +2009-08-17 Aaron Boodman <aa@chromium.org> + + Reviewed by Alexey Proskuryakov. + + https://bugs.webkit.org/show_bug.cgi?id=28313: Combine ThreadableLoaderOptions::crossOriginRequestPolicy and + ThreadableLoaderOptions::crossOriginRedirectPolicy since they are always set the same way. + + Also, tightened up behavior of XMLHttpRequest with cross-origin redirects and access control. We have not implemented + redirects access control, so we should never redirect across origins. But in two edge cases, we were: + + * Asynchronous XHR: Script on origin A requests resource from origin B. Server redirects (without sending access control + authorization headers) to a resource on origin A. + * Synchronous XHR: Script on origin A requests resource from origin B. Server redirects (without sending access control + authorization headers) to another resource on origin B (this time sending access control authorization headers). + + Test: http/tests/xmlhttprequest/access-control-and-redirects.html + + * loader/DocumentThreadableLoader.cpp: + (WebCore::DocumentThreadableLoader::willSendRequest): Refactor redirect checking code into shared location. + (WebCore::DocumentThreadableLoader::loadRequest): Ditto. + (WebCore::DocumentThreadableLoader::isAllowedRedirect): Ditto. + * loader/DocumentThreadableLoader.h: + * loader/ThreadableLoader.h: + (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Remove ThreadableLoaderOptions::crossOriginRedirectPolicy. + * page/EventSource.cpp: + (WebCore::EventSource::connect): Ditto. + * workers/Worker.cpp: Ditto. + (WebCore::Worker::Worker): Ditto. + * workers/WorkerContext.cpp: Ditto. + (WebCore::WorkerContext::importScripts): Ditto. + * workers/WorkerScriptLoader.cpp: + (WebCore::WorkerScriptLoader::loadSynchronously): Ditto. + (WebCore::WorkerScriptLoader::loadAsynchronously): Ditto. + * workers/WorkerScriptLoader.h: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::createRequest): Ditto. + +2009-08-17 Adam Langley <agl@google.com> + + Reviewed by Dan Bernstein (relanding of r47157). + + Fix a typo in platform/graphics/skia/PlatformContextSkia.cpp + + https://bugs.webkit.org/show_bug.cgi?id=28172 + + This was originally fixed in r47157, however it triggered a bug in + Skia which caused Chromium Linux to fail layout tests in debug mode. + It was reverted in r47189 while we sorted it out. + + The Skia bug was fixed in Skia's r321 [1] and rolled into Chromium in + Chromium's r23523. This is a reland of the original patch. + + No new tests because it's a just typo fix. + + [1] http://code.google.com/p/skia/source/detail?r=321 + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Reviewed by Xan Lopez. + + Protect ResourceHandle for g_file_query_info_async call, using the + same technique we already use for HTTP requests that take the soup + path. + + * platform/network/soup/ResourceHandleSoup.cpp: + (WebCore::ResourceHandleInternal::~ResourceHandleInternal): + (WebCore::ResourceHandle::~ResourceHandle): + (WebCore::finishedCallback): + (WebCore::): + +2009-08-17 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + REGRESSION (r47255): MediaWiki's (including Wikipedia) navigation pane + appears below the main content + https://bugs.webkit.org/show_bug.cgi?id=28350 + + A particular version of the MediaWiki software detects WebKit through + user agent sniffing and imports a style sheet called KHTMLFixes.css, + which contains a single rule that was meant to work around some KHTML + bug, but currently has the sole effect of causing the float containing + the main article content to extend all the way to the left and thus push + down the left navigation pane. + + * css/CSSImportRule.cpp: + (WebCore::CSSImportRule::setCSSStyleSheet): If site specific hacks are + enabled, check if the imported style sheet is the MediaWiki + KHTMLFixes.css. If so, remove the offending rule. + +2009-08-17 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Kevin Ollivier. + + Correct crash when processing local cancelled requests. + + No new tests. Existing fast/images/favicon-as-image.html + displays the problem. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::writeCallback): Add check for m_cancelled after + performing local-file processing. + (WebCore::ResourceHandleManager::downloadTimerCallback): Add + check for m_cancelled after performing local-file processing. + +2009-08-17 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> + + Unreviewed. Reverts 47371, since it breaks GTK+. + + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): + * platform/image-decoders/ImageDecoder.cpp: Removed. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::ImageDecoder): + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::convertCMYKToRGBA): + (WebCore::convertRGBToRGBA): + (WebCore::JPEGImageDecoder::outputScanlines): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::headerAvailable): + (WebCore::PNGImageDecoder::rowAvailable): + +2009-08-17 Yong Li <yong.li@torchmobile.com> + + Reviewed by Adam Treat. + + Allow image decoders to down-sample the image directly + to scaled output buffer. This can be enabled/disabled by + macro ENABLE(IMAGE_DECODER_DOWN_SAMPLING). + Only JPEG and PNG decoders are modified to support it now. + https://bugs.webkit.org/show_bug.cgi?id=28308 + + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): + * platform/image-decoders/ImageDecoder.cpp: Added. + * platform/image-decoders/ImageDecoder.h: + (WebCore::ImageDecoder::ImageDecoder): + (WebCore::ImageDecoder::setMaxNumPixels): + * platform/image-decoders/jpeg/JPEGImageDecoder.cpp: + (WebCore::convertCMYKToRGBA): + (WebCore::convertRGBToRGBA): + (WebCore::JPEGImageDecoder::outputScanlines): + * platform/image-decoders/jpeg/JPEGImageDecoder.h: + (WebCore::JPEGImageDecoder::setSize): + * platform/image-decoders/png/PNGImageDecoder.cpp: + (WebCore::PNGImageDecoder::headerAvailable): + (WebCore::PNGImageDecoder::rowAvailable): + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Build fix: fix float literals to avoid casting warnings. + + * rendering/MediaControlElements.cpp: + +2009-08-17 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Eric Seidel. + + Use OwnPtrs for GraphicsLayers + https://bugs.webkit.org/show_bug.cgi?id=28399 + + Convert RenderLayerBacking and RenderLayerCompositor to use OwnPtrs + for their references to GraphicsLayers. + + * platform/graphics/GraphicsLayer.h: + * platform/graphics/mac/GraphicsLayerCA.mm: + (WebCore::GraphicsLayer::create): + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::RenderLayerBacking): + (WebCore::RenderLayerBacking::createGraphicsLayer): + (WebCore::RenderLayerBacking::destroyGraphicsLayer): + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): + (WebCore::RenderLayerBacking::updateInternalHierarchy): + (WebCore::RenderLayerBacking::updateClippingLayers): + (WebCore::RenderLayerBacking::updateForegroundLayer): + (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): + * rendering/RenderLayerBacking.h: + (WebCore::RenderLayerBacking::graphicsLayer): + (WebCore::RenderLayerBacking::clippingLayer): + (WebCore::RenderLayerBacking::ancestorClippingLayer): + (WebCore::RenderLayerBacking::foregroundLayer): + (WebCore::RenderLayerBacking::parentForSublayers): + (WebCore::RenderLayerBacking::childForSuperlayers): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::~RenderLayerCompositor): + (WebCore::RenderLayerCompositor::rootPlatformLayer): + (WebCore::RenderLayerCompositor::didMoveOnscreen): + (WebCore::RenderLayerCompositor::ensureRootPlatformLayer): + (WebCore::RenderLayerCompositor::destroyRootPlatformLayer): + * rendering/RenderLayerCompositor.h: + +2009-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Reset InjectedScript styles cache on document change. + + https://bugs.webkit.org/show_bug.cgi?id=28390 + + * inspector/InspectorController.cpp: + (WebCore::InspectorController::close): + (WebCore::InspectorController::populateScriptObjects): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::resetInjectedScript): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + * inspector/InspectorDOMAgent.h: + * inspector/front-end/InjectedScript.js: + (InjectedScript._reset): + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + * rendering/MediaControlElements.cpp: Removed unneeded include of CString.h, + resorted includes, renamed "doc" to "document" and fixed formatting. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Removed functions now unneeded due to use of Reflect to create + language bindings. + + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::accessibilityParentForImageMap): + Get at usemap attribute directly. + + * editing/DeleteButtonController.cpp: + (WebCore::DeleteButtonController::createDeletionUI): + Get at id attribute directly. + * editing/EditorCommand.cpp: + (WebCore::executeInsertHorizontalRule): Ditto. + + * html/HTMLDocument.cpp: + (WebCore::HTMLDocument::dir): Get at dir attribute of body directly. + (WebCore::HTMLDocument::setDir): Ditto. + + * html/HTMLElement.cpp: Deleted unused functions. + * html/HTMLElement.h: Ditto. + + * html/HTMLImageElement.cpp: Deleted unused functions. + (WebCore::HTMLImageElement::alt): Changed to return const AtomicString&. + (WebCore::HTMLImageElement::addSubresourceAttributeURLs): Changed to + get at usemap attribute directly, but added a FIXME because although + it is what the old code did, it looks to not be entirely correct. + + * html/HTMLImageElement.h: Deleted unused functions. + + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::altDisplayString): Get at alt attribute directly. + + * rendering/RenderImage.cpp: + (WebCore::RenderImage::imageMap): Get at usemap attribute directly. + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::createGraphicsLayer): Get at id attribute + directly. + (WebCore::RenderLayerBacking::isSimpleContainerCompositingLayer): Removed + explicit HTMLNames namespace qualification. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + * dom/Document.cpp: + (WebCore::Document::setFocusedNode): Removed unneeded calls + to RefPtr::get. + +2009-08-17 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Discard DOM Node bindings on any document change. + + https://bugs.webkit.org/show_bug.cgi?id=28389 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + +2009-08-13 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Improve Cookie DataGrid to Show Hidden Data + https://bugs.webkit.org/show_bug.cgi?id=28269 + + * English.lproj/localizedStrings.js: DataGrid Headers "Name", "Value", "Size", ... + * WebCore.gypi: added missing files + + Implemented Bindings for InspectorController.deleteCookie(name) + + * inspector/InspectorBackend.idl: + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + (WebCore::JSInspectorBackend::deleteCookie): + + v8 Bindings Stubs + + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + + Removed WebInspector.Cookie + + * inspector/front-end/Cookie.js: Removed. + * inspector/front-end/inspector.html: + * inspector/front-end/WebKit.qrc: + + Improved DataGrid and Kept Fallback Behavior for Platforms that don't + yet provide access to raw cookies. + + * inspector/front-end/CookieItemsView.js: + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): + (WebInspector.CookieItemsView.prototype.update): + (WebInspector.CookieItemsView.prototype.buildCookies): + (WebInspector.CookieItemsView.prototype.dataGridForCookies): + (WebInspector.CookieItemsView.prototype.fallbackUpdate.callback): + (WebInspector.CookieItemsView.prototype.fallbackUpdate): + (WebInspector.CookieItemsView.prototype.fallbackBuildCookiesFromString): + (WebInspector.CookieItemsView.prototype.fallbackDataGridForCookies): + (WebInspector.CookieItemsView.prototype._deleteButtonClicked): + + Interaction with the page through Injected Script (for fallback behavior) + + * inspector/front-end/DOMAgent.js: + (InspectorController.getCookies): + * inspector/front-end/InjectedScript.js: + (InjectedScript.setStyleProperty): style fix + (InjectedScript.getCookies): + + Allow alignment of text inside DataGrids. + + * inspector/front-end/DataGrid.js: + (WebInspector.DataGrid): + (WebInspector.DataGridNode.prototype.createCell): + * inspector/front-end/DatabasesPanel.js: + (WebInspector.DatabasesPanel.prototype.dataGridForDOMStorage): + * inspector/front-end/inspector.css: + + Added deleteCookie(., ., String name) + Modified getRawCookies to return a bool to know if its implemented + + * platform/CookieJar.h: + + + Implemented deleteCookie for Macs + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + + Stub Implementations for Other Platforms + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + (WebCore::deleteCookie): + +2009-08-17 Adam Treat <adam.treat@torchmobile.com> + + Blind build fix for Leopard. + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::adjustLineToPixelBoundaries): + +2009-08-13 Mike Fenton <mike.fenton@torchmobile.com> + + Reviewed by Adam Treat. + + Style fixes based on cpp_style.py and WebKit Style guide for + GraphicsContextCG.cpp + + https://bugs.webkit.org/show_bug.cgi?id=28268 + + * platform/graphics/cg/GraphicsContextCG.cpp: + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::applyStrokePattern): + (WebCore::GraphicsContext::drawPath): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::clipToImageBuffer): + (WebCore::GraphicsContext::setPlatformShadow): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::roundToDevicePixels): + (WebCore::GraphicsContext::drawLineForText): + (WebCore::GraphicsContext::setURLForRect): + (WebCore::GraphicsContext::setImageInterpolationQuality): + (WebCore::GraphicsContext::imageInterpolationQuality): + (WebCore::GraphicsContext::setPlatformTextDrawingMode): + (WebCore::GraphicsContext::setCompositeOperation): + +2009-08-13 Mike Fenton <mike.fenton@torchmobile.com> + + Reviewed by Adam Treat. + + Style fixes based on cpp_style.py and WebKit Style guide for + GraphicsContext.cpp/h, GraphicsContextCairo.cpp and GraphicsContextQt.cpp. + + https://bugs.webkit.org/show_bug.cgi?id=28268 + + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::save): + (WebCore::GraphicsContext::restore): + (GraphicsContext::drawText): + (GraphicsContext::initFocusRing): + (GraphicsContext::focusRingBoundingRect): + (GraphicsContext::drawImage): + * platform/graphics/GraphicsContext.h: + * platform/graphics/cairo/GraphicsContextCairo.cpp: + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::toCairoOperator): + * platform/graphics/qt/GraphicsContextQt.cpp: + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Change HTMLAreaElement to use OwnArrayPtr + https://bugs.webkit.org/show_bug.cgi?id=28386 + + * html/HTMLAreaElement.cpp: + (WebCore::HTMLAreaElement::HTMLAreaElement): Removed unneeded initializer. + (WebCore::HTMLAreaElement::~HTMLAreaElement): Removed unneeded delete call. + (WebCore::HTMLAreaElement::parseMappedAttribute): Use the set function + instead of deletion followed by assignment. + * html/HTMLAreaElement.h: Use OwnArrayPtr. + +2009-08-17 Darin Adler <darin@apple.com> + + Fix Windows build. + + * dom/make_names.pl: Add back cast to (void*) needed on Windows. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Move noResize from HTMLFrameElementBase to HTMLFrameElement + https://bugs.webkit.org/show_bug.cgi?id=28384 + + * html/HTMLFrameElement.cpp: + (WebCore::HTMLFrameElement::HTMLFrameElement): Initialize m_noResize. + (WebCore::HTMLFrameElement::parseMappedAttribute): Set m_noResize to true + here if noresizeAttr is changed. This code was moved here from + HTMLFrameElementBase, but I added some FIXME comments. + (WebCore::HTMLFrameElement::setNoResize): Set the attribute based on + boolean argument. Moved here from HTMLFrameElementBase. + + * html/HTMLFrameElement.h: Moved noResize, setNoResize, and m_noResize + here from HTMLFrameElementBase. + + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::HTMLFrameElementBase): Removed m_noResize. + (WebCore::HTMLFrameElementBase::parseMappedAttribute): Removed code to parse + noresizeAttr. + + * html/HTMLFrameElementBase.h: Removed noResize, setNoResize, and m_noResize. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + Tweak HTMLFrameElementBase so that m_URL can be private + https://bugs.webkit.org/show_bug.cgi?id=28385 + + * html/HTMLFrameElement.cpp: + (WebCore::HTMLFrameElement::rendererIsNeeded): Removed m_URL argument. + * html/HTMLFrameElementBase.cpp: + (WebCore::HTMLFrameElementBase::isURLAllowed): Use m_URL instead of + taking an argument. + (WebCore::HTMLFrameElementBase::openURL): Removed m_URL argument. + * html/HTMLFrameElementBase.h: Removed argument from isURLAllowed function. + * html/HTMLIFrameElement.cpp: + (WebCore::HTMLIFrameElement::rendererIsNeeded): Removed m_URL argument. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + HTMLViewSourceDocument should use smart pointers + https://bugs.webkit.org/show_bug.cgi?id=28378 + + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::HTMLViewSourceDocument): Don't initialize + pointers any more since RefPtr starts 0 by default. + (WebCore::HTMLViewSourceDocument::createContainingTable): Use more specific + types for local variables. + (WebCore::HTMLViewSourceDocument::addSpanWithClassName): Return a PassRefPtr, + and use a RefPtr of a more specific type for a local variable. + (WebCore::HTMLViewSourceDocument::addLine): Use more specific types for local + variables, and use RefPtr as well. + (WebCore::HTMLViewSourceDocument::addLink): Return a PassRefPtr, and use a + RefPtr of a more specific type for a local variable. + + * html/HTMLViewSourceDocument.h: Change return types to PassRefPtr and + data member types to RefPtr. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + DOM attribute getter/setter functions should use const AtomicString& type + https://bugs.webkit.org/show_bug.cgi?id=25425 + + Convert 4 more classes. These are classes I am going to make other changes + to soon, so it's good to have this use of Reflect in the IDL out of the way. + + * html/HTMLEmbedElement.idl: Use Reflect for many attributes. + * html/HTMLFrameElement.idl: Ditto. + * html/HTMLIFrameElement.idl: Ditto. + * html/HTMLObjectElement.idl: Ditto. + +2009-08-17 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Script to create element factory needs changes to accommodate calling create + https://bugs.webkit.org/show_bug.cgi?id=28379 + + * dom/make_names.pl: Tweak formatting. Remove lots of unneeded quotes + around names used inside {}. Added new createWithNew property for tags + that makes the factory use a create function instead of calling new. + Renamed functions with initialize in their name to have default in their + name, since they return an array full of default values and don't themselves + initialize anything. + +2009-08-16 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + StyledElement should use ASCIICType instead of having its own toHex function + https://bugs.webkit.org/show_bug.cgi?id=28377 + + * dom/StyledElement.cpp: + (WebCore::StyledElement::addCSSColor): Use isASCIIHexDigit and toASCIIHexValue. + +2009-08-16 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + execCommand("InsertHorizontalRule") inserts a broken <hr> element + https://bugs.webkit.org/show_bug.cgi?id=28375 + + * editing/EditorCommand.cpp: + (WebCore::executeInsertHorizontalRule): Create an HTMLHRElement + instead of just an HTMLElement. + +2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] <option> element & 'onpick' events - history navigation is broken + https://bugs.webkit.org/show_bug.cgi?id=28371 + + After selecting an option element with an 'onpick' event associated with a 'go' task, + the navigation is executed. When going back in history, the same 'onpick' event is fired + again. Fix that problem, add wml/option-element-onpick-recursion.html covering the bug. + + Test: wml/option-element-onpick-recursion.html + + * wml/WMLOptionElement.cpp: + (WebCore::WMLOptionElement::handleIntrinsicEventIfNeeded): + * wml/WMLSelectElement.cpp: + (WebCore::WMLSelectElement::WMLSelectElement): + (WebCore::WMLSelectElement::selectInitialOptions): + * wml/WMLSelectElement.h: + (WebCore::WMLSelectElement::initialized): + +2009-08-16 Anthony Ricaud <rik@webkit.org> + + Reviewed by Timothy Hatcher. + + Inspector Resource filtering: keyboard Navigation always uses ALL resources + https://bugs.webkit.org/show_bug.cgi?id=28231 + + Determine if a resource is selectable on user action. + + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourceSidebarTreeElement.prototype.get selectable): + +2009-08-16 David Kilzer <ddkilzer@apple.com> + + <http://webkit.org/b/28355> Replace MAX()/MIN() macros with type-safe std::max()/min() templates + + Reviewed by Dan Bernstein. + + * accessibility/mac/AccessibilityObjectWrapper.mm: + (AXAttributeStringSetSpelling): Changed MIN() to min(). + * platform/graphics/mac/FontMacATSUI.mm: + (WebCore::Font::selectionRectForComplexText): Changed MAX() to + max() and MIN() to min(). + (WebCore::Font::floatWidthForComplexText): Ditto. + * platform/graphics/mac/SimpleFontDataMac.mm: Added using + std::max statement. + (WebCore::SimpleFontData::platformInit): Changed MAX() to max(). + * platform/text/mac/TextCodecMac.cpp: + (WebCore::TextCodecMac::decode): Changed MIN() to min(). + +2009-08-16 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] Cleanup WMLIntrinsicEventHandling code + https://bugs.webkit.org/show_bug.cgi?id=28358 + + Remove superflous "Event* evt" parameter from executeTask() methods. It's a leftover from the initial WML merge. + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::defaultEventHandler): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::defaultEventHandler): + * wml/WMLGoElement.cpp: + (WebCore::WMLGoElement::executeTask): + * wml/WMLGoElement.h: + * wml/WMLIntrinsicEventHandler.cpp: + (WebCore::WMLIntrinsicEventHandler::triggerIntrinsicEvent): + * wml/WMLPrevElement.cpp: + (WebCore::WMLPrevElement::executeTask): + * wml/WMLPrevElement.h: + * wml/WMLRefreshElement.cpp: + (WebCore::WMLRefreshElement::executeTask): + * wml/WMLRefreshElement.h: + * wml/WMLTaskElement.h: + +2009-08-16 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: A handful of DOMAgent-related fixes and cleanups. + + - renamed elementId to nodeId in operations on nodes. + - added load listeners to frame owners in InspectorDOMAgent. + - removed InspectorController::inspectedWindowScriptObjectCleared event. + - preserved isViaInspector flag for 'via inspector' marker to survive styles update. + - removed contentDocument-related logic from ElementsPanel since it is handled in + the InspectorDOMAgent. + - removed DOM listeners unregistration and corresponding events from InspectorController. + - made this.styles 'private' in ElementsPanel. + - added TODO for the handleCopy processing. + + https://bugs.webkit.org/show_bug.cgi?id=28356 + + * WebCore.order: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::getChildNodes): + (WebCore::InspectorBackend::setTextNodeValue): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::startListening): + (WebCore::InspectorDOMAgent::stopListening): + (WebCore::InspectorDOMAgent::handleEvent): + (WebCore::InspectorDOMAgent::pushChildNodesToFrontend): + (WebCore::InspectorDOMAgent::getChildNodes): + (WebCore::InspectorDOMAgent::pushNodePathToFrontend): + (WebCore::InspectorDOMAgent::setTextNodeValue): + (WebCore::InspectorDOMAgent::buildObjectForNode): + (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): + (WebCore::InspectorDOMAgent::innerParentNode): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorFrontend.cpp: + * inspector/InspectorFrontend.h: + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMDocument.prototype.addEventListener): + (WebInspector.DOMDocument.prototype.removeEventListener): + (WebInspector.DOMDocument.prototype._fireDomEvent): + (WebInspector.DOMAgent.prototype.getChildNodesAsync.mycallback): + (WebInspector.DOMAgent.prototype.getChildNodesAsync): + (WebInspector.DOMAgent.prototype._setChildNodes): + (WebInspector.CSSStyleDeclaration.parseRule): + (WebInspector.childNodeInserted): + (WebInspector.childNodeRemoved): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + (WebInspector.ElementsPanel.prototype.reset): + (WebInspector.ElementsPanel.prototype.addStyleChange): + (WebInspector.ElementsPanel.prototype.removeStyleChange): + (WebInspector.ElementsPanel.prototype._updateModifiedNodes): + (WebInspector.ElementsPanel.prototype.updateBreadcrumb): + (WebInspector.ElementsPanel.prototype.handleCopyEvent): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype.set rootDOMNode): + (WebInspector.ElementsTreeOutline.prototype.findTreeElement): + (WebInspector.ElementsTreeElement): + (WebInspector.ElementsTreeElement.prototype._updateChildren.updateChildrenOfNode): + (WebInspector.ElementsTreeElement.prototype._updateChildren): + (WebInspector.ElementsTreeElement.prototype.onexpand): + * inspector/front-end/InjectedScript.js: + (InjectedScript.addStyleSelector): + (InjectedScript._serializeRule): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection): + * inspector/front-end/inspector.js: + (WebInspector.set hoveredDOMNode): + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype.findTreeElement): + * inspector/front-end/utilities.js: + (Node.prototype.enclosingNodeOrSelfWithNodeNameInArray): + (Node.prototype.enclosingNodeOrSelfWithClass): + (isAncestorNode): + (firstCommonNodeAncestor): + (traverseNextNode): + (traversePreviousNode): + (): + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::dispatchWindowObjectAvailable): + * page/android/InspectorControllerAndroid.cpp: + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt + + Optimize updateFillImages() to not add/remove clients every time + https://bugs.webkit.org/show_bug.cgi?id=28334 + + Optimize the case where old and new just have a single layer pointing to the same (or no) + image. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::updateFillImages): + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Implement animations of multiple text-shadows and -webkit-box-shadows. + https://bugs.webkit.org/show_bug.cgi?id=28266 + + Test: transitions/multiple-shadow-transitions.html + + * page/animation/AnimationBase.cpp: + (WebCore::PropertyWrapperShadow::equals): + (WebCore::PropertyWrapperShadow::blend): + +2009-08-15 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Anders Carlsson. + + Make transitions work for position and size of multiple backgrounds and masks. + https://bugs.webkit.org/show_bug.cgi?id=28266 + + Make background-position, background-size, -webkit-mask-position and -webkit-mask-size + properties animatable with multiple backgrounds, rather than just animating the first one. + + Tests: transitions/multiple-background-size-transitions.html + transitions/multiple-background-transitions.html + transitions/multiple-mask-transitions.html + + * page/animation/AnimationBase.cpp: + (WebCore::FillLayerPropertyWrapperBase::FillLayerPropertyWrapperBase): + (WebCore::FillLayerPropertyWrapperBase::~FillLayerPropertyWrapperBase): + (WebCore::FillLayerPropertyWrapperGetter::FillLayerPropertyWrapperGetter): + (WebCore::FillLayerPropertyWrapperGetter::equals): + (WebCore::FillLayerPropertyWrapper::FillLayerPropertyWrapper): + (WebCore::FillLayerPropertyWrapper::blend): + (WebCore::FillLayersPropertyWrapper::FillLayersPropertyWrapper): + (WebCore::FillLayersPropertyWrapper::equals): + (WebCore::FillLayersPropertyWrapper::blend): + (WebCore::ensurePropertyMap): + * rendering/style/FillLayer.h: + (WebCore::FillLayer::setXPosition): + (WebCore::FillLayer::setYPosition): + (WebCore::FillLayer::setSize): + +2009-08-15 George Staikos <george.staikos@torchmobile.com> + + Reviewed by Jan Alonzo. + + Don't crash in fieldset code when WML is enabled. + https://bugs.webkit.org/show_bug.cgi?id=28012 + + Test: fast/wml/html-fieldset-crash.html + + * rendering/RenderFieldset.cpp: + (WebCore::RenderFieldset::findLegend): ++brackets + +2009-08-15 Sam Weinig <sam@webkit.org> + + Try and enable EventSource on Windows. + + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.vcproj/build-generated-files.sh: + +2009-08-15 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Setting attribute event listeners to the body does not set them on the window + https://bugs.webkit.org/show_bug.cgi?id=28343 + + Tests: fast/dom/Window/HTMLBodyElement-window-eventListener-attributes.html + fast/dom/Window/HTMLFrameSetElement-window-eventListener-attributes.html + + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::setOnblur): Use setWindowAttributeEventListener instead of setAttributeEventListener. + (WebCore::HTMLBodyElement::setOnerror): Ditto. + (WebCore::HTMLBodyElement::setOnfocus): Ditto. + (WebCore::HTMLBodyElement::setOnload): Ditto. + (WebCore::HTMLBodyElement::setOnbeforeunload): Ditto. + (WebCore::HTMLBodyElement::setOnmessage): Ditto. + (WebCore::HTMLBodyElement::setOnoffline): Ditto. + (WebCore::HTMLBodyElement::setOnonline): Ditto. + (WebCore::HTMLBodyElement::setOnresize): Ditto. + (WebCore::HTMLBodyElement::setOnstorage): Ditto. + (WebCore::HTMLBodyElement::setOnunload): Ditto. + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::setOnblur): Ditto. + (WebCore::HTMLFrameSetElement::setOnerror): Ditto. + (WebCore::HTMLFrameSetElement::setOnfocus): Ditto. + (WebCore::HTMLFrameSetElement::setOnload): Ditto. + (WebCore::HTMLFrameSetElement::setOnbeforeunload): Ditto. + (WebCore::HTMLFrameSetElement::setOnmessage): Ditto. + (WebCore::HTMLFrameSetElement::setOnoffline): Ditto. + (WebCore::HTMLFrameSetElement::setOnonline): Ditto. + (WebCore::HTMLFrameSetElement::setOnresize): Ditto. + (WebCore::HTMLFrameSetElement::setOnstorage): Ditto. + (WebCore::HTMLFrameSetElement::setOnunload): Ditto. + +2009-08-15 Sam Weinig <sam@webkit.org> + + Reviewed by Dan Bernstein. + + Fix up some IDL comments. + + * html/HTMLBodyElement.idl: + * html/HTMLFrameSetElement.idl: + +2009-08-15 Adam Bergkvist <adam.bergkvist@ericsson.com> + + Reviewed by Sam Weinig. + + Added implementation of the EventSource object that enables + server-sent events from HTML5. + http://dev.w3.org/html5/eventsource/ + https://bugs.webkit.org/show_bug.cgi?id=14997 + + Tests: fast/eventsource/eventsource-attribute-listeners.html + fast/eventsource/eventsource-constructor.html + http/tests/eventsource/eventsource-bad-mime-type.html + http/tests/eventsource/eventsource-parse-event-stream.html + http/tests/eventsource/eventsource-reconnect.html + http/tests/eventsource/eventsource-status-code-states.html + http/tests/eventsource/workers/eventsource-simple.html + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore::JSDOMWindow::eventSource): + * bindings/js/JSEventSourceConstructor.cpp: Added. + (WebCore::): + (WebCore::JSEventSourceConstructor::JSEventSourceConstructor): + (WebCore::constructEventSource): + (WebCore::JSEventSourceConstructor::getConstructData): + * bindings/js/JSEventSourceConstructor.h: Added. + (WebCore::JSEventSourceConstructor::classInfo): + * bindings/js/JSEventSourceCustom.cpp: Added. + (WebCore::JSEventSource::markChildren): + (WebCore::JSEventSource::addEventListener): + (WebCore::JSEventSource::removeEventListener): + * bindings/js/JSEventTarget.cpp: + (WebCore::toJS): + (WebCore::toEventTarget): + * bindings/js/JSWorkerContextCustom.cpp: + (WebCore::JSWorkerContext::eventSource): + * dom/EventNames.h: + * dom/EventTarget.cpp: + (WebCore::EventTarget::toEventSource): + * dom/EventTarget.h: + * page/DOMWindow.idl: + * page/EventSource.cpp: Added. + (WebCore::EventSource::EventSource): + (WebCore::EventSource::~EventSource): + (WebCore::EventSource::connect): + (WebCore::EventSource::endRequest): + (WebCore::EventSource::scheduleReconnect): + (WebCore::EventSource::reconnectTimerFired): + (WebCore::EventSource::url): + (WebCore::EventSource::readyState): + (WebCore::EventSource::close): + (WebCore::EventSource::scriptExecutionContext): + (WebCore::EventSource::addEventListener): + (WebCore::EventSource::removeEventListener): + (WebCore::EventSource::dispatchEvent): + (WebCore::EventSource::didReceiveResponse): + (WebCore::EventSource::didReceiveData): + (WebCore::EventSource::didFinishLoading): + (WebCore::EventSource::didFail): + (WebCore::EventSource::didFailRedirectCheck): + (WebCore::EventSource::parseEventStream): + (WebCore::EventSource::parseEventStreamLine): + (WebCore::EventSource::dispatchGenericEvent): + (WebCore::EventSource::dispatchMessageEvent): + (WebCore::EventSource::stop): + * page/EventSource.h: Added. + (WebCore::EventSource::create): + (WebCore::EventSource::): + (WebCore::EventSource::setOnopen): + (WebCore::EventSource::onopen): + (WebCore::EventSource::setOnmessage): + (WebCore::EventSource::onmessage): + (WebCore::EventSource::setOnerror): + (WebCore::EventSource::onerror): + (WebCore::EventSource::toEventSource): + (WebCore::EventSource::eventListeners): + (WebCore::EventSource::refEventTarget): + (WebCore::EventSource::derefEventTarget): + * page/EventSource.idl: Added. + * workers/WorkerContext.idl: + +2009-08-15 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Minor DOMAgent bugfixes. + + https://bugs.webkit.org/show_bug.cgi?id=28177 + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::nodeForId): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + +2009-08-15 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Evaluating objects while on a breakpoint dumps string + representation instead of live object. + + https://bugs.webkit.org/show_bug.cgi?id=28280 + + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.completions.this._evalInInspectedWindow): + (WebInspector.ConsoleView.prototype.completions): + (WebInspector.ConsoleView.prototype._reportCompletions): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame.delayedEvaluation): + (WebInspector.ScriptsPanel.prototype.doEvalInCallFrame): + (WebInspector.ScriptsPanel.prototype.variablesInSelectedCallFrame): + +2009-08-15 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding two new files to WebCore/platform/haiku: + LocalizedStringsHaiku.cpp and LoggingHaiku.cpp + https://bugs.webkit.org/show_bug.cgi?id=28129 + + * platform/haiku/LocalizedStringsHaiku.cpp: Added. + (WebCore::submitButtonDefaultLabel): + (WebCore::inputElementAltText): + (WebCore::resetButtonDefaultLabel): + (WebCore::defaultLanguage): + (WebCore::searchableIndexIntroduction): + (WebCore::fileButtonChooseFileLabel): + (WebCore::fileButtonNoFileSelectedLabel): + (WebCore::contextMenuItemTagOpenLinkInNewWindow): + (WebCore::contextMenuItemTagDownloadLinkToDisk): + (WebCore::contextMenuItemTagCopyLinkToClipboard): + (WebCore::contextMenuItemTagOpenImageInNewWindow): + (WebCore::contextMenuItemTagDownloadImageToDisk): + (WebCore::contextMenuItemTagCopyImageToClipboard): + (WebCore::contextMenuItemTagOpenFrameInNewWindow): + (WebCore::contextMenuItemTagCopy): + (WebCore::contextMenuItemTagGoBack): + (WebCore::contextMenuItemTagGoForward): + (WebCore::contextMenuItemTagStop): + (WebCore::contextMenuItemTagReload): + (WebCore::contextMenuItemTagCut): + (WebCore::contextMenuItemTagPaste): + (WebCore::contextMenuItemTagNoGuessesFound): + (WebCore::contextMenuItemTagIgnoreSpelling): + (WebCore::contextMenuItemTagLearnSpelling): + (WebCore::contextMenuItemTagSearchWeb): + (WebCore::contextMenuItemTagLookUpInDictionary): + (WebCore::contextMenuItemTagOpenLink): + (WebCore::contextMenuItemTagIgnoreGrammar): + (WebCore::contextMenuItemTagSpellingMenu): + (WebCore::contextMenuItemTagShowSpellingPanel): + (WebCore::contextMenuItemTagCheckSpelling): + (WebCore::contextMenuItemTagCheckSpellingWhileTyping): + (WebCore::contextMenuItemTagCheckGrammarWithSpelling): + (WebCore::contextMenuItemTagFontMenu): + (WebCore::contextMenuItemTagBold): + (WebCore::contextMenuItemTagItalic): + (WebCore::contextMenuItemTagUnderline): + (WebCore::contextMenuItemTagOutline): + (WebCore::contextMenuItemTagWritingDirectionMenu): + (WebCore::contextMenuItemTagDefaultDirection): + (WebCore::contextMenuItemTagLeftToRight): + (WebCore::contextMenuItemTagRightToLeft): + (WebCore::contextMenuItemTagInspectElement): + (WebCore::searchMenuNoRecentSearchesText): + (WebCore::searchMenuRecentSearchesText): + (WebCore::searchMenuClearRecentSearchesText): + (WebCore::unknownFileSizeText): + (WebCore::AXWebAreaText): + (WebCore::AXLinkText): + (WebCore::AXListMarkerText): + (WebCore::AXImageMapText): + (WebCore::AXHeadingText): + (WebCore::imageTitle): + (WebCore::contextMenuItemTagTextDirectionMenu): + (WebCore::AXButtonActionVerb): + (WebCore::AXTextFieldActionVerb): + (WebCore::AXRadioButtonActionVerb): + (WebCore::AXCheckedCheckBoxActionVerb): + (WebCore::AXUncheckedCheckBoxActionVerb): + (WebCore::AXLinkActionVerb): + (WebCore::AXDefinitionListTermText): + (WebCore::AXDefinitionListDefinitionText): + * platform/haiku/LoggingHaiku.cpp: Added. + (WebCore::InitializeLoggingChannelsIfNecessary): + +2009-08-15 Darin Adler <darin@apple.com> + + Fix GTK build. + + * accessibility/gtk/AccessibilityObjectWrapperAtk.cpp: + (fallbackObject): Pass 0 for document. Should be OK at least for now. + +2009-08-15 Darin Adler <darin@apple.com> + + Fix Qt build. + + * dom/XMLTokenizerQt.cpp: Use create functions instead of calling new + directly to make CDATASection and Comment nodes. + +2009-08-14 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Make DOM classes start with a reference count of 1, like all other RefCounted + https://bugs.webkit.org/show_bug.cgi?id=28068 + + First half, everything except for element classes. + + * GNUmakefile.am: Removed DocPtr.h. + * WebCore.gypi: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + + * dom/Attr.cpp: + (WebCore::Attr::Attr): Added a call to createTextChild here so callers don't + have to call it explicitly. + (WebCore::Attr::create): Added. + (WebCore::Attr::setValue): Changed to take AtomicString. + (WebCore::Attr::cloneNode): Use create. + + * dom/Attr.h: Added a create function. Made the constructor private, + and a lot of other functions private as well. + + * dom/Attribute.cpp: + (WebCore::Attribute::createAttrIfNeeded): Use Attr::create. + + * dom/CDATASection.cpp: + (WebCore::CDATASection::create): Added. + (WebCore::CDATASection::cloneNode): Use create. + (WebCore::CDATASection::virtualCreate): Ditto. + + * dom/CDATASection.h: Added a create function. Made everything private. + Removed unneeded destructor declaration. + + * dom/CharacterData.cpp: + (WebCore::CharacterData::CharacterData): Replaced the multiple constructors + with a single one that takes ConstructionType. + + * dom/CharacterData.h: Made more functions be protected and private. + Made m_data be private. + + * dom/Comment.cpp: + (WebCore::Comment::Comment): Got rid of an extra constructor. + (WebCore::Comment::create): Added. + (WebCore::Comment::cloneNode): Call create. + + * dom/Comment.h: Added a create function. Made everything private. + + * dom/ContainerNode.cpp: + (WebCore::dispatchChildInsertionEvents): Use RefPtr instead of DocPtr. + (WebCore::dispatchChildRemovalEvents): Ditto. + + * dom/ContainerNode.h: Made the constructor protected and passed + ConstructionType instead of an isElement boolean. + + * dom/DocPtr.h: Removed. + + * dom/Document.cpp: + (WebCore::Document::Document): Simplified the code that sets m_document + since it's no longer a smart pointer. + (WebCore::Document::removedLastRef): Use explicit calls to selfOnlyRef + and selfOnlyDeref instead of a DocPtr in here. + (WebCore::Document::~Document): Simplified the code that sets m_document + since it's no longer a smart pointer. + (WebCore::Document::createDocumentFragment): Call create. + (WebCore::Document::createTextNode): Ditto. + (WebCore::Document::createComment): Ditto. + (WebCore::Document::createCDATASection): Ditto. + (WebCore::Document::createProcessingInstruction): Ditto. + (WebCore::Document::createEntityReference): Ditto. + (WebCore::Document::createEditingTextNode): Ditto. + (WebCore::Document::importNode): Call Attr::create. + (WebCore::Document::createAttributeNS): Ditto. + + * dom/Document.h: Call adoptRef. Made a lot of functions private and + protected and sorted them so public functions come first. + + * dom/DocumentFragment.cpp: + (WebCore::DocumentFragment::create): Added. + (WebCore::DocumentFragment::cloneNode): Call create. + * dom/DocumentFragment.h: Added create. + + * dom/DocumentType.cpp: + (WebCore::DocumentType::DocumentType): Pass type to Node constructor. + (WebCore::DocumentType::cloneNode): Use create. + * dom/DocumentType.h: + (WebCore::DocumentType::create): Call adoptRef. + + * dom/EditingText.cpp: + (WebCore::EditingText::create): Added. + * dom/EditingText.h: Added a create function. Made everything private. + + * dom/Element.cpp: + (WebCore::Element::Element): Pass CreateElementZeroRefCount to preserve + the zero reference count behavior for classes derived from Element. + + * dom/EntityReference.cpp: + (WebCore::EntityReference::create): Added. + (WebCore::EntityReference::cloneNode): Call create. + * dom/EntityReference.h: Added create. Made everything private. + + * dom/Node.cpp: + (WebCore::Node::initialRefCount): Added. Inline helper function for + the constructor. + (WebCore::Node::isContainer): Ditto. + (WebCore::Node::isElement): Ditto. + (WebCore::Node::isText): Ditto. + (WebCore::Node::Node): Changed to take a construction type argument. + Since m_document is now a normal pointer, added a call to selfOnlyRef. + (WebCore::Node::~Node): Ditto, but selfOnlyDeref. + (WebCore::Node::setDocument): Added selfOnlyRef/Deref calls. + (WebCore::Node::appendTextContent): Use the data function instead of + calling nodeValue functions, which do the same thing in a roundabout way. + + * dom/Node.h: Made the constructor protected and replaced the multiple + arguments iwth a single ConstructionType argument. Sorted the public + things first. + + * dom/Notation.h: Made most things private. + * dom/Notation.cpp: Removed extra constructor. + + * dom/ProcessingInstruction.cpp: + (WebCore::ProcessingInstruction::create): Added. + (WebCore::ProcessingInstruction::cloneNode): Call create. + * dom/ProcessingInstruction.h: Added create function. Made many other + members private. + + * dom/Range.cpp: + (WebCore::Range::processContents): Use DocumentFragment::create. + + * dom/Text.cpp: + (WebCore::Text::Text): Updated for base class change. + (WebCore::Text::create): Added. + (WebCore::Text::splitText): Changed to not require access to m_data. + (WebCore::Text::cloneNode): Call create. + (WebCore::Text::createRenderer): Call dataImpl. + (WebCore::Text::attach): Call data. + (WebCore::Text::recalcStyle): Call dataImpl. + (WebCore::Text::virtualCreate): Call create. + (WebCore::Text::createWithLengthLimit): Call create. + (WebCore::Text::formatForDebugger): Call data. + + * dom/Text.h: Added a create function. Made many other members private. + Renamed createNew to virtualCreate. + + * dom/XMLTokenizer.cpp: + (WebCore::XMLTokenizer::enterText): Call Text::create. + + * dom/XMLTokenizerLibxml2.cpp: + (WebCore::XMLTokenizer::cdataBlock): Call CDATASection::create. + (WebCore::XMLTokenizer::comment): Call Comment::create. + + * editing/CompositeEditCommand.cpp: + (WebCore::CompositeEditCommand::deleteInsignificantText): + Call data instead of string. + + * editing/CreateLinkCommand.cpp: + (WebCore::CreateLinkCommand::doApply): Call Text::create. + + * editing/EditorCommand.cpp: + (WebCore::executeInsertNode): Call DocumentFragment::create. + + * editing/SplitTextNodeCommand.cpp: + (WebCore::SplitTextNodeCommand::doApply): Call Text::create. + + * editing/markup.cpp: + (WebCore::appendStartMarkup): Call data instead of nodeValue. + + * html/HTMLDocument.h: + (WebCore::HTMLDocument::create): Call adoptRef. + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::createContextualFragment): Call DocumentFragment::create. + (WebCore::replaceChildrenWithFragment): Call data instead of string. + (WebCore::replaceChildrenWithText): Call Text::create. + (WebCore::HTMLElement::setInnerText): Call DocumentFragment::create and + Text::create. + (WebCore::HTMLElement::setOuterText): Call Text::create. + + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): Call Text::create. + + * html/HTMLOptionElement.cpp: + (WebCore::HTMLOptionElement::setText): Call Text::create. + + * html/HTMLParser.cpp: + (WebCore::HTMLParser::textCreateErrorCheck): Call Text::create. + (WebCore::HTMLParser::commentCreateErrorCheck): Call Comment::create. + (WebCore::HTMLParser::handleIsindex): Call Text::create. + + * html/HTMLViewSourceDocument.cpp: + (WebCore::HTMLViewSourceDocument::addText): Call Text::create. + + * html/HTMLViewSourceDocument.h: + (WebCore::HTMLViewSourceDocument::create): Call adoptRef. + + * loader/FTPDirectoryDocument.cpp: + (WebCore::FTPDirectoryTokenizer::appendEntry): Call Text::create. + (WebCore::FTPDirectoryTokenizer::createTDForFilename): Call Text::create. + + * loader/FTPDirectoryDocument.h: + (WebCore::FTPDirectoryDocument::create): Call adoptRef. + * loader/ImageDocument.h: + (WebCore::ImageDocument::create): Ditto. + * loader/MediaDocument.h: + (WebCore::MediaDocument::create): Ditto. + * loader/PlaceholderDocument.h: + (WebCore::PlaceholderDocument::create): Ditto. + * loader/PluginDocument.h: + (WebCore::PluginDocument::create): Ditto. + * loader/TextDocument.h: + (WebCore::TextDocument::create): Ditto. + + * loader/loader.cpp: + (WebCore::Loader::Host::didFinishLoading): Use RefPtr instead of DocPtr. + (WebCore::Loader::Host::didFail): Ditto. + + * platform/TreeShared.h: + (WebCore::TreeShared::TreeShared): Added an initialRefCount argument, + defaulting to 1. Node still sometimes initializes it to 0 instead for now. + + * rendering/RenderText.cpp: + (WebCore::RenderText::originalText): Use dataImpl instead of string. + + * rendering/RenderTextFragment.cpp: + (WebCore::RenderTextFragment::originalText): Use dataImpl instead of string. + (WebCore::RenderTextFragment::previousCharacter): Ditto. + + * svg/SVGDocument.h: + (WebCore::SVGDocument::create): Use adoptRef. + + * svg/SVGElementInstance.cpp: + (WebCore::SVGElementInstance::SVGElementInstance): Updated to take a + PassRefPtr. + + * svg/SVGElementInstance.h: Made everything private. + + * wml/WMLDocument.h: + (WebCore::WMLDocument::create): Called adoptRef. + + * xml/XPathNamespace.cpp: + (WebCore::XPathNamespace::XPathNamespace): Take AtomicString arguments. + * xml/XPathNamespace.h: Made everything private. + + * xml/XSLTProcessor.cpp: + (WebCore::createFragmentFromSource): Use DocumentFragment::create and + Text::create. + +2009-08-13 Jon Honeycutt <jhoneycutt@apple.com> + + Part of <rdar://problem/6218721> No MSAA focus events fired for Webkit + nightly (20866) + + https://bugs.webkit.org/show_bug.cgi?id=20866 + + Reviewed by Oliver Hunt. + + * accessibility/AXObjectCache.cpp: + (WebCore::AXObjectCache::AXObjectCache): + Changed to take a pointer to its owner document. This is used by + AXObjectCache::handleFocusedUIElementChanged(). + (WebCore::AXObjectCache::focusedUIElementForPage): + Code moved from AccessibilityRenderObject::focusedUIElement(). Modified + to be a static function and to take a pointer to a Page. + (WebCore::AXObjectCache::platformGenerateAXID): + Moved the code to generate the next AXID from getAXID() to here. Added + a #if to make this non-WIN only, because Windows has its own + implementation. + (WebCore::AXObjectCache::getAXID): + Ensure that we generate a positive AXID, ranging from 1 to LONG_MAX. + + * accessibility/AXObjectCache.h: + Add a declaration for Document and Page. Removed the declaration of + AccessibilityObject, because we include the header. Reordered the + declaration of Node alphabetically. Moved the typedef for AXID to + AccessibilityObject. Removed some trailing whitespace. Added a member + variable to hold a pointer to the owner Document. + (WebCore::AXObjectCache::AXObjectCache): + Changed to take a pointer to its owner Document. + (WebCore::AXObjectCache::focusedUIElementForPage): + Added; code moved from AccessiblityRenderObject::focusedUIElement(). + Returns the focused element with respect to accessibility. + (WebCore::AXObjectCache::platformGenerateAXID): + Declare a function to generate an AXID. + (WebCore::AXObjectCache::objectFromAXID): + Return the AccessibilityObject with the given AXID. + + * accessibility/AccessibilityObject.h: + Moved the typedef for AXID from AXObjectCache to here. Made the m_id + member use the typedef. + (WebCore::AccessibilityObject::axObjectID): + Changed the return type to use the typedef. + (WebCore::AccessibilityObject::setAXObjectID): + Changed the argument type to use the typedef. + + * accessibility/AccessibilityRenderObject.cpp: + Removed some unneeded #includes. + (WebCore::AccessibilityRenderObject::focusedUIElement): + Moved the code to AXObjectCache::focusedUIElementForPage(), which we now + call. + + * accessibility/win/AXObjectCacheWin.cpp: + (WebCore::AXObjectCache::platformGenerateAXID): + Ensure that we generate an AXID that is in the range 1 to LONG_MAX. + (WebCore::AXObjectCache::handleFocusedUIElementChanged): + If the Document has no Page, return. If the Page has not focused + element (respecting accessibility), return. Assert that the + accessibility of the focused element is not ignored, and that the + object's AXID will be negative and fit into a LONG when negated. + Broadcast a focus event for the object. + + * dom/Document.cpp: + (WebCore::Document::axObjectCache): + Pass this when creating the AXObjectCache. + (WebCore::Document::setFocusedNode): + Call AXObjectCache::handleFocusedUIElementChanged() on Windows. + +2009-08-14 Jiahua Huang <jhuangjiahua@gmail.com> + + Reviewed by Jan Alonzo. + + [gtk] Pasteboard/GtkClipboard can't handle the "text/html" target. + https://bugs.webkit.org/show_bug.cgi?id=27028 + + Remove the improper set of enum WebKitWebViewTargetInfo + by grabbing the target infos via m_helper. + + * manual-tests/gtk/copy-htmltext.html: Added. + * platform/Pasteboard.h: + * platform/gtk/PasteboardGtk.cpp: + (WebCore::clipboard_get_contents_cb): + * platform/gtk/PasteboardHelper.h: + +2009-08-14 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt. + + Fix an assertion when bringing up the Inspector. + https://bugs.webkit.org/show_bug.cgi?id=28318 + + The fix for bug 28295 assumed that image clients count the number of times + addClient/removeClient is called. That was true for CachedResource clients, + but not StyleGeneratedImage clients, which pass the call onto CSSImageGeneratorValue. + + Fix by making CSSImageGeneratorValue count the number of times a client is + added/removed. + + * css/CSSCanvasValue.cpp: + (WebCore::CSSCanvasValue::canvasChanged): + (WebCore::CSSCanvasValue::canvasResized): + * css/CSSImageGeneratorValue.cpp: + (WebCore::CSSImageGeneratorValue::addClient): + (WebCore::CSSImageGeneratorValue::removeClient): + (WebCore::CSSImageGeneratorValue::getImage): + * css/CSSImageGeneratorValue.h: + +2009-08-14 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Kevin Ollivier. + + Correct libcurl crash when downloading local files. + https://bugs.webkit.org/show_bug.cgi?id=28312 + + No new tests. Test is covered by fast/encoding/char-encoding-mac.html. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::handleLocalReceiveResponse): New static function that + performs the local setting of valid URL and firing didReceiveResponse. + This code was moved from writeCallback. + (WebCore::writeCallback): Move local file handling to static function + (above) and use the function instead. + (WebCore::readCallback): Add check + for responseFired, and handle as a local file if it was not. + +2009-08-14 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Oliver Hunt. + + [Haiku] Fix RenderThemeHaiku build. + https://bugs.webkit.org/show_bug.cgi?id=28307 + + * platform/haiku/RenderThemeHaiku.cpp: Included RenderThemeHaiku.h + instead of RenderTheme.h. + (WebCore::RenderThemeHaiku::paintCheckbox): Removed the wrong 'virtual' + before the function. + (WebCore::RenderThemeHaiku::paintRadio): Removed the wrong 'virtual' + before the function. + * platform/haiku/RenderThemeHaiku.h: Corrected wrong function definitions. + +2009-08-14 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Oliver Hunt. + + [Haiku] Adding SharedBufferHaiku to WebCore. + https://bugs.webkit.org/show_bug.cgi?id=28309 + + * platform/haiku/SharedBufferHaiku.cpp: Added. + (WebCore::SharedBuffer::createWithContentsOfFile): + * platform/haiku/TemporaryLinkStubs.cpp: Removed unnecessary headers + and functions. + (WebCore::signedPublicKeyAndChallengeString): + (WebCore::getSupportedKeySizes): + +2009-08-14 Nate Chapin <japhet@chromium.org> + + Reviewed by Dimitri Glazkov. + + Ensure we're getting the right v8 context in the V8 DOMWindowEvent custom getter. + + https://bugs.webkit.org/show_bug.cgi?id=28311 + + This should fix Chromium failing LayoutTests/fast/events/set-event-in-another-frame.html. + + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_GETTER): + +2009-08-14 Aaron Boodman <aa@chromium.org> + + Reviewed by Alexey Proskuryakov. + + BUG 28134: Move the remaining parts of Access Control from XMLHttpRequest to ThreadableDocumentLoader. + https://bugs.webkit.org/show_bug.cgi?id=28134 + + No new tests added since Access Control was already well tested and this is a pure refactor. + + * loader/DocumentThreadableLoader.cpp: Move a lot of the access control code from XHR in, preserving its + basic strategy. Also, modify the synchronous path to not be a special case, but reuse more of the async + path. + + (WebCore::DocumentThreadableLoader::loadResourceSynchronously): Go through the async path and pass additional flags. + (WebCore::DocumentThreadableLoader::create): Group enum params into an options struct. + (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Ditto. + (WebCore::DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest): Brought mostly from XHR. + (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight): Ditto. + (WebCore::DocumentThreadableLoader::willSendRequest): Handle preflight case. + (WebCore::DocumentThreadableLoader::didReceiveResponse): Ditto. + (WebCore::DocumentThreadableLoader::didFinishLoading): Ditto. + (WebCore::DocumentThreadableLoader::getShouldUseCredentialStorage): Ditto. + (WebCore::DocumentThreadableLoader::preflightSuccess): Preflight handling. + (WebCore::DocumentThreadableLoader::preflightFailure): Ditto. + (WebCore::DocumentThreadableLoader::loadRequest): Common request function that handles async/sync. + * loader/DocumentThreadableLoader.h: Group enum params into an options struct. + * loader/ThreadableLoader.cpp: Ditto. + (WebCore::ThreadableLoader::create): Ditto. + (WebCore::ThreadableLoader::loadResourceSynchronously): Ditto. + * loader/ThreadableLoader.h: Ditto. + (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions): Ditto. + * loader/WorkerThreadableLoader.cpp: Ditto. + (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):Ditto. + (WebCore::WorkerThreadableLoader::loadResourceSynchronously): Ditto. + (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge): Ditto. + (WebCore::WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader): Ditto. + * loader/WorkerThreadableLoader.h: Ditto. + (WebCore::WorkerThreadableLoader::create): Ditto. + * platform/CrossThreadCopier.h: Allow ThreadableLoaderOptions to be copied across threads. + (WebCore::): + * workers/WorkerScriptLoader.cpp: More enum->struct grouping. + (WebCore::WorkerScriptLoader::loadSynchronously): More enum->struct grouping. + (WebCore::WorkerScriptLoader::loadAsynchronously): More enum->struct grouping. + * xml/XMLHttpRequest.cpp: Remove all the access control code and some supporting state. + (WebCore::XMLHttpRequest::XMLHttpRequest): Ditto. + (WebCore::XMLHttpRequest::createRequest): Ditto. + (WebCore::XMLHttpRequest::didFinishLoading): Ditto. + (WebCore::XMLHttpRequest::didReceiveResponse): Ditto. + (WebCore::XMLHttpRequest::didReceiveData): Ditto. + * xml/XMLHttpRequest.h: Ditto. + +2009-08-14 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Rename the confusing isObject(<class>) to inherits(<class>). + It still works on non-objects, returning false. + + * bindings/js/JSEventTarget.cpp: + (WebCore::toEventTarget): + * bindings/js/JSGeolocationCustom.cpp: + (WebCore::createPositionCallback): + (WebCore::createPositionErrorCallback): + * bindings/js/JSNodeFilterCustom.cpp: + (WebCore::toNodeFilter): + * bindings/js/JSXMLHttpRequestCustom.cpp: + (WebCore::JSXMLHttpRequest::send): + * bindings/js/JSXSLTProcessorCustom.cpp: + (WebCore::JSXSLTProcessor::importStylesheet): + (WebCore::JSXSLTProcessor::transformToFragment): + (WebCore::JSXSLTProcessor::transformToDocument): + * bindings/scripts/CodeGeneratorJS.pm: + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::callObjCFallbackObject): + * bridge/runtime_method.cpp: + (JSC::callRuntimeMethod): + Updated to new name, inherits, from old name, isObject. + +2009-08-14 Yael Aharon <yael.aharon@nokia.com> + + Reviewed by Simon Hausmann. + + Allow Qt API to list and to remove URL schemes that were registered as + local URL schemes. + [Qt] Allow applications to register their own local URL scheme. + https://bugs.webkit.org/show_bug.cgi?id=28240 + + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::removeURLSchemeRegisteredAsLocal): + (WebCore::SecurityOrigin::localURLSchemes): + * page/SecurityOrigin.h: + +2009-08-14 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Wrap console objects late (in the frontend) so that injected + script was already in place. + + https://bugs.webkit.org/show_bug.cgi?id=28297 + + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::ConsoleMessage): + * inspector/ConsoleMessage.h: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::addMessageToConsole): + (WebCore::InspectorController::startGroup): + (WebCore::InspectorController::setFrontendProxyObject): + * inspector/InspectorController.h: + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::InspectorFrontend): + (WebCore::InspectorFrontend::addMessageToConsole): + * inspector/InspectorFrontend.h: + +2009-08-13 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fix logic in RenderObject::updateFillImages() that led to incorrect client + counts if an image was used twice in the background-image property. + https://bugs.webkit.org/show_bug.cgi?id=28295 + + Test: fast/backgrounds/multiple-backgrounds-assert.html + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::updateFillImages): + Simplify the logic to call addClient()/removeClient() for every background + image, but go through the new layers first to avoid removing all the + clients of an image. + +2009-08-13 Oliver Hunt <oliver@apple.com> + + Reviewed by Maciej Stachowiak. + + Devirtualise marking + https://bugs.webkit.org/show_bug.cgi?id=28294 + + Make sure we override the JSObject createStructure method on those + objects that have custom marking routines. + + * bindings/scripts/CodeGeneratorJS.pm: + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by Mark Rowe. + + Follow-up to earlier work to remove dependencies on JavaScriptCore. + + * ForwardingHeaders/parser/Parser.h: Removed. + * inspector/JavaScriptDebugServer.cpp: Removed now-unneeded includes + of Parser.h. + +2009-08-13 Dan Bernstein <mitz@apple.com> + + Reviewed by Eric Seidel. + + 'box-orient: block-axis' behaves like 'box-orient: horizontal', causes + an assertion failure in debug builds + https://bugs.webkit.org/show_bug.cgi?id=28279 + + Test: fast/flexbox/block-axis.html + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::operator EBoxOrient): Map block-axis to + vertical. + +2009-08-13 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dan Bernstein. + + Fix crash when removing reflection on an absolutely-positioned image. + https://bugs.webkit.org/show_bug.cgi?id=28289 + + Make sure we clean up the reflection layer when removing the reflection, + so that the RenderLayer tree does not contain pointers to deleted layers. + + Test: fast/reflections/reflected-img-crash.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::~RenderLayer): + (WebCore::RenderLayer::styleChanged): + (WebCore::RenderLayer::removeReflection): + * rendering/RenderLayer.h: + +2009-08-13 Dan Bernstein <mitz@apple.com> + + Reviewed by Simon Fraser. + + misalignment because of float:left of <div> tag + https://bugs.webkit.org/show_bug.cgi?id=15869 + + One section of http://edgar.sec.gov site draws to the right of the rest + of the content + <rdar://problem/7135951> + + Tests: fast/block/float/avoidance-percent-width-compat.html + fast/block/float/avoidance-percent-width-strict.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::getClearDelta): Changed to apply the same float + avoidance logic in strict mode and in compatibility mode, which + matches Firefox and IE. Changed to compute and use the computed + width of the child, instead of ignoring non-fixed widths. + +2009-08-13 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Geolocation PositionOptions does not use correct default values. + https://bugs.webkit.org/show_bug.cgi?id=27254 + + Sets the correct default values for the properties of the PositionOptions object + passed to Geolocation methods. See http://www.w3.org/TR/geolocation-API/. + + Also adds checking to throw an exception if arguments of the incorrect type are + passed to Geolocation methods. Adds a layout test to test this. This test should + pass on all platforms where Geolocation is implemented. + + Test: fast/dom/Geolocation/argument-types.html + + * bindings/js/JSGeolocationCustom.cpp: + (WebCore::createPositionCallback): Added. Creates the callback. + (WebCore::createPositionErrorCallback): Added. Creates the calback. + (WebCore::createPositionOptions): Added. Creates the PositionOptions object, setting defaults where required. + (WebCore::JSGeolocation::getCurrentPosition): Modified. Now uses above helper functions. + (WebCore::JSGeolocation::watchPosition): Modified. Now uses above helper functions. + * page/Geolocation.cpp: + (WebCore::Geolocation::GeoNotifier::GeoNotifier): Modified. Asserts that PositionOptions object is present. + (WebCore::Geolocation::GeoNotifier::startTimer): Modified. Only starts timer if timeout has been set. + * page/PositionOptions.h: + (WebCore::PositionOptions::create): Modified. Creates object with default values. + (WebCore::PositionOptions::timeout): Modified. Uses correct type. + (WebCore::PositionOptions::hasTimeout): Added. Determines whether a timeout has been set. + (WebCore::PositionOptions::setTimeout): Modified. Uses correct type. + (WebCore::PositionOptions::maximumAge): Modified. Uses correct type. + (WebCore::PositionOptions::setMaximumAge): Modified. Uses correct type. + (WebCore::PositionOptions::PositionOptions): Modified. Creates object with default values. + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed chromium build fix. + + [Chromium] Let CodeGeneratorV8.pm know that RGBColor is ref-counted. + + * bindings/scripts/CodeGeneratorV8.pm: + +2009-08-13 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Merge error in SharedWorker code + https://bugs.webkit.org/show_bug.cgi?id=28277 + + Fixed merge error that prevents WebKit from compiling with SHARED_WORKERS enabled. + No new tests needed. + + * workers/DefaultSharedWorkerRepository.cpp: + Removed duplicated functions. + +2009-08-13 Kyle Prete <kylep@chromium.org> + + Reviewed by Dave Levin. + + Chromium: Show a "Playback Disabled" button on media error. + https://bugs.webkit.org/show_bug.cgi?id=28196 + Use a disabled play button when the media file cannot be played. + + No new tests needed. Covered by LayoutTests/media/video-empty-source.html + + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::paintMediaPlayButton): + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Try and fix the Qt build. + + * bridge/qt/qt_runtime.cpp: + +2009-08-13 Zan Dobersek <zandobersek@gmail.com> + + Reviewed by Gustavo Noronha. + + [GTK] Drag and drop support + https://bugs.webkit.org/show_bug.cgi?id=23642 + + Utilizes functions that are being called upon drag and drop actions. + Uses different GTK clipboards that hold different types + of drag data - images, HTML markup, text, URL, URL label. + Also clears each clipboard before setting new data to it. + + No new tests - despite some implementations, no new functionality + is added until implementations of the GTK drag and drop protocol + in WebKit part. + + * platform/gtk/ClipboardGtk.cpp: + (WebCore::ClipboardGtk::ClipboardGtk): + (WebCore::ClipboardGtk::~ClipboardGtk): + (WebCore::getCachedImage): + (WebCore::ClipboardGtk::declareAndWriteDragImage): + (WebCore::ClipboardGtk::writeURL): + (WebCore::ClipboardGtk::writeRange): + * platform/gtk/ClipboardGtk.h: ClipboardGdk -> ClipboardGtk + +2009-08-13 Darin Adler <darin@apple.com> + + Reviewed by David Levin. + + JavaScriptCore tweaks to get ready for the parser arena + https://bugs.webkit.org/show_bug.cgi?id=28243 + + * ForwardingHeaders/runtime/CollectorHeapIterator.h: Removed. + + * WebCore.xcodeproj/project.pbxproj: Exposed a couple header + files as Private that are now needed to compile Mac WebKit. + + * bindings/js/JSAudioConstructor.cpp: + * bindings/js/JSDOMBinding.cpp: + * bindings/js/JSDOMBinding.h: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSHTMLInputElementCustom.cpp: + * bindings/js/JSHistoryCustom.cpp: + * bindings/js/JSImageConstructor.cpp: + * bindings/js/JSLazyEventListener.cpp: + * bindings/js/JSLocationCustom.cpp: + * bindings/js/JSMessageChannelConstructor.cpp: + * bindings/js/JSOptionConstructor.cpp: + * bindings/js/JSWebSocketConstructor.cpp: + * bindings/js/JSWebSocketCustom.cpp: + * bindings/js/JSWorkerConstructor.cpp: + * bindings/js/JSXMLHttpRequestConstructor.cpp: + * bridge/jni/jni_jsobject.mm: + Updated includes. + + * inspector/JavaScriptDebugServer.cpp: + (WebCore::JavaScriptDebugServer::sourceParsed): + Change to not assert if this is called with no listeners. + I don't think this was guaranteed before, and we now use + this code path when recompiling. Slightly less efficient, + but this is a one-time cost when turning on the debugger. + (WebCore::JavaScriptDebugServer::recompileAllJSFunctions): + Change to call Debugger::recompileAllJSFunctions. + +2009-08-13 Brady Eidson <beidson@apple.com> + + Reviewed by Eric Seidel. + + <rdar://problem/7138591> and https://bugs.webkit.org/show_bug.cgi?id=28260 + onhashchange property cannot be set from javascript. + + Test: fast/loader/onhashchange-attribute-listeners.html + + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::onhashchange): + (WebCore::HTMLBodyElement::setOnhashchange): + * html/HTMLBodyElement.h: + * html/HTMLBodyElement.idl: + + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::onhashchange): + (WebCore::HTMLFrameSetElement::setOnhashchange): + * html/HTMLFrameSetElement.h: + * html/HTMLFrameSetElement.idl: + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::onhashchange): + (WebCore::DOMWindow::setOnhashchange): + * page/DOMWindow.h: + * page/DOMWindow.idl: + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Reviewed by Geoff Garen. + + Fix leaks of RGBColor instances from below SVGColor::rgbColor. + + * svg/SVGColor.cpp: + (WebCore::SVGColor::rgbColor): Return a PassRefPtr to ensure that the newly-allocated + RGBColor is cleaned up by the caller. + * svg/SVGColor.h: + +2009-08-13 Pavel Feldman <pfeldman@chromium.org> + + Reviewed by Timothy Hatcher. + + WebInspector: Migrate to DOMAgent (serialized access to DOM). + + https://bugs.webkit.org/show_bug.cgi?id=28177 + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::highlightDOMNode): + (WebCore::JSInspectorBackend::nodeForId): + (WebCore::JSInspectorBackend::idForNode): + (WebCore::JSInspectorBackend::wrapObject): + (WebCore::JSInspectorBackend::unwrapObject): + (WebCore::JSInspectorBackend::pushNodePathToFrontend): + (WebCore::JSInspectorBackend::selectDatabase): + (WebCore::JSInspectorBackend::selectDOMStorage): + * bindings/js/ScriptObjectQuarantine.cpp: + (WebCore::getQuarantinedScriptObject): + * bindings/js/ScriptObjectQuarantine.h: + * bindings/js/ScriptValue.cpp: + (WebCore::ScriptValue::isObject): + * bindings/js/ScriptValue.h: + * bindings/v8/ScriptObjectQuarantine.cpp: + (WebCore::getQuarantinedScriptObject): + * bindings/v8/ScriptObjectQuarantine.h: + * bindings/v8/ScriptValue.h: + (WebCore::ScriptValue::isObject): + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL): + * inspector/ConsoleMessage.cpp: + (WebCore::ConsoleMessage::ConsoleMessage): + * inspector/ConsoleMessage.h: + * inspector/InspectorBackend.cpp: + (WebCore::InspectorBackend::clearMessages): + (WebCore::InspectorBackend::loaded): + (WebCore::InspectorBackend::highlight): + (WebCore::InspectorBackend::nodeForId): + (WebCore::InspectorBackend::idForNode): + (WebCore::InspectorBackend::wrapObject): + (WebCore::InspectorBackend::unwrapObject): + (WebCore::InspectorBackend::pushNodePathToFrontend): + (WebCore::InspectorBackend::addNodesToSearchResult): + (WebCore::InspectorBackend::selectDatabase): + (WebCore::InspectorBackend::selectDOMStorage): + * inspector/InspectorBackend.h: + * inspector/InspectorBackend.idl: + * inspector/InspectorController.cpp: + (WebCore::InspectorController::InspectorController): + (WebCore::InspectorController::focusNode): + (WebCore::InspectorController::addMessageToConsole): + (WebCore::InspectorController::clearConsoleMessages): + (WebCore::InspectorController::startGroup): + (WebCore::InspectorController::scriptObjectReady): + (WebCore::InspectorController::setFrontendProxyObject): + (WebCore::InspectorController::close): + (WebCore::InspectorController::didCommitLoad): + (WebCore::InspectorController::wrapObject): + (WebCore::InspectorController::unwrapObject): + * inspector/InspectorController.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setDocument): + (WebCore::InspectorDOMAgent::handleEvent): + (WebCore::InspectorDOMAgent::pushDocumentToFrontend): + (WebCore::InspectorDOMAgent::pushChildNodesToFrontend): + (WebCore::InspectorDOMAgent::nodeForId): + (WebCore::InspectorDOMAgent::pushNodePathToFrontend): + (WebCore::InspectorDOMAgent::buildObjectForNode): + (WebCore::InspectorDOMAgent::buildArrayForContainerChildren): + (WebCore::InspectorDOMAgent::innerParentElement): + * inspector/InspectorDOMAgent.h: + * inspector/InspectorDOMStorageResource.cpp: + (WebCore::InspectorDOMStorageResource::bind): + * inspector/InspectorFrontend.cpp: + (WebCore::InspectorFrontend::clearConsoleMessages): + (WebCore::InspectorFrontend::updateFocusedNode): + (WebCore::InspectorFrontend::setDocument): + (WebCore::InspectorFrontend::selectDatabase): + (WebCore::InspectorFrontend::selectDOMStorage): + (WebCore::InspectorFrontend::addNodesToSearchResult): + * inspector/InspectorFrontend.h: + * inspector/front-end/ConsoleView.js: + (WebInspector.ConsoleView.prototype.clearMessages): + (WebInspector.ConsoleView.prototype.completions): + (WebInspector.ConsoleView.prototype._reportCompletions): + (WebInspector.ConsoleView.prototype._messagesClicked): + (WebInspector.ConsoleView.prototype.doEvalInWindow.evalCallback): + (WebInspector.ConsoleView.prototype.doEvalInWindow): + (WebInspector.ConsoleView.prototype._format): + (WebInspector.ConsoleView.prototype._formatfunction): + (WebInspector.ConsoleView.prototype._formatdate): + (WebInspector.ConsoleView.prototype._formatregexp): + (WebInspector.ConsoleView.prototype._formatnode): + (WebInspector.ConsoleView.prototype._formatobject): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode): + (WebInspector.DOMNode.prototype._renumber): + (WebInspector.DOMDocument): + (WebInspector.DOMAgent): + (WebInspector.DOMAgent.prototype.getChildNodesAsync): + (WebInspector.DOMAgent.prototype.setAttributeAsync): + (WebInspector.DOMAgent.prototype.removeAttributeAsync): + (WebInspector.DOMAgent.prototype.setTextNodeValueAsync): + (WebInspector.DOMAgent.prototype.nodeForId): + (WebInspector.DOMAgent.prototype._setDocument): + (WebInspector.DOMAgent.prototype._setChildNodes): + (WebInspector.DOMAgent.prototype._bindNodes): + (WebInspector.DOMAgent.prototype._childNodeInserted): + (WebInspector.CSSStyleDeclaration): + (WebInspector.CSSStyleDeclaration.parseRule): + (WebInspector.setDocument): + (InspectorController.getStyles): + (InspectorController.getComputedStyle): + (InspectorController.getInlineStyle): + (InspectorController.applyStyleText): + (InspectorController.setStyleText): + (InspectorController.toggleStyleEnabled): + (InspectorController.applyStyleRuleText): + (InspectorController.addStyleSelector): + (InspectorController.setStyleProperty): + (InspectorController.getPrototypes): + (InspectorController.getProperties): + (InspectorController.setPropertyValue): + (InspectorController.evaluate): + (InspectorController.addInspectedNode): + (InspectorController.performSearch): + (InspectorController.searchCanceled): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): + (WebInspector.ElementsPanel.prototype.searchCanceled): + (WebInspector.ElementsPanel.prototype.performSearch): + (WebInspector.ElementsPanel.prototype._updateMatchesCount): + (WebInspector.ElementsPanel.prototype._updateMatchesCountSoon): + (WebInspector.ElementsPanel.prototype.addNodesToSearchResult): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode.restoreHighlightToHoveredNode): + (WebInspector.ElementsTreeOutline.prototype.set focusedDOMNode): + (WebInspector.ElementsTreeElement.prototype.updateChildren): + (WebInspector.ElementsTreeElement.prototype._attributeEditingCommitted): + * inspector/front-end/InjectedScript.js: + (InjectedScript.applyStyleRuleText): + (InjectedScript.addStyleSelector): + (InjectedScript._doesSelectorAffectNode): + (InjectedScript._serializeRule): + (InjectedScript._serializeStyle): + (InjectedScript.getProperties): + (InjectedScript.evaluate): + (InjectedScript.addInspectedNode): + (InjectedScript.performSearch.addNodesToResults): + (InjectedScript.performSearch.matchExactItems): + (InjectedScript.performSearch.matchExactId.addNodesToResults.call): + (InjectedScript.performSearch.matchExactId): + (InjectedScript.performSearch): + (InjectedScript.performSearch.matchExactTagNames): + (InjectedScript.performSearch.matchExactAttributeNames): + (InjectedScript.performSearch.matchPartialTagNames): + (InjectedScript.performSearch.matchStartOfTagNames): + (InjectedScript.performSearch.matchPartialTagNamesAndAttributeValues): + (InjectedScript.performSearch.matchPartialAttributeValues): + (InjectedScript.performSearch.matchStyleSelector): + (InjectedScript.performSearch.matchPlainText): + (InjectedScript.performSearch.matchXPathQuery): + (InjectedScript.performSearch.finishedSearching): + (InjectedScript.performSearch.processChunk): + (InjectedScript.searchCanceled): + (InjectedScript._ensureCommandLineAPIInstalled.inspectObject): + (InjectedScript._ensureCommandLineAPIInstalled): + (InjectedScript._resolveObject): + (InjectedScript._nodeForId): + (InjectedScript._objectForId): + (InjectedScript._createProxyObject): + * inspector/front-end/ObjectPropertiesSection.js: + (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate): + (WebInspector.ObjectPropertyTreeElement.prototype.update): + * inspector/front-end/ObjectProxy.js: + (WebInspector.ObjectProxy): + (WebInspector.ObjectPropertyProxy): + * inspector/front-end/PropertiesSidebarPane.js: + (WebInspector.PropertiesSidebarPane.prototype.update.callback): + (WebInspector.PropertiesSidebarPane.prototype.update): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype.update.callback): + (WebInspector.StylesSidebarPane.prototype.update): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted): + (WebInspector.StylePropertiesSection.prototype.editingSelectorCancelled): + (WebInspector.BlankStylePropertiesSection.prototype.editingCommitted.callback): + (WebInspector.BlankStylePropertiesSection.prototype.editingCommitted): + (WebInspector.StylePropertyTreeElement.prototype): + * inspector/front-end/inspector.js: + (WebInspector._updateHoverHighlight): + (WebInspector.loaded): + (WebInspector.clearConsoleMessages): + (WebInspector.selectDatabase): + (WebInspector.selectDOMStorage): + (WebInspector.updateFocusedNode): + (WebInspector.addNodesToSearchResult): + * inspector/front-end/utilities.js: + (Object.proxyType): + * storage/Storage.h: + (WebCore::Storage::frame): + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Reviewed by Geoff Garen. + + Fix leaks of RGBColor instances from below CSSPrimitiveValue::getRGBColorValue. + + * css/CSSPrimitiveValue.cpp: + (WebCore::CSSPrimitiveValue::getRGBColorValue): Return a PassRefPtr to ensure that the + newly-allocated RGBColor is cleaned up by the caller. + * css/CSSPrimitiveValue.h: + +2009-08-13 Eric Seidel <eric@webkit.org> + + Reviewed by David Hyatt. + + wrong font size when css font-family includes monospace + https://bugs.webkit.org/show_bug.cgi?id=19161 + + Firefox only uses fixed-width default size for exactly "font-family: monospace;". + WebKit has historically used fixed-width default size any time a + font-family includes monospace in the fallback list. + + This patch corrects WebKit's behavior to match Firefox. + I also had to fix a bug in WebKit's font-family fallback behavior where + child elements would inherit parts of their parents fallback lists. + + This patch is mostly just replacing all cases where we used to check for: + fontDescription.genericFontFamily() == MonospaceFamily + with: + fontDescription.useFixedDefaultSize() + + Tests: fast/css/getComputedStyle/computed-style-font-family-monospace.html + fast/css/getComputedStyle/font-family-fallback-reset.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + Deploy useFixedDefaultSize(). Also fix the bug where child + FontDescriptions would carry part of the parent font-family fallback list. + (WebCore::CSSStyleSelector::checkForGenericFamilyChange): + It's no longer alright to just check genericFontFamily(), + we have to check to make sure the changed style has a matching useFixedDefaultSize(). + * platform/graphics/FontDescription.h: + (WebCore::FontDescription::useFixedDefaultSize): + Only use the fixed default size if we have one font family and it is "monospace". + "-webkit-monospace" is the internal representation of the CSS identifier "monospace". + +2009-08-13 Christian Plesner Hansen <christian.plesner.hansen@gmail.com> + + Reviewed by Dimitri Glazkov. + + [v8] Fix atomic string externalization crash. + Atomic string externalization assumes that all non-empty strings + can be externalized which is untrue on 64-bit. This change fixed + that. + + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This bug causes loads of test crashes, no need to add new tests + specifically for this. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-13 George Staikos <george.staikos@torchmobile.com> + + Rubberstamped by Darin Adler. + + Use ASSERT_UNUSED instead of UNUSED_PARAM + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::deregisterTask): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::deregisterTask): + +2009-08-13 Steve Block <steveblock@google.com> + + Reviewed by Darin Adler. + + Fixes a couple of bugs in SecurityOrigin::createFromDatabaseIdentifier. + https://bugs.webkit.org/show_bug.cgi?id=28262 + + No new tests possible. + + * page/SecurityOrigin.cpp: + (WebCore::SecurityOrigin::createFromDatabaseIdentifier): + +2009-08-13 Dirk Schulze <krit@webkit.org> + + Reviewed by Eric Seidel. + + [CAIRO] getImageData fails on a given rect bigger than the image rect + + The destination image and the source image was mixed up on creating the + imageData. + + This is just a clean up and doesn't affect the current behavior. It's not + possible to test this failure in a LayoutTest. Only canvas uses getImageData + at the moment and returns before calling getImageData, if the image rect does + not contain the requested rect. + + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::getImageData): + +2009-08-13 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding RenderTheme to WebCore. + https://bugs.webkit.org/show_bug.cgi?id=28258 + + * platform/haiku/RenderThemeHaiku.cpp: Added. + (WebCore::RenderThemeHaiku::create): + (WebCore::RenderTheme::themeForPage): + (WebCore::RenderThemeHaiku::RenderThemeHaiku): + (WebCore::RenderThemeHaiku::~RenderThemeHaiku): + (WebCore::supportsFocus): + (WebCore::RenderThemeHaiku::supportsFocusRing): + (WebCore::RenderThemeHaiku::platformActiveSelectionBackgroundColor): + (WebCore::RenderThemeHaiku::platformInactiveSelectionBackgroundColor): + (WebCore::RenderThemeHaiku::platformActiveSelectionForegroundColor): + (WebCore::RenderThemeHaiku::platformInactiveSelectionForegroundColor): + (WebCore::RenderThemeHaiku::platformTextSearchHighlightColor): + (WebCore::RenderThemeHaiku::systemFont): + (WebCore::RenderThemeHaiku::paintCheckbox): + (WebCore::RenderThemeHaiku::setCheckboxSize): + (WebCore::RenderThemeHaiku::paintRadio): + (WebCore::RenderThemeHaiku::setRadioSize): + (WebCore::RenderThemeHaiku::adjustMenuListStyle): + (WebCore::RenderThemeHaiku::paintMenuList): + * platform/haiku/RenderThemeHaiku.h: Added. + (WebCore::RenderThemeHaiku::supportsHover): + +2009-08-13 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Remove the "m_point" code from ContextMenuHaiku.cpp + https://bugs.webkit.org/show_bug.cgi?id=28256 + + * platform/haiku/ContextMenuHaiku.cpp: + (WebCore::ContextMenuReceiver::ContextMenuReceiver): + (WebCore::ContextMenu::ContextMenu): + (WebCore::ContextMenu::appendItem): + (WebCore::ContextMenu::insertItem): + +2009-08-13 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Darin Adler. + + Inspector: Show Hidden Cookie Data + https://bugs.webkit.org/show_bug.cgi?id=28185 + + Added new file Cookie.h to the WebCore XCode + + * WebCore.xcodeproj/project.pbxproj: + + InspectorController.cookies() binding + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + * inspector/InspectorBackend.idl: + + Struct for static Cookie information + (name, value, path, domain, expires, httpOnly, secure, session) + + * platform/Cookie.h: Added. + (WebCore::Cookie::Cookie): + + Getter for the a list of raw Cookies + getRawCookies(., ., out Vector<Cookie>) + + * platform/CookieJar.h: + + Implementation of getRawCookies for the mac platform. + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + + Stub other CookieJar implementations to satisfy the interface. + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + +2009-08-13 Patrick Mueller <Patrick_Mueller@us.ibm.com> + + Reviewed by Timothy Hatcher. + + Add a new gesture in Web Inspector to remove breakpoints + https://bugs.webkit.org/show_bug.cgi?id=19131 + + * inspector/front-end/SourceFrame.js: + (WebInspector.SourceFrame.prototype._documentMouseDown): + +2009-08-13 Norbert Leser <norbert.leser@nokia.com> + + Reviewed by Simon Hausmann. + + Symbian target components (library and executable files) + require Unique Identifiers (i.e., UID3). + These identifiers are defined in the respective project + file, conditionally for "symbian" platform. + + * WebCore.pro: + +2009-08-13 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Eric Seidel. + + wrong calculation of overflow size for flexbox and table + https://bugs.webkit.org/show_bug.cgi?id=28064 + + RenderFlexibleBox and RenderTable were using the width of overflow + to update height of overflow, so height became wrong value and + width was not updated. As the corresponding code of RenderBlock + was sane, I factored it out and used from RenderFlexibleBox and + RenderTable. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::updateOverflowWithShadowAndReflection): created from code of layoutBlock + (WebCore::RenderBlock::layoutBlock): + * rendering/RenderBlock.h: + * rendering/RenderFlexibleBox.cpp: use updateOverflowWithShadowAndReflection + (WebCore::RenderFlexibleBox::layoutBlock): + * rendering/RenderTable.cpp: + (WebCore::RenderTable::layout): use updateOverflowWithShadowAndReflection + +2009-08-13 Mark Rowe <mrowe@apple.com> + + Revert r47185, the fix for <https://bugs.webkit.org/show_bug.cgi?id=28185>, as it broke the + Windows build in a non-obvious manner. + + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSInspectorBackendCustom.cpp: + * inspector/InspectorBackend.idl: + * platform/Cookie.h: Removed. + * platform/CookieJar.h: + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::setCookies): + (WebCore::cookies): + * platform/mac/CookieJar.mm: + * platform/network/chromium/CookieJarChromium.cpp: + * platform/network/curl/CookieJarCurl.cpp: + * platform/network/soup/CookieJarSoup.cpp: + * platform/network/win/CookieJarCFNetWin.cpp: + * platform/network/win/CookieJarWin.cpp: + * platform/qt/CookieJarQt.cpp: + +2009-08-13 Ariya Hidayat <ariya.hidayat@nokia.com> + + Not reviewed: build fix (for r47192), adding new file from + https://bugs.webkit.org/show_bug.cgi?id=28174 + + * inspector/front-end/StatusBarButton.js: Added. + +2009-08-13 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Timothy Hatcher. + + Introduced StatusBarButton class that encapsulates glyphs support. + Views updated accordingly. + + https://bugs.webkit.org/show_bug.cgi?id=28174 + + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * inspector/front-end/CookieItemsView.js: + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): Updated to retrieve DOM element from StatusBarButton instance (here and in similar getters below.) + (WebInspector.CookieItemsView.prototype.hide): + (WebInspector.CookieItemsView.prototype.update): + * inspector/front-end/DOMStorageItemsView.js: + (WebInspector.DOMStorageItemsView): + (WebInspector.DOMStorageItemsView.prototype.get statusBarItems): + (WebInspector.DOMStorageItemsView.prototype.hide): + (WebInspector.DOMStorageItemsView.prototype.update): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel): + (WebInspector.ElementsPanel.prototype.get statusBarItems): + (WebInspector.ElementsPanel.prototype.hide): + (WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked): + * inspector/front-end/Panel.js: + * inspector/front-end/ProfileView.js: + (WebInspector.ProfileView): + (WebInspector.ProfileView.prototype.get statusBarItems): + (WebInspector.ProfileView.prototype._updatePercentButton): + (WebInspector.ProfileView.prototype._focusClicked): + (WebInspector.ProfileView.prototype._excludeClicked): + (WebInspector.ProfileView.prototype._resetClicked): + * inspector/front-end/ProfilesPanel.js: + (WebInspector.ProfilesPanel): + (WebInspector.ProfilesPanel.prototype.get statusBarItems): + (WebInspector.ProfilesPanel.prototype.setRecordingProfile): + (WebInspector.ProfilesPanel.prototype._updateInterface): + * inspector/front-end/ResourcesPanel.js: + (WebInspector.ResourcesPanel.prototype.get statusBarItems): + (WebInspector.ResourcesPanel.prototype.reset): + (WebInspector.ResourcesPanel.prototype._toggleLargerResources): + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel): + (WebInspector.ScriptsPanel.prototype.get statusBarItems): + (WebInspector.ScriptsPanel.prototype._updatePauseOnExceptionsButton): + (WebInspector.ScriptsPanel.prototype._updateDebuggerButtons): + * inspector/front-end/StatusBarButton.js: Added. + (WebInspector.StatusBarButton): + (WebInspector.StatusBarButton.prototype._clicked): + (WebInspector.StatusBarButton.prototype.get disabled): + (WebInspector.StatusBarButton.prototype.set disabled): + (WebInspector.StatusBarButton.prototype.get title): + (WebInspector.StatusBarButton.prototype.set title): + (WebInspector.StatusBarButton.prototype.get toggled): + (WebInspector.StatusBarButton.prototype.set toggled): + (WebInspector.StatusBarButton.prototype.get visible): + (WebInspector.StatusBarButton.prototype.set visible): + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.css: For uniformity, class names are always used to identify status bar buttons. Also, fixed "Reload" button style to use glyphs. + * inspector/front-end/inspector.html: + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] Add shadow support in GraphicsContext::fillRect(). + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::fillRect): Paint shadow if necessary. + (WebCore::GraphicsContext::setPlatformShadow): Inverse y offset. + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed build fix for Chromium Linux. + + Rollback r47157 as this broke debug tests of Chromium Linux. + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-13 David Levin <levin@chromium.org> + + Unreviewed build fix for chromium. + + The chromium build broke due to r47185 which added + a cookies array to inspector/InspectorBackend.idl. + + * bindings/v8/custom/V8CustomBinding.h: Added the declaration for the cookies callback. + * bindings/v8/custom/V8InspectorBackendCustom.cpp: + (WebCore::CALLBACK_FUNC_DECL(InspectorBackendCookies)): Stubbed out an implementation + for the cookies callback. + +2009-08-12 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Show Hidden Cookie Data + https://bugs.webkit.org/show_bug.cgi?id=28185 + + Added new file Cookie.h to the WebCore XCode + + * WebCore.xcodeproj/project.pbxproj: + + InspectorController.cookies() binding + + * bindings/js/JSInspectorBackendCustom.cpp: + (WebCore::JSInspectorBackend::cookies): + * inspector/InspectorBackend.idl: + + Struct for static Cookie information + (name, value, path, domain, expires, httpOnly, secure, session) + + * platform/Cookie.h: Added. + (WebCore::Cookie::Cookie): + + Getter for the a list of raw Cookies + getRawCookies(., ., out Vector<Cookie>) + + * platform/CookieJar.h: + + Implementation of getRawCookies for the mac platform. + + * platform/mac/CookieJar.mm: + (WebCore::getRawCookies): + + Stub other CookieJar implementations to satisfy the interface. + + * platform/haiku/CookieJarHaiku.cpp: + (WebCore::getRawCookies): + * platform/network/chromium/CookieJarChromium.cpp: + (WebCore::getRawCookies): + * platform/network/curl/CookieJarCurl.cpp: + (WebCore::getRawCookies): + * platform/network/soup/CookieJarSoup.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarCFNetWin.cpp: + (WebCore::getRawCookies): + * platform/network/win/CookieJarWin.cpp: + (WebCore::getRawCookies): + * platform/qt/CookieJarQt.cpp: + (WebCore::getRawCookies): + +2009-08-08 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Cookies in Storage Panel + https://bugs.webkit.org/show_bug.cgi?id=27202 + + Data Structure for a Cookie. Just Key/Value for Now: + + * inspector/front-end/Cookie.js: Added. + (WebInspector.Cookie): + (WebInspector.Cookie.prototype.get key): + (WebInspector.Cookie.prototype.set key): + (WebInspector.Cookie.prototype.get value): + (WebInspector.Cookie.prototype.set value): + + A Storage View for Cookies. Allows for Refresh/Delete: + + * inspector/front-end/CookieItemsView.js: Added. + (WebInspector.CookieItemsView): + (WebInspector.CookieItemsView.prototype.get statusBarItems): refresh and delete buttons + (WebInspector.CookieItemsView.prototype.show): + (WebInspector.CookieItemsView.prototype.hide): + (WebInspector.CookieItemsView.prototype.update): + (WebInspector.CookieItemsView.prototype.buildCookies): parses the inspected window's document.cookie string + (WebInspector.CookieItemsView.prototype.dataGridForCookies): creates a datagrid for cookies + (WebInspector.CookieItemsView.prototype._deleteButtonClicked): attempt at deleting the cookie (not flawless) + (WebInspector.CookieItemsView.prototype._refreshButtonClicked): rebuild the datagrid + + Include a SidebarSection Section in the Databases Panel: + + * inspector/front-end/DatabasesPanel.js: + (WebInspector.DatabasesPanel): + (WebInspector.DatabasesPanel.prototype.show): calls populateInterface + (WebInspector.DatabasesPanel.prototype.populateInterface): adds cookies if they don't exist + (WebInspector.DatabasesPanel.prototype.reset): remove cookie specific parts + (WebInspector.DatabasesPanel.prototype.addCookies): add cookies sidebar tree element + (WebInspector.DatabasesPanel.prototype.showCookies): sets the visible view to a CookiesItemView + (WebInspector.CookieSidebarTreeElement): + (WebInspector.CookieSidebarTreeElement.prototype.onselect): + (WebInspector.CookieSidebarTreeElement.prototype.get mainTitle): just "Cookies" at the moment + (WebInspector.CookieSidebarTreeElement.prototype.set mainTitle): + (WebInspector.CookieSidebarTreeElement.prototype.get subtitle): no subtitle yet + (WebInspector.CookieSidebarTreeElement.prototype.set subtitle): + + New "Cookies" Image for the Sidebar: + + * inspector/front-end/Images/cookie.png: Added. + * inspector/front-end/inspector.css: + + Include the Added Files where appropriate: + + * inspector/front-end/WebKit.qrc: + * inspector/front-end/inspector.html: + +2009-08-12 George Wright <george.wright@torchmobile.com> + + Reviewed by George Staikos. + + Add SQLTransactionCoordinator.[h,cpp] to WebCore.pro. + + https://bugs.webkit.org/show_bug.cgi?id=28246 + + * WebCore.pro: + +2009-08-12 George Staikos <george.staikos@torchmobile.com> + + Reviewed by Adam Treat. + + Mark unused variables to avoid compile failures in -Werror. + + * wml/WMLAnchorElement.cpp: + (WebCore::WMLAnchorElement::deregisterTask): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::deregisterTask): + +2009-08-12 Charles Wei <charles.wei@torchmobile.com.cn> + + Reviewed by Niko Zimmermann. + + This is to add WCSS marquee support , which is defined by OMA and is an extension for CSS2, + It extends CSS display with "display:-wap-marquee;-wap-marquee-dir:xxx;-wap-marquee-speed:xxx;-wap-marquee-style:xxx" + Minor fixes by Eric Seidel and George Staikos. + https://bugs.webkit.org/show_bug.cgi?id=23727 + + No new tests, the tests have already been landed at LayoutTests/fast/wcss/ + + * WebCore.pro: + * css/CSSParser.cpp: + (WebCore::CSSParser::parseValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::applyProperty): + * css/CSSValueKeywords.in: + * css/WCSSPropertyNames.in: Added. + * css/WCSSValueKeywords.in: Added. + * rendering/RenderMarquee.cpp: + (WebCore::RenderMarquee::start): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::createObject): + * rendering/style/RenderStyleConstants.h: + (WebCore::): + +2009-08-12 George Wright <george.wright@torchmobile.com> + + Reviewed by David Hyatt. + + Update the canvas renderer's intrinsic size with the zoomed + lengths and ensure the intrinsic size is correct when setting + an initial style. + + https://bugs.webkit.org/show_bug.cgi?id=26908 + + Test: fast/canvas/canvas-zoom.html + + * rendering/RenderHTMLCanvas.cpp: + (WebCore::RenderHTMLCanvas::canvasSizeChanged): + * rendering/RenderReplaced.cpp: + (WebCore::RenderReplaced::styleDidChange): + +2009-08-12 Alpha Lam <hclam@chromium.org> + + Reviewed by Simon Fraser. + + Fix regression for dragging the media controller thumb. + https://bugs.webkit.org/show_bug.cgi?id=28211 + + Modified the conditions for rejecting events on the media controller + to only rejecting mouse events not from the left button. + + Test: media/controls-drag-timebar.html + + * rendering/MediaControlElements.cpp: + (WebCore::MediaControlTimelineElement::defaultEventHandler): + +2009-08-12 Dumitru Daniliuc <dumi@chromium.org> + + Reviewed by Eric Seidel. + + Fixing a deadlock caused by two transactions that run on two + different database handles for the same DB. Adding a per-DB thread + transaction coordinator that allows the DB thread to run only one + transaction per DB file at any given time. + + Adding a regression test for this bug. + + Test: storage/multiple-transactions-on-different-handles.html + + https://bugs.webkit.org/show_bug.cgi?id=27966 + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * storage/Database.cpp: + (WebCore::Database::transactionCoordinator): + * storage/Database.h: + * storage/DatabaseThread.cpp: + (WebCore::DatabaseThread::DatabaseThread): + * storage/DatabaseThread.h: + (WebCore::DatabaseThread::transactionCoordinator): + * storage/SQLTransaction.cpp: + (WebCore::SQLTransaction::SQLTransaction): + (WebCore::SQLTransaction::debugStepName): + (WebCore::SQLTransaction::performNextStep): + (WebCore::SQLTransaction::aquireLock): + (WebCore::SQLTransaction::lockAquired): + (WebCore::SQLTransaction::cleanupAfterSuccessCallback): + (WebCore::SQLTransaction::cleanupAfterTransactionErrorCallback): + * storage/SQLTransaction.h: + * storage/SQLTransactionCoordinator.cpp: Added. + * storage/SQLTransactionCoordinator.h: Added. + +2009-08-12 Darin Adler <darin@apple.com> + + Reviewed by Geoff Garen. + + Custom properties on DOM objects are lost after GC (as demonstrated by the gc-9.html test) + https://bugs.webkit.org/show_bug.cgi?id=28194 + + * GNUmakefile.am: Added the two new source files. + * WebCore.gypi: Ditto. + * WebCore.pro: Ditto. + * WebCore.vcproj/WebCore.vcproj: Ditto. + * WebCore.xcodeproj/project.pbxproj: Ditto. + * WebCoreSources.bkl: Ditto. + + * bindings/js/JSCSSRuleListCustom.cpp: Added. + (WebCore::JSCSSRuleList::markChildren): Call markDOMObjectWrapper + on rules in the list. + + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + (WebCore::JSCSSStyleDeclaration::markChildren): Added. Call + markDOMObjectWrapper on the CSSValue objects that are owned by the + declaration as values of the properties. + + * bindings/js/JSDOMBinding.cpp: + (WebCore::isObservableThroughDOM): Added code to handle some + cases where nodes are observable because they own objects that + in turn have custom properties. + + * bindings/js/JSDOMBinding.h: Fix a typo in the header. + + * bindings/js/JSDocumentCustom.cpp: + (WebCore::JSDocument::markChildren): Added call to markDOMObjectWrapper + for implementation and styleSheets. + + * bindings/js/JSElementCustom.cpp: + (WebCore::JSElement::markChildren): Added. Calls markDOMObjectWrapper + for attributes and style. + + * bindings/js/JSHTMLCanvasElementCustom.cpp: Added. + (WebCore::JSHTMLCanvasElement::markChildren): Call markDOMObjectWrapper + on the rendering context. + + * bindings/js/JSStyleSheetCustom.cpp: + (WebCore::JSStyleSheet::markChildren): Call markDOMObjectWrapper on + items in the stylesheet. + + * bindings/js/JSStyleSheetListCustom.cpp: + (WebCore::JSStyleSheetList::markChildren): Added. Calls + markDOMObjectWrapper on stylesheets in the list. + + * css/CSSRuleList.idl: Added CustomMarkFunction. + * css/CSSStyleDeclaration.idl: Ditto. + * css/StyleSheetList.idl: Ditto. + * dom/Element.idl: Ditto. + * html/HTMLCanvasElement.idl: Ditto. + + * dom/Element.h: Made everything private that could be. + Added access to the attributeMap that does returns + the existing map without doing any of the lazy-updating work. This + is needed to get at the existing attributes during garbage collection + without having side effects. + + * html/HTMLCanvasElement.h: Cleaned up the header a bit, making + members private. Added renderingContext2D function for use in + JSHTMLCanvasElement::markChildren. + +2009-08-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Eric Seidel. + + Fixes two bugs about Pan Scrolling - Scrolling with middle mouse button doesn't + work in Expanded view on reader.google.com, and Can enter auto scroll from a non-scrollable area. + https://bugs.webkit.org/show_bug.cgi?id=28023 + https://bugs.webkit.org/show_bug.cgi?id=24794 + + Added a new method to RenderBox seeing if the Box can be scrolled and actually has something to + scroll, and use that for pan scrolling. + + Test: platform/win/fast/events/panScroll-nested-divs.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMouseDraggedEvent): + (WebCore::EventHandler::updateAutoscrollRenderer): + (WebCore::EventHandler::handleMousePressEvent): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::canBeScrolledAndHasScrollableArea): + * rendering/RenderBox.h: + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollByRecursively): + +2009-08-12 Brian Weinstein <bweinstein@apple.com> + + Reviewed by Adam Roben. + + Fix of <rdar://6728361> Mouse wheel scrolling on a page with expanded drop down + list detaches drop down. + + Added a function for Windows PopupMenu's to return their class name. + + * platform/PopupMenu.h: + * platform/win/PopupMenuWin.cpp: + (WebCore::PopupMenu::popupClassName): + +2009-08-12 Shinichiro Hamaji <hamaji@chromium.org> + + Reviewed by Dan Bernstein. + + WINCE PORT: Color and Gradient + https://bugs.webkit.org/show_bug.cgi?id=27511 + + * platform/graphics/wince/ColorWince.cpp: Added. + * platform/graphics/wince/GradientWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + fix a typo in platform/graphics/skia/PlatformContextSkia.cpp + https://bugs.webkit.org/show_bug.cgi?id=28172 + + No new tests because it's a just typo fix. + + * platform/graphics/skia/PlatformContextSkia.cpp: + (PlatformContextSkia::setupPaintCommon): + +2009-08-12 Michelangelo De Simone <micdesim@gmail.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=27458 + Support for the :default CSS pseudoclass, as per HTML5 spec. + http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#selector-default + + Tests: fast/css/pseudo-default-001.html + fast/css/pseudo-default-002.html + fast/css/pseudo-default-003.html + fast/css/pseudo-default-004.html + + * css/CSSSelector.cpp: + (WebCore::CSSSelector::extractPseudoType): pseudoDefault + * css/CSSSelector.h: + (WebCore::CSSSelector::): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::canShareStyleWithElement): sharing stuff is + aware that only one default button can be present in a form + (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector): applies + the :default CSS pseudoclass + * dom/Element.h: + (WebCore::Element::isDefaultButtonForForm): new method to determine + whether a FormControl is a default button for a given form + * html/HTMLFormControlElement.cpp: + (WebCore::HTMLFormControlElement::isDefaultButtonForForm): ditto + * html/HTMLFormControlElement.h: + * html/HTMLFormElement.cpp: + (WebCore::HTMLFormElement::defaultButton): extracts the default button + from the form + * html/HTMLFormElement.h: + +2009-08-12 David Levin <levin@chromium.org> + + No review, rolling out r47106. + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This patch relied on a new version of v8 which is not available + in chromium yet. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-12 Steve Block <steveblock@google.com> + + Reviewed by Eric Seidel. + + Bug 26993 : Geolocation::requestPermission() + https://bugs.webkit.org/show_bug.cgi?id=26993 + + Second patch to allow the Geolocation permission request to chrome to be asynchronous + or synchronous. Fixes a bug where callbacks were called twice when permissions + are granted synchronously. + + No new tests required. + + * page/Geolocation.cpp: + (WebCore::Geolocation::setIsAllowed): Modified. Calls makeSuccessCallbacks() rather than geolocationServicePositionChanged(). + (WebCore::Geolocation::geolocationServicePositionChanged): Modified. Updated logic to avoid repeated callbacks when permissions are granted synchronously. + (WebCore::Geolocation::makeSuccessCallbacks): Added. Calls success callbacks. + * page/Geolocation.h: Modified. Adds makeSuccessCallbacks(). + +2009-08-12 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + <rdar://problem/6952336> + CrashTracer: [USER] 3 crashes in Safari at com.apple.WebCore • WebCore::SecurityOrigin::canAccess const + 27 + + Make sure to set the security origin before calling dispatchWindowObjectAvailable. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::begin): + +2009-08-12 Xiaomei Ji <xji@chromium.org> + + Reviewed by Eric Seidel. + + Fix [Chromium] drop down menu letter selection, skip selections + https://bugs.webkit.org/show_bug.cgi?id=28205 + + Not auto-testable since it is chromim platform specific code, and it involves sending a keyboard + event to the popup, which is not possible (eventSender sends the key + events through webview, we want to go through the webwidget). + + * manual-tests/keyboard_select_elements_with_same_beginning.html: Added. + * platform/chromium/PopupMenuChromium.cpp: + (WebCore::isCharacterTypeEvent): style change. + (WebCore::PopupListBox::handleKeyEvent): typeAheadFind should be called only when the event is + a character type event to avoid calling twice for English. + (WebCore::PopupListBox::typeAheadFind): remove unnecessary checking of isCharacterTypeEvent() since the whole function is only called under that condition. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding GraphicsContext to WebCore/platform/graphics/haiku. + https://bugs.webkit.org/show_bug.cgi?id=28130 + + * platform/graphics/haiku/GraphicsContextHaiku.cpp: Added. + (WebCore::GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate): + (WebCore::GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate): + (WebCore::GraphicsContext::GraphicsContext): + (WebCore::GraphicsContext::~GraphicsContext): + (WebCore::GraphicsContext::platformContext): + (WebCore::GraphicsContext::savePlatformState): + (WebCore::GraphicsContext::restorePlatformState): + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::drawEllipse): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::fillRoundedRect): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::beginPath): + (WebCore::GraphicsContext::addPath): + (WebCore::GraphicsContext::clip): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::drawLineForText): + (WebCore::GraphicsContext::drawLineForMisspellingOrBadGrammar): + (WebCore::GraphicsContext::roundToDevicePixels): + (WebCore::GraphicsContext::beginTransparencyLayer): + (WebCore::GraphicsContext::endTransparencyLayer): + (WebCore::GraphicsContext::clearRect): + (WebCore::GraphicsContext::strokeRect): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::setMiterLimit): + (WebCore::GraphicsContext::setAlpha): + (WebCore::GraphicsContext::setCompositeOperation): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipToImageBuffer): + (WebCore::GraphicsContext::getCTM): + (WebCore::GraphicsContext::translate): + (WebCore::GraphicsContext::origin): + (WebCore::GraphicsContext::rotate): + (WebCore::GraphicsContext::scale): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::concatCTM): + (WebCore::GraphicsContext::setPlatformShouldAntialias): + (WebCore::GraphicsContext::setImageInterpolationQuality): + (WebCore::GraphicsContext::setURLForRect): + (WebCore::GraphicsContext::setPlatformFont): + (WebCore::GraphicsContext::setPlatformStrokeColor): + (WebCore::GraphicsContext::getHaikuStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeThickness): + (WebCore::GraphicsContext::setPlatformFillColor): + (WebCore::GraphicsContext::clearPlatformShadow): + (WebCore::GraphicsContext::setPlatformShadow): + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Modifying WebCore/platform/graphics files to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * platform/graphics/BitmapImage.h: Adding getBBitmap() function. + * platform/graphics/Color.h: rgb_color is the Color struct in Haiku. + * platform/graphics/FloatPoint.h: BPoint is the Point class in Haiku. + * platform/graphics/FloatRect.h: BRect is the Rect class in Haiku. + * platform/graphics/GraphicsContext.cpp: + * platform/graphics/GraphicsContext.h: BView is the PlatformGraphicsContext + class for Haiku. Adding getHaikuStrokeStyle() function. + * platform/graphics/Icon.h: Adding an empty Icon() constructor because + this class isn't implemented for the moment. + * platform/graphics/ImageSource.h: BBitmap is the native bitmap class + for Haiku. + * platform/graphics/IntPoint.h: BPoint is the Point class in Haiku. + * platform/graphics/IntRect.h: BRect is the Rect class in Haiku. + * platform/graphics/IntSize.h: BSize is the Size class in Haiku. + * platform/graphics/Path.h: BRegion is the Path class in Haiku. + * platform/graphics/Pattern.h: Adding the GraphicsDef.h header and the + native pattern type. + * platform/graphics/SimpleFontData.h: Adding Haiku's Font.h header. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding modification to the WebCore/platform/ files to allow + the Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * platform/ContextMenuItem.h: BMenu is the PlatformMenuItemDescription + class of Haiku. + * platform/Cursor.h: BCursor is the Cursor class of Haiku. + * platform/DragData.h: Use a BMessage as DragDataRef. + * platform/DragImage.h: Use a BBitmap as DragImageRef. + * platform/PlatformKeyboardEvent.h: Use BMessage as event vehicle. + * platform/PlatformMenuDescription.h: BMenu is the + PlatformMenuDescription class of Haiku. + * platform/PlatformMouseEvent.h: Use BMessage as event vehicle. + * platform/PlatformWheelEvent.h: Use BMessage as event vehicle. + * platform/PopupMenu.h: Adding a m_menu attribute for Haiku. + * platform/Widget.h: BView is the PlatformWidget class of Haiku. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Tiny modifications on WebCore files to allow Haiku port. + https://bugs.webkit.org/show_bug.cgi?id=28128 + + * bindings/js/ScriptControllerHaiku.cpp: Style cleanup. + * loader/CachedFont.cpp: Haiku behaves like Qt, Gtk, or Chromium, + so many PLATFORM(HAIKU) were added to these functions. + (WebCore::CachedFont::~CachedFont): + (WebCore::CachedFont::ensureCustomFontData): + (WebCore::CachedFont::platformDataFromCustomData): + (WebCore::CachedFont::allClientsRemoved): + * page/EventHandler.cpp: Like the mac and Qt port, Haiku doesn't need the + invertSenseOfTabsToLinks() function. + * page/haiku/DragControllerHaiku.cpp: Style cleanup. + * platform/image-decoders/ImageDecoder.h: For image decoding Haiku + behaves like Cairo or Wx, (not like Skia). + (WebCore::RGBA32Buffer::getAddr): + * platform/text/PlatformString.h: Adding the String(BString&) and BString() + methods specific to Haiku. + * platform/text/UnicodeRange.h: Haiku needs to include stdint.h. + * platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp: + (WebCore::currentSearchLocaleID): Missing function. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding the ScrollbarTheme files. + https://bugs.webkit.org/show_bug.cgi?id=28125 + + * platform/haiku/ScrollbarThemeHaiku.cpp: Added. + (buttonWidth): + (WebCore::ScrollbarTheme::nativeTheme): + (WebCore::ScrollbarThemeHaiku::ScrollbarThemeHaiku): + (WebCore::ScrollbarThemeHaiku::~ScrollbarThemeHaiku): + (WebCore::ScrollbarThemeHaiku::scrollbarThickness): + (WebCore::ScrollbarThemeHaiku::hasButtons): + (WebCore::ScrollbarThemeHaiku::hasThumb): + (WebCore::ScrollbarThemeHaiku::backButtonRect): + (WebCore::ScrollbarThemeHaiku::forwardButtonRect): + (WebCore::ScrollbarThemeHaiku::trackRect): + (WebCore::ScrollbarThemeHaiku::paintScrollbarBackground): + (WebCore::ScrollbarThemeHaiku::paintButton): + (WebCore::ScrollbarThemeHaiku::paintThumb): + * platform/haiku/ScrollbarThemeHaiku.h: Added. + +2009-08-12 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Adding eight simple files to WebCore/platform/graphics/haiku. + https://bugs.webkit.org/show_bug.cgi?id=28122 + + * platform/graphics/haiku/ColorHaiku.cpp: Added. + (WebCore::Color::Color): + (WebCore::Color::operator rgb_color): + (WebCore::focusRingColor): + * platform/graphics/haiku/FloatPointHaiku.cpp: Added. + (WebCore::FloatPoint::FloatPoint): + (WebCore::FloatPoint::operator BPoint): + * platform/graphics/haiku/FloatRectHaiku.cpp: Added. + (WebCore::FloatRect::FloatRect): + (WebCore::FloatRect::operator BRect): + * platform/graphics/haiku/GradientHaiku.cpp: Added. + (WebCore::Gradient::platformDestroy): + (WebCore::Gradient::platformGradient): + (WebCore::Gradient::fill): + * platform/graphics/haiku/IntPointHaiku.cpp: Added. + (WebCore::IntPoint::IntPoint): + (WebCore::IntPoint::operator BPoint): + * platform/graphics/haiku/IntRectHaiku.cpp: Added. + (WebCore::IntRect::IntRect): + (WebCore::IntRect::operator BRect): + * platform/graphics/haiku/IntSizeHaiku.cpp: Added. + (WebCore::IntSize::IntSize): + (WebCore::IntSize::operator BSize): + * platform/graphics/haiku/PathHaiku.cpp: Added. + (WebCore::Path::Path): + (WebCore::Path::~Path): + (WebCore::Path::operator=): + (WebCore::Path::hasCurrentPoint): + (WebCore::Path::contains): + (WebCore::Path::translate): + (WebCore::Path::boundingRect): + (WebCore::Path::moveTo): + (WebCore::Path::addLineTo): + (WebCore::Path::addQuadCurveTo): + (WebCore::Path::addBezierCurveTo): + (WebCore::Path::addArcTo): + (WebCore::Path::closeSubpath): + (WebCore::Path::addArc): + (WebCore::Path::addRect): + (WebCore::Path::addEllipse): + (WebCore::Path::clear): + (WebCore::Path::isEmpty): + (WebCore::Path::debugString): + (WebCore::Path::apply): + (WebCore::Path::transform): + (WebCore::Path::strokeBoundingRect): + +2009-08-12 Lyon Chen <lyon.chen@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Implement Keygen for WINCE + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/KeygenWince.cpp: Added. + +2009-08-12 Brent Fulgham <bfulgham@webkit.org> + + Rubber-stamped by Kevin Ollivier. + + Handle crash in wx due to null value passed to strlen in + the CString constructor. + + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::certificatePath): Check for null return from getenv + and use default CString constructor instead. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + WINCE PORT: simple stubs to make it build for WINCE + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/DragDataWince.cpp: Added. + * platform/wince/DragImageWince.cpp: Added. + * platform/wince/EditorWince.cpp: Added. + * platform/wince/KURLWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCEPORT: FileSystem and FileChooser + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/FileChooserWince.cpp: Added. + * platform/wince/FileSystemWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by Eric Seidel. + + WINCE PORT: implement Cursor for WINCE. There's no real cursor on most + WinMob devices. We pass the cursor info to application, which so that + can determine what to do. + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/CursorWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: MIMETypeRegistry + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/MIMETypeRegistryWince.cpp: Added. + +2009-08-12 Joe Mason <joe.mason@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Pasteboard and SearchPopupMenu + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/PasteboardWince.cpp: Added. + * platform/wince/SearchPopupMenuWince.cpp: Added. + +2009-08-12 Yong Li <yong.li@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: Add SharedTimerWince.cpp and SystemTimeWince.cpp + https://bugs.webkit.org/show_bug.cgi?id=27543 + + * platform/wince/SharedTimerWince.cpp: Added. + * platform/wince/SystemTimeWince.cpp: Added. + +2009-08-12 Mark Mentovai <mark@chromium.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=28204 + Allow C++ exceptions to be disabled in WebCore's V8 Mac build. + + * WebCorePrefix.h: + Only undefine |try| and |catch| when building Objective-C[++], + leaving the C++ library definitions intact for C++. + +2009-08-12 Nate Chapin <japhet@chromium.org> + + Reviewed by Adam Barth. + + Add a Custom Setter for DOMWindowEvent in the V8 bindings. + https://bugs.webkit.org/show_bug.cgi?id=27719 + + Tests: fast/events/set-event-in-another-frame.html + fast/events/set-event-to-null.html + + * bindings/scripts/CodeGeneratorV8.pm: Clean up custom getter/setter code, + as it currently doesn't support a custom getter + and a v8-specific custom setter simultaneously. + * bindings/v8/custom/V8CustomBinding.h: + * bindings/v8/custom/V8DOMWindowCustom.cpp: + (WebCore::ACCESSOR_SETTER): + * page/DOMWindow.idl: + +2009-08-12 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Merge wx/ImageSourceWx.cpp into ImageSource.cpp. No changes to + ImageSource.cpp were needed, so this just deletes ImageSourceWx.cpp. + + * WebCore.gypi: + * WebCoreSources.bkl: + * platform/graphics/wx/ImageSourceWx.cpp: Removed. + * webcore-wx.bkl: + +2009-08-12 Peter Kasting <pkasting@google.com> + + Reviewed by Dave Levin. + + https://bugs.webkit.org/show_bug.cgi?id=27933 + Build fix after r47099. + + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::getImageData): + (WebCore::putImageData): + +2009-08-08 Yong Li <yong.li@torchmobile.com> + + Reviewed by Adam Treat. + + WINCE PORT: Implement Path for WINCE. Most code can be + reused for other ports that don't have native path support + https://bugs.webkit.org/show_bug.cgi?id=28188 + + Written also by George Staikos (including quadCurve() and bezier()) + + * platform/graphics/wince/PathWince.cpp: Added. + * platform/graphics/wince/PlatformPathWince.cpp: Added. + * platform/graphics/wince/PlatformPathWince.h: Added. + * platform/graphics/wince/WinceGraphicsExtras.h: Added. + +2009-08-12 Joseph Pecoraro <joepeck02@gmail.com> + + "Double-click to add" new style button does not always show up [quick fix] + https://bugs.webkit.org/show_bug.cgi?id=28187 + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertyTreeElement.prototype.updateTitle): + +2009-08-12 Crystal Zhang <crystal.zhang@torchmobile.com> + + Reviewed by George Staikos. + + WINCE PORT: MediaPlayerProxy and MediaPlayerPrivate + https://bugs.webkit.org/show_bug.cgi?id=28178 + + * platform/graphics/wince/MediaPlayerPrivateWince.h: Added. + * platform/graphics/wince/MediaPlayerProxy.cpp: Added. + * platform/graphics/wince/MediaPlayerProxy.h: Added. + +2009-08-12 Laszlo Gombos <laszlo.1.gombos@nokia.com> + + Reviewed by Eric Seidel. + + HTML 5 database and LocalStorage is not persistent on the Symbian port of QtWebKit + https://bugs.webkit.org/show_bug.cgi?id=28175 + + Call QDir::toNativeSeparators() before the path is passed to the OS. + + Based on work by David Leong. + + * platform/qt/FileSystemQt.cpp: + (WebCore::pathByAppendingComponent): + +2009-08-12 Dirk Schulze <krit@webkit.org> + + Reviewed by Ariya Hidayat. + + Minor build-fix for SVG Filter. Use getUnmultipliedImageData instead + of getImageData. This changed since r47099. + + * platform/graphics/filters/FEColorMatrix.cpp: + (WebCore::FEColorMatrix::apply): + +2009-08-12 Viet-Trung Luu <viettrungluu@gmail.com> + + Reviewed by Dimitri Glazkov. + + Explicitly set control tints for Chromium/Mac, since the controls' + NSCell(s) lack an NSView and hence their tint isn't updated + automatically when the application is activated/deactivated. + https://bugs.webkit.org/show_bug.cgi?id=28108 + http://crbug.com/18199 + + * rendering/RenderThemeChromiumMac.mm: + (WebCore::updateNSCellControlTint): + (WebCore::RenderThemeChromiumMac::paintCheckbox): + (WebCore::RenderThemeChromiumMac::paintRadio): + (WebCore::RenderThemeChromiumMac::paintButton): + (WebCore::RenderThemeChromiumMac::paintMenuList): + (WebCore::RenderThemeChromiumMac::paintSliderThumb): + (WebCore::RenderThemeChromiumMac::paintSearchField): + (WebCore::RenderThemeChromiumMac::paintSearchFieldCancelButton): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeChromiumMac::paintSearchFieldResultsButton): + +2009-08-12 Christian Plesner Hansen <christian.plesner.hansen@gmail.com> + + Reviewed by Dimitri Glazkov. + + [V8] Fix atomic string externalization crash. + Atomic string externalization assumes that all non-empty strings + can be externalized which is untrue on 64-bit. This change fixed + that. + + https://bugs.webkit.org/show_bug.cgi?id=28215 + + This bug causes loads of test crashes, no need to add new tests + specifically for this. + + * bindings/v8/V8Binding.cpp: + (WebCore::v8StringToAtomicWebCoreString): + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Holger Freyther. + + [Qt] Fix box-shadow painting in r47103. The edge should not be blurry. + Also optimize by not having to save and restore painter state. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::fillRect): + +2009-08-12 Ariya Hidayat <ariya.hidayat@nokia.com> + + Reviewed by Adam Treat. + + [Qt] Fix coding style in GraphicsContextQt.cpp + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::toQtCompositionMode): + (WebCore::toQtLineCap): + (WebCore::toQtLineJoin): + (WebCore::GraphicsContextPlatformPrivate::p): + (WebCore::GraphicsContext::drawLine): + (WebCore::GraphicsContext::strokeArc): + (WebCore::GraphicsContext::drawConvexPolygon): + (WebCore::GraphicsContext::pen): + (WebCore::GraphicsContext::fillPath): + (WebCore::GraphicsContext::strokePath): + (WebCore::GraphicsContext::fillRect): + (WebCore::GraphicsContext::clipPath): + (WebCore::GraphicsContext::drawFocusRing): + (WebCore::GraphicsContext::beginTransparencyLayer): + (WebCore::GraphicsContext::endTransparencyLayer): + (WebCore::GraphicsContext::clearRect): + (WebCore::GraphicsContext::setLineCap): + (WebCore::GraphicsContext::setLineJoin): + (WebCore::GraphicsContext::setMiterLimit): + (WebCore::GraphicsContext::setAlpha): + (WebCore::GraphicsContext::clipOut): + (WebCore::GraphicsContext::clipOutEllipseInRect): + (WebCore::GraphicsContext::addInnerRoundedRectClip): + (WebCore::GraphicsContext::setPlatformStrokeColor): + (WebCore::GraphicsContext::setPlatformStrokeStyle): + (WebCore::GraphicsContext::setPlatformStrokeThickness): + +2009-08-12 Szabo Carol <carol.szabo@nokia.com> + + Reviewed by Simon Hausmann and Ariya Hidayat. + + https://bugs.webkit.org/show_bug.cgi?id=23291 + + [Qt] Partial support for -webkit-box-shadow. Blur is not support and + the shadow still does not go well with border radius. + + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore::GraphicsContext::drawRect): + (WebCore::GraphicsContext::fillRect): + +2009-08-12 Xan Lopez <xlopez@igalia.com> + + Reviewed by Jan Alonzo. + + Use AM_V_GEN in a few more places, for less noisy builds. + + * GNUmakefile.am: + +2009-08-12 Dirk Schulze <krit@webkit.org> + + Reviewed by Oliver Hunt. + + SVG Filter premultiplied color support for getImageDate/putImageData + [https://bugs.webkit.org/show_bug.cgi?id=27933] + + Some SVG Filters need premultiplied ImageData for the calculation. Therefore getImageData + and putImageData of ImageBuffer need support for premultiplied colors. + + * html/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::getImageData): + (WebCore::CanvasRenderingContext2D::putImageData): + * platform/graphics/ImageBuffer.h: + (WebCore::): + * platform/graphics/cairo/ImageBufferCairo.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/skia/ImageBufferSkia.cpp: + (WebCore::getImageData): + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::putImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * platform/graphics/wx/ImageBufferWx.cpp: + (WebCore::ImageBuffer::getUnmultipliedImageData): + (WebCore::ImageBuffer::getPremultipliedImageData): + (WebCore::ImageBuffer::putUnmultipliedImageData): + (WebCore::ImageBuffer::putPremultipliedImageData): + * svg/graphics/SVGResourceMasker.cpp: + (WebCore::SVGResourceMasker::applyMask): + +2009-08-12 Mikhail Naganov <mnaganov@chromium.org> + + Reviewed by Timothy Hatcher. + + Changed Number.bytesToString to support low-resolution output. + + https://bugs.webkit.org/show_bug.cgi?id=28146 + + * inspector/front-end/utilities.js: + (Number.bytesToString): + +2009-08-12 Prasanth Ullattil <prasanth.ullattil@nokia.com> + + Reviewed by Simon Hausmann. + + Add support for hooking BeginPaint/EndPaint on 64Bit Windows + + Webkit uses the runtime patching trick explained by "Feng Yuan" for + hooking these paint functions. It currently supports only 32bit assembly + code. This patch adds support for 64Bit version. Since inline-assemblies + are not supported for 64Bit, we have use a seperate .asm file. + + * WebCore.pro: + * plugins/win/PaintHooks.asm: Added. + * plugins/win/PluginViewWin.cpp: + (WebCore::PluginView::hookedBeginPaint): + (WebCore::PluginView::hookedEndPaint): + (WebCore::hook): + +2009-08-11 Oliver Hunt <oliver@apple.com> + + Reviewed by Gavin Barraclough. + + Make it harder to misuse try* allocation routines + https://bugs.webkit.org/show_bug.cgi?id=27469 + + Add forwarding header for PossiblyNull type, and add missing null check + to ImageBuffer creation. + + * ForwardingHeaders/wtf/PossiblyNull.h: Added. + * platform/graphics/cg/ImageBufferCG.cpp: + (WebCore::ImageBuffer::ImageBuffer): + +2009-08-11 Gavin Barraclough <barraclough@apple.com> + + Reviewed by Oliver Hunt. + + Restrict use of FuncDeclNode & FuncExprNode to the parser. + https://bugs.webkit.org/show_bug.cgi?id=28209 + + * inspector/JavaScriptDebugServer.cpp: + (WebCore::JavaScriptDebugServer::recompileAllJSFunctions): + Function signature change. + +2009-08-11 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Merge skia/ImageSourceSkia.cpp into ImageSource.cpp. + + * WebCore.gypi: Remove deleted file, plus a file that was deleted a while back. + * platform/graphics/ImageSource.cpp: + (WebCore::ImageSource::setData): Use slightly shorter syntax. + (WebCore::ImageSource::filenameExtension): Use shorter syntax. + (WebCore::ImageSource::createFrameAtIndex): Remove redundant call, clarify comments, reject all empty images. + (WebCore::ImageSource::frameHasAlphaAtIndex): Clarify comments, use shorter syntax. + * platform/graphics/skia/ImageSourceSkia.cpp: Removed. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + SharedWorkers do not exit when the last parent document exits + https://bugs.webkit.org/show_bug.cgi?id=28170 + + Prevents Documents from being suspended/placed in the page cache if they are associated with shared workers. + + Added vector cache instead of nested hash tables for SharedWorker repository. + + Added SharedWorkerRepository::documentDetached API. + + * dom/Document.cpp: + (WebCore::Document::detach): + Notifies SharedWorkerRepository when the document is closing. + * loader/FrameLoader.cpp: + Updated FrameLoader to not cache the Document if it is associated with a SharedWorker (since we can't suspend workers yet, we need to shut them down). + (WebCore::FrameLoader::canCachePageContainingThisFrame): + (WebCore::FrameLoader::logCanCacheFrameDecision): + * workers/DefaultSharedWorkerRepository.cpp: + (WebCore::SharedWorkerProxy::create): + (WebCore::SharedWorkerProxy::isClosing): + Renamed from closing(). + (WebCore::SharedWorkerProxy::matches): + Added manual equality function to replace old hash lookup. + (WebCore::SharedWorkerProxy::isDocumentInWorkerDocuments): + Checks to see if a document is in the worker's list of documents. Used to determine if page is suspendable. + (WebCore::SharedWorkerProxy::SharedWorkerProxy): + (WebCore::SharedWorkerProxy::addToWorkerDocuments): + Added tracking of the worker's list of documents for lifecycle purposes. + (WebCore::SharedWorkerProxy::documentDetached): + Shuts down the proxy when the last associated document is detached. + (WebCore::SharedWorkerProxy::close): + Marks the proxy as closed so it is no longer shared with new instances. + (WebCore::SharedWorkerProxy::workerContextDestroyed): + Removes the proxy from the repository/frees the proxy when the associated SharedWorkerContext is destroyed. + (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded): + closing()->isClosing() + (WebCore::SharedWorkerRepository::documentDetached): + (WebCore::SharedWorkerRepository::hasSharedWorkers): + Used by FrameLoader to determine if a page has shared workers and so cannot be suspended/cached. + (WebCore::DefaultSharedWorkerRepository::hasSharedWorkers): + (WebCore::DefaultSharedWorkerRepository::removeProxy): + Invoked by workerContextDestroyed() to remove a SharedWorkerProxy from the repository. + (WebCore::DefaultSharedWorkerRepository::documentDetached): + (WebCore::DefaultSharedWorkerRepository::connectToWorker): + (WebCore::DefaultSharedWorkerRepository::getProxy): + * workers/DefaultSharedWorkerRepository.h: + * workers/SharedWorkerRepository.h: + +2009-08-11 Chris Fleizach <cfleizach@apple.com> + + Reviewed by Darin Adler. + + Bug 28200 - ListMarker should be included as part of the text value to parse + https://bugs.webkit.org/show_bug.cgi?id=28200 + + When returning text through the marker range attributes, the list marker text should + also be included. It isn't included by default because a TextIterator is used which + only looks at Nodes for text. A list marker does not have a corresponding node, + so its text is not returned through accessibility. That is, until now. + + Test: platform/mac/accessibility/string-range-contains-listmarker.html + + * accessibility/AccessibilityObject.cpp: + (WebCore::AccessibilityObject::listMarkerTextForRange): + (WebCore::AccessibilityObject::stringForVisiblePositionRange): + * accessibility/AccessibilityObject.h: + * accessibility/mac/AccessibilityObjectWrapper.mm: + (-[AccessibilityObjectWrapper doAXAttributedStringForTextMarkerRange:]): + (-[AccessibilityObjectWrapper accessibilityParameterizedAttributeNames]): + (-[AccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): + * rendering/RenderListItem.h: + + Make markerText() public so that accessibility code can access it. + +2009-08-11 Peter Kasting <pkasting@google.com> + + Reviewed by Adam Treat. + + https://bugs.webkit.org/show_bug.cgi?id=27965 + Move cairo/ImageSourceCairo.cpp to ImageSource.cpp in preparation for + merging most of the other ImageSource*.cpp files with it. + + * GNUmakefile.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * platform/graphics/ImageSource.cpp: Copied from WebCore/platform/graphics/cairo/ImageSourceCairo.cpp. + * platform/graphics/cairo/ImageSourceCairo.cpp: Removed. + +2009-08-10 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Adam Roben. + + Cairo-based Windows port does not handle the https protocol. + https://bugs.webkit.org/show_bug.cgi?id=28171. + + No new tests needed. Existing https tests show this failure + for WinCairo builds. + + * WebCore.vcproj/WebCoreCURL.vsprops: Add a few preprocessor + definitions for SSL support in cURL. + * platform/network/curl/ResourceHandleManager.h: Add new + certificate path member variable. + * platform/network/curl/ResourceHandleManager.cpp: + (WebCore::certificateBundlePath): New method to retrieve the + proper certificate resource bundle path. + (WebCore::ResourceHandleManager::initializeHandle): Check for + the resource bundle and use if available to activate SSL + support. + +2009-08-11 Maxime Simon <simon.maxime@gmail.com> + + Reviewed by Eric Seidel. + + [Haiku] Use Clipboard::create() instead of the constructor of Clipboard. + https://bugs.webkit.org/show_bug.cgi?id=28127 + + * editing/haiku/EditorHaiku.cpp: + (WebCore::Editor::newGeneralClipboard): + * page/haiku/EventHandlerHaiku.cpp: + (WebCore::EventHandler::passWheelEventToWidget): + (WebCore::EventHandler::createDraggingClipboard): + * platform/haiku/ClipboardHaiku.cpp: Style cleanup. There were many whitespace end of lines. + (WebCore::ClipboardHaiku::ClipboardHaiku): + (WebCore::ClipboardHaiku::clearAllData): + (WebCore::ClipboardHaiku::getData): + (WebCore::ClipboardHaiku::setData): + (WebCore::ClipboardHaiku::types): + (WebCore::ClipboardHaiku::dragLocation): + (WebCore::ClipboardHaiku::dragImage): + (WebCore::ClipboardHaiku::setDragImage): + (WebCore::ClipboardHaiku::dragImageElement): + (WebCore::ClipboardHaiku::createDragImage): + (WebCore::ClipboardHaiku::declareAndWriteDragImage): + (WebCore::ClipboardHaiku::writeURL): + (WebCore::ClipboardHaiku::writeRange): + (WebCore::ClipboardHaiku::hasData): + * platform/haiku/DragDataHaiku.cpp: + (WebCore::DragData::createClipboard): + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break). + + Speculative GTK build fix + + * GNUmakefile.am: + Added missing .idl file, and added notifications directory to IDL_PATH. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break). + + Speculative Windows build fix + + * WebCore.vcproj/WebCore.vcproj: + Added missing build steps for non-debug targets. + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by NOBODY (build break) + + Speculative build fix for Qt build. + + * WebCore.pro: Added /notifications to include path + +2009-08-11 John Gregg <johnnyg@google.com> + + Reviewed by Maciej Stachowiak. + + Desktop Notifications API + https://bugs.webkit.org/show_bug.cgi?id=25463 + + Adds an implementation of desktop notifications, behind the compile-time + flag ENABLE(NOTIFICATIONS). This code simply relays calls on the JavaScript + API through a NotificationProvider interface, which must provide the services + to actually notify the user and manage the desktop. This provider is injected + into WebKit through the ChromeClient for normal page contexts and through the + WorkerThread for worker contexts. + + A permissions API is defined on a per-origin basis, which allows a web page + to check if its origin is allowed to show desktop notifications, and to request + permission for its origin. + + * Configurations/FeatureDefines.xcconfig: + * DerivedSources.cpp: + * DerivedSources.make: + * GNUmakefile.am: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.vcproj/WebCoreCommon.vsprops: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSDOMWindowCustom.cpp: + * bindings/js/JSDesktopNotificationsCustom.cpp: Added. + (WebCore::JSNotificationCenter::requestPermission): + (WebCore::JSNotification::addEventListener): + (WebCore::JSNotification::removeEventListener): + * bindings/js/JSEventTarget.cpp: + (WebCore::toJS): + (WebCore::toEventTarget): + * dom/EventTarget.cpp: + (WebCore::EventTarget::toNotification): + * dom/EventTarget.h: + * loader/EmptyClients.h: + (WebCore::EmptyChromeClient::notificationPresenter): + * notifications: Added. + * notifications/Notification.cpp: Added. + (WebCore::Notification::Notification): + (WebCore::Notification::~Notification): + (WebCore::Notification::show): + (WebCore::Notification::cancel): + (WebCore::Notification::ondisplay): + (WebCore::Notification::setOndisplay): + (WebCore::Notification::onerror): + (WebCore::Notification::setOnerror): + (WebCore::Notification::onclose): + (WebCore::Notification::setOnclose): + (WebCore::Notification::getAttributeEventListener): + (WebCore::Notification::setAttributeEventListener): + (WebCore::Notification::clearAttributeEventListener): + (WebCore::Notification::dispatchDisplayEvent): + (WebCore::Notification::dispatchErrorEvent): + (WebCore::Notification::dispatchCloseEvent): + (WebCore::Notification::addEventListener): + (WebCore::Notification::removeEventListener): + (WebCore::Notification::handleEvent): + (WebCore::Notification::dispatchEvent): + * notifications/Notification.h: Added. + (WebCore::Notification::create): + (WebCore::Notification::isHTML): + (WebCore::Notification::url): + (WebCore::Notification::contents): + (WebCore::Notification::scriptExecutionContext): + (WebCore::Notification::toNotification): + (WebCore::Notification::refEventTarget): + (WebCore::Notification::derefEventTarget): + * notifications/Notification.idl: Added. + * notifications/NotificationCenter.cpp: Added. + (WebCore::NotificationCenter::NotificationCenter): + (WebCore::NotificationCenter::checkPermission): + (WebCore::NotificationCenter::requestPermission): + * notifications/NotificationCenter.h: Added. + (WebCore::NotificationCenter::create): + (WebCore::NotificationCenter::createHTMLNotification): + (WebCore::NotificationCenter::createNotification): + (WebCore::NotificationCenter::context): + (WebCore::NotificationCenter::presenter): + * notifications/NotificationCenter.idl: Added. + * notifications/NotificationContents.h: Added. + (WebCore::NotificationContents::NotificationContents): + (WebCore::NotificationContents::icon): + (WebCore::NotificationContents::title): + (WebCore::NotificationContents::body): + * notifications/NotificationPresenter.h: Added. + (WebCore::NotificationPresenter::): + (WebCore::NotificationPresenter::~NotificationPresenter): + * page/Chrome.cpp: + (WebCore::Chrome::notificationPresenter): + * page/Chrome.h: + * page/ChromeClient.h: + * page/DOMWindow.cpp: + (WebCore::DOMWindow::clear): + (WebCore::DOMWindow::webkitNotifications): + * page/DOMWindow.h: + * page/DOMWindow.idl: + * page/Page.h: + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::~WorkerContext): + (WebCore::WorkerContext::webkitNotifications): + * workers/WorkerContext.h: + * workers/WorkerContext.idl: + * workers/WorkerThread.h: + (WebCore::WorkerThread::getNotificationPresenter): + (WebCore::WorkerThread::setNotificationPresenter): + +2009-08-11 Joseph Pecoraro <joepeck02@gmail.com> + + Reviewed by Timothy Hatcher. + + Inspector: Console Drawer is Toggling instead of Staying Open + https://bugs.webkit.org/show_bug.cgi?id=28115 + + * inspector/front-end/Drawer.js: + (WebInspector.Drawer.prototype.showView): ensures the drawer will be open and showing the provided view + * inspector/front-end/inspector.js: + (WebInspector.showConsole): usees the new showView to guarantee the Drawer will be open + (WebInspector.showChanges): uses the new showView guarantee the Drawer will be open + +2009-08-11 Nikolas Zimmermann <nikolas.zimmermann@torchmobile.com> + + Reviewed by George Staikos. + + [WML] WMLPageState is not allowed to store the active card, it needs to be done per document + https://bugs.webkit.org/show_bug.cgi?id=28180 + + Don't store the active WMLCardElement in WMLPageState, but in WMLDocument. + Otherwhise this may lead to crashes related to intrinsic event exeuction. + + Unfortunately select elements aren't testable by the layout tests, so adding + a new manual test reproducing the crash. + + * manual-tests/wml/select-onpick-event-crash.wml: Added. + * wml/WMLCardElement.cpp: + (WebCore::WMLCardElement::determineActiveCard): + * wml/WMLDoElement.cpp: + (WebCore::WMLDoElement::defaultEventHandler): + * wml/WMLDocument.cpp: + (WebCore::WMLDocument::finishedParsing): + * wml/WMLDocument.h: + (WebCore::WMLDocument::activeCard): + * wml/WMLGoElement.cpp: + (WebCore::WMLGoElement::executeTask): + * wml/WMLPageState.cpp: + (WebCore::WMLPageState::WMLPageState): + * wml/WMLPageState.h: + * wml/WMLPrevElement.cpp: + (WebCore::WMLPrevElement::executeTask): + * wml/WMLRefreshElement.cpp: + (WebCore::WMLRefreshElement::executeTask): + +2009-08-07 Peter Kasting <pkasting@google.com> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=28073 + Treat icons with no bit count and no color count as 256-color for + purposes of quality ranking. Also fix a couple cases of a style + violation. + + Test: fast/images/icon-0colors.html + + * platform/image-decoders/ico/ICOImageDecoder.cpp: + (WebCore::ICOImageDecoder::processDirectory): + (WebCore::ICOImageDecoder::readDirectoryEntry): + +2009-08-11 Drew Wilson <atwilson@google.com> + + Reviewed by David Levin. + + Need to refactor WorkerObjectProxy. + https://bugs.webkit.org/show_bug.cgi?id=28136 + + Added WorkerReportingProxy for reporting worker state (exceptions, console messages, thread exited) to the parent. + + Existing tests are sufficient, as this is only a refactoring. + + * GNUmakefile.am: + Added WorkerReportingProxy.h to build. + * WebCore.gypi: + Added WorkerReportingProxy.h to build. + * WebCore.vcproj/WebCore.vcproj: + Added WorkerReportingProxy.h to build. + * WebCore.xcodeproj/project.pbxproj: + Added WorkerReportingProxy.h to build. + * workers/DedicatedWorkerContext.cpp: + * workers/DedicatedWorkerContext.h: + Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy. + * workers/DedicatedWorkerThread.cpp: + (WebCore::DedicatedWorkerThread::DedicatedWorkerThread): + Changed constructor to pass WorkerReportingProxy to base class. + * workers/DefaultSharedWorkerRepository.cpp: + Updated SharedWorkerProxy to implement WorkerReportingProxy interface. + (WebCore::SharedWorkerProxy::postExceptionToWorkerObject): + (WebCore::SharedWorkerProxy::postConsoleMessageToWorkerObject): + (WebCore::SharedWorkerProxy::workerContextClosed): + (WebCore::SharedWorkerProxy::workerContextDestroyed): + (WebCore::DefaultSharedWorkerRepository::workerScriptLoaded): + Now passes in WorkerReportingProxy when creating SharedWorkerThread. + * workers/SharedWorkerContext.cpp: + * workers/SharedWorkerContext.h: + Removed addMessage/forwardException() APIs - now handled by WorkerReportingProxy. + * workers/SharedWorkerThread.cpp: + (WebCore::SharedWorkerThread::create): + (WebCore::SharedWorkerThread::SharedWorkerThread): + Passes WorkerReportingProxy to base class constructor. + * workers/SharedWorkerThread.h: + Constructor now takes a WorkerReportingProxy. + * workers/WorkerContext.cpp: + (WebCore::WorkerContext::~WorkerContext): + Moved code that calls workerContextDestroyed() into base class so shared workers share this functionality. + (WebCore::WorkerContext::close): + Now notifies WorkerReportingProxy when the thread is closing. + (WebCore::WorkerContext::reportException): + Reports exceptions via WorkerReportingProxy. + (WebCore::WorkerContext::addMessage): + Reports console messages via WorkerReportingProxy. + * workers/WorkerContext.h: + * workers/WorkerObjectProxy.h: + (WebCore::WorkerObjectProxy::workerContextClosed): + Default empty implementation for dedicated workers. + * workers/WorkerReportingProxy.h: Added. + Base interface that contains APIs moved from WorkerObjectProxy. + (WebCore::WorkerReportingProxy::~WorkerReportingProxy): + * workers/WorkerThread.cpp: + (WebCore::WorkerThread::WorkerThread): + Updated constructor to accept a WorkerReportingProxy. + * workers/WorkerThread.h: + (WebCore::WorkerThread::workerReportingProxy): + +2009-08-11 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by NOBODY (build fix). + + Fix the Qt build after r47022. + + Use the new markChildren() pattern for marking aggregate/child objects. + + * bridge/qt/qt_instance.cpp: + (JSC::Bindings::QtRuntimeObjectImp::markChildren): + (JSC::Bindings::QtInstance::markAggregate): + * bridge/qt/qt_instance.h: + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::QtRuntimeMetaMethod::markChildren): + * bridge/qt/qt_runtime.h: + 2009-08-11 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Holger Freyther. @@ -191,7 +4435,7 @@ * page/DOMWindow.cpp: (WebCore::DOMWindow::applicationCache): -2009-08-10 Crystal Zhang <crystal.zhang@staikos.net> +2009-08-10 Crystal Zhang <crystal.zhang@torchmobile.com> Reviewed by George Staikos. diff --git a/WebCore/Configurations/FeatureDefines.xcconfig b/WebCore/Configurations/FeatureDefines.xcconfig index 37d2df6..2369253 100644 --- a/WebCore/Configurations/FeatureDefines.xcconfig +++ b/WebCore/Configurations/FeatureDefines.xcconfig @@ -37,11 +37,14 @@ ENABLE_3D_RENDERING_1060 = ENABLE_3D_RENDERING; ENABLE_CHANNEL_MESSAGING = ENABLE_CHANNEL_MESSAGING; ENABLE_DATABASE = ENABLE_DATABASE; ENABLE_DATAGRID = ENABLE_DATAGRID; +ENABLE_DATALIST = ENABLE_DATALIST; ENABLE_DOM_STORAGE = ENABLE_DOM_STORAGE; +ENABLE_EVENTSOURCE = ENABLE_EVENTSOURCE; ENABLE_FILTERS = ; ENABLE_GEOLOCATION = ; ENABLE_ICONDATABASE = ENABLE_ICONDATABASE; ENABLE_JAVASCRIPT_DEBUGGER = ENABLE_JAVASCRIPT_DEBUGGER; +ENABLE_NOTIFICATIONS = ; ENABLE_OFFLINE_WEB_APPLICATIONS = ENABLE_OFFLINE_WEB_APPLICATIONS; ENABLE_RUBY = ENABLE_RUBY; ENABLE_SHARED_WORKERS = ; @@ -59,4 +62,4 @@ ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XPATH = ENABLE_XPATH; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DOM_STORAGE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_CANVAS) $(ENABLE_3D_RENDERING) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_DATABASE) $(ENABLE_DATAGRID) $(ENABLE_DATALIST) $(ENABLE_DOM_STORAGE) $(ENABLE_EVENTSOURCE) $(ENABLE_FILTERS) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_NOTIFICATIONS) $(ENABLE_OFFLINE_WEB_APPLICATIONS) $(ENABLE_RUBY) $(ENABLE_SHARED_WORKERS) $(ENABLE_SVG) $(ENABLE_SVG_ANIMATION) $(ENABLE_SVG_AS_IMAGE) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_SVG_FOREIGN_OBJECT) $(ENABLE_SVG_USE) $(ENABLE_VIDEO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WML) $(ENABLE_WORKERS) $(ENABLE_XPATH) $(ENABLE_XSLT); diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp index b0311e2..d127c48 100644 --- a/WebCore/DerivedSources.cpp +++ b/WebCore/DerivedSources.cpp @@ -73,6 +73,7 @@ #include "JSErrorEvent.cpp" #include "JSEvent.cpp" #include "JSEventException.cpp" +#include "JSEventSource.cpp" #include "JSFile.cpp" #include "JSFileList.cpp" #include "JSHistory.cpp" @@ -92,6 +93,7 @@ #include "JSHTMLDataGridCellElement.cpp" #include "JSHTMLDataGridColElement.cpp" #include "JSHTMLDataGridRowElement.cpp" +#include "JSHTMLDataListElement.cpp" #include "JSHTMLDirectoryElement.cpp" #include "JSHTMLDivElement.cpp" #include "JSHTMLDListElement.cpp" @@ -166,6 +168,8 @@ #include "JSNodeIterator.cpp" #include "JSNodeList.cpp" #include "JSNotation.cpp" +#include "JSNotificationCenter.cpp" +#include "JSNotification.cpp" #include "JSOverflowEvent.cpp" #include "JSPlugin.cpp" #include "JSPluginArray.cpp" diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make index 788c5ee..4cdde30 100644 --- a/WebCore/DerivedSources.make +++ b/WebCore/DerivedSources.make @@ -35,6 +35,7 @@ VPATH = \ $(WebCore)/html/canvas \ $(WebCore)/inspector \ $(WebCore)/loader/appcache \ + $(WebCore)/notifications \ $(WebCore)/page \ $(WebCore)/plugins \ $(WebCore)/storage \ @@ -99,6 +100,7 @@ DOM_CLASSES = \ Event \ EventException \ EventListener \ + EventSource \ EventTarget \ File \ FileList \ @@ -120,6 +122,7 @@ DOM_CLASSES = \ HTMLDataGridCellElement \ HTMLDataGridColElement \ HTMLDataGridRowElement \ + HTMLDataListElement \ HTMLDListElement \ HTMLDirectoryElement \ HTMLDivElement \ @@ -194,6 +197,8 @@ DOM_CLASSES = \ NodeIterator \ NodeList \ Notation \ + Notification \ + NotificationCenter \ OverflowEvent \ Plugin \ PluginArray \ @@ -554,6 +559,10 @@ UserAgentStyleSheets.h : css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS) # HTML tag and attribute names +ifeq ($(findstring ENABLE_DATALIST,$(FEATURE_DEFINES)), ENABLE_DATALIST) + HTML_FLAGS := $(HTML_FLAGS) ENABLE_DATALIST=1 +endif + ifeq ($(findstring ENABLE_VIDEO,$(FEATURE_DEFINES)), ENABLE_VIDEO) HTML_FLAGS := $(HTML_FLAGS) ENABLE_VIDEO=1 endif @@ -683,7 +692,7 @@ endif # JavaScript bindings GENERATE_BINDINGS = perl -I $(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl \ - --include dom --include html --include css --include page --include xml --include svg --outputDir . + --include dom --include html --include css --include page --include notifications --include xml --include svg --outputDir . GENERATE_BINDINGS_SCRIPTS = \ bindings/scripts/CodeGenerator.pm \ diff --git a/WebCore/ForwardingHeaders/parser/Parser.h b/WebCore/ForwardingHeaders/parser/Parser.h deleted file mode 100644 index 863df59..0000000 --- a/WebCore/ForwardingHeaders/parser/Parser.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef WebCore_FWD_Parser_h -#define WebCore_FWD_Parser_h -#include <JavaScriptCore/Parser.h> -#endif diff --git a/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h b/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h deleted file mode 100644 index fcfe26d..0000000 --- a/WebCore/ForwardingHeaders/runtime/CollectorHeapIterator.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef WebCore_FWD_CollectorHeapIterator_h -#define WebCore_FWD_CollectorHeapIterator_h -#include <JavaScriptCore/CollectorHeapIterator.h> -#endif diff --git a/WebCore/ForwardingHeaders/wtf/PossiblyNull.h b/WebCore/ForwardingHeaders/wtf/PossiblyNull.h new file mode 100644 index 0000000..d52a4a0 --- /dev/null +++ b/WebCore/ForwardingHeaders/wtf/PossiblyNull.h @@ -0,0 +1,4 @@ +#ifndef WebCore_FWD_PossiblyNull_h +#define WebCore_FWD_PossiblyNull_h +#include <JavaScriptCore/PossiblyNull.h> +#endif diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 5cc1fd6..e2240f7 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -26,6 +26,7 @@ webcore_cppflags += \ -I$(srcdir)/WebCore/loader/appcache \ -I$(srcdir)/WebCore/loader/archive \ -I$(srcdir)/WebCore/loader/icon \ + -I$(srcdir)/WebCore/notifications \ -I$(srcdir)/WebCore/page \ -I$(srcdir)/WebCore/page/animation \ -I$(srcdir)/WebCore/platform \ @@ -175,6 +176,7 @@ IDL_BINDINGS += \ WebCore/html/HTMLDataGridCellElement.idl \ WebCore/html/HTMLDataGridColElement.idl \ WebCore/html/HTMLDataGridRowElement.idl \ + WebCore/html/HTMLDataListElement.idl \ WebCore/html/HTMLDListElement.idl \ WebCore/html/HTMLDirectoryElement.idl \ WebCore/html/HTMLDivElement.idl \ @@ -234,11 +236,14 @@ IDL_BINDINGS += \ WebCore/html/VoidCallback.idl \ WebCore/inspector/JavaScriptCallFrame.idl \ WebCore/inspector/InspectorBackend.idl \ + WebCore/notifications/Notification.idl \ + WebCore/notifications/NotificationCenter.idl \ WebCore/page/BarInfo.idl \ WebCore/page/Console.idl \ WebCore/page/Coordinates.idl \ WebCore/page/DOMSelection.idl \ WebCore/page/DOMWindow.idl \ + WebCore/page/EventSource.idl \ WebCore/page/Geolocation.idl \ WebCore/page/Geoposition.idl \ WebCore/page/History.idl \ @@ -311,6 +316,7 @@ webcore_sources += \ WebCore/bindings/js/JSDataGridDataSource.cpp \ WebCore/bindings/js/JSDataGridDataSource.h \ WebCore/bindings/js/JSCSSRuleCustom.cpp \ + WebCore/bindings/js/JSCSSRuleListCustom.cpp \ WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp \ WebCore/bindings/js/JSCSSStyleDeclarationCustom.h \ WebCore/bindings/js/JSCSSValueCustom.cpp \ @@ -342,6 +348,9 @@ webcore_sources += \ WebCore/bindings/js/JSEventCustom.cpp \ WebCore/bindings/js/JSEventListener.cpp \ WebCore/bindings/js/JSEventListener.h \ + WebCore/bindings/js/JSEventSourceConstructor.cpp \ + WebCore/bindings/js/JSEventSourceConstructor.h \ + WebCore/bindings/js/JSEventSourceCustom.cpp \ WebCore/bindings/js/JSEventTarget.cpp \ WebCore/bindings/js/JSEventTarget.h \ WebCore/bindings/js/JSGeolocationCustom.cpp \ @@ -349,6 +358,7 @@ webcore_sources += \ WebCore/bindings/js/JSHTMLAllCollection.h \ WebCore/bindings/js/JSHTMLAppletElementCustom.cpp \ WebCore/bindings/js/JSHTMLAppletElementCustom.h \ + WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp \ WebCore/bindings/js/JSHTMLCollectionCustom.cpp \ WebCore/bindings/js/JSHTMLDataGridElementCustom.cpp \ WebCore/bindings/js/JSHTMLDocumentCustom.cpp \ @@ -654,7 +664,6 @@ webcore_sources += \ WebCore/dom/DOMCoreException.h \ WebCore/dom/DOMImplementation.cpp \ WebCore/dom/DOMImplementation.h \ - WebCore/dom/DocPtr.h \ WebCore/dom/Document.cpp \ WebCore/dom/Document.h \ WebCore/dom/DocumentFragment.cpp \ @@ -958,6 +967,8 @@ webcore_sources += \ WebCore/html/HTMLDataGridColElement.h \ WebCore/html/HTMLDataGridRowElement.cpp \ WebCore/html/HTMLDataGridRowElement.h \ + WebCore/html/HTMLDataListElement.cpp \ + WebCore/html/HTMLDataListElement.h \ WebCore/html/HTMLDListElement.cpp \ WebCore/html/HTMLDListElement.h \ WebCore/html/HTMLDirectoryElement.cpp \ @@ -1267,6 +1278,8 @@ webcore_sources += \ WebCore/page/EditorClient.h \ WebCore/page/EventHandler.cpp \ WebCore/page/EventHandler.h \ + WebCore/page/EventSource.cpp \ + WebCore/page/EventSource.h \ WebCore/page/FocusController.cpp \ WebCore/page/FocusController.h \ WebCore/page/FocusDirection.h \ @@ -1466,6 +1479,7 @@ webcore_sources += \ WebCore/platform/graphics/ImageBuffer.cpp \ WebCore/platform/graphics/ImageBuffer.h \ WebCore/platform/graphics/ImageObserver.h \ + WebCore/platform/graphics/ImageSource.cpp \ WebCore/platform/graphics/ImageSource.h \ WebCore/platform/graphics/IntPoint.h \ WebCore/platform/graphics/IntRect.cpp \ @@ -1857,7 +1871,6 @@ webcoregtk_sources += \ WebCore/platform/graphics/cairo/ImageBufferCairo.cpp \ WebCore/platform/graphics/cairo/ImageBufferData.h \ WebCore/platform/graphics/cairo/ImageCairo.cpp \ - WebCore/platform/graphics/cairo/ImageSourceCairo.cpp \ WebCore/platform/graphics/cairo/PathCairo.cpp \ WebCore/platform/graphics/cairo/PatternCairo.cpp \ WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ @@ -2111,6 +2124,8 @@ webcore_sources += \ WebCore/storage/SQLTransaction.cpp \ WebCore/storage/SQLTransaction.h \ WebCore/storage/SQLTransactionCallback.h \ + WebCore/storage/SQLTransactionCoordinator.h \ + WebCore/storage/SQLTransactionCoordinator.cpp \ WebCore/storage/SQLTransactionErrorCallback.h else @@ -2119,6 +2134,30 @@ webcore_cppflags += -DENABLE_DATABASE=0 endif # END ENABLE_DATABASE # ---- +# HTML5 datalist Support +# ---- +if ENABLE_DATALIST + +HTML_FEATURES += ENABLE_DATALIST=1 +webcore_cppflags += -DENABLE_DATALIST=1 + +endif # END ENABLE_DATALIST + +# ---- +# HTML5 server-sent events +# ---- +if !ENABLE_EVENTSOURCE +global_cppflags += -DENABLE_EVENTSOURCE=0 +endif + +if ENABLE_EVENTSOURCE +FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1 + +webcore_cppflags += \ + -DENABLE_EVENTSOURCE=1 +endif # ENABLE_EVENTSOURCE + +# ---- # HTML5 client-side session and persistent storage # ---- if ENABLE_DOM_STORAGE @@ -2370,6 +2409,7 @@ webcore_sources += \ WebCore/workers/WorkerMessagingProxy.cpp \ WebCore/workers/WorkerMessagingProxy.h \ WebCore/workers/WorkerObjectProxy.h \ + WebCore/workers/WorkerReportingProxy.h \ WebCore/workers/WorkerRunLoop.cpp \ WebCore/workers/WorkerRunLoop.h \ WebCore/workers/WorkerScriptLoader.cpp \ @@ -2461,7 +2501,7 @@ webcore_sources += \ DerivedSources/WMLNames.cpp: DerivedSources/WMLElementFactory.cpp; DerivedSources/WMLElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/wml/WMLTagNames.in $(WebCore)/wml/WMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/wml/WMLTagNames.in --attrs $(WebCore)/wml/WMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/wml/WMLTagNames.in --attrs $(WebCore)/wml/WMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # END ENABLE_WML # ---- @@ -2509,6 +2549,24 @@ webcoregtk_sources += \ WebCore/platform/gtk/GeolocationServiceGtk.h endif # END ENABLE_GEOLOCATION +# ---- +# Notifications support +# ---- +if ENABLE_NOTIFICATIONS +FEATURE_DEFINES_JAVASCRIPT += ENABLE_NOTIFICATIONS=1 + +webcore_cppflags += \ + -DENABLE_NOTIFICATIONS=1 + +webcore_sources += \ + WebCore/notifications/Notification.cpp \ + WebCore/notifications/Notification.h \ + WebCore/notifications/NotificationCenter.cpp \ + WebCore/notifications/NotificationCenter.h \ + WebCore/notifications/NotificationPresenter.h \ + WebCore/notifications/NotificationContents.h + +endif # END ENABLE_NOTIFICATIONS # ---- # SVG Support @@ -3121,10 +3179,10 @@ DerivedSources/JSSVGElementWrapperFactory.cpp: DerivedSources/SVGElementFactory. if SVG_FLAGS DerivedSources/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(SVG_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --extraDefines "$(SVG_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" else DerivedSources/SVGElementFactory.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/svg/svgtags.in $(WebCore)/svg/svgattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/svg/svgtags.in --attrs $(WebCore)/svg/svgattrs.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # SVG_FLAGS @@ -3133,7 +3191,7 @@ endif # SVG_FLAGS DerivedSources/XLinkNames.h: DerivedSources/XLinkNames.cpp; DerivedSources/XLinkNames.cpp : $(WebCore)/dom/make_names.pl $(WebCore)/svg/xlinkattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/svg/xlinkattrs.in --outputDir "$(GENSOURCES)" endif # END ENABLE_SVG @@ -3177,20 +3235,20 @@ DerivedSources/CSSValueKeywords.h : $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css # DOCTYPE strings DerivedSources/DocTypeStrings.cpp : $(WebCore)/html/DocTypeStrings.gperf - $(GPERF) -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(WebCore)/html/DocTypeStrings.gperf > $@ + $(AM_V_GEN)$(GPERF) -CEot -L ANSI-C -k "*" -N findDoctypeEntry -F ,PubIDInfo::eAlmostStandards,PubIDInfo::eAlmostStandards $(WebCore)/html/DocTypeStrings.gperf > $@ # HTML entity names DerivedSources/HTMLEntityNames.c : $(WebCore)/html/HTMLEntityNames.gperf - $(GPERF) -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 \ + $(AM_V_GEN)$(GPERF) -a -L ANSI-C -C -G -c -o -t -k '*' -N findEntity -D -s 2 \ $(WebCore)/html/HTMLEntityNames.gperf > $@ # color names DerivedSources/ColorData.c: $(WebCore)/platform/ColorData.gperf - $(GPERF) -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ + $(AM_V_GEN)$(GPERF) -CDEot -L ANSI-C -k '*' -N findColor -D -s 2 $< > $@ # CSS tokenizer DerivedSources/tokenizer.cpp : $(WebCore)/css/tokenizer.flex $(WebCore)/css/maketokenizer - $(FLEX) -t $< | $(PERL) $(WebCore)/css/maketokenizer > $@ + $(AM_V_GEN)$(FLEX) -t $< | $(PERL) $(WebCore)/css/maketokenizer > $@ # CSS grammar @@ -3227,7 +3285,7 @@ SCRIPTS_BINDINGS = \ DerivedSources/UserAgentStyleSheetsData.cpp: DerivedSources/UserAgentStyleSheets.h; DerivedSources/UserAgentStyleSheets.h: $(WebCore)/css/make-css-file-arrays.pl $(USER_AGENT_STYLE_SHEETS) - $(PERL) $< $@ DerivedSources/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) + $(AM_V_GEN)$(PERL) $< $@ DerivedSources/UserAgentStyleSheetsData.cpp $(USER_AGENT_STYLE_SHEETS) # HTML tag and attribute names DerivedSources/HTMLElementFactory.cpp: DerivedSources/HTMLNames.cpp; @@ -3238,16 +3296,16 @@ DerivedSources/JSHTMLElementWrapperFactory.h: DerivedSources/JSHTMLElementWrappe if HTML_FLAGS DerivedSources/HTMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(HTML_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --extraDefines "$(HTML_FEATURES)" --factory --wrapperFactory --outputDir "$(GENSOURCES)" else DerivedSources/HTMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/html/HTMLTagNames.in $(WebCore)/html/HTMLAttributeNames.in - $(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --tags $(WebCore)/html/HTMLTagNames.in --attrs $(WebCore)/html/HTMLAttributeNames.in --factory --wrapperFactory --outputDir "$(GENSOURCES)" endif # HTML_FLAGS DerivedSources/XMLNames.h: DerivedSources/XMLNames.cpp; DerivedSources/XMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlattrs.in - $(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES)" + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES)" IDL_PATH := \ $(WebCore)/bindings/js \ @@ -3257,6 +3315,7 @@ IDL_PATH := \ $(WebCore)/html/canvas \ $(WebCore)/inspector \ $(WebCore)/loader/appcache \ + $(WebCore)/notifications \ $(WebCore)/page \ $(WebCore)/storage \ $(WebCore)/svg \ @@ -3271,7 +3330,7 @@ DerivedSources/JS%.h: DerivedSources/JS%.cpp; .SECONDARY: DerivedSources/JS%.cpp: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorJS.pm - $(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "$(FEATURE_DEFINES_JAVASCRIPT)" --generator JS $< + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl $(IDL_PATH:%=--include "%") --outputDir "$(GENSOURCES)" --defines "$(FEATURE_DEFINES_JAVASCRIPT)" --generator JS $< IDL_BINDINGS_JS_PURE := \ WebCore/svg/ElementTimeControl.idl \ @@ -3381,4 +3440,3 @@ dist_webresources_DATA = \ CLEANFILES += \ libWebCoreJS.la - diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi index 8738e15..1d7fa6c 100644 --- a/WebCore/WebCore.gypi +++ b/WebCore/WebCore.gypi @@ -100,6 +100,7 @@ 'html/HTMLDataGridColElement.idl', 'html/HTMLDataGridElement.idl', 'html/HTMLDataGridRowElement.idl', + 'html/HTMLDataListElement.idl', 'html/HTMLDirectoryElement.idl', 'html/HTMLDivElement.idl', 'html/HTMLDocument.idl', @@ -414,6 +415,7 @@ 'bindings/js/JSConsoleCustom.cpp', 'bindings/js/JSCoordinatesCustom.cpp', 'bindings/js/JSCSSRuleCustom.cpp', + 'bindings/js/JSCSSRuleListCustom.cpp', 'bindings/js/JSCSSStyleDeclarationCustom.cpp', 'bindings/js/JSCSSStyleDeclarationCustom.h', 'bindings/js/JSCSSValueCustom.cpp', @@ -464,6 +466,7 @@ 'bindings/js/JSHTMLAllCollection.h', 'bindings/js/JSHTMLAppletElementCustom.cpp', 'bindings/js/JSHTMLAppletElementCustom.h', + 'bindings/js/JSHTMLCanvasElementCustom.cpp', 'bindings/js/JSHTMLCollectionCustom.cpp', 'bindings/js/JSHTMLDataGridElementCustom.cpp', 'bindings/js/JSHTMLDocumentCustom.cpp', @@ -947,7 +950,6 @@ 'dom/DOMCoreException.h', 'dom/DOMImplementation.cpp', 'dom/DOMImplementation.h', - 'dom/DocPtr.h', 'dom/Document.cpp', 'dom/Document.h', 'dom/DocumentFragment.cpp', @@ -1263,6 +1265,8 @@ 'html/HTMLDataGridElement.h', 'html/HTMLDataGridRowElement.cpp', 'html/HTMLDataGridRowElement.h', + 'html/HTMLDataListElement.cpp', + 'html/HTMLDataListElement.h', 'html/HTMLDirectoryElement.cpp', 'html/HTMLDirectoryElement.h', 'html/HTMLDivElement.cpp', @@ -1748,7 +1752,6 @@ 'platform/graphics/cairo/ImageBufferCairo.cpp', 'platform/graphics/cairo/ImageBufferData.h', 'platform/graphics/cairo/ImageCairo.cpp', - 'platform/graphics/cairo/ImageSourceCairo.cpp', 'platform/graphics/cairo/PathCairo.cpp', 'platform/graphics/cairo/PatternCairo.cpp', 'platform/graphics/cairo/TransformationMatrixCairo.cpp', @@ -1912,8 +1915,6 @@ 'platform/graphics/skia/GraphicsContextSkia.cpp', 'platform/graphics/skia/ImageBufferSkia.cpp', 'platform/graphics/skia/ImageSkia.cpp', - 'platform/graphics/skia/ImageSourceSkia.cpp', - 'platform/graphics/skia/ImageSourceSkia.h', 'platform/graphics/skia/IntPointSkia.cpp', 'platform/graphics/skia/IntRectSkia.cpp', 'platform/graphics/skia/NativeImageSkia.cpp', @@ -1996,7 +1997,6 @@ 'platform/graphics/wx/GraphicsContextWx.cpp', 'platform/graphics/wx/ImageBufferData.h', 'platform/graphics/wx/ImageBufferWx.cpp', - 'platform/graphics/wx/ImageSourceWx.cpp', 'platform/graphics/wx/ImageWx.cpp', 'platform/graphics/wx/IntPointWx.cpp', 'platform/graphics/wx/IntRectWx.cpp', @@ -2060,6 +2060,7 @@ 'platform/graphics/ImageBuffer.h', 'platform/graphics/ImageObserver.h', 'platform/graphics/ImageSource.h', + 'platform/graphics/ImageSource.cpp', 'platform/graphics/IntPoint.h', 'platform/graphics/IntRect.cpp', 'platform/graphics/IntRect.h', @@ -2541,6 +2542,7 @@ 'platform/ContextMenu.cpp', 'platform/ContextMenu.h', 'platform/ContextMenuItem.h', + 'platform/Cookie.h', 'platform/CookieJar.h', 'platform/CrossThreadCopier.h', 'platform/CrossThreadCopier.cpp', @@ -2963,6 +2965,8 @@ 'storage/SQLTransaction.cpp', 'storage/SQLTransaction.h', 'storage/SQLTransactionCallback.h', + 'storage/SQLTransactionCoordinator.h', + 'storage/SQLTransactionCoordinator.cpp', 'storage/SQLTransactionErrorCallback.h', 'storage/Storage.cpp', 'storage/Storage.h', @@ -3353,6 +3357,7 @@ 'workers/WorkerMessagingProxy.cpp', 'workers/WorkerMessagingProxy.h', 'workers/WorkerObjectProxy.h', + 'workers/WorkerReportingProxy.h', 'workers/WorkerRunLoop.cpp', 'workers/WorkerRunLoop.h', 'workers/WorkerScriptLoader.cpp', @@ -3425,6 +3430,7 @@ 'inspector/front-end/ChangesView.js', 'inspector/front-end/Color.js', 'inspector/front-end/ConsoleView.js', + 'inspector/front-end/CookieItemsView.js', 'inspector/front-end/Database.js', 'inspector/front-end/DatabaseQueryView.js', 'inspector/front-end/DatabasesPanel.js', @@ -3466,6 +3472,7 @@ 'inspector/front-end/SidebarTreeElement.js', 'inspector/front-end/SourceFrame.js', 'inspector/front-end/SourceView.js', + 'inspector/front-end/StatusBarButton.js', 'inspector/front-end/StylesSidebarPane.js', 'inspector/front-end/TextPrompt.js', 'inspector/front-end/TopDownProfileDataGridTree.js', @@ -3481,6 +3488,7 @@ 'inspector/front-end/Images/clearConsoleButtonGlyph.png', 'inspector/front-end/Images/closeButtons.png', 'inspector/front-end/Images/consoleButtonGlyph.png', + 'inspector/front-end/Images/cookie.png', 'inspector/front-end/Images/database.png', 'inspector/front-end/Images/databasesIcon.png', 'inspector/front-end/Images/databaseTable.png', diff --git a/WebCore/WebCore.order b/WebCore/WebCore.order index 31b178c..c9441c6 100644 --- a/WebCore/WebCore.order +++ b/WebCore/WebCore.order @@ -2290,7 +2290,6 @@ __ZN3JSC8Bindings10RootObject9gcProtectEPNS_8JSObjectE __ZNK3WTF9HashTableIPN3JSC8JSObjectESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTra __ZN3WTF7HashMapIPN3JSC8JSObjectEjNS_7PtrHashIS3_EENS_10HashTraitsIS3_EENS6_IjEEE3addERKS3_RKj __ZN3WTF9HashTableIPN3JSC8JSObjectESt4pairIS3_jENS_18PairFirstExtractorIS5_EENS_7PtrHashIS3_EENS_14PairHashTraitsINS_10HashTrai -__ZN7WebCore19InspectorController34inspectedWindowScriptObjectClearedEPNS_5FrameE __ZN7WebCore6StringC1ERKN3JSC7UStringE __ZN7WebCore6StringC2ERKN3JSC7UStringE __ZNK7WebCore20StringSourceProvider4dataEv diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 6a19309..5eeadb7 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -10,6 +10,8 @@ symbian: { webkitlibs.sources = QtWebKit.dll webkitlibs.path = /sys/bin DEPLOYMENT += webkitlibs + + TARGET.UID3 = 0x200267C2 } include($$PWD/../WebKit.pri) @@ -106,6 +108,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=.): DEFINES += ENABLE_JAVASCRIPT_DEBUGGER=1 !contains(DEFINES, ENABLE_DATABASE=.): DEFINES += ENABLE_DATABASE=1 +!contains(DEFINES, ENABLE_EVENTSOURCE=.): DEFINES += ENABLE_EVENTSOURCE=1 !contains(DEFINES, ENABLE_OFFLINE_WEB_APPLICATIONS=.): DEFINES += ENABLE_OFFLINE_WEB_APPLICATIONS=1 !contains(DEFINES, ENABLE_DOM_STORAGE=.): DEFINES += ENABLE_DOM_STORAGE=1 !contains(DEFINES, ENABLE_ICONDATABASE=.): DEFINES += ENABLE_ICONDATABASE=1 @@ -125,6 +128,7 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { !contains(DEFINES, ENABLE_XPATH=.): DEFINES += ENABLE_XPATH=1 !contains(DEFINES, ENABLE_XSLT=.): DEFINES += ENABLE_XSLT=0 #!contains(DEFINES, ENABLE_XBL=.): DEFINES += ENABLE_XBL=1 +!contains(DEFINES, ENABLE_WCSS=.): DEFINES += ENABLE_WCSS=0 !contains(DEFINES, ENABLE_WML=.): DEFINES += ENABLE_WML=0 !contains(DEFINES, ENABLE_SHARED_WORKERS=.): DEFINES += ENABLE_SHARED_WORKERS=0 !contains(DEFINES, ENABLE_WORKERS=.): DEFINES += ENABLE_WORKERS=1 @@ -152,6 +156,9 @@ contains(DEFINES, ENABLE_SINGLE_THREADED=1) { else:DEFINES += ENABLE_VIDEO=0 } +# HTML5 datalist support +!contains(DEFINES, ENABLE_DATALIST=.): DEFINES += ENABLE_DATALIST=1 + # Nescape plugins support (NPAPI) !contains(DEFINES, ENABLE_NETSCAPE_PLUGIN_API=.) { unix|win32-*:!embedded:!wince*:!symbian { @@ -193,6 +200,7 @@ INCLUDEPATH = \ $$PWD/loader/appcache \ $$PWD/loader/archive \ $$PWD/loader/icon \ + $$PWD/notifications \ $$PWD/page \ $$PWD/page/animation \ $$PWD/platform \ @@ -254,9 +262,16 @@ WALDOCSSVALUES = $$PWD/css/CSSValueKeywords.in DASHBOARDSUPPORTCSSPROPERTIES = $$PWD/css/DashboardSupportCSSPropertyNames.in -SVGCSSPROPERTIES = $$PWD/css/SVGCSSPropertyNames.in -SVGCSSVALUES = $$PWD/css/SVGCSSValueKeywords.in +contains(DEFINES, ENABLE_SVG=1) { + EXTRACSSPROPERTIES += $$PWD/css/SVGCSSPropertyNames.in + EXTRACSSVALUES += $$PWD/css/SVGCSSValueKeywords.in +} + +contains(DEFINES, ENABLE_WCSS=1) { + EXTRACSSPROPERTIES += $$PWD/css/WCSSPropertyNames.in + EXTRACSSVALUES += $$PWD/css/WCSSValueKeywords.in +} STYLESHEETS_EMBED = \ $$PWD/css/html.css \ @@ -364,6 +379,7 @@ IDL_BINDINGS += \ html/HTMLDataGridCellElement.idl \ html/HTMLDataGridColElement.idl \ html/HTMLDataGridRowElement.idl \ + html/HTMLDataListElement.idl \ html/HTMLDirectoryElement.idl \ html/HTMLDivElement.idl \ html/HTMLDListElement.idl \ @@ -430,6 +446,7 @@ IDL_BINDINGS += \ page/Coordinates.idl \ page/DOMSelection.idl \ page/DOMWindow.idl \ + page/EventSource.idl \ page/Geolocation.idl \ page/Geoposition.idl \ page/History.idl \ @@ -628,6 +645,7 @@ SOURCES += \ bindings/js/JSClipboardCustom.cpp \ bindings/js/JSConsoleCustom.cpp \ bindings/js/JSCSSRuleCustom.cpp \ + bindings/js/JSCSSRuleListCustom.cpp \ bindings/js/JSCSSStyleDeclarationCustom.cpp \ bindings/js/JSCSSValueCustom.cpp \ bindings/js/JSCoordinatesCustom.cpp \ @@ -645,11 +663,14 @@ SOURCES += \ bindings/js/JSDOMWindowShell.cpp \ bindings/js/JSElementCustom.cpp \ bindings/js/JSEventCustom.cpp \ + bindings/js/JSEventSourceConstructor.cpp \ + bindings/js/JSEventSourceCustom.cpp \ bindings/js/JSEventTarget.cpp \ bindings/js/JSGeolocationCustom.cpp \ bindings/js/JSHTMLAllCollection.cpp \ bindings/js/JSHistoryCustom.cpp \ bindings/js/JSHTMLAppletElementCustom.cpp \ + bindings/js/JSHTMLCanvasElementCustom.cpp \ bindings/js/JSHTMLCollectionCustom.cpp \ bindings/js/JSHTMLDataGridElementCustom.cpp \ bindings/js/JSHTMLDocumentCustom.cpp \ @@ -944,6 +965,7 @@ SOURCES += \ html/HTMLDataGridCellElement.cpp \ html/HTMLDataGridColElement.cpp \ html/HTMLDataGridRowElement.cpp \ + html/HTMLDataListElement.cpp \ html/HTMLDirectoryElement.cpp \ html/HTMLDivElement.cpp \ html/HTMLDListElement.cpp \ @@ -1076,6 +1098,7 @@ SOURCES += \ page/NavigatorBase.cpp \ page/DragController.cpp \ page/EventHandler.cpp \ + page/EventSource.cpp \ page/FocusController.cpp \ page/Frame.cpp \ page/FrameTree.cpp \ @@ -1323,6 +1346,7 @@ HEADERS += \ bindings/js/JSDOMWindowCustom.h \ bindings/js/JSDOMWindowShell.h \ bindings/js/JSEventListener.h \ + bindings/js/JSEventSourceConstructor.h \ bindings/js/JSEventTarget.h \ bindings/js/JSHistoryCustom.h \ bindings/js/JSHTMLAllCollection.h \ @@ -1748,6 +1772,7 @@ HEADERS += \ page/DOMWindow.h \ page/DragController.h \ page/EventHandler.h \ + page/EventSource.h \ page/FocusController.h \ page/Frame.h \ page/FrameTree.h \ @@ -2426,6 +2451,10 @@ contains(DEFINES, ENABLE_DATAGRID=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_DATAGRID=1 } +contains(DEFINES, ENABLE_EVENTSOURCE=1) { + FEATURE_DEFINES_JAVASCRIPT += ENABLE_EVENTSOURCE=1 +} + contains(DEFINES, ENABLE_SQLITE=1) { !system-sqlite:exists( $${SQLITE3SRCDIR}/sqlite3.c ) { # Build sqlite3 into WebCore from source @@ -2473,6 +2502,7 @@ contains(DEFINES, ENABLE_DATABASE=1) { storage/SQLResultSetRowList.cpp \ storage/SQLStatement.cpp \ storage/SQLTransaction.cpp \ + storage/SQLTransactionCoordinator.cpp \ bindings/js/JSCustomSQLStatementCallback.cpp \ bindings/js/JSCustomSQLStatementErrorCallback.cpp \ bindings/js/JSCustomSQLTransactionCallback.cpp \ @@ -2500,6 +2530,7 @@ contains(DEFINES, ENABLE_DOM_STORAGE=1) { storage/SQLResultSetRowList.h \ storage/SQLStatement.h \ storage/SQLTransaction.h \ + storage/SQLTransactionCoordinator.h \ storage/StorageArea.h \ storage/StorageAreaImpl.h \ storage/StorageAreaSync.h \ @@ -2672,6 +2703,14 @@ contains(DEFINES, ENABLE_FILTERS=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_FILTERS=1 } +contains(DEFINES, ENABLE_WCSS=1) { + FEATURE_DEFINES_JAVASCRIPT += ENABLE_WCSS=1 + contains(DEFINES, ENABLE_XHTMLMP=0) { + DEFINES -= ENABLE_XHTMLMP=0 + DEFINES += ENABLE_XHTMLMP=1 + } +} + contains(DEFINES, ENABLE_WML=1) { SOURCES += \ wml/WMLAElement.cpp \ @@ -2980,42 +3019,25 @@ contains(DEFINES, ENABLE_SVG=1) { xlinknames.variable_out = GENERATED_SOURCES addExtraCompilerWithHeader(xlinknames) - # GENERATOR 6-A: - cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp - cssprops.input = WALDOCSSPROPS - cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES $$SVGCSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf - cssprops.CONFIG = target_predeps no_link - cssprops.variable_out = - cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES SVGCSSPROPERTIES - addExtraCompilerWithHeader(cssprops) - - # GENERATOR 6-B: - cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c - cssvalues.input = WALDOCSSVALUES - cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$SVGCSSVALUES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf - cssvalues.CONFIG = target_predeps no_link - cssvalues.variable_out = - cssvalues.depend = ${QMAKE_FILE_NAME} SVGCSSVALUES - addExtraCompilerWithHeader(cssvalues) -} else { - # GENERATOR 6-A: - cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp - cssprops.input = WALDOCSSPROPS - cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf - cssprops.CONFIG = target_predeps no_link - cssprops.variable_out = - cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES - addExtraCompilerWithHeader(cssprops) - - # GENERATOR 6-B: - cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c - cssvalues.input = WALDOCSSVALUES - cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf - cssvalues.CONFIG = target_predeps no_link - cssvalues.variable_out = - cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR_SLASH}${QMAKE_FILE_BASE}.h - addExtraCompiler(cssvalues) -} +} +# GENERATOR 6-A: +cssprops.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.cpp +cssprops.input = WALDOCSSPROPS +cssprops.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$DASHBOARDSUPPORTCSSPROPERTIES $$EXTRACSSPROPERTIES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makeprop.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf +cssprops.CONFIG = target_predeps no_link +cssprops.variable_out = +cssprops.depend = ${QMAKE_FILE_NAME} DASHBOARDSUPPORTCSSPROPERTIES EXTRACSSPROPERTIES +addExtraCompilerWithHeader(cssprops) + +# GENERATOR 6-B: +cssvalues.output = $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.c +cssvalues.input = WALDOCSSVALUES +cssvalues.commands = perl -ne \"print lc\" ${QMAKE_FILE_NAME} $$EXTRACSSVALUES > $${GENERATED_SOURCES_DIR}$${QMAKE_DIR_SEP}${QMAKE_FILE_BASE}.in && cd $$GENERATED_SOURCES_DIR && perl $$PWD/css/makevalues.pl && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.strip ${QMAKE_FILE_BASE}.gperf +cssvalues.CONFIG = target_predeps no_link +cssvalues.variable_out = +cssvalues.depend = ${QMAKE_FILE_NAME} EXTRACSSVALUES +cssvalues.clean = ${QMAKE_FILE_OUT} ${QMAKE_VAR_GENERATED_SOURCES_DIR_SLASH}${QMAKE_FILE_BASE}.h +addExtraCompiler(cssvalues) contains(DEFINES, ENABLE_JAVASCRIPT_DEBUGGER=1) { FEATURE_DEFINES_JAVASCRIPT += ENABLE_JAVASCRIPT_DEBUGGER=1 @@ -3241,3 +3263,20 @@ CONFIG(QTDIR_build):isEqual(QT_MAJOR_VERSION, 4):greaterThan(QT_MINOR_VERSION, 4 CONFIG += no_debug_info } +!win32-g++:win32:contains(QMAKE_HOST.arch, x86_64):{ + asm_compiler.commands = ml64 /c + asm_compiler.commands += /Fo ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN} + asm_compiler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)} + asm_compiler.input = ASM_SOURCES + asm_compiler.variable_out = OBJECTS + asm_compiler.name = compiling[asm] ${QMAKE_FILE_IN} + silent:asm_compiler.commands = @echo compiling[asm] ${QMAKE_FILE_IN} && $$asm_compiler.commands + QMAKE_EXTRA_COMPILERS += asm_compiler + + ASM_SOURCES += \ + plugins/win/PaintHooks.asm + if(win32-msvc2005|win32-msvc2008):equals(TEMPLATE_PREFIX, "vc") { + SOURCES += \ + plugins/win/PaintHooks.asm + } +} diff --git a/WebCore/WebCore.vcproj/QTMovieWin.vcproj b/WebCore/WebCore.vcproj/QTMovieWin.vcproj index 593855b..e53bd22 100644 --- a/WebCore/WebCore.vcproj/QTMovieWin.vcproj +++ b/WebCore/WebCore.vcproj/QTMovieWin.vcproj @@ -23,7 +23,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" @@ -96,7 +96,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" @@ -168,7 +168,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c

if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
" /> <Tool Name="VCCustomBuildTool" diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 7aef730..9d08b56 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -67,7 +67,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -123,7 +123,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -178,7 +178,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -233,7 +233,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
<Configuration
@@ -289,7 +289,7 @@ />
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
mkdir 2>NUL "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

xcopy /y /d "$(ProjectDir)..\config.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(WebKitOutputDir)\obj\WebCore\DerivedSources\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\accessibility\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\inspector\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\appcache\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\archive\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\loader\icon\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\history\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\html\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\notifications\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\css\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cf\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\transforms\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\graphics\opentype\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\text\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\curl\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\network\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\sql\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\platform\cairo\cairo\src\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bindings\js\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\animation\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\page\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\bridge\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\plugins\win\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\rendering\style\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\editing\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\dom\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\xml\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\svg\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\storage\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)..\workers\*.h" "$(WebKitOutputDir)\include\WebCore"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\bindings\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\bindings"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\parser\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\parser"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\runtime\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\runtime"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\masm\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\masm"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\pcre\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\pcre"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\profiler\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\profiler"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wrec\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wrec"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode"
xcopy /y /d "$(ProjectDir)\..\ForwardingHeaders\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\WebCore\ForwardingHeaders\wtf\unicode\icu"

mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\inspector\front-end\*" "$(WebKitOutputDir)\bin\WebKit.resources\inspector"
mkdir 2>NUL "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"
xcopy /y /d /s /exclude:xcopy.excludes "$(ProjectDir)\..\English.lproj\localizedStrings.js" "$(WebKitOutputDir)\bin\WebKit.resources\en.lproj"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
</Configuration>
</Configurations>
@@ -2779,6 +2779,54 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSource.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSEventSource.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSFile.cpp"
>
<FileConfiguration
@@ -3787,6 +3835,14 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDataListElement.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDataListElement.cpp"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSHTMLDirectoryElement.cpp"
>
<FileConfiguration
@@ -7387,6 +7443,102 @@ >
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotification.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotification.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotificationCenter.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>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSNotificationCenter.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSOverflowEvent.cpp"
>
<FileConfiguration
@@ -16717,6 +16869,14 @@ >
</File>
<File
+ RelativePath="..\page\EventSource.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\EventSource.h"
+ >
+ </File>
+ <File
RelativePath="..\page\FocusController.cpp"
>
</File>
@@ -18389,6 +18549,34 @@ >
</File>
<File
+ RelativePath="..\platform\graphics\ImageSource.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>
+ </File>
+ <File
RelativePath="..\platform\graphics\ImageSource.h"
>
</File>
@@ -19564,34 +19752,6 @@ </FileConfiguration>
</File>
<File
- RelativePath="..\platform\graphics\cairo\ImageSourceCairo.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>
- </File>
- <File
RelativePath="..\platform\graphics\cairo\PathCairo.cpp"
>
<FileConfiguration
@@ -23632,10 +23792,6 @@ >
</File>
<File
- RelativePath="..\dom\DocPtr.h"
- >
- </File>
- <File
RelativePath="..\dom\Document.cpp"
>
</File>
@@ -24292,6 +24448,10 @@ >
</File>
<File
+ RelativePath="..\workers\WorkerReportingProxy.h"
+ >
+ </File>
+ <File
RelativePath="..\workers\WorkerRunLoop.cpp"
>
</File>
@@ -24321,6 +24481,34 @@ </File>
</Filter>
<Filter
+ Name="notifications"
+ >
+ <File
+ RelativePath="..\notifications\Notification.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\Notification.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationCenter.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationCenter.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationContents.h"
+ >
+ </File>
+ <File
+ RelativePath="..\notifications\NotificationPresenter.h"
+ >
+ </File>
+ </Filter>
+ <Filter
Name="editing"
>
<File
@@ -25552,6 +25740,14 @@ >
</File>
<File
+ RelativePath="..\html\HTMLDataListElement.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\html\HTMLDataListElement.h"
+ >
+ </File>
+ <File
RelativePath="..\html\HTMLDirectoryElement.cpp"
>
<FileConfiguration
@@ -28491,6 +28687,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSCSSRuleListCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSCSSStyleDeclarationCustom.cpp"
>
</File>
@@ -28575,6 +28775,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSDesktopNotificationsCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSDocumentCustom.cpp"
>
</File>
@@ -28643,6 +28847,18 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSEventSourceConstructor.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSEventSourceConstructor.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSEventSourceCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSEventTarget.cpp"
>
</File>
@@ -28671,6 +28887,10 @@ >
</File>
<File
+ RelativePath="..\bindings\js\JSHTMLCanvasElementCustom.cpp"
+ >
+ </File>
+ <File
RelativePath="..\bindings\js\JSHTMLCollectionCustom.cpp"
>
</File>
@@ -30596,6 +30816,14 @@ >
</File>
<File
+ RelativePath="..\storage\SQLTransactionCoordinator.h"
+ >
+ </File>
+ <File
+ RelativePath="..\storage\SQLTransactionCoordinator.cpp"
+ >
+ </File>
+ <File
RelativePath="..\storage\SQLTransactionErrorCallback.h"
>
</File>
@@ -31083,6 +31311,10 @@ >
</File>
<File
+ RelativePath="..\inspector\front-end\StatusBarButton.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\StylesSidebarPane.js"
>
</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreCURL.vsprops b/WebCore/WebCore.vcproj/WebCoreCURL.vsprops index aaadb97..4320e05 100644 --- a/WebCore/WebCore.vcproj/WebCoreCURL.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCURL.vsprops @@ -7,5 +7,6 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="$(ProjectDir)..\platform\network\curl"
+ PreprocessorDefinitions="USE_WINDOWS_SSPI;USE_SSLEAY;HAVE_ZLIB"
/>
</VisualStudioPropertySheet>
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops index 3dd37fc..cbf71e1 100644 --- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops +++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops @@ -7,8 +7,8 @@ > <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(ProjectDir)..\";"$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\icu";"$(WebKitLibrariesDir)\include\iconv";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)..\svg\animation"" - PreprocessorDefinitions="__WIN32__;WEBCORE_CONTEXT_MENUS;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT" + AdditionalIncludeDirectories=""$(ProjectDir)..\";"$(ProjectDir)..";"$(ProjectDir)..\accessibility";"$(ProjectDir)..\accessibility\win";"$(ProjectDir)..\bridge";"$(ProjectDir)..\bridge\c";"$(ProjectDir)..\css";"$(ProjectDir)..\editing";"$(ProjectDir)..\rendering";"$(ProjectDir)..\rendering\style";"$(ProjectDir)..\bindings\js";"$(ProjectDir)..\dom";"$(ProjectDir)..\dom\default";"$(ProjectDir)..\history";"$(ProjectDir)..\html";"$(ProjectDir)..\html\canvas";"$(ProjectDir)..\inspector";"$(ProjectDir)..\loader";"$(ProjectDir)..\loader\appcache";"$(ProjectDir)..\loader\archive";"$(ProjectDir)..\loader\archive\cf";"$(ProjectDir)..\loader\icon";"$(ProjectDir)..\notifications";"$(ProjectDir)..\page";"$(ProjectDir)..\page\animation";"$(ProjectDir)..\page\win";"$(ProjectDir)..\platform";"$(ProjectDir)..\platform\animation";"$(ProjectDir)..\platform\sql";"$(ProjectDir)..\platform\win";"$(ProjectDir)..\platform\network";"$(ProjectDir)..\platform\network\win";"$(ProjectDir)..\platform\cf";"$(ProjectDir)..\platform\graphics";"$(ProjectDir)..\platform\graphics\opentype";"$(ProjectDir)..\platform\graphics\transforms";"$(ProjectDir)..\platform\text";"$(ProjectDir)..\platform\graphics\win";"$(ProjectDir)..\xml";"$(WebKitOutputDir)\obj\WebCore\DerivedSources";"$(ProjectDir)..\plugins";"$(ProjectDir)..\plugins\win";"$(ProjectDir)..\svg\graphics";"$(ProjectDir)..\svg\graphics\filters";"$(ProjectDir)..\svg";"$(ProjectDir)..\wml";"$(ProjectDir)..\storage";"$(ProjectDir)..\workers";"$(WebKitOutputDir)\include";"$(WebKitOutputDir)\include\private";"$(WebKitOutputDir)\include\JavaScriptCore";"$(WebKitOutputDir)\include\private\JavaScriptCore";"$(ProjectDir)..\ForwardingHeaders";"$(WebKitLibrariesDir)\include";"$(WebKitLibrariesDir)\include\private";"$(WebKitLibrariesDir)\include\private\JavaScriptCore";"$(WebKitLibrariesDir)\include\icu";"$(WebKitLibrariesDir)\include\iconv";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitLibrariesDir)\include\sqlite";"$(WebKitLibrariesDir)\include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)..\svg\animation"" + PreprocessorDefinitions="__WIN32__;WEBCORE_CONTEXT_MENUS;ENABLE_CHANNEL_MESSAGING;ENABLE_DATABASE;ENABLE_DATAGRID;ENABLE_DATALIST;ENABLE_DOM_STORAGE;ENABLE_EVENTSOURCE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_RUBY;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WEB_SOCKETS;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT" UsePrecompiledHeader="2" PrecompiledHeaderThrough="WebCorePrefix.h" ForcedIncludeFiles="WebCorePrefix.h" @@ -19,6 +19,6 @@ /> <Tool Name="VCPreBuildEventTool" - CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")
exit /b
" + CommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

touch "$(WebKitOutputDir)\tmp.cpp"
cl /analyze /nologo /c "$(WebKitOutputDir)\tmp.cpp" /Fo"$(IntDir)\tmp.obj" 2>&1 | findstr D9040
if ERRORLEVEL 1 (set EnablePREfast="true") else (set EnablePREfast="false")
if ERRORLEVEL 1 (set AnalyzeWithLargeStack="/analyze:65536") else (set AnalyzeWithLargeStack="")
exit /b
" /> </VisualStudioPropertySheet> diff --git a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj index a7e8f6f..4a39032 100644 --- a/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj +++ b/WebCore/WebCore.vcproj/WebCoreGenerated.vcproj @@ -22,8 +22,8 @@ > <Tool Name="VCNMakeTool" - BuildCommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" - ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" + BuildCommandLine="%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
if exist "$(WebKitOutputDir)\buildfailed" grep XX$(ProjectName)XX "$(WebKitOutputDir)\buildfailed"
if errorlevel 1 exit 1
echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" + ReBuildCommandLine="echo XX$(ProjectName)XX > "$(WebKitOutputDir)\buildfailed"

del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
%SystemDrive%\cygwin\bin\which.exe bash
if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH%
cmd /c
bash build-generated-files.sh "$(WebKitOutputDir)" "$(WebKitLibrariesDir)"
bash migrate-idls.sh "$(WebKitOutputDir)/obj/WebKit/DOMInterfaces"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" CleanCommandLine="del /s /q "$(WebKitOutputDir)\obj\WebCore\DerivedSources"
del /s /q "$(WebKitOutputDir)\obj\WebKit\DOMInterfaces"
if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
" Output="" PreprocessorDefinitions="" diff --git a/WebCore/WebCore.vcproj/build-generated-files.sh b/WebCore/WebCore.vcproj/build-generated-files.sh index e4cbd45..46b8c7b 100644 --- a/WebCore/WebCore.vcproj/build-generated-files.sh +++ b/WebCore/WebCore.vcproj/build-generated-files.sh @@ -71,5 +71,5 @@ mkdir -p "${BUILT_PRODUCTS_DIR}/DerivedSources" cd "${BUILT_PRODUCTS_DIR}/DerivedSources" export WebCore="${XSRCROOT}" -export FEATURE_DEFINES="ENABLE_CHANNEL_MESSAGING ENABLE_DATABASE ENABLE_DATAGRID ENABLE_DOM_STORAGE ENABLE_ICONDATABASE ENABLE_JAVASCRIPT_DEBUGGER ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_RUBY ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_WEB_SOCKETS ENABLE_WORKERS ENABLE_XPATH ENABLE_XSLT" +export FEATURE_DEFINES="ENABLE_CHANNEL_MESSAGING ENABLE_DATABASE ENABLE_DATAGRID ENABLE_DATALIST ENABLE_DOM_STORAGE ENABLE_EVENTSOURCE ENABLE_ICONDATABASE ENABLE_JAVASCRIPT_DEBUGGER ENABLE_OFFLINE_WEB_APPLICATIONS ENABLE_RUBY ENABLE_SVG ENABLE_SVG_ANIMATION ENABLE_SVG_AS_IMAGE ENABLE_SVG_FONTS ENABLE_SVG_FOREIGN_OBJECT ENABLE_SVG_USE ENABLE_VIDEO ENABLE_WEB_SOCKETS ENABLE_WORKERS ENABLE_XPATH ENABLE_XSLT" make -f "$WebCore/DerivedSources.make" -j ${NUMCPUS} || exit 1 diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj index 96c4fc7..e4d8124 100644 --- a/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/WebCore/WebCore.xcodeproj/project.pbxproj @@ -635,6 +635,16 @@ 31C0FF4C0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */; }; 31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */; }; 31C0FF4E0E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */; }; + 33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503C9910179A74003B47E1 /* NotificationPresenter.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503C9F10179AD7003B47E1 /* JSNotification.cpp */; }; + 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA010179AD7003B47E1 /* JSNotification.h */; }; + 33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */; }; + 33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */; }; + 33503CC010179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */; }; + 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33503CC61017A1B1003B47E1 /* Notification.cpp */; }; + 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3390CA510FFC157B00921962 /* NotificationCenter.cpp */; }; + 3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA520FFC157B00921962 /* NotificationCenter.h */; }; + 3390CA580FFC157B00921962 /* NotificationContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 3390CA540FFC157B00921962 /* NotificationContents.h */; }; 371F4F400D25B9AF00ECE0D5 /* FontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */; settings = {ATTRIBUTES = (Private, ); }; }; 371F4F410D25B9AF00ECE0D5 /* FontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */; }; 371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */ = {isa = PBXBuildFile; fileRef = 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */; }; @@ -675,6 +685,7 @@ 4162A4581011464700DFF3ED /* JSDedicatedWorkerContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerContext.h */; }; 4167EBF5102962BA003D252A /* DefaultSharedWorkerRepository.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */; }; 4167EBF6102962BA003D252A /* DefaultSharedWorkerRepository.h in Headers */ = {isa = PBXBuildFile; fileRef = 4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */; }; + 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; }; 416E75BE0EDF8FD700360E1D /* ScriptCallStack.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */; }; 416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */; }; 416E75CB0EDF90C700360E1D /* ScriptCallFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */; }; @@ -965,7 +976,7 @@ 6515EC910D9723FF0063D49A /* JSSVGAltGlyphElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6515EC8F0D9723FF0063D49A /* JSSVGAltGlyphElement.cpp */; }; 6515EC920D9723FF0063D49A /* JSSVGAltGlyphElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6515EC900D9723FF0063D49A /* JSSVGAltGlyphElement.h */; }; 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */; }; - 65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */; }; + 65488D6B0DD5A83D009D83B2 /* StringSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 65488D6A0DD5A83D009D83B2 /* StringSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; 6550B69D099DF0270090D781 /* CDATASection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B693099DF0270090D781 /* CDATASection.cpp */; }; 6550B69E099DF0270090D781 /* CDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 6550B694099DF0270090D781 /* CDATASection.h */; }; 6550B69F099DF0270090D781 /* CharacterData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6550B695099DF0270090D781 /* CharacterData.cpp */; }; @@ -2087,6 +2098,8 @@ 938E65F709F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938E65F609F0985D008A48EC /* JSHTMLElementWrapperFactory.cpp */; }; 938E666009F09B81008A48EC /* JSHTMLCanvasElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */; }; 938E666209F09B87008A48EC /* JSHTMLCanvasElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */; }; + 9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */; }; + 9392262F10321084006E7D5D /* JSCSSRuleListCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */; }; 9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1410AD185F400691BD4 /* RenderCounter.h */; }; 9392F1440AD185FE00691BD4 /* RenderCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */; }; 9392F14C0AD1861B00691BD4 /* CounterNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F14B0AD1861B00691BD4 /* CounterNode.h */; }; @@ -2136,7 +2149,6 @@ 93EB169509F880B00091F8FF /* WebCoreSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */; }; 93EB169709F880C00091F8FF /* WebCoreSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB169609F880C00091F8FF /* WebCoreSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; }; 93EB355F09E37FD600F43799 /* MouseEventWithHitTestResults.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */; }; - 93EEC1FA09C2877700C515D1 /* DocPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EEC1E709C2877700C515D1 /* DocPtr.h */; settings = {ATTRIBUTES = (Private, ); }; }; 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 */; }; @@ -3851,6 +3863,8 @@ B5A684240FFABEAA00D24689 /* SQLiteFileSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */; }; B6D39711103AF29D00A83BC7 /* MockGeolocationService.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B6D39710103AF29D00A83BC7 /* MockGeolocationService.cpp */; }; B6D39715103AF2BB00A83BC7 /* MockGeolocationService.h in Headers */ = {isa = PBXBuildFile; fileRef = B6D39714103AF2BB00A83BC7 /* MockGeolocationService.h */; }; + B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; }; + B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; }; BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; }; BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; }; BC00F0060E0A185500FD04E3 /* DOMFileInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */; }; @@ -4372,7 +4386,7 @@ C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; }; C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */ = {isa = PBXBuildFile; fileRef = C6D74AD309AA282E000B0A52 /* ModifySelectionListLevel.h */; }; C6D74AE409AA290A000B0A52 /* ModifySelectionListLevel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C6D74AE309AA290A000B0A52 /* ModifySelectionListLevel.cpp */; }; - CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; }; + CE54FD381016D9A6008B44C8 /* ScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = CE54FD371016D9A6008B44C8 /* ScriptSourceProvider.h */; settings = {ATTRIBUTES = (Private, ); }; }; D05CED290A40BB2C00C5AF38 /* FormatBlockCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D05CED270A40BB2C00C5AF38 /* FormatBlockCommand.cpp */; }; D05CED2A0A40BB2C00C5AF38 /* FormatBlockCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D05CED280A40BB2C00C5AF38 /* FormatBlockCommand.h */; }; D06C0D8F0CFD11460065F43F /* RemoveFormatCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = D06C0D8D0CFD11460065F43F /* RemoveFormatCommand.h */; }; @@ -4386,12 +4400,20 @@ D23CA55D0AB0EAAE005108A5 /* JSRangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */; }; D23CA55F0AB0EAB6005108A5 /* JSRangeException.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */; }; D23CA56C0AB0EB8D005108A5 /* RangeException.h in Headers */ = {isa = PBXBuildFile; fileRef = D23CA56B0AB0EB8D005108A5 /* RangeException.h */; }; + D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; }; DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; }; DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; }; DD05FE0D0B8BA3C6009ACDFE /* WebCoreObjCExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; DD763BB20992C2C900740B8E /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DD763BB10992C2C900740B8E /* libxml2.dylib */; }; DD7CDF250A23CF9800069928 /* CSSUnknownRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CCE0A1989CA007FB8C5 /* CSSUnknownRule.h */; }; DDE63ED50B7D45A800226998 /* DOMTextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 933A14750B7D1BAF00A53FFD /* DOMTextEvent.h */; }; + E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B17C53EAC1C1FBEE /* EventSource.h */; }; + E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */; }; + E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */; }; + E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */; }; + E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */; }; + E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */; }; + E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */; }; E107400D0E77BDC00033AF24 /* JSMessageChannel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */; }; E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */ = {isa = PBXBuildFile; fileRef = E107400C0E77BDC00033AF24 /* JSMessageChannel.h */; }; E10743240E7835830033AF24 /* JSMessageChannelConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */; }; @@ -4521,6 +4543,13 @@ ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = ED501DC50B249F2900AE18D9 /* EditorMac.mm */; }; EDE3A5000C7A430600956A37 /* ColorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = EDE3A4FF0C7A430600956A37 /* ColorMac.h */; settings = {ATTRIBUTES = (Private, ); }; }; EDEC98030AED7E170059137F /* WebCorePrefix.h in Headers */ = {isa = PBXBuildFile; fileRef = EDEC98020AED7E170059137F /* WebCorePrefix.h */; }; + F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */; }; + F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */; }; + F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */; }; + F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */; }; + F5C041E50FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */; }; + F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */; }; + F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */; }; F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; }; F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; }; F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; }; @@ -5634,6 +5663,19 @@ 31C0FF460E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEvent.h; sourceTree = "<group>"; }; 31C0FF470E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMWebKitTransitionEvent.mm; sourceTree = "<group>"; }; 31C0FF480E4CEFDD007D6FE5 /* DOMWebKitTransitionEventInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWebKitTransitionEventInternal.h; sourceTree = "<group>"; }; + 333F704E0FB49CA2008E12A6 /* Notification.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = Notification.idl; path = notifications/Notification.idl; sourceTree = "<group>"; }; + 333F704F0FB49CA2008E12A6 /* Notification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notification.h; path = notifications/Notification.h; sourceTree = "<group>"; }; + 33503C9910179A74003B47E1 /* NotificationPresenter.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; name = NotificationPresenter.h; path = notifications/NotificationPresenter.h; sourceTree = "<group>"; }; + 33503C9F10179AD7003B47E1 /* JSNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotification.cpp; sourceTree = "<group>"; }; + 33503CA010179AD7003B47E1 /* JSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotification.h; sourceTree = "<group>"; }; + 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotificationCenter.cpp; sourceTree = "<group>"; }; + 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotificationCenter.h; sourceTree = "<group>"; }; + 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDesktopNotificationsCustom.cpp; sourceTree = "<group>"; }; + 33503CC61017A1B1003B47E1 /* Notification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Notification.cpp; path = notifications/Notification.cpp; sourceTree = "<group>"; }; + 3390CA510FFC157B00921962 /* NotificationCenter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NotificationCenter.cpp; path = notifications/NotificationCenter.cpp; sourceTree = "<group>"; }; + 3390CA520FFC157B00921962 /* NotificationCenter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationCenter.h; path = notifications/NotificationCenter.h; sourceTree = "<group>"; }; + 3390CA530FFC157B00921962 /* NotificationCenter.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NotificationCenter.idl; path = notifications/NotificationCenter.idl; sourceTree = "<group>"; }; + 3390CA540FFC157B00921962 /* NotificationContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NotificationContents.h; path = notifications/NotificationContents.h; sourceTree = "<group>"; }; 371F4F3E0D25B9AF00ECE0D5 /* FontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontData.h; sourceTree = "<group>"; }; 371F4F3F0D25B9AF00ECE0D5 /* FontData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontData.cpp; sourceTree = "<group>"; }; 371F4FFA0D25E7F300ECE0D5 /* SegmentedFontData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SegmentedFontData.h; sourceTree = "<group>"; }; @@ -5675,6 +5717,7 @@ 4162A4561011464700DFF3ED /* JSDedicatedWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerContext.h; sourceTree = "<group>"; }; 4167EBF3102962BA003D252A /* DefaultSharedWorkerRepository.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultSharedWorkerRepository.cpp; path = workers/DefaultSharedWorkerRepository.cpp; sourceTree = "<group>"; }; 4167EBF4102962BA003D252A /* DefaultSharedWorkerRepository.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultSharedWorkerRepository.h; path = workers/DefaultSharedWorkerRepository.h; sourceTree = "<group>"; }; + 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WorkerReportingProxy.h; path = workers/WorkerReportingProxy.h; sourceTree = "<group>"; }; 416E75BC0EDF8FD700360E1D /* ScriptCallStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallStack.h; sourceTree = "<group>"; }; 416E75BD0EDF8FD700360E1D /* ScriptCallStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptCallStack.cpp; sourceTree = "<group>"; }; 416E75C90EDF90C700360E1D /* ScriptCallFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptCallFrame.h; sourceTree = "<group>"; }; @@ -7097,6 +7140,8 @@ 938E662509F09956008A48EC /* HTMLCanvasElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLCanvasElement.idl; sourceTree = "<group>"; }; 938E665F09F09B81008A48EC /* JSHTMLCanvasElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElement.cpp; sourceTree = "<group>"; }; 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLCanvasElement.h; sourceTree = "<group>"; }; + 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLCanvasElementCustom.cpp; sourceTree = "<group>"; }; + 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSRuleListCustom.cpp; sourceTree = "<group>"; }; 9392F1410AD185F400691BD4 /* RenderCounter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderCounter.h; sourceTree = "<group>"; }; 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCounter.cpp; sourceTree = "<group>"; }; 9392F14B0AD1861B00691BD4 /* CounterNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CounterNode.h; sourceTree = "<group>"; }; @@ -7158,7 +7203,6 @@ 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseEventWithHitTestResults.cpp; sourceTree = "<group>"; }; 93EEC1E509C2877700C515D1 /* Attr.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Attr.idl; sourceTree = "<group>"; }; 93EEC1E609C2877700C515D1 /* CharacterData.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CharacterData.idl; sourceTree = "<group>"; }; - 93EEC1E709C2877700C515D1 /* DocPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocPtr.h; sourceTree = "<group>"; }; 93EEC1E809C2877700C515D1 /* DocumentType.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DocumentType.idl; sourceTree = "<group>"; }; 93EEC1E909C2877700C515D1 /* DOMImplementation.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMImplementation.idl; sourceTree = "<group>"; }; 93EEC1EA09C2877700C515D1 /* Element.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Element.idl; sourceTree = "<group>"; }; @@ -8729,6 +8773,8 @@ B5A684230FFABEAA00D24689 /* SQLiteFileSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SQLiteFileSystem.cpp; path = sql/SQLiteFileSystem.cpp; sourceTree = "<group>"; }; B6D39710103AF29D00A83BC7 /* MockGeolocationService.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockGeolocationService.cpp; sourceTree = "<group>"; }; B6D39714103AF2BB00A83BC7 /* MockGeolocationService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockGeolocationService.h; sourceTree = "<group>"; }; + 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>"; }; BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; }; BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; }; BC00F0000E0A185500FD04E3 /* DOMFileInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFileInternal.h; sourceTree = "<group>"; }; @@ -9301,10 +9347,19 @@ D23CA55C0AB0EAAE005108A5 /* JSRangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSRangeException.h; sourceTree = "<group>"; }; D23CA55E0AB0EAB6005108A5 /* JSRangeException.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSRangeException.cpp; sourceTree = "<group>"; }; D23CA56B0AB0EB8D005108A5 /* RangeException.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RangeException.h; sourceTree = "<group>"; }; + D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; }; DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; }; DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; }; DD05FE0B0B8BA3C6009ACDFE /* WebCoreObjCExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreObjCExtras.h; sourceTree = "<group>"; }; DD763BB10992C2C900740B8E /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = /usr/lib/libxml2.dylib; sourceTree = "<absolute>"; }; + E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventSource.idl; sourceTree = "<group>"; }; + E0FEF371B17C53EAC1C1FBEE /* EventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSource.h; sourceTree = "<group>"; }; + E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventSource.cpp; sourceTree = "<group>"; }; + E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSource.h; sourceTree = "<group>"; }; + E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSource.cpp; sourceTree = "<group>"; }; + E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; }; + E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEventSourceConstructor.h; sourceTree = "<group>"; }; + E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceConstructor.cpp; sourceTree = "<group>"; }; E107400B0E77BDC00033AF24 /* JSMessageChannel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannel.cpp; sourceTree = "<group>"; }; E107400C0E77BDC00033AF24 /* JSMessageChannel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessageChannel.h; sourceTree = "<group>"; }; E10743230E7835830033AF24 /* JSMessageChannelConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMessageChannelConstructor.cpp; sourceTree = "<group>"; }; @@ -9471,6 +9526,14 @@ F587868402DE3B8601EA4122 /* Cursor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = Cursor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F587869902DE3B8601EA4122 /* DeprecatedPtrList.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = DeprecatedPtrList.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; F58EF58E02DFDFB7018635CA /* WebCore.base.exp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.exports; path = WebCore.base.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; + F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLDataListElement.cpp; sourceTree = "<group>"; }; + F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLDataListElement.h; sourceTree = "<group>"; }; + F5C041D90FFCA7CE00839D4A /* HTMLDataListElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLDataListElement.idl; sourceTree = "<group>"; }; + F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLDataListElement.h; sourceTree = "<group>"; }; + F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMHTMLDataListElement.mm; sourceTree = "<group>"; }; + F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMHTMLDataListElementInternal.h; sourceTree = "<group>"; }; + F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLDataListElement.cpp; sourceTree = "<group>"; }; + F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLDataListElement.h; sourceTree = "<group>"; }; F5C2869302846DCD018635CA /* ApplicationServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ApplicationServices.framework; path = /System/Library/Frameworks/ApplicationServices.framework; sourceTree = "<absolute>"; }; F5C2869402846DCD018635CA /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; }; F5C2869502846DCD018635CA /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; @@ -9559,6 +9622,7 @@ 93EEC1EC09C2877700C515D1 /* html */, 1C81B94D0E9732D900266E07 /* inspector */, BCB16BFB0979C38700467741 /* loader */, + 333F703D0FB49C16008E12A6 /* notifications */, 65BF02180974806300C43196 /* page */, BCF1A5BA097832090061A123 /* platform */, 5DCF83690D59157800953BC6 /* plugins */, @@ -9646,6 +9710,7 @@ A83B79120CCB003F000B0825 /* Events */, A83B79080CCAFF2B000B0825 /* HTML */, 1C5FAECA0DCFD8C900D58F78 /* Inspector */, + 33503C9C10179A9A003B47E1 /* Notifications */, 1AC226020DB69EA70089B669 /* Offline */, A9D247F90D757E4100FDF959 /* Plugins */, BC9854460CD3DA5F00069BC1 /* Ranges */, @@ -9812,6 +9877,8 @@ 1AE82EC90CAAE177002237AE /* storage */ = { isa = PBXGroup; children = ( + B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */, + B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */, 514185ED0CD65F0400763C99 /* ChangeVersionWrapper.cpp */, 514185EC0CD65F0400763C99 /* ChangeVersionWrapper.h */, 5196115E0CAC56570010A80C /* Database.cpp */, @@ -10030,6 +10097,7 @@ 2E43463D0F546A8200B0F1BA /* WorkerMessagingProxy.cpp */, 2E43463E0F546A8200B0F1BA /* WorkerMessagingProxy.h */, 2E43463F0F546A8200B0F1BA /* WorkerObjectProxy.h */, + 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */, 2E4346400F546A8200B0F1BA /* WorkerRunLoop.cpp */, 2E4346410F546A8200B0F1BA /* WorkerRunLoop.h */, A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */, @@ -10059,6 +10127,32 @@ name = animation; sourceTree = "<group>"; }; + 333F703D0FB49C16008E12A6 /* notifications */ = { + isa = PBXGroup; + children = ( + 33503CC61017A1B1003B47E1 /* Notification.cpp */, + 33503C9910179A74003B47E1 /* NotificationPresenter.h */, + 3390CA510FFC157B00921962 /* NotificationCenter.cpp */, + 3390CA520FFC157B00921962 /* NotificationCenter.h */, + 3390CA530FFC157B00921962 /* NotificationCenter.idl */, + 3390CA540FFC157B00921962 /* NotificationContents.h */, + 333F704E0FB49CA2008E12A6 /* Notification.idl */, + 333F704F0FB49CA2008E12A6 /* Notification.h */, + ); + name = notifications; + sourceTree = "<group>"; + }; + 33503C9C10179A9A003B47E1 /* Notifications */ = { + isa = PBXGroup; + children = ( + 33503C9F10179AD7003B47E1 /* JSNotification.cpp */, + 33503CA010179AD7003B47E1 /* JSNotification.h */, + 33503CA110179AD7003B47E1 /* JSNotificationCenter.cpp */, + 33503CA210179AD7003B47E1 /* JSNotificationCenter.h */, + ); + name = Notifications; + sourceTree = "<group>"; + }; 449195900FBE175B00D9F824 /* Exports */ = { isa = PBXGroup; children = ( @@ -10557,6 +10651,9 @@ 1AF326770D78B9440068F0C4 /* EditorClient.h */, 93C09A800B064F00005ABD4D /* EventHandler.cpp */, 93C09A520B064DB3005ABD4D /* EventHandler.h */, + E0FEF371B27C53EAC1C1FBEE /* EventSource.cpp */, + E0FEF371B17C53EAC1C1FBEE /* EventSource.h */, + E0FEF371B07C53EAC1C1FBEE /* EventSource.idl */, 14993BE30B2F2B1C0050497F /* FocusController.cpp */, 14993BE40B2F2B1C0050497F /* FocusController.h */, 062287830B4DB322000C34DF /* FocusDirection.h */, @@ -11325,6 +11422,8 @@ 93F9B6540BA0F35E00854064 /* DOMHTMLCanvasElement.mm */, 85DF2F8C0AA3C88100AD64C5 /* DOMHTMLCollection.h */, 85DF2F8D0AA3C88100AD64C5 /* DOMHTMLCollection.mm */, + F5C041DE0FFCA96D00839D4A /* DOMHTMLDataListElement.h */, + F5C041DF0FFCA96D00839D4A /* DOMHTMLDataListElement.mm */, 85BA4CFD0AA688680088052D /* DOMHTMLDirectoryElement.h */, 85BA4CFE0AA688680088052D /* DOMHTMLDirectoryElement.mm */, 85BA4CFF0AA688680088052D /* DOMHTMLDivElement.h */, @@ -11479,6 +11578,7 @@ 85E711520AC5D5340053270F /* DOMHTMLButtonElementInternal.h */, 93F9B6550BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h */, 85E711530AC5D5340053270F /* DOMHTMLCollectionInternal.h */, + F5C041E00FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h */, 85E711540AC5D5340053270F /* DOMHTMLDirectoryElementInternal.h */, 85E711550AC5D5340053270F /* DOMHTMLDivElementInternal.h */, 85E711560AC5D5340053270F /* DOMHTMLDListElementInternal.h */, @@ -11906,6 +12006,9 @@ BC77CD410FEFE0C40070887B /* HTMLDataGridRowElement.cpp */, BC77CCED0FEFDE6C0070887B /* HTMLDataGridRowElement.h */, BC77CC6B0FEC3D5F0070887B /* HTMLDataGridRowElement.idl */, + F5C041D70FFCA7CE00839D4A /* HTMLDataListElement.cpp */, + F5C041D80FFCA7CE00839D4A /* HTMLDataListElement.h */, + F5C041D90FFCA7CE00839D4A /* HTMLDataListElement.idl */, A8EA79ED0A1916DF00A8EF5F /* HTMLDirectoryElement.cpp */, A8EA79EE0A1916DF00A8EF5F /* HTMLDirectoryElement.h */, 1A85B1D90A1B23A400D8C87C /* HTMLDirectoryElement.idl */, @@ -12188,6 +12291,8 @@ BC212A400FE83A1800EC3708 /* JSHTMLDataGridElement.h */, BC77CD4C0FEFE1610070887B /* JSHTMLDataGridRowElement.cpp */, BC77CD4D0FEFE1610070887B /* JSHTMLDataGridRowElement.h */, + F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */, + F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */, 1A85B1E00A1B240500D8C87C /* JSHTMLDirectoryElement.cpp */, 1A85B1E10A1B240500D8C87C /* JSHTMLDirectoryElement.h */, 1A85B2B40A1B2AC700D8C87C /* JSHTMLDivElement.cpp */, @@ -13608,6 +13713,8 @@ BCBFB53B0DCD29CF0019B3E5 /* JSDOMWindowShell.h */, 93B70D4D09EB0C7C009D8468 /* JSEventListener.cpp */, 93B70D4E09EB0C7C009D8468 /* JSEventListener.h */, + E0FEF371B67C53EAC1C1FBEE /* JSEventSourceConstructor.h */, + E0FEF371B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp */, BC60901E0E91B8EC000C68B5 /* JSEventTarget.cpp */, BC60901D0E91B8EC000C68B5 /* JSEventTarget.h */, 9350E70C0E87500B00189FFF /* JSHTMLAllCollection.cpp */, @@ -13743,6 +13850,7 @@ C0DFC86F0DB6841A003EAE7C /* JSConsoleCustom.cpp */, FE700DD00F92D81A008E2BFE /* JSCoordinatesCustom.cpp */, BC46C1ED0C0DDBDF0020CFC3 /* JSCSSRuleCustom.cpp */, + 9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */, BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */, @@ -13763,6 +13871,7 @@ 1AE830420CAB0ED1002237AE /* JSDatabaseCustom.cpp */, BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */, 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */, + 33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */, 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */, 929264760B61FC7200B41D34 /* JSDocumentCustom.cpp */, BC1DEA4E0E268EB60083A73F /* JSDocumentFragmentCustom.cpp */, @@ -13772,9 +13881,11 @@ 652FBBBB0DE27CB60001D386 /* JSDOMWindowCustom.h */, BC2ED5540C6B9BD300920BFF /* JSElementCustom.cpp */, BCEFAF4D0C317E6900FA81F6 /* JSEventCustom.cpp */, + E0FEF371B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp */, FE80D7A60E9C1ED2000D6F75 /* JSGeolocationCustom.cpp */, BCE7B1920D4E86960075A539 /* JSHistoryCustom.cpp */, BC4EDEF30C08F3FB007EDD49 /* JSHTMLAppletElementCustom.cpp */, + 9392262C1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp */, BCCBAD3A0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp */, BCBCAE530FF1A29E000762AE /* JSHTMLDataGridElementCustom.cpp */, BC51580A0C03D404008BB0EE /* JSHTMLDocumentCustom.cpp */, @@ -13905,6 +14016,8 @@ BC5A86B40C3367E800EEA649 /* JSDOMSelection.h */, 1403BA0B09EB18C700797C7F /* JSDOMWindow.cpp */, 1403BA0E09EB18F800797C7F /* JSDOMWindow.h */, + E0FEF371B37C53EAC1C1FBEE /* JSEventSource.h */, + E0FEF371B47C53EAC1C1FBEE /* JSEventSource.cpp */, BC94D14C0C275C68006BC617 /* JSHistory.cpp */, BC94D14D0C275C68006BC617 /* JSHistory.h */, BCE1C4390D9830D3003B02F2 /* JSLocation.cpp */, @@ -14069,6 +14182,7 @@ 93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */, 93B6A0E50B0BCA5C00F5027A /* ContextMenu.h */, 06027CAC0B1CBFC000884B2D /* ContextMenuItem.h */, + D8B6152E1032495100C8554A /* Cookie.h */, 9352088109BD45E900F2038D /* CookieJar.h */, 2E4346560F546A9900B0F1BA /* CrossThreadCopier.cpp */, 2E4346570F546A9900B0F1BA /* CrossThreadCopier.h */, @@ -14708,7 +14822,6 @@ A81872110977D3C0005826D9 /* ContainerNode.h */, A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */, A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */, - 93EEC1E709C2877700C515D1 /* DocPtr.h */, A8185F3409765765005826D9 /* Document.cpp */, A8185F3809765765005826D9 /* Document.h */, 6548E24809E1E04D00AF8020 /* Document.idl */, @@ -15109,7 +15222,6 @@ 93F1996D08245E59001E9ABC /* DeprecatedPtrListImpl.h in Headers */, B2F34FE60E82F81400F627CD /* DNS.h in Headers */, BCB16C2A0979C3BD00467741 /* DocLoader.h in Headers */, - 93EEC1FA09C2877700C515D1 /* DocPtr.h in Headers */, A8185F4009765766005826D9 /* Document.h in Headers */, A8185F3D09765766005826D9 /* DocumentFragment.h in Headers */, 656D37360ADBA5DE00A4554D /* DocumentLoader.h in Headers */, @@ -15215,6 +15327,8 @@ 93F9B6580BA0F35E00854064 /* DOMHTMLCanvasElementInternal.h in Headers */, 85DF2F8E0AA3C88100AD64C5 /* DOMHTMLCollection.h in Headers */, 85E711A20AC5D5350053270F /* DOMHTMLCollectionInternal.h in Headers */, + F5C041E30FFCA96D00839D4A /* DOMHTMLDataListElement.h in Headers */, + F5C041E50FFCA96D00839D4A /* DOMHTMLDataListElementInternal.h in Headers */, 85BA4D0B0AA688680088052D /* DOMHTMLDirectoryElement.h in Headers */, 85E711A30AC5D5350053270F /* DOMHTMLDirectoryElementInternal.h in Headers */, 85BA4D0D0AA688680088052D /* DOMHTMLDivElement.h in Headers */, @@ -15872,6 +15986,7 @@ 935FBC4509BA00B900E230B1 /* EventListener.h in Headers */, 1CA19E160DC255CA0065A994 /* EventLoop.h in Headers */, 939885C408B7E3D100E707C4 /* EventNames.h in Headers */, + E0FEF372B17C53EAC1C1FBEE /* EventSource.h in Headers */, E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */, BC60D8F30D2A11E000B9918F /* ExceptionBase.h in Headers */, 935FBCF209BA143B00E230B1 /* ExceptionCode.h in Headers */, @@ -15968,6 +16083,7 @@ BC77CB870FEBF5AF0070887B /* HTMLDataGridColElement.h in Headers */, BC212A1F0FE8333200EC3708 /* HTMLDataGridElement.h in Headers */, BC77CCEE0FEFDE6C0070887B /* HTMLDataGridRowElement.h in Headers */, + F5C041DB0FFCA7CE00839D4A /* HTMLDataListElement.h in Headers */, A8EA79FA0A1916DF00A8EF5F /* HTMLDirectoryElement.h in Headers */, A8EA7CB70A192B9C00A8EF5F /* HTMLDivElement.h in Headers */, A8EA79F70A1916DF00A8EF5F /* HTMLDListElement.h in Headers */, @@ -16157,6 +16273,8 @@ 14E8378E09F85D4F00B85AE4 /* JSEvent.h in Headers */, BC60D9C00D2A269A00B9918F /* JSEventException.h in Headers */, 93B70D6A09EB0C7C009D8468 /* JSEventListener.h in Headers */, + E0FEF372B37C53EAC1C1FBEE /* JSEventSource.h in Headers */, + E0FEF372B67C53EAC1C1FBEE /* JSEventSourceConstructor.h in Headers */, BC60901F0E91B8EC000C68B5 /* JSEventTarget.h in Headers */, BC00F0150E0A189500FD04E3 /* JSFile.h in Headers */, BC00F0170E0A189500FD04E3 /* JSFileList.h in Headers */, @@ -16180,6 +16298,7 @@ BC77CBD40FEBF8310070887B /* JSHTMLDataGridColElement.h in Headers */, BC212A420FE83A1800EC3708 /* JSHTMLDataGridElement.h in Headers */, BC77CD4F0FEFE1610070887B /* JSHTMLDataGridRowElement.h in Headers */, + F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */, 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */, 1A85B2B70A1B2AC700D8C87C /* JSHTMLDivElement.h in Headers */, 1A85B1E90A1B240500D8C87C /* JSHTMLDListElement.h in Headers */, @@ -16261,6 +16380,8 @@ 1A750D8E0A90E521000FF215 /* JSNodeIterator.h in Headers */, BCD9C2C30C17B69E005C90A2 /* JSNodeList.h in Headers */, 65DF31FE09D1CC60000BE325 /* JSNotation.h in Headers */, + 33503CA410179AD7003B47E1 /* JSNotification.h in Headers */, + 33503CA610179AD7003B47E1 /* JSNotificationCenter.h in Headers */, A826E8AE0A1A8F2300CD1BB6 /* JSOptionConstructor.h in Headers */, 1A0D57410A5C7867007EDD4C /* JSOverflowEvent.h in Headers */, A9D247FF0D757E6900FDF959 /* JSPlugin.h in Headers */, @@ -16533,6 +16654,9 @@ 63D7B32D0E78CD3F00F7617C /* NodeRenderStyle.h in Headers */, 9382AAB40D8C386100F357A6 /* NodeWithIndex.h in Headers */, A8EA7EBE0A1945D000A8EF5F /* Notation.h in Headers */, + 3390CA560FFC157B00921962 /* NotificationCenter.h in Headers */, + 3390CA580FFC157B00921962 /* NotificationContents.h in Headers */, + 33503C9A10179A74003B47E1 /* NotificationPresenter.h in Headers */, 1A569D0B0D7E2B82007C3983 /* NP_jsobject.h in Headers */, 1A569D0C0D7E2B82007C3983 /* npapi.h in Headers */, 1A219B3B0DCA87AB0040E3A0 /* npfunctions.h in Headers */, @@ -17192,6 +17316,9 @@ 49484FCB102CF23C00187DD3 /* CanvasRenderingContext2D.h in Headers */, 49484FCE102CF23C00187DD3 /* CanvasStyle.h in Headers */, B6D39715103AF2BB00A83BC7 /* MockGeolocationService.h in Headers */, + 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */, + B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */, + D8B6152F1032495100C8554A /* Cookie.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -17681,6 +17808,7 @@ 85BA4CDE0AA6861B0088052D /* DOMHTMLButtonElement.mm in Sources */, 93F9B6570BA0F35E00854064 /* DOMHTMLCanvasElement.mm in Sources */, 85DF2F8F0AA3C88100AD64C5 /* DOMHTMLCollection.mm in Sources */, + F5C041E40FFCA96D00839D4A /* DOMHTMLDataListElement.mm in Sources */, 85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */, 85BA4D0E0AA688680088052D /* DOMHTMLDivElement.mm in Sources */, 85BA4D100AA688680088052D /* DOMHTMLDListElement.mm in Sources */, @@ -17927,6 +18055,7 @@ 93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */, 1CA19E050DC255950065A994 /* EventLoopMac.mm in Sources */, 939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */, + E0FEF372B27C53EAC1C1FBEE /* EventSource.cpp in Sources */, E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */, BC60D8F20D2A11E000B9918F /* ExceptionBase.cpp in Sources */, 93831B570D087D6000E5C984 /* ExceptionCode.cpp in Sources */, @@ -18023,6 +18152,7 @@ BC77CBAA0FEBF6C90070887B /* HTMLDataGridColElement.cpp in Sources */, BCF524600FEBEE5D0095BF26 /* HTMLDataGridElement.cpp in Sources */, BC77CD420FEFE0C40070887B /* HTMLDataGridRowElement.cpp in Sources */, + F5C041DA0FFCA7CE00839D4A /* HTMLDataListElement.cpp in Sources */, A8EA79F90A1916DF00A8EF5F /* HTMLDirectoryElement.cpp in Sources */, A8EA7CB10A192B9C00A8EF5F /* HTMLDivElement.cpp in Sources */, A8EA79F50A1916DF00A8EF5F /* HTMLDListElement.cpp in Sources */, @@ -18206,6 +18336,7 @@ BCBCAE3C0FF19399000762AE /* JSDataGridDataSource.cpp in Sources */, 4162A4571011464700DFF3ED /* JSDedicatedWorkerContext.cpp in Sources */, 4162A454101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp in Sources */, + 33503CC010179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp in Sources */, 659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */, 929264770B61FC7200B41D34 /* JSDocumentCustom.cpp in Sources */, 1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */, @@ -18232,6 +18363,9 @@ BCEFAF4E0C317E6900FA81F6 /* JSEventCustom.cpp in Sources */, BC60D9BF0D2A269A00B9918F /* JSEventException.cpp in Sources */, 93B70D6909EB0C7C009D8468 /* JSEventListener.cpp in Sources */, + E0FEF372B47C53EAC1C1FBEE /* JSEventSource.cpp in Sources */, + E0FEF372B77C53EAC1C1FBEE /* JSEventSourceConstructor.cpp in Sources */, + E0FEF372B57C53EAC1C1FBEE /* JSEventSourceCustom.cpp in Sources */, BC6090200E91B8EC000C68B5 /* JSEventTarget.cpp in Sources */, BC00F0140E0A189500FD04E3 /* JSFile.cpp in Sources */, BC00F0160E0A189500FD04E3 /* JSFileList.cpp in Sources */, @@ -18260,6 +18394,7 @@ BC212A410FE83A1800EC3708 /* JSHTMLDataGridElement.cpp in Sources */, BCBCAE540FF1A29E000762AE /* JSHTMLDataGridElementCustom.cpp in Sources */, BC77CD4E0FEFE1610070887B /* JSHTMLDataGridRowElement.cpp in Sources */, + F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */, 1A85B1E60A1B240500D8C87C /* JSHTMLDirectoryElement.cpp in Sources */, 1A85B2B60A1B2AC700D8C87C /* JSHTMLDivElement.cpp in Sources */, 1A85B1E80A1B240500D8C87C /* JSHTMLDListElement.cpp in Sources */, @@ -18365,6 +18500,8 @@ BCD9C2C20C17B69E005C90A2 /* JSNodeList.cpp in Sources */, BCD9C2650C17AA67005C90A2 /* JSNodeListCustom.cpp in Sources */, 65DF31FD09D1CC60000BE325 /* JSNotation.cpp in Sources */, + 33503CA310179AD7003B47E1 /* JSNotification.cpp in Sources */, + 33503CA510179AD7003B47E1 /* JSNotificationCenter.cpp in Sources */, A826EC480A1B0CBE00CD1BB6 /* JSOptionConstructor.cpp in Sources */, 1A0D57400A5C7867007EDD4C /* JSOverflowEvent.cpp in Sources */, A9D247FE0D757E6900FDF959 /* JSPlugin.cpp in Sources */, @@ -18654,6 +18791,8 @@ 854FE7320A2297BE0058D7AD /* NodeFilterCondition.cpp in Sources */, 854FE7340A2297BE0058D7AD /* NodeIterator.cpp in Sources */, A8EA7EBF0A1945D000A8EF5F /* Notation.cpp in Sources */, + 33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */, + 3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */, 1A569D0A0D7E2B82007C3983 /* NP_jsobject.cpp in Sources */, 1A569D0D0D7E2B82007C3983 /* npruntime.cpp in Sources */, 1A569D130D7E2B82007C3983 /* objc_class.mm in Sources */, @@ -19244,6 +19383,9 @@ 49484FCA102CF23C00187DD3 /* CanvasRenderingContext2D.cpp in Sources */, 49484FCD102CF23C00187DD3 /* CanvasStyle.cpp in Sources */, B6D39711103AF29D00A83BC7 /* MockGeolocationService.cpp in Sources */, + 9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */, + 9392262F10321084006E7D5D /* JSCSSRuleListCustom.cpp in Sources */, + B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/WebCore/WebCorePrefix.h b/WebCore/WebCorePrefix.h index c0d1e70..6c8e200 100644 --- a/WebCore/WebCorePrefix.h +++ b/WebCore/WebCorePrefix.h @@ -113,6 +113,13 @@ #include <stdio.h> #else #include <CoreServices/CoreServices.h> + +#if defined(WIN32) || defined(_WIN32) +/* Including CoreServices.h on Windows doesn't include CFNetwork.h, so we do + it explicitly here to make Windows more consistent with Mac. */ +#include <CFNetwork/CFNetwork.h> +#endif + #endif #endif @@ -125,8 +132,11 @@ #define delete ("if you use new/delete make sure to include config.h at the top of the file"()) #endif -/* Work around a bug with C++ library that screws up Objective-C++ when exception support is disabled. */ -#if defined(__APPLE__) +/* When C++ exceptions are disabled, the C++ library defines |try| and |catch| + * to allow C++ code that expects exceptions to build. These definitions + * interfere with Objective-C++ uses of Objective-C exception handlers, which + * use |@try| and |@catch|. As a workaround, undefine these macros. */ +#ifdef __OBJC__ #undef try #undef catch #endif diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl index a9a1b42..a40c2b1 100644 --- a/WebCore/WebCoreSources.bkl +++ b/WebCore/WebCoreSources.bkl @@ -60,6 +60,7 @@ This file contains the list of files needed to build WebCore. bindings/js/JSClipboardCustom.cpp bindings/js/JSConsoleCustom.cpp bindings/js/JSCSSRuleCustom.cpp + bindings/js/JSCSSRuleListCustom.cpp bindings/js/JSCSSStyleDeclarationCustom.cpp bindings/js/JSCSSValueCustom.cpp bindings/js/JSCoordinatesCustom.cpp @@ -85,11 +86,14 @@ This file contains the list of files needed to build WebCore. bindings/js/JSDocumentFragmentCustom.cpp bindings/js/JSElementCustom.cpp bindings/js/JSEventCustom.cpp + bindings/js/JSEventSourceConstructor.cpp + bindings/js/JSEventSourceCustom.cpp bindings/js/JSEventTarget.cpp bindings/js/JSGeolocationCustom.cpp bindings/js/JSHTMLAllCollection.cpp bindings/js/JSHistoryCustom.cpp bindings/js/JSHTMLAppletElementCustom.cpp + bindings/js/JSHTMLCanvasElementCustom.cpp bindings/js/JSHTMLCollectionCustom.cpp bindings/js/JSHTMLDataGridElementCustom.cpp bindings/js/JSHTMLDocumentCustom.cpp @@ -283,6 +287,7 @@ This file contains the list of files needed to build WebCore. DerivedSources/WebCore/JSEntityReference.cpp DerivedSources/WebCore/JSErrorEvent.cpp DerivedSources/WebCore/JSEvent.cpp + DerivedSources/WebCore/JSEventSource.cpp DerivedSources/WebCore/JSEventException.cpp DerivedSources/WebCore/JSFile.cpp DerivedSources/WebCore/JSFileList.cpp @@ -303,6 +308,7 @@ This file contains the list of files needed to build WebCore. DerivedSources/WebCore/JSHTMLDataGridCellElement.cpp DerivedSources/WebCore/JSHTMLDataGridColElement.cpp DerivedSources/WebCore/JSHTMLDataGridRowElement.cpp + DerivedSources/WebCore/JSHTMLDataListElement.cpp DerivedSources/WebCore/JSHTMLDListElement.cpp DerivedSources/WebCore/JSHTMLDirectoryElement.cpp DerivedSources/WebCore/JSHTMLDivElement.cpp @@ -592,6 +598,7 @@ This file contains the list of files needed to build WebCore. html/HTMLDataGridCellElement.cpp html/HTMLDataGridColElement.cpp html/HTMLDataGridRowElement.cpp + html/HTMLDataListElement.cpp html/HTMLDListElement.cpp html/HTMLDirectoryElement.cpp html/HTMLDivElement.cpp @@ -747,6 +754,7 @@ This file contains the list of files needed to build WebCore. page/DOMWindow.cpp page/DragController.cpp page/EventHandler.cpp + page/EventSource.cpp page/FocusController.cpp page/Frame.cpp page/FrameTree.cpp @@ -835,6 +843,7 @@ This file contains the list of files needed to build WebCore. platform/graphics/GraphicsContext.cpp platform/graphics/GraphicsTypes.cpp platform/graphics/Image.cpp + platform/graphics/ImageSource.cpp platform/graphics/IntRect.cpp platform/graphics/Path.cpp platform/graphics/PathTraversalState.cpp diff --git a/WebCore/accessibility/AXObjectCache.cpp b/WebCore/accessibility/AXObjectCache.cpp index 0b758e6..db57f3b 100644 --- a/WebCore/accessibility/AXObjectCache.cpp +++ b/WebCore/accessibility/AXObjectCache.cpp @@ -43,8 +43,11 @@ #include "AccessibilityTableColumn.h" #include "AccessibilityTableHeaderContainer.h" #include "AccessibilityTableRow.h" -#include "InputElement.h" +#include "FocusController.h" +#include "Frame.h" #include "HTMLNames.h" +#include "InputElement.h" +#include "Page.h" #include "RenderObject.h" #include "RenderView.h" @@ -57,8 +60,9 @@ using namespace HTMLNames; bool AXObjectCache::gAccessibilityEnabled = false; bool AXObjectCache::gAccessibilityEnhancedUserInterfaceEnabled = false; -AXObjectCache::AXObjectCache() +AXObjectCache::AXObjectCache(const Document* document) : m_notificationPostTimer(this, &AXObjectCache::notificationPostTimerFired) + , m_document(document) { } @@ -73,6 +77,32 @@ AXObjectCache::~AXObjectCache() } } +AccessibilityObject* AXObjectCache::focusedUIElementForPage(const Page* page) +{ + // get the focused node in the page + Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document(); + Node* focusedNode = focusedDocument->focusedNode(); + if (!focusedNode) + focusedNode = focusedDocument; + + RenderObject* focusedNodeRenderer = focusedNode->renderer(); + if (!focusedNodeRenderer) + return 0; + + AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer); + + if (obj->shouldFocusActiveDescendant()) { + if (AccessibilityObject* descendant = obj->activeDescendant()) + obj = descendant; + } + + // the HTML element, for example, is focusable but has an AX object that is ignored + if (obj->accessibilityIsIgnored()) + obj = obj->parentObjectUnignored(); + + return obj; +} + AccessibilityObject* AXObjectCache::get(RenderObject* renderer) { if (!renderer) @@ -213,6 +243,23 @@ void AXObjectCache::remove(RenderObject* renderer) m_renderObjectMapping.remove(renderer); } +#if !PLATFORM(WIN) +AXID AXObjectCache::platformGenerateAXID() const +{ + static AXID lastUsedID = 0; + + // Generate a new ID. + AXID objID = lastUsedID; + do { + ++objID; + } while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + lastUsedID = objID; + + return objID; +} +#endif + AXID AXObjectCache::getAXID(AccessibilityObject* obj) { // check for already-assigned ID @@ -221,15 +268,10 @@ AXID AXObjectCache::getAXID(AccessibilityObject* obj) ASSERT(m_idsInUse.contains(objID)); return objID; } - - // generate a new ID - static AXID lastUsedID = 0; - objID = lastUsedID; - do - ++objID; - while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + objID = platformGenerateAXID(); + m_idsInUse.add(objID); - lastUsedID = objID; obj->setAXObjectID(objID); return objID; diff --git a/WebCore/accessibility/AXObjectCache.h b/WebCore/accessibility/AXObjectCache.h index 7a808dd..96ded44 100644 --- a/WebCore/accessibility/AXObjectCache.h +++ b/WebCore/accessibility/AXObjectCache.h @@ -42,13 +42,12 @@ class WebCoreTextMarker; namespace WebCore { + class Document; + class Node; + class Page; class RenderObject; class String; class VisiblePosition; - class AccessibilityObject; - class Node; - - typedef unsigned AXID; struct TextMarkerData { AXID axID; @@ -59,9 +58,11 @@ namespace WebCore { class AXObjectCache { public: - AXObjectCache(); + AXObjectCache(const Document*); ~AXObjectCache(); - + + static AccessibilityObject* focusedUIElementForPage(const Page*); + // to be used with render objects AccessibilityObject* getOrCreate(RenderObject*); @@ -94,11 +95,13 @@ namespace WebCore { void removeAXID(AccessibilityObject*); bool isIDinUse(AXID id) const { return m_idsInUse.contains(id); } + AXID platformGenerateAXID() const; + AccessibilityObject* objectFromAXID(AXID id) const { return m_objects.get(id).get(); } // Text marker utilities. static void textMarkerDataForVisiblePosition(TextMarkerData&, const VisiblePosition&); static VisiblePosition visiblePositionForTextMarkerData(TextMarkerData&); - + private: HashMap<AXID, RefPtr<AccessibilityObject> > m_objects; HashMap<RenderObject*, AXID> m_renderObjectMapping; @@ -113,6 +116,8 @@ namespace WebCore { AXID getAXID(AccessibilityObject*); bool nodeIsAriaType(Node* node, String role); + + const Document* m_document; }; #if !HAVE(ACCESSIBILITY) diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp index d6fd969..4fb4e3a 100644 --- a/WebCore/accessibility/AccessibilityObject.cpp +++ b/WebCore/accessibility/AccessibilityObject.cpp @@ -41,6 +41,7 @@ #include "NotImplemented.h" #include "Page.h" #include "RenderImage.h" +#include "RenderListItem.h" #include "RenderListMarker.h" #include "RenderMenuList.h" #include "RenderTextControl.h" @@ -363,6 +364,49 @@ static bool replacedNodeNeedsCharacter(Node* replacedNode) return true; } +// Finds a RenderListItem parent give a node. +RenderListItem* AccessibilityObject::renderListItemContainerForNode(Node* node) const +{ + for (Node* stringNode = node; stringNode; stringNode = stringNode->parent()) { + RenderObject* renderObject = stringNode->renderer(); + if (!renderObject || !renderObject->isListItem()) + continue; + + return toRenderListItem(renderObject); + } + + return 0; +} + +// Returns the text associated with a list marker if this node is contained within a list item. +String AccessibilityObject::listMarkerTextForNodeAndPosition(Node* node, const VisiblePosition& visiblePositionStart) const +{ + // If the range does not contain the start of the line, the list marker text should not be included. + if (!isStartOfLine(visiblePositionStart)) + return String(); + + RenderListItem* listItem = renderListItemContainerForNode(node); + if (!listItem) + return String(); + + // If this is in a list item, we need to manually add the text for the list marker + // because a RenderListMarker does not have a Node equivalent and thus does not appear + // when iterating text. + const String& markerText = listItem->markerText(); + if (markerText.isEmpty()) + return String(); + + // Append text, plus the period that follows the text. + // FIXME: Not all list marker styles are followed by a period, but this + // sounds much better when there is a synthesized pause because of a period. + Vector<UChar> resultVector; + resultVector.append(markerText.characters(), markerText.length()); + resultVector.append('.'); + resultVector.append(' '); + + return String::adopt(resultVector); +} + String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const { if (visiblePositionRange.isNull()) @@ -373,6 +417,11 @@ String AccessibilityObject::stringForVisiblePositionRange(const VisiblePositionR for (TextIterator it(range.get()); !it.atEnd(); it.advance()) { // non-zero length means textual node, zero length means replaced node (AKA "attachments" in AX) if (it.length() != 0) { + // Add a textual representation for list marker text + String listMarkerText = listMarkerTextForNodeAndPosition(it.node(), visiblePositionRange.start); + if (!listMarkerText.isEmpty()) + resultVector.append(listMarkerText.characters(), listMarkerText.length()); + resultVector.append(it.characters(), it.length()); } else { // locate the node and starting offset for this replaced range diff --git a/WebCore/accessibility/AccessibilityObject.h b/WebCore/accessibility/AccessibilityObject.h index 3f6c395..9173953 100644 --- a/WebCore/accessibility/AccessibilityObject.h +++ b/WebCore/accessibility/AccessibilityObject.h @@ -86,10 +86,13 @@ class IntPoint; class IntSize; class Node; class RenderObject; +class RenderListItem; class VisibleSelection; class String; class Widget; +typedef unsigned AXID; + enum AccessibilityRole { UnknownRole = 1, ButtonRole, @@ -304,8 +307,8 @@ public: virtual PassRefPtr<Range> ariaSelectedTextDOMRange() const { return 0; } virtual AXObjectCache* axObjectCache() const { return 0; } - unsigned axObjectID() const { return m_id; } - void setAXObjectID(unsigned axObjectID) { m_id = axObjectID; } + AXID axObjectID() const { return m_id; } + void setAXObjectID(AXID axObjectID) { m_id = axObjectID; } static AccessibilityObject* anchorElementForNode(Node*); virtual Element* anchorElement() const { return 0; } @@ -408,6 +411,7 @@ public: virtual String doAXStringForRange(const PlainTextRange&) const { return String(); } virtual IntRect doAXBoundsForRange(const PlainTextRange&) const { return IntRect(); } + String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const; unsigned doAXLineForIndex(unsigned); @@ -436,14 +440,15 @@ public: virtual void updateBackingStore() { } protected: - unsigned m_id; + AXID m_id; AccessibilityChildrenVector m_children; mutable bool m_haveChildren; AccessibilityRole m_role; virtual void clearChildren(); virtual bool isDetached() const { return true; } - + RenderListItem* renderListItemContainerForNode(Node* node) const; + #if PLATFORM(MAC) RetainPtr<AccessibilityObjectWrapper> m_wrapper; #elif PLATFORM(WIN) && !PLATFORM(WINCE) diff --git a/WebCore/accessibility/AccessibilityRenderObject.cpp b/WebCore/accessibility/AccessibilityRenderObject.cpp index e0f9a91..b0b97fc 100644 --- a/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -35,7 +35,6 @@ #include "CharacterNames.h" #include "EventNames.h" #include "FloatRect.h" -#include "FocusController.h" #include "Frame.h" #include "FrameLoader.h" #include "HTMLAreaElement.h" @@ -54,7 +53,6 @@ #include "HitTestResult.h" #include "LocalizedStrings.h" #include "NodeList.h" -#include "Page.h" #include "RenderButton.h" #include "RenderFieldset.h" #include "RenderFileUploadControl.h" @@ -1658,7 +1656,7 @@ AccessibilityObject* AccessibilityRenderObject::accessibilityParentForImageMap(H // The HTMLImageElement's useMap() value includes the '#' symbol at the beginning, // which has to be stripped off - String useMapName = static_cast<HTMLImageElement*>(curr)->useMap().substring(1).lower(); + String useMapName = static_cast<HTMLImageElement*>(curr)->getAttribute(usemapAttr).string().substring(1).lower(); if (useMapName == mapName) return axObjectCache()->getOrCreate(obj); } @@ -2102,32 +2100,11 @@ AccessibilityObject* AccessibilityRenderObject::doAccessibilityHitTest(const Int AccessibilityObject* AccessibilityRenderObject::focusedUIElement() const { - // get the focused node in the page Page* page = m_renderer->document()->page(); if (!page) return 0; - - Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document(); - Node* focusedNode = focusedDocument->focusedNode(); - if (!focusedNode) - focusedNode = focusedDocument; - - RenderObject* focusedNodeRenderer = focusedNode->renderer(); - if (!focusedNodeRenderer) - return 0; - - AccessibilityObject* obj = focusedNodeRenderer->document()->axObjectCache()->getOrCreate(focusedNodeRenderer); - - if (obj->shouldFocusActiveDescendant()) { - if (AccessibilityObject* descendant = obj->activeDescendant()) - obj = descendant; - } - - // the HTML element, for example, is focusable but has an AX object that is ignored - if (obj->accessibilityIsIgnored()) - obj = obj->parentObjectUnignored(); - - return obj; + + return AXObjectCache::focusedUIElementForPage(page); } bool AccessibilityRenderObject::shouldFocusActiveDescendant() const diff --git a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp index 6d3729b..f346a81 100644 --- a/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp +++ b/WebCore/accessibility/gtk/AccessibilityObjectWrapperAtk.cpp @@ -60,7 +60,7 @@ using namespace WebCore; static AccessibilityObject* fallbackObject() { - static AXObjectCache* fallbackCache = new AXObjectCache(); + static AXObjectCache* fallbackCache = new AXObjectCache(0); static AccessibilityObject* object = 0; if (!object) { // FIXME: using fallbackCache->getOrCreate(ListBoxOptionRole) is a hack diff --git a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm index d1e0599..75cefee 100644 --- a/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm +++ b/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm @@ -378,7 +378,7 @@ static void AXAttributeStringSetSpelling(NSMutableAttributedString* attrString, // add misspelling attribute for the intersection of the marker and the range int rStart = range.location + (marker.startOffset - offset); - int rLength = MIN(marker.endOffset, endOffset) - marker.startOffset; + int rLength = min(marker.endOffset, endOffset) - marker.startOffset; NSRange spellRange = NSMakeRange(rStart, rLength); AXAttributeStringSetNumber(attrString, NSAccessibilityMisspelledTextAttribute, [NSNumber numberWithBool:YES], spellRange); @@ -478,6 +478,9 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) - (NSAttributedString*)doAXAttributedStringForTextMarkerRange:(WebCoreTextMarkerRange*)textMarkerRange { + if (!m_object) + return nil; + // extract the start and end VisiblePosition VisiblePosition startVisiblePosition = visiblePositionForStartOfTextMarkerRange(textMarkerRange); if (startVisiblePosition.isNull()) @@ -487,6 +490,7 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) if (endVisiblePosition.isNull()) return nil; + VisiblePositionRange visiblePositionRange(startVisiblePosition, endVisiblePosition); // iterate over the range to build the AX attributed string NSMutableAttributedString* attrString = [[NSMutableAttributedString alloc] init]; TextIterator it(makeRange(startVisiblePosition, endVisiblePosition).get()); @@ -499,6 +503,11 @@ static NSString* nsStringForReplacedNode(Node* replacedNode) // non-zero length means textual node, zero length means replaced node (AKA "attachments" in AX) if (it.length() != 0) { + // Add the text of the list marker item if necessary. + String listMarkerText = m_object->listMarkerTextForNodeAndPosition(node, VisiblePosition(it.range()->startPosition())); + if (!listMarkerText.isEmpty()) + AXAttributedStringAppendText(attrString, node, offset, listMarkerText.characters(), listMarkerText.length()); + AXAttributedStringAppendText(attrString, node, offset, it.characters(), it.length()); } else { Node* replacedNode = node->childNode(offset); @@ -1581,6 +1590,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) @"AXStyleTextMarkerRangeForTextMarker", @"AXLengthForTextMarkerRange", NSAccessibilityBoundsForRangeParameterizedAttribute, + NSAccessibilityStringForRangeParameterizedAttribute, nil]; } @@ -1932,6 +1942,14 @@ static RenderObject* rendererForView(NSView* view) NSRect rect = m_object->boundsForVisiblePositionRange(VisiblePositionRange(start, end)); return [NSValue valueWithRect:rect]; } + + if ([attribute isEqualToString:NSAccessibilityStringForRangeParameterizedAttribute]) { + VisiblePosition start = m_object->visiblePositionForIndex(range.location); + VisiblePosition end = m_object->visiblePositionForIndex(range.location+range.length); + if (start.isNull() || end.isNull()) + return nil; + return m_object->stringForVisiblePositionRange(VisiblePositionRange(start, end)); + } if ([attribute isEqualToString: @"AXAttributedStringForTextMarkerRange"]) return [self doAXAttributedStringForTextMarkerRange:textMarkerRange]; diff --git a/WebCore/accessibility/win/AXObjectCacheWin.cpp b/WebCore/accessibility/win/AXObjectCacheWin.cpp index e39d5a5..f782ceb 100644 --- a/WebCore/accessibility/win/AXObjectCacheWin.cpp +++ b/WebCore/accessibility/win/AXObjectCacheWin.cpp @@ -28,6 +28,10 @@ #include "AXObjectCache.h" #include "AccessibilityObject.h" +#include "Document.h" +#include "Page.h" + +using namespace std; namespace WebCore { @@ -50,8 +54,43 @@ void AXObjectCache::postPlatformNotification(AccessibilityObject*, const String& { } +AXID AXObjectCache::platformGenerateAXID() const +{ + static AXID lastUsedID = 0; + + // Generate a new ID. Windows accessibility relies on a positive AXID, + // ranging from 1 to LONG_MAX. + AXID objID = lastUsedID; + do { + ++objID; + objID %= std::numeric_limits<LONG>::max(); + } while (objID == 0 || HashTraits<AXID>::isDeletedValue(objID) || m_idsInUse.contains(objID)); + + ASSERT(objID >= 1 && objID <= std::numeric_limits<LONG>::max()); + + lastUsedID = objID; + + return objID; +} + void AXObjectCache::handleFocusedUIElementChanged() { + Page* page = m_document->page(); + if (!page || !page->chrome()->platformWindow()) + return; + + AccessibilityObject* focusedObject = focusedUIElementForPage(page); + if (!focusedObject) + return; + + ASSERT(!focusedObject->accessibilityIsIgnored()); + ASSERT(focusedObject->axObjectID() >= 1 && focusedObject->axObjectID() <= numeric_limits<LONG>::max()); + + // Windows will end up calling get_accChild() on the root accessible + // object for the WebView, passing the child ID that we specify below. We + // negate the AXID so we know that the caller is passing the ID of an + // element, not the index of a child element. + NotifyWinEvent(EVENT_OBJECT_FOCUS, page->chrome()->platformWindow(), OBJID_CLIENT, -static_cast<LONG>(focusedObject->axObjectID())); } } // namespace WebCore diff --git a/WebCore/bindings/js/JSAudioConstructor.cpp b/WebCore/bindings/js/JSAudioConstructor.cpp index 87a3880..174cc11 100644 --- a/WebCore/bindings/js/JSAudioConstructor.cpp +++ b/WebCore/bindings/js/JSAudioConstructor.cpp @@ -34,6 +34,7 @@ #include "JSHTMLAudioElement.h" #include "ScriptExecutionContext.h" #include "Text.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSCSSRuleListCustom.cpp b/WebCore/bindings/js/JSCSSRuleListCustom.cpp new file mode 100644 index 0000000..be3a9a2 --- /dev/null +++ b/WebCore/bindings/js/JSCSSRuleListCustom.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Apple Inc. All right 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 "JSCSSRuleList.h" + +#include "CSSRuleList.h" + +using namespace JSC; + +namespace WebCore { + +void JSCSSRuleList::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + CSSRuleList* list = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = list->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, list->item(i)); +} + +} diff --git a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 280ec93..4a137d3 100644 --- a/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 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 @@ -27,8 +27,8 @@ #include "JSCSSStyleDeclarationCustom.h" #include "AtomicString.h" +#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" -#include "CSSStyleDeclaration.h" #include "CSSValue.h" #include "PlatformString.h" #include <runtime/StringObjectThatMasqueradesAsUndefined.h> @@ -40,6 +40,21 @@ using namespace WTF; namespace WebCore { +void JSCSSStyleDeclaration::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + CSSStyleDeclaration* declaration = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + if (declaration->isMutableStyleDeclaration()) { + CSSMutableStyleDeclaration* mutableDeclaration = static_cast<CSSMutableStyleDeclaration*>(declaration); + CSSMutableStyleDeclaration::const_iterator end = mutableDeclaration->end(); + for (CSSMutableStyleDeclaration::const_iterator it = mutableDeclaration->begin(); it != end; ++it) + markDOMObjectWrapper(markStack, globalData, it->value()); + } +} + // Check for a CSS prefix. // Passed prefix is all lowercase. // First character of the prefix within the property name may be upper or lowercase. diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp index 566b986..06492f9 100644 --- a/WebCore/bindings/js/JSDOMBinding.cpp +++ b/WebCore/bindings/js/JSDOMBinding.cpp @@ -28,6 +28,7 @@ #include "ExceptionCode.h" #include "Frame.h" #include "HTMLAudioElement.h" +#include "HTMLCanvasElement.h" #include "HTMLImageElement.h" #include "HTMLScriptElement.h" #include "HTMLNames.h" @@ -42,6 +43,7 @@ #include "RangeException.h" #include "ScriptController.h" #include "XMLHttpRequestException.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> #include <wtf/StdLibExtras.h> @@ -264,18 +266,48 @@ static inline bool isObservableThroughDOM(JSNode* jsNode) Node* node = jsNode->impl(); if (node->inDocument()) { - // 1. If a node is in the document, and its wrapper has custom properties, + // If a node is in the document, and its wrapper has custom properties, // the wrapper is observable because future access to the node through the // DOM must reflect those properties. if (jsNode->hasCustomProperties()) return true; - // 2. If a node is in the document, and has event listeners, its wrapper is + // If a node is in the document, and has event listeners, its wrapper is // observable because its wrapper is responsible for marking those event listeners. if (node->eventListeners().size()) return true; // Technically, we may overzealously mark a wrapper for a node that has only non-JS event listeners. Oh well. + + // If a node owns another object with a wrapper with custom properties, + // the wrapper must be treated as observable, because future access to + // those objects through the DOM must reflect those properties. + // FIXME: It would be better if this logic could be in the node next to + // the custom markChildren functions rather than here. + if (node->isElementNode()) { + if (NamedNodeMap* attributes = static_cast<Element*>(node)->attributeMap()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), attributes)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + if (node->isStyledElement()) { + if (CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(node)->inlineStyleDecl()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), style)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + } + if (static_cast<Element*>(node)->hasTagName(canvasTag)) { + if (CanvasRenderingContext2D* context = static_cast<HTMLCanvasElement*>(node)->renderingContext2D()) { + if (DOMObject* wrapper = getCachedDOMObjectWrapper(*jsNode->globalObject()->globalData(), context)) { + if (wrapper->hasCustomProperties()) + return true; + } + } + } + } } else { - // 3. If a wrapper is the last reference to an image or script element + // If a wrapper is the last reference to an image or script element // that is loading but not in the document, the wrapper is observable // because it is the only thing keeping the image element alive, and if // the image element is destroyed, its load event will not fire. @@ -348,6 +380,9 @@ void updateDOMNodeDocument(Node* node, Document* oldDocument, Document* newDocum void markDOMObjectWrapper(MarkStack& markStack, JSGlobalData& globalData, void* object) { + // FIXME: This could be changed to only mark wrappers that are "observable" + // as markDOMNodesForDocument does, allowing us to collect more wrappers, + // but doing this correctly would be challenging. if (!object) return; DOMObject* wrapper = getCachedDOMObjectWrapper(globalData, object); diff --git a/WebCore/bindings/js/JSDOMBinding.h b/WebCore/bindings/js/JSDOMBinding.h index 64cfc3a..5abd7a7 100644 --- a/WebCore/bindings/js/JSDOMBinding.h +++ b/WebCore/bindings/js/JSDOMBinding.h @@ -26,7 +26,6 @@ #include "Document.h" // For DOMConstructorWithDocument #include <runtime/Completion.h> #include <runtime/Lookup.h> -#include <runtime/JSFunction.h> #include <wtf/Noncopyable.h> namespace JSC { @@ -61,7 +60,7 @@ namespace WebCore { #endif }; - // FIXME: This class should colapse into DOMObject once all DOMObjects are + // FIXME: This class should collapse into DOMObject once all DOMObjects are // updated to store a globalObject pointer. class DOMObjectWithGlobalPointer : public DOMObject { public: diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp index 9798972..44a11e4 100644 --- a/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -38,6 +38,7 @@ #include "JSDOMWindowShell.h" #include "JSEvent.h" #include "JSEventListener.h" +#include "JSEventSourceConstructor.h" #include "JSHTMLCollection.h" #include "JSHistory.h" #include "JSImageConstructor.h" @@ -54,6 +55,7 @@ #include "Location.h" #include "MediaPlayer.h" #include "MessagePort.h" +#include "NotificationCenter.h" #include "Page.h" #include "PlatformScreen.h" #include "RegisteredEventListener.h" @@ -61,6 +63,8 @@ #include "ScriptController.h" #include "Settings.h" #include "WindowFeatures.h" +#include <runtime/Error.h> +#include <runtime/JSFunction.h> #include <runtime/JSObject.h> #include <runtime/PrototypeFunction.h> @@ -424,6 +428,13 @@ JSValue JSDOMWindow::event(ExecState* exec) const return toJS(exec, event); } +#if ENABLE(EVENTSOURCE) +JSValue JSDOMWindow::eventSource(ExecState* exec) const +{ + return getDOMConstructor<JSEventSourceConstructor>(exec, this); +} +#endif + JSValue JSDOMWindow::image(ExecState* exec) const { return getDOMConstructor<JSImageConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp new file mode 100644 index 0000000..fb34c7b --- /dev/null +++ b/WebCore/bindings/js/JSDesktopNotificationsCustom.cpp @@ -0,0 +1,90 @@ +/* + * 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(NOTIFICATIONS) + +#include "Document.h" +#include "JSCustomVoidCallback.h" +#include "JSEventListener.h" +#include "JSNotification.h" +#include "JSNotificationCenter.h" +#include "Notification.h" +#include "NotificationCenter.h" + +using namespace JSC; + +namespace WebCore { + +JSValue JSNotificationCenter::requestPermission(ExecState* exec, const ArgList& args) +{ + // Permission request is only valid from page context. + ScriptExecutionContext* context = impl()->context(); + if (context->isWorkerContext()) + return throwError(exec, SyntaxError); + + if (!args.at(0).isObject()) + return throwError(exec, TypeError); + + PassRefPtr<JSCustomVoidCallback> callback = JSCustomVoidCallback::create(args.at(0).getObject(), static_cast<Document*>(context)->frame()); + + impl()->requestPermission(callback); + return jsUndefined(); +} + +JSValue JSNotification::addEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + + if (RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1))) + impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); + + return jsUndefined(); +} + +JSValue JSNotification::removeEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + + if (JSEventListener* listener = globalObject->findJSEventListener(args.at(1))) + impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); + + return jsUndefined(); +} + + +} // namespace + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/bindings/js/JSDocumentCustom.cpp b/WebCore/bindings/js/JSDocumentCustom.cpp index 39a1fc5..25c0b00 100644 --- a/WebCore/bindings/js/JSDocumentCustom.cpp +++ b/WebCore/bindings/js/JSDocumentCustom.cpp @@ -42,8 +42,14 @@ namespace WebCore { void JSDocument::markChildren(MarkStack& markStack) { JSNode::markChildren(markStack); - markDOMNodesForDocument(markStack, impl()); - markActiveObjectsForContext(markStack, *Heap::heap(this)->globalData(), impl()); + + Document* document = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMNodesForDocument(markStack, document); + markActiveObjectsForContext(markStack, globalData, document); + markDOMObjectWrapper(markStack, globalData, document->implementation()); + markDOMObjectWrapper(markStack, globalData, document->styleSheets()); } JSValue JSDocument::location(ExecState* exec) const diff --git a/WebCore/bindings/js/JSElementCustom.cpp b/WebCore/bindings/js/JSElementCustom.cpp index 47793d0..c7b19e3 100644 --- a/WebCore/bindings/js/JSElementCustom.cpp +++ b/WebCore/bindings/js/JSElementCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 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 @@ -51,6 +51,18 @@ namespace WebCore { using namespace HTMLNames; +void JSElement::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + Element* element = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMObjectWrapper(markStack, globalData, element->attributeMap()); + if (element->isStyledElement()) + markDOMObjectWrapper(markStack, globalData, static_cast<StyledElement*>(element)->inlineStyleDecl()); +} + static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value) { if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIsJavaScript(deprecatedParseURL(value))) { @@ -59,7 +71,7 @@ static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* elem return false; } return true; -} +} JSValue JSElement::setAttribute(ExecState* exec, const ArgList& args) { diff --git a/WebCore/bindings/js/JSEventSourceConstructor.cpp b/WebCore/bindings/js/JSEventSourceConstructor.cpp new file mode 100644 index 0000000..c6e4825 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceConstructor.cpp @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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(EVENTSOURCE) + +#include "JSEventSourceConstructor.h" + +#include "EventSource.h" +#include "ExceptionCode.h" +#include "JSEventSource.h" +#include "ScriptExecutionContext.h" +#include <runtime/Error.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSEventSourceConstructor); + +const ClassInfo JSEventSourceConstructor::s_info = { "EventSourceContructor", 0, 0, 0 }; + +JSEventSourceConstructor::JSEventSourceConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(JSEventSourceConstructor::createStructure(globalObject->objectPrototype()), globalObject) +{ + putDirect(exec->propertyNames().prototype, JSEventSourcePrototype::self(exec, globalObject), None); + putDirect(exec->propertyNames().length, jsNumber(exec, 1), ReadOnly|DontDelete|DontEnum); +} + +static JSObject* constructEventSource(ExecState* exec, JSObject* constructor, const ArgList& args) +{ + if (args.size() < 1) + return throwError(exec, SyntaxError, "Not enough arguments"); + + UString url = args.at(0).toString(exec); + if (exec->hadException()) + return 0; + + JSEventSourceConstructor* jsConstructor = static_cast<JSEventSourceConstructor*>(constructor); + ScriptExecutionContext* context = jsConstructor->scriptExecutionContext(); + if (!context) + return throwError(exec, ReferenceError, "EventSource constructor associated document is unavailable"); + + ExceptionCode ec = 0; + RefPtr<EventSource> eventSource = EventSource::create(url, context, ec); + if (ec) { + setDOMException(exec, ec); + return 0; + } + + return asObject(toJS(exec, jsConstructor->globalObject(), eventSource.release())); +} + +ConstructType JSEventSourceConstructor::getConstructData(ConstructData& constructData) +{ + constructData.native.function = constructEventSource; + return ConstructTypeHost; +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventSourceConstructor.h b/WebCore/bindings/js/JSEventSourceConstructor.h new file mode 100644 index 0000000..b2f3cb5 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceConstructor.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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 JSEventSourceConstructor_h +#define JSEventSourceConstructor_h + +#if ENABLE(EVENTSOURCE) + +#include "JSDOMBinding.h" + +namespace WebCore { + + class JSEventSourceConstructor : public DOMConstructorObject { + public: + JSEventSourceConstructor(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 // ENABLE(EVENTSOURCE) + +#endif // JSEventSourceConstructor_h diff --git a/WebCore/bindings/js/JSEventSourceCustom.cpp b/WebCore/bindings/js/JSEventSourceCustom.cpp new file mode 100644 index 0000000..d20ccd6 --- /dev/null +++ b/WebCore/bindings/js/JSEventSourceCustom.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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(EVENTSOURCE) + +#include "JSEventSource.h" + +#include "EventSource.h" +#include "JSDOMGlobalObject.h" +#include "JSEventListener.h" + +using namespace JSC; + +namespace WebCore { + +void JSEventSource::markChildren(MarkStack& markStack) +{ + DOMObject::markChildren(markStack); + + markIfNotNull(markStack, m_impl->onopen()); + markIfNotNull(markStack, m_impl->onmessage()); + markIfNotNull(markStack, m_impl->onerror()); + + typedef EventSource::EventListenersMap EventListenersMap; + typedef EventSource::ListenerVector ListenerVector; + EventListenersMap& eventListeners = m_impl->eventListeners(); + for (EventListenersMap::iterator mapIter = eventListeners.begin(); mapIter != eventListeners.end(); ++mapIter) { + for (ListenerVector::iterator vecIter = mapIter->second.begin(); vecIter != mapIter->second.end(); ++vecIter) + (*vecIter)->markJSFunction(markStack); + } +} + +JSValue JSEventSource::addEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + RefPtr<JSEventListener> listener = globalObject->findOrCreateJSEventListener(args.at(1)); + if (!listener) + return jsUndefined(); + impl()->addEventListener(args.at(0).toString(exec), listener.release(), args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +JSValue JSEventSource::removeEventListener(ExecState* exec, const ArgList& args) +{ + JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(impl()->scriptExecutionContext()); + if (!globalObject) + return jsUndefined(); + JSEventListener* listener = globalObject->findJSEventListener(args.at(1)); + if (!listener) + return jsUndefined(); + impl()->removeEventListener(args.at(0).toString(exec), listener, args.at(2).toBoolean(exec)); + return jsUndefined(); +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/bindings/js/JSEventTarget.cpp b/WebCore/bindings/js/JSEventTarget.cpp index c34e10e..5825ee5 100644 --- a/WebCore/bindings/js/JSEventTarget.cpp +++ b/WebCore/bindings/js/JSEventTarget.cpp @@ -43,6 +43,11 @@ #include "XMLHttpRequest.h" #include "XMLHttpRequestUpload.h" +#if ENABLE(EVENTSOURCE) +#include "EventSource.h" +#include "JSEventSource.h" +#endif + #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "DOMApplicationCache.h" #include "JSDOMApplicationCache.h" @@ -60,6 +65,11 @@ #include "Worker.h" #endif +#if ENABLE(NOTIFICATIONS) +#include "JSNotification.h" +#include "Notification.h" +#endif + using namespace JSC; namespace WebCore { @@ -69,6 +79,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ if (!target) return jsNull(); +#if ENABLE(EVENTSOURCE) + if (EventSource* eventSource = target->toEventSource()) + return toJS(exec, globalObject, eventSource); +#endif + #if ENABLE(SVG) // SVGElementInstance supports both toSVGElementInstance and toNode since so much mouse handling code depends on toNode returning a valid node. if (SVGElementInstance* instance = target->toSVGElementInstance()) @@ -111,6 +126,11 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ return toJSDOMGlobalObject(workerContext); #endif +#if ENABLE(NOTIFICATIONS) + if (Notification* notification = target->toNotification()) + return toJS(exec, notification); +#endif + ASSERT_NOT_REACHED(); return jsNull(); } @@ -118,7 +138,7 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EventTarget* targ EventTarget* toEventTarget(JSC::JSValue value) { #define CONVERT_TO_EVENT_TARGET(type) \ - if (value.isObject(&JS##type::s_info)) \ + if (value.inherits(&JS##type::s_info)) \ return static_cast<JS##type*>(asObject(value))->impl(); CONVERT_TO_EVENT_TARGET(Node) @@ -126,9 +146,13 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(XMLHttpRequestUpload) CONVERT_TO_EVENT_TARGET(MessagePort) - if (value.isObject(&JSDOMWindowShell::s_info)) + if (value.inherits(&JSDOMWindowShell::s_info)) return static_cast<JSDOMWindowShell*>(asObject(value))->impl(); +#if ENABLE(EVENTSOURCE) + CONVERT_TO_EVENT_TARGET(EventSource) +#endif + #if ENABLE(OFFLINE_WEB_APPLICATIONS) CONVERT_TO_EVENT_TARGET(DOMApplicationCache) #endif @@ -147,6 +171,10 @@ EventTarget* toEventTarget(JSC::JSValue value) CONVERT_TO_EVENT_TARGET(SharedWorkerContext) #endif +#if ENABLE(NOTIFICATIONS) + CONVERT_TO_EVENT_TARGET(Notification) +#endif + return 0; } diff --git a/WebCore/bindings/js/JSGeolocationCustom.cpp b/WebCore/bindings/js/JSGeolocationCustom.cpp index 6379a1c..cc0ba8b 100644 --- a/WebCore/bindings/js/JSGeolocationCustom.cpp +++ b/WebCore/bindings/js/JSGeolocationCustom.cpp @@ -34,6 +34,7 @@ #include "JSCustomPositionErrorCallback.h" #include "JSDOMWindow.h" #include "PositionOptions.h" +#include <runtime/InternalFunction.h> using namespace JSC; using namespace std; @@ -43,7 +44,7 @@ namespace WebCore { static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSValue value) { // The spec specifies 'FunctionOnly' for this object. - if (!value.isObject(&InternalFunction::info)) { + if (!value.inherits(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -55,12 +56,12 @@ static PassRefPtr<PositionCallback> createPositionCallback(ExecState* exec, JSVa static PassRefPtr<PositionErrorCallback> createPositionErrorCallback(ExecState* exec, JSValue value) { - // Argument is optional (hence undefined is allowed), and null is allowed. + // Argument is optional (hence undefined is allowed), and null is allowed. if (value.isUndefinedOrNull()) return 0; // The spec specifies 'FunctionOnly' for this object. - if (!value.isObject(&InternalFunction::info)) { + if (!value.inherits(&InternalFunction::info)) { setDOMException(exec, TYPE_MISMATCH_ERR); return 0; } @@ -91,7 +92,7 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu JSValue enableHighAccuracyValue = object->get(exec, Identifier(exec, "enableHighAccuracy")); if (exec->hadException()) return 0; - if(!enableHighAccuracyValue.isUndefined()) { + if (!enableHighAccuracyValue.isUndefined()) { options->setEnableHighAccuracy(enableHighAccuracyValue.toBoolean(exec)); if (exec->hadException()) return 0; diff --git a/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp new file mode 100644 index 0000000..921e243 --- /dev/null +++ b/WebCore/bindings/js/JSHTMLCanvasElementCustom.cpp @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Apple Inc. All right 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 "JSHTMLCanvasElement.h" + +#include "HTMLCanvasElement.h" + +using namespace JSC; + +namespace WebCore { + +void JSHTMLCanvasElement::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(impl()); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + markDOMObjectWrapper(markStack, globalData, canvas->renderingContext2D()); +} + +} diff --git a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp index 6b47622..e5166ee 100644 --- a/WebCore/bindings/js/JSHTMLInputElementCustom.cpp +++ b/WebCore/bindings/js/JSHTMLInputElementCustom.cpp @@ -29,6 +29,7 @@ #include "Document.h" #include "HTMLInputElement.h" #include "Settings.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSHistoryCustom.cpp b/WebCore/bindings/js/JSHistoryCustom.cpp index a3b15e1..a11266d 100644 --- a/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/WebCore/bindings/js/JSHistoryCustom.cpp @@ -31,6 +31,7 @@ #include "Frame.h" #include "History.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSImageConstructor.cpp b/WebCore/bindings/js/JSImageConstructor.cpp index faaaf41..0f4a991 100644 --- a/WebCore/bindings/js/JSImageConstructor.cpp +++ b/WebCore/bindings/js/JSImageConstructor.cpp @@ -25,6 +25,7 @@ #include "JSHTMLImageElement.h" #include "JSNode.h" #include "ScriptExecutionContext.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSInspectorBackendCustom.cpp b/WebCore/bindings/js/JSInspectorBackendCustom.cpp index b2eb2d1..30e6dc2 100644 --- a/WebCore/bindings/js/JSInspectorBackendCustom.cpp +++ b/WebCore/bindings/js/JSInspectorBackendCustom.cpp @@ -2,6 +2,7 @@ * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2009 Joseph Pecoraro * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -34,6 +35,8 @@ #include "JSInspectorBackend.h" #include "Console.h" +#include "Cookie.h" +#include "CookieJar.h" #if ENABLE(DATABASE) #include "Database.h" #include "JSDatabase.h" @@ -51,6 +54,10 @@ #include "JSRange.h" #include "Node.h" #include "Page.h" +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#include "JSStorage.h" +#endif #include "TextIterator.h" #include "VisiblePosition.h" #include <runtime/JSArray.h> @@ -70,21 +77,12 @@ using namespace JSC; namespace WebCore { -JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState*, const JSC::ArgList& args) +JSValue JSInspectorBackend::highlightDOMNode(JSC::ExecState* exec, const JSC::ArgList& args) { if (args.size() < 1) return jsUndefined(); - JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); - if (!wrapper) - return jsUndefined(); - - Node* node = toNode(wrapper->unwrappedObject()); - if (!node) - return jsUndefined(); - - impl()->highlight(node); - + impl()->highlight(args.at(0).toInt32(exec)); return jsUndefined(); } @@ -158,6 +156,68 @@ JSValue JSInspectorBackend::inspectedWindow(ExecState*, const ArgList&) return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), inspectedWindow); } +JSValue JSInspectorBackend::cookies(ExecState* exec, const ArgList&) +{ + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + Document* document = ic->inspectedPage()->mainFrame()->document(); + Vector<Cookie> cookies; + bool isImplemented = getRawCookies(document, document->cookieURL(), cookies); + + if (!isImplemented) + return jsUndefined(); + + MarkedArgumentBuffer result; + Identifier nameIdentifier(exec, "name"); + Identifier valueIdentifier(exec, "value"); + Identifier domainIdentifier(exec, "domain"); + Identifier pathIdentifier(exec, "path"); + Identifier expiresIdentifier(exec, "expires"); + Identifier sizeIdentifier(exec, "size"); + Identifier httpOnlyIdentifier(exec, "httpOnly"); + Identifier secureIdentifier(exec, "secure"); + Identifier sessionIdentifier(exec, "session"); + + unsigned length = cookies.size(); + for (unsigned i = 0; i < length; ++i) { + const Cookie& cookie = cookies[i]; + JSObject* cookieObject = constructEmptyObject(exec); + cookieObject->putDirect(nameIdentifier, jsString(exec, cookie.name)); + cookieObject->putDirect(valueIdentifier, jsString(exec, cookie.value)); + cookieObject->putDirect(domainIdentifier, jsString(exec, cookie.domain)); + cookieObject->putDirect(pathIdentifier, jsString(exec, cookie.path)); + cookieObject->putDirect(expiresIdentifier, jsNumber(exec, cookie.expires)); + cookieObject->putDirect(sizeIdentifier, jsNumber(exec, cookie.name.length() + cookie.value.length())); + cookieObject->putDirect(httpOnlyIdentifier, jsBoolean(cookie.httpOnly)); + cookieObject->putDirect(secureIdentifier, jsBoolean(cookie.secure)); + cookieObject->putDirect(sessionIdentifier, jsBoolean(cookie.session)); + result.append(cookieObject); + } + + return constructArray(exec, result); +} + +JSValue JSInspectorBackend::deleteCookie(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + String cookieName = args.at(0).toString(exec); + if (exec->hadException()) + return jsUndefined(); + + Document* document = ic->inspectedPage()->mainFrame()->document(); + WebCore::deleteCookie(document, document->cookieURL(), cookieName); + + return jsUndefined(); +} + JSValue JSInspectorBackend::setting(ExecState* exec, const ArgList& args) { if (args.size() < 1) @@ -280,4 +340,107 @@ JSValue JSInspectorBackend::profiles(JSC::ExecState* exec, const JSC::ArgList&) #endif +JSValue JSInspectorBackend::nodeForId(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + Node* node = impl()->nodeForId(args.at(0).toInt32(exec)); + if (!node) + return jsUndefined(); + + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + JSLock lock(SilenceAssertionsOnly); + JSDOMWindow* inspectedWindow = toJSDOMWindow(ic->inspectedPage()->mainFrame()); + return JSInspectedObjectWrapper::wrap(inspectedWindow->globalExec(), toJS(exec, deprecatedGlobalObjectForPrototype(inspectedWindow->globalExec()), node)); +} + +JSValue JSInspectorBackend::idForNode(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Node* node = toNode(wrapper->unwrappedObject()); + if (node) + return jsNumber(exec, impl()->idForNode(node)); + return jsUndefined(); +} + +JSValue JSInspectorBackend::wrapObject(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + return impl()->wrapObject(ScriptValue(args.at(0))).jsValue(); +} + +JSValue JSInspectorBackend::unwrapObject(ExecState* exec, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + return impl()->unwrapObject(args.at(0).toString(exec)).jsValue(); +} + +JSValue JSInspectorBackend::pushNodePathToFrontend(ExecState* exec, const ArgList& args) +{ + if (args.size() < 2) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Node* node = toNode(wrapper->unwrappedObject()); + if (!node) + return jsUndefined(); + + bool selectInUI = args.at(1).toBoolean(exec); + return jsNumber(exec, impl()->pushNodePathToFrontend(node, selectInUI)); +} + +#if ENABLE(DATABASE) +JSValue JSInspectorBackend::selectDatabase(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Database* database = toDatabase(wrapper->unwrappedObject()); + if (database) + impl()->selectDatabase(database); + return jsUndefined(); +} +#endif + +#if ENABLE(DOM_STORAGE) +JSValue JSInspectorBackend::selectDOMStorage(ExecState*, const ArgList& args) +{ + if (args.size() < 1) + return jsUndefined(); + InspectorController* ic = impl()->inspectorController(); + if (!ic) + return jsUndefined(); + + JSQuarantinedObjectWrapper* wrapper = JSQuarantinedObjectWrapper::asWrapper(args.at(0)); + if (!wrapper) + return jsUndefined(); + + Storage* storage = toStorage(wrapper->unwrappedObject()); + if (storage) + impl()->selectDOMStorage(storage); + return jsUndefined(); +} +#endif + } // namespace WebCore diff --git a/WebCore/bindings/js/JSLazyEventListener.cpp b/WebCore/bindings/js/JSLazyEventListener.cpp index 7caff2b..cf0ed44 100644 --- a/WebCore/bindings/js/JSLazyEventListener.cpp +++ b/WebCore/bindings/js/JSLazyEventListener.cpp @@ -23,6 +23,7 @@ #include "Frame.h" #include "JSNode.h" #include <runtime/FunctionConstructor.h> +#include <runtime/JSFunction.h> #include <runtime/JSLock.h> #include <wtf/RefCountedLeakCounter.h> diff --git a/WebCore/bindings/js/JSLocationCustom.cpp b/WebCore/bindings/js/JSLocationCustom.cpp index d7d32f4..0289bc0 100644 --- a/WebCore/bindings/js/JSLocationCustom.cpp +++ b/WebCore/bindings/js/JSLocationCustom.cpp @@ -31,6 +31,7 @@ #include "KURL.h" #include "Location.h" #include "ScriptController.h" +#include <runtime/JSFunction.h> #include <runtime/PrototypeFunction.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSMessageChannelConstructor.cpp b/WebCore/bindings/js/JSMessageChannelConstructor.cpp index 25a5cb2..9721ba3 100644 --- a/WebCore/bindings/js/JSMessageChannelConstructor.cpp +++ b/WebCore/bindings/js/JSMessageChannelConstructor.cpp @@ -30,6 +30,7 @@ #include "JSDocument.h" #include "JSMessageChannel.h" #include "MessageChannel.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSNodeFilterCustom.cpp b/WebCore/bindings/js/JSNodeFilterCustom.cpp index 09fd110..2a99a93 100644 --- a/WebCore/bindings/js/JSNodeFilterCustom.cpp +++ b/WebCore/bindings/js/JSNodeFilterCustom.cpp @@ -48,7 +48,7 @@ JSValue JSNodeFilter::acceptNode(ExecState* exec, const ArgList& args) PassRefPtr<NodeFilter> toNodeFilter(JSValue value) { - if (value.isObject(&JSNodeFilter::s_info)) + if (value.inherits(&JSNodeFilter::s_info)) return static_cast<JSNodeFilter*>(asObject(value))->impl(); return NodeFilter::create(JSNodeFilterCondition::create(value)); diff --git a/WebCore/bindings/js/JSOptionConstructor.cpp b/WebCore/bindings/js/JSOptionConstructor.cpp index 2b8bd5d..7da0666 100644 --- a/WebCore/bindings/js/JSOptionConstructor.cpp +++ b/WebCore/bindings/js/JSOptionConstructor.cpp @@ -25,6 +25,7 @@ #include "JSHTMLOptionElement.h" #include "ScriptExecutionContext.h" #include "Text.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSStyleSheetCustom.cpp b/WebCore/bindings/js/JSStyleSheetCustom.cpp index 43249dc..d711b6f 100644 --- a/WebCore/bindings/js/JSStyleSheetCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetCustom.cpp @@ -56,12 +56,19 @@ void JSStyleSheet::markChildren(MarkStack& markStack) { Base::markChildren(markStack); + StyleSheet* sheet = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = sheet->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, sheet->item(i)); + // This prevents us from having a style sheet with a dangling ownerNode pointer. // A better solution would be to handle this on the DOM side -- if the style sheet // is kept around, then we want the node to stay around too. One possibility would // be to make ref/deref on the style sheet ref/deref the node instead, but there's // a lot of disentangling of the CSS DOM objects that would need to happen first. - if (Node* ownerNode = impl()->ownerNode()) { + if (Node* ownerNode = sheet->ownerNode()) { if (JSNode* ownerNodeWrapper = getCachedDOMNodeWrapper(ownerNode->document(), ownerNode)) markStack.append(ownerNodeWrapper); } diff --git a/WebCore/bindings/js/JSStyleSheetListCustom.cpp b/WebCore/bindings/js/JSStyleSheetListCustom.cpp index 1da6418..7bf9389 100644 --- a/WebCore/bindings/js/JSStyleSheetListCustom.cpp +++ b/WebCore/bindings/js/JSStyleSheetListCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 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 @@ -35,6 +35,18 @@ using namespace JSC; namespace WebCore { +void JSStyleSheetList::markChildren(MarkStack& markStack) +{ + Base::markChildren(markStack); + + StyleSheetList* list = impl(); + JSGlobalData& globalData = *Heap::heap(this)->globalData(); + + unsigned length = list->length(); + for (unsigned i = 0; i < length; ++i) + markDOMObjectWrapper(markStack, globalData, list->item(i)); +} + bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, const Identifier& propertyName) { return styleSheetList->getNamedItem(propertyName); diff --git a/WebCore/bindings/js/JSWebSocketConstructor.cpp b/WebCore/bindings/js/JSWebSocketConstructor.cpp index ca2e104..5b34765 100644 --- a/WebCore/bindings/js/JSWebSocketConstructor.cpp +++ b/WebCore/bindings/js/JSWebSocketConstructor.cpp @@ -37,6 +37,7 @@ #include "JSWebSocket.h" #include "ScriptExecutionContext.h" #include "WebSocket.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWebSocketCustom.cpp b/WebCore/bindings/js/JSWebSocketCustom.cpp index 3aa4b8b..401b33d 100644 --- a/WebCore/bindings/js/JSWebSocketCustom.cpp +++ b/WebCore/bindings/js/JSWebSocketCustom.cpp @@ -38,6 +38,7 @@ #include "KURL.h" #include "WebSocket.h" #include "NotImplemented.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerConstructor.cpp b/WebCore/bindings/js/JSWorkerConstructor.cpp index 9943cfb..69c05e7 100644 --- a/WebCore/bindings/js/JSWorkerConstructor.cpp +++ b/WebCore/bindings/js/JSWorkerConstructor.cpp @@ -34,6 +34,7 @@ #include "JSDOMWindowCustom.h" #include "JSWorker.h" #include "Worker.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp index 919c81f..7ece7a0 100644 --- a/WebCore/bindings/js/JSWorkerContextCustom.cpp +++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp @@ -43,6 +43,10 @@ #include "WorkerNavigator.h" #include <interpreter/Interpreter.h> +#if ENABLE(EVENTSOURCE) +#include "JSEventSourceConstructor.h" +#endif + using namespace JSC; namespace WebCore { @@ -77,6 +81,13 @@ bool JSWorkerContext::getOwnPropertySlotDelegate(ExecState* exec, const Identifi return false; } +#if ENABLE(EVENTSOURCE) +JSValue JSWorkerContext::eventSource(ExecState* exec) const +{ + return getDOMConstructor<JSEventSourceConstructor>(exec, this); +} +#endif + JSValue JSWorkerContext::xmlHttpRequest(ExecState* exec) const { return getDOMConstructor<JSXMLHttpRequestConstructor>(exec, this); diff --git a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp index a644c9e..91fff9a 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestConstructor.cpp @@ -23,6 +23,7 @@ #include "JSXMLHttpRequest.h" #include "ScriptExecutionContext.h" #include "XMLHttpRequest.h" +#include <runtime/Error.h> using namespace JSC; diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp index a591fae..95bc16e 100644 --- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp +++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp @@ -123,9 +123,9 @@ JSValue JSXMLHttpRequest::send(ExecState* exec, const ArgList& args) JSValue val = args.at(0); if (val.isUndefinedOrNull()) impl()->send(ec); - else if (val.isObject(&JSDocument::s_info)) + else if (val.inherits(&JSDocument::s_info)) impl()->send(toDocument(val), ec); - else if (val.isObject(&JSFile::s_info)) + else if (val.inherits(&JSFile::s_info)) impl()->send(toFile(val), ec); else impl()->send(val.toString(exec), ec); diff --git a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp index 01e53a6..441bbc9 100644 --- a/WebCore/bindings/js/JSXSLTProcessorCustom.cpp +++ b/WebCore/bindings/js/JSXSLTProcessorCustom.cpp @@ -49,7 +49,7 @@ namespace WebCore { JSValue JSXSLTProcessor::importStylesheet(ExecState*, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.isObject(&JSNode::s_info)) { + if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); impl()->importStylesheet(node->impl()); return jsUndefined(); @@ -62,7 +62,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg { JSValue nodeVal = args.at(0); JSValue docVal = args.at(1); - if (nodeVal.isObject(&JSNode::s_info) && docVal.isObject(&JSDocument::s_info)) { + if (nodeVal.inherits(&JSNode::s_info) && docVal.inherits(&JSDocument::s_info)) { WebCore::Node* node = static_cast<JSNode*>(asObject(nodeVal))->impl(); Document* doc = static_cast<Document*>(static_cast<JSDocument*>(asObject(docVal))->impl()); return toJS(exec, impl()->transformToFragment(node, doc).get()); @@ -74,7 +74,7 @@ JSValue JSXSLTProcessor::transformToFragment(ExecState* exec, const ArgList& arg JSValue JSXSLTProcessor::transformToDocument(ExecState* exec, const ArgList& args) { JSValue nodeVal = args.at(0); - if (nodeVal.isObject(&JSNode::s_info)) { + if (nodeVal.inherits(&JSNode::s_info)) { JSNode* node = static_cast<JSNode*>(asObject(nodeVal)); RefPtr<Document> resultDocument = impl()->transformToDocument(node->impl()); if (resultDocument) diff --git a/WebCore/bindings/js/ScriptControllerHaiku.cpp b/WebCore/bindings/js/ScriptControllerHaiku.cpp index b573b97..3fe471d 100644 --- a/WebCore/bindings/js/ScriptControllerHaiku.cpp +++ b/WebCore/bindings/js/ScriptControllerHaiku.cpp @@ -28,8 +28,8 @@ #include "ScriptController.h" #include "PluginView.h" -#include "runtime_root.h" #include "runtime.h" +#include "runtime_root.h" namespace WebCore { diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.cpp b/WebCore/bindings/js/ScriptObjectQuarantine.cpp index 89553ef..f96f89e 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/js/ScriptObjectQuarantine.cpp @@ -38,6 +38,7 @@ #include "JSNode.h" #include "ScriptObject.h" #include "ScriptValue.h" +#include "Storage.h" #include <runtime/JSLock.h> @@ -80,10 +81,11 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj #endif #if ENABLE(DOM_STORAGE) -bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(frame); ASSERT(storage); + Frame* frame = storage->frame(); + ASSERT(frame); JSDOMGlobalObject* globalObject = toJSDOMWindow(frame); ExecState* exec = globalObject->globalExec(); diff --git a/WebCore/bindings/js/ScriptObjectQuarantine.h b/WebCore/bindings/js/ScriptObjectQuarantine.h index d70acd7..df52379 100644 --- a/WebCore/bindings/js/ScriptObjectQuarantine.h +++ b/WebCore/bindings/js/ScriptObjectQuarantine.h @@ -37,7 +37,6 @@ namespace WebCore { class Database; class DOMWindow; - class Frame; class Node; class ScriptObject; class ScriptValue; @@ -49,7 +48,7 @@ namespace WebCore { bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); #endif #if ENABLE(DOM_STORAGE) - bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); #endif bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/js/ScriptValue.cpp b/WebCore/bindings/js/ScriptValue.cpp index d427cee..6eac102 100644 --- a/WebCore/bindings/js/ScriptValue.cpp +++ b/WebCore/bindings/js/ScriptValue.cpp @@ -74,4 +74,11 @@ bool ScriptValue::isUndefined() const return m_value.get().isUndefined(); } +bool ScriptValue::isObject() const +{ + if (!m_value) + return false; + return m_value.get().isObject(); +} + } // namespace WebCore diff --git a/WebCore/bindings/js/ScriptValue.h b/WebCore/bindings/js/ScriptValue.h index 209ce06..19bb693 100644 --- a/WebCore/bindings/js/ScriptValue.h +++ b/WebCore/bindings/js/ScriptValue.h @@ -50,6 +50,7 @@ public: bool isEqual(ScriptState*, const ScriptValue&) const; bool isNull() const; bool isUndefined() const; + bool isObject() const; bool hasNoValue() const { return m_value == JSC::JSValue(); } private: diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm index 1918aef..f6de50e 100644 --- a/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -667,6 +667,12 @@ sub GenerateHeader push(@headerContent, " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . " {\n" . + " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType" . ($dataNode->extendedAttributes->{"CustomMarkFunction"} ? "" : ", JSC::HasDefaultMark") . "));\n" . + " }\n"); + } elsif ($dataNode->extendedAttributes->{"CustomMarkFunction"}) { + push(@headerContent, + " static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype)\n" . + " {\n" . " return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType));\n" . " }\n"); } @@ -1373,7 +1379,7 @@ sub GenerateImplementation push(@implContent, " if (!castedThisObj)\n"); push(@implContent, " return throwError(exec, TypeError);\n"); } else { - push(@implContent, " if (!thisValue.isObject(&${className}::s_info))\n"); + push(@implContent, " if (!thisValue.inherits(&${className}::s_info))\n"); push(@implContent, " return throwError(exec, TypeError);\n"); push(@implContent, " $className* castedThisObj = static_cast<$className*>(asObject(thisValue));\n"); } @@ -1537,7 +1543,7 @@ sub GenerateImplementation push(@implContent, "{\n"); - push(@implContent, " return value.isObject(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); + push(@implContent, " return value.inherits(&${className}::s_info) ? " . ($podType ? "($podType) *" : "") . "static_cast<$className*>(asObject(value))->impl() : "); if ($podType and $podType ne "float") { push(@implContent, "$podType();\n}\n"); } else { diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm index 439f368..1eb3e85 100644 --- a/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -975,51 +975,24 @@ sub GenerateBatchedAttributeData $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } } + } else { + # Default Getter and Setter + $getter = "${interfaceName}Internal::${attrName}AttrGetter"; + $setter = "${interfaceName}Internal::${attrName}AttrSetter"; - # Custom Getter and Setter - } elsif ($attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; - if ($interfaceName eq "WorkerContext" and $attrName eq "self") { - $setter = "0"; - $propAttr = "v8::ReadOnly"; - } else { + # Custom Setter + if ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { $hasCustomSetter = 1; $setter = "V8Custom::v8${customAccessor}AccessorSetter"; } - # Custom Setter - } elsif ($attrExt->{"CustomSetter"} || $attrExt->{"V8CustomSetter"}) { - $hasCustomSetter = 1; - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "V8Custom::v8${customAccessor}AccessorSetter"; - - # Custom Getter - } elsif ($attrExt->{"CustomGetter"}) { - $getter = "V8Custom::v8${customAccessor}AccessorGetter"; - $setter = "${interfaceName}Internal::${attrName}AttrSetter"; - - # Replaceable - } elsif ($attrExt->{"Replaceable"}) { - # Replaceable accessor is put on instance template with ReadOnly attribute. - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "0"; - - # Mark to avoid duplicate v8::ReadOnly flags in output. - $hasCustomSetter = 1; - - # Handle the special case of window.top being marked upstream as Replaceable. - # FIXME: Investigate why [Replaceable] is not marked as ReadOnly - # upstream and reach parity. - if (!($interfaceName eq "DOMWindow" and $attrName eq "top")) { - $propAttr .= "|v8::ReadOnly"; + # Custom Getter + if ($attrExt->{"CustomGetter"} || $attrExt->{"Custom"} || $attrExt->{"V8Custom"}) { + $getter = "V8Custom::v8${customAccessor}AccessorGetter"; } - - # Normal - } else { - $getter = "${interfaceName}Internal::${attrName}AttrGetter"; - $setter = "${interfaceName}Internal::${attrName}AttrSetter"; } + # Replaceable if ($attrExt->{"Replaceable"} && !$hasCustomSetter) { $setter = "0"; $propAttr .= "|v8::ReadOnly"; @@ -1653,6 +1626,7 @@ sub IsRefPtrType return 1 if $type eq "Plugin"; return 1 if $type eq "ProcessingInstruction"; return 1 if $type eq "Range"; + return 1 if $type eq "RGBColor"; return 1 if $type eq "Text"; return 1 if $type eq "TextMetrics"; return 1 if $type eq "TimeRanges"; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp index 053cf68..c9f379b 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.cpp +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.cpp @@ -38,6 +38,7 @@ #include "Page.h" #include "ScriptObject.h" #include "ScriptValue.h" +#include "Storage.h" #include "V8Binding.h" #include "V8Proxy.h" @@ -61,10 +62,11 @@ bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObj return false; } -bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject) +bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject) { - ASSERT(frame); ASSERT(storage); + Frame* frame = storage->frame(); + ASSERT(frame); #if ENABLE(DOM_STORAGE) v8::HandleScope handleScope; diff --git a/WebCore/bindings/v8/ScriptObjectQuarantine.h b/WebCore/bindings/v8/ScriptObjectQuarantine.h index 3b7ccff..712dd9b 100644 --- a/WebCore/bindings/v8/ScriptObjectQuarantine.h +++ b/WebCore/bindings/v8/ScriptObjectQuarantine.h @@ -42,7 +42,6 @@ namespace WebCore { class Database; class DOMWindow; - class Frame; class Node; class ScriptObject; class ScriptValue; @@ -51,7 +50,7 @@ namespace WebCore { ScriptValue quarantineValue(ScriptState*, const ScriptValue&); bool getQuarantinedScriptObject(Database* database, ScriptObject& quarantinedObject); - bool getQuarantinedScriptObject(Frame* frame, Storage* storage, ScriptObject& quarantinedObject); + bool getQuarantinedScriptObject(Storage* storage, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(Node* node, ScriptObject& quarantinedObject); bool getQuarantinedScriptObject(DOMWindow* domWindow, ScriptObject& quarantinedObject); diff --git a/WebCore/bindings/v8/ScriptValue.h b/WebCore/bindings/v8/ScriptValue.h index 004851b..ddc3577 100644 --- a/WebCore/bindings/v8/ScriptValue.h +++ b/WebCore/bindings/v8/ScriptValue.h @@ -110,7 +110,12 @@ public: { return m_value->IsUndefined(); } - + + bool isObject() const + { + return m_value->IsObject(); + } + bool hasNoValue() const { return m_value.IsEmpty(); diff --git a/WebCore/bindings/v8/V8Binding.cpp b/WebCore/bindings/v8/V8Binding.cpp index c5d580a..c0367d5 100644 --- a/WebCore/bindings/v8/V8Binding.cpp +++ b/WebCore/bindings/v8/V8Binding.cpp @@ -154,14 +154,12 @@ AtomicString v8StringToAtomicWebCoreString(v8::Handle<v8::String> v8String) { WebCoreStringResource* stringResource = WebCoreStringResource::toStringResource(v8String); if (!stringResource) { + if (!v8String->CanMakeExternal()) + return v8StringToWebCoreString(v8String, DoNotExternalize, AtomicStringType); // If this string hasn't been externalized, we force it now. - String plain = v8StringToWebCoreString(v8String, Externalize, AtomicStringType); - // If the string is empty there's no room to cache an atomic - // string so we bail out. - if (plain.isEmpty()) - return plain; + v8StringToWebCoreString(v8String, Externalize, AtomicStringType); stringResource = WebCoreStringResource::toStringResource(v8String); - ASSERT(stringResource != NULL); + ASSERT(stringResource); } return stringResource->atomicString(); } diff --git a/WebCore/bindings/v8/custom/V8CustomBinding.h b/WebCore/bindings/v8/custom/V8CustomBinding.h index 80fed1d..945dcbb 100644 --- a/WebCore/bindings/v8/custom/V8CustomBinding.h +++ b/WebCore/bindings/v8/custom/V8CustomBinding.h @@ -218,7 +218,7 @@ namespace WebCore { DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DStrokeStyle); DECLARE_PROPERTY_ACCESSOR(CanvasRenderingContext2DFillStyle); - DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowEvent); + DECLARE_PROPERTY_ACCESSOR(DOMWindowEvent); DECLARE_PROPERTY_ACCESSOR_GETTER(DOMWindowCrypto); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowLocation); DECLARE_PROPERTY_ACCESSOR_SETTER(DOMWindowOpener); @@ -402,12 +402,23 @@ namespace WebCore { DECLARE_CALLBACK(InspectorBackendSetting); DECLARE_CALLBACK(InspectorBackendInspectedWindow); DECLARE_CALLBACK(InspectorBackendSetSetting); + DECLARE_CALLBACK(InspectorBackendCookies); + DECLARE_CALLBACK(InspectorBackendDeleteCookie); DECLARE_CALLBACK(InspectorBackendCurrentCallFrame); DECLARE_CALLBACK(InspectorBackendDebuggerEnabled); DECLARE_CALLBACK(InspectorBackendPauseOnExceptions); DECLARE_CALLBACK(InspectorBackendProfilerEnabled); + DECLARE_CALLBACK(InspectorBackendNodeForId); + DECLARE_CALLBACK(InspectorBackendIdForNode); + DECLARE_CALLBACK(InspectorBackendWrapObject); + DECLARE_CALLBACK(InspectorBackendUnwrapObject); + DECLARE_CALLBACK(InspectorBackendPushNodePathToFrontend); #if ENABLE(DATABASE) DECLARE_CALLBACK(InspectorBackendDatabaseTableNames); + DECLARE_CALLBACK(InspectorBackendSelectDatabase); +#endif +#if ENABLE(DOM_STORAGE) + DECLARE_CALLBACK(InspectorBackendSelectDOMStorage); #endif DECLARE_CALLBACK(InspectorBackendWrapCallback); diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp index 7d0b9e6..13d40bc 100644 --- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp +++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp @@ -145,14 +145,37 @@ static v8::Handle<v8::Value> convertBase64(const String& str, bool encode) ACCESSOR_GETTER(DOMWindowEvent) { + v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); + if (holder.IsEmpty()) + return v8::Undefined(); + + Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); + if (!frame || !V8Proxy::canAccessFrame(frame, true)) + return v8::Undefined(); + + v8::Local<v8::Context> context = V8Proxy::context(frame); v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); - v8::Local<v8::Context> context = v8::Context::GetCurrent(); v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol); if (jsEvent.IsEmpty()) return v8::Undefined(); return jsEvent; } +ACCESSOR_SETTER(DOMWindowEvent) +{ + v8::Handle<v8::Object> holder = V8DOMWrapper::lookupDOMWrapper(V8ClassIndex::DOMWINDOW, info.This()); + if (holder.IsEmpty()) + return; + + Frame* frame = V8DOMWrapper::convertToNativeObject<DOMWindow>(V8ClassIndex::DOMWINDOW, holder)->frame(); + if (!frame || !V8Proxy::canAccessFrame(frame, true)) + return; + + v8::Local<v8::Context> context = V8Proxy::context(frame); + v8::Local<v8::String> eventSymbol = v8::String::NewSymbol("event"); + context->Global()->SetHiddenValue(eventSymbol, value); +} + ACCESSOR_GETTER(DOMWindowCrypto) { // FIXME: Implement me. diff --git a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp index 2571df4..cb9b3a9 100644 --- a/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp +++ b/WebCore/bindings/v8/custom/V8InspectorBackendCustom.cpp @@ -57,13 +57,8 @@ CALLBACK_FUNC_DECL(InspectorBackendHighlightDOMNode) if (args.Length() < 1) return v8::Undefined(); - Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); - if (!node) - return v8::Undefined(); - InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); - inspectorBackend->highlight(node); - + inspectorBackend->highlight(args[0]->ToInt32()->Value()); return v8::Undefined(); } @@ -209,10 +204,123 @@ CALLBACK_FUNC_DECL(InspectorBackendSetSetting) return v8::Undefined(); } +CALLBACK_FUNC_DECL(InspectorBackendCookies) +{ + INC_STATS("InspectorBackend.cookies()"); + // FIXME: Not yet implemented. + return v8::Undefined(); +} + +CALLBACK_FUNC_DECL(InspectorBackendDeleteCookie) +{ + INC_STATS("InspectorBackend.deleteCookie()"); + // FIXME: Not yet implemented. (see WebCore/bindings/js/JSInspectorBackendCustom.cpp#deleteCookie) + return v8::Undefined(); +} + CALLBACK_FUNC_DECL(InspectorBackendWrapCallback) { INC_STATS("InspectorBackend.wrapCallback()"); return args[0]; } +CALLBACK_FUNC_DECL(InspectorBackendNodeForId) +{ + INC_STATS("InspectorBackend.nodeForId()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + + Node* node = inspectorBackend->nodeForId(args[0]->ToInt32()->Value()); + if (!node) + return v8::Undefined(); + + InspectorController* ic = inspectorBackend->inspectorController(); + if (!ic) + return v8::Undefined(); + + return V8DOMWrapper::convertToV8Object(V8ClassIndex::NODE, node); +} + +CALLBACK_FUNC_DECL(InspectorBackendIdForNode) +{ + INC_STATS("InspectorBackend.idForNode()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); + if (node) + return v8::Number::New(inspectorBackend->idForNode(node)); + return v8::Undefined(); +} + +CALLBACK_FUNC_DECL(InspectorBackendWrapObject) +{ + INC_STATS("InspectorBackend.wrapObject()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + return inspectorBackend->wrapObject(ScriptValue(args[0])).v8Value(); +} + +CALLBACK_FUNC_DECL(InspectorBackendUnwrapObject) +{ + INC_STATS("InspectorBackend.unwrapObject()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + return inspectorBackend->unwrapObject(toWebCoreStringWithNullCheck(args[0])).v8Value(); +} + +CALLBACK_FUNC_DECL(InspectorBackendPushNodePathToFrontend) +{ + INC_STATS("InspectorBackend.pushNodePathToFrontend()"); + if (args.Length() < 2) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Node* node = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[0])); + bool selectInUI = args[1]->ToBoolean()->Value(); + if (node) + return v8::Number::New(inspectorBackend->pushNodePathToFrontend(node, selectInUI)); + + return v8::Undefined(); +} + +#if ENABLE(DATABASE) +CALLBACK_FUNC_DECL(InspectorBackendSelectDatabase) +{ + INC_STATS("InspectorBackend.selectDatabase()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Database* database = V8DOMWrapper::convertToNativeObject<Database>(V8ClassIndex::DATABASE, v8::Handle<v8::Object>::Cast(args[0])); + if (database) + inspectorBackend->selectDatabase(database); + + return v8::Undefined(); +} +#endif + +#if ENABLE(DOM_STORAGE) +CALLBACK_FUNC_DECL(InspectorBackendSelectDOMStorage) +{ + INC_STATS("InspectorBackend.selectDOMStorage()"); + if (args.Length() < 1) + return v8::Undefined(); + + InspectorBackend* inspectorBackend = V8DOMWrapper::convertToNativeObject<InspectorBackend>(V8ClassIndex::INSPECTORBACKEND, args.Holder()); + Storage* storage = V8DOMWrapper::convertToNativeObject<Storage>(V8ClassIndex::STORAGE, v8::Handle<v8::Object>::Cast(args[0])); + if (storage) + inspectorBackend->selectDOMStorage(storage); + + return v8::Undefined(); +} +#endif + } // namespace WebCore diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm index c9af8b0..eb4a6bd 100644 --- a/WebCore/bridge/jni/jni_jsobject.mm +++ b/WebCore/bridge/jni/jni_jsobject.mm @@ -29,19 +29,18 @@ #if ENABLE(MAC_JAVA_BRIDGE) #include "Frame.h" +#include "ScriptController.h" +#include "StringSourceProvider.h" #include "WebCoreFrameView.h" #include "jni_runtime.h" #include "jni_utility.h" -#include "ScriptController.h" #include "runtime_object.h" #include "runtime_root.h" #include <interpreter/CallFrame.h> +#include <runtime/Completion.h> #include <runtime/JSGlobalObject.h> #include <runtime/JSLock.h> -#include <runtime/Completion.h> -#include <runtime/Completion.h> #include <wtf/Assertions.h> -#include <parser/SourceProvider.h> using WebCore::Frame; diff --git a/WebCore/bridge/npapi.h b/WebCore/bridge/npapi.h index 126d513..5991f5b 100644 --- a/WebCore/bridge/npapi.h +++ b/WebCore/bridge/npapi.h @@ -114,6 +114,14 @@ /* Definition of Basic Types */ /*----------------------------------------------------------------------*/ +/* QNX sets the _INT16 and friends defines, but does not typedef the types */ +#ifdef __QNXNTO__ +#undef _UINT16 +#undef _INT16 +#undef _UINT32 +#undef _INT32 +#endif + #ifndef _UINT16 #define _UINT16 typedef unsigned short uint16; diff --git a/WebCore/bridge/objc/objc_runtime.mm b/WebCore/bridge/objc/objc_runtime.mm index 2d69c1c..67bd2a3 100644 --- a/WebCore/bridge/objc/objc_runtime.mm +++ b/WebCore/bridge/objc/objc_runtime.mm @@ -209,7 +209,7 @@ void ObjcFallbackObjectImp::put(ExecState*, const Identifier&, JSValue, PutPrope static JSValue JSC_HOST_CALL callObjCFallbackObject(ExecState* exec, JSObject* function, JSValue thisValue, const ArgList& args) { - if (!thisValue.isObject(&RuntimeObjectImp::s_info)) + if (!thisValue.inherits(&RuntimeObjectImp::s_info)) return throwError(exec, TypeError); JSValue result = jsUndefined(); diff --git a/WebCore/bridge/qt/qt_instance.cpp b/WebCore/bridge/qt/qt_instance.cpp index 506697a..58280e3 100644 --- a/WebCore/bridge/qt/qt_instance.cpp +++ b/WebCore/bridge/qt/qt_instance.cpp @@ -56,12 +56,12 @@ public: static const ClassInfo s_info; - virtual void mark() + virtual void markChildren(MarkStack& markStack) { + RuntimeObjectImp::markChildren(markStack); QtInstance* instance = static_cast<QtInstance*>(getInternalInstance()); if (instance) - instance->mark(); - RuntimeObjectImp::mark(); + instance->markAggregate(markStack); } protected: @@ -202,13 +202,13 @@ RuntimeObjectImp* QtInstance::createRuntimeObject(ExecState* exec) return ret; } -void QtInstance::mark() +void QtInstance::markAggregate(MarkStack& markStack) { - if (m_defaultMethod && !m_defaultMethod->marked()) - m_defaultMethod->mark(); + if (m_defaultMethod) + markStack.append(m_defaultMethod); foreach(JSObject* val, m_methods.values()) { - if (val && !val->marked()) - val->mark(); + if (val) + markStack.append(val); } } diff --git a/WebCore/bridge/qt/qt_instance.h b/WebCore/bridge/qt/qt_instance.h index 23766b1..c276b29 100644 --- a/WebCore/bridge/qt/qt_instance.h +++ b/WebCore/bridge/qt/qt_instance.h @@ -48,7 +48,7 @@ public: virtual JSValue valueOf(ExecState*) const; virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const; - virtual void mark(); // This isn't inherited + void markAggregate(MarkStack&); virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList&); diff --git a/WebCore/bridge/qt/qt_runtime.cpp b/WebCore/bridge/qt/qt_runtime.cpp index 6be119c..1590417 100644 --- a/WebCore/bridge/qt/qt_runtime.cpp +++ b/WebCore/bridge/qt/qt_runtime.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "qt_runtime.h" +#include "BooleanObject.h" #include "DateInstance.h" #include "DateMath.h" #include "DatePrototype.h" @@ -46,9 +47,9 @@ #include <JSFunction.h> #include <limits.h> #include <runtime.h> +#include <runtime/Error.h> #include <runtime_array.h> #include <runtime_object.h> -#include "BooleanObject.h" // QtScript has these Q_DECLARE_METATYPE(QObjectList); @@ -1328,14 +1329,14 @@ QtRuntimeMetaMethod::QtRuntimeMetaMethod(ExecState* exec, const Identifier& iden d->m_allowPrivate = allowPrivate; } -void QtRuntimeMetaMethod::mark() +void QtRuntimeMetaMethod::markChildren(MarkStack& markStack) { - QtRuntimeMethod::mark(); + QtRuntimeMethod::markChildren(markStack); QW_D(QtRuntimeMetaMethod); if (d->m_connect) - d->m_connect->mark(); + markStack.append(d->m_connect); if (d->m_disconnect) - d->m_disconnect->mark(); + markStack.append(d->m_disconnect); } JSValue QtRuntimeMetaMethod::call(ExecState* exec, JSObject* functionObject, JSValue thisValue, const ArgList& args) diff --git a/WebCore/bridge/qt/qt_runtime.h b/WebCore/bridge/qt/qt_runtime.h index 72d93eb..edb577c 100644 --- a/WebCore/bridge/qt/qt_runtime.h +++ b/WebCore/bridge/qt/qt_runtime.h @@ -167,7 +167,7 @@ public: virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&); - virtual void mark(); + virtual void markChildren(MarkStack& markStack); protected: QtRuntimeMetaMethodData* d_func() const {return reinterpret_cast<QtRuntimeMetaMethodData*>(d_ptr);} diff --git a/WebCore/bridge/runtime_method.cpp b/WebCore/bridge/runtime_method.cpp index 0af0af5..15ea582 100644 --- a/WebCore/bridge/runtime_method.cpp +++ b/WebCore/bridge/runtime_method.cpp @@ -82,13 +82,13 @@ static JSValue JSC_HOST_CALL callRuntimeMethod(ExecState* exec, JSObject* functi RuntimeObjectImp* imp; - if (thisValue.isObject(&RuntimeObjectImp::s_info)) { + if (thisValue.inherits(&RuntimeObjectImp::s_info)) { imp = static_cast<RuntimeObjectImp*>(asObject(thisValue)); } else { // If thisObj is the DOM object for a plugin, get the corresponding // runtime object from the DOM object. JSValue value = thisValue.get(exec, Identifier(exec, "__apple_runtime_object")); - if (value.isObject(&RuntimeObjectImp::s_info)) + if (value.inherits(&RuntimeObjectImp::s_info)) imp = static_cast<RuntimeObjectImp*>(asObject(value)); else return throwError(exec, TypeError); diff --git a/WebCore/css/CSSCanvasValue.cpp b/WebCore/css/CSSCanvasValue.cpp index cf8cb42..0c1c3f9 100644 --- a/WebCore/css/CSSCanvasValue.cpp +++ b/WebCore/css/CSSCanvasValue.cpp @@ -47,15 +47,15 @@ String CSSCanvasValue::cssText() const void CSSCanvasValue::canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) { IntRect imageChangeRect = enclosingIntRect(changedRect); - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this), &imageChangeRect); } void CSSCanvasValue::canvasResized(HTMLCanvasElement*) { - HashMap<RenderObject*, IntSize>::const_iterator end = m_clients.end(); - for (HashMap<RenderObject*, IntSize>::const_iterator curr = m_clients.begin(); curr != end; ++curr) + RenderObjectSizeCountMap::const_iterator end = m_clients.end(); + for (RenderObjectSizeCountMap::const_iterator curr = m_clients.begin(); curr != end; ++curr) curr->first->imageChanged(static_cast<WrappedImagePtr>(this)); } diff --git a/WebCore/css/CSSImageGeneratorValue.cpp b/WebCore/css/CSSImageGeneratorValue.cpp index 6e23d95..4cf0873 100644 --- a/WebCore/css/CSSImageGeneratorValue.cpp +++ b/WebCore/css/CSSImageGeneratorValue.cpp @@ -49,24 +49,42 @@ void CSSImageGeneratorValue::addClient(RenderObject* renderer, const IntSize& si ref(); if (!size.isEmpty()) m_sizes.add(size); - m_clients.add(renderer, size); + + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + if (it == m_clients.end()) + m_clients.add(renderer, SizeCountPair(size, 1)); + else { + SizeCountPair& sizeCount = it->second; + ++sizeCount.second; + } } void CSSImageGeneratorValue::removeClient(RenderObject* renderer) { - IntSize size = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize size = sizeCount.first; if (!size.isEmpty()) { m_sizes.remove(size); if (!m_sizes.contains(size)) m_images.remove(size); } - m_clients.remove(renderer); + + if (!--sizeCount.second) + m_clients.remove(renderer); + deref(); } Image* CSSImageGeneratorValue::getImage(RenderObject* renderer, const IntSize& size) { - IntSize oldSize = m_clients.get(renderer); + RenderObjectSizeCountMap::iterator it = m_clients.find(renderer); + ASSERT(it != m_clients.end()); + + SizeCountPair& sizeCount = it->second; + IntSize oldSize = sizeCount.first; if (oldSize != size) { removeClient(renderer); addClient(renderer, size); diff --git a/WebCore/css/CSSImageGeneratorValue.h b/WebCore/css/CSSImageGeneratorValue.h index 661fd37..c053bfe 100644 --- a/WebCore/css/CSSImageGeneratorValue.h +++ b/WebCore/css/CSSImageGeneratorValue.h @@ -57,8 +57,11 @@ protected: Image* getImage(RenderObject*, const IntSize&); void putImage(const IntSize&, PassRefPtr<Image>); + typedef pair<IntSize, int> SizeCountPair; + typedef HashMap<RenderObject*, SizeCountPair> RenderObjectSizeCountMap; + HashCountedSet<IntSize> m_sizes; // A count of how many times a given image size is in use. - HashMap<RenderObject*, IntSize> m_clients; // A map from RenderObjects to image sizes. + RenderObjectSizeCountMap m_clients; // A map from RenderObjects (with entry count) to image sizes. HashMap<IntSize, RefPtr<Image> > m_images; // A cache of Image objects by image size. RefPtr<StyleGeneratedImage> m_image; diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp index 50e60f4..adcfbb9 100644 --- a/WebCore/css/CSSImportRule.cpp +++ b/WebCore/css/CSSImportRule.cpp @@ -1,7 +1,7 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) * (C) 2002-2003 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2002, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2002, 2005, 2006, 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 @@ -26,6 +26,8 @@ #include "DocLoader.h" #include "Document.h" #include "MediaList.h" +#include "Settings.h" +#include <wtf/StdLibExtras.h> namespace WebCore { @@ -60,7 +62,20 @@ void CSSImportRule::setCSSStyleSheet(const String& url, const String& charset, c CSSStyleSheet* parent = parentStyleSheet(); bool strict = !parent || parent->useStrictParsing(); - m_styleSheet->parseString(sheet->sheetText(strict), strict); + String sheetText = sheet->sheetText(strict); + m_styleSheet->parseString(sheetText, strict); + + if (strict && parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks()) { + // Work around <https://bugs.webkit.org/show_bug.cgi?id=28350>. + DEFINE_STATIC_LOCAL(const String, slashKHTMLFixesDotCss, ("/KHTMLFixes.css")); + DEFINE_STATIC_LOCAL(const String, mediaWikiKHTMLFixesStyleSheet, ("/* KHTML fix stylesheet */\n/* work around the horizontal scrollbars */\n#column-content { margin-left: 0; }\n\n")); + if (url.endsWith(slashKHTMLFixesDotCss) && sheetText == mediaWikiKHTMLFixesStyleSheet) { + ASSERT(m_styleSheet->length() == 1); + ExceptionCode ec; + m_styleSheet->deleteRule(0, ec); + } + } + m_loading = false; if (parent) diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp index b79992f..b299fcf 100644 --- a/WebCore/css/CSSParser.cpp +++ b/WebCore/css/CSSParser.cpp @@ -4,6 +4,7 @@ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * Copyright (C) 2008 Eric Seidel <eric@webkit.org> + * 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 @@ -747,7 +748,11 @@ bool CSSParser::parseValue(int propId, bool important) // inline | block | list-item | run-in | inline-block | table | // inline-table | table-row-group | table-header-group | table-footer-group | table-row | // table-column-group | table-column | table-cell | table-caption | box | inline-box | none | inherit +#if ENABLE(WCSS) + if ((id >= CSSValueInline && id <= CSSValueWapMarquee) || id == CSSValueNone) +#else if ((id >= CSSValueInline && id <= CSSValueWebkitInlineBox) || id == CSSValueNone) +#endif valid_primitive = true; break; @@ -1313,6 +1318,28 @@ bool CSSParser::parseValue(int propId, bool important) else valid_primitive = validUnit(value, FTime|FInteger|FNonNeg, m_strict); break; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + if (id == CSSValueLtr || id == CSSValueRtl) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeStyle: + if (id == CSSValueNone || id == CSSValueSlide || id == CSSValueScroll || id == CSSValueAlternate) + valid_primitive = true; + break; + case CSSPropertyWapMarqueeLoop: + if (id == CSSValueInfinite) + valid_primitive = true; + else + valid_primitive = validUnit(value, FInteger | FNonNeg, m_strict); + break; + case CSSPropertyWapMarqueeSpeed: + if (id == CSSValueNormal || id == CSSValueSlow || id == CSSValueFast) + valid_primitive = true; + else + valid_primitive = validUnit(value, FTime | FInteger | FNonNeg, m_strict); + break; +#endif case CSSPropertyWebkitUserDrag: // auto | none | element if (id == CSSValueAuto || id == CSSValueNone || id == CSSValueElement) valid_primitive = true; diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp index 6343dac..1f2c9ca 100644 --- a/WebCore/css/CSSPrimitiveValue.cpp +++ b/WebCore/css/CSSPrimitiveValue.cpp @@ -643,7 +643,7 @@ Rect* CSSPrimitiveValue::getRectValue(ExceptionCode& ec) const return m_value.rect; } -RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const +PassRefPtr<RGBColor> CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const { ec = 0; if (m_type != CSS_RGBCOLOR) { @@ -652,7 +652,7 @@ RGBColor* CSSPrimitiveValue::getRGBColorValue(ExceptionCode& ec) const } // FIMXE: This should not return a new object for each invocation. - return RGBColor::create(m_value.rgbcolor).releaseRef(); + return RGBColor::create(m_value.rgbcolor); } Pair* CSSPrimitiveValue::getPairValue(ExceptionCode& ec) const diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h index 85a0ba3..d417619 100644 --- a/WebCore/css/CSSPrimitiveValue.h +++ b/WebCore/css/CSSPrimitiveValue.h @@ -152,7 +152,7 @@ public: Rect* getRectValue(ExceptionCode&) const; Rect* getRectValue() const { return m_type != CSS_RECT ? 0 : m_value.rect; } - RGBColor* getRGBColorValue(ExceptionCode&) const; + PassRefPtr<RGBColor> getRGBColorValue(ExceptionCode&) const; RGBA32 getRGBA32Value() const { return m_type != CSS_RGBCOLOR ? 0 : m_value.rgbcolor; } Pair* getPairValue(ExceptionCode&) const; diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h index 69cfbb1..be96407 100644 --- a/WebCore/css/CSSPrimitiveValueMappings.h +++ b/WebCore/css/CSSPrimitiveValueMappings.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2007 Alexey Proskuryakov <ap@nypop.com>. * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -522,6 +523,7 @@ template<> inline CSSPrimitiveValue::operator EBoxOrient() const case CSSValueInlineAxis: return HORIZONTAL; case CSSValueVertical: + case CSSValueBlockAxis: return VERTICAL; default: ASSERT_NOT_REACHED(); @@ -777,6 +779,11 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e) case TABLE_CAPTION: m_value.ident = CSSValueTableCaption; break; +#if ENABLE(WCSS) + case WAP_MARQUEE: + m_value.ident = CSSValueWapMarquee; + break; +#endif case BOX: m_value.ident = CSSValueWebkitBox; break; diff --git a/WebCore/css/CSSRuleList.idl b/WebCore/css/CSSRuleList.idl index 224d6a1..9add078 100644 --- a/WebCore/css/CSSRuleList.idl +++ b/WebCore/css/CSSRuleList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 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 @@ -27,6 +27,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, InterfaceUUID=64c346a0-1e34-49d3-9472-57ec8e0fdccb, diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp index 80910a7..25dbd87 100644 --- a/WebCore/css/CSSSelector.cpp +++ b/WebCore/css/CSSSelector.cpp @@ -77,6 +77,7 @@ void CSSSelector::extractPseudoType() const DEFINE_STATIC_LOCAL(AtomicString, before, ("before")); DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked")); DEFINE_STATIC_LOCAL(AtomicString, fileUploadButton, ("-webkit-file-upload-button")); + DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default")); DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled")); DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only")); DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write")); @@ -170,7 +171,9 @@ void CSSSelector::extractPseudoType() const else if (m_value == fileUploadButton) { m_pseudoType = PseudoFileUploadButton; element = true; - } else if (m_value == disabled) + } else if (m_value == defaultString) + m_pseudoType = PseudoDefault; + else if (m_value == disabled) m_pseudoType = PseudoDisabled; else if (m_value == readOnly) m_pseudoType = PseudoReadOnly; diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h index 18251fd..53de50d 100644 --- a/WebCore/css/CSSSelector.h +++ b/WebCore/css/CSSSelector.h @@ -126,6 +126,7 @@ namespace WebCore { PseudoChecked, PseudoEnabled, PseudoFullPageMedia, + PseudoDefault, PseudoDisabled, PseudoInputPlaceholder, PseudoOptional, diff --git a/WebCore/css/CSSStyleDeclaration.idl b/WebCore/css/CSSStyleDeclaration.idl index f7ce37f..3e37418 100644 --- a/WebCore/css/CSSStyleDeclaration.idl +++ b/WebCore/css/CSSStyleDeclaration.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module css { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, DelegatingPutFunction, HasNameGetter, diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp index 9074476..2f7d900 100644 --- a/WebCore/css/CSSStyleSelector.cpp +++ b/WebCore/css/CSSStyleSelector.cpp @@ -995,6 +995,9 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n) if (s->isEnabledFormControl() != m_element->isEnabledFormControl()) return false; + + if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm()) + return false; } if (style->transitions() || style->animations()) @@ -2358,6 +2361,8 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme case CSSSelector::PseudoFullPageMedia: return e && e->document() && e->document()->isMediaDocument(); break; + case CSSSelector::PseudoDefault: + return e && e->isDefaultButtonForForm(); case CSSSelector::PseudoDisabled: if (e && e->isFormControlElement()) { InputElement* inputElement = toInputElement(e); @@ -2991,6 +2996,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; case CSSPropertyDisplay: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display) +#if ENABLE(WCSS) + if (primitiveValue) { + if (primitiveValue->getIdent() == CSSValueWapMarquee) { + // Initialize Wap Marquee style + m_style->setOverflowX(OMARQUEE); + m_style->setOverflowY(OMARQUEE); + m_style->setWhiteSpace(NOWRAP); + m_style->setMarqueeDirection(MLEFT); + m_style->setMarqueeSpeed(85); // Normal speed + m_style->setMarqueeLoopCount(1); + m_style->setMarqueeBehavior(MSCROLL); + + if (m_parentStyle) + m_style->setDisplay(m_parentStyle->display()); + else + m_style->setDisplay(*primitiveValue); + } else + m_style->setDisplay(*primitiveValue); + } +#endif return; case CSSPropertyEmptyCells: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells) @@ -3754,7 +3779,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) { FontDescription fontDescription = m_style->fontDescription(); fontDescription.setKeywordSize(0); - bool familyIsFixed = fontDescription.genericFamily() == FontDescription::MonospaceFamily; float oldSize = 0; float size = 0; @@ -3769,7 +3793,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_parentNode) fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize()); } else if (isInitial) { - size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); } else if (primitiveValue->getIdent()) { // Keywords are being used. @@ -3782,7 +3806,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) case CSSValueXLarge: case CSSValueXxLarge: case CSSValueWebkitXxxLarge: - size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), familyIsFixed); + size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize()); fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1); break; case CSSValueLarger: @@ -4025,13 +4049,12 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) if (m_style->setFontDescription(fontDescription)) m_fontDirty = true; return; - } - else if (isInitial) { + } else if (isInitial) { FontDescription initialDesc = FontDescription(); FontDescription fontDescription = m_style->fontDescription(); // We need to adjust the size to account for the generic family change from monospace // to non-monospace. - if (fontDescription.keywordSize() && fontDescription.genericFamily() == FontDescription::MonospaceFamily) + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize()) setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false)); fontDescription.setGenericFamily(initialDesc.genericFamily()); if (!initialDesc.firstFamily().familyIsEmpty()) @@ -4041,21 +4064,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) return; } - if (!value->isValueList()) return; + if (!value->isValueList()) + return; FontDescription fontDescription = m_style->fontDescription(); - CSSValueList *list = static_cast<CSSValueList*>(value); + CSSValueList* list = static_cast<CSSValueList*>(value); int len = list->length(); FontFamily& firstFamily = fontDescription.firstFamily(); - FontFamily *currFamily = 0; + FontFamily* currFamily = 0; // Before mapping in a new font-family property, we should reset the generic family. - bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily; + bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize(); fontDescription.setGenericFamily(FontDescription::NoFamily); for (int i = 0; i < len; i++) { - CSSValue *item = list->itemWithoutBoundsCheck(i); - if (!item->isPrimitiveValue()) continue; - CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item); + CSSValue* item = list->itemWithoutBoundsCheck(i); + if (!item->isPrimitiveValue()) + continue; + CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item); AtomicString face; Settings* settings = m_checker.m_document->settings(); if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING) @@ -4087,28 +4112,32 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) break; } } - + if (!face.isEmpty()) { if (!currFamily) { // Filling in the first family. firstFamily.setFamily(face); + firstFamily.appendFamily(0); // Remove any inherited family-fallback list. currFamily = &firstFamily; - } - else { + } else { RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create(); newFamily->setFamily(face); currFamily->appendFamily(newFamily); currFamily = newFamily.get(); } - - if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace) - setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace)); - - if (m_style->setFontDescription(fontDescription)) - m_fontDirty = true; } } - return; + + // We can't call useFixedDefaultSize() until all new font families have been added + // If currFamily is non-zero then we set at least one family on this description. + if (currFamily) { + if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize) + setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize)); + + if (m_style->setFontDescription(fontDescription)) + m_fontDirty = true; + } + return; } case CSSPropertyTextDecoration: { // list of ident @@ -4742,6 +4771,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount()); m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior()); return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeLoop: +#endif case CSSPropertyWebkitMarqueeRepetition: { HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount) if (!primitiveValue) @@ -4752,6 +4784,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) m_style->setMarqueeLoopCount(primitiveValue->getIntValue()); return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeSpeed: +#endif case CSSPropertyWebkitMarqueeSpeed: { HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed) if (!primitiveValue) @@ -4802,9 +4837,30 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value) } return; } +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeStyle: +#endif case CSSPropertyWebkitMarqueeStyle: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior) return; +#if ENABLE(WCSS) + case CSSPropertyWapMarqueeDir: + HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection) + if (primitiveValue && primitiveValue->getIdent()) { + switch (primitiveValue->getIdent()) { + case CSSValueLtr: + m_style->setMarqueeDirection(MRIGHT); + break; + case CSSValueRtl: + m_style->setMarqueeDirection(MLEFT); + break; + default: + m_style->setMarqueeDirection(*primitiveValue); + break; + } + } + return; +#endif case CSSPropertyWebkitMarqueeDirection: HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection) return; @@ -5587,8 +5643,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty return; const FontDescription& parentFont = parentStyle->fontDescription(); - - if (childFont.genericFamily() == parentFont.genericFamily()) + if (childFont.useFixedDefaultSize() == parentFont.useFixedDefaultSize()) return; // For now, lump all families but monospace together. @@ -5601,17 +5656,16 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty // If the font uses a keyword size, then we refetch from the table rather than // multiplying by our scale factor. float size; - if (childFont.keywordSize()) { - size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), - childFont.genericFamily() == FontDescription::MonospaceFamily); - } else { + if (childFont.keywordSize()) + size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize()); + else { Settings* settings = m_checker.m_document->settings(); float fixedScaleFactor = settings ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize() : 1; - size = (parentFont.genericFamily() == FontDescription::MonospaceFamily) ? - childFont.specifiedSize()/fixedScaleFactor : - childFont.specifiedSize()*fixedScaleFactor; + size = parentFont.useFixedDefaultSize() ? + childFont.specifiedSize() / fixedScaleFactor : + childFont.specifiedSize() * fixedScaleFactor; } FontDescription newFontDescription(childFont); diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in index c0b52f2..621276b 100644 --- a/WebCore/css/CSSValueKeywords.in +++ b/WebCore/css/CSSValueKeywords.in @@ -260,6 +260,7 @@ table-cell table-caption -webkit-box -webkit-inline-box +-wap-marquee #none # # CSS_PROP_CURSOR: diff --git a/WebCore/css/StyleSheetList.idl b/WebCore/css/StyleSheetList.idl index 2abd22f..574d749 100644 --- a/WebCore/css/StyleSheetList.idl +++ b/WebCore/css/StyleSheetList.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -22,6 +22,7 @@ module stylesheets { // Introduced in DOM Level 2: interface [ + CustomMarkFunction, GenerateConstructor, HasIndexGetter, HasNameGetter, diff --git a/WebCore/css/WCSSPropertyNames.in b/WebCore/css/WCSSPropertyNames.in new file mode 100644 index 0000000..704209f --- /dev/null +++ b/WebCore/css/WCSSPropertyNames.in @@ -0,0 +1,4 @@ +-wap-marquee-dir +-wap-marquee-loop +-wap-marquee-speed +-wap-marquee-style diff --git a/WebCore/css/WCSSValueKeywords.in b/WebCore/css/WCSSValueKeywords.in new file mode 100644 index 0000000..00657ba --- /dev/null +++ b/WebCore/css/WCSSValueKeywords.in @@ -0,0 +1 @@ +# place holder for all WCSS specific CSS value keywords diff --git a/WebCore/css/html.css b/WebCore/css/html.css index 6b03390..3d0b667 100644 --- a/WebCore/css/html.css +++ b/WebCore/css/html.css @@ -483,6 +483,10 @@ select[size="1"] { white-space: pre; } +datalist { + display: none; +} + optgroup { font-weight: bolder; } diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp index 435c1af..aa5916b 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 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 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 @@ -30,10 +30,10 @@ namespace WebCore { -Attr::Attr(Element* element, Document* docPtr, PassRefPtr<Attribute> a) - : ContainerNode(docPtr) +inline Attr::Attr(Element* element, Document* document, PassRefPtr<Attribute> attribute) + : ContainerNode(document) , m_element(element) - , m_attribute(a) + , m_attribute(attribute) , m_ignoreChildrenChanged(0) , m_specified(true) { @@ -41,6 +41,13 @@ Attr::Attr(Element* element, Document* docPtr, PassRefPtr<Attribute> a) m_attribute->m_impl = this; } +PassRefPtr<Attr> Attr::create(Element* element, Document* document, PassRefPtr<Attribute> attribute) +{ + RefPtr<Attr> attr = adoptRef(new Attr(element, document, attribute)); + attr->createTextChild(); + return attr.release(); +} + Attr::~Attr() { ASSERT(m_attribute->attr() == this); @@ -86,14 +93,14 @@ const AtomicString& Attr::prefix() const return m_attribute->prefix(); } -void Attr::setPrefix(const AtomicString &_prefix, ExceptionCode& ec) +void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec) { ec = 0; - checkSetPrefix(_prefix, ec); + checkSetPrefix(prefix, ec); if (ec) return; - m_attribute->setPrefix(_prefix); + m_attribute->setPrefix(prefix); } String Attr::nodeValue() const @@ -101,11 +108,11 @@ String Attr::nodeValue() const return value(); } -void Attr::setValue(const String& v, ExceptionCode&) +void Attr::setValue(const AtomicString& value, ExceptionCode&) { m_ignoreChildrenChanged++; removeChildren(); - m_attribute->setValue(v.impl()); + m_attribute->setValue(value); createTextChild(); m_ignoreChildrenChanged--; @@ -120,7 +127,7 @@ void Attr::setNodeValue(const String& v, ExceptionCode& ec) PassRefPtr<Node> Attr::cloneNode(bool /*deep*/) { - RefPtr<Attr> clone = new Attr(0, document(), m_attribute->clone()); + RefPtr<Attr> clone = adoptRef(new Attr(0, document(), m_attribute->clone())); cloneChildNodes(clone.get()); return clone.release(); } diff --git a/WebCore/dom/Attr.h b/WebCore/dom/Attr.h index ed4dc07..e927a6e 100644 --- a/WebCore/dom/Attr.h +++ b/WebCore/dom/Attr.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 Apple Inc. All rights reserved. + * 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 @@ -39,48 +39,47 @@ namespace WebCore { class Attr : public ContainerNode { friend class NamedNodeMap; public: - Attr(Element*, Document*, PassRefPtr<Attribute>); - ~Attr(); + static PassRefPtr<Attr> create(Element*, Document*, PassRefPtr<Attribute>); + virtual ~Attr(); - // Call this after calling the constructor so the - // Attr node isn't floating when we append the text node. - void createTextChild(); - - // DOM methods & attributes for Attr String name() const { return qualifiedName().toString(); } bool specified() const { return m_specified; } Element* ownerElement() const { return m_element; } - String value() const { return m_attribute->value(); } - void setValue(const String&, ExceptionCode&); + const AtomicString& value() const { return m_attribute->value(); } + void setValue(const AtomicString&, ExceptionCode&); + + Attribute* attr() const { return m_attribute.get(); } + const QualifiedName& qualifiedName() const { return m_attribute->name(); } + + // An extension to get presentational information for attributes. + CSSStyleDeclaration* style() { return m_attribute->style(); } + + void setSpecified(bool specified) { m_specified = specified; } + +private: + Attr(Element*, Document*, PassRefPtr<Attribute>); + + void createTextChild(); - // DOM methods overridden from parent classes virtual String nodeName() const; virtual NodeType nodeType() const; + const AtomicString& localName() const; const AtomicString& namespaceURI() const; const AtomicString& prefix() const; + virtual void setPrefix(const AtomicString&, ExceptionCode&); virtual String nodeValue() const; virtual void setNodeValue(const String&, ExceptionCode&); virtual PassRefPtr<Node> cloneNode(bool deep); - // Other methods (not part of DOM) virtual bool isAttributeNode() const { return true; } virtual bool childTypeAllowed(NodeType); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - Attribute* attr() const { return m_attribute.get(); } - const QualifiedName& qualifiedName() const { return m_attribute->name(); } - - // An extension to get presentational information for attributes. - CSSStyleDeclaration* style() { return m_attribute->style(); } - - void setSpecified(bool specified) { m_specified = specified; } - -private: virtual const AtomicString& virtualPrefix() const { return prefix(); } virtual const AtomicString& virtualLocalName() const { return localName(); } virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); } diff --git a/WebCore/dom/Attribute.cpp b/WebCore/dom/Attribute.cpp index 048ac6a..0ab0bb6 100644 --- a/WebCore/dom/Attribute.cpp +++ b/WebCore/dom/Attribute.cpp @@ -37,10 +37,8 @@ PassRefPtr<Attribute> Attribute::clone() const PassRefPtr<Attr> Attribute::createAttrIfNeeded(Element* e) { RefPtr<Attr> r = m_impl; - if (!r) { - r = new Attr(e, e->document(), this); - r->createTextChild(); - } + if (!r) + r = Attr::create(e, e->document(), this); return r.release(); } diff --git a/WebCore/dom/CDATASection.cpp b/WebCore/dom/CDATASection.cpp index 72faa70..d73054e 100644 --- a/WebCore/dom/CDATASection.cpp +++ b/WebCore/dom/CDATASection.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2008 Apple Inc. All rights reserved. + * 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 @@ -26,13 +26,14 @@ namespace WebCore { -CDATASection::CDATASection(Document* document, const String& text) - : Text(document, text) +inline CDATASection::CDATASection(Document* document, const String& data) + : Text(document, data) { } -CDATASection::~CDATASection() +PassRefPtr<CDATASection> CDATASection::create(Document* document, const String& data) { + return adoptRef(new CDATASection(document, data)); } String CDATASection::nodeName() const @@ -47,19 +48,17 @@ Node::NodeType CDATASection::nodeType() const PassRefPtr<Node> CDATASection::cloneNode(bool /*deep*/) { - return new CDATASection(document(), m_data); + return create(document(), data()); } -// DOM Section 1.1.1 bool CDATASection::childTypeAllowed(NodeType) { return false; } -PassRefPtr<Text> CDATASection::createNew(PassRefPtr<StringImpl> string) +PassRefPtr<Text> CDATASection::virtualCreate(const String& data) { - return new CDATASection(document(), string); + return create(document(), data); } - } // namespace WebCore diff --git a/WebCore/dom/CDATASection.h b/WebCore/dom/CDATASection.h index 8b7df9d..5cf07e1 100644 --- a/WebCore/dom/CDATASection.h +++ b/WebCore/dom/CDATASection.h @@ -1,9 +1,7 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,16 +29,16 @@ namespace WebCore { class CDATASection : public Text { public: + static PassRefPtr<CDATASection> create(Document*, const String&); + +private: CDATASection(Document*, const String&); - virtual ~CDATASection(); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool childTypeAllowed(NodeType); - -protected: - virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>); + virtual PassRefPtr<Text> virtualCreate(const String&); }; } // namespace WebCore diff --git a/WebCore/dom/CharacterData.cpp b/WebCore/dom/CharacterData.cpp index 9a72de9..902b7ff 100644 --- a/WebCore/dom/CharacterData.cpp +++ b/WebCore/dom/CharacterData.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -30,20 +30,11 @@ namespace WebCore { -CharacterData::CharacterData(Document *doc, bool isText) - : Node(doc, false, false, isText) - , m_data(StringImpl::empty()) -{ -} - -CharacterData::CharacterData(Document* document, const String& text, bool isText) - : Node(document, false, false, isText) -{ - m_data = text.impl() ? text.impl() : StringImpl::empty(); -} - -CharacterData::~CharacterData() +CharacterData::CharacterData(Document* document, const String& text, ConstructionType type) + : Node(document, type) + , m_data(text.impl() ? text.impl() : StringImpl::empty()) { + ASSERT(type == CreateOther || type == CreateText); } void CharacterData::setData(const String& data, ExceptionCode&) diff --git a/WebCore/dom/CharacterData.h b/WebCore/dom/CharacterData.h index d9e55c0..6c31933 100644 --- a/WebCore/dom/CharacterData.h +++ b/WebCore/dom/CharacterData.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2004, 2005, 2006, 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 @@ -29,12 +29,6 @@ namespace WebCore { class CharacterData : public Node { public: - CharacterData(Document*, const String& text, bool isText = false); - CharacterData(Document*, bool isText = false); - virtual ~CharacterData(); - - // DOM methods & attributes for CharacterData - String data() const { return m_data; } void setData(const String&, ExceptionCode&); unsigned length() const { return m_data->length(); } @@ -42,31 +36,30 @@ public: void appendData(const String&, ExceptionCode&); void insertData(unsigned offset, const String&, ExceptionCode&); void deleteData(unsigned offset, unsigned count, ExceptionCode&); - void replaceData(unsigned offset, unsigned count, const String &arg, ExceptionCode&); + void replaceData(unsigned offset, unsigned count, const String&, ExceptionCode&); bool containsOnlyWhitespace() const; - // DOM methods overridden from parent classes - - virtual String nodeValue() const; - virtual void setNodeValue(const String&, ExceptionCode&); - - // Other methods (not part of DOM) + StringImpl* dataImpl() { return m_data.get(); } - virtual bool isCharacterDataNode() const { return true; } - virtual int maxCharacterOffset() const; - StringImpl* string() { return m_data.get(); } +protected: + CharacterData(Document*, const String&, ConstructionType); - virtual bool offsetInCharacters() const; virtual bool rendererIsNeeded(RenderStyle*); -protected: - RefPtr<StringImpl> m_data; - + void setDataImpl(PassRefPtr<StringImpl> impl) { m_data = impl; } void dispatchModifiedEvent(StringImpl* oldValue); private: + virtual String nodeValue() const; + virtual void setNodeValue(const String&, ExceptionCode&); + virtual bool isCharacterDataNode() const { return true; } + virtual int maxCharacterOffset() const; + virtual bool offsetInCharacters() const; + void checkCharDataOperation(unsigned offset, ExceptionCode&); + + RefPtr<StringImpl> m_data; }; } // namespace WebCore diff --git a/WebCore/dom/Comment.cpp b/WebCore/dom/Comment.cpp index a36a491..3dcde38 100644 --- a/WebCore/dom/Comment.cpp +++ b/WebCore/dom/Comment.cpp @@ -1,9 +1,7 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -24,22 +22,16 @@ #include "config.h" #include "Comment.h" -#include "Document.h" - namespace WebCore { -Comment::Comment(Document* doc, const String& text) - : CharacterData(doc, text) -{ -} - -Comment::Comment(Document* doc) - : CharacterData(doc) +inline Comment::Comment(Document* document, const String& text) + : CharacterData(document, text, CreateOther) { } -Comment::~Comment() +PassRefPtr<Comment> Comment::create(Document* document, const String& text) { + return adoptRef(new Comment(document, text)); } String Comment::nodeName() const @@ -54,10 +46,9 @@ Node::NodeType Comment::nodeType() const PassRefPtr<Node> Comment::cloneNode(bool /*deep*/) { - return document()->createComment(m_data); + return create(document(), data()); } -// DOM Section 1.1.1 bool Comment::childTypeAllowed(NodeType) { return false; diff --git a/WebCore/dom/Comment.h b/WebCore/dom/Comment.h index d00ba62..680ffae 100644 --- a/WebCore/dom/Comment.h +++ b/WebCore/dom/Comment.h @@ -1,9 +1,7 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,16 +29,14 @@ namespace WebCore { class Comment : public CharacterData { public: - Comment(Document*, const String &_text); - Comment(Document*); - virtual ~Comment(); + static PassRefPtr<Comment> create(Document*, const String&); + +private: + Comment(Document*, const String&); - // DOM methods overridden from parent classes virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); - - // Other methods (not part of DOM) virtual bool isCommentNode() const { return true; } virtual bool childTypeAllowed(NodeType); }; diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 2d79156..569756c 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -869,16 +869,16 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) ASSERT(!eventDispatchForbidden()); RefPtr<Node> c = child; - DocPtr<Document> doc = child->document(); + RefPtr<Document> document = child->document(); if (c->parentNode() && c->parentNode()->inDocument()) c->insertedIntoDocument(); else c->insertedIntoTree(true); - doc->incDOMTreeVersion(); + document->incDOMTreeVersion(); - if (c->parentNode() && doc->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) { + if (c->parentNode() && document->hasListenerType(Document::DOMNODEINSERTED_LISTENER)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeInsertedEvent, true, c->parentNode(), String(), String(), ec); if (ec) @@ -886,27 +886,28 @@ static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec) } // dispatch the DOMNodeInsertedIntoDocument event to all descendants - if (c->inDocument() && doc->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) + if (c->inDocument() && document->hasListenerType(Document::DOMNODEINSERTEDINTODOCUMENT_LISTENER)) { for (; c; c = c->traverseNextNode(child)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeInsertedIntoDocumentEvent, false, 0, String(), String(), ec); if (ec) return; } + } } static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) { RefPtr<Node> c = child; - DocPtr<Document> doc = child->document(); + RefPtr<Document> document = child->document(); // update auxiliary doc info (e.g. iterators) to note that node is being removed - doc->nodeWillBeRemoved(child); + document->nodeWillBeRemoved(child); - doc->incDOMTreeVersion(); + document->incDOMTreeVersion(); // dispatch pre-removal mutation events - if (c->parentNode() && doc->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { + if (c->parentNode() && document->hasListenerType(Document::DOMNODEREMOVED_LISTENER)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeRemovedEvent, true, c->parentNode(), String(), String(), ec); if (ec) @@ -914,7 +915,7 @@ static void dispatchChildRemovalEvents(Node* child, ExceptionCode& ec) } // dispatch the DOMNodeRemovedFromDocument event to all descendants - if (c->inDocument() && doc->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) + if (c->inDocument() && document->hasListenerType(Document::DOMNODEREMOVEDFROMDOCUMENT_LISTENER)) for (; c; c = c->traverseNextNode(child)) { ec = 0; c->dispatchMutationEvent(eventNames().DOMNodeRemovedFromDocumentEvent, false, 0, String(), String(), ec); diff --git a/WebCore/dom/ContainerNode.h b/WebCore/dom/ContainerNode.h index 3ad932c..aa480a7 100644 --- a/WebCore/dom/ContainerNode.h +++ b/WebCore/dom/ContainerNode.h @@ -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, 2005, 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 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 @@ -38,7 +38,6 @@ namespace Private { class ContainerNode : public Node { public: - ContainerNode(Document*, bool isElement = false); virtual ~ContainerNode(); Node* firstChild() const { return m_firstChild; } @@ -74,6 +73,8 @@ public: void cloneChildNodes(ContainerNode* clone); protected: + ContainerNode(Document*, ConstructionType = CreateContainer); + static void queuePostAttachCallback(NodeCallback, Node*); void suspendPostAttachCallbacks(); void resumePostAttachCallbacks(); @@ -97,8 +98,8 @@ private: Node* m_lastChild; }; -inline ContainerNode::ContainerNode(Document* document, bool isElement) - : Node(document, isElement, true) +inline ContainerNode::ContainerNode(Document* document, ConstructionType type) + : Node(document, type) , m_firstChild(0) , m_lastChild(0) { diff --git a/WebCore/dom/DocPtr.h b/WebCore/dom/DocPtr.h deleted file mode 100644 index 8b50e8d..0000000 --- a/WebCore/dom/DocPtr.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file is part of the DOM implementation for KDE. - * Copyright (C) 2005, 2006 Apple Computer, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef DocPtr_h -#define DocPtr_h - -namespace WebCore { - -template <class T> class DocPtr { -public: - DocPtr() : m_ptr(0) {} - DocPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->selfOnlyRef(); } - DocPtr(const DocPtr &o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); } - ~DocPtr() { if (T *ptr = m_ptr) ptr->selfOnlyDeref(); } - - template <class U> DocPtr(const DocPtr<U> &o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->selfOnlyRef(); } - - void resetSkippingRef(T *o) { m_ptr = o; } - - T *get() const { return m_ptr; } - - T &operator*() const { return *m_ptr; } - T *operator->() const { return m_ptr; } - - bool operator!() const { return !m_ptr; } - - // this type conversion operator allows implicit conversion to - // bool but not to other integer types - - typedef T * (DocPtr::*UnspecifiedBoolType)() const; - operator UnspecifiedBoolType() const - { - return m_ptr ? &DocPtr::get : 0; - } - - DocPtr &operator=(const DocPtr &); - DocPtr &operator=(T *); - - private: - T *m_ptr; -}; - -template <class T> DocPtr<T> &DocPtr<T>::operator=(const DocPtr<T> &o) -{ - T *optr = o.m_ptr; - if (optr) - optr->selfOnlyRef(); - if (T *ptr = m_ptr) - ptr->selfOnlyDeref(); - m_ptr = optr; - return *this; -} - -template <class T> inline DocPtr<T> &DocPtr<T>::operator=(T *optr) -{ - if (optr) - optr->selfOnlyRef(); - if (T *ptr = m_ptr) - ptr->selfOnlyDeref(); - m_ptr = optr; - return *this; -} - -template <class T> inline bool operator==(const DocPtr<T> &a, const DocPtr<T> &b) -{ - return a.get() == b.get(); -} - -template <class T> inline bool operator==(const DocPtr<T> &a, const T *b) -{ - return a.get() == b; -} - -template <class T> inline bool operator==(const T *a, const DocPtr<T> &b) -{ - return a == b.get(); -} - -template <class T> inline bool operator!=(const DocPtr<T> &a, const DocPtr<T> &b) -{ - return a.get() != b.get(); -} - -template <class T> inline bool operator!=(const DocPtr<T> &a, const T *b) -{ - return a.get() != b; -} - -template <class T> inline bool operator!=(const T *a, const DocPtr<T> &b) -{ - return a != b.get(); -} - -} // namespace WebCore - -#endif // DocPtr_h diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 066cf46..644eb61 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -107,6 +107,7 @@ #include "SegmentedString.h" #include "SelectionController.h" #include "Settings.h" +#include "SharedWorkerRepository.h" #include "StyleSheetList.h" #include "TextEvent.h" #include "TextIterator.h" @@ -361,7 +362,7 @@ Document::Document(Frame* frame, bool isXHTML) , m_containsWMLContent(false) #endif { - m_document.resetSkippingRef(this); + m_document = this; m_printing = false; @@ -431,8 +432,7 @@ void Document::removedLastRef() // want the document to be destructed until after // removeAllChildren returns, so we guard ourselves with an // extra self-only ref. - - DocPtr<Document> guard(this); + selfOnlyRef(); // We must make sure not to be retaining any of our children through // these extra pointers or we will create a reference cycle. @@ -456,6 +456,8 @@ void Document::removedLastRef() #ifndef NDEBUG m_inRemovedLastRefFunction = false; #endif + + selfOnlyDeref(); } else { #ifndef NDEBUG m_deletionHasBegun = true; @@ -482,7 +484,7 @@ Document::~Document() #endif delete m_tokenizer; - m_document.resetSkippingRef(0); + m_document = 0; delete m_styleSelector; delete m_docLoader; @@ -518,8 +520,6 @@ Document::~Document() if (m_styleSheets) m_styleSheets->documentDestroyed(); - - m_document = 0; } void Document::resetLinkColor() @@ -589,17 +589,17 @@ PassRefPtr<Element> Document::createElement(const AtomicString& name, ExceptionC PassRefPtr<DocumentFragment> Document::createDocumentFragment() { - return new DocumentFragment(document()); + return DocumentFragment::create(document()); } PassRefPtr<Text> Document::createTextNode(const String& data) { - return new Text(this, data); + return Text::create(this, data); } PassRefPtr<Comment> Document::createComment(const String& data) { - return new Comment(this, data); + return Comment::create(this, data); } PassRefPtr<CDATASection> Document::createCDATASection(const String& data, ExceptionCode& ec) @@ -608,7 +608,7 @@ PassRefPtr<CDATASection> Document::createCDATASection(const String& data, Except ec = NOT_SUPPORTED_ERR; return 0; } - return new CDATASection(this, data); + return CDATASection::create(this, data); } PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const String& target, const String& data, ExceptionCode& ec) @@ -621,7 +621,7 @@ PassRefPtr<ProcessingInstruction> Document::createProcessingInstruction(const St ec = NOT_SUPPORTED_ERR; return 0; } - return new ProcessingInstruction(this, target, data); + return ProcessingInstruction::create(this, target, data); } PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ExceptionCode& ec) @@ -634,12 +634,12 @@ PassRefPtr<EntityReference> Document::createEntityReference(const String& name, ec = NOT_SUPPORTED_ERR; return 0; } - return new EntityReference(this, name); + return EntityReference::create(this, name); } PassRefPtr<EditingText> Document::createEditingTextNode(const String& text) { - return new EditingText(this, text); + return EditingText::create(this, text); } PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() @@ -704,11 +704,8 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo return newElement.release(); } - case ATTRIBUTE_NODE: { - RefPtr<Attr> newAttr = new Attr(0, this, static_cast<Attr*>(importedNode)->attr()->clone()); - newAttr->createTextChild(); - return newAttr.release(); - } + case ATTRIBUTE_NODE: + return Attr::create(0, this, static_cast<Attr*>(importedNode)->attr()->clone()); case DOCUMENT_FRAGMENT_NODE: { DocumentFragment* oldFragment = static_cast<DocumentFragment*>(importedNode); RefPtr<DocumentFragment> newFragment = createDocumentFragment(); @@ -1379,7 +1376,11 @@ void Document::detach() // Send out documentWillBecomeInactive() notifications to registered elements, // in order to stop media elements documentWillBecomeInactive(); - + +#if ENABLE(SHARED_WORKERS) + SharedWorkerRepository::documentDetached(this); +#endif + if (m_frame) { FrameView* view = m_frame->view(); if (view) @@ -1500,7 +1501,7 @@ AXObjectCache* Document::axObjectCache() const return doc->axObjectCache(); // this is the top-level document, so install a new cache - m_axObjectCache = new AXObjectCache; + m_axObjectCache = new AXObjectCache(this); return m_axObjectCache; #endif // ANDROID } @@ -2660,10 +2661,10 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) focusChangeBlocked = true; newFocusedNode = 0; } - if ((oldFocusedNode.get() == this) && oldFocusedNode->hasOneRef()) + if (oldFocusedNode == this && oldFocusedNode->hasOneRef()) return true; - if (oldFocusedNode.get() == oldFocusedNode->rootEditableElement()) + if (oldFocusedNode == oldFocusedNode->rootEditableElement()) frame()->editor()->didEndEditing(); } @@ -2692,7 +2693,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) } m_focusedNode->setFocus(); - if (m_focusedNode.get() == m_focusedNode->rootEditableElement()) + if (m_focusedNode == m_focusedNode->rootEditableElement()) frame()->editor()->didBeginEditing(); // eww, I suck. set the qt focus correctly @@ -2714,7 +2715,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) } } -#if PLATFORM(MAC) && !PLATFORM(CHROMIUM) +#if (PLATFORM(MAC) || PLATFORM(WIN)) && !PLATFORM(CHROMIUM) if (!focusChangeBlocked && m_focusedNode && AXObjectCache::accessibilityEnabled()) axObjectCache()->handleFocusedUIElementChanged(); #elif PLATFORM(GTK) @@ -2723,9 +2724,9 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode) RenderObject* newFocusedRenderer = 0; if (oldFocusedNode) - oldFocusedRenderer = oldFocusedNode.get()->renderer(); + oldFocusedRenderer = oldFocusedNode->renderer(); if (newFocusedNode) - newFocusedRenderer = newFocusedNode.get()->renderer(); + newFocusedRenderer = newFocusedNode->renderer(); axObjectCache()->handleFocusedUIElementChangedWithRenderers(oldFocusedRenderer, newFocusedRenderer); } @@ -3925,7 +3926,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S // FIXME: Assume this is a mapped attribute, since createAttribute isn't namespace-aware. There's no harm to XML // documents if we're wrong. - return new Attr(0, this, MappedAttribute::create(qName, StringImpl::empty())); + return Attr::create(0, this, MappedAttribute::create(qName, StringImpl::empty())); } #if ENABLE(SVG) diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index fc4dc7e..c18a864 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -172,19 +172,16 @@ class Document : public ContainerNode, public ScriptExecutionContext { public: static PassRefPtr<Document> create(Frame* frame) { - return new Document(frame, false); + return adoptRef(new Document(frame, false)); } static PassRefPtr<Document> createXHTML(Frame* frame) { - return new Document(frame, true); + return adoptRef(new Document(frame, true)); } virtual ~Document(); - virtual bool isDocument() const { return true; } - using ContainerNode::ref; using ContainerNode::deref; - virtual void removedLastRef(); // Nodes belonging to this document hold "self-only" references - // these are enough to keep the document from being destroyed, but @@ -214,7 +211,6 @@ public: DocumentType* doctype() const { return m_docType.get(); } DOMImplementation* implementation() const; - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); Element* documentElement() const { @@ -299,11 +295,6 @@ public: CollectionCache* nameCollectionInfo(CollectionType, const AtomicString& name); - // DOM methods overridden from parent classes - - virtual String nodeName() const; - virtual NodeType nodeType() const; - // Other methods (not part of DOM) virtual bool isHTMLDocument() const { return false; } virtual bool isImageDocument() const { return false; } @@ -455,9 +446,6 @@ public: virtual String userAgent(const KURL&) const; - // from cachedObjectClient - virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); - #if FRAME_LOADS_USER_STYLESHEET void setUserStyleSheet(const String& sheet); #endif @@ -474,10 +462,6 @@ public: enum ParseMode { Compat, AlmostStrict, Strict }; -private: - virtual void determineParseMode() {} - -public: void setParseMode(ParseMode m) { m_parseMode = m; } ParseMode parseMode() const { return m_parseMode; } @@ -506,11 +490,6 @@ public: MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const IntPoint&, const PlatformMouseEvent&); - virtual bool childTypeAllowed(NodeType); - virtual PassRefPtr<Node> cloneNode(bool deep); - - virtual bool canReplaceChild(Node* newChild, Node* oldChild); - StyleSheetList* styleSheets(); /* Newly proposed CSS3 mechanism for selecting alternate @@ -751,8 +730,6 @@ public: void setDocType(PassRefPtr<DocumentType>); - virtual void finishedParsing(); - #if ENABLE(XPATH) // XPathEvaluator methods PassRefPtr<XPathExpression> createExpression(const String& expression, @@ -799,7 +776,6 @@ public: HTMLCanvasElement* getCSSCanvasElement(const String& name); bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; } - void initDNSPrefetch(); void parseDNSPrefetchControlHeader(const String&); virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); @@ -808,10 +784,95 @@ public: virtual void scriptImported(unsigned long, const String&); virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously. + typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; + JSWrapperCache& wrapperCache() { return m_wrapperCache; } + + virtual void finishedParsing(); + + bool inPageCache() const { return m_inPageCache; } + void setInPageCache(bool flag); + + // Elements can register themselves for the "documentWillBecomeInactive()" and + // "documentDidBecomeActive()" callbacks + void registerForDocumentActivationCallbacks(Element*); + void unregisterForDocumentActivationCallbacks(Element*); + void documentWillBecomeInactive(); + void documentDidBecomeActive(); + + void registerForMediaVolumeCallbacks(Element*); + void unregisterForMediaVolumeCallbacks(Element*); + void mediaVolumeDidChange(); + + void setShouldCreateRenderers(bool); + bool shouldCreateRenderers(); + + void setDecoder(PassRefPtr<TextResourceDecoder>); + TextResourceDecoder* decoder() const { return m_decoder.get(); } + + String displayStringModifiedByEncoding(const String&) const; + PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; + void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; + + // Quirk for the benefit of Apple's Dictionary application. + void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } + bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; } + +#if ENABLE(DASHBOARD_SUPPORT) + void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; } + bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; } + bool hasDashboardRegions () const { return m_hasDashboardRegions; } + void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; } + const Vector<DashboardRegionValue>& dashboardRegions() const; + void setDashboardRegions(const Vector<DashboardRegionValue>&); +#endif + + void removeAllEventListeners(); + + void registerDisconnectedNodeWithEventListeners(Node*); + void unregisterDisconnectedNodeWithEventListeners(Node*); + + CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } + +#if ENABLE(SVG) + const SVGDocumentExtensions* svgExtensions(); + SVGDocumentExtensions* accessSVGExtensions(); +#endif + + void initSecurityContext(); + + // Explicitly override the security origin for this document. + // Note: It is dangerous to change the security origin of a document + // that already contains content. + void setSecurityOrigin(SecurityOrigin*); + + bool processingLoadEvent() const { return m_processingLoadEvent; } + +#if ENABLE(DATABASE) + void addOpenDatabase(Database*); + void removeOpenDatabase(Database*); + DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. + void setHasOpenDatabases() { m_hasOpenDatabases = true; } + bool hasOpenDatabases() { return m_hasOpenDatabases; } + void stopDatabases(); +#endif + + void setUsingGeolocation(bool f) { m_usingGeolocation = f; } + bool usingGeolocation() const { return m_usingGeolocation; }; + +#if ENABLE(WML) + void setContainsWMLContent(bool value) { m_containsWMLContent = value; } + bool containsWMLContent() const { return m_containsWMLContent; } + + void resetWMLPageState(); + void initializeWMLPageState(); +#endif + protected: Document(Frame*, bool isXHTML); - void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } + void setStyleSelector(CSSStyleSelector* styleSelector) { m_styleSelector = styleSelector; } + + void clearXMLVersion() { m_xmlVersion = String(); } #if ENABLE(TOUCH_EVENTS) // Android public: @@ -826,16 +887,38 @@ private: #endif // ENABLE(TOUCH_EVENTS) private: + virtual bool isDocument() const { return true; } + virtual void removedLastRef(); + virtual void determineParseMode() { } + + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + + virtual String nodeName() const; + virtual NodeType nodeType() const; + virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); + virtual bool childTypeAllowed(NodeType); + virtual PassRefPtr<Node> cloneNode(bool deep); + virtual bool canReplaceChild(Node* newChild, Node* oldChild); + virtual void refScriptExecutionContext() { ref(); } virtual void derefScriptExecutionContext() { deref(); } virtual const KURL& virtualURL() const; // Same as url(), but needed for ScriptExecutionContext to implement it without a performance loss for direct calls. virtual KURL virtualCompleteURL(const String&) const; // Same as completeURL() for the same reason as above. + void initDNSPrefetch(); + String encoding() const; void executeScriptSoonTimerFired(Timer<Document>*); + void updateTitle(); + void removeAllDisconnectedNodeEventListeners(); + void updateFocusAppearanceTimerFired(Timer<Document>*); + void updateBaseURL(); + + void cacheDocumentElement() const; + CSSStyleSelector* m_styleSelector; bool m_didCalculateStyleSelector; @@ -988,96 +1071,6 @@ private: bool m_shouldProcessNoScriptElement; #endif -public: - bool inPageCache() const { return m_inPageCache; } - void setInPageCache(bool flag); - - // Elements can register themselves for the "documentWillBecomeInactive()" and - // "documentDidBecomeActive()" callbacks - void registerForDocumentActivationCallbacks(Element*); - void unregisterForDocumentActivationCallbacks(Element*); - void documentWillBecomeInactive(); - void documentDidBecomeActive(); - - void registerForMediaVolumeCallbacks(Element*); - void unregisterForMediaVolumeCallbacks(Element*); - void mediaVolumeDidChange(); - - void setShouldCreateRenderers(bool); - bool shouldCreateRenderers(); - - void setDecoder(PassRefPtr<TextResourceDecoder>); - TextResourceDecoder* decoder() const { return m_decoder.get(); } - - String displayStringModifiedByEncoding(const String&) const; - PassRefPtr<StringImpl> displayStringModifiedByEncoding(PassRefPtr<StringImpl>) const; - void displayBufferModifiedByEncoding(UChar* buffer, unsigned len) const; - - // Quirk for the benefit of Apple's Dictionary application. - void setFrameElementsShouldIgnoreScrolling(bool ignore) { m_frameElementsShouldIgnoreScrolling = ignore; } - bool frameElementsShouldIgnoreScrolling() const { return m_frameElementsShouldIgnoreScrolling; } - -#if ENABLE(DASHBOARD_SUPPORT) - void setDashboardRegionsDirty(bool f) { m_dashboardRegionsDirty = f; } - bool dashboardRegionsDirty() const { return m_dashboardRegionsDirty; } - bool hasDashboardRegions () const { return m_hasDashboardRegions; } - void setHasDashboardRegions(bool f) { m_hasDashboardRegions = f; } - const Vector<DashboardRegionValue>& dashboardRegions() const; - void setDashboardRegions(const Vector<DashboardRegionValue>&); -#endif - - void removeAllEventListeners(); - - void registerDisconnectedNodeWithEventListeners(Node*); - void unregisterDisconnectedNodeWithEventListeners(Node*); - - CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; } - -#if ENABLE(SVG) - const SVGDocumentExtensions* svgExtensions(); - SVGDocumentExtensions* accessSVGExtensions(); -#endif - - void initSecurityContext(); - - // Explicitly override the security origin for this document. - // Note: It is dangerous to change the security origin of a document - // that already contains content. - void setSecurityOrigin(SecurityOrigin*); - - bool processingLoadEvent() const { return m_processingLoadEvent; } - -#if ENABLE(DATABASE) - void addOpenDatabase(Database*); - void removeOpenDatabase(Database*); - DatabaseThread* databaseThread(); // Creates the thread as needed, but not if it has been already terminated. - void setHasOpenDatabases() { m_hasOpenDatabases = true; } - bool hasOpenDatabases() { return m_hasOpenDatabases; } - void stopDatabases(); -#endif - - void setUsingGeolocation(bool f) { m_usingGeolocation = f; } - bool usingGeolocation() const { return m_usingGeolocation; }; - -#if ENABLE(WML) - void setContainsWMLContent(bool value) { m_containsWMLContent = value; } - bool containsWMLContent() const { return m_containsWMLContent; } - - void resetWMLPageState(); - void initializeWMLPageState(); -#endif - -protected: - void clearXMLVersion() { m_xmlVersion = String(); } - -private: - void updateTitle(); - void removeAllDisconnectedNodeEventListeners(); - void updateFocusAppearanceTimerFired(Timer<Document>*); - void updateBaseURL(); - - void cacheDocumentElement() const; - RenderObject* m_savedRenderer; int m_secureForms; @@ -1131,10 +1124,6 @@ private: unsigned m_numNodeListCaches; -public: - typedef HashMap<WebCore::Node*, JSNode*> JSWrapperCache; - JSWrapperCache& wrapperCache() { return m_wrapperCache; } -private: JSWrapperCache m_wrapperCache; #if ENABLE(DATABASE) @@ -1163,7 +1152,7 @@ inline bool Document::hasElementWithId(AtomicStringImpl* id) const inline bool Node::isDocumentNode() const { - return this == m_document.get(); + return this == m_document; } } // namespace WebCore diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp index 7a6174f..3663e99 100644 --- a/WebCore/dom/DocumentFragment.cpp +++ b/WebCore/dom/DocumentFragment.cpp @@ -1,10 +1,8 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * 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, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006, 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 @@ -23,13 +21,18 @@ */ #include "config.h" - #include "DocumentFragment.h" namespace WebCore { -DocumentFragment::DocumentFragment(Document *doc) : ContainerNode(doc) +inline DocumentFragment::DocumentFragment(Document* document) + : ContainerNode(document) +{ +} + +PassRefPtr<DocumentFragment> DocumentFragment::create(Document* document) { + return adoptRef(new DocumentFragment(document)); } String DocumentFragment::nodeName() const @@ -42,7 +45,6 @@ Node::NodeType DocumentFragment::nodeType() const return DOCUMENT_FRAGMENT_NODE; } -// DOM Section 1.1.1 bool DocumentFragment::childTypeAllowed(NodeType type) { switch (type) { @@ -60,7 +62,7 @@ bool DocumentFragment::childTypeAllowed(NodeType type) PassRefPtr<Node> DocumentFragment::cloneNode(bool deep) { - RefPtr<DocumentFragment> clone = new DocumentFragment(document()); + RefPtr<DocumentFragment> clone = create(document()); if (deep) cloneChildNodes(clone.get()); return clone.release(); diff --git a/WebCore/dom/DocumentFragment.h b/WebCore/dom/DocumentFragment.h index 46d8ecd..e624ee4 100644 --- a/WebCore/dom/DocumentFragment.h +++ b/WebCore/dom/DocumentFragment.h @@ -1,10 +1,8 @@ /* - * This file is part of the DOM implementation for KDE. - * * 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, 2005, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2005, 2006, 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 @@ -32,6 +30,9 @@ namespace WebCore { class DocumentFragment : public ContainerNode { public: + static PassRefPtr<DocumentFragment> create(Document*); + +private: DocumentFragment(Document*); virtual String nodeName() const; diff --git a/WebCore/dom/DocumentType.cpp b/WebCore/dom/DocumentType.cpp index 885a65b..b8185e7 100644 --- a/WebCore/dom/DocumentType.cpp +++ b/WebCore/dom/DocumentType.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, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 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 @@ -29,11 +29,11 @@ namespace WebCore { -DocumentType::DocumentType(Document* document, const String& n, const String& p, const String& s) - : Node(document) - , m_name(n) - , m_publicId(p) - , m_systemId(s) +DocumentType::DocumentType(Document* document, const String& name, const String& publicId, const String& systemId) + : Node(document, CreateOther) + , m_name(name) + , m_publicId(publicId) + , m_systemId(systemId) { } @@ -54,7 +54,7 @@ Node::NodeType DocumentType::nodeType() const PassRefPtr<Node> DocumentType::cloneNode(bool /*deep*/) { - return new DocumentType(document(), m_name, m_publicId, m_systemId); + return create(document(), m_name, m_publicId, m_systemId); } void DocumentType::insertedIntoDocument() diff --git a/WebCore/dom/DocumentType.h b/WebCore/dom/DocumentType.h index 9fd3c6e..4f89d01 100644 --- a/WebCore/dom/DocumentType.h +++ b/WebCore/dom/DocumentType.h @@ -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, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 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 @@ -34,7 +34,7 @@ class DocumentType : public Node { public: static PassRefPtr<DocumentType> create(Document* document, const String& name, const String& publicId, const String& systemId) { - return new DocumentType(document, name, publicId, systemId); + return adoptRef(new DocumentType(document, name, publicId, systemId)); } NamedNodeMap* entities() const { return m_entities.get(); } diff --git a/WebCore/dom/EditingText.cpp b/WebCore/dom/EditingText.cpp index 40cf97d..b36931a 100644 --- a/WebCore/dom/EditingText.cpp +++ b/WebCore/dom/EditingText.cpp @@ -1,9 +1,5 @@ -/** - * This file is part of the DOM implementation for KDE. - * - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. +/* + * Copyright (C) 2003, 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 @@ -24,24 +20,19 @@ #include "config.h" #include "EditingText.h" -// FIXME: does this really require a class? Perhaps any Text node -// inside an editable element should have the "always create a renderer" -// behavior. +// FIXME: Does this really require a class? Perhaps instead any text node +// inside an editable element could have the "always create a renderer" behavior. namespace WebCore { -EditingText::EditingText(Document *impl, const String &text) - : Text(impl, text) -{ -} - -EditingText::EditingText(Document *impl) - : Text(impl) +inline EditingText::EditingText(Document* document, const String& data) + : Text(document, data) { } -EditingText::~EditingText() +PassRefPtr<EditingText> EditingText::create(Document* document, const String& data) { + return adoptRef(new EditingText(document, data)); } bool EditingText::rendererIsNeeded(RenderStyle*) diff --git a/WebCore/dom/EditingText.h b/WebCore/dom/EditingText.h index e114786..08223c2 100644 --- a/WebCore/dom/EditingText.h +++ b/WebCore/dom/EditingText.h @@ -1,9 +1,5 @@ /* - * This file is part of the DOM implementation for KDE. - * - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003 Apple Computer, Inc. + * Copyright (C) 2003, 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 @@ -31,11 +27,12 @@ namespace WebCore { class EditingText : public Text { public: - EditingText(Document *impl, const String &text); - EditingText(Document *impl); - virtual ~EditingText(); + static PassRefPtr<EditingText> create(Document*, const String&); +private: virtual bool rendererIsNeeded(RenderStyle *); + + EditingText(Document*, const String&); }; } // namespace WebCore diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp index 1956be4..7aee10c 100644 --- a/WebCore/dom/Element.cpp +++ b/WebCore/dom/Element.cpp @@ -57,8 +57,8 @@ namespace WebCore { using namespace HTMLNames; using namespace XMLNames; -Element::Element(const QualifiedName& tagName, Document* doc) - : ContainerNode(doc, true) +Element::Element(const QualifiedName& tagName, Document* document) + : ContainerNode(document, CreateElementZeroRefCount) , m_tagName(tagName) { } diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h index 223c26a..6aa6312 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 Apple Inc. All rights reserved. + * 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 @@ -42,7 +42,7 @@ class IntSize; class Element : public ContainerNode { public: Element(const QualifiedName&, Document*); - ~Element(); + virtual ~Element(); const AtomicString& getIDAttribute() const; bool hasAttribute(const QualifiedName&) const; @@ -64,7 +64,6 @@ public: void scrollIntoView(bool alignToTop = true); void scrollIntoViewIfNeeded(bool centerIfNeeded = true); - void scrollByUnits(int units, ScrollGranularity); void scrollByLines(int lines); void scrollByPages(int pages); @@ -108,17 +107,11 @@ public: const AtomicString& localName() const { return m_tagName.localName(); } const AtomicString& prefix() const { return m_tagName.prefix(); } - virtual void setPrefix(const AtomicString&, ExceptionCode&); const AtomicString& namespaceURI() const { return m_tagName.namespaceURI(); } virtual KURL baseURI() const; - // DOM methods overridden from parent classes - virtual NodeType nodeType() const; virtual String nodeName() const; - virtual void insertedIntoDocument(); - virtual void removedFromDocument(); - virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); PassRefPtr<Element> cloneElementWithChildren(); PassRefPtr<Element> cloneElementWithoutChildren(); @@ -136,13 +129,9 @@ public: // This method is called whenever an attribute is added, changed or removed. virtual void attributeChanged(Attribute*, bool preserveDecls = false); - // The implementation of Element::attributeChanged() calls the following two functions. - // They are separated to allow a different flow of control in StyledElement::attributeChanged(). - void recalcStyleIfNeededAfterAttributeChanged(Attribute*); - void updateAfterAttributeChanged(Attribute*); - // not part of the DOM void setAttributeMap(PassRefPtr<NamedNodeMap>); + NamedNodeMap* attributeMap() const { return namedAttrMap.get(); } virtual void copyNonAttributeProperties(const Element* /*source*/) { } @@ -153,10 +142,6 @@ public: virtual RenderStyle* computedStyle(); - virtual bool childTypeAllowed(NodeType); - - virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); - void dispatchAttrRemovalEvent(Attribute*); void dispatchAttrAdditionEvent(Attribute*); @@ -170,12 +155,6 @@ public: virtual void updateFocusAppearance(bool restorePreviousSelection); void blur(); -#ifndef NDEBUG - virtual void formatForDebugger(char* buffer, unsigned length) const; -#endif - - bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); - String innerText() const; String outerText() const; @@ -206,13 +185,13 @@ public: Element* nextElementSibling() const; unsigned childElementCount() const; - // FormControlElement API virtual bool isFormControlElement() const { return false; } virtual bool isEnabledFormControl() const { return true; } virtual bool isReadOnlyFormControl() const { return false; } virtual bool isTextFormControl() const { return false; } virtual bool isOptionalFormControl() const { return false; } virtual bool isRequiredFormControl() const { return false; } + virtual bool isDefaultButtonForForm() const { return false; } virtual bool formControlValueMatchesRenderer() const { return false; } virtual void setFormControlValueMatchesRenderer(bool) { } @@ -225,13 +204,37 @@ public: virtual void dispatchFormControlChangeEvent() { } +protected: + virtual void insertedIntoDocument(); + virtual void removedFromDocument(); + virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); + + // The implementation of Element::attributeChanged() calls the following two functions. + // They are separated to allow a different flow of control in StyledElement::attributeChanged(). + void recalcStyleIfNeededAfterAttributeChanged(Attribute*); + void updateAfterAttributeChanged(Attribute*); + private: + void scrollByUnits(int units, ScrollGranularity); + + virtual void setPrefix(const AtomicString&, ExceptionCode&); + virtual NodeType nodeType() const; + virtual bool childTypeAllowed(NodeType); + + virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); + +#ifndef NDEBUG + virtual void formatForDebugger(char* buffer, unsigned length) const; +#endif + + bool pseudoStyleCacheIsInvalid(const RenderStyle* currentStyle, RenderStyle* newStyle); + virtual void createAttributeMap() const; - virtual void updateStyleAttribute() const {} + virtual void updateStyleAttribute() const { } #if ENABLE(SVG) - virtual void updateAnimatedSVGAttribute(const String&) const {} + virtual void updateAnimatedSVGAttribute(const String&) const { } #endif void updateFocusAppearanceSoonAfterAttach(); @@ -248,10 +251,10 @@ private: QualifiedName m_tagName; virtual NodeRareData* createRareData(); -protected: ElementRareData* rareData() const; ElementRareData* ensureRareData(); +protected: mutable RefPtr<NamedNodeMap> namedAttrMap; }; diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl index 53711e9..16aac84 100644 --- a/WebCore/dom/Element.idl +++ b/WebCore/dom/Element.idl @@ -21,6 +21,7 @@ module core { interface [ + CustomMarkFunction, GenerateConstructor, GenerateNativeConverter, InlineGetOwnPropertySlot, diff --git a/WebCore/dom/EntityReference.cpp b/WebCore/dom/EntityReference.cpp index 012605c..c4c292a 100644 --- a/WebCore/dom/EntityReference.cpp +++ b/WebCore/dom/EntityReference.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 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 @@ -23,12 +23,17 @@ namespace WebCore { -EntityReference::EntityReference(Document* document, const String& entityName) +inline EntityReference::EntityReference(Document* document, const String& entityName) : ContainerNode(document) , m_entityName(entityName) { } +PassRefPtr<EntityReference> EntityReference::create(Document* document, const String& entityName) +{ + return adoptRef(new EntityReference(document, entityName)); +} + String EntityReference::nodeName() const { return m_entityName; @@ -41,7 +46,7 @@ Node::NodeType EntityReference::nodeType() const PassRefPtr<Node> EntityReference::cloneNode(bool) { - return new EntityReference(document(), m_entityName); + return create(document(), m_entityName); } } // namespace diff --git a/WebCore/dom/EntityReference.h b/WebCore/dom/EntityReference.h index 4767a5e..7a6f6c3 100644 --- a/WebCore/dom/EntityReference.h +++ b/WebCore/dom/EntityReference.h @@ -28,13 +28,15 @@ namespace WebCore { class EntityReference : public ContainerNode { public: + static PassRefPtr<EntityReference> create(Document*, const String& entityName); + +private: EntityReference(Document*, const String& entityName); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); -private: String m_entityName; }; diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h index d28b154..18c4240 100644 --- a/WebCore/dom/EventNames.h +++ b/WebCore/dom/EventNames.h @@ -73,6 +73,7 @@ namespace WebCore { macro(obsolete) \ macro(offline) \ macro(online) \ + macro(open) \ macro(overflowchanged) \ macro(paste) \ macro(readystatechange) \ diff --git a/WebCore/dom/EventTarget.cpp b/WebCore/dom/EventTarget.cpp index 7ba0584..2f13da8 100644 --- a/WebCore/dom/EventTarget.cpp +++ b/WebCore/dom/EventTarget.cpp @@ -44,6 +44,11 @@ EventTarget::~EventTarget() { } +EventSource* EventTarget::toEventSource() +{ + return 0; +} + Node* EventTarget::toNode() { return 0; @@ -106,6 +111,13 @@ SharedWorkerContext* EventTarget::toSharedWorkerContext() } #endif +#if ENABLE(NOTIFICATIONS) +Notification* EventTarget::toNotification() +{ + return 0; +} +#endif + #ifndef NDEBUG void forbidEventDispatch() { diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h index 2ededda..6d3cb7c 100644 --- a/WebCore/dom/EventTarget.h +++ b/WebCore/dom/EventTarget.h @@ -43,8 +43,10 @@ namespace WebCore { class DOMWindow; class Event; class EventListener; + class EventSource; class MessagePort; class Node; + class Notification; class SVGElementInstance; class ScriptExecutionContext; class SharedWorker; @@ -57,6 +59,7 @@ namespace WebCore { class EventTarget { public: + virtual EventSource* toEventSource(); virtual MessagePort* toMessagePort(); virtual Node* toNode(); virtual DOMWindow* toDOMWindow(); @@ -78,6 +81,10 @@ namespace WebCore { virtual SharedWorkerContext* toSharedWorkerContext(); #endif +#if ENABLE(NOTIFICATIONS) + virtual Notification* toNotification(); +#endif + virtual ScriptExecutionContext* scriptExecutionContext() const = 0; virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture) = 0; diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 18655c6..819f908 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -337,8 +337,69 @@ Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2) return ch; } -Node::Node(Document* doc, bool isElement, bool isContainer, bool isText) - : m_document(doc) +inline bool Node::initialRefCount(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateOther: + case CreateText: + return 1; + case CreateElementZeroRefCount: + return 0; + } + ASSERT_NOT_REACHED(); + return 1; +} + +inline bool Node::isContainer(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateElementZeroRefCount: + return true; + case CreateOther: + case CreateText: + return false; + } + ASSERT_NOT_REACHED(); + return false; +} + +inline bool Node::isElement(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateOther: + case CreateText: + return false; + case CreateElement: + case CreateElementZeroRefCount: + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +inline bool Node::isText(ConstructionType type) +{ + switch (type) { + case CreateContainer: + case CreateElement: + case CreateElementZeroRefCount: + case CreateOther: + return false; + case CreateText: + return true; + } + ASSERT_NOT_REACHED(); + return false; +} + +Node::Node(Document* document, ConstructionType type) + : TreeShared<Node>(initialRefCount(type)) + , m_document(document) , m_previous(0) , m_next(0) , m_renderer(0) @@ -355,25 +416,27 @@ Node::Node(Document* doc, bool isElement, bool isContainer, bool isText) , m_inDetach(false) , m_inSubtreeMark(false) , m_hasRareData(false) - , m_isElement(isElement) - , m_isContainer(isContainer) - , m_isText(isText) + , m_isElement(isElement(type)) + , m_isContainer(isContainer(type)) + , m_isText(isText(type)) , m_parsingChildrenFinished(true) -#if ENABLE(SVG) - , m_areSVGAttributesValid(true) -#endif , m_isStyleAttributeValid(true) , m_synchronizingStyleAttribute(false) #if ENABLE(SVG) + , m_areSVGAttributesValid(true) , m_synchronizingSVGAttributes(false) #endif { + if (m_document) + m_document->selfOnlyRef(); + #ifndef NDEBUG if (shouldIgnoreLeaks) ignoreSet.add(this); else nodeCounter.increment(); #endif + #if DUMP_NODE_STATISTICS liveNodeSet.add(this); #endif @@ -416,6 +479,9 @@ Node::~Node() m_previous->setNextSibling(0); if (m_next) m_next->setPreviousSibling(0); + + if (m_document) + m_document->selfOnlyDeref(); } #ifdef NDEBUG @@ -450,14 +516,19 @@ void Node::setDocument(Document* document) if (inDocument() || m_document == document) return; + document->selfOnlyRef(); + setWillMoveToNewOwnerDocumentWasCalled(false); willMoveToNewOwnerDocument(); ASSERT(willMoveToNewOwnerDocumentWasCalled); #if USE(JSC) - updateDOMNodeDocument(this, m_document.get(), document); + updateDOMNodeDocument(this, m_document, document); #endif + if (m_document) + m_document->selfOnlyDeref(); + m_document = document; setDidMoveToNewOwnerDocumentWasCalled(false); @@ -1900,11 +1971,11 @@ void Node::appendTextContent(bool convertBRsToNewlines, StringBuilder& content) case TEXT_NODE: case CDATA_SECTION_NODE: case COMMENT_NODE: - content.append(static_cast<const CharacterData*>(this)->CharacterData::nodeValue()); + content.append(static_cast<const CharacterData*>(this)->data()); break; case PROCESSING_INSTRUCTION_NODE: - content.append(static_cast<const ProcessingInstruction*>(this)->ProcessingInstruction::nodeValue()); + content.append(static_cast<const ProcessingInstruction*>(this)->data()); break; case ELEMENT_NODE: diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index f10e830..d1f58dc 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -25,7 +25,6 @@ #ifndef Node_h #define Node_h -#include "DocPtr.h" #include "EventTarget.h" #include "KURLHash.h" #include "PlatformString.h" @@ -108,7 +107,6 @@ public: enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force }; static StyleChange diff(const RenderStyle*, const RenderStyle*); - Node(Document*, bool isElement = false, bool isContainer = false, bool isText = false); virtual ~Node(); // DOM methods & attributes for Node @@ -316,7 +314,7 @@ public: { ASSERT(this); ASSERT(m_document || (nodeType() == DOCUMENT_TYPE_NODE && !inDocument())); - return m_document.get(); + return m_document; } void setDocument(Document*); @@ -673,14 +671,35 @@ public: using TreeShared<Node>::ref; using TreeShared<Node>::deref; - + +protected: + // CreateElementZeroRefCount is deprecated and can be removed once we convert all element + // classes to start with a reference count of 1. + enum ConstructionType { CreateContainer, CreateElement, CreateOther, CreateText, CreateElementZeroRefCount }; + Node(Document*, ConstructionType); + + virtual void willMoveToNewOwnerDocument(); + virtual void didMoveToNewOwnerDocument(); + + virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const { } + void setTabIndexExplicitly(short); + + bool hasRareData() const { return m_hasRareData; } + + NodeRareData* rareData() const; + NodeRareData* ensureRareData(); + private: + static bool initialRefCount(ConstructionType); + static bool isContainer(ConstructionType); + static bool isElement(ConstructionType); + static bool isText(ConstructionType); + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } void removeAllEventListenersSlowCase(); -private: virtual NodeRareData* createRareData(); Node* containerChildNode(unsigned index) const; unsigned containerChildNodeCount() const; @@ -698,7 +717,7 @@ private: void appendTextContent(bool convertBRsToNewlines, StringBuilder&) const; - DocPtr<Document> m_document; + Document* m_document; Node* m_previous; Node* m_next; RenderObject* m_renderer; @@ -721,22 +740,16 @@ private: const bool m_isText : 1; protected: - // These bits are used by the Element derived class, pulled up here so they can + // These bits are used by derived classes, pulled up here so they can // be stored in the same memory word as the Node bits above. - bool m_parsingChildrenFinished : 1; -#if ENABLE(SVG) - mutable bool m_areSVGAttributesValid : 1; -#endif - // These bits are used by the StyledElement derived class, and live here for the - // same reason as above. - mutable bool m_isStyleAttributeValid : 1; - mutable bool m_synchronizingStyleAttribute : 1; + bool m_parsingChildrenFinished : 1; // Element + mutable bool m_isStyleAttributeValid : 1; // StyledElement + mutable bool m_synchronizingStyleAttribute : 1; // StyledElement #if ENABLE(SVG) - // This bit is used by the SVGElement derived class, and lives here for the same - // reason as above. - mutable bool m_synchronizingSVGAttributes : 1; + mutable bool m_areSVGAttributesValid : 1; // Element + mutable bool m_synchronizingSVGAttributes : 1; // SVGElement #endif // 11 bits remaining diff --git a/WebCore/dom/Notation.cpp b/WebCore/dom/Notation.cpp index 7081d98..cade384 100644 --- a/WebCore/dom/Notation.cpp +++ b/WebCore/dom/Notation.cpp @@ -1,8 +1,6 @@ -/** - * This file is part of the DOM implementation for KDE. - * +/* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -19,17 +17,14 @@ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ + #include "config.h" #include "Notation.h" namespace WebCore { -Notation::Notation(Document* doc) : ContainerNode(doc) -{ -} - -Notation::Notation(Document* doc, const String& name, const String& publicId, const String& systemId) - : ContainerNode(doc) +Notation::Notation(Document* document, const String& name, const String& publicId, const String& systemId) + : ContainerNode(document) , m_name(name) , m_publicId(publicId) , m_systemId(systemId) @@ -52,7 +47,6 @@ PassRefPtr<Node> Notation::cloneNode(bool /*deep*/) return 0; } -// DOM Section 1.1.1 bool Notation::childTypeAllowed(NodeType) { return false; diff --git a/WebCore/dom/Notation.h b/WebCore/dom/Notation.h index 2bd5363..547c9e7 100644 --- a/WebCore/dom/Notation.h +++ b/WebCore/dom/Notation.h @@ -1,8 +1,6 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -24,26 +22,25 @@ #ifndef Notation_h #define Notation_h -#include "CachedResourceClient.h" #include "ContainerNode.h" namespace WebCore { +// FIXME: This class is never instantiated. Maybe it should be removed. + class Notation : public ContainerNode { public: - Notation(Document*); - Notation(Document*, const String& name, const String& publicId, const String& systemId); + const String& publicId() const { return m_publicId; } + const String& systemId() const { return m_systemId; } - // DOM methods & attributes for Notation - String publicId() const { return m_publicId; } - String systemId() const { return m_systemId; } +private: + Notation(Document*, const String& name, const String& publicId, const String& systemId); virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); virtual bool childTypeAllowed(NodeType); -private: String m_name; String m_publicId; String m_systemId; diff --git a/WebCore/dom/ProcessingInstruction.cpp b/WebCore/dom/ProcessingInstruction.cpp index 806bf92..8404481 100644 --- a/WebCore/dom/ProcessingInstruction.cpp +++ b/WebCore/dom/ProcessingInstruction.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 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 @@ -35,8 +35,10 @@ namespace WebCore { -ProcessingInstruction::ProcessingInstruction(Document* doc) - : ContainerNode(doc) +inline ProcessingInstruction::ProcessingInstruction(Document* document, const String& target, const String& data) + : ContainerNode(document) + , m_target(target) + , m_data(data) , m_cachedSheet(0) , m_loading(false) , m_alternate(false) @@ -46,17 +48,9 @@ ProcessingInstruction::ProcessingInstruction(Document* doc) { } -ProcessingInstruction::ProcessingInstruction(Document* doc, const String& target, const String& data) - : ContainerNode(doc) - , m_target(target) - , m_data(data) - , m_cachedSheet(0) - , m_loading(false) - , m_alternate(false) -#if ENABLE(XSLT) - , m_isXSL(false) -#endif +PassRefPtr<ProcessingInstruction> ProcessingInstruction::create(Document* document, const String& target, const String& data) { + return adoptRef(new ProcessingInstruction(document, target, data)); } ProcessingInstruction::~ProcessingInstruction() @@ -95,8 +89,9 @@ void ProcessingInstruction::setNodeValue(const String& nodeValue, ExceptionCode& PassRefPtr<Node> ProcessingInstruction::cloneNode(bool /*deep*/) { - // ### copy m_localHref - return new ProcessingInstruction(document(), m_target, m_data); + // FIXME: Is it a problem that this does not copy m_localHref? + // What about other data members? + return create(document(), m_target, m_data); } // DOM Section 1.1.1 diff --git a/WebCore/dom/ProcessingInstruction.h b/WebCore/dom/ProcessingInstruction.h index d133019..4b7dc86 100644 --- a/WebCore/dom/ProcessingInstruction.h +++ b/WebCore/dom/ProcessingInstruction.h @@ -1,8 +1,6 @@ /* - * This file is part of the DOM implementation for KDE. - * * Copyright (C) 2000 Peter Kelly (pmk@post.com) - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006 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 @@ -35,15 +33,28 @@ class CSSStyleSheet; class ProcessingInstruction : public ContainerNode, private CachedResourceClient { public: - ProcessingInstruction(Document*); - ProcessingInstruction(Document*, const String& target, const String& data); + static PassRefPtr<ProcessingInstruction> create(Document*, const String& target, const String& data); virtual ~ProcessingInstruction(); - // DOM methods & attributes for Notation - String target() const { return m_target; } - String data() const { return m_data; } + const String& target() const { return m_target; } + const String& data() const { return m_data; } void setData(const String&, ExceptionCode&); + void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; } + + virtual void finishParsingChildren(); + + const String& localHref() const { return m_localHref; } + StyleSheet* sheet() const { return m_sheet.get(); } + void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>); + +#if ENABLE(XSLT) + bool isXSL() const { return m_isXSL; } +#endif + +private: + ProcessingInstruction(Document*, const String& target, const String& data); + virtual String nodeName() const; virtual NodeType nodeType() const; virtual String nodeValue() const; @@ -55,28 +66,18 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; } - virtual void finishParsingChildren(); - // Other methods (not part of DOM) - String localHref() const { return m_localHref; } - StyleSheet* sheet() const { return m_sheet.get(); } void checkStyleSheet(); virtual void setCSSStyleSheet(const String& url, const String& charset, const CachedCSSStyleSheet*); #if ENABLE(XSLT) virtual void setXSLStyleSheet(const String& url, const String& sheet); #endif - void setCSSStyleSheet(PassRefPtr<CSSStyleSheet>); + bool isLoading() const; virtual bool sheetLoaded(); -#if ENABLE(XSLT) - bool isXSL() const { return m_isXSL; } -#endif - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; -private: void parseStyleSheet(const String& sheet); String m_target; diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp index edee305..b9a531c 100644 --- a/WebCore/dom/Range.cpp +++ b/WebCore/dom/Range.cpp @@ -586,7 +586,7 @@ PassRefPtr<DocumentFragment> Range::processContents(ActionType action, Exception RefPtr<DocumentFragment> fragment; if (action == EXTRACT_CONTENTS || action == CLONE_CONTENTS) - fragment = new DocumentFragment(m_ownerDocument.get()); + fragment = DocumentFragment::create(m_ownerDocument.get()); ec = 0; if (collapsed(ec)) diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp index 456cc52..13c23fb 100644 --- a/WebCore/dom/StyledElement.cpp +++ b/WebCore/dom/StyledElement.cpp @@ -280,14 +280,6 @@ CSSStyleDeclaration* StyledElement::style() return getInlineStyleDecl(); } -static inline int toHex(UChar c) -{ - return ((c >= '0' && c <= '9') ? (c - '0') - : ((c >= 'a' && c <= 'f') ? (c - 'a' + 10) - : ((c >= 'A' && c <= 'F') ? (c - 'A' + 10) - : -1))); -} - void StyledElement::addCSSProperty(MappedAttribute* attr, int id, const String &value) { if (!attr->decl()) createMappedDecl(attr); @@ -393,10 +385,9 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) // search forward for digits in the string int numDigits = 0; while (pos < (int)color.length() && numDigits < basicLength) { - int hex = toHex(color[pos]); - colors[component] = (colors[component] << 4); - if (hex > 0) { - colors[component] += hex; + colors[component] <<= 4; + if (isASCIIHexDigit(color[pos])) { + colors[component] += toASCIIHexValue(color[pos]); maxDigit = min(maxDigit, numDigits); } numDigits++; @@ -410,10 +401,9 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String& c) // normalize to 00-ff. The highest filled digit counts, minimum is 2 digits maxDigit -= 2; - colors[0] >>= 4*maxDigit; - colors[1] >>= 4*maxDigit; - colors[2] >>= 4*maxDigit; - // ASSERT(colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100); + colors[0] >>= 4 * maxDigit; + colors[1] >>= 4 * maxDigit; + colors[2] >>= 4 * maxDigit; color = String::format("#%02x%02x%02x", colors[0], colors[1], colors[2]); if (attr->decl()->setProperty(id, color, false)) diff --git a/WebCore/dom/Text.cpp b/WebCore/dom/Text.cpp index bbd926b..00db1c1 100644 --- a/WebCore/dom/Text.cpp +++ b/WebCore/dom/Text.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -37,22 +37,18 @@ #include "WMLVariables.h" #endif -namespace WebCore { - -// DOM Section 1.1.1 +using namespace std; -Text::Text(Document* document, const String& text) - : CharacterData(document, text, true) -{ -} +namespace WebCore { -Text::Text(Document* document) - : CharacterData(document, true) +Text::Text(Document* document, const String& data) + : CharacterData(document, data, CreateText) { } -Text::~Text() +PassRefPtr<Text> Text::create(Document* document, const String& data) { + return adoptRef(new Text(document, data)); } PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) @@ -61,14 +57,14 @@ PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) // INDEX_SIZE_ERR: Raised if the specified offset is negative or greater than // the number of 16-bit units in data. - if (offset > m_data->length()) { + if (offset > length()) { ec = INDEX_SIZE_ERR; return 0; } - RefPtr<StringImpl> oldStr = m_data; - RefPtr<Text> newText = createNew(oldStr->substring(offset)); - m_data = oldStr->substring(0, offset); + RefPtr<StringImpl> oldStr = dataImpl(); + RefPtr<Text> newText = virtualCreate(oldStr->substring(offset)); + setDataImpl(oldStr->substring(0, offset)); dispatchModifiedEvent(oldStr.get()); @@ -81,7 +77,7 @@ PassRefPtr<Text> Text::splitText(unsigned offset, ExceptionCode& ec) document()->textNodeSplit(this); if (renderer()) - toRenderText(renderer())->setText(m_data); + toRenderText(renderer())->setText(dataImpl()); return newText.release(); } @@ -199,7 +195,7 @@ Node::NodeType Text::nodeType() const PassRefPtr<Node> Text::cloneNode(bool /*deep*/) { - return document()->createTextNode(m_data); + return create(document(), data()); } bool Text::rendererIsNeeded(RenderStyle *style) @@ -244,7 +240,7 @@ bool Text::rendererIsNeeded(RenderStyle *style) return true; } -RenderObject *Text::createRenderer(RenderArena* arena, RenderStyle*) +RenderObject* Text::createRenderer(RenderArena* arena, RenderStyle*) { #if ENABLE(SVG) if (parentNode()->isSVGElement() @@ -252,17 +248,17 @@ RenderObject *Text::createRenderer(RenderArena* arena, RenderStyle*) && !parentNode()->hasTagName(SVGNames::foreignObjectTag) #endif ) - return new (arena) RenderSVGInlineText(this, m_data); + return new (arena) RenderSVGInlineText(this, dataImpl()); #endif - return new (arena) RenderText(this, m_data); + return new (arena) RenderText(this, dataImpl()); } void Text::attach() { #if ENABLE(WML) if (document()->isWMLDocument() && !containsOnlyWhitespace()) { - String text = m_data; + String text = data(); ASSERT(!text.isEmpty()); text = substituteVariableReferences(text, document()); @@ -286,7 +282,7 @@ void Text::recalcStyle(StyleChange change) if (needsStyleRecalc()) { if (renderer()) { if (renderer()->isText()) - toRenderText(renderer())->setText(m_data); + toRenderText(renderer())->setText(dataImpl()); } else { if (attached()) detach(); @@ -296,40 +292,42 @@ void Text::recalcStyle(StyleChange change) setNeedsStyleRecalc(NoStyleChange); } -// DOM Section 1.1.1 bool Text::childTypeAllowed(NodeType) { return false; } -PassRefPtr<Text> Text::createNew(PassRefPtr<StringImpl> string) +PassRefPtr<Text> Text::virtualCreate(const String& data) { - return new Text(document(), string); + return create(document(), data); } -PassRefPtr<Text> Text::createWithLengthLimit(Document* doc, const String& text, unsigned& charsLeft, unsigned maxChars) +PassRefPtr<Text> Text::createWithLengthLimit(Document* document, const String& data, unsigned& charsLeft, unsigned maxChars) { - if (charsLeft == text.length() && charsLeft <= maxChars) { + unsigned dataLength = data.length(); + + if (charsLeft == dataLength && charsLeft <= maxChars) { charsLeft = 0; - return new Text(doc, text); + return create(document, data); } + + unsigned start = dataLength - charsLeft; + unsigned end = start + min(charsLeft, maxChars); - unsigned start = text.length() - charsLeft; - unsigned end = start + std::min(charsLeft, maxChars); - - // check we are not on an unbreakable boundary - TextBreakIterator* it = characterBreakIterator(text.characters(), text.length()); - if (end < text.length() && !isTextBreak(it, end)) + // Check we are not on an unbreakable boundary. + TextBreakIterator* it = characterBreakIterator(data.characters(), dataLength); + if (end < dataLength && !isTextBreak(it, end)) end = textBreakPreceding(it, end); - // maxChars of unbreakable characters could lead to infinite loop + // If we have maxChars of unbreakable characters the above could lead to + // an infinite loop. + // FIXME: It would be better to just have the old value of end before calling + // textBreakPreceding rather than this, because this exceeds the length limit. if (end <= start) - end = text.length(); + end = dataLength; - String nodeText = text.substring(start, end - start); - charsLeft = text.length() - end; - - return new Text(doc, nodeText); + charsLeft = dataLength - end; + return create(document, data.substring(start, end - start)); } #ifndef NDEBUG @@ -343,7 +341,7 @@ void Text::formatForDebugger(char *buffer, unsigned length) const result += s; } - s = nodeValue(); + s = data(); if (s.length() > 0) { if (result.length() > 0) result += "; "; diff --git a/WebCore/dom/Text.h b/WebCore/dom/Text.h index e5a6e69..4722736 100644 --- a/WebCore/dom/Text.h +++ b/WebCore/dom/Text.h @@ -1,7 +1,7 @@ /* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * 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 @@ -27,44 +27,39 @@ namespace WebCore { -const unsigned cTextNodeLengthLimit = 1 << 16; - class Text : public CharacterData { public: - Text(Document *impl, const String &_text); - Text(Document *impl); - virtual ~Text(); + static const unsigned defaultLengthLimit = 1 << 16; - // DOM methods & attributes for CharacterData + static PassRefPtr<Text> create(Document*, const String&); + static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned lengthLimit = defaultLengthLimit); PassRefPtr<Text> splitText(unsigned offset, ExceptionCode&); // DOM Level 3: http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-1312295772 + String wholeText() const; PassRefPtr<Text> replaceWholeText(const String&, ExceptionCode&); - // DOM methods overridden from parent classes + virtual void attach(); + +protected: + Text(Document*, const String&); +private: virtual String nodeName() const; virtual NodeType nodeType() const; virtual PassRefPtr<Node> cloneNode(bool deep); - - // Other methods (not part of DOM) - - virtual void attach(); virtual bool rendererIsNeeded(RenderStyle*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void recalcStyle(StyleChange = NoChange); virtual bool childTypeAllowed(NodeType); - static PassRefPtr<Text> createWithLengthLimit(Document*, const String&, unsigned& charsLeft, unsigned maxChars = cTextNodeLengthLimit); + virtual PassRefPtr<Text> virtualCreate(const String&); #ifndef NDEBUG virtual void formatForDebugger(char* buffer, unsigned length) const; #endif - -protected: - virtual PassRefPtr<Text> createNew(PassRefPtr<StringImpl>); }; } // namespace WebCore diff --git a/WebCore/dom/XMLTokenizer.cpp b/WebCore/dom/XMLTokenizer.cpp index 1747c3c..4d06343 100644 --- a/WebCore/dom/XMLTokenizer.cpp +++ b/WebCore/dom/XMLTokenizer.cpp @@ -136,7 +136,7 @@ bool XMLTokenizer::enterText() #if !USE(QXMLSTREAM) ASSERT(m_bufferedText.size() == 0); #endif - RefPtr<Node> newNode = new Text(m_doc, ""); + RefPtr<Node> newNode = Text::create(m_doc, ""); if (!m_currentNode->addChild(newNode.get())) return false; setCurrentNode(newNode.get()); diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp index 4387a66..da2f9b6 100644 --- a/WebCore/dom/XMLTokenizerLibxml2.cpp +++ b/WebCore/dom/XMLTokenizerLibxml2.cpp @@ -951,7 +951,7 @@ void XMLTokenizer::cdataBlock(const xmlChar* s, int len) exitText(); - RefPtr<Node> newNode = new CDATASection(m_doc, toString(s, len)); + RefPtr<Node> newNode = CDATASection::create(m_doc, toString(s, len)); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -970,7 +970,7 @@ void XMLTokenizer::comment(const xmlChar* s) exitText(); - RefPtr<Node> newNode = new Comment(m_doc, toString(s)); + RefPtr<Node> newNode = Comment::create(m_doc, toString(s)); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); diff --git a/WebCore/dom/XMLTokenizerQt.cpp b/WebCore/dom/XMLTokenizerQt.cpp index 16c637f..799eef3 100644 --- a/WebCore/dom/XMLTokenizerQt.cpp +++ b/WebCore/dom/XMLTokenizerQt.cpp @@ -692,7 +692,7 @@ void XMLTokenizer::parseCdata() { exitText(); - RefPtr<Node> newNode = new CDATASection(m_doc, m_stream.text()); + RefPtr<Node> newNode = CDATASection::create(m_doc, m_stream.text()); if (!m_currentNode->addChild(newNode.get())) return; if (m_view && !newNode->attached()) @@ -703,7 +703,7 @@ void XMLTokenizer::parseComment() { exitText(); - RefPtr<Node> newNode = new Comment(m_doc, m_stream.text()); + RefPtr<Node> newNode = Comment::create(m_doc, m_stream.text()); m_currentNode->addChild(newNode.get()); if (m_view && !newNode->attached()) newNode->attach(); diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl index e6d59a0..4e6eb38 100755 --- a/WebCore/dom/make_names.pl +++ b/WebCore/dom/make_names.pl @@ -48,28 +48,30 @@ my %parameters = (); my $extraDefines = 0; my $preprocessor = "/usr/bin/gcc -E -P -x c++"; -GetOptions('tags=s' => \$tagsFile, +GetOptions( + 'tags=s' => \$tagsFile, 'attrs=s' => \$attrsFile, 'factory' => \$printFactory, 'outputDir=s' => \$outputDir, 'extraDefines=s' => \$extraDefines, 'preprocessor=s' => \$preprocessor, - 'wrapperFactory' => \$printWrapperFactory); + 'wrapperFactory' => \$printWrapperFactory +); die "You must specify at least one of --tags <file> or --attrs <file>" unless (length($tagsFile) || length($attrsFile)); readNames($tagsFile, "tags") if length($tagsFile); readNames($attrsFile, "attrs") if length($attrsFile); -die "You must specify a namespace (e.g. SVG) for <namespace>Names.h" unless $parameters{'namespace'}; -die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $parameters{'namespaceURI'}; +die "You must specify a namespace (e.g. SVG) for <namespace>Names.h" unless $parameters{namespace}; +die "You must specify a namespaceURI (e.g. http://www.w3.org/2000/svg)" unless $parameters{namespaceURI}; -$parameters{'namespacePrefix'} = $parameters{'namespace'} unless $parameters{'namespacePrefix'}; +$parameters{namespacePrefix} = $parameters{namespace} unless $parameters{namespacePrefix}; mkpath($outputDir); -my $namesBasePath = "$outputDir/$parameters{'namespace'}Names"; -my $factoryBasePath = "$outputDir/$parameters{'namespace'}ElementFactory"; -my $wrapperFactoryBasePath = "$outputDir/JS$parameters{'namespace'}ElementWrapperFactory"; +my $namesBasePath = "$outputDir/$parameters{namespace}Names"; +my $factoryBasePath = "$outputDir/$parameters{namespace}ElementFactory"; +my $wrapperFactoryBasePath = "$outputDir/JS$parameters{namespace}ElementWrapperFactory"; printNamesHeaderFile("$namesBasePath.h"); printNamesCppFile("$namesBasePath.cpp"); @@ -86,39 +88,44 @@ if ($printWrapperFactory) { ### Hash initialization -sub initializeTagPropertyHash +sub defaultTagPropertyHash { - return ('constructorNeedsCreatedByParser' => 0, - 'constructorNeedsFormElement' => 0, - 'exportString' => 0, - 'interfaceName' => defaultInterfaceName($_[0]), - # By default, the JSInterfaceName is the same as the interfaceName. - 'JSInterfaceName' => defaultInterfaceName($_[0]), - 'mapToTagName' => '', - 'wrapperOnlyIfMediaIsAvailable' => 0, - 'conditional' => 0); + return ( + 'constructorNeedsCreatedByParser' => 0, + 'constructorNeedsFormElement' => 0, + 'createWithNew' => 1, + 'exportString' => 0, + 'interfaceName' => defaultInterfaceName($_[0]), + # By default, the JSInterfaceName is the same as the interfaceName. + 'JSInterfaceName' => defaultInterfaceName($_[0]), + 'mapToTagName' => '', + 'wrapperOnlyIfMediaIsAvailable' => 0, + 'conditional' => 0 + ); } -sub initializeAttrPropertyHash +sub defaultAttrPropertyHash { return ('exportString' => 0); } -sub initializeParametersHash +sub defaultParametersHash { - return ('namespace' => '', - 'namespacePrefix' => '', - 'namespaceURI' => '', - 'guardFactoryWith' => '', - 'tagsNullNamespace' => 0, - 'attrsNullNamespace' => 0, - 'exportStrings' => 0); + return ( + 'namespace' => '', + 'namespacePrefix' => '', + 'namespaceURI' => '', + 'guardFactoryWith' => '', + 'tagsNullNamespace' => 0, + 'attrsNullNamespace' => 0, + 'exportStrings' => 0 + ); } sub defaultInterfaceName { - die "No namespace found" if !$parameters{'namespace'}; - return $parameters{'namespace'} . upperCaseName($_[0]) . "Element" + die "No namespace found" if !$parameters{namespace}; + return $parameters{namespace} . upperCaseName($_[0]) . "Element" } ### Parsing handlers @@ -129,16 +136,16 @@ sub tagsHandler $tag =~ s/-/_/g; - # Initialize default properties' values. - $tags{$tag} = { initializeTagPropertyHash($tag) } if !defined($tags{$tag}); + # Initialize default property values. + $tags{$tag} = { defaultTagPropertyHash($tag) } if !defined($tags{$tag}); if ($property) { die "Unknown property $property for tag $tag\n" if !defined($tags{$tag}{$property}); - # The code rely on JSInterfaceName deriving from interfaceName to check for custom JSInterfaceName. - # So just override JSInterfaceName if it was not already set. - if ($property eq "interfaceName" && $tags{$tag}{'JSInterfaceName'} eq $tags{$tag}{'interfaceName'}) { - $tags{$tag}{'JSInterfaceName'} = $value; - } + + # The code relies on JSInterfaceName deriving from interfaceName to check for custom JSInterfaceName. + # So override JSInterfaceName if it was not already set. + $tags{$tag}{JSInterfaceName} = $value if $property eq "interfaceName" && $tags{$tag}{JSInterfaceName} eq $tags{$tag}{interfaceName}; + $tags{$tag}{$property} = $value; } } @@ -150,7 +157,7 @@ sub attrsHandler $attr =~ s/-/_/g; # Initialize default properties' values. - $attrs{$attr} = { initializeAttrPropertyHash($attr) } if !defined($attrs{$attr}); + $attrs{$attr} = { defaultAttrPropertyHash($attr) } if !defined($attrs{$attr}); if ($property) { die "Unknown property $property for attribute $attr\n" if !defined($attrs{$attr}{$property}); @@ -163,7 +170,7 @@ sub parametersHandler my ($parameter, $value) = @_; # Initialize default properties' values. - %parameters = initializeParametersHash() if !(keys %parameters); + %parameters = defaultParametersHash() if !(keys %parameters); die "Unknown parameter $parameter for tags/attrs\n" if !defined($parameters{$parameter}); $parameters{$parameter} = $value; @@ -214,7 +221,7 @@ sub printMacros for my $name (sort keys %$namesRef) { print F "$macro $name","$suffix;\n"; - if ($parameters{'exportStrings'} or $names{$name}{"exportString"}) { + if ($parameters{exportStrings} or $names{$name}{exportString}) { print F "extern char $name", "${suffix}String[];\n"; } } @@ -223,7 +230,7 @@ sub printMacros sub usesDefaultWrapper { my $tagName = shift; - return $tagName eq $parameters{'namespace'} . "Element"; + return $tagName eq $parameters{namespace} . "Element"; } # Build a direct mapping from the tags to the Element to create, excluding @@ -232,16 +239,16 @@ sub buildConstructorMap { my %tagConstructorMap = (); for my $tagName (keys %tags) { - my $interfaceName = $tags{$tagName}{'interfaceName'}; + my $interfaceName = $tags{$tagName}{interfaceName}; next if (usesDefaultWrapper($interfaceName)); - if ($tags{$tagName}{'mapToTagName'}) { - die "Cannot handle multiple mapToTagName for $tagName\n" if $tags{$tags{$tagName}{'mapToTagName'}}{'mapToTagName'}; - $interfaceName = $tags{ $tags{$tagName}{'mapToTagName'} }{'interfaceName'}; + if ($tags{$tagName}{mapToTagName}) { + die "Cannot handle multiple mapToTagName for $tagName\n" if $tags{$tags{$tagName}{mapToTagName}}{mapToTagName}; + $interfaceName = $tags{ $tags{$tagName}{mapToTagName} }{interfaceName}; } # Chop the string to keep the interesting part. - $interfaceName =~ s/$parameters{'namespace'}(.*)Element/$1/; + $interfaceName =~ s/$parameters{namespace}(.*)Element/$1/; $tagConstructorMap{$tagName} = lc($interfaceName); } @@ -254,17 +261,13 @@ sub printConstructorSignature { my ($F, $tagName, $constructorName, $constructorTagName) = @_; - print F "static PassRefPtr<$parameters{'namespace'}Element> ${constructorName}Constructor(const QualifiedName& $constructorTagName, Document* doc"; - if ($parameters{'namespace'} eq "HTML") { + print F "static PassRefPtr<$parameters{namespace}Element> ${constructorName}Constructor(const QualifiedName& $constructorTagName, Document* document"; + if ($parameters{namespace} eq "HTML") { print F ", HTMLFormElement*"; - if ($tags{$tagName}{'constructorNeedsFormElement'}) { - print F " formElement"; - } + print F " formElement" if $tags{$tagName}{constructorNeedsFormElement}; } print F ", bool"; - if ($tags{$tagName}{'constructorNeedsCreatedByParser'}) { - print F " createdByParser"; - } + print F " createdByParser" if $tags{$tagName}{constructorNeedsCreatedByParser}; print F ")\n{\n"; } @@ -276,22 +279,26 @@ sub printConstructorInterior my ($F, $tagName, $interfaceName, $constructorTagName) = @_; # Handle media elements. - if ($tags{$tagName}{'wrapperOnlyIfMediaIsAvailable'}) { + if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { print F <<END if (!MediaPlayer::isAvailable()) - return new HTMLElement($constructorTagName, doc); + return new HTMLElement($constructorTagName, document); END ; } - # Now call the constructor with the right parameters. - print F " return new ${interfaceName}($constructorTagName, doc"; - if ($tags{$tagName}{'constructorNeedsFormElement'}) { - print F ", formElement"; - } - if ($tags{$tagName}{'constructorNeedsCreatedByParser'}) { - print F ", createdByParser"; + my $newPrefix = ""; + my $createSuffix = "::create"; + + if ($tags{$tagName}{createWithNew}) { + $newPrefix = "new "; + $createSuffix = ""; } + + # Call the constructor with the right parameters. + print F " return $newPrefix$interfaceName${createSuffix}($constructorTagName, document"; + print F ", formElement" if $tags{$tagName}{constructorNeedsFormElement}; + print F ", createdByParser" if $tags{$tagName}{constructorNeedsCreatedByParser}; print F ");\n}\n\n"; } @@ -300,20 +307,20 @@ sub printConstructors my ($F, $tagConstructorMapRef) = @_; my %tagConstructorMap = %$tagConstructorMapRef; - print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; # This is to avoid generating the same constructor several times. my %uniqueTags = (); for my $tagName (sort keys %tagConstructorMap) { - my $interfaceName = $tags{$tagName}{'interfaceName'}; + my $interfaceName = $tags{$tagName}{interfaceName}; # Ignore the mapped tag # FIXME: It could be moved inside this loop but was split for readibility. - next if (defined($uniqueTags{$interfaceName}) || $tags{$tagName}{'mapToTagName'}); + next if (defined($uniqueTags{$interfaceName}) || $tags{$tagName}{mapToTagName}); $uniqueTags{$interfaceName} = '1'; - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n\n"; @@ -323,20 +330,20 @@ sub printConstructors printConstructorInterior($F, $tagName, $interfaceName, "tagName"); if ($conditional) { - print F "#endif\n\n"; + print F "#endif\n"; } } # Mapped tag name uses a special wrapper to keep their prefix and namespaceURI while using the mapped localname. for my $tagName (sort keys %tagConstructorMap) { - if ($tags{$tagName}{'mapToTagName'}) { - my $mappedName = $tags{$tagName}{'mapToTagName'}; + if ($tags{$tagName}{mapToTagName}) { + my $mappedName = $tags{$tagName}{mapToTagName}; printConstructorSignature($F, $mappedName, $mappedName . "To" . $tagName, "tagName"); - printConstructorInterior($F, $mappedName, $tags{$mappedName}{'interfaceName'}, "QualifiedName(tagName.prefix(), ${mappedName}Tag.localName(), tagName.namespaceURI())"); + printConstructorInterior($F, $mappedName, $tags{$mappedName}{interfaceName}, "QualifiedName(tagName.prefix(), ${mappedName}Tag.localName(), tagName.namespaceURI())"); } } - print F "#endif\n" if $parameters{'guardFactoryWith'}; + print F "#endif\n" if $parameters{guardFactoryWith}; } sub printFunctionInits @@ -346,14 +353,14 @@ sub printFunctionInits for my $tagName (sort keys %tagConstructorMap) { - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n"; } - if ($tags{$tagName}{'mapToTagName'}) { - print F " addTag(${tagName}Tag, $tags{$tagName}{'mapToTagName'}To${tagName}Constructor);\n"; + if ($tags{$tagName}{mapToTagName}) { + print F " addTag(${tagName}Tag, $tags{$tagName}{mapToTagName}To${tagName}Constructor);\n"; } else { print F " addTag(${tagName}Tag, $tagConstructorMap{$tagName}Constructor);\n"; } @@ -368,9 +375,7 @@ sub svgCapitalizationHacks { my $name = shift; - if ($name =~ /^fe(.+)$/) { - $name = "FE" . ucfirst $1; - } + $name = "FE" . ucfirst $1 if $name =~ /^fe(.+)$/; return $name; } @@ -379,7 +384,7 @@ sub upperCaseName { my $name = shift; - $name = svgCapitalizationHacks($name) if ($parameters{'namespace'} eq "SVG"); + $name = svgCapitalizationHacks($name) if ($parameters{namespace} eq "SVG"); while ($name =~ /^(.*?)_(.*)/) { $name = $1 . ucfirst $2; @@ -392,10 +397,11 @@ sub printLicenseHeader { my $F = shift; print F "/* - * THIS FILE IS AUTOMATICALLY GENERATED, DO NOT EDIT. + * THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. * + * This file was generated by the dom/make_names.pl script. * - * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 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 @@ -416,10 +422,9 @@ sub printLicenseHeader * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (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. */ - "; } @@ -428,16 +433,16 @@ sub printNamesHeaderFile my ($headerPath) = shift; my $F; open F, ">$headerPath"; - + printLicenseHeader($F); - print F "#ifndef DOM_$parameters{'namespace'}NAMES_H\n"; - print F "#define DOM_$parameters{'namespace'}NAMES_H\n\n"; + print F "#ifndef DOM_$parameters{namespace}NAMES_H\n"; + print F "#define DOM_$parameters{namespace}NAMES_H\n\n"; print F "#include \"QualifiedName.h\"\n\n"; - - print F "namespace WebCore {\n\n namespace $parameters{'namespace'}Names {\n\n"; - - my $lowerNamespace = lc($parameters{'namespacePrefix'}); - print F "#ifndef DOM_$parameters{'namespace'}NAMES_HIDE_GLOBALS\n"; + + print F "namespace WebCore {\n\n namespace $parameters{namespace}Names {\n\n"; + + my $lowerNamespace = lc($parameters{namespacePrefix}); + print F "#ifndef DOM_$parameters{namespace}NAMES_HIDE_GLOBALS\n"; print F "// Namespace\n"; print F "extern const WebCore::AtomicString ${lowerNamespace}NamespaceURI;\n\n"; @@ -451,19 +456,19 @@ sub printNamesHeaderFile printMacros($F, "extern const WebCore::QualifiedName", "Attr", \%attrs); } print F "#endif\n\n"; - + if (keys %tags) { - print F "WebCore::QualifiedName** get$parameters{'namespace'}Tags(size_t* size);\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size);\n"; } if (keys %attrs) { - print F "WebCore::QualifiedName** get$parameters{'namespace'}Attrs(size_t* size);\n"; + print F "WebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size);\n"; } - + print F "\nvoid init();\n\n"; print F "} }\n\n"; print F "#endif\n\n"; - + close F; } @@ -475,25 +480,25 @@ sub printNamesCppFile printLicenseHeader($F); - my $lowerNamespace = lc($parameters{'namespacePrefix'}); + my $lowerNamespace = lc($parameters{namespacePrefix}); print F "#include \"config.h\"\n"; print F "#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC\n"; -print F "#define DOM_$parameters{'namespace'}NAMES_HIDE_GLOBALS 1\n"; +print F "#define DOM_$parameters{namespace}NAMES_HIDE_GLOBALS 1\n"; print F "#else\n"; print F "#define QNAME_DEFAULT_CONSTRUCTOR 1\n"; print F "#endif\n\n"; -print F "#include \"$parameters{'namespace'}Names.h\"\n\n"; +print F "#include \"$parameters{namespace}Names.h\"\n\n"; print F "#include \"StaticConstructors.h\"\n"; -print F "namespace WebCore {\n\n namespace $parameters{'namespace'}Names { +print F "namespace WebCore {\n\n namespace $parameters{namespace}Names { using namespace WebCore; -DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namespaceURI'}\") +DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{namespaceURI}\") "; if (keys %tags) { @@ -502,14 +507,14 @@ DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namesp print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{'namespace'}Tags(size_t* size)\n"; - print F "{\n static WebCore::QualifiedName* $parameters{'namespace'}Tags[] = {\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Tags(size_t* size)\n"; + print F "{\n static WebCore::QualifiedName* $parameters{namespace}Tags[] = {\n"; for my $name (sort keys %tags) { print F " (WebCore::QualifiedName*)&${name}Tag,\n"; } print F " };\n"; print F " *size = ", scalar(keys %tags), ";\n"; - print F " return $parameters{'namespace'}Tags;\n"; + print F " return $parameters{namespace}Tags;\n"; print F "}\n"; } @@ -518,14 +523,14 @@ DEFINE_GLOBAL(AtomicString, ${lowerNamespace}NamespaceURI, \"$parameters{'namesp for my $name (sort keys %attrs) { print F "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; } - print F "\n\nWebCore::QualifiedName** get$parameters{'namespace'}Attrs(size_t* size)\n"; - print F "{\n static WebCore::QualifiedName* $parameters{'namespace'}Attr[] = {\n"; + print F "\n\nWebCore::QualifiedName** get$parameters{namespace}Attrs(size_t* size)\n"; + print F "{\n static WebCore::QualifiedName* $parameters{namespace}Attr[] = {\n"; for my $name (sort keys %attrs) { print F " (WebCore::QualifiedName*)&${name}Attr,\n"; } print F " };\n"; print F " *size = ", scalar(keys %attrs), ";\n"; - print F " return $parameters{'namespace'}Attr;\n"; + print F " return $parameters{namespace}Attr;\n"; print F "}\n"; } @@ -549,16 +554,16 @@ print F "\nvoid init() AtomicString::init(); "; - print(F " AtomicString ${lowerNamespace}NS(\"$parameters{'namespaceURI'}\");\n\n"); + print(F " AtomicString ${lowerNamespace}NS(\"$parameters{namespaceURI}\");\n\n"); print(F " // Namespace\n"); print(F " new ((void*)&${lowerNamespace}NamespaceURI) AtomicString(${lowerNamespace}NS);\n\n"); if (keys %tags) { - my $tagsNamespace = $parameters{'tagsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS"; + my $tagsNamespace = $parameters{tagsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS"; printDefinitions($F, \%tags, "tags", $tagsNamespace); } if (keys %attrs) { - my $attrsNamespace = $parameters{'attrsNullNamespace'} ? "nullAtom" : "${lowerNamespace}NS"; + my $attrsNamespace = $parameters{attrsNullNamespace} ? "nullAtom" : "${lowerNamespace}NS"; printDefinitions($F, \%attrs, "attributes", $attrsNamespace); } @@ -572,7 +577,7 @@ sub printJSElementIncludes my %tagsSeen; for my $tagName (sort keys %tags) { - my $JSInterfaceName = $tags{$tagName}{"JSInterfaceName"}; + my $JSInterfaceName = $tags{$tagName}{JSInterfaceName}; next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName); $tagsSeen{$JSInterfaceName} = 1; @@ -586,7 +591,7 @@ sub printElementIncludes my %tagsSeen; for my $tagName (sort keys %tags) { - my $interfaceName = $tags{$tagName}{"interfaceName"}; + my $interfaceName = $tags{$tagName}{interfaceName}; next if defined($tagsSeen{$interfaceName}); $tagsSeen{$interfaceName} = 1; @@ -604,7 +609,7 @@ sub printDefinitionStrings my %names = %$namesRef; for my $name (sort keys %$namesRef) { - next if (!$parameters{'exportStrings'} and !$names{$name}{"exportString"}); + next if (!$parameters{exportStrings} and !$names{$name}{exportString}); my $realName = $name; $realName =~ s/_/-/g; @@ -625,7 +630,7 @@ sub printDefinitions my %names = %$namesRef; for my $name (sort keys %$namesRef) { - next if ($parameters{'exportStrings'} or $names{$name}{"exportString"}); + next if ($parameters{exportStrings} or $names{$name}{exportString}); my $realName = $name; $realName =~ s/_/-/g; @@ -651,39 +656,31 @@ printLicenseHeader($F); print F <<END #include "config.h" -#include "$parameters{'namespace'}ElementFactory.h" - -#include "$parameters{'namespace'}Names.h" -#if ENABLE(DASHBOARD_SUPPORT) -#include "Document.h" -#include "Settings.h" -#endif +#include "$parameters{namespace}ElementFactory.h" +#include "$parameters{namespace}Names.h" END ; -if ($parameters{'namespace'} eq "HTML") { - print F "#include \"HTMLFormElement.h\"\n"; -} - printElementIncludes($F); print F <<END #include <wtf/HashMap.h> +#if ENABLE(DASHBOARD_SUPPORT) +#include "Document.h" +#include "Settings.h" +#endif + namespace WebCore { -using namespace $parameters{'namespace'}Names; +using namespace $parameters{namespace}Names; END ; -print F "typedef PassRefPtr<$parameters{'namespace'}Element> (*ConstructorFunction)(const QualifiedName&, Document*"; - -if ($parameters{'namespace'} eq "HTML") { - print F ", HTMLFormElement*"; -} - +print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction)(const QualifiedName&, Document*"; +print F ", HTMLFormElement*" if $parameters{namespace} eq "HTML"; print F ", bool createdByParser);\n"; print F <<END typedef HashMap<AtomicStringImpl*, ConstructorFunction> FunctionMap; @@ -697,7 +694,7 @@ my %tagConstructorMap = buildConstructorMap(); printConstructors($F, \%tagConstructorMap); -print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; +print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END static void addTag(const QualifiedName& tag, ConstructorFunction func) @@ -705,10 +702,10 @@ static void addTag(const QualifiedName& tag, ConstructorFunction func) gFunctionMap->set(tag.localName().impl(), func); } -static inline void createFunctionMapIfNecessary() +static void createFunctionMap() { - if (gFunctionMap) - return; + ASSERT(!gFunctionMap); + // Create the table. gFunctionMap = new FunctionMap; @@ -719,30 +716,25 @@ END printFunctionInits($F, \%tagConstructorMap); print F "}\n"; -print F "#endif\n" if $parameters{'guardFactoryWith'}; - -print F "\nPassRefPtr<$parameters{'namespace'}Element> $parameters{'namespace'}ElementFactory::create$parameters{'namespace'}Element(const QualifiedName& qName, Document* doc"; - -if ($parameters{"namespace"} eq "HTML") { - print F ", HTMLFormElement* formElement"; -} +print F "#endif\n" if $parameters{guardFactoryWith}; +print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}ElementFactory::create$parameters{namespace}Element(const QualifiedName& qName, Document* document"; +print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML"; print F ", bool createdByParser)\n{\n"; -print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; +print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END - // Don't make elements without a document - if (!doc) + if (!document) return 0; END ; -if ($parameters{'namespace'} ne "HTML") { +if ($parameters{namespace} ne "HTML") { print F <<END #if ENABLE(DASHBOARD_SUPPORT) - Settings* settings = doc->settings(); + Settings* settings = document->settings(); if (settings && settings->usesDashboardBackwardCompatibilityMode()) return 0; #endif @@ -752,21 +744,21 @@ END } print F <<END - createFunctionMapIfNecessary(); - ConstructorFunction func = gFunctionMap->get(qName.localName().impl()); - if (func) + if (!gFunctionMap) + createFunctionMap(); + if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl())) END ; -if ($parameters{"namespace"} eq "HTML") { - print F " return func(qName, doc, formElement, createdByParser);\n"; +if ($parameters{namespace} eq "HTML") { + print F " return function(qName, document, formElement, createdByParser);\n"; } else { - print F " return func(qName, doc, createdByParser);\n"; + print F " return function(qName, document, createdByParser);\n"; } -print F " return new $parameters{'namespace'}Element(qName, doc);\n"; +print F " return new $parameters{namespace}Element(qName, document);\n"; -if ($parameters{'guardFactoryWith'}) { +if ($parameters{guardFactoryWith}) { print F <<END #else @@ -797,8 +789,8 @@ sub printFactoryHeaderFile printLicenseHeader($F); print F<<END -#ifndef $parameters{'namespace'}ElementFactory_h -#define $parameters{'namespace'}ElementFactory_h +#ifndef $parameters{namespace}ElementFactory_h +#define $parameters{namespace}ElementFactory_h #include <wtf/PassRefPtr.h> @@ -811,35 +803,29 @@ namespace WebCore { namespace WebCore { - class $parameters{'namespace'}Element; + class $parameters{namespace}Element; END ; -if ($parameters{'namespace'} eq "HTML") { - print F " class HTMLFormElement;\n"; -} +print F " class HTMLFormElement;\n" if $parameters{namespace} eq "HTML"; print F<<END // The idea behind this class is that there will eventually be a mapping from namespace URIs to ElementFactories that can dispense // elements. In a compound document world, the generic createElement function (will end up being virtual) will be called. - class $parameters{'namespace'}ElementFactory { + class $parameters{namespace}ElementFactory { public: PassRefPtr<Element> createElement(const WebCore::QualifiedName&, WebCore::Document*, bool createdByParser = true); END ; -print F " static PassRefPtr<$parameters{'namespace'}Element> create$parameters{'namespace'}Element(const WebCore::QualifiedName&, WebCore::Document*"; - -if ($parameters{'namespace'} eq "HTML") { - print F ", HTMLFormElement* = 0"; -} - +print F " static PassRefPtr<$parameters{namespace}Element> create$parameters{namespace}Element(const WebCore::QualifiedName&, WebCore::Document*"; +print F ", HTMLFormElement* = 0" if $parameters{namespace} eq "HTML"; print F ", bool /*createdByParser*/ = true);\n"; printf F<<END }; } -#endif // $parameters{'namespace'}ElementFactory_h +#endif // $parameters{namespace}ElementFactory_h END ; @@ -854,7 +840,7 @@ sub usesDefaultJSWrapper my $name = shift; # A tag reuses the default wrapper if its JSInterfaceName matches the default namespace Element. - return $tags{$name}{'JSInterfaceName'} eq $parameters{"namespace"} . "Element" || $tags{$name}{'JSInterfaceName'} eq "HTMLNoScriptElement"; + return $tags{$name}{JSInterfaceName} eq $parameters{namespace} . "Element" || $tags{$name}{JSInterfaceName} eq "HTMLNoScriptElement"; } sub printWrapperFunctions @@ -864,11 +850,11 @@ sub printWrapperFunctions my %tagsSeen; for my $tagName (sort keys %tags) { # Avoid defining the same wrapper method twice. - my $JSInterfaceName = $tags{$tagName}{"JSInterfaceName"}; + my $JSInterfaceName = $tags{$tagName}{JSInterfaceName}; next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($tagName); $tagsSeen{$JSInterfaceName} = 1; - my $conditional = $tags{$tagName}{"conditional"}; + my $conditional = $tags{$tagName}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n\n"; @@ -876,12 +862,12 @@ sub printWrapperFunctions # Hack for the media tags # FIXME: This should have been done via a CustomWrapper attribute and a separate *Custom file. - if ($tags{$tagName}{"wrapperOnlyIfMediaIsAvailable"}) { + if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { print F <<END -static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { if (!MediaPlayer::isAvailable()) - return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{'namespace'}Element, element.get()); + return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get()); return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get()); } @@ -889,7 +875,7 @@ END ; } else { print F <<END -static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, element.get()); } @@ -897,6 +883,7 @@ static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec END ; } + if ($conditional) { print F "#endif\n\n"; } @@ -913,13 +900,13 @@ sub printWrapperFactoryCppFile print F "#include \"config.h\"\n\n"; - print F "#if $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#include \"JS$parameters{'namespace'}ElementWrapperFactory.h\"\n"; + print F "#include \"JS$parameters{namespace}ElementWrapperFactory.h\"\n"; printJSElementIncludes($F); - print F "\n#include \"$parameters{'namespace'}Names.h\"\n\n"; + print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; printElementIncludes($F); @@ -930,9 +917,9 @@ using namespace JSC; namespace WebCore { -using namespace $parameters{'namespace'}Names; +using namespace $parameters{namespace}Names; -typedef JSNode* (*Create$parameters{'namespace'}ElementWrapperFunction)(ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{'namespace'}Element>); +typedef JSNode* (*Create$parameters{namespace}ElementWrapperFunction)(ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{namespace}Element>); END ; @@ -940,9 +927,9 @@ END printWrapperFunctions($F); print F <<END -JSNode* createJS$parameters{'namespace'}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{'namespace'}Element> element) +JSNode* createJS$parameters{namespace}Wrapper(ExecState* exec, JSDOMGlobalObject* globalObject, PassRefPtr<$parameters{namespace}Element> element) { - typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{'namespace'}ElementWrapperFunction> FunctionMap; + typedef HashMap<WebCore::AtomicStringImpl*, Create$parameters{namespace}ElementWrapperFunction> FunctionMap; DEFINE_STATIC_LOCAL(FunctionMap, map, ()); if (map.isEmpty()) { END @@ -952,13 +939,13 @@ END # Do not add the name to the map if it does not have a JS wrapper constructor or uses the default wrapper. next if usesDefaultJSWrapper($tag, \%tags); - my $conditional = $tags{$tag}{"conditional"}; + my $conditional = $tags{$tag}{conditional}; if ($conditional) { my $conditionalString = "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")"; print F "#if ${conditionalString}\n"; } - my $ucTag = $tags{$tag}{"JSInterfaceName"}; + my $ucTag = $tags{$tag}{JSInterfaceName}; print F " map.set(${tag}Tag.localName().impl(), create${ucTag}Wrapper);\n"; if ($conditional) { @@ -968,10 +955,10 @@ END print F <<END } - Create$parameters{'namespace'}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); + Create$parameters{namespace}ElementWrapperFunction createWrapperFunction = map.get(element->localName().impl()); if (createWrapperFunction) return createWrapperFunction(exec, globalObject, element); - return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{'namespace'}Element, element.get()); + return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace}Element, element.get()); } } @@ -979,7 +966,7 @@ END END ; - print F "#endif\n" if $parameters{'guardFactoryWith'}; + print F "#endif\n" if $parameters{guardFactoryWith}; close F; } @@ -992,10 +979,10 @@ sub printWrapperFactoryHeaderFile printLicenseHeader($F); - print F "#ifndef JS$parameters{'namespace'}ElementWrapperFactory_h\n"; - print F "#define JS$parameters{'namespace'}ElementWrapperFactory_h\n\n"; + print F "#ifndef JS$parameters{namespace}ElementWrapperFactory_h\n"; + print F "#define JS$parameters{namespace}ElementWrapperFactory_h\n\n"; - print F "#if $parameters{'guardFactoryWith'}\n" if $parameters{'guardFactoryWith'}; + print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWith}; print F <<END #include <wtf/Forward.h> @@ -1008,18 +995,18 @@ namespace WebCore { class JSNode; class JSDOMGlobalObject; - class $parameters{'namespace'}Element; + class $parameters{namespace}Element; - JSNode* createJS$parameters{'namespace'}Wrapper(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{'namespace'}Element>); + JSNode* createJS$parameters{namespace}Wrapper(JSC::ExecState*, JSDOMGlobalObject*, PassRefPtr<$parameters{namespace}Element>); } END ; - print F "#endif // $parameters{'guardFactoryWith'}\n\n" if $parameters{'guardFactoryWith'}; + print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith}; - print F "#endif // JS$parameters{'namespace'}ElementWrapperFactory_h\n"; + print F "#endif // JS$parameters{namespace}ElementWrapperFactory_h\n"; close F; } diff --git a/WebCore/editing/CompositeEditCommand.cpp b/WebCore/editing/CompositeEditCommand.cpp index 25f167c..aa658b9 100644 --- a/WebCore/editing/CompositeEditCommand.cpp +++ b/WebCore/editing/CompositeEditCommand.cpp @@ -519,7 +519,7 @@ void CompositeEditCommand::deleteInsignificantText(PassRefPtr<Text> textNode, un gapStart = max(gapStart, start); gapEnd = min(gapEnd, end); if (str.isNull()) - str = textNode->string()->substring(start, end - start); + str = textNode->data().substring(start, end - start); // remove text in the gap str.remove(gapStart - start - removed, gapLen); removed += gapLen; diff --git a/WebCore/editing/CreateLinkCommand.cpp b/WebCore/editing/CreateLinkCommand.cpp index 263feab..98d6c6d 100644 --- a/WebCore/editing/CreateLinkCommand.cpp +++ b/WebCore/editing/CreateLinkCommand.cpp @@ -51,7 +51,7 @@ void CreateLinkCommand::doApply() applyStyledElement(anchorElement.get()); } else { insertNodeAt(anchorElement.get(), endingSelection().start()); - RefPtr<Text> textNode = new Text(document(), m_url); + RefPtr<Text> textNode = Text::create(document(), m_url); appendNode(textNode.get(), anchorElement.get()); setEndingSelection(VisibleSelection(positionBeforeNode(anchorElement.get()), positionAfterNode(anchorElement.get()), DOWNSTREAM)); } diff --git a/WebCore/editing/DeleteButtonController.cpp b/WebCore/editing/DeleteButtonController.cpp index 725c01d..c472552 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 = new HTMLDivElement(divTag, m_target->document()); - container->setId(containerElementIdentifier); + container->setAttribute(idAttr, containerElementIdentifier); CSSMutableStyleDeclaration* style = container->getInlineStyleDecl(); style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone); @@ -202,7 +202,7 @@ void DeleteButtonController::createDeletionUI() style->setProperty(CSSPropertyLeft, "0"); RefPtr<HTMLDivElement> outline = new HTMLDivElement(divTag, m_target->document()); - outline->setId(outlineElementIdentifier); + outline->setAttribute(idAttr, outlineElementIdentifier); const int borderWidth = 4; const int borderRadius = 6; @@ -225,7 +225,7 @@ void DeleteButtonController::createDeletionUI() return; RefPtr<DeleteButton> button = new DeleteButton(m_target->document()); - button->setId(buttonElementIdentifier); + button->setAttribute(idAttr, buttonElementIdentifier); const int buttonWidth = 30; const int buttonHeight = 30; diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp index 55750ff..90070dd 100644 --- a/WebCore/editing/EditorCommand.cpp +++ b/WebCore/editing/EditorCommand.cpp @@ -40,6 +40,7 @@ #include "FormatBlockCommand.h" #include "Frame.h" #include "HTMLFontElement.h" +#include "HTMLHRElement.h" #include "HTMLImageElement.h" #include "IndentOutdentCommand.h" #include "InsertListCommand.h" @@ -198,7 +199,7 @@ static bool executeInsertFragment(Frame* frame, PassRefPtr<DocumentFragment> fra static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content) { - RefPtr<DocumentFragment> fragment = new DocumentFragment(frame->document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(frame->document()); ExceptionCode ec = 0; fragment->appendChild(content, ec); if (ec) @@ -467,9 +468,9 @@ static bool executeInsertBacktab(Frame* frame, Event* event, EditorCommandSource static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSource, const String& value) { - RefPtr<HTMLElement> hr = new HTMLElement(hrTag, frame->document()); + RefPtr<HTMLHRElement> hr = new HTMLHRElement(hrTag, frame->document()); if (!value.isEmpty()) - hr->setId(value); + hr->setAttribute(idAttr, value); return executeInsertNode(frame, hr.release()); } diff --git a/WebCore/editing/SplitTextNodeCommand.cpp b/WebCore/editing/SplitTextNodeCommand.cpp index 07a54e3..3b04e01 100644 --- a/WebCore/editing/SplitTextNodeCommand.cpp +++ b/WebCore/editing/SplitTextNodeCommand.cpp @@ -55,7 +55,7 @@ void SplitTextNodeCommand::doApply() if (prefixText.isEmpty()) return; - RefPtr<Text> prefixTextNode = new Text(document(), prefixText); + RefPtr<Text> prefixTextNode = Text::create(document(), prefixText); ASSERT(prefixTextNode); document()->copyMarkers(m_text2.get(), 0, m_offset, prefixTextNode.get(), 0); diff --git a/WebCore/editing/haiku/EditorHaiku.cpp b/WebCore/editing/haiku/EditorHaiku.cpp index 17fde1f..723d4ff 100644 --- a/WebCore/editing/haiku/EditorHaiku.cpp +++ b/WebCore/editing/haiku/EditorHaiku.cpp @@ -28,9 +28,8 @@ #include "config.h" #include "Editor.h" -#include "ClipboardAccessPolicy.h" #include "Clipboard.h" - +#include "ClipboardAccessPolicy.h" #include "ClipboardHaiku.h" @@ -38,7 +37,7 @@ namespace WebCore { PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) { - return new ClipboardHaiku(policy, false); + return ClipboardHaiku::create(policy, false); } } // namespace WebCore diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp index 14ce7f6..2b963ef 100644 --- a/WebCore/editing/markup.cpp +++ b/WebCore/editing/markup.cpp @@ -420,7 +420,7 @@ static void appendStartMarkup(Vector<UChar>& result, const Node* node, const Ran case Node::COMMENT_NODE: // FIXME: Comment content is not escaped, but XMLSerializer (and possibly other callers) should raise an exception if it includes "-->". append(result, "<!--"); - append(result, static_cast<const Comment*>(node)->nodeValue()); + append(result, static_cast<const Comment*>(node)->data()); append(result, "-->"); break; case Node::DOCUMENT_NODE: diff --git a/WebCore/html/CollectionType.h b/WebCore/html/CollectionType.h index e5973a3..9d7bb54 100644 --- a/WebCore/html/CollectionType.h +++ b/WebCore/html/CollectionType.h @@ -51,6 +51,7 @@ enum CollectionType { TSectionRows, // all row elements in this table section TRCells, // all cells in this row SelectOptions, + DataListOptions, MapAreas, OtherCollection diff --git a/WebCore/html/HTMLAreaElement.cpp b/WebCore/html/HTMLAreaElement.cpp index b878a1a..b2e4129 100644 --- a/WebCore/html/HTMLAreaElement.cpp +++ b/WebCore/html/HTMLAreaElement.cpp @@ -36,7 +36,6 @@ using namespace HTMLNames; HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* document) : HTMLAnchorElement(tagName, document) - , m_coords(0) , m_coordsLen(0) , m_lastSize(-1, -1) , m_shape(Unknown) @@ -46,7 +45,6 @@ HTMLAreaElement::HTMLAreaElement(const QualifiedName& tagName, Document* documen HTMLAreaElement::~HTMLAreaElement() { - delete [] m_coords; } void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr) @@ -61,8 +59,7 @@ void HTMLAreaElement::parseMappedAttribute(MappedAttribute* attr) else if (equalIgnoringCase(attr->value(), "rect")) m_shape = Rect; } else if (attr->name() == coordsAttr) { - delete [] m_coords; - m_coords = newCoordsArray(attr->value().string(), m_coordsLen); + m_coords.set(newCoordsArray(attr->value().string(), m_coordsLen)); } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) { // Do nothing. } else diff --git a/WebCore/html/HTMLAreaElement.h b/WebCore/html/HTMLAreaElement.h index fffd45e..fd308b6 100644 --- a/WebCore/html/HTMLAreaElement.h +++ b/WebCore/html/HTMLAreaElement.h @@ -25,6 +25,7 @@ #include "HTMLAnchorElement.h" #include "IntSize.h" +#include <wtf/OwnArrayPtr.h> namespace WebCore { @@ -58,7 +59,7 @@ private: Path getRegion(const IntSize&) const; OwnPtr<Path> m_region; - Length* m_coords; + OwnArrayPtr<Length> m_coords; int m_coordsLen; IntSize m_lastSize; Shape m_shape; diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp index be6663f..df26d93 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -338,7 +338,7 @@ EventListener* HTMLBodyElement::onblur() const void HTMLBodyElement::setOnblur(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().blurEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); } EventListener* HTMLBodyElement::onerror() const @@ -348,7 +348,7 @@ EventListener* HTMLBodyElement::onerror() const void HTMLBodyElement::setOnerror(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().errorEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); } EventListener* HTMLBodyElement::onfocus() const @@ -358,7 +358,7 @@ EventListener* HTMLBodyElement::onfocus() const void HTMLBodyElement::setOnfocus(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().focusEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); } EventListener* HTMLBodyElement::onload() const @@ -368,7 +368,7 @@ EventListener* HTMLBodyElement::onload() const void HTMLBodyElement::setOnload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().loadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); } EventListener* HTMLBodyElement::onbeforeunload() const @@ -378,9 +378,19 @@ EventListener* HTMLBodyElement::onbeforeunload() const void HTMLBodyElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().beforeunloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); } +EventListener* HTMLBodyElement::onhashchange() const +{ + return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); +} + +void HTMLBodyElement::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* HTMLBodyElement::onmessage() const { return document()->getWindowAttributeEventListener(eventNames().messageEvent); @@ -388,7 +398,7 @@ EventListener* HTMLBodyElement::onmessage() const void HTMLBodyElement::setOnmessage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().messageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); } EventListener* HTMLBodyElement::onoffline() const @@ -398,7 +408,7 @@ EventListener* HTMLBodyElement::onoffline() const void HTMLBodyElement::setOnoffline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().offlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); } EventListener* HTMLBodyElement::ononline() const @@ -408,7 +418,7 @@ EventListener* HTMLBodyElement::ononline() const void HTMLBodyElement::setOnonline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().onlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); } EventListener* HTMLBodyElement::onresize() const @@ -418,7 +428,7 @@ EventListener* HTMLBodyElement::onresize() const void HTMLBodyElement::setOnresize(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().resizeEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); } EventListener* HTMLBodyElement::onstorage() const @@ -428,7 +438,7 @@ EventListener* HTMLBodyElement::onstorage() const void HTMLBodyElement::setOnstorage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().storageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); } EventListener* HTMLBodyElement::onunload() const @@ -438,7 +448,7 @@ EventListener* HTMLBodyElement::onunload() const void HTMLBodyElement::setOnunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().unloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); } } // namespace WebCore diff --git a/WebCore/html/HTMLBodyElement.h b/WebCore/html/HTMLBodyElement.h index 575d562..d5efab3 100644 --- a/WebCore/html/HTMLBodyElement.h +++ b/WebCore/html/HTMLBodyElement.h @@ -57,6 +57,8 @@ public: void setOnbeforeunload(PassRefPtr<EventListener>); EventListener* onmessage() const; void setOnmessage(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onoffline() const; void setOnoffline(PassRefPtr<EventListener>); EventListener* ononline() const; diff --git a/WebCore/html/HTMLBodyElement.idl b/WebCore/html/HTMLBodyElement.idl index 097b4ac..7be6803 100644 --- a/WebCore/html/HTMLBodyElement.idl +++ b/WebCore/html/HTMLBodyElement.idl @@ -36,6 +36,7 @@ module html { #if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler attributes attribute [DontEnum] EventListener onbeforeunload; + attribute [DontEnum] EventListener onhashchange; attribute [DontEnum] EventListener onmessage; attribute [DontEnum] EventListener onoffline; attribute [DontEnum] EventListener ononline; @@ -43,10 +44,15 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; + // Overrides of Element attributes (left in for completeness). + // attribute [DontEnum] EventListener onblur; + // attribute [DontEnum] EventListener onerror; + // attribute [DontEnum] EventListener onfocus; + // attribute [DontEnum] EventListener onload; + // Not implemented yet. // attribute [DontEnum] EventListener onafterprint; // attribute [DontEnum] EventListener onbeforeprint; - // attribute [DontEnum] EventListener onhashchange; // attribute [DontEnum] EventListener onpopstate; // attribute [DontEnum] EventListener onredo; // attribute [DontEnum] EventListener onundo; diff --git a/WebCore/html/HTMLCanvasElement.h b/WebCore/html/HTMLCanvasElement.h index bba1f2d..6961957 100644 --- a/WebCore/html/HTMLCanvasElement.h +++ b/WebCore/html/HTMLCanvasElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Alp Toker <alp@atoker.com> * * Redistribution and use in source and binary forms, with or without @@ -35,7 +35,6 @@ namespace WebCore { class CanvasRenderingContext2D; -typedef CanvasRenderingContext2D CanvasRenderingContext; class FloatPoint; class FloatRect; class FloatSize; @@ -45,9 +44,11 @@ class ImageBuffer; class IntPoint; class IntSize; +typedef CanvasRenderingContext2D CanvasRenderingContext; + class CanvasObserver { public: - virtual ~CanvasObserver() {}; + virtual ~CanvasObserver() { } virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0; virtual void canvasResized(HTMLCanvasElement*) = 0; @@ -59,11 +60,6 @@ public: HTMLCanvasElement(const QualifiedName&, Document*); virtual ~HTMLCanvasElement(); -#if ENABLE(DASHBOARD_SUPPORT) - virtual HTMLTagStatus endTagRequirement() const; - virtual int tagPriority() const; -#endif - int width() const { return m_size.width(); } int height() const { return m_size.height(); } void setWidth(int); @@ -73,10 +69,7 @@ public: CanvasRenderingContext* getContext(const String&); - virtual void parseMappedAttribute(MappedAttribute*); - virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - - IntSize size() const { return m_size; } + const IntSize& size() const { return m_size; } void setSize(const IntSize& size) { if (size == m_size) @@ -103,15 +96,26 @@ public: void setOriginTainted() { m_originClean = false; } bool originClean() const { return m_originClean; } - static const float MaxCanvasArea; - - void setObserver(CanvasObserver* o) { m_observer = o; } + void setObserver(CanvasObserver* observer) { m_observer = observer; } TransformationMatrix baseTransform() const; + + CanvasRenderingContext2D* renderingContext2D() { return m_2DContext.get(); } + private: +#if ENABLE(DASHBOARD_SUPPORT) + virtual HTMLTagStatus endTagRequirement() const; + virtual int tagPriority() const; +#endif + + virtual void parseMappedAttribute(MappedAttribute*); + virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); + void createImageBuffer() const; void reset(); + static const float MaxCanvasArea; + bool m_rendererIsCanvas; OwnPtr<CanvasRenderingContext2D> m_2DContext; diff --git a/WebCore/html/HTMLCanvasElement.idl b/WebCore/html/HTMLCanvasElement.idl index 13fc623..4b1b057 100644 --- a/WebCore/html/HTMLCanvasElement.idl +++ b/WebCore/html/HTMLCanvasElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 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 @@ -26,6 +26,7 @@ module html { interface [ + CustomMarkFunction, GenerateConstructor, InterfaceUUID=a14d88c8-c6af-4e34-ad17-659700c77a10, ImplementationUUID=7ae731bc-c264-4ee3-a4b4-5d4540af26c3 diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp index de4c424..76de60a 100644 --- a/WebCore/html/HTMLCollection.cpp +++ b/WebCore/html/HTMLCollection.cpp @@ -27,6 +27,7 @@ #include "HTMLElement.h" #include "HTMLNames.h" #include "HTMLObjectElement.h" +#include "HTMLOptionElement.h" #include "NodeList.h" #include <utility> @@ -104,6 +105,7 @@ Element* HTMLCollection::itemAfter(Element* previous) const case MapAreas: case OtherCollection: case SelectOptions: + case DataListOptions: case WindowNamedItems: break; case NodeChildren: @@ -153,6 +155,13 @@ Element* HTMLCollection::itemAfter(Element* previous) const if (e->hasLocalName(optionTag)) return e; break; + case DataListOptions: + if (e->hasLocalName(optionTag)) { + HTMLOptionElement* option = static_cast<HTMLOptionElement*>(e); + if (!option->disabled() && !option->value().isEmpty()) + return e; + } + break; case MapAreas: if (e->hasLocalName(areaTag)) return e; diff --git a/WebCore/html/HTMLDataListElement.cpp b/WebCore/html/HTMLDataListElement.cpp new file mode 100644 index 0000000..a6ca525 --- /dev/null +++ b/WebCore/html/HTMLDataListElement.cpp @@ -0,0 +1,60 @@ +/* + * 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(DATALIST) +#include "HTMLDataListElement.h" + +#include "HTMLNames.h" + +namespace WebCore { + +HTMLDataListElement::HTMLDataListElement(const QualifiedName& tagName, Document *doc) + : HTMLElement(tagName, doc) +{ +} + +HTMLDataListElement::~HTMLDataListElement() +{ +} + +bool HTMLDataListElement::checkDTD(const Node* newChild) +{ + return newChild->hasTagName(HTMLNames::optionTag) || HTMLElement::inInlineTagList(newChild); +} + +PassRefPtr<HTMLCollection> HTMLDataListElement::options() +{ + return HTMLCollection::create(this, DataListOptions); +} + +} // namespace WebCore + +#endif // ENABLE(DATALIST) diff --git a/WebCore/html/HTMLDataListElement.h b/WebCore/html/HTMLDataListElement.h new file mode 100644 index 0000000..8c4cfbc --- /dev/null +++ b/WebCore/html/HTMLDataListElement.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef HTMLDataListElement_h +#define HTMLDataListElement_h + +#if ENABLE(DATALIST) + +#include "HTMLCollection.h" +#include "HTMLElement.h" + +namespace WebCore { + + class HTMLDataListElement : public HTMLElement { + public: + HTMLDataListElement(const QualifiedName&, Document*); + virtual ~HTMLDataListElement(); + PassRefPtr<HTMLCollection> options(); + + private: + virtual bool checkDTD(const Node*); + }; + +} // namespace WebCore + +#endif // ENABLE(DATALIST) + +#endif // HTMLDataListElement_h diff --git a/WebCore/html/HTMLDataListElement.idl b/WebCore/html/HTMLDataListElement.idl new file mode 100644 index 0000000..916c0a1 --- /dev/null +++ b/WebCore/html/HTMLDataListElement.idl @@ -0,0 +1,38 @@ +/* + * 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. + */ + +module html { + interface [ + GenerateConstructor, + Conditional=DATALIST + ] HTMLDataListElement : HTMLElement { + readonly attribute HTMLCollection options; + }; +} diff --git a/WebCore/html/HTMLDocument.cpp b/WebCore/html/HTMLDocument.cpp index 2457c4f..c995bbb 100644 --- a/WebCore/html/HTMLDocument.cpp +++ b/WebCore/html/HTMLDocument.cpp @@ -114,14 +114,14 @@ String HTMLDocument::dir() HTMLElement* b = body(); if (!b) return String(); - return b->dir(); + return b->getAttribute(dirAttr); } void HTMLDocument::setDir(const String& value) { HTMLElement* b = body(); if (b) - b->setDir(value); + b->setAttribute(dirAttr, value); } String HTMLDocument::designMode() const diff --git a/WebCore/html/HTMLDocument.h b/WebCore/html/HTMLDocument.h index eda7593..4b14d0c 100644 --- a/WebCore/html/HTMLDocument.h +++ b/WebCore/html/HTMLDocument.h @@ -37,7 +37,7 @@ class HTMLDocument : public Document, public CachedResourceClient { public: static PassRefPtr<HTMLDocument> create(Frame* frame) { - return new HTMLDocument(frame); + return adoptRef(new HTMLDocument(frame)); } virtual ~HTMLDocument(); @@ -71,10 +71,6 @@ public: void captureEvents(); void releaseEvents(); - virtual bool childAllowed(Node*); - - virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); - void addNamedItem(const AtomicString& name); void removeNamedItem(const AtomicString& name); bool hasNamedItem(AtomicStringImpl* name); @@ -87,6 +83,10 @@ protected: HTMLDocument(Frame*); private: + virtual bool childAllowed(Node*); + + virtual PassRefPtr<Element> createElement(const AtomicString& tagName, ExceptionCode&); + virtual bool isHTMLDocument() const { return true; } virtual bool isFrameSet() const; virtual Tokenizer* createTokenizer(); diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp index b310cad..7a23d94 100644 --- a/WebCore/html/HTMLElement.cpp +++ b/WebCore/html/HTMLElement.cpp @@ -257,7 +257,7 @@ PassRefPtr<DocumentFragment> HTMLElement::createContextualFragment(const String hasLocalName(headTag) || hasLocalName(styleTag) || hasLocalName(titleTag)) return 0; - RefPtr<DocumentFragment> fragment = new DocumentFragment(document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); if (document()->isHTMLDocument()) parseHTMLDocumentFragment(html, fragment.get()); @@ -319,7 +319,7 @@ static void replaceChildrenWithFragment(HTMLElement* element, PassRefPtr<Documen } if (hasOneTextChild(element) && hasOneTextChild(fragment.get())) { - static_cast<Text*>(element->firstChild())->setData(static_cast<Text*>(fragment->firstChild())->string(), ec); + static_cast<Text*>(element->firstChild())->setData(static_cast<Text*>(fragment->firstChild())->data(), ec); return; } @@ -339,7 +339,7 @@ static void replaceChildrenWithText(HTMLElement* element, const String& text, Ex return; } - RefPtr<Text> textNode = new Text(element->document(), text); + RefPtr<Text> textNode = Text::create(element->document(), text); if (hasOneChild(element)) { element->replaceChild(textNode.release(), element->firstChild(), ec); @@ -425,7 +425,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) // Add text nodes and <br> elements. ec = 0; - RefPtr<DocumentFragment> fragment = new DocumentFragment(document()); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(document()); int lineStart = 0; UChar prev = 0; int length = text.length(); @@ -433,7 +433,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) UChar c = text[i]; if (c == '\n' || c == '\r') { if (i > lineStart) { - fragment->appendChild(new Text(document(), text.substring(lineStart, i - lineStart)), ec); + fragment->appendChild(Text::create(document(), text.substring(lineStart, i - lineStart)), ec); if (ec) return; } @@ -447,7 +447,7 @@ void HTMLElement::setInnerText(const String& text, ExceptionCode& ec) prev = c; } if (length > lineStart) - fragment->appendChild(new Text(document(), text.substring(lineStart, length - lineStart)), ec); + fragment->appendChild(Text::create(document(), text.substring(lineStart, length - lineStart)), ec); replaceChildrenWithFragment(this, fragment.release(), ec); } @@ -475,7 +475,7 @@ void HTMLElement::setOuterText(const String &text, ExceptionCode& ec) // FIXME: This creates a new text node even when the text is empty. // FIXME: This creates a single text node even when the text has CR and LF // characters in it. Instead it should create <br> elements. - RefPtr<Text> t = new Text(document(), text); + RefPtr<Text> t = Text::create(document(), text); ec = 0; parent->replaceChild(t, this, ec); if (ec) @@ -737,56 +737,11 @@ void HTMLElement::accessKeyAction(bool sendToAnyElement) dispatchSimulatedClick(0, true); } -String HTMLElement::id() const -{ - return getAttribute(idAttr); -} - -void HTMLElement::setId(const String& value) -{ - setAttribute(idAttr, value); -} - String HTMLElement::title() const { return getAttribute(titleAttr); } -void HTMLElement::setTitle(const String& value) -{ - setAttribute(titleAttr, value); -} - -String HTMLElement::lang() const -{ - return getAttribute(langAttr); -} - -void HTMLElement::setLang(const String& value) -{ - setAttribute(langAttr, value); -} - -String HTMLElement::dir() const -{ - return getAttribute(dirAttr); -} - -void HTMLElement::setDir(const String &value) -{ - setAttribute(dirAttr, value); -} - -String HTMLElement::className() const -{ - return getAttribute(classAttr); -} - -void HTMLElement::setClassName(const String &value) -{ - setAttribute(classAttr, value); -} - short HTMLElement::tabIndex() const { if (supportsFocus()) @@ -894,6 +849,7 @@ static HashSet<AtomicStringImpl*>* inlineTagList() tagList.add(textareaTag.localName().impl()); tagList.add(labelTag.localName().impl()); tagList.add(buttonTag.localName().impl()); + tagList.add(datalistTag.localName().impl()); tagList.add(insTag.localName().impl()); tagList.add(delTag.localName().impl()); tagList.add(nobrTag.localName().impl()); diff --git a/WebCore/html/HTMLElement.h b/WebCore/html/HTMLElement.h index 21b3bb5..d7485e8 100644 --- a/WebCore/html/HTMLElement.h +++ b/WebCore/html/HTMLElement.h @@ -47,16 +47,7 @@ public: PassRefPtr<HTMLCollection> children(); - String id() const; - void setId(const String&); virtual String title() const; - void setTitle(const String&); - String lang() const; - void setLang(const String&); - String dir() const; - void setDir(const String&); - String className() const; - void setClassName(const String&); virtual short tabIndex() const; void setTabIndex(int); diff --git a/WebCore/html/HTMLEmbedElement.idl b/WebCore/html/HTMLEmbedElement.idl index a38402c..05c10db 100644 --- a/WebCore/html/HTMLEmbedElement.idl +++ b/WebCore/html/HTMLEmbedElement.idl @@ -29,17 +29,17 @@ module html { InterfaceUUID=18f9bd58-6bb3-4b5c-aa30-6da13adfc91e, ImplementationUUID=93e0407a-8380-4ff0-978d-f773f2dee6a3 ] HTMLEmbedElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; + attribute [ConvertNullToNullString, Reflect] DOMString align; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString] DOMString height; + attribute [ConvertNullToNullString, Reflect] DOMString height; #else attribute [ConvertFromString] long height; #endif - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString src; - attribute [ConvertNullToNullString] DOMString type; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString type; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString width; #else attribute [ConvertFromString] long width; #endif diff --git a/WebCore/html/HTMLFormControlElement.cpp b/WebCore/html/HTMLFormControlElement.cpp index 09d91df..3d8bc78 100644 --- a/WebCore/html/HTMLFormControlElement.cpp +++ b/WebCore/html/HTMLFormControlElement.cpp @@ -294,6 +294,11 @@ HTMLFormElement* HTMLFormControlElement::virtualForm() const return m_form; } +bool HTMLFormControlElement::isDefaultButtonForForm() const +{ + return isSuccessfulSubmitButton() && m_form && m_form->defaultButton() == this; +} + void HTMLFormControlElement::removeFromForm() { if (!m_form) diff --git a/WebCore/html/HTMLFormControlElement.h b/WebCore/html/HTMLFormControlElement.h index a30f46c..902bbf3 100644 --- a/WebCore/html/HTMLFormControlElement.h +++ b/WebCore/html/HTMLFormControlElement.h @@ -117,6 +117,7 @@ protected: private: virtual HTMLFormElement* virtualForm() const; + virtual bool isDefaultButtonForForm() const; HTMLFormElement* m_form; RefPtr<ValidityState> m_validityState; diff --git a/WebCore/html/HTMLFormElement.cpp b/WebCore/html/HTMLFormElement.cpp index 54986b0..51fb35f 100644 --- a/WebCore/html/HTMLFormElement.cpp +++ b/WebCore/html/HTMLFormElement.cpp @@ -577,6 +577,17 @@ void HTMLFormElement::setTarget(const String &value) setAttribute(targetAttr, value); } +HTMLFormControlElement* HTMLFormElement::defaultButton() const +{ + for (unsigned i = 0; i < formElements.size(); ++i) { + HTMLFormControlElement* control = formElements[i]; + if (control->isSuccessfulSubmitButton()) + return control; + } + + return 0; +} + PassRefPtr<HTMLFormControlElement> HTMLFormElement::elementForAlias(const AtomicString& alias) { if (alias.isEmpty() || !m_elementAliases) diff --git a/WebCore/html/HTMLFormElement.h b/WebCore/html/HTMLFormElement.h index 6b7812a..afe1ff0 100644 --- a/WebCore/html/HTMLFormElement.h +++ b/WebCore/html/HTMLFormElement.h @@ -107,6 +107,8 @@ public: virtual String target() const; void setTarget(const String&); + + HTMLFormControlElement* defaultButton() const; PassRefPtr<HTMLFormControlElement> elementForAlias(const AtomicString&); void addElementAlias(HTMLFormControlElement*, const AtomicString& alias); diff --git a/WebCore/html/HTMLFrameElement.cpp b/WebCore/html/HTMLFrameElement.cpp index adc3ff1..d87386f 100644 --- a/WebCore/html/HTMLFrameElement.cpp +++ b/WebCore/html/HTMLFrameElement.cpp @@ -1,9 +1,9 @@ -/** +/* * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann (hausmann@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2006, 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 @@ -38,6 +38,7 @@ HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document* docum : HTMLFrameElementBase(tagName, document) , m_frameBorder(true) , m_frameBorderSet(false) + , m_noResize(false) { ASSERT(hasTagName(frameTag)); } @@ -45,7 +46,7 @@ HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document* docum bool HTMLFrameElement::rendererIsNeeded(RenderStyle*) { // For compatibility, frames render even when display: none is set. - return isURLAllowed(m_URL); + return isURLAllowed(); } RenderObject* HTMLFrameElement::createRenderer(RenderArena* arena, RenderStyle*) @@ -79,8 +80,20 @@ void HTMLFrameElement::parseMappedAttribute(MappedAttribute *attr) m_frameBorder = attr->value().toInt(); m_frameBorderSet = !attr->isNull(); // FIXME: If we are already attached, this has no effect. + } else if (attr->name() == noresizeAttr) { + m_noResize = true; + // FIXME: If we are already attached, this has no effect. + // FIXME: Since this does not check attr->isNull(), it can + // never reset m_noResize to false if the attribute is removed. + // FIXME: There seems to be no code that looks at this + // value and prevents resizing. } else HTMLFrameElementBase::parseMappedAttribute(attr); } +void HTMLFrameElement::setNoResize(bool noResize) +{ + setAttribute(noresizeAttr, noResize ? "" : 0); +} + } // namespace WebCore diff --git a/WebCore/html/HTMLFrameElement.h b/WebCore/html/HTMLFrameElement.h index ab602ee..23b5acb 100644 --- a/WebCore/html/HTMLFrameElement.h +++ b/WebCore/html/HTMLFrameElement.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2004, 2006 Apple Computer, Inc. + * Copyright (C) 2004, 2006, 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 @@ -49,9 +49,14 @@ public: bool hasFrameBorder() const { return m_frameBorder; } + bool noResize() const { return m_noResize; } + void setNoResize(bool); + private: bool m_frameBorder; bool m_frameBorderSet; + + bool m_noResize; }; } // namespace WebCore diff --git a/WebCore/html/HTMLFrameElement.idl b/WebCore/html/HTMLFrameElement.idl index 106e57e..d0076eb 100644 --- a/WebCore/html/HTMLFrameElement.idl +++ b/WebCore/html/HTMLFrameElement.idl @@ -26,14 +26,14 @@ module html { ImplementationUUID=38c9e3c8-3384-40b6-a484-cb845c48b67d ] HTMLFrameElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString frameBorder; - attribute [ConvertNullToNullString] DOMString longDesc; - attribute [ConvertNullToNullString] DOMString marginHeight; - attribute [ConvertNullToNullString] DOMString marginWidth; - attribute [ConvertNullToNullString] DOMString name; + attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; + attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; + attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; + attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; + attribute [ConvertNullToNullString, Reflect] DOMString name; attribute boolean noResize; - attribute [ConvertNullToNullString] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString scrolling; + attribute [ConvertNullToNullString, CustomSetter, ReflectURL] DOMString src; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp index a4f0a5e..282dee3 100644 --- a/WebCore/html/HTMLFrameElementBase.cpp +++ b/WebCore/html/HTMLFrameElementBase.cpp @@ -50,18 +50,17 @@ HTMLFrameElementBase::HTMLFrameElementBase(const QualifiedName& tagName, Documen , m_scrolling(ScrollbarAuto) , m_marginWidth(-1) , m_marginHeight(-1) - , m_noResize(false) , m_viewSource(false) , m_shouldOpenURLAfterAttach(false) { } -bool HTMLFrameElementBase::isURLAllowed(const AtomicString& URLString) const +bool HTMLFrameElementBase::isURLAllowed() const { - if (URLString.isEmpty()) + if (m_URL.isEmpty()) return true; - const KURL& completeURL = document()->completeURL(URLString); + const KURL& completeURL = document()->completeURL(m_URL); // Don't allow more than 200 total frames in a set. This seems // like a reasonable upper bound, and otherwise mutually recursive @@ -93,7 +92,7 @@ void HTMLFrameElementBase::openURL() { ASSERT(!m_frameName.isEmpty()); - if (!isURLAllowed(m_URL)) + if (!isURLAllowed()) return; if (m_URL.isEmpty()) @@ -127,9 +126,6 @@ void HTMLFrameElementBase::parseMappedAttribute(MappedAttribute *attr) } else if (attr->name() == marginheightAttr) { m_marginHeight = attr->value().toInt(); // FIXME: If we are already attached, this has no effect. - } else if (attr->name() == noresizeAttr) { - m_noResize = true; - // FIXME: If we are already attached, this has no effect. } else if (attr->name() == scrollingAttr) { // Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling." if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes")) @@ -283,11 +279,6 @@ void HTMLFrameElementBase::setName(const String &value) setAttribute(nameAttr, value); } -void HTMLFrameElementBase::setNoResize(bool noResize) -{ - setAttribute(noresizeAttr, noResize ? "" : 0); -} - String HTMLFrameElementBase::scrolling() const { return getAttribute(scrollingAttr); diff --git a/WebCore/html/HTMLFrameElementBase.h b/WebCore/html/HTMLFrameElementBase.h index 4a24451..ad55ee1 100644 --- a/WebCore/html/HTMLFrameElementBase.h +++ b/WebCore/html/HTMLFrameElementBase.h @@ -2,7 +2,7 @@ * Copyright (C) 1999 Lars Knoll (knoll@kde.org) * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann <hausmann@kde.org> - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 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 @@ -67,9 +67,6 @@ public: String name() const; void setName(const String&); - bool noResize() const { return m_noResize; } - void setNoResize(bool); - String scrolling() const; void setScrolling(const String&); @@ -84,7 +81,7 @@ public: protected: HTMLFrameElementBase(const QualifiedName&, Document*); - bool isURLAllowed(const AtomicString&) const; + bool isURLAllowed() const; void setNameAndOpenURL(); void openURL(); @@ -98,7 +95,6 @@ protected: int m_marginWidth; int m_marginHeight; - bool m_noResize; bool m_viewSource; bool m_shouldOpenURLAfterAttach; diff --git a/WebCore/html/HTMLFrameSetElement.cpp b/WebCore/html/HTMLFrameSetElement.cpp index a8f544b..235bb9f 100644 --- a/WebCore/html/HTMLFrameSetElement.cpp +++ b/WebCore/html/HTMLFrameSetElement.cpp @@ -240,7 +240,7 @@ EventListener* HTMLFrameSetElement::onblur() const void HTMLFrameSetElement::setOnblur(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().blurEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().blurEvent, eventListener); } EventListener* HTMLFrameSetElement::onerror() const @@ -250,7 +250,7 @@ EventListener* HTMLFrameSetElement::onerror() const void HTMLFrameSetElement::setOnerror(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().errorEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().errorEvent, eventListener); } EventListener* HTMLFrameSetElement::onfocus() const @@ -260,9 +260,19 @@ EventListener* HTMLFrameSetElement::onfocus() const void HTMLFrameSetElement::setOnfocus(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().focusEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().focusEvent, eventListener); } +EventListener* HTMLFrameSetElement::onhashchange() const +{ + return document()->getWindowAttributeEventListener(eventNames().hashchangeEvent); +} + +void HTMLFrameSetElement::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* HTMLFrameSetElement::onload() const { return document()->getWindowAttributeEventListener(eventNames().loadEvent); @@ -270,7 +280,7 @@ EventListener* HTMLFrameSetElement::onload() const void HTMLFrameSetElement::setOnload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().loadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().loadEvent, eventListener); } EventListener* HTMLFrameSetElement::onbeforeunload() const @@ -280,7 +290,7 @@ EventListener* HTMLFrameSetElement::onbeforeunload() const void HTMLFrameSetElement::setOnbeforeunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().beforeunloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, eventListener); } EventListener* HTMLFrameSetElement::onmessage() const @@ -290,7 +300,7 @@ EventListener* HTMLFrameSetElement::onmessage() const void HTMLFrameSetElement::setOnmessage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().messageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().messageEvent, eventListener); } EventListener* HTMLFrameSetElement::onoffline() const @@ -300,7 +310,7 @@ EventListener* HTMLFrameSetElement::onoffline() const void HTMLFrameSetElement::setOnoffline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().offlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().offlineEvent, eventListener); } EventListener* HTMLFrameSetElement::ononline() const @@ -310,7 +320,7 @@ EventListener* HTMLFrameSetElement::ononline() const void HTMLFrameSetElement::setOnonline(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().onlineEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().onlineEvent, eventListener); } EventListener* HTMLFrameSetElement::onresize() const @@ -320,7 +330,7 @@ EventListener* HTMLFrameSetElement::onresize() const void HTMLFrameSetElement::setOnresize(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().resizeEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().resizeEvent, eventListener); } EventListener* HTMLFrameSetElement::onstorage() const @@ -330,7 +340,7 @@ EventListener* HTMLFrameSetElement::onstorage() const void HTMLFrameSetElement::setOnstorage(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().storageEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().storageEvent, eventListener); } EventListener* HTMLFrameSetElement::onunload() const @@ -340,7 +350,7 @@ EventListener* HTMLFrameSetElement::onunload() const void HTMLFrameSetElement::setOnunload(PassRefPtr<EventListener> eventListener) { - document()->setAttributeEventListener(eventNames().unloadEvent, eventListener); + document()->setWindowAttributeEventListener(eventNames().unloadEvent, eventListener); } } // namespace WebCore diff --git a/WebCore/html/HTMLFrameSetElement.h b/WebCore/html/HTMLFrameSetElement.h index 4319c7a..b51e702 100644 --- a/WebCore/html/HTMLFrameSetElement.h +++ b/WebCore/html/HTMLFrameSetElement.h @@ -79,6 +79,8 @@ public: EventListener* onbeforeunload() const; void setOnbeforeunload(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onmessage() const; void setOnmessage(PassRefPtr<EventListener>); EventListener* onoffline() const; diff --git a/WebCore/html/HTMLFrameSetElement.idl b/WebCore/html/HTMLFrameSetElement.idl index 4050f2c..0375c0a 100644 --- a/WebCore/html/HTMLFrameSetElement.idl +++ b/WebCore/html/HTMLFrameSetElement.idl @@ -33,6 +33,7 @@ module html { #if !defined(LANGUAGE_COM) || !LANGUAGE_COM // Event handler attributes attribute [DontEnum] EventListener onbeforeunload; + attribute [DontEnum] EventListener onhashchange; attribute [DontEnum] EventListener onmessage; attribute [DontEnum] EventListener onoffline; attribute [DontEnum] EventListener ononline; @@ -40,7 +41,7 @@ module html { attribute [DontEnum] EventListener onstorage; attribute [DontEnum] EventListener onunload; - // Overrides of Element attributes. + // Overrides of Element attributes (left in for completeness). // attribute [DontEnum] EventListener onblur; // attribute [DontEnum] EventListener onerror; // attribute [DontEnum] EventListener onfocus; @@ -49,7 +50,6 @@ module html { // Not implemented yet. // attribute [DontEnum] EventListener onafterprint; // attribute [DontEnum] EventListener onbeforeprint; - // attribute [DontEnum] EventListener onhashchange; // attribute [DontEnum] EventListener onpopstate; // attribute [DontEnum] EventListener onredo; // attribute [DontEnum] EventListener onundo; diff --git a/WebCore/html/HTMLIFrameElement.cpp b/WebCore/html/HTMLIFrameElement.cpp index 478925a..123b134 100644 --- a/WebCore/html/HTMLIFrameElement.cpp +++ b/WebCore/html/HTMLIFrameElement.cpp @@ -3,7 +3,7 @@ * (C) 1999 Antti Koivisto (koivisto@kde.org) * (C) 2000 Simon Hausmann (hausmann@kde.org) * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2006, 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 @@ -89,7 +89,7 @@ void HTMLIFrameElement::parseMappedAttribute(MappedAttribute* attr) bool HTMLIFrameElement::rendererIsNeeded(RenderStyle* style) { - return isURLAllowed(m_URL) && style->display() != NONE; + return isURLAllowed() && style->display() != NONE; } RenderObject* HTMLIFrameElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/WebCore/html/HTMLIFrameElement.idl b/WebCore/html/HTMLIFrameElement.idl index b5684ca..e288b54 100644 --- a/WebCore/html/HTMLIFrameElement.idl +++ b/WebCore/html/HTMLIFrameElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -26,16 +26,16 @@ module html { ImplementationUUID=370c6318-f804-49f9-bc8a-46b99cd87399 ] HTMLIFrameElement : HTMLElement { - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString frameBorder; - attribute [ConvertNullToNullString] DOMString height; - attribute [ConvertNullToNullString] DOMString longDesc; - attribute [ConvertNullToNullString] DOMString marginHeight; - attribute [ConvertNullToNullString] DOMString marginWidth; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString scrolling; - attribute [ConvertNullToNullString, CustomSetter] DOMString src; - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString align; + attribute [ConvertNullToNullString, Reflect=frameborder] DOMString frameBorder; + attribute [ConvertNullToNullString, Reflect] DOMString height; + attribute [ConvertNullToNullString, Reflect=longdesc] DOMString longDesc; + attribute [ConvertNullToNullString, Reflect=marginheight] DOMString marginHeight; + attribute [ConvertNullToNullString, Reflect=marginwidth] DOMString marginWidth; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString scrolling; + attribute [ConvertNullToNullString, CustomSetter, Reflect] DOMString src; + attribute [ConvertNullToNullString, Reflect] DOMString width; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp index 5173964..932e718 100644 --- a/WebCore/html/HTMLImageElement.cpp +++ b/WebCore/html/HTMLImageElement.cpp @@ -279,46 +279,11 @@ bool HTMLImageElement::isURLAttribute(Attribute* attr) const || (attr->name() == usemapAttr && attr->value().string()[0] != '#'); } -String HTMLImageElement::name() const -{ - return getAttribute(nameAttr); -} - -void HTMLImageElement::setName(const String& value) -{ - setAttribute(nameAttr, value); -} - -String HTMLImageElement::align() const -{ - return getAttribute(alignAttr); -} - -void HTMLImageElement::setAlign(const String& value) -{ - setAttribute(alignAttr, value); -} - -String HTMLImageElement::alt() const +const AtomicString& HTMLImageElement::alt() const { return getAttribute(altAttr); } -void HTMLImageElement::setAlt(const String& value) -{ - setAttribute(altAttr, value); -} - -String HTMLImageElement::border() const -{ - return getAttribute(borderAttr); -} - -void HTMLImageElement::setBorder(const String& value) -{ - setAttribute(borderAttr, value); -} - bool HTMLImageElement::draggable() const { // Image elements are draggable by default. @@ -381,16 +346,6 @@ void HTMLImageElement::setSrc(const String& value) setAttribute(srcAttr, value); } -String HTMLImageElement::useMap() const -{ - return getAttribute(usemapAttr); -} - -void HTMLImageElement::setUseMap(const String& value) -{ - setAttribute(usemapAttr, value); -} - int HTMLImageElement::vspace() const { // ### return actual vspace @@ -439,7 +394,8 @@ void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons HTMLElement::addSubresourceAttributeURLs(urls); addSubresourceURL(urls, src()); - addSubresourceURL(urls, document()->completeURL(useMap())); + // FIXME: What about when the usemap attribute begins with "#"? + addSubresourceURL(urls, document()->completeURL(getAttribute(usemapAttr))); } } diff --git a/WebCore/html/HTMLImageElement.h b/WebCore/html/HTMLImageElement.h index 5e82186..f58574d 100644 --- a/WebCore/html/HTMLImageElement.h +++ b/WebCore/html/HTMLImageElement.h @@ -69,17 +69,7 @@ public: void setLoadManually(bool loadManually) { m_imageLoader.setLoadManually(loadManually); } - String name() const; - void setName(const String&); - - String align() const; - void setAlign(const String&); - - String alt() const; - void setAlt(const String&); - - String border() const; - void setBorder(const String&); + const AtomicString& alt() const; virtual bool draggable() const; @@ -100,9 +90,6 @@ public: KURL src() const; void setSrc(const String&); - String useMap() const; - void setUseMap(const String&); - int vspace() const; void setVspace(int); diff --git a/WebCore/html/HTMLKeygenElement.cpp b/WebCore/html/HTMLKeygenElement.cpp index b1b6238..6af088f 100644 --- a/WebCore/html/HTMLKeygenElement.cpp +++ b/WebCore/html/HTMLKeygenElement.cpp @@ -51,7 +51,7 @@ HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Document* doc for (Vector<String>::const_iterator it = keys.begin(); it != end; ++it) { HTMLOptionElement* o = new HTMLOptionElement(optionTag, doc, form()); addChild(o); - o->addChild(new Text(doc, *it)); + o->addChild(Text::create(doc, *it)); } } diff --git a/WebCore/html/HTMLObjectElement.idl b/WebCore/html/HTMLObjectElement.idl index 1880836..d3fb5c0 100644 --- a/WebCore/html/HTMLObjectElement.idl +++ b/WebCore/html/HTMLObjectElement.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> * * This library is free software; you can redistribute it and/or @@ -30,22 +30,22 @@ module html { ImplementationUUID=2dd24554-6784-4ef9-9713-179f3d37b2f9 ] HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; - attribute [ConvertNullToNullString] DOMString code; - attribute [ConvertNullToNullString] DOMString align; - attribute [ConvertNullToNullString] DOMString archive; - attribute [ConvertNullToNullString] DOMString border; - attribute [ConvertNullToNullString] DOMString codeBase; - attribute [ConvertNullToNullString] DOMString codeType; - attribute [ConvertNullToNullString] DOMString data; + attribute [ConvertNullToNullString, Reflect] DOMString code; + attribute [ConvertNullToNullString, Reflect] DOMString align; + attribute [ConvertNullToNullString, Reflect] DOMString archive; + attribute [ConvertNullToNullString, Reflect] DOMString border; + attribute [ConvertNullToNullString, Reflect=codebase] DOMString codeBase; + attribute [ConvertNullToNullString, Reflect=codetype] DOMString codeType; + attribute [ConvertNullToNullString, ReflectURL] DOMString data; attribute boolean declare; - attribute [ConvertNullToNullString] DOMString height; + attribute [ConvertNullToNullString, Reflect] DOMString height; attribute long hspace; - attribute [ConvertNullToNullString] DOMString name; - attribute [ConvertNullToNullString] DOMString standby; - attribute [ConvertNullToNullString] DOMString type; - attribute [ConvertNullToNullString] DOMString useMap; + attribute [ConvertNullToNullString, Reflect] DOMString name; + attribute [ConvertNullToNullString, Reflect] DOMString standby; + attribute [ConvertNullToNullString, Reflect] DOMString type; + attribute [ConvertNullToNullString, Reflect=usemap] DOMString useMap; attribute long vspace; - attribute [ConvertNullToNullString] DOMString width; + attribute [ConvertNullToNullString, Reflect] DOMString width; // Introduced in DOM Level 2: readonly attribute [CheckFrameSecurity] Document contentDocument; diff --git a/WebCore/html/HTMLOptionElement.cpp b/WebCore/html/HTMLOptionElement.cpp index 009db47..091b1a5 100644 --- a/WebCore/html/HTMLOptionElement.cpp +++ b/WebCore/html/HTMLOptionElement.cpp @@ -92,7 +92,7 @@ void HTMLOptionElement::setText(const String &text, ExceptionCode& ec) } removeChildren(); - appendChild(new Text(document(), text), ec); + appendChild(Text::create(document(), text), ec); } void HTMLOptionElement::accessKeyAction(bool) diff --git a/WebCore/html/HTMLParser.cpp b/WebCore/html/HTMLParser.cpp index 722f4e2..b12c09b 100644 --- a/WebCore/html/HTMLParser.cpp +++ b/WebCore/html/HTMLParser.cpp @@ -692,13 +692,13 @@ typedef HashMap<AtomicStringImpl*, CreateErrorCheckFunc> FunctionMap; bool HTMLParser::textCreateErrorCheck(Token* t, RefPtr<Node>& result) { - result = new Text(m_document, t->text.get()); + result = Text::create(m_document, t->text.get()); return false; } bool HTMLParser::commentCreateErrorCheck(Token* t, RefPtr<Node>& result) { - result = new Comment(m_document, t->text.get()); + result = Comment::create(m_document, t->text.get()); return false; } @@ -1093,6 +1093,7 @@ bool HTMLParser::isAffectedByResidualStyle(const AtomicString& tagName) unaffectedTags.add(selectTag.localName().impl()); unaffectedTags.add(objectTag.localName().impl()); unaffectedTags.add(datagridTag.localName().impl()); + unaffectedTags.add(datalistTag.localName().impl()); } return !unaffectedTags.contains(tagName.impl()); @@ -1598,7 +1599,7 @@ PassRefPtr<Node> HTMLParser::handleIsindex(Token* t) } n->addChild(new HTMLHRElement(hrTag, m_document)); - n->addChild(new Text(m_document, text)); + n->addChild(Text::create(m_document, text)); n->addChild(isIndex.release()); n->addChild(new HTMLHRElement(hrTag, m_document)); diff --git a/WebCore/html/HTMLTagNames.in b/WebCore/html/HTMLTagNames.in index c066e3c..ed75652 100644 --- a/WebCore/html/HTMLTagNames.in +++ b/WebCore/html/HTMLTagNames.in @@ -26,6 +26,7 @@ code interfaceName=HTMLElement col interfaceName=HTMLTableColElement colgroup interfaceName=HTMLTableColElement datagrid interfaceName=HTMLDataGridElement,conditional=DATAGRID +datalist interfaceName=HTMLDataListElement,conditional=DATALIST dcell interfaceName=HTMLDataGridCellElement,conditional=DATAGRID dcol interfaceName=HTMLDataGridColElement,conditional=DATAGRID drow interfaceName=HTMLDataGridRowElement,conditional=DATAGRID diff --git a/WebCore/html/HTMLViewSourceDocument.cpp b/WebCore/html/HTMLViewSourceDocument.cpp index 13404cc..55c6df7 100644 --- a/WebCore/html/HTMLViewSourceDocument.cpp +++ b/WebCore/html/HTMLViewSourceDocument.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 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 @@ -47,9 +47,6 @@ using namespace HTMLNames; HTMLViewSourceDocument::HTMLViewSourceDocument(Frame* frame, const String& mimeType) : HTMLDocument(frame) , m_type(mimeType) - , m_current(0) - , m_tbody(0) - , m_td(0) { setUsesBeforeAfterRules(true); } @@ -70,23 +67,23 @@ Tokenizer* HTMLViewSourceDocument::createTokenizer() void HTMLViewSourceDocument::createContainingTable() { - RefPtr<Element> html = new HTMLHtmlElement(htmlTag, this); + RefPtr<HTMLHtmlElement> html = new HTMLHtmlElement(htmlTag, this); addChild(html); html->attach(); - RefPtr<Element> body = new HTMLBodyElement(bodyTag, this); + RefPtr<HTMLBodyElement> body = new HTMLBodyElement(bodyTag, this); html->addChild(body); body->attach(); // Create a line gutter div that can be used to make sure the gutter extends down the height of the whole // document. - RefPtr<Element> div = new HTMLDivElement(divTag, this); + RefPtr<HTMLDivElement> div = new HTMLDivElement(divTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-gutter-backdrop")); div->setAttributeMap(attrs.release()); body->addChild(div); div->attach(); - RefPtr<Element> table = new HTMLTableElement(tableTag, this); + RefPtr<HTMLTableElement> table = new HTMLTableElement(tableTag, this); body->addChild(table); table->attach(); m_tbody = new HTMLTableSectionElement(tbodyTag, this); @@ -205,31 +202,31 @@ void HTMLViewSourceDocument::addViewSourceDoctypeToken(DoctypeToken* doctypeToke addText(text, "webkit-html-doctype"); } -Element* HTMLViewSourceDocument::addSpanWithClassName(const String& className) +PassRefPtr<Element> HTMLViewSourceDocument::addSpanWithClassName(const String& className) { if (m_current == m_tbody) { addLine(className); return m_current; } - Element* span = new HTMLElement(spanTag, this); + RefPtr<HTMLElement> span = new HTMLElement(spanTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, className)); span->setAttributeMap(attrs.release()); m_current->addChild(span); span->attach(); - return span; + return span.release(); } void HTMLViewSourceDocument::addLine(const String& className) { // Create a table row. - RefPtr<Element> trow = new HTMLTableRowElement(trTag, this); + RefPtr<HTMLTableRowElement> trow = new HTMLTableRowElement(trTag, this); m_tbody->addChild(trow); trow->attach(); // Create a cell that will hold the line number (it is generated in the stylesheet using counters). - Element* td = new HTMLTableCellElement(tdTag, this); + RefPtr<HTMLTableCellElement> td = new HTMLTableCellElement(tdTag, this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); attrs->addAttribute(MappedAttribute::create(classAttr, "webkit-line-number")); td->setAttributeMap(attrs.release()); @@ -246,7 +243,7 @@ void HTMLViewSourceDocument::addLine(const String& className) m_current = m_td = td; #ifdef DEBUG_LINE_NUMBERS - RefPtr<Text> lineNumberText = new Text(this, String::number(tokenizer()->lineNumber() + 1) + " "); + RefPtr<Text> lineNumberText = Text::create(this, String::number(tokenizer()->lineNumber() + 1) + " "); td->addChild(lineNumberText); lineNumberText->attach(); #endif @@ -277,7 +274,7 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className } if (m_current == m_tbody) addLine(className); - RefPtr<Text> t = new Text(this, substring); + RefPtr<Text> t = Text::create(this, substring); m_current->addChild(t); t->attach(); if (i < size - 1) @@ -289,13 +286,13 @@ void HTMLViewSourceDocument::addText(const String& text, const String& className m_current = m_tbody; } -Element* HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) +PassRefPtr<Element> HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) { if (m_current == m_tbody) addLine("webkit-html-tag"); // Now create a link for the attribute value instead of a span. - Element* anchor = new HTMLAnchorElement(aTag, this); + RefPtr<HTMLAnchorElement> anchor = new HTMLAnchorElement(this); RefPtr<NamedMappedAttrMap> attrs = NamedMappedAttrMap::create(); const char* classValue; if (isAnchor) @@ -308,7 +305,7 @@ Element* HTMLViewSourceDocument::addLink(const String& url, bool isAnchor) anchor->setAttributeMap(attrs.release()); m_current->addChild(anchor); anchor->attach(); - return anchor; + return anchor.release(); } } diff --git a/WebCore/html/HTMLViewSourceDocument.h b/WebCore/html/HTMLViewSourceDocument.h index 57a8f21..e4eadb0 100644 --- a/WebCore/html/HTMLViewSourceDocument.h +++ b/WebCore/html/HTMLViewSourceDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 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 @@ -30,18 +30,18 @@ namespace WebCore { class DoctypeToken; +class HTMLTableCellElement; +class HTMLTableSectionElement; + struct Token; class HTMLViewSourceDocument : public HTMLDocument { public: static PassRefPtr<HTMLViewSourceDocument> create(Frame* frame, const String& mimeType) { - return new HTMLViewSourceDocument(frame, mimeType); + return adoptRef(new HTMLViewSourceDocument(frame, mimeType)); } - // Returns HTMLTokenizer or TextTokenizer based on m_type. - virtual Tokenizer* createTokenizer(); - void addViewSourceToken(Token*); // Used by the HTML tokenizer. void addViewSourceText(const String&); // Used by the plaintext tokenizer. void addViewSourceDoctypeToken(DoctypeToken*); @@ -49,16 +49,19 @@ public: private: HTMLViewSourceDocument(Frame*, const String& mimeType); + // Returns HTMLTokenizer or TextTokenizer based on m_type. + virtual Tokenizer* createTokenizer(); + void createContainingTable(); - Element* addSpanWithClassName(const String&); + PassRefPtr<Element> addSpanWithClassName(const String&); void addLine(const String& className); void addText(const String& text, const String& className); - Element* addLink(const String& url, bool isAnchor); + PassRefPtr<Element> addLink(const String& url, bool isAnchor); String m_type; - Element* m_current; - Element* m_tbody; - Element* m_td; + RefPtr<Element> m_current; + RefPtr<HTMLTableSectionElement> m_tbody; + RefPtr<HTMLTableCellElement> m_td; }; } diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp index 20718e9..7203e12 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -1278,8 +1278,13 @@ static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) return data.get(); } -PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh) const +PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionCode& ec) const { + ec = 0; + if (!isfinite(sw) || !isfinite(sh)) { + ec = NOT_SUPPORTED_ERR; + return 0; + } FloatSize unscaledSize(sw, sh); IntSize scaledSize = m_canvas->convertLogicalToDevice(unscaledSize); if (scaledSize.width() < 1) @@ -1306,7 +1311,7 @@ PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, ImageBuffer* buffer = m_canvas ? m_canvas->buffer() : 0; if (!buffer) return createEmptyImageData(scaledRect.size()); - return buffer->getImageData(scaledRect); + return buffer->getUnmultipliedImageData(scaledRect); } void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, ExceptionCode& ec) @@ -1357,7 +1362,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, sourceRect.move(-destOffset); IntPoint destPoint(destOffset.width(), destOffset.height()); - buffer->putImageData(data, sourceRect, destPoint); + buffer->putUnmultipliedImageData(data, sourceRect, destPoint); } String CanvasRenderingContext2D::font() const diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.h b/WebCore/html/canvas/CanvasRenderingContext2D.h index 9648ffc..7c47e55 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.h +++ b/WebCore/html/canvas/CanvasRenderingContext2D.h @@ -178,7 +178,7 @@ namespace WebCore { PassRefPtr<CanvasPattern> createPattern(HTMLImageElement*, const String& repetitionType, ExceptionCode&); PassRefPtr<CanvasPattern> createPattern(HTMLCanvasElement*, const String& repetitionType, ExceptionCode&); - PassRefPtr<ImageData> createImageData(float width, float height) const; + PassRefPtr<ImageData> createImageData(float width, float height, ExceptionCode&) const; PassRefPtr<ImageData> getImageData(float sx, float sy, float sw, float sh, ExceptionCode&) const; void putImageData(ImageData*, float dx, float dy, ExceptionCode&); void putImageData(ImageData*, float dx, float dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, ExceptionCode&); diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.idl b/WebCore/html/canvas/CanvasRenderingContext2D.idl index a86b47d..0428054 100644 --- a/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -113,7 +113,8 @@ module html { attribute [Custom] custom fillStyle; // pixel manipulation - ImageData createImageData(in float sw, in float sh); + ImageData createImageData(in float sw, in float sh) + raises (DOMException); ImageData getImageData(in float sx, in float sy, in float sw, in float sh) raises(DOMException); [Custom] void putImageData(/* in ImageData imagedata, in float dx, in float dy [, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight] */); diff --git a/WebCore/inspector/InspectorBackend.cpp b/WebCore/inspector/InspectorBackend.cpp index 1eb10e8..ae2596a 100644 --- a/WebCore/inspector/InspectorBackend.cpp +++ b/WebCore/inspector/InspectorBackend.cpp @@ -30,6 +30,10 @@ #include "config.h" #include "InspectorBackend.h" +#if ENABLE(DATABASE) +#include "Database.h" +#endif + #include "Element.h" #include "Frame.h" #include "FrameLoader.h" @@ -37,8 +41,13 @@ #include "InspectorClient.h" #include "InspectorController.h" #include "InspectorDOMAgent.h" +#include "InspectorFrontend.h" #include "InspectorResource.h" +#if ENABLE(DOM_STORAGE) +#include "Storage.h" +#endif + #if ENABLE(JAVASCRIPT_DEBUGGER) #include "JavaScriptCallFrame.h" #include "JavaScriptDebugServer.h" @@ -139,10 +148,10 @@ bool InspectorBackend::addSourceToFrame(const String& mimeType, const String& so return true; } -void InspectorBackend::clearMessages() +void InspectorBackend::clearMessages(bool clearUI) { if (m_inspectorController) - m_inspectorController->clearConsoleMessages(); + m_inspectorController->clearConsoleMessages(clearUI); } void InspectorBackend::toggleNodeSearch() @@ -182,10 +191,10 @@ bool InspectorBackend::searchingForNode() return false; } -void InspectorBackend::loaded(bool enableDOMAgent) +void InspectorBackend::loaded() { if (m_inspectorController) - m_inspectorController->scriptObjectReady(enableDOMAgent); + m_inspectorController->scriptObjectReady(); } void InspectorBackend::enableResourceTracking(bool always) @@ -355,10 +364,10 @@ void InspectorBackend::stepOutOfFunctionInDebugger() #endif -void InspectorBackend::getChildNodes(long callId, long elementId) +void InspectorBackend::getChildNodes(long callId, long nodeId) { if (m_inspectorController) - m_inspectorController->domAgent()->getChildNodes(callId, elementId); + m_inspectorController->domAgent()->getChildNodes(callId, nodeId); } void InspectorBackend::setAttribute(long callId, long elementId, const String& name, const String& value) @@ -373,16 +382,87 @@ void InspectorBackend::removeAttribute(long callId, long elementId, const String m_inspectorController->domAgent()->removeAttribute(callId, elementId, name); } -void InspectorBackend::setTextNodeValue(long callId, long elementId, const String& value) +void InspectorBackend::setTextNodeValue(long callId, long nodeId, const String& value) { if (m_inspectorController) - m_inspectorController->domAgent()->setTextNodeValue(callId, elementId, value); + m_inspectorController->domAgent()->setTextNodeValue(callId, nodeId, value); } -void InspectorBackend::highlight(Node* node) +void InspectorBackend::highlight(long nodeId) +{ + if (m_inspectorController) { + Node* node = m_inspectorController->domAgent()->nodeForId(nodeId); + if (node) + m_inspectorController->highlight(node); + } +} + +Node* InspectorBackend::nodeForId(long nodeId) { if (m_inspectorController) - m_inspectorController->highlight(node); + return m_inspectorController->domAgent()->nodeForId(nodeId); + return 0; } +long InspectorBackend::idForNode(Node* node) +{ + if (m_inspectorController) + return m_inspectorController->domAgent()->idForNode(node); + return -1; +} + +ScriptValue InspectorBackend::wrapObject(const ScriptValue& object) +{ + if (m_inspectorController) + return m_inspectorController->wrapObject(object); + return ScriptValue(); +} + +ScriptValue InspectorBackend::unwrapObject(const String& objectId) +{ + if (m_inspectorController) + return m_inspectorController->unwrapObject(objectId); + return ScriptValue(); +} + +long InspectorBackend::pushNodePathToFrontend(Node* node, bool selectInUI) +{ + if (!m_inspectorController) + return 0; + if (!m_inspectorController->m_domAgent || !m_inspectorController->m_frontend) + return 0; + long id = m_inspectorController->m_domAgent->pushNodePathToFrontend(node); + if (selectInUI) + m_inspectorController->m_frontend->updateFocusedNode(id); + return id; +} + +void InspectorBackend::addNodesToSearchResult(const String& nodeIds) +{ + if (m_inspectorController && m_inspectorController->m_frontend) + m_inspectorController->m_frontend->addNodesToSearchResult(nodeIds); +} + +#if ENABLE(DATABASE) +void InspectorBackend::selectDatabase(Database* database) +{ + if (!m_inspectorController) + return; + if (!m_inspectorController->m_frontend) + return; + m_inspectorController->m_frontend->selectDatabase(database); +} +#endif + +#if ENABLE(DOM_STORAGE) +void InspectorBackend::selectDOMStorage(Storage* storage) +{ + if (!m_inspectorController) + return; + if (!m_inspectorController->m_frontend) + return; + m_inspectorController->m_frontend->selectDOMStorage(storage); +} +#endif + } // namespace WebCore diff --git a/WebCore/inspector/InspectorBackend.h b/WebCore/inspector/InspectorBackend.h index daa16b4..c40e1b9 100644 --- a/WebCore/inspector/InspectorBackend.h +++ b/WebCore/inspector/InspectorBackend.h @@ -38,10 +38,12 @@ namespace WebCore { class CachedResource; +class Database; class InspectorClient; class InspectorDOMAgent; class JavaScriptCallFrame; class Node; +class Storage; class InspectorBackend : public RefCounted<InspectorBackend> { @@ -69,7 +71,7 @@ public: void addResourceSourceToFrame(long identifier, Node* frame); bool addSourceToFrame(const String& mimeType, const String& source, Node* frame); - void clearMessages(); + void clearMessages(bool clearUI); void toggleNodeSearch(); @@ -82,7 +84,7 @@ public: bool searchingForNode(); - void loaded(bool enableDOMAgent); + void loaded(); void enableResourceTracking(bool always); void disableResourceTracking(bool always); @@ -123,13 +125,25 @@ public: void stepOutOfFunctionInDebugger(); #endif - void getChildNodes(long callId, long elementId); + void getChildNodes(long callId, long nodeId); void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); - void setTextNodeValue(long callId, long elementId, const String& value); + void setTextNodeValue(long callId, long nodeId, const String& value); // Generic code called from custom implementations. - void highlight(Node* node); + void highlight(long nodeId); + Node* nodeForId(long nodeId); + long idForNode(Node* node); + ScriptValue wrapObject(const ScriptValue& object); + ScriptValue unwrapObject(const String& objectId); + long pushNodePathToFrontend(Node* node, bool selectInUI); + void addNodesToSearchResult(const String& nodeIds); +#if ENABLE(DATABASE) + void selectDatabase(Database* database); +#endif +#if ENABLE(DOM_STORAGE) + void selectDOMStorage(Storage* storage); +#endif private: InspectorBackend(InspectorController* inspectorController, InspectorClient* client); diff --git a/WebCore/inspector/InspectorBackend.idl b/WebCore/inspector/InspectorBackend.idl index bae1f26..942819e 100644 --- a/WebCore/inspector/InspectorBackend.idl +++ b/WebCore/inspector/InspectorBackend.idl @@ -35,14 +35,14 @@ module core { GenerateConstructor ] InspectorBackend { void hideDOMNodeHighlight(); - [Custom] void highlightDOMNode(in Node node); - void loaded(in boolean enableDOMAgent); + [Custom] void highlightDOMNode(in long nodeId); + void loaded(); void windowUnloading(); void attach(); void detach(); void closeWindow(); - void clearMessages(); + void clearMessages(in boolean clearUI); void toggleNodeSearch(); boolean isWindowVisible(); @@ -68,6 +68,9 @@ module core { void disableResourceTracking(in boolean always); void storeLastActivePanel(in DOMString panelName); + [Custom] Array cookies(); + [Custom] void deleteCookie(in DOMString cookieName); + #if defined(ENABLE_JAVASCRIPT_DEBUGGER) && ENABLE_JAVASCRIPT_DEBUGGER boolean debuggerEnabled(); void enableDebugger(in boolean always); @@ -97,9 +100,23 @@ module core { [Custom] Array profiles(); #endif - void getChildNodes(in long callId, in long elementId); + void getChildNodes(in long callId, in long nodeId); void setAttribute(in long callId, in long elementId, in DOMString name, in DOMString value); void removeAttribute(in long callId, in long elementId, in DOMString name); - void setTextNodeValue(in long callId, in long elementId, in DOMString value); + void setTextNodeValue(in long callId, in long nodeId, in DOMString value); + + // Called from InjectedScript. + [Custom] DOMObject nodeForId(in long nodeId); + [Custom] long idForNode(in DOMObject node); + [Custom] long wrapObject(in DOMObject object); + [Custom] DOMObject unwrapObject(in long objectId); + [Custom] int pushNodePathToFrontend(in DOMObject node, in boolean selectInUI); + void addNodesToSearchResult(in DOMString nodeIds); +#if defined(ENABLE_DATABASE) && ENABLE_DATABASE + [Custom] void selectDatabase(in DOMObject database); +#endif +#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE + [Custom] void selectDOMStorage(in DOMObject storage); +#endif }; - } +} diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp index c3351e5..3035d4e 100644 --- a/WebCore/inspector/InspectorController.cpp +++ b/WebCore/inspector/InspectorController.cpp @@ -61,7 +61,9 @@ #include "ResourceRequest.h" #include "ResourceResponse.h" #include "ScriptCallStack.h" +#include "ScriptFunctionCall.h" #include "ScriptObject.h" +#include "ScriptObjectQuarantine.h" #include "ScriptString.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -125,6 +127,7 @@ InspectorController::InspectorController(Page* page, InspectorClient* client) , m_resourceTrackingEnabled(false) , m_resourceTrackingSettingsLoaded(false) , m_inspectorBackend(InspectorBackend::create(this, client)) + , m_lastBoundObjectId(1) #if ENABLE(JAVASCRIPT_DEBUGGER) , m_debuggerEnabled(false) , m_attachDebuggerWhenShown(false) @@ -270,7 +273,8 @@ void InspectorController::focusNode() ASSERT(m_frontend); ASSERT(m_nodeToFocus); - m_frontend->updateFocusedNode(m_nodeToFocus.get()); + long id = m_domAgent->pushNodePathToFrontend(m_nodeToFocus.get()); + m_frontend->updateFocusedNode(id); m_nodeToFocus = 0; } @@ -378,12 +382,15 @@ void InspectorController::addConsoleMessage(ScriptState* scriptState, ConsoleMes m_previousMessage->addToConsole(m_frontend.get()); } -void InspectorController::clearConsoleMessages() +void InspectorController::clearConsoleMessages(bool clearUI) { deleteAllValues(m_consoleMessages); m_consoleMessages.clear(); m_previousMessage = 0; m_groupLevel = 0; + m_idToConsoleObject.clear(); + if (clearUI && m_frontend) + m_frontend->clearConsoleMessages(); } void InspectorController::startGroup(MessageSource source, ScriptCallStack* callStack) @@ -492,14 +499,6 @@ void InspectorController::handleMousePressOnNode(Node* node) inspect(node); } -void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) -{ - if (!enabled() || !m_frontend) - return; - - m_frontend->inspectedWindowScriptObjectCleared(frame); -} - void InspectorController::windowScriptObjectAvailable() { if (!m_page || !enabled()) @@ -511,7 +510,7 @@ void InspectorController::windowScriptObjectAvailable() ScriptGlobalObject::set(m_scriptState, "InspectorController", m_inspectorBackend.get()); } -void InspectorController::scriptObjectReady(bool enableDOMAgent) +void InspectorController::scriptObjectReady() { ASSERT(m_scriptState); if (!m_scriptState) @@ -520,9 +519,10 @@ void InspectorController::scriptObjectReady(bool enableDOMAgent) ScriptObject webInspectorObj; if (!ScriptGlobalObject::get(m_scriptState, "WebInspector", webInspectorObj)) return; - setFrontendProxyObject(m_scriptState, webInspectorObj); - if (enableDOMAgent) - m_domAgent = new InspectorDOMAgent(m_frontend.get()); + ScriptObject injectedScriptObj; + if (!ScriptGlobalObject::get(m_scriptState, "InjectedScript", injectedScriptObj)) + return; + setFrontendProxyObject(m_scriptState, webInspectorObj, injectedScriptObj); #if ENABLE(JAVASCRIPT_DEBUGGER) Setting debuggerEnabled = setting(debuggerEnabledSettingName); @@ -539,9 +539,12 @@ void InspectorController::scriptObjectReady(bool enableDOMAgent) m_client->inspectorWindowObjectCleared(); } -void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj) +void InspectorController::setFrontendProxyObject(ScriptState* scriptState, ScriptObject webInspectorObj, ScriptObject injectedScriptObj) { - m_frontend.set(new InspectorFrontend(scriptState, webInspectorObj)); + m_scriptState = scriptState; + m_injectedScriptObj = injectedScriptObj; + m_frontend.set(new InspectorFrontend(this, scriptState, webInspectorObj)); + m_domAgent = new InspectorDOMAgent(m_frontend.get()); } void InspectorController::show() @@ -595,10 +598,8 @@ void InspectorController::close() closeWindow(); m_frontend.set(0); - if (m_domAgent) { - m_domAgent->setDocument(0); - m_domAgent = 0; - } + m_injectedScriptObj = ScriptObject(); + m_domAgent = 0; m_scriptState = 0; } @@ -649,8 +650,8 @@ void InspectorController::populateScriptObjects() (*it)->bind(m_frontend.get()); #endif - if (m_domAgent) - m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + if (m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) + resetInjectedScript(); m_frontend->populateInterface(); } @@ -706,7 +707,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (loader->frame() == m_inspectedPage->mainFrame()) { m_client->inspectedURLChanged(loader->url().string()); - clearConsoleMessages(); + clearConsoleMessages(false); m_times.clear(); m_counts.clear(); @@ -725,7 +726,7 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) if (windowVisible()) { resetScriptObjects(); - if (!loader->isLoadingFromCachedPage()) { + if (!loader->frameLoader()->isLoadingFromCachedPage()) { ASSERT(m_mainResource && m_mainResource->isSameLoader(loader)); // We don't add the main resource until its load is committed. This is // needed to keep the load for a user-entered URL from showing up in the @@ -740,8 +741,8 @@ void InspectorController::didCommitLoad(DocumentLoader* loader) } } - if (m_domAgent) - m_domAgent->setDocument(m_inspectedPage->mainFrame()->document()); + if (m_domAgent && m_domAgent->setDocument(m_inspectedPage->mainFrame()->document())) + resetInjectedScript(); } for (Frame* frame = loader->frame(); frame; frame = frame->tree()->traverseNext(loader->frame())) @@ -859,7 +860,7 @@ void InspectorController::identifierForInitialRequest(unsigned long identifier, addResource(resource.get()); - if (windowVisible() && loader->isLoadingFromCachedPage() && resource == m_mainResource) + if (windowVisible() && loader->frameLoader()->isLoadingFromCachedPage() && resource == m_mainResource) resource->createScriptObject(m_frontend.get()); } @@ -1478,4 +1479,34 @@ InspectorController::SpecialPanels InspectorController::specialPanelForJSName(co return ElementsPanel; } +ScriptValue InspectorController::wrapObject(const ScriptValue& quarantinedObject) +{ + if (quarantinedObject.isObject()) { + long id = m_lastBoundObjectId++; + String objectId = String::format("object#%ld", id); + m_idToConsoleObject.set(objectId, quarantinedObject); + + ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "createProxyObject"); + function.appendArgument(quarantinedObject); + function.appendArgument(objectId); + ScriptValue wrapper = function.call(); + return wrapper; + } + return quarantinedObject; +} + +ScriptValue InspectorController::unwrapObject(const String& objectId) +{ + HashMap<String, ScriptValue>::iterator it = m_idToConsoleObject.find(objectId); + if (it != m_idToConsoleObject.end()) + return it->second; + return ScriptValue(); +} + +void InspectorController::resetInjectedScript() +{ + ScriptFunctionCall function(m_scriptState, m_injectedScriptObj, "reset"); + function.call(); +} + } // namespace WebCore diff --git a/WebCore/inspector/InspectorController.h b/WebCore/inspector/InspectorController.h index 632b0ce..6a31deb 100644 --- a/WebCore/inspector/InspectorController.h +++ b/WebCore/inspector/InspectorController.h @@ -31,7 +31,9 @@ #include "Console.h" #include "PlatformString.h" +#include "ScriptObject.h" #include "ScriptState.h" +#include "ScriptValue.h" #include "StringHash.h" #include "Timer.h" @@ -60,7 +62,6 @@ class HitTestResult; class InspectorClient; class InspectorDOMAgent; class JavaScriptCallFrame; -class StorageArea; class KURL; class Node; class Page; @@ -68,9 +69,9 @@ struct ResourceRequest; class ResourceResponse; class ResourceError; class ScriptCallStack; -class ScriptObject; class ScriptString; class SharedBuffer; +class StorageArea; class ConsoleMessage; class InspectorDatabaseResource; @@ -187,7 +188,7 @@ public: void addMessageToConsole(MessageSource, MessageType, MessageLevel, ScriptCallStack*); void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceID); - void clearConsoleMessages(); + void clearConsoleMessages(bool clearUI); const Vector<ConsoleMessage*>& consoleMessages() const { return m_consoleMessages; } void attachWindow(); @@ -198,10 +199,9 @@ public: void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); void handleMousePressOnNode(Node*); - void inspectedWindowScriptObjectCleared(Frame*); void windowScriptObjectAvailable(); - void setFrontendProxyObject(ScriptState* state, ScriptObject object); + void setFrontendProxyObject(ScriptState* state, ScriptObject webInspectorObj, ScriptObject injectedScriptObj = ScriptObject()); void populateScriptObjects(); void resetScriptObjects(); @@ -279,7 +279,7 @@ private: #endif // Following are used from InspectorBackend and internally. - void scriptObjectReady(bool enableDOMAgent); + void scriptObjectReady(); void moveWindowBy(float x, float y) const; void setAttachedWindow(bool); void setAttachedWindowHeight(unsigned height); @@ -287,6 +287,15 @@ private: void closeWindow(); InspectorDOMAgent* domAgent() { return m_domAgent.get(); } + friend class InspectorFrontend; + // Following are used from InspectorFrontend only. We don't want to expose them to the + // rest of the InspectorController clients. + // TODO: extract these into a separate interface. + ScriptValue wrapObject(const ScriptValue& object); + ScriptValue unwrapObject(const String& objectId); + + void resetInjectedScript(); + #if ENABLE(JAVASCRIPT_DEBUGGER) void startUserInitiatedProfilingSoon(); void toggleRecordButton(bool); @@ -314,6 +323,7 @@ private: InspectorClient* m_client; RefPtr<InspectorDOMAgent> m_domAgent; + ScriptObject m_injectedScriptObj; Page* m_page; RefPtr<Node> m_nodeToFocus; RefPtr<InspectorResource> m_mainResource; @@ -343,6 +353,8 @@ private: OwnPtr<InspectorFrontend> m_frontend; RefPtr<InspectorBackend> m_inspectorBackend; #endif + HashMap<String, ScriptValue> m_idToConsoleObject; + long m_lastBoundObjectId; #if ENABLE(JAVASCRIPT_DEBUGGER) bool m_debuggerEnabled; bool m_attachDebuggerWhenShown; diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp index f222239..8a081f7 100644 --- a/WebCore/inspector/InspectorDOMAgent.cpp +++ b/WebCore/inspector/InspectorDOMAgent.cpp @@ -31,6 +31,7 @@ #include "InspectorDOMAgent.h" #include "AtomicString.h" +#include "ContainerNode.h" #include "DOMWindow.h" #include "Document.h" #include "Event.h" @@ -63,10 +64,11 @@ InspectorDOMAgent::~InspectorDOMAgent() setDocument(0); } -void InspectorDOMAgent::setDocument(Document* doc) +bool InspectorDOMAgent::setDocument(Document* doc) { if (doc == mainFrameDocument()) - return; + return false; + discardBindings(); ListHashSet<RefPtr<Document> > copy = m_documents; for (ListHashSet<RefPtr<Document> >::iterator it = copy.begin(); it != copy.end(); ++it) @@ -77,11 +79,10 @@ void InspectorDOMAgent::setDocument(Document* doc) if (doc) { startListening(doc); if (doc->documentElement()) { - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); } - } else { - discardBindings(); } + return true; } void InspectorDOMAgent::startListening(Document* doc) @@ -94,6 +95,7 @@ void InspectorDOMAgent::startListening(Document* doc) doc->addEventListener(eventNames().DOMNodeRemovedEvent, this, false); doc->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, true); doc->addEventListener(eventNames().DOMAttrModifiedEvent, this, false); + doc->addEventListener(eventNames().loadEvent, this, true); m_documents.add(doc); } @@ -107,6 +109,7 @@ void InspectorDOMAgent::stopListening(Document* doc) doc->removeEventListener(eventNames().DOMNodeRemovedEvent, this, false); doc->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, true); doc->removeEventListener(eventNames().DOMAttrModifiedEvent, this, false); + doc->removeEventListener(eventNames().loadEvent, this, true); m_documents.remove(doc); } @@ -169,7 +172,25 @@ void InspectorDOMAgent::handleEvent(Event* event, bool) } else if (type == eventNames().DOMContentLoadedEvent) { // Re-push document once it is loaded. discardBindings(); - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); + } else if (type == eventNames().loadEvent) { + long frameOwnerId = idForNode(node); + if (!frameOwnerId) + return; + + if (!m_childrenRequested.contains(frameOwnerId)) { + // No children are mapped yet -> only notify on changes of hasChildren. + m_frontend->hasChildrenUpdated(frameOwnerId, true); + } else { + // Re-add frame owner element together with its new children. + long parentId = idForNode(innerParentNode(node)); + m_frontend->childNodeRemoved(parentId, frameOwnerId); + long prevId = idForNode(innerPreviousSibling(node)); + ScriptObject value = buildObjectForNode(node, 0); + m_frontend->childNodeInserted(parentId, prevId, value); + // Invalidate children requested flag for the element. + m_childrenRequested.remove(m_childrenRequested.find(frameOwnerId)); + } } } @@ -199,25 +220,24 @@ void InspectorDOMAgent::unbind(Node* node) } } -void InspectorDOMAgent::pushDocumentElementToFrontend() +void InspectorDOMAgent::pushDocumentToFrontend() { - Element* docElem = mainFrameDocument()->documentElement(); - if (!m_nodeToId.contains(docElem)) - m_frontend->setDocumentElement(buildObjectForNode(docElem, 0)); + Document* document = mainFrameDocument(); + if (!m_nodeToId.contains(document)) + m_frontend->setDocument(buildObjectForNode(document, 2)); } -void InspectorDOMAgent::pushChildNodesToFrontend(long elementId) +void InspectorDOMAgent::pushChildNodesToFrontend(long nodeId) { - Node* node = nodeForId(elementId); - if (!node || (node->nodeType() != Node::ELEMENT_NODE)) + Node* node = nodeForId(nodeId); + if (!node || (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE)) return; - if (m_childrenRequested.contains(elementId)) + if (m_childrenRequested.contains(nodeId)) return; - Element* element = static_cast<Element*>(node); - ScriptArray children = buildArrayForElementChildren(element, 1); - m_childrenRequested.add(elementId); - m_frontend->setChildNodes(elementId, children); + ScriptArray children = buildArrayForContainerChildren(node, 1); + m_childrenRequested.add(nodeId); + m_frontend->setChildNodes(nodeId, children); } void InspectorDOMAgent::discardBindings() @@ -229,6 +249,9 @@ void InspectorDOMAgent::discardBindings() Node* InspectorDOMAgent::nodeForId(long id) { + if (!id) + return 0; + HashMap<long, Node*>::iterator it = m_idToNode.find(id); if (it != m_idToNode.end()) return it->second; @@ -245,9 +268,9 @@ long InspectorDOMAgent::idForNode(Node* node) return 0; } -void InspectorDOMAgent::getChildNodes(long callId, long elementId) +void InspectorDOMAgent::getChildNodes(long callId, long nodeId) { - pushChildNodesToFrontend(elementId); + pushChildNodesToFrontend(nodeId); m_frontend->didGetChildNodes(callId); } @@ -256,25 +279,25 @@ long InspectorDOMAgent::pushNodePathToFrontend(Node* nodeToPush) ASSERT(nodeToPush); // Invalid input // If we are sending information to the client that is currently being created. Send root node first. - pushDocumentElementToFrontend(); + pushDocumentToFrontend(); // Return id in case the node is known. long result = idForNode(nodeToPush); if (result) return result; - Element* element = innerParentElement(nodeToPush); - ASSERT(element); // Node is detached or is a document itself + Node* node = innerParentNode(nodeToPush); + ASSERT(node); // Node is detached or is a document itself - Vector<Element*> path; - while (element && !idForNode(element)) { - path.append(element); - element = innerParentElement(element); + Vector<Node*> path; + while (node && !idForNode(node)) { + path.append(node); + node = innerParentNode(node); } // element is known to the client - ASSERT(element); - path.append(element); + ASSERT(node); + path.append(node); for (int i = path.size() - 1; i >= 0; --i) { long nodeId = idForNode(path.at(i)); ASSERT(nodeId); @@ -309,9 +332,9 @@ void InspectorDOMAgent::removeAttribute(long callId, long elementId, const Strin } } -void InspectorDOMAgent::setTextNodeValue(long callId, long elementId, const String& value) +void InspectorDOMAgent::setTextNodeValue(long callId, long nodeId, const String& value) { - Node* node = nodeForId(elementId); + Node* node = nodeForId(nodeId); if (node && (node->nodeType() == Node::TEXT_NODE)) { Text* text_node = static_cast<Text*>(node); ExceptionCode ec = 0; @@ -336,9 +359,9 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth) nodeValue = node->nodeValue(); break; case Node::ATTRIBUTE_NODE: - case Node::DOCUMENT_NODE: case Node::DOCUMENT_FRAGMENT_NODE: break; + case Node::DOCUMENT_NODE: case Node::ELEMENT_NODE: default: nodeName = node->nodeName(); @@ -353,10 +376,11 @@ ScriptObject InspectorDOMAgent::buildObjectForNode(Node* node, int depth) if (node->nodeType() == Node::ELEMENT_NODE) { Element* element = static_cast<Element*>(node); value.set("attributes", buildArrayForElementAttributes(element)); - int nodeCount = innerChildNodeCount(element); + } + if (node->nodeType() == Node::ELEMENT_NODE || node->nodeType() == Node::DOCUMENT_NODE) { + int nodeCount = innerChildNodeCount(node); value.set("childNodeCount", nodeCount); - - ScriptArray children = buildArrayForElementChildren(element, depth); + ScriptArray children = buildArrayForContainerChildren(node, depth); if (children.length() > 0) value.set("children", children); } @@ -381,14 +405,14 @@ ScriptArray InspectorDOMAgent::buildArrayForElementAttributes(Element* element) return attributesValue; } -ScriptArray InspectorDOMAgent::buildArrayForElementChildren(Element* element, int depth) +ScriptArray InspectorDOMAgent::buildArrayForContainerChildren(Node* container, int depth) { ScriptArray children = m_frontend->newScriptArray(); if (depth == 0) { int index = 0; // Special case the_only text child. - if (innerChildNodeCount(element) == 1) { - Node *child = innerFirstChild(element); + if (innerChildNodeCount(container) == 1) { + Node *child = innerFirstChild(container); if (child->nodeType() == Node::TEXT_NODE) children.set(index++, buildObjectForNode(child, 0)); } @@ -398,7 +422,7 @@ ScriptArray InspectorDOMAgent::buildArrayForElementChildren(Element* element, in } int index = 0; - for (Node *child = innerFirstChild(element); child; child = innerNextSibling(child)) + for (Node *child = innerFirstChild(container); child; child = innerNextSibling(child)) children.set(index++, buildObjectForNode(child, depth)); return children; } @@ -446,12 +470,12 @@ int InspectorDOMAgent::innerChildNodeCount(Node* node) return count; } -Element* InspectorDOMAgent::innerParentElement(Node* node) +Node* InspectorDOMAgent::innerParentNode(Node* node) { - Element* element = node->parentElement(); - if (!element) - return node->ownerDocument()->ownerElement(); - return element; + Node* parent = node->parentNode(); + if (parent && parent->nodeType() == Node::DOCUMENT_NODE) + return static_cast<Document*>(parent)->ownerElement(); + return parent; } bool InspectorDOMAgent::isWhitespace(Node* node) diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h index 28c3a22..67b2be8 100644 --- a/WebCore/inspector/InspectorDOMAgent.h +++ b/WebCore/inspector/InspectorDOMAgent.h @@ -42,6 +42,7 @@ #include <wtf/RefPtr.h> namespace WebCore { + class ContainerNode; class Element; class Event; class Document; @@ -56,13 +57,13 @@ namespace WebCore { ~InspectorDOMAgent(); // Methods called from the frontend. - void getChildNodes(long callId, long elementId); + void getChildNodes(long callId, long nodeId); void setAttribute(long callId, long elementId, const String& name, const String& value); void removeAttribute(long callId, long elementId, const String& name); - void setTextNodeValue(long callId, long elementId, const String& value); + void setTextNodeValue(long callId, long nodeId, const String& value); // Methods called from the InspectorController. - void setDocument(Document* document); + bool setDocument(Document* document); Node* nodeForId(long nodeId); long idForNode(Node* node); @@ -77,12 +78,12 @@ namespace WebCore { long bind(Node* node); void unbind(Node* node); - void pushDocumentElementToFrontend(); - void pushChildNodesToFrontend(long elementId); + void pushDocumentToFrontend(); + void pushChildNodesToFrontend(long nodeId); ScriptObject buildObjectForNode(Node* node, int depth); - ScriptArray buildArrayForElementAttributes(Element* elemen); - ScriptArray buildArrayForElementChildren(Element* element, int depth); + ScriptArray buildArrayForElementAttributes(Element* element); + ScriptArray buildArrayForContainerChildren(Node* container, int depth); // We represent embedded doms as a part of the same hierarchy. Hence we treat children of frame owners differently. // We also skip whitespace text nodes conditionally. Following methods encapsulate these specifics. @@ -90,7 +91,7 @@ namespace WebCore { Node* innerNextSibling(Node* node); Node* innerPreviousSibling(Node* node); int innerChildNodeCount(Node* node); - Element* innerParentElement(Node* node); + Node* innerParentNode(Node* node); bool isWhitespace(Node* node); Document* mainFrameDocument(); diff --git a/WebCore/inspector/InspectorDOMStorageResource.cpp b/WebCore/inspector/InspectorDOMStorageResource.cpp index 03db649..1e56742 100644 --- a/WebCore/inspector/InspectorDOMStorageResource.cpp +++ b/WebCore/inspector/InspectorDOMStorageResource.cpp @@ -64,7 +64,7 @@ void InspectorDOMStorageResource::bind(InspectorFrontend* frontend) ScriptObject jsonObject = frontend->newScriptObject(); ScriptObject domStorage; - if (!getQuarantinedScriptObject(m_frame.get(), m_domStorage.get(), domStorage)) + if (!getQuarantinedScriptObject(m_domStorage.get(), domStorage)) return; jsonObject.set("domStorage", domStorage); jsonObject.set("host", m_frame->document()->securityOrigin()->host()); diff --git a/WebCore/inspector/InspectorFrontend.cpp b/WebCore/inspector/InspectorFrontend.cpp index af65fb4..f745ae3 100644 --- a/WebCore/inspector/InspectorFrontend.cpp +++ b/WebCore/inspector/InspectorFrontend.cpp @@ -32,7 +32,7 @@ #include "ConsoleMessage.h" #include "Frame.h" -#include "InspectorController.h" // TODO(pfeldman): Extract SpecialPanels to remove include. +#include "InspectorController.h" #include "Node.h" #include "ScriptFunctionCall.h" #include "ScriptObject.h" @@ -49,8 +49,9 @@ namespace WebCore { -InspectorFrontend::InspectorFrontend(ScriptState* scriptState, ScriptObject webInspector) - : m_scriptState(scriptState) +InspectorFrontend::InspectorFrontend(InspectorController* inspectorController, ScriptState* scriptState, ScriptObject webInspector) + : m_inspectorController(inspectorController) + , m_scriptState(scriptState) , m_webInspector(webInspector) { } @@ -79,12 +80,17 @@ void InspectorFrontend::addMessageToConsole(const ScriptObject& messageObj, cons function->appendArgument(frames[i]); } else if (!wrappedArguments.isEmpty()) { for (unsigned i = 0; i < wrappedArguments.size(); ++i) - function->appendArgument(wrappedArguments[i]); + function->appendArgument(m_inspectorController->wrapObject(wrappedArguments[i])); } else function->appendArgument(message); function->call(); } +void InspectorFrontend::clearConsoleMessages() +{ + callSimpleFunction("clearConsoleMessages"); +} + bool InspectorFrontend::addResource(long long identifier, const ScriptObject& resourceObj) { OwnPtr<ScriptFunctionCall> function(newFunctionCall("addResource")); @@ -112,14 +118,10 @@ void InspectorFrontend::removeResource(long long identifier) function->call(); } -void InspectorFrontend::updateFocusedNode(Node* node) +void InspectorFrontend::updateFocusedNode(long long nodeId) { - ScriptObject quarantinedNode; - if (!getQuarantinedScriptObject(node, quarantinedNode)) - return; - OwnPtr<ScriptFunctionCall> function(newFunctionCall("updateFocusedNode")); - function->appendArgument(quarantinedNode); + function->appendArgument(nodeId); function->call(); } @@ -130,17 +132,6 @@ void InspectorFrontend::setAttachedWindow(bool attached) function->call(); } -void InspectorFrontend::inspectedWindowScriptObjectCleared(Frame* frame) -{ - ScriptObject domWindow; - if (!getQuarantinedScriptObject(frame->domWindow(), domWindow)) - return; - - OwnPtr<ScriptFunctionCall> function(newFunctionCall("inspectedWindowCleared")); - function->appendArgument(domWindow); - function->call(); -} - void InspectorFrontend::showPanel(int panel) { const char* showFunctionName; @@ -286,9 +277,9 @@ bool InspectorFrontend::addDOMStorage(const ScriptObject& domStorageObj) } #endif -void InspectorFrontend::setDocumentElement(const ScriptObject& root) +void InspectorFrontend::setDocument(const ScriptObject& root) { - OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDocumentElement")); + OwnPtr<ScriptFunctionCall> function(newFunctionCall("setDocument")); function->appendArgument(root); function->call(); } @@ -349,6 +340,37 @@ void InspectorFrontend::didApplyDomChange(int callId, bool success) function->call(); } +#if ENABLE(DATABASE) +void InspectorFrontend::selectDatabase(Database* database) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDatabase")); + ScriptObject quarantinedObject; + if (!getQuarantinedScriptObject(database, quarantinedObject)) + return; + function->appendArgument(quarantinedObject); + function->call(); +} +#endif + +#if ENABLE(DOM_STORAGE) +void InspectorFrontend::selectDOMStorage(Storage* storage) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("selectDOMStorage")); + ScriptObject quarantinedObject; + if (!getQuarantinedScriptObject(storage, quarantinedObject)) + return; + function->appendArgument(quarantinedObject); + function->call(); +} +#endif + +void InspectorFrontend::addNodesToSearchResult(const String& nodeIds) +{ + OwnPtr<ScriptFunctionCall> function(newFunctionCall("addNodesToSearchResult")); + function->appendArgument(nodeIds); + function->call(); +} + PassOwnPtr<ScriptFunctionCall> InspectorFrontend::newFunctionCall(const String& functionName) { ScriptFunctionCall* function = new ScriptFunctionCall(m_scriptState, m_webInspector, "dispatch"); diff --git a/WebCore/inspector/InspectorFrontend.h b/WebCore/inspector/InspectorFrontend.h index 7a48b62..600f50a 100644 --- a/WebCore/inspector/InspectorFrontend.h +++ b/WebCore/inspector/InspectorFrontend.h @@ -45,28 +45,32 @@ namespace JSC { namespace WebCore { class ConsoleMessage; + class Database; + class Frame; + class InspectorController; class InspectorResource; class Node; class ScriptFunctionCall; class ScriptString; + class Storage; class InspectorFrontend { public: - InspectorFrontend(ScriptState*, ScriptObject webInspector); + InspectorFrontend(InspectorController* inspectorController, ScriptState*, ScriptObject webInspector); ~InspectorFrontend(); ScriptArray newScriptArray(); ScriptObject newScriptObject(); void addMessageToConsole(const ScriptObject& messageObj, const Vector<ScriptString>& frames, const Vector<ScriptValue> wrappedArguments, const String& message); - + void clearConsoleMessages(); + bool addResource(long long identifier, const ScriptObject& resourceObj); bool updateResource(long long identifier, const ScriptObject& resourceObj); void removeResource(long long identifier); - void updateFocusedNode(Node* node); + void updateFocusedNode(long long nodeId); void setAttachedWindow(bool attached); - void inspectedWindowScriptObjectCleared(Frame* frame); void showPanel(int panel); void populateInterface(); void reset(); @@ -90,13 +94,15 @@ namespace WebCore { #if ENABLE(DATABASE) bool addDatabase(const ScriptObject& dbObj); + void selectDatabase(Database* database); #endif #if ENABLE(DOM_STORAGE) bool addDOMStorage(const ScriptObject& domStorageObj); + void selectDOMStorage(Storage* storage); #endif - void setDocumentElement(const ScriptObject& root); + void setDocument(const ScriptObject& root); void setChildNodes(int parentId, const ScriptArray& nodes); void hasChildrenUpdated(int id, bool newValue); void childNodeInserted(int parentId, int prevId, const ScriptObject& node); @@ -105,9 +111,12 @@ namespace WebCore { void didGetChildNodes(int callId); void didApplyDomChange(int callId, bool success); + void addNodesToSearchResult(const String& nodeIds); + private: PassOwnPtr<ScriptFunctionCall> newFunctionCall(const String& functionName); void callSimpleFunction(const String& functionName); + InspectorController* m_inspectorController; ScriptState* m_scriptState; ScriptObject m_webInspector; }; diff --git a/WebCore/inspector/JavaScriptDebugServer.cpp b/WebCore/inspector/JavaScriptDebugServer.cpp index 10eff26..008ddd3 100644 --- a/WebCore/inspector/JavaScriptDebugServer.cpp +++ b/WebCore/inspector/JavaScriptDebugServer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 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 @@ -45,10 +45,8 @@ #include "ScrollView.h" #include "Widget.h" #include "ScriptController.h" -#include <runtime/CollectorHeapIterator.h> #include <debugger/DebuggerCallFrame.h> #include <runtime/JSLock.h> -#include <parser/Parser.h> #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> #include <wtf/UnusedParam.h> @@ -299,8 +297,6 @@ void JavaScriptDebugServer::sourceParsed(ExecState* exec, const SourceCode& sour m_callingListeners = true; - ASSERT(hasListeners()); - bool isError = errorLine != -1; if (hasGlobalListeners()) { @@ -555,60 +551,7 @@ void JavaScriptDebugServer::recompileAllJSFunctionsSoon() void JavaScriptDebugServer::recompileAllJSFunctions(Timer<JavaScriptDebugServer>*) { JSLock lock(SilenceAssertionsOnly); - JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData(); - - // If JavaScript is running, it's not safe to recompile, since we'll end - // up throwing away code that is live on the stack. - ASSERT(!globalData->dynamicGlobalObject); - if (globalData->dynamicGlobalObject) - return; - - Vector<ProtectedPtr<JSFunction> > functions; - Heap::iterator heapEnd = globalData->heap.primaryHeapEnd(); - for (Heap::iterator it = globalData->heap.primaryHeapBegin(); it != heapEnd; ++it) { - if ((*it)->isObject(&JSFunction::info)) { - JSFunction* function = static_cast<JSFunction*>(*it); - if (!function->isHostFunction()) - functions.append(function); - } - } - - typedef HashMap<RefPtr<FunctionBodyNode>, RefPtr<FunctionBodyNode> > FunctionBodyMap; - typedef HashMap<SourceProvider*, ExecState*> SourceProviderMap; - - FunctionBodyMap functionBodies; - SourceProviderMap sourceProviders; - - size_t size = functions.size(); - for (size_t i = 0; i < size; ++i) { - JSFunction* function = functions[i]; - - FunctionBodyNode* oldBody = function->body(); - pair<FunctionBodyMap::iterator, bool> result = functionBodies.add(oldBody, 0); - if (!result.second) { - function->setBody(result.first->second.get()); - continue; - } - - ExecState* exec = function->scope().globalObject()->JSGlobalObject::globalExec(); - const SourceCode& sourceCode = oldBody->source(); - - RefPtr<FunctionBodyNode> newBody = globalData->parser->parse<FunctionBodyNode>(exec, 0, sourceCode); - ASSERT(newBody); - newBody->finishParsing(oldBody->copyParameters(), oldBody->parameterCount()); - - result.first->second = newBody; - function->setBody(newBody.release()); - - if (hasListeners() && function->scope().globalObject()->debugger() == this) - sourceProviders.add(sourceCode.provider(), exec); - } - - // Call sourceParsed() after reparsing all functions because it will execute - // JavaScript in the inspector. - SourceProviderMap::const_iterator end = sourceProviders.end(); - for (SourceProviderMap::const_iterator iter = sourceProviders.begin(); iter != end; ++iter) - sourceParsed((*iter).second, SourceCode((*iter).first), -1, 0); + Debugger::recompileAllJSFunctions(JSDOMWindow::commonJSGlobalData()); } void JavaScriptDebugServer::didAddListener(Page* page) diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js index 6851eea..d4693b7 100644 --- a/WebCore/inspector/front-end/ConsoleView.js +++ b/WebCore/inspector/front-end/ConsoleView.js @@ -175,7 +175,7 @@ WebInspector.ConsoleView.prototype = { clearMessages: function(clearInspectorController) { if (clearInspectorController) - InspectorController.clearMessages(); + InspectorController.clearMessages(false); if (WebInspector.panels.resources) WebInspector.panels.resources.clearMessages(); @@ -212,10 +212,42 @@ WebInspector.ConsoleView.prototype = { return; var reportCompletions = this._reportCompletions.bind(this, bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix); - this._evalInInspectedWindow(expressionString, reportCompletions); + // Collect comma separated object properties for the completion. + + if (!expressionString) { + if (WebInspector.panels.scripts && WebInspector.panels.scripts.paused) { + // Evaluate into properties in scope of the selected call frame. + reportCompletions(WebInspector.panels.scripts.variablesInSelectedCallFrame()); + return; + } else { + expressionString = "this"; + } + } + + function parsingCallback(result, isException) + { + if (!isException) + result = JSON.parse(result); + reportCompletions(result, isException); + } + + this._evalInInspectedWindow( + "(function() {" + + "var props = {};" + + "for (var prop in (" + expressionString + ")) props[prop] = true;" + + ((!dotNotation && !bracketNotation) ? + "for (var prop in window._inspectorCommandLineAPI)" + + "if (prop.charAt(0) !== '_') props[prop] = true;" + : "") + + "return JSON.stringify(props);" + + "})()", + parsingCallback); }, - _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result) { + _reportCompletions: function(bestMatchOnly, completionsReadyCallback, dotNotation, bracketNotation, prefix, result, isException) { + if (isException) + return; + if (bracketNotation) { if (prefix.length && prefix[0] === "'") var quoteUsed = "'"; @@ -224,16 +256,7 @@ WebInspector.ConsoleView.prototype = { } var results = []; - var properties = Object.properties(result); - if (!dotNotation && !bracketNotation && result._inspectorCommandLineAPI) { - var commandLineAPI = Object.properties(result._inspectorCommandLineAPI); - for (var i = 0; i < commandLineAPI.length; ++i) { - var property = commandLineAPI[i]; - if (property.charAt(0) !== "_") - properties.push(property); - } - } - properties.sort(); + var properties = Object.sortedProperties(result); for (var i = 0; i < properties.length; ++i) { var property = properties[i]; @@ -288,7 +311,7 @@ WebInspector.ConsoleView.prototype = { if (!link || !link.representedNode) return; - WebInspector.updateFocusedNode(link.representedNode); + WebInspector.updateFocusedNode(link.representedNode.id); event.stopPropagation(); event.preventDefault(); }, @@ -313,74 +336,6 @@ WebInspector.ConsoleView.prototype = { this.doEvalInWindow(expression, callback); }, - _ensureCommandLineAPIInstalled: function(inspectedWindow) - { - if (!inspectedWindow._inspectorCommandLineAPI) { - inspectedWindow.eval("window._inspectorCommandLineAPI = { \ - $: function() { return document.getElementById.apply(document, arguments) }, \ - $$: function() { return document.querySelectorAll.apply(document, arguments) }, \ - $x: function(xpath, context) { \ - var nodes = []; \ - try { \ - var doc = context || document; \ - var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \ - var node; \ - while (node = results.iterateNext()) nodes.push(node); \ - } catch (e) {} \ - return nodes; \ - }, \ - dir: function() { return console.dir.apply(console, arguments) }, \ - dirxml: function() { return console.dirxml.apply(console, arguments) }, \ - keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \ - values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \ - profile: function() { return console.profile.apply(console, arguments) }, \ - profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ - _inspectedNodes: [], \ - get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \ - get $1() { return _inspectorCommandLineAPI._inspectedNodes[1] }, \ - get $2() { return _inspectorCommandLineAPI._inspectedNodes[2] }, \ - get $3() { return _inspectorCommandLineAPI._inspectedNodes[3] }, \ - get $4() { return _inspectorCommandLineAPI._inspectedNodes[4] } \ - };"); - - inspectedWindow._inspectorCommandLineAPI.clear = InspectorController.wrapCallback(this.clearMessages.bind(this)); - inspectedWindow._inspectorCommandLineAPI.inspect = InspectorController.wrapCallback(inspectObject.bind(this)); - - function inspectObject(o) - { - if (arguments.length === 0) - return; - - InspectorController.inspectedWindow().console.log(o); - if (Object.type(o, InspectorController.inspectedWindow()) === "node") { - WebInspector.showElementsPanel(); - WebInspector.panels.elements.treeOutline.revealAndSelectNode(o); - } else { - switch (Object.describe(o)) { - case "Database": - WebInspector.showDatabasesPanel(); - WebInspector.panels.databases.selectDatabase(o); - break; - case "Storage": - WebInspector.showDatabasesPanel(); - WebInspector.panels.databases.selectDOMStorage(o); - break; - } - } - } - } - }, - - addInspectedNode: function(node) - { - var inspectedWindow = InspectorController.inspectedWindow(); - this._ensureCommandLineAPIInstalled(inspectedWindow); - var inspectedNodes = inspectedWindow._inspectorCommandLineAPI._inspectedNodes; - inspectedNodes.unshift(node); - if (inspectedNodes.length >= 5) - inspectedNodes.pop(); - }, - doEvalInWindow: function(expression, callback) { if (!expression) { @@ -388,22 +343,15 @@ WebInspector.ConsoleView.prototype = { expression = "this"; } - // Surround the expression in with statements to inject our command line API so that - // the window object properties still take more precedent than our API functions. - expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; - var self = this; - function delayedEvaluation() + function evalCallback(result) { - var inspectedWindow = InspectorController.inspectedWindow(); - self._ensureCommandLineAPIInstalled(inspectedWindow); - try { - callback(inspectedWindow.eval(expression)); - } catch (e) { - callback(e, true); - } - } - setTimeout(delayedEvaluation, 0); + if (result.exception) + callback(result.exception, true); + else + callback(result.value, false); + }; + InspectorController.evaluate(expression, evalCallback); }, _enterKeyPressed: function(event) @@ -436,13 +384,10 @@ WebInspector.ConsoleView.prototype = { _format: function(output, forceObjectFormat) { - var inspectedWindow = InspectorController.inspectedWindow(); if (forceObjectFormat) var type = "object"; - else if (output instanceof inspectedWindow.NodeList) - var type = "array"; else - var type = Object.type(output, inspectedWindow); + var type = Object.proxyType(output); // We don't perform any special formatting on these types, so we just // pass them through the simple _formatvalue function. @@ -451,8 +396,6 @@ WebInspector.ConsoleView.prototype = { "null": 1, "boolean": 1, "number": 1, - "date": 1, - "function": 1, }; var formatter; @@ -479,6 +422,16 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode(val)); }, + _formatfunction: function(func, elem) + { + elem.appendChild(document.createTextNode(func.description)); + }, + + _formatdate: function(date, elem) + { + elem.appendChild(document.createTextNode(date.description)); + }, + _formatstring: function(str, elem) { elem.appendChild(document.createTextNode("\"" + str + "\"")); @@ -486,7 +439,7 @@ WebInspector.ConsoleView.prototype = { _formatregexp: function(re, elem) { - var formatted = String(re).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); + var formatted = String(re.description).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); elem.appendChild(document.createTextNode(formatted)); }, @@ -501,10 +454,10 @@ WebInspector.ConsoleView.prototype = { elem.appendChild(document.createTextNode("]")); }, - _formatnode: function(node, elem) + _formatnode: function(object, elem) { var treeOutline = new WebInspector.ElementsTreeOutline(); - treeOutline.rootDOMNode = node; + treeOutline.rootDOMNode = WebInspector.domAgent.nodeForId(object.nodeId); treeOutline.element.addStyleClass("outline-disclosure"); if (!treeOutline.children[0].hasChildren) treeOutline.element.addStyleClass("single-node"); @@ -513,7 +466,7 @@ WebInspector.ConsoleView.prototype = { _formatobject: function(obj, elem) { - elem.appendChild(new WebInspector.ObjectPropertiesSection(new WebInspector.ObjectProxy(obj), Object.describe(obj, true), null, null, true).element); + elem.appendChild(new WebInspector.ObjectPropertiesSection(obj, obj.description, null, true).element); }, _formaterror: function(obj, elem) diff --git a/WebCore/inspector/front-end/CookieItemsView.js b/WebCore/inspector/front-end/CookieItemsView.js new file mode 100644 index 0000000..2d69e7d --- /dev/null +++ b/WebCore/inspector/front-end/CookieItemsView.js @@ -0,0 +1,329 @@ +/* + * Copyright (C) 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Joseph Pecoraro + * + * 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. + */ + +WebInspector.CookieItemsView = function() +{ + WebInspector.View.call(this); + + // Some Platforms have not yet implemented access to raw cookies + // Those platforms will return undefined instead of an Array + // For these platforms we: + // - resort to document.cookie + // - do not show the delete cookie status bar button + this._useFallback = typeof InspectorController.cookies() === "undefined"; + + this.element.addStyleClass("storage-view"); + this.element.addStyleClass("table"); + + this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item"); + this.deleteButton.visible = false; + this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false); + + this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); + this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); +} + +WebInspector.CookieItemsView.prototype = { + get statusBarItems() + { + if (this._useFallback) + return [this.refreshButton.element]; + else + return [this.refreshButton.element, this.deleteButton.element]; + }, + + show: function(parentElement) + { + WebInspector.View.prototype.show.call(this, parentElement); + this.update(); + }, + + hide: function() + { + WebInspector.View.prototype.hide.call(this); + this.deleteButton.visible = false; + }, + + update: function() + { + if (this._useFallback) { + this.fallbackUpdate(); + return; + } + + this.element.removeChildren(); + var dataGrid = this.dataGridForCookies(); + if (dataGrid) { + this._dataGrid = dataGrid; + this.element.appendChild(dataGrid.element); + this.deleteButton.visible = true; + } else { + var emptyMsgElement = document.createElement("div"); + emptyMsgElement.className = "storage-table-empty"; + emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); + this.element.appendChild(emptyMsgElement); + this._dataGrid = null; + this.deleteButton.visible = false; + } + }, + + buildCookies: function() + { + var rawCookies = InspectorController.cookies(); + var cookies = []; + for (var i = 0; i < rawCookies.length; ++i) { + var cookie = rawCookies[i]; + cookie.expires = new Date(cookie.expires); + cookies.push(cookie); + } + + return cookies; + }, + + dataGridForCookies: function() + { + var cookies = this.buildCookies(); + if (!cookies.length) + return null; + + var columns = { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 5: {}, 6: {}, 7: {} }; + columns[0].title = WebInspector.UIString("Name"); + columns[0].width = columns[0].title.length; + columns[1].title = WebInspector.UIString("Value"); + columns[1].width = columns[1].title.length; + columns[2].title = WebInspector.UIString("Domain"); + columns[2].width = columns[2].title.length; + columns[3].title = WebInspector.UIString("Path"); + columns[3].width = columns[3].title.length; + columns[4].title = WebInspector.UIString("Expires"); + columns[4].width = columns[4].title.length; + columns[5].title = WebInspector.UIString("Size"); + columns[5].width = columns[5].title.length; + columns[5].aligned = "right"; + columns[6].title = WebInspector.UIString("HTTP"); + columns[6].width = columns[6].title.length; + columns[6].aligned = "centered"; + columns[7].title = WebInspector.UIString("Secure"); + columns[7].width = columns[7].title.length; + columns[7].aligned = "centered"; + + function updateDataAndColumn(index, value) { + data[index] = value; + if (value.length > columns[index].width) + columns[index].width = value.length; + } + + var data; + var nodes = []; + for (var i = 0; i < cookies.length; ++i) { + var cookie = cookies[i]; + data = {}; + + updateDataAndColumn(0, cookie.name); + updateDataAndColumn(1, cookie.value); + updateDataAndColumn(2, cookie.domain); + updateDataAndColumn(3, cookie.path); + updateDataAndColumn(4, (cookie.session ? "Session" : cookie.expires.toGMTString())); + updateDataAndColumn(5, Number.bytesToString(cookie.size, WebInspector.UIString)); + updateDataAndColumn(6, (cookie.httpOnly ? "\u2713" : "")); // Checkmark + updateDataAndColumn(7, (cookie.secure ? "\u2713" : "")); // Checkmark + + var node = new WebInspector.DataGridNode(data, false); + node.cookie = cookie; + node.selectable = true; + nodes.push(node); + } + + var totalColumnWidths = 0; + for (var columnIdentifier in columns) + totalColumnWidths += columns[columnIdentifier].width; + + // Enforce the Value column (the 2nd column) to be a max of 33% + // tweaking the raw total width because may massively outshadow the others + var valueColumnWidth = columns[1].width; + if (valueColumnWidth / totalColumnWidths > 0.33) { + totalColumnWidths -= valueColumnWidth; + totalColumnWidths *= 1.33; + columns[1].width = totalColumnWidths * 0.33; + } + + // Calculate the percentage width for the columns. + const minimumPrecent = 6; + var recoupPercent = 0; + for (var columnIdentifier in columns) { + var width = columns[columnIdentifier].width; + width = Math.round((width / totalColumnWidths) * 100); + if (width < minimumPrecent) { + recoupPercent += (minimumPrecent - width); + width = minimumPrecent; + } + columns[columnIdentifier].width = width; + } + + // Enforce the minimum percentage width. (need to narrow total percentage due to earlier additions) + while (recoupPercent > 0) { + for (var columnIdentifier in columns) { + if (columns[columnIdentifier].width > minimumPrecent) { + --columns[columnIdentifier].width; + --recoupPercent; + if (!recoupPercent) + break; + } + } + } + + for (var columnIdentifier in columns) + columns[columnIdentifier].width += "%"; + + var dataGrid = new WebInspector.DataGrid(columns); + var length = nodes.length; + for (var i = 0; i < length; ++i) + dataGrid.appendChild(nodes[i]); + if (length > 0) + nodes[0].selected = true; + + return dataGrid; + }, + + fallbackUpdate: function() + { + this.element.removeChildren(); + + var self = this; + function callback(rawCookieString) { + var cookies = self.fallbackBuildCookiesFromString(rawCookieString); + var dataGrid = self.fallbackDataGridForCookies(cookies); + if (dataGrid) { + self._dataGrid = dataGrid; + self.element.appendChild(dataGrid.element); + self.deleteButton.visible = true; + } else { + var emptyMsgElement = document.createElement("div"); + emptyMsgElement.className = "storage-table-empty"; + emptyMsgElement.textContent = WebInspector.UIString("This site has no cookies."); + self.element.appendChild(emptyMsgElement); + self._dataGrid = null; + self.deleteButton.visible = false; + } + } + + InspectorController.getCookies(callback); + }, + + fallbackBuildCookiesFromString: function(rawCookieString) + { + var rawCookies = rawCookieString.split(/;\s*/); + var cookies = []; + + if (!(/^\s*$/.test(rawCookieString))) { + for (var i = 0; i < rawCookies.length; ++i) { + var cookie = rawCookies[i]; + var delimIndex = cookie.indexOf("="); + var name = cookie.substring(0, delimIndex); + var value = cookie.substring(delimIndex + 1); + var size = name.length + value.length; + cookies.push({ name: name, value: value, size: size }); + } + } + + return cookies; + }, + + fallbackDataGridForCookies: function(cookies) + { + if (!cookies.length) + return null; + + var columns = {}; + columns[0] = {}; + columns[1] = {}; + columns[0].title = WebInspector.UIString("Name"); + columns[0].width = columns[0].title.length; + columns[1].title = WebInspector.UIString("Value"); + columns[1].width = columns[1].title.length; + + var nodes = []; + for (var i = 0; i < cookies.length; ++i) { + var cookie = cookies[i]; + var data = {}; + + var name = cookie.name; + data[0] = name; + if (name.length > columns[0].width) + columns[0].width = name.length; + + var value = cookie.value; + data[1] = value; + if (value.length > columns[1].width) + columns[1].width = value.length; + + var node = new WebInspector.DataGridNode(data, false); + node.selectable = true; + nodes.push(node); + } + + var totalColumnWidths = columns[0].width + columns[1].width; + var width = Math.round((columns[0].width * 100) / totalColumnWidths); + const minimumPrecent = 20; + if (width < minimumPrecent) + width = minimumPrecent; + if (width > 100 - minimumPrecent) + width = 100 - minimumPrecent; + columns[0].width = width; + columns[1].width = 100 - width; + columns[0].width += "%"; + columns[1].width += "%"; + + var dataGrid = new WebInspector.DataGrid(columns); + var length = nodes.length; + for (var i = 0; i < length; ++i) + dataGrid.appendChild(nodes[i]); + if (length > 0) + nodes[0].selected = true; + + return dataGrid; + }, + + _deleteButtonClicked: function(event) + { + if (!this._dataGrid || this._useFallback) + return; + + var cookie = this._dataGrid.selectedNode.cookie; + InspectorController.deleteCookie(cookie.name); + this.update(); + }, + + _refreshButtonClicked: function(event) + { + this.update(); + } +} + +WebInspector.CookieItemsView.prototype.__proto__ = WebInspector.View.prototype; diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js index 5aacd41..7942f0a 100644 --- a/WebCore/inspector/front-end/DOMAgent.js +++ b/WebCore/inspector/front-end/DOMAgent.js @@ -31,7 +31,7 @@ WebInspector.DOMNode = function(doc, payload) { this.ownerDocument = doc; - this._id = payload.id; + this.id = payload.id; this.nodeType = payload.nodeType; this.nodeName = payload.nodeName; this._nodeValue = payload.nodeValue; @@ -48,14 +48,22 @@ WebInspector.DOMNode = function(doc, payload) { this.nextSibling = null; this.prevSibling = null; this.firstChild = null; + this.lastChild = null; this.parentNode = null; - if (payload.childNodes) - this._setChildrenPayload(payload.childNodes); + if (payload.children) + this._setChildrenPayload(payload.children); this._computedStyle = null; this.style = null; this._matchedCSSRules = []; + + if (this.nodeType == Node.ELEMENT_NODE) { + if (this.nodeName == "HTML") + this.ownerDocument.documentElement = this; + if (this.nodeName == "BODY") + this.ownerDocument.body = this; + } } WebInspector.DOMNode.prototype = { @@ -161,9 +169,11 @@ WebInspector.DOMNode.prototype = { this._childNodeCount = this.children.length; if (this._childNodeCount == 0) { this.firstChild = null; + this.lastChild = null; return; } this.firstChild = this.children[0]; + this.lastChild = this.children[this._childNodeCount - 1]; for (var i = 0; i < this._childNodeCount; ++i) { var child = this.children[i]; child.nextSibling = i + 1 < this._childNodeCount ? this.children[i + 1] : null; @@ -208,17 +218,9 @@ WebInspector.DOMNode.prototype = { } } -WebInspector.DOMDocument = function(domAgent, defaultView) +WebInspector.DOMDocument = function(domAgent, defaultView, payload) { - WebInspector.DOMNode.call(this, null, - { - id: 0, - nodeType: Node.DOCUMENT_NODE, - nodeName: "", - nodeValue: "", - attributes: [], - childNodeCount: 0 - }); + WebInspector.DOMNode.call(this, this, payload); this._listeners = {}; this._domAgent = domAgent; this.defaultView = defaultView; @@ -226,7 +228,7 @@ WebInspector.DOMDocument = function(domAgent, defaultView) WebInspector.DOMDocument.prototype = { - addEventListener: function(name, callback, useCapture) + addEventListener: function(name, callback) { var listeners = this._listeners[name]; if (!listeners) { @@ -236,7 +238,7 @@ WebInspector.DOMDocument.prototype = { listeners.push(callback); }, - removeEventListener: function(name, callback, useCapture) + removeEventListener: function(name, callback) { var listeners = this._listeners[name]; if (!listeners) @@ -251,10 +253,12 @@ WebInspector.DOMDocument.prototype = { { var listeners = this._listeners[name]; if (!listeners) - return; + return; - for (var i = 0; i < listeners.length; ++i) - listeners[i](event); + for (var i = 0; i < listeners.length; ++i) { + var listener = listeners[i]; + listener.call(this, event); + } } } @@ -302,23 +306,8 @@ WebInspector.DOMAgent = function() { this._idToDOMNode = null; this.document = null; - // Install onpopulate handler. This is a temporary measure. - // TODO: add this code into the original updateChildren once domAgent - // becomes primary source of DOM information. - // TODO2: update ElementsPanel to not track embedded iframes - it is already being handled + // TODO: update ElementsPanel to not track embedded iframes - it is already being handled // in the agent backend. - var domAgent = this; - var originalUpdateChildren = WebInspector.ElementsTreeElement.prototype.updateChildren; - WebInspector.ElementsTreeElement.prototype.updateChildren = function() - { - domAgent.getChildNodesAsync(this.representedObject, originalUpdateChildren.bind(this)); - }; - - // Mute console handle to avoid crash on selection change. - // TODO: Re-implement inspectorConsoleAPI to work in a serialized way and remove this workaround. - WebInspector.Console.prototype.addInspectedNode = function() - { - }; // Whitespace is ignored in InspectorDOMAgent already -> no need to filter. // TODO: Either remove all of its usages or push value into the agent backend. @@ -331,38 +320,36 @@ WebInspector.DOMAgent.prototype = { return this._window; }, - getChildNodesAsync: function(parent, opt_callback) + getChildNodesAsync: function(parent, callback) { var children = parent.children; - if (children && opt_callback) { - opt_callback(children); - return; + if (children) { + callback(children); + return; + } + function mycallback() { + callback(parent.children); } - var mycallback = function() { - if (opt_callback) { - opt_callback(parent.children); - } - }; var callId = WebInspector.Callback.wrap(mycallback); - InspectorController.getChildNodes(callId, parent._id); + InspectorController.getChildNodes(callId, parent.id); }, setAttributeAsync: function(node, name, value, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setAttribute(WebInspector.Callback.wrap(mycallback), node._id, name, value); + InspectorController.setAttribute(WebInspector.Callback.wrap(mycallback), node.id, name, value); }, removeAttributeAsync: function(node, name, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.removeAttribute(WebInspector.Callback.wrap(mycallback), node._id, name); + InspectorController.removeAttribute(WebInspector.Callback.wrap(mycallback), node.id, name); }, setTextNodeValueAsync: function(node, text, callback) { var mycallback = this._didApplyDomChange.bind(this, node, callback); - InspectorController.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node._id, text); + InspectorController.setTextNodeValue(WebInspector.Callback.wrap(mycallback), node.id, text); }, _didApplyDomChange: function(node, callback, success) @@ -383,26 +370,22 @@ WebInspector.DOMAgent.prototype = { node._setAttributesPayload(attrsArray); }, - getNodeForId: function(nodeId) { + nodeForId: function(nodeId) { return this._idToDOMNode[nodeId]; }, - _setDocumentElement: function(payload) + _setDocument: function(payload) { - this.document = new WebInspector.DOMDocument(this, this._window); - this._idToDOMNode = { 0 : this.document }; - this._setChildNodes(0, [payload]); - this.document.documentElement = this.document.firstChild; - this.document.documentElement.ownerDocument = this.document; + this.document = new WebInspector.DOMDocument(this, this._window, payload); + this._idToDOMNode = {}; + this._idToDOMNode[payload.id] = this.document; + this._bindNodes(this.document.children); WebInspector.panels.elements.reset(); }, _setChildNodes: function(parentId, payloads) { var parent = this._idToDOMNode[parentId]; - if (parent.children) { - return; - } parent._setChildrenPayload(payloads); this._bindNodes(parent.children); }, @@ -411,7 +394,7 @@ WebInspector.DOMAgent.prototype = { { for (var i = 0; i < children.length; ++i) { var child = children[i]; - this._idToDOMNode[child._id] = child; + this._idToDOMNode[child.id] = child; if (child.children) this._bindNodes(child.children); } @@ -433,7 +416,7 @@ WebInspector.DOMAgent.prototype = { var parent = this._idToDOMNode[parentId]; var prev = this._idToDOMNode[prevId]; var node = parent._insertChild(prev, payload); - this._idToDOMNode[node._id] = node; + this._idToDOMNode[node.id] = node; var event = { target : node, relatedNode : parent }; this.document._fireDomEvent("DOMNodeInserted", event); }, @@ -450,7 +433,7 @@ WebInspector.DOMAgent.prototype = { } WebInspector.CSSStyleDeclaration = function(payload) { - this._id = payload.id; + this.id = payload.id; this.width = payload.width; this.height = payload.height; this.__disabledProperties = payload.__disabledProperties; @@ -492,12 +475,13 @@ WebInspector.CSSStyleDeclaration.parseStyle = function(payload) WebInspector.CSSStyleDeclaration.parseRule = function(payload) { var rule = {}; - rule._id = payload.id; + rule.id = payload.id; rule.selectorText = payload.selectorText; rule.style = new WebInspector.CSSStyleDeclaration(payload.style); rule.style.parentRule = rule; rule.isUserAgent = payload.isUserAgent; rule.isUser = payload.isUser; + rule.isViaInspector = payload.isViaInspector; if (payload.parentStyleSheet) rule.parentStyleSheet = { href: payload.parentStyleSheet.href }; @@ -586,9 +570,9 @@ WebInspector.attributesUpdated = function() this.domAgent._attributesUpdated.apply(this.domAgent, arguments); } -WebInspector.setDocumentElement = function() +WebInspector.setDocument = function() { - this.domAgent._setDocumentElement.apply(this.domAgent, arguments); + this.domAgent._setDocument.apply(this.domAgent, arguments); } WebInspector.setChildNodes = function() @@ -604,13 +588,11 @@ WebInspector.hasChildrenUpdated = function() WebInspector.childNodeInserted = function() { this.domAgent._childNodeInserted.apply(this.domAgent, arguments); - this._childNodeInserted.bind(this); } WebInspector.childNodeRemoved = function() { this.domAgent._childNodeRemoved.apply(this.domAgent, arguments); - this._childNodeRemoved.bind(this); } WebInspector.didGetChildNodes = WebInspector.Callback.processCallback; @@ -619,106 +601,122 @@ WebInspector.didApplyDomChange = WebInspector.Callback.processCallback; WebInspector.didRemoveAttribute = WebInspector.Callback.processCallback; WebInspector.didSetTextNodeValue = WebInspector.Callback.processCallback; -// Temporary methods for DOMAgent migration. -WebInspector.wrapNodeWithStyles = function(node, styles) -{ - var windowStub = new WebInspector.DOMWindow(null); - var docStub = new WebInspector.DOMDocument(null, windowStub); - var payload = {}; - payload.nodeType = node.nodeType; - payload.nodeName = node.nodeName; - payload.nodeValue = node.nodeValue; - payload.attributes = []; - payload.childNodeCount = 0; - - for (var i = 0; i < node.attributes.length; ++i) { - var attr = node.attributes[i]; - payload.attributes.push(attr.name); - payload.attributes.push(attr.value); - } - var nodeStub = new WebInspector.DOMNode(docStub, payload); - nodeStub._setStyles(styles.computedStyle, styles.inlineStyle, styles.styleAttributes, styles.matchedCSSRules); - return nodeStub; -} - // Temporary methods that will be dispatched via InspectorController into the injected context. InspectorController.getStyles = function(nodeId, authorOnly, callback) { setTimeout(function() { callback(InjectedScript.getStyles(nodeId, authorOnly)); - }, 0) + }, 0); } InspectorController.getComputedStyle = function(nodeId, callback) { setTimeout(function() { callback(InjectedScript.getComputedStyle(nodeId)); - }, 0) + }, 0); } InspectorController.getInlineStyle = function(nodeId, callback) { setTimeout(function() { callback(InjectedScript.getInlineStyle(nodeId)); - }, 0) + }, 0); } InspectorController.applyStyleText = function(styleId, styleText, propertyName, callback) { setTimeout(function() { callback(InjectedScript.applyStyleText(styleId, styleText, propertyName)); - }, 0) + }, 0); } InspectorController.setStyleText = function(style, cssText, callback) { setTimeout(function() { callback(InjectedScript.setStyleText(style, cssText)); - }, 0) + }, 0); } InspectorController.toggleStyleEnabled = function(styleId, propertyName, disabled, callback) { setTimeout(function() { callback(InjectedScript.toggleStyleEnabled(styleId, propertyName, disabled)); - }, 0) + }, 0); } -InspectorController.applyStyleRuleText = function(ruleId, newContent, selectedNode, callback) +InspectorController.applyStyleRuleText = function(ruleId, newContent, selectedNodeId, callback) { setTimeout(function() { - callback(InjectedScript.applyStyleRuleText(ruleId, newContent, selectedNode)); - }, 0) + callback(InjectedScript.applyStyleRuleText(ruleId, newContent, selectedNodeId)); + }, 0); } -InspectorController.addStyleSelector = function(newContent, callback) +InspectorController.addStyleSelector = function(newContent, selectedNodeId, callback) { setTimeout(function() { - callback(InjectedScript.addStyleSelector(newContent)); - }, 0) + callback(InjectedScript.addStyleSelector(newContent, selectedNodeId)); + }, 0); } -InspectorController.setStyleProperty = function(styleId, name, value, callback) { +InspectorController.setStyleProperty = function(styleId, name, value, callback) +{ setTimeout(function() { callback(InjectedScript.setStyleProperty(styleId, name, value)); - }, 0) + }, 0); } -InspectorController.getPrototypes = function(objectProxy, callback) { +InspectorController.getPrototypes = function(nodeId, callback) +{ setTimeout(function() { - callback(InjectedScript.getPrototypes(objectProxy)); - }, 0) + callback(InjectedScript.getPrototypes(nodeId)); + }, 0); } -InspectorController.getProperties = function(objectProxy, ignoreHasOwnProperty, callback) { +InspectorController.getProperties = function(objectProxy, ignoreHasOwnProperty, callback) +{ setTimeout(function() { callback(InjectedScript.getProperties(objectProxy, ignoreHasOwnProperty)); - }, 0) + }, 0); } -InspectorController.setPropertyValue = function(objectProxy, propertyName, expression, callback) { +InspectorController.setPropertyValue = function(objectProxy, propertyName, expression, callback) +{ setTimeout(function() { callback(InjectedScript.setPropertyValue(objectProxy, propertyName, expression)); - }, 0) + }, 0); +} + +InspectorController.evaluate = function(expression, callback) +{ + setTimeout(function() { + callback(InjectedScript.evaluate(expression)); + }, 0); +} + +InspectorController.addInspectedNode = function(nodeId, callback) +{ + setTimeout(function() { + callback(InjectedScript.addInspectedNode(nodeId)); + }, 0); +} + +InspectorController.performSearch = function(whitespaceTrimmedQuery, callback) +{ + setTimeout(function() { + callback(InjectedScript.performSearch(whitespaceTrimmedQuery)); + }, 0); +} + +InspectorController.searchCanceled = function(callback) +{ + setTimeout(function() { + callback(InjectedScript.searchCanceled()); + }, 0); } +InspectorController.getCookies = function(callback) +{ + setTimeout(function() { + callback(InjectedScript.getCookies()); + }, 0); +} diff --git a/WebCore/inspector/front-end/DOMStorageItemsView.js b/WebCore/inspector/front-end/DOMStorageItemsView.js index fad6e3c..514883f 100644 --- a/WebCore/inspector/front-end/DOMStorageItemsView.js +++ b/WebCore/inspector/front-end/DOMStorageItemsView.js @@ -32,21 +32,18 @@ WebInspector.DOMStorageItemsView = function(domStorage) this.element.addStyleClass("storage-view"); this.element.addStyleClass("table"); - this.deleteButton = document.createElement("button"); - this.deleteButton.title = WebInspector.UIString("Delete"); - this.deleteButton.className = "delete-storage-status-bar-item status-bar-item hidden"; + this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item"); + this.deleteButton.visible = false; this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false); - this.refreshButton = document.createElement("button"); - this.refreshButton.title = WebInspector.UIString("Refresh"); - this.refreshButton.className = "refresh-storage-status-bar-item status-bar-item"; + this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item"); this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false); } WebInspector.DOMStorageItemsView.prototype = { get statusBarItems() { - return [this.refreshButton, this.deleteButton]; + return [this.refreshButton.element, this.deleteButton.element]; }, show: function(parentElement) @@ -58,7 +55,7 @@ WebInspector.DOMStorageItemsView.prototype = { hide: function() { WebInspector.View.prototype.hide.call(this); - this.deleteButton.addStyleClass("hidden"); + this.deleteButton.visible = false; }, update: function() @@ -76,7 +73,7 @@ WebInspector.DOMStorageItemsView.prototype = { this._dataGrid = dataGrid; this.element.appendChild(dataGrid.element); this._dataGrid.updateWidths(); - this.deleteButton.removeStyleClass("hidden"); + this.deleteButton.visible = true; } } @@ -87,7 +84,7 @@ WebInspector.DOMStorageItemsView.prototype = { emptyMsgElement.textContent = WebInspector.UIString("This storage is empty."); this.element.appendChild(emptyMsgElement); this._dataGrid = null; - this.deleteButton.addStyleClass("hidden"); + this.deleteButton.visible = false; } }, diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js index 42e001c..ce61548 100644 --- a/WebCore/inspector/front-end/DataGrid.js +++ b/WebCore/inspector/front-end/DataGrid.js @@ -39,6 +39,8 @@ WebInspector.DataGrid = function(columns) this._dataTable.addEventListener("mousedown", this._mouseDownInDataTable.bind(this), true); this._dataTable.addEventListener("click", this._clickInDataTable.bind(this), true); + this.aligned = {}; + var scrollContainer = document.createElement("div"); scrollContainer.className = "data-container"; scrollContainer.appendChild(this._dataTable); @@ -78,6 +80,11 @@ WebInspector.DataGrid = function(columns) cell.addStyleClass("sortable"); } + if (column.aligned) { + cell.addStyleClass(column.aligned); + this.aligned[columnIdentifier] = column.aligned; + } + headerRow.appendChild(cell); ++columnCount; @@ -752,6 +759,10 @@ WebInspector.DataGridNode.prototype = { var cell = document.createElement("td"); cell.className = columnIdentifier + "-column"; + var alignment = this.dataGrid.aligned[columnIdentifier]; + if (alignment) + cell.addStyleClass(alignment); + var div = document.createElement("div"); div.textContent = this.data[columnIdentifier]; cell.appendChild(div); diff --git a/WebCore/inspector/front-end/DatabasesPanel.js b/WebCore/inspector/front-end/DatabasesPanel.js index a31e3ff..acbbe28 100644 --- a/WebCore/inspector/front-end/DatabasesPanel.js +++ b/WebCore/inspector/front-end/DatabasesPanel.js @@ -59,6 +59,10 @@ WebInspector.DatabasesPanel = function(database) this.sidebarTree.appendChild(this.sessionStorageListTreeElement); this.sessionStorageListTreeElement.expand(); + this.cookieListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("COOKIES"), {}, true); + this.sidebarTree.appendChild(this.cookieListTreeElement); + this.cookieListTreeElement.expand(); + this.storageViews = document.createElement("div"); this.storageViews.id = "storage-views"; this.element.appendChild(this.storageViews); @@ -87,6 +91,12 @@ WebInspector.DatabasesPanel.prototype = { WebInspector.Panel.prototype.show.call(this); this._updateSidebarWidth(); this._registerStorageEventListener(); + this.populateInterface(); + }, + + populateInterface: function() + { + this.addCookies(); }, reset: function() @@ -116,11 +126,15 @@ WebInspector.DatabasesPanel.prototype = { this._domStorage = []; + delete this.cookieTreeElement; + delete this._cookieView; + this.databasesListTreeElement.removeChildren(); this.localStorageListTreeElement.removeChildren(); this.sessionStorageListTreeElement.removeChildren(); - this.storageViews.removeChildren(); - + this.cookieListTreeElement.removeChildren(); + this.storageViews.removeChildren(); + this.storageViewStatusBarItemsContainer.removeChildren(); }, @@ -149,6 +163,14 @@ WebInspector.DatabasesPanel.prototype = { this.sessionStorageListTreeElement.appendChild(domStorageTreeElement); }, + addCookies: function() + { + if (!this.cookieTreeElement) { + this.cookieTreeElement = new WebInspector.CookieSidebarTreeElement(); + this.cookieListTreeElement.appendChild(this.cookieTreeElement); + } + }, + selectDatabase: function(db) { var database; @@ -235,6 +257,27 @@ WebInspector.DatabasesPanel.prototype = { this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]); }, + showCookies: function() + { + if (this.visibleView) + this.visibleView.hide(); + + var view = this._cookieView; + if (!view) { + view = new WebInspector.CookieItemsView(); + this._cookieView = view; + } + + view.show(this.storageViews); + + this.visibleView = view; + + this.storageViewStatusBarItemsContainer.removeChildren(); + var statusBarItems = view.statusBarItems; + for (var i = 0; i < statusBarItems.length; ++i) + this.storageViewStatusBarItemsContainer.appendChild(statusBarItems[i]); + }, + closeVisibleView: function() { if (this.visibleView) @@ -357,7 +400,7 @@ WebInspector.DatabasesPanel.prototype = { columns[0].title = WebInspector.UIString("Key"); columns[0].width = columns[0].title.length; columns[1].title = WebInspector.UIString("Value"); - columns[1].width = columns[0].title.length; + columns[1].width = columns[1].title.length; var nodes = []; @@ -380,7 +423,7 @@ WebInspector.DatabasesPanel.prototype = { } var totalColumnWidths = columns[0].width + columns[1].width; - width = Math.round((columns[0].width * 100) / totalColumnWidths); + var width = Math.round((columns[0].width * 100) / totalColumnWidths); const minimumPrecent = 10; if (width < minimumPrecent) width = minimumPrecent; @@ -400,7 +443,7 @@ WebInspector.DatabasesPanel.prototype = { nodes[0].selected = true; return dataGrid; }, - + resize: function() { var visibleView = this.visibleView; @@ -606,3 +649,39 @@ WebInspector.DOMStorageSidebarTreeElement.prototype = { } WebInspector.DOMStorageSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; + +WebInspector.CookieSidebarTreeElement = function() +{ + WebInspector.SidebarTreeElement.call(this, "cookie-sidebar-tree-item", null, "", null, false); + + this.refreshTitles(); +} + +WebInspector.CookieSidebarTreeElement.prototype = { + onselect: function() + { + WebInspector.panels.databases.showCookies(); + }, + + get mainTitle() + { + return WebInspector.UIString("Cookies"); + }, + + set mainTitle(x) + { + // Do nothing. + }, + + get subtitle() + { + return ""; + }, + + set subtitle(x) + { + // Do nothing. + } +} + +WebInspector.CookieSidebarTreeElement.prototype.__proto__ = WebInspector.SidebarTreeElement.prototype; diff --git a/WebCore/inspector/front-end/Drawer.js b/WebCore/inspector/front-end/Drawer.js index 23dc483..1b50f91 100644 --- a/WebCore/inspector/front-end/Drawer.js +++ b/WebCore/inspector/front-end/Drawer.js @@ -64,6 +64,12 @@ WebInspector.Drawer.prototype = { } }, + showView: function(view) + { + if (!this.visible || this.visibleView !== view) + this.visibleView = view; + }, + show: function() { if (this._animating || this.visible) diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js index ffa0000..1748159 100644 --- a/WebCore/inspector/front-end/ElementsPanel.js +++ b/WebCore/inspector/front-end/ElementsPanel.js @@ -61,7 +61,8 @@ WebInspector.ElementsPanel = function() InspectorController.toggleNodeSearch(); this.panel.nodeSearchButton.removeStyleClass("toggled-on"); } - WebInspector.console.addInspectedNode(this._focusedDOMNode); + if (this._focusedDOMNode) + InspectorController.addInspectedNode(this._focusedDOMNode.id, function() {}); }; this.contentElement.appendChild(this.treeOutline.element); @@ -97,10 +98,7 @@ WebInspector.ElementsPanel = function() this.sidebarResizeElement.className = "sidebar-resizer-vertical"; this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false); - this.nodeSearchButton = this.createStatusBarButton(); - this.nodeSearchButton.title = WebInspector.UIString("Select an element in the page to inspect it."); - this.nodeSearchButton.id = "node-search-status-bar-item"; - this.nodeSearchButton.className = "status-bar-item"; + this.nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item"); this.nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false); this.searchingForNode = false; @@ -109,13 +107,7 @@ WebInspector.ElementsPanel = function() this.element.appendChild(this.sidebarElement); this.element.appendChild(this.sidebarResizeElement); - this._mutationMonitoredWindows = []; - this._nodeInsertedEventListener = InspectorController.wrapCallback(this._nodeInserted.bind(this)); - this._nodeRemovedEventListener = InspectorController.wrapCallback(this._nodeRemoved.bind(this)); - this._contentLoadedEventListener = InspectorController.wrapCallback(this._contentLoaded.bind(this)); - - this.stylesheet = null; - this.styles = {}; + this._changedStyles = {}; this.reset(); } @@ -130,7 +122,7 @@ WebInspector.ElementsPanel.prototype = { get statusBarItems() { - return [this.nodeSearchButton, this.crumbsElement]; + return [this.nodeSearchButton.element, this.crumbsElement]; }, updateStatusBarItems: function() @@ -156,7 +148,7 @@ WebInspector.ElementsPanel.prototype = { if (InspectorController.searchingForNode()) { InspectorController.toggleNodeSearch(); - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = false; } }, @@ -175,40 +167,27 @@ WebInspector.ElementsPanel.prototype = { if (InspectorController.searchingForNode()) { InspectorController.toggleNodeSearch(); - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = false; } this.recentlyModifiedNodes = []; - this.unregisterAllMutationEventListeners(); delete this.currentQuery; this.searchCanceled(); - var inspectedWindow = Preferences.useDOMAgent ? WebInspector.domAgent.inspectedWindow : InspectorController.inspectedWindow(); - if (!inspectedWindow || !inspectedWindow.document) + var inspectedWindow = WebInspector.domAgent.inspectedWindow; + if (!inspectedWindow || !inspectedWindow.document || !inspectedWindow.document.firstChild) return; - if (!inspectedWindow.document.firstChild) { - function contentLoaded() - { - inspectedWindow.document.removeEventListener("DOMContentLoaded", contentLoadedCallback, false); - - this.reset(); - } - - var contentLoadedCallback = InspectorController.wrapCallback(contentLoaded.bind(this)); - inspectedWindow.document.addEventListener("DOMContentLoaded", contentLoadedCallback, false); - return; - } - // If the window isn't visible, return early so the DOM tree isn't built // and mutation event listeners are not added. if (!InspectorController.isWindowVisible()) return; - this.registerMutationEventListeners(inspectedWindow); - var inspectedRootDocument = inspectedWindow.document; + inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this)); + inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this)); + this.rootDOMNode = inspectedRootDocument; var canidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement; @@ -222,19 +201,11 @@ WebInspector.ElementsPanel.prototype = { } }, - includedInSearchResultsPropertyName: "__includedInInspectorSearchResults", - searchCanceled: function() { if (this._searchResults) { - const searchResultsProperty = this.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]; - - var treeElement = this.treeOutline.findTreeElement(node); + var treeElement = this.treeOutline.findTreeElement(this._searchResults[i]); if (treeElement) treeElement.highlighted = false; } @@ -242,13 +213,9 @@ WebInspector.ElementsPanel.prototype = { WebInspector.updateSearchMatchesCount(0, this); - if (this._currentSearchChunkIntervalIdentifier) { - clearInterval(this._currentSearchChunkIntervalIdentifier); - delete this._currentSearchChunkIntervalIdentifier; - } - this._currentSearchResultIndex = 0; this._searchResults = []; + InspectorController.searchCanceled(function() {}); }, performSearch: function(query) @@ -260,241 +227,56 @@ WebInspector.ElementsPanel.prototype = { if (!whitespaceTrimmedQuery.length) return; - 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 = query.escapeCharacters("'"); - const escapedTagNameQuery = (tagNameQuery ? tagNameQuery.escapeCharacters("'") : null); - const escapedWhitespaceTrimmedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); - const searchResultsProperty = this.includedInSearchResultsPropertyName; - - var updatedMatchCountOnce = false; - var matchesCountUpdateTimeout = null; - - function updateMatchesCount() - { - WebInspector.updateSearchMatchesCount(this._searchResults.length, this); - matchesCountUpdateTimeout = null; - updatedMatchCountOnce = true; - } - - function updateMatchesCountSoon() - { - if (!updatedMatchCountOnce) - return updateMatchesCount.call(this); - if (matchesCountUpdateTimeout) - return; - // Update the matches count every half-second so it doesn't feel twitchy. - matchesCountUpdateTimeout = setTimeout(updateMatchesCount.bind(this), 500); - } - - function addNodesToResults(nodes, length, getItem) - { - if (!length) - return; - - 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 (!this._searchResults.length) { - this._currentSearchResultIndex = 0; - this.focusedDOMNode = node; - } - - node[searchResultsProperty] = true; - this._searchResults.push(node); - - // Highlight the tree element to show it matched the search. - // FIXME: highlight the substrings in text nodes and attributes. - var treeElement = this.treeOutline.findTreeElement(node); - if (treeElement) - treeElement.highlighted = true; - } - - updateMatchesCountSoon.call(this); - } - - 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); - } + this._updatedMatchCountOnce = false; + this._matchesCountUpdateTimeout = null; - 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 < this._searchResults.length; ++i) - delete this._searchResults[i][searchResultsProperty]; - } + InspectorController.performSearch(whitespaceTrimmedQuery, function() {}); + }, - const mainFrameDocument = InspectorController.inspectedWindow().document; - const searchDocuments = [mainFrameDocument]; - - if (tagNameQuery && startTagFound && endTagFound) - const searchFunctions = [matchExactTagNames, matchPlainText]; - else if (tagNameQuery && startTagFound) - const 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(). - const 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. - const searchFunctions = [matchPartialAttributeValues, matchPlainText]; - } else - const searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery]; - - // Find all frames, iframes and object elements to search their documents. - const querySelectorAllFunction = InspectorController.inspectedWindow().Document.prototype.querySelectorAll; - const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "iframe, frame, object"); - - for (var i = 0; i < subdocumentResult.length; ++i) { - var element = subdocumentResult.item(i); - if (element.contentDocument) - searchDocuments.push(element.contentDocument); - } + _updateMatchesCount: function() + { + WebInspector.updateSearchMatchesCount(this._searchResults.length, this); + this._matchesCountUpdateTimeout = null; + this._updatedMatchCountOnce = true; + }, - const panel = this; - var documentIndex = 0; - var searchFunctionIndex = 0; - var chunkIntervalIdentifier = null; + _updateMatchesCountSoon: function() + { + if (!this._updatedMatchCountOnce) + return this._updateMatchesCount(); + if (this._matchesCountUpdateTimeout) + return; + // Update the matches count every half-second so it doesn't feel twitchy. + this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500); + }, - // Split up the work into chunks so we don't block the UI thread while processing. + addNodesToSearchResult: function(nodeIds) + { + if (!nodeIds) + return; - 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; - } + var nodeIdsArray = nodeIds.split(","); + for (var i = 0; i < nodeIdsArray.length; ++i) { + var nodeId = nodeIdsArray[i]; + var node = WebInspector.domAgent.nodeForId(nodeId); + if (!node) + continue; - searchDocument = searchDocuments[documentIndex]; + if (!this._searchResults.length) { + this._currentSearchResultIndex = 0; + this.focusedDOMNode = node; } - if (!searchDocument || !searchFunction) - return; + this._searchResults.push(node); - try { - searchFunction.call(panel, searchDocument); - } catch(err) { - // ignore any exceptions. the query might be malformed, but we allow that. - } + // Highlight the tree element to show it matched the search. + // FIXME: highlight the substrings in text nodes and attributes. + var treeElement = this.treeOutline.findTreeElement(node); + if (treeElement) + treeElement.highlighted = true; } - processChunk(); - - chunkIntervalIdentifier = setInterval(processChunk, 25); - this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; + this._updateMatchesCountSoon(); }, jumpToNextSearchResult: function() @@ -515,12 +297,6 @@ WebInspector.ElementsPanel.prototype = { this.focusedDOMNode = this._searchResults[this._currentSearchResultIndex]; }, - inspectedWindowCleared: function(window) - { - if (InspectorController.isWindowVisible()) - this.updateMutationEventListeners(window); - }, - renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector) { // TODO: Implement Shifting the oldSelector, and its contents to a newSelector @@ -532,16 +308,16 @@ WebInspector.ElementsPanel.prototype = { return; var selector = style.parentRule.selectorText; - if (!this.styles[identifier]) - this.styles[identifier] = {}; + if (!this._changedStyles[identifier]) + this._changedStyles[identifier] = {}; - if (!this.styles[identifier][selector]) - this.styles[identifier][selector] = {}; + if (!this._changedStyles[identifier][selector]) + this._changedStyles[identifier][selector] = {}; - if (!this.styles[identifier][selector][property]) + if (!this._changedStyles[identifier][selector][property]) WebInspector.styleChanges += 1; - this.styles[identifier][selector][property] = style.getPropertyValue(property); + this._changedStyles[identifier][selector][property] = style.getPropertyValue(property); }, removeStyleChange: function(identifier, style, property) @@ -550,11 +326,11 @@ WebInspector.ElementsPanel.prototype = { return; var selector = style.parentRule.selectorText; - if (!this.styles[identifier] || !this.styles[identifier][selector]) + if (!this._changedStyles[identifier] || !this._changedStyles[identifier][selector]) return; - if (this.styles[identifier][selector][property]) { - delete this.styles[identifier][selector][property]; + if (this._changedStyles[identifier][selector][property]) { + delete this._changedStyles[identifier][selector][property]; WebInspector.styleChanges -= 1; } }, @@ -566,20 +342,20 @@ WebInspector.ElementsPanel.prototype = { // Merge Down to Just Selectors var mergedSelectors = {}; - for (var identifier in this.styles) { - for (var selector in this.styles[identifier]) { + for (var identifier in this._changedStyles) { + for (var selector in this._changedStyles[identifier]) { if (!mergedSelectors[selector]) - mergedSelectors[selector] = this.styles[identifier][selector]; + mergedSelectors[selector] = this._changedStyles[identifier][selector]; else { // merge on selector var merge = {}; for (var property in mergedSelectors[selector]) merge[property] = mergedSelectors[selector][property]; - for (var property in this.styles[identifier][selector]) { + for (var property in this._changedStyles[identifier][selector]) { if (!merge[property]) - merge[property] = this.styles[identifier][selector][property]; + merge[property] = this._changedStyles[identifier][selector][property]; else { // merge on property within a selector, include comment to notify user var value1 = merge[property]; - var value2 = this.styles[identifier][selector][property]; + var value2 = this._changedStyles[identifier][selector][property]; if (value1 === value2) merge[property] = [value1]; @@ -636,53 +412,6 @@ WebInspector.ElementsPanel.prototype = { InspectorController.inspectedWindow().console.log(result); }, - _addMutationEventListeners: function(monitoredWindow) - { - monitoredWindow.document.addEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); - monitoredWindow.document.addEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); - if (monitoredWindow.frameElement) - monitoredWindow.addEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); - }, - - _removeMutationEventListeners: function(monitoredWindow) - { - if (monitoredWindow.frameElement) - monitoredWindow.removeEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); - if (!monitoredWindow.document) - return; - monitoredWindow.document.removeEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); - monitoredWindow.document.removeEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); - }, - - updateMutationEventListeners: function(monitoredWindow) - { - this._addMutationEventListeners(monitoredWindow); - }, - - registerMutationEventListeners: function(monitoredWindow) - { - if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) !== -1) - return; - this._mutationMonitoredWindows.push(monitoredWindow); - if (InspectorController.isWindowVisible()) - this._addMutationEventListeners(monitoredWindow); - }, - - unregisterMutationEventListeners: function(monitoredWindow) - { - if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) === -1) - return; - this._mutationMonitoredWindows.remove(monitoredWindow); - this._removeMutationEventListeners(monitoredWindow); - }, - - unregisterAllMutationEventListeners: function() - { - for (var i = 0; i < this._mutationMonitoredWindows.length; ++i) - this._removeMutationEventListeners(this._mutationMonitoredWindows[i]); - this._mutationMonitoredWindows = []; - }, - get rootDOMNode() { return this.treeOutline.rootDOMNode; @@ -703,13 +432,6 @@ WebInspector.ElementsPanel.prototype = { this.treeOutline.focusedDOMNode = x; }, - _contentLoaded: function(event) - { - this.recentlyModifiedNodes.push({node: event.target, parent: event.target.defaultView.frameElement, replaced: true}); - if (this.visible) - this._updateModifiedNodesSoon(); - }, - _nodeInserted: function(event) { this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true}); @@ -747,14 +469,14 @@ WebInspector.ElementsPanel.prototype = { if (!parent) continue; - var parentNodeItem = this.treeOutline.findTreeElement(parent, null, null, objectsAreSame); + var parentNodeItem = this.treeOutline.findTreeElement(parent); if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) { parentNodeItem.updateChildren(replaced); parentNodeItem.alreadyUpdatedChildren = true; updatedParentTreeElements.push(parentNodeItem); } - if (!updateBreadcrumbs && (objectsAreSame(this.focusedDOMNode, parent) || isAncestorIncludingParentFrames(this.focusedDOMNode, parent))) + if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestorIncludingParentFrames(this.focusedDOMNode, parent))) updateBreadcrumbs = true; } @@ -814,7 +536,7 @@ WebInspector.ElementsPanel.prototype = { var foundRoot = false; var crumb = crumbs.firstChild; while (crumb) { - if (objectsAreSame(crumb.representedObject, this.rootDOMNode)) + if (crumb.representedObject === this.rootDOMNode) foundRoot = true; if (foundRoot) @@ -822,7 +544,7 @@ WebInspector.ElementsPanel.prototype = { else crumb.removeStyleClass("dimmed"); - if (objectsAreSame(crumb.representedObject, this.focusedDOMNode)) { + if (crumb.representedObject === this.focusedDOMNode) { crumb.addStyleClass("selected"); handled = true; } else { @@ -879,7 +601,7 @@ WebInspector.ElementsPanel.prototype = { if (current.nodeType === Node.DOCUMENT_NODE) continue; - if (objectsAreSame(current, this.rootDOMNode)) + if (current === this.rootDOMNode) foundRoot = true; var crumb = document.createElement("span"); @@ -962,7 +684,7 @@ WebInspector.ElementsPanel.prototype = { if (foundRoot) crumb.addStyleClass("dimmed"); - if (objectsAreSame(current, this.focusedDOMNode)) + if (current === this.focusedDOMNode) crumb.addStyleClass("selected"); if (!crumbs.childNodes.length) crumb.addStyleClass("end"); @@ -1269,7 +991,8 @@ WebInspector.ElementsPanel.prototype = { switch (this.focusedDOMNode.nodeType) { case Node.ELEMENT_NODE: - var data = this.focusedDOMNode.outerHTML; + // TODO: Introduce InspectorController.copyEvent that pushes appropriate markup into the clipboard. + var data = null; break; case Node.COMMENT_NODE: @@ -1316,10 +1039,7 @@ WebInspector.ElementsPanel.prototype = { { InspectorController.toggleNodeSearch(); - if (InspectorController.searchingForNode()) - this.nodeSearchButton.addStyleClass("toggled-on"); - else - this.nodeSearchButton.removeStyleClass("toggled-on"); + this.nodeSearchButton.toggled = InspectorController.searchingForNode(); } } diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js index ef53209..345a084 100644 --- a/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -51,7 +51,7 @@ WebInspector.ElementsTreeOutline.prototype = { set rootDOMNode(x) { - if (objectsAreSame(this._rootDOMNode, x)) + if (this._rootDOMNode === x) return; this._rootDOMNode = x; @@ -66,7 +66,7 @@ WebInspector.ElementsTreeOutline.prototype = { set focusedDOMNode(x) { - if (objectsAreSame(this._focusedDOMNode, x)) { + if (this._focusedDOMNode === x) { this.revealAndSelectNode(x); return; } @@ -79,11 +79,11 @@ WebInspector.ElementsTreeOutline.prototype = { // and the select() call would change the focusedDOMNode and reenter this setter. So to // avoid calling focusedNodeChanged() twice, first check if _focusedDOMNode is the same // node as the one passed in. - if (objectsAreSame(this._focusedDOMNode, x)) { + if (this._focusedDOMNode === x) { this.focusedNodeChanged(); if (x && !this.suppressSelectHighlight) { - InspectorController.highlightDOMNode(x); + InspectorController.highlightDOMNode(x.id); if ("_restorePreviousHighlightNodeTimeout" in this) clearTimeout(this._restorePreviousHighlightNodeTimeout); @@ -92,7 +92,7 @@ WebInspector.ElementsTreeOutline.prototype = { { var hoveredNode = WebInspector.hoveredDOMNode; if (hoveredNode) - InspectorController.highlightDOMNode(hoveredNode); + InspectorController.highlightDOMNode(hoveredNode.id); else InspectorController.hideDOMNodeHighlight(); } @@ -138,19 +138,17 @@ WebInspector.ElementsTreeOutline.prototype = { focusedNodeChanged: function(forceUpdate) {}, - findTreeElement: function(node, isAncestor, getParent, equal) + findTreeElement: function(node, isAncestor, getParent) { if (typeof isAncestor === "undefined") isAncestor = isAncestorIncludingParentFrames; if (typeof getParent === "undefined") getParent = parentNodeOrFrameElement; - if (typeof equal === "undefined") - equal = objectsAreSame; - var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestor, getParent, equal); + var treeElement = TreeOutline.prototype.findTreeElement.call(this, node, isAncestor, getParent); if (!treeElement && node.nodeType === Node.TEXT_NODE) { // The text node might have been inlined if it was short, so try to find the parent element. - treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestor, getParent, equal); + treeElement = TreeOutline.prototype.findTreeElement.call(this, node.parentNode, isAncestor, getParent); } return treeElement; @@ -248,7 +246,7 @@ WebInspector.ElementsTreeOutline.prototype.__proto__ = TreeOutline.prototype; WebInspector.ElementsTreeElement = function(node) { - var hasChildren = node.contentDocument || (Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes()); + var hasChildren = Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes(); var titleInfo = nodeTitleInfo.call(node, hasChildren, WebInspector.linkifyURL); if (titleInfo.hasChildren) @@ -387,9 +385,14 @@ WebInspector.ElementsTreeElement.prototype = { this.updateChildren(); }, - + updateChildren: function(fullRefresh) { + WebInspector.domAgent.getChildNodesAsync(this.representedObject, this._updateChildren.bind(this, fullRefresh)); + }, + + _updateChildren: function(fullRefresh) + { if (fullRefresh) { var selectedTreeElement = this.treeOutline.selectedTreeElement; if (selectedTreeElement && selectedTreeElement.hasAncestor(this)) @@ -406,11 +409,11 @@ WebInspector.ElementsTreeElement.prototype = { var child = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(node) : node.firstChild); while (child) { var currentTreeElement = treeElement.children[treeChildIndex]; - if (!currentTreeElement || !objectsAreSame(currentTreeElement.representedObject, child)) { + if (!currentTreeElement || currentTreeElement.representedObject !== child) { // Find any existing element that is later in the children list. var existingTreeElement = null; for (var i = (treeChildIndex + 1); i < treeElement.children.length; ++i) { - if (objectsAreSame(treeElement.children[i].representedObject, child)) { + if (treeElement.children[i].representedObject === child) { existingTreeElement = treeElement.children[i]; break; } @@ -445,9 +448,7 @@ WebInspector.ElementsTreeElement.prototype = { var currentNode = currentChild.representedObject; var currentParentNode = currentNode.parentNode; - if (objectsAreSame(currentParentNode, this.representedObject)) - continue; - if (this.representedObject.contentDocument && objectsAreSame(currentParentNode, this.representedObject.contentDocument)) + if (currentParentNode === this.representedObject) continue; var selectedTreeElement = this.treeOutline.selectedTreeElement; @@ -455,13 +456,8 @@ WebInspector.ElementsTreeElement.prototype = { this.select(); this.removeChildAtIndex(i); - - if (this.treeOutline.panel && currentNode.contentDocument) - this.treeOutline.panel.unregisterMutationEventListeners(currentNode.contentDocument.defaultView); } - if (this.representedObject.contentDocument) - updateChildrenOfNode(this.representedObject.contentDocument); updateChildrenOfNode(this.representedObject); var lastChild = this.children[this.children.length - 1]; @@ -477,9 +473,6 @@ WebInspector.ElementsTreeElement.prototype = { onexpand: function() { this.treeOutline.updateSelection(); - - if (this.treeOutline.panel && this.representedObject.contentDocument) - this.treeOutline.panel.registerMutationEventListeners(this.representedObject.contentDocument.defaultView); }, oncollapse: function() @@ -693,7 +686,7 @@ WebInspector.ElementsTreeElement.prototype = { } if (!parseElement.hasAttributes()) { - InspectorController.inspectedWindow().Element.prototype.removeAttribute.call(this.representedObject, attributeName); + this.representedObject.removeAttribute(attributeName); this._updateTitle(); moveToNextAttributeIfNeeded.call(this); return; @@ -704,12 +697,12 @@ WebInspector.ElementsTreeElement.prototype = { var attr = parseElement.attributes[i]; foundOriginalAttribute = foundOriginalAttribute || attr.name === attributeName; try { - InspectorController.inspectedWindow().Element.prototype.setAttribute.call(this.representedObject, attr.name, attr.value); + this.representedObject.setAttribute(attr.name, attr.value); } catch(e) {} // ignore invalid attribute (innerHTML doesn't throw errors, but this can) } if (!foundOriginalAttribute) - InspectorController.inspectedWindow().Element.prototype.removeAttribute.call(this.representedObject, attributeName); + this.representedObject.removeAttribute(attributeName); this._updateTitle(); diff --git a/WebCore/inspector/front-end/Images/cookie.png b/WebCore/inspector/front-end/Images/cookie.png Binary files differnew file mode 100644 index 0000000..386d52b --- /dev/null +++ b/WebCore/inspector/front-end/Images/cookie.png diff --git a/WebCore/inspector/front-end/InjectedScript.js b/WebCore/inspector/front-end/InjectedScript.js index 4611b48..4144826 100644 --- a/WebCore/inspector/front-end/InjectedScript.js +++ b/WebCore/inspector/front-end/InjectedScript.js @@ -27,12 +27,20 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -var InjectedScript = { - _styles: {}, - _styleRules: {}, - _lastStyleId: 0, - _lastStyleRuleId: 0 -}; +var InjectedScript = {}; + +// Called from within InspectorController on the 'inspected page' side. +InjectedScript.reset = function() +{ + InjectedScript._styles = {}; + InjectedScript._styleRules = {}; + InjectedScript._lastStyleId = 0; + InjectedScript._lastStyleRuleId = 0; + InjectedScript._searchResults = []; + InjectedScript._includedInSearchResultsPropertyName = "__includedInInspectorSearchResults"; +} + +InjectedScript.reset(); InjectedScript.getStyles = function(nodeId, authorOnly) { @@ -174,12 +182,14 @@ InjectedScript.toggleStyleEnabled = function(styleId, propertyName, disabled) return InjectedScript._serializeStyle(style, true); } -InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNode) +InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNodeId) { var rule = InjectedScript._styleRules[ruleId]; if (!rule) return false; + var selectedNode = InjectedScript._nodeForId(selectedNodeId); + try { var stylesheet = rule.parentStyleSheet; stylesheet.addRule(newContent); @@ -194,20 +204,14 @@ InjectedScript.applyStyleRuleText = function(ruleId, newContent, selectedNode) } } - var nodes = selectedNode.ownerDocument.querySelectorAll(newContent); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] === selectedNode) { - return [InjectedScript._serializeRule(newRule), true]; - } - } - return [InjectedScript._serializeRule(newRule), false]; + return [InjectedScript._serializeRule(newRule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode)]; } catch(e) { // Report invalid syntax. return false; } } -InjectedScript.addStyleSelector = function(newContent) +InjectedScript.addStyleSelector = function(newContent, selectedNodeId) { var stylesheet = InjectedScript.stylesheet; if (!stylesheet) { @@ -227,10 +231,28 @@ InjectedScript.addStyleSelector = function(newContent) return false; } - return InjectedScript._serializeRule(stylesheet.cssRules[stylesheet.cssRules.length - 1]); + var selectedNode = InjectedScript._nodeForId(selectedNodeId); + var rule = stylesheet.cssRules[stylesheet.cssRules.length - 1]; + rule.__isViaInspector = true; + + return [ InjectedScript._serializeRule(rule), InjectedScript._doesSelectorAffectNode(newContent, selectedNode) ]; +} + +InjectedScript._doesSelectorAffectNode = function(selectorText, node) +{ + if (!node) + return false; + var nodes = node.ownerDocument.querySelectorAll(selectorText); + for (var i = 0; i < nodes.length; ++i) { + if (nodes[i] === node) { + return true; + } + } + return false; } -InjectedScript.setStyleProperty = function(styleId, name, value) { +InjectedScript.setStyleProperty = function(styleId, name, value) +{ var style = InjectedScript._styles[styleId]; if (!style) return false; @@ -251,17 +273,18 @@ InjectedScript._serializeRule = function(rule) } ruleValue.isUserAgent = parentStyleSheet && !parentStyleSheet.ownerNode && !parentStyleSheet.href; ruleValue.isUser = parentStyleSheet && parentStyleSheet.ownerNode && parentStyleSheet.ownerNode.nodeName == "#document"; + ruleValue.isViaInspector = !!rule.__isViaInspector; // Bind editable scripts only. var doBind = !ruleValue.isUserAgent && !ruleValue.isUser; ruleValue.style = InjectedScript._serializeStyle(rule.style, doBind); if (doBind) { - if (!rule._id) { - rule._id = InjectedScript._lastStyleRuleId++; - InjectedScript._styleRules[rule._id] = rule; + if (!rule.id) { + rule.id = InjectedScript._lastStyleRuleId++; + InjectedScript._styleRules[rule.id] = rule; } - ruleValue.id = rule._id; + ruleValue.id = rule.id; } return ruleValue; } @@ -295,11 +318,11 @@ InjectedScript._serializeStyle = function(style, doBind) result.uniqueStyleProperties = InjectedScript._getUniqueStyleProperties(style); if (doBind) { - if (!style._id) { - style._id = InjectedScript._lastStyleId++; - InjectedScript._styles[style._id] = style; + if (!style.id) { + style.id = InjectedScript._lastStyleId++; + InjectedScript._styles[style.id] = style; } - result.id = style._id; + result.id = style.id; } return result; } @@ -405,6 +428,7 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty) return false; var properties = []; + // Go over properties, prepare results. for (var propertyName in object) { if (!ignoreHasOwnProperty && "hasOwnProperty" in object && !object.hasOwnProperty(propertyName)) @@ -415,29 +439,31 @@ InjectedScript.getProperties = function(objectProxy, ignoreHasOwnProperty) continue; var property = {}; property.name = propertyName; + property.parentObjectProxy = objectProxy; var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName); if (!property.isGetter) { var childObject = object[propertyName]; - property.type = typeof childObject; - property.textContent = Object.describe(childObject, true); - property.parentObjectProxy = objectProxy; - var parentPath = objectProxy.path.slice(); - property.childObjectProxy = { - objectId : objectProxy.objectId, - path : parentPath.splice(parentPath.length, 0, propertyName), - protoDepth : objectProxy.protoDepth - }; - if (childObject && (property.type === "object" || property.type === "function")) { + var childObjectProxy = {}; + childObjectProxy.objectId = objectProxy.objectId; + childObjectProxy.path = objectProxy.path ? objectProxy.path.slice() : []; + childObjectProxy.path.push(propertyName); + + childObjectProxy.protoDepth = objectProxy.protoDepth || 0; + childObjectProxy.description = Object.describe(childObject, true); + property.value = childObjectProxy; + + var type = typeof childObject; + if (type === "object" || type === "function") { for (var subPropertyName in childObject) { if (propertyName === "__treeElementIdentifier") continue; - property.hasChildren = true; + childObjectProxy.hasChildren = true; break; } } } else { // FIXME: this should show something like "getter" (bug 16734). - property.textContent = "\u2014"; // em dash + property.value = { description: "\u2014" }; // em dash property.isGetter = true; } properties.push(property); @@ -479,6 +505,338 @@ InjectedScript.setPropertyValue = function(objectProxy, propertyName, expression } } +InjectedScript.evaluate = function(expression) +{ + InjectedScript._ensureCommandLineAPIInstalled(); + // Surround the expression in with statements to inject our command line API so that + // the window object properties still take more precedent than our API functions. + expression = "with (window._inspectorCommandLineAPI) { with (window) { " + expression + " } }"; + + var result = {}; + try { + var value = InjectedScript._window().eval(expression); + var wrapper = InspectorController.wrapObject(value); + if (typeof wrapper === "object" && wrapper.exception) + result.exception = wrapper.exception; + else + result.value = wrapper; + } catch (e) { + result.exception = e.toString(); + } + return result; +} + +InjectedScript.addInspectedNode = function(nodeId) +{ + var node = InjectedScript._nodeForId(nodeId); + if (!node) + return false; + + InjectedScript._ensureCommandLineAPIInstalled(); + var inspectedNodes = InjectedScript._window()._inspectorCommandLineAPI._inspectedNodes; + inspectedNodes.unshift(node); + if (inspectedNodes.length >= 5) + inspectedNodes.pop(); + return true; +} + +InjectedScript.performSearch = function(whitespaceTrimmedQuery, searchResultsProperty) +{ + 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 = whitespaceTrimmedQuery.escapeCharacters("'"); + const escapedTagNameQuery = (tagNameQuery ? tagNameQuery.escapeCharacters("'") : null); + const escapedWhitespaceTrimmedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); + 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 = InspectorController.pushNodePathToFrontend(node, false); + nodeIds.push(nodeId); + } + InspectorController.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 = InjectedScript._window().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 querySelectorAllFunction = InjectedScript._window().Document.prototype.querySelectorAll; + const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "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; + } + + searchDocument = searchDocuments[documentIndex]; + } + + if (!searchDocument || !searchFunction) + return; + + try { + searchFunction.call(panel, searchDocument); + } catch(err) { + // ignore any exceptions. the query might be malformed, but we allow that. + } + } + + 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.getCookies = function() +{ + return InjectedScript._window().document.cookie; +} + +InjectedScript._ensureCommandLineAPIInstalled = function(inspectedWindow) +{ + var inspectedWindow = InjectedScript._window(); + if (inspectedWindow._inspectorCommandLineAPI) + return; + + inspectedWindow.eval("window._inspectorCommandLineAPI = { \ + $: function() { return document.getElementById.apply(document, arguments) }, \ + $$: function() { return document.querySelectorAll.apply(document, arguments) }, \ + $x: function(xpath, context) { \ + var nodes = []; \ + try { \ + var doc = context || document; \ + var results = doc.evaluate(xpath, doc, null, XPathResult.ANY_TYPE, null); \ + var node; \ + while (node = results.iterateNext()) nodes.push(node); \ + } catch (e) {} \ + return nodes; \ + }, \ + dir: function() { return console.dir.apply(console, arguments) }, \ + dirxml: function() { return console.dirxml.apply(console, arguments) }, \ + keys: function(o) { var a = []; for (var k in o) a.push(k); return a; }, \ + values: function(o) { var a = []; for (var k in o) a.push(o[k]); return a; }, \ + profile: function() { return console.profile.apply(console, arguments) }, \ + profileEnd: function() { return console.profileEnd.apply(console, arguments) }, \ + _inspectedNodes: [], \ + get $0() { return _inspectorCommandLineAPI._inspectedNodes[0] }, \ + get $1() { return _inspectorCommandLineAPI._inspectedNodes[1] }, \ + get $2() { return _inspectorCommandLineAPI._inspectedNodes[2] }, \ + get $3() { return _inspectorCommandLineAPI._inspectedNodes[3] }, \ + get $4() { return _inspectorCommandLineAPI._inspectedNodes[4] } \ + };"); + + inspectedWindow._inspectorCommandLineAPI.clear = InspectorController.wrapCallback(InspectorController.clearMessages.bind(InspectorController, true)); + inspectedWindow._inspectorCommandLineAPI.inspect = InspectorController.wrapCallback(inspectObject.bind(this)); + + function inspectObject(o) + { + if (arguments.length === 0) + return; + + inspectedWindow.console.log(o); + if (Object.type(o, inspectedWindow) === "node") { + InspectorController.pushNodePathToFrontend(o, true); + } else { + switch (Object.describe(o)) { + case "Database": + InspectorController.selectDatabase(o); + break; + case "Storage": + InspectorController.selectDOMStorage(o); + break; + } + } + } +} + InjectedScript._resolveObject = function(objectProxy) { var object = InjectedScript._objectForId(objectProxy.objectId); @@ -486,11 +844,11 @@ InjectedScript._resolveObject = function(objectProxy) var protoDepth = objectProxy.protoDepth; // Follow the property path. - for (var i = 0; object && i < path.length; ++i) + for (var i = 0; object && path && i < path.length; ++i) object = object[path[i]]; // Get to the necessary proto layer. - for (var i = 0; object && i < protoDepth; ++i) + for (var i = 0; object && protoDepth && i < protoDepth; ++i) object = object.__proto__; return object; @@ -505,12 +863,34 @@ InjectedScript._window = function() InjectedScript._nodeForId = function(nodeId) { - // TODO: replace with node lookup in the InspectorDOMAgent once DOMAgent nodes are used. - return nodeId; + if (!nodeId) + return null; + return InspectorController.nodeForId(nodeId); } InjectedScript._objectForId = function(objectId) { - // TODO: replace with node lookups for node ids and evaluation result lookups for the rest of ids. + if (typeof objectId === "number") + return InjectedScript._nodeForId(objectId); + else if (typeof objectId === "string") + return InspectorController.unwrapObject(objectId); + + // TODO: move scope chain objects to proxy-based schema. return objectId; } + +// Called from within InspectorController on the 'inspected page' side. +InjectedScript.createProxyObject = function(object, objectId) +{ + var result = {}; + result.objectId = objectId; + result.type = Object.type(object, InjectedScript._window()); + if (result.type === "node") + result.nodeId = InspectorController.pushNodePathToFrontend(object, false); + try { + result.description = Object.describe(object, true, InjectedScript._window()); + } catch (e) { + result.exception = e.toString(); + } + return result; +} diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js index 9b03940..f0b877d 100644 --- a/WebCore/inspector/front-end/ObjectPropertiesSection.js +++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js @@ -124,13 +124,6 @@ WebInspector.ObjectPropertyTreeElement = function(property) } WebInspector.ObjectPropertyTreeElement.prototype = { - safePropertyValue: function(object, propertyName) - { - if (object["__lookupGetter__"] && object.__lookupGetter__(propertyName)) - return; - return object[propertyName]; - }, - onpopulate: function() { if (this.children.length && !this.shouldRefreshChildren) @@ -147,7 +140,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { self.appendChild(new self.treeOutline.section.treeElementConstructor(properties[i])); } }; - InspectorController.getProperties(this.property.childObjectProxy, false, callback); + InspectorController.getProperties(this.property.value, false, callback); }, ondblclick: function(element, event) @@ -168,7 +161,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.valueElement = document.createElement("span"); this.valueElement.className = "value"; - this.valueElement.textContent = this.property.textContent; + this.valueElement.textContent = this.property.value.description; if (this.property.isGetter) this.valueElement.addStyleClass("dimmed"); @@ -177,7 +170,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = { this.listItemElement.appendChild(nameElement); this.listItemElement.appendChild(document.createTextNode(": ")); this.listItemElement.appendChild(this.valueElement); - this.hasChildren = this.property.hasChildren; + this.hasChildren = this.property.value.hasChildren; }, updateSiblings: function() diff --git a/WebCore/inspector/front-end/ObjectProxy.js b/WebCore/inspector/front-end/ObjectProxy.js index fa7816e..dbb9e48 100644 --- a/WebCore/inspector/front-end/ObjectProxy.js +++ b/WebCore/inspector/front-end/ObjectProxy.js @@ -28,18 +28,17 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -WebInspector.ObjectProxy = function(objectId, path, protoDepth) +WebInspector.ObjectProxy = function(objectId, path, protoDepth, description, hasChildren) { this.objectId = objectId; this.path = path || []; this.protoDepth = protoDepth || 0; + this.description = description; + this.hasChildren = hasChildren; } WebInspector.ObjectPropertyProxy = function(name, object) { this.name = name; - this.type = "object"; - this.hasChildren = true; - this.textContent = Object.describe(object, true); - this.childObjectProxy = new WebInspector.ObjectProxy(object); + this.value = new WebInspector.ObjectProxy(object, [], 0, Object.describe(object, true), true); } diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js index 3e2212c..5046f6b 100644 --- a/WebCore/inspector/front-end/Panel.js +++ b/WebCore/inspector/front-end/Panel.js @@ -66,18 +66,6 @@ WebInspector.Panel.prototype = { return this._toolbarItem; }, - createStatusBarButton: function() - { - var button = document.createElement("button"); - var glyph = document.createElement("div"); - glyph.className = "glyph"; - button.appendChild(glyph); - var glyphShadow = document.createElement("div"); - glyphShadow.className = "glyph shadow"; - button.appendChild(glyphShadow); - return button; - }, - show: function() { WebInspector.View.prototype.show.call(this); diff --git a/WebCore/inspector/front-end/ProfileView.js b/WebCore/inspector/front-end/ProfileView.js index 2517bd2..5c9fcda 100644 --- a/WebCore/inspector/front-end/ProfileView.js +++ b/WebCore/inspector/front-end/ProfileView.js @@ -56,25 +56,19 @@ WebInspector.ProfileView = function(profile) this.viewSelectElement.appendChild(heavyViewOption); this.viewSelectElement.appendChild(treeViewOption); - this.percentButton = document.createElement("button"); - this.percentButton.className = "percent-time-status-bar-item status-bar-item"; + this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item"); this.percentButton.addEventListener("click", this._percentClicked.bind(this), false); - this.focusButton = document.createElement("button"); - this.focusButton.title = WebInspector.UIString("Focus selected function."); - this.focusButton.className = "focus-profile-node-status-bar-item status-bar-item"; + this.focusButton = new WebInspector.StatusBarButton(WebInspector.UIString("Focus selected function."), "focus-profile-node-status-bar-item"); this.focusButton.disabled = true; this.focusButton.addEventListener("click", this._focusClicked.bind(this), false); - this.excludeButton = document.createElement("button"); - this.excludeButton.title = WebInspector.UIString("Exclude selected function."); - this.excludeButton.className = "exclude-profile-node-status-bar-item status-bar-item"; + this.excludeButton = new WebInspector.StatusBarButton(WebInspector.UIString("Exclude selected function."), "exclude-profile-node-status-bar-item"); this.excludeButton.disabled = true; this.excludeButton.addEventListener("click", this._excludeClicked.bind(this), false); - this.resetButton = document.createElement("button"); - this.resetButton.title = WebInspector.UIString("Restore all functions."); - this.resetButton.className = "reset-profile-status-bar-item status-bar-item hidden"; + this.resetButton = new WebInspector.StatusBarButton(WebInspector.UIString("Restore all functions."), "reset-profile-status-bar-item"); + this.resetButton.visible = false; this.resetButton.addEventListener("click", this._resetClicked.bind(this), false); this.profile = profile; @@ -90,7 +84,7 @@ WebInspector.ProfileView = function(profile) WebInspector.ProfileView.prototype = { get statusBarItems() { - return [this.viewSelectElement, this.percentButton, this.focusButton, this.excludeButton, this.resetButton]; + return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element]; }, get profile() @@ -439,10 +433,10 @@ WebInspector.ProfileView.prototype = { { if (this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent) { this.percentButton.title = WebInspector.UIString("Show absolute total and self times."); - this.percentButton.addStyleClass("toggled-on"); + this.percentButton.toggled = true; } else { this.percentButton.title = WebInspector.UIString("Show total and self times as percentages."); - this.percentButton.removeStyleClass("toggled-on"); + this.percentButton.toggled = false; } }, @@ -451,7 +445,7 @@ WebInspector.ProfileView.prototype = { if (!this.dataGrid.selectedNode) return; - this.resetButton.removeStyleClass("hidden"); + this.resetButton.visible = true; this.profileDataGridTree.focus(this.dataGrid.selectedNode); this.refresh(); this.refreshVisibleData(); @@ -466,7 +460,7 @@ WebInspector.ProfileView.prototype = { selectedNode.deselect(); - this.resetButton.removeStyleClass("hidden"); + this.resetButton.visible = true; this.profileDataGridTree.exclude(selectedNode); this.refresh(); this.refreshVisibleData(); @@ -474,7 +468,7 @@ WebInspector.ProfileView.prototype = { _resetClicked: function(event) { - this.resetButton.addStyleClass("hidden"); + this.resetButton.visible = false; this.profileDataGridTree.restore(); this.refresh(); this.refreshVisibleData(); diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js index c8b948a..e7ee064 100644 --- a/WebCore/inspector/front-end/ProfilesPanel.js +++ b/WebCore/inspector/front-end/ProfilesPanel.js @@ -59,14 +59,10 @@ WebInspector.ProfilesPanel = function() this.profileViews.id = "profile-views"; this.element.appendChild(this.profileViews); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false); - this.recordButton = this.createStatusBarButton(); - this.recordButton.title = WebInspector.UIString("Start profiling."); - this.recordButton.id = "record-profile-status-bar-item"; - this.recordButton.className = "status-bar-item"; + this.recordButton = new WebInspector.StatusBarButton(WebInspector.UIString("Start profiling."), "record-profile-status-bar-item"); this.recordButton.addEventListener("click", this._recordClicked.bind(this), false); this.recording = false; @@ -87,7 +83,7 @@ WebInspector.ProfilesPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.recordButton, this.profileViewStatusBarItemsContainer]; + return [this.enableToggleButton.element, this.recordButton.element, this.profileViewStatusBarItemsContainer]; }, show: function() @@ -317,10 +313,10 @@ WebInspector.ProfilesPanel.prototype = { this.recording = isProfiling; if (isProfiling) { - this.recordButton.addStyleClass("toggled-on"); + this.recordButton.toggled = true; this.recordButton.title = WebInspector.UIString("Stop profiling."); } else { - this.recordButton.removeStyleClass("toggled-on"); + this.recordButton.toggled = false; this.recordButton.title = WebInspector.UIString("Start profiling."); } }, @@ -336,14 +332,14 @@ WebInspector.ProfilesPanel.prototype = { { if (InspectorController.profilerEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.recordButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.recordButton.visible = true; this.profileViewStatusBarItemsContainer.removeStyleClass("hidden"); this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.recordButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.recordButton.visible = false; this.profileViewStatusBarItemsContainer.addStyleClass("hidden"); this.panelEnablerView.visible = true; } diff --git a/WebCore/inspector/front-end/PropertiesSidebarPane.js b/WebCore/inspector/front-end/PropertiesSidebarPane.js index 2d32137..4e55761 100644 --- a/WebCore/inspector/front-end/PropertiesSidebarPane.js +++ b/WebCore/inspector/front-end/PropertiesSidebarPane.js @@ -32,7 +32,7 @@ WebInspector.PropertiesSidebarPane = function() } WebInspector.PropertiesSidebarPane.prototype = { - update: function(object) + update: function(node) { var body = this.bodyElement; @@ -40,7 +40,7 @@ WebInspector.PropertiesSidebarPane.prototype = { this.sections = []; - if (!object) + if (!node) return; var self = this; @@ -51,13 +51,13 @@ WebInspector.PropertiesSidebarPane.prototype = { // Get array of prototype user-friendly names. for (var i = 0; i < prototypes.length; ++i) { - var prototype = new WebInspector.ObjectProxy(object, [], i); + var prototype = new WebInspector.ObjectProxy(node.id, [], i); var section = new WebInspector.ObjectPropertiesSection(prototype, prototypes[i], WebInspector.UIString("Prototype")); self.sections.push(section); body.appendChild(section.element); } }; - InspectorController.getPrototypes(object, callback); + InspectorController.getPrototypes(node.id, callback); } } diff --git a/WebCore/inspector/front-end/ResourcesPanel.js b/WebCore/inspector/front-end/ResourcesPanel.js index fb43551..bb7faa6 100644 --- a/WebCore/inspector/front-end/ResourcesPanel.js +++ b/WebCore/inspector/front-end/ResourcesPanel.js @@ -139,14 +139,11 @@ WebInspector.ResourcesPanel = function() this.element.appendChild(this.panelEnablerView.element); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleResourceTracking.bind(this), false); - this.largerResourcesButton = this.createStatusBarButton(); - this.largerResourcesButton.id = "resources-larger-resources-status-bar-item"; - this.largerResourcesButton.className = "status-bar-item toggled-on"; - this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); + this.largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "resources-larger-resources-status-bar-item"); + this.largerResourcesButton.toggled = true; this.largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false); this.sortingSelectElement = document.createElement("select"); @@ -211,7 +208,7 @@ WebInspector.ResourcesPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.largerResourcesButton, this.sortingSelectElement]; + return [this.enableToggleButton.element, this.largerResourcesButton.element, this.sortingSelectElement]; }, show: function() @@ -467,14 +464,14 @@ WebInspector.ResourcesPanel.prototype = { if (InspectorController.resourceTrackingEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Resource tracking enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.largerResourcesButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.largerResourcesButton.visible = true; this.sortingSelectElement.removeStyleClass("hidden"); this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Resource tracking disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.largerResourcesButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.largerResourcesButton.visible = false; this.sortingSelectElement.addStyleClass("hidden"); this.panelEnablerView.visible = true; } @@ -1076,12 +1073,12 @@ WebInspector.ResourcesPanel.prototype = { if (this.resourcesTreeElement.smallChildren) { this.resourcesGraphsElement.addStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use large resource rows."); - this.largerResourcesButton.removeStyleClass("toggled-on"); + this.largerResourcesButton.toggled = false; this._adjustScrollPosition(); } else { this.resourcesGraphsElement.removeStyleClass("small"); this.largerResourcesButton.title = WebInspector.UIString("Use small resource rows."); - this.largerResourcesButton.addStyleClass("toggled-on"); + this.largerResourcesButton.toggled = true; } }, @@ -1546,6 +1543,11 @@ WebInspector.ResourceSidebarTreeElement.prototype = { // Do nothing. }, + get selectable() + { + return WebInspector.panels.resources._filterCategory == "all" || WebInspector.panels.resources._filterCategory == this.resource.category.name; + }, + createIconElement: function() { var previousIconElement = this.iconElement; diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js index 0058374..a97d5cf 100644 --- a/WebCore/inspector/front-end/ScriptsPanel.js +++ b/WebCore/inspector/front-end/ScriptsPanel.js @@ -151,13 +151,10 @@ WebInspector.ScriptsPanel = function() this.element.appendChild(this.sidebarElement); this.element.appendChild(this.sidebarResizeElement); - this.enableToggleButton = this.createStatusBarButton(); - this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; + this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false); - this.pauseOnExceptionButton = this.createStatusBarButton(); - this.pauseOnExceptionButton.id = "scripts-pause-on-exceptions-status-bar-item"; - this.pauseOnExceptionButton.className = "status-bar-item"; + this.pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item"); this.pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false); this._breakpointsURLMap = {}; @@ -208,7 +205,7 @@ WebInspector.ScriptsPanel.prototype = { get statusBarItems() { - return [this.enableToggleButton, this.pauseOnExceptionButton]; + return [this.enableToggleButton.element, this.pauseOnExceptionButton.element]; }, get paused() @@ -377,13 +374,8 @@ WebInspector.ScriptsPanel.prototype = { var panel = this; function delayedEvaluation() { - if (!code) { - // Evaluate into properties in scope of the selected call frame. - callback(panel._variablesInScope(callFrame)); - return; - } try { - callback(callFrame.evaluate(code)); + callback(InspectorController.wrapObject(callFrame.evaluate(code))); } catch (e) { callback(e, true); } @@ -391,10 +383,14 @@ WebInspector.ScriptsPanel.prototype = { setTimeout(delayedEvaluation, 0); }, - _variablesInScope: function(callFrame) + variablesInSelectedCallFrame: function() { + var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; + if (!this._paused || !selectedCallFrame) + return {}; + var result = {}; - var scopeChain = callFrame.scopeChain; + var scopeChain = selectedCallFrame.scopeChain; for (var i = 0; i < scopeChain.length; ++i) { var scopeObject = scopeChain[i]; for (var property in scopeObject) @@ -764,10 +760,10 @@ WebInspector.ScriptsPanel.prototype = { { if (InspectorController.pauseOnExceptions()) { this.pauseOnExceptionButton.title = WebInspector.UIString("Don't pause on exceptions."); - this.pauseOnExceptionButton.addStyleClass("toggled-on"); + this.pauseOnExceptionButton.toggled = true; } else { this.pauseOnExceptionButton.title = WebInspector.UIString("Pause on exceptions."); - this.pauseOnExceptionButton.removeStyleClass("toggled-on"); + this.pauseOnExceptionButton.toggled = false; } }, @@ -775,13 +771,13 @@ WebInspector.ScriptsPanel.prototype = { { if (InspectorController.debuggerEnabled()) { this.enableToggleButton.title = WebInspector.UIString("Debugging enabled. Click to disable."); - this.enableToggleButton.addStyleClass("toggled-on"); - this.pauseOnExceptionButton.removeStyleClass("hidden"); + this.enableToggleButton.toggled = true; + this.pauseOnExceptionButton.visible = true; this.panelEnablerView.visible = false; } else { this.enableToggleButton.title = WebInspector.UIString("Debugging disabled. Click to enable."); - this.enableToggleButton.removeStyleClass("toggled-on"); - this.pauseOnExceptionButton.addStyleClass("hidden"); + this.enableToggleButton.toggled = false; + this.pauseOnExceptionButton.visible = false; this.panelEnablerView.visible = true; } diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js index 930eb16..9c0f7e0 100644 --- a/WebCore/inspector/front-end/SourceFrame.js +++ b/WebCore/inspector/front-end/SourceFrame.js @@ -289,8 +289,10 @@ WebInspector.SourceFrame.prototype = { return; var sourceRow = event.target.enclosingNodeOrSelfWithNodeName("tr"); - if (sourceRow._breakpointObject) - sourceRow._breakpointObject.enabled = !sourceRow._breakpointObject.enabled; + if (sourceRow._breakpointObject && sourceRow._breakpointObject.enabled) + sourceRow._breakpointObject.enabled = false; + else if (sourceRow._breakpointObject) + WebInspector.panels.scripts.removeBreakpoint(sourceRow._breakpointObject); else if (this.addBreakpointDelegate) this.addBreakpointDelegate(this.lineNumberForSourceRow(sourceRow)); }, diff --git a/WebCore/inspector/front-end/StatusBarButton.js b/WebCore/inspector/front-end/StatusBarButton.js new file mode 100644 index 0000000..5c69ed5 --- /dev/null +++ b/WebCore/inspector/front-end/StatusBarButton.js @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +WebInspector.StatusBarButton = function(title, className) +{ + this.element = document.createElement("button"); + this.element.className = className + " status-bar-item"; + this.element.addEventListener("click", this._clicked.bind(this), false); + + this.glyph = document.createElement("div"); + this.glyph.className = "glyph"; + this.element.appendChild(this.glyph); + + this.glyphShadow = document.createElement("div"); + this.glyphShadow.className = "glyph shadow"; + this.element.appendChild(this.glyphShadow); + + this.title = title; + this.disabled = false; + this._toggled = false; + this._visible = true; +} + +WebInspector.StatusBarButton.prototype = { + _clicked: function() + { + this.dispatchEventToListeners("click"); + }, + + get disabled() + { + return this._disabled; + }, + + set disabled(x) + { + if (this._disabled === x) + return; + this._disabled = x; + this.element.disabled = x; + }, + + get title() + { + return this._title; + }, + + set title(x) + { + if (this._title === x) + return; + this._title = x; + this.element.title = x; + }, + + get toggled() + { + return this._toggled; + }, + + set toggled(x) + { + if (this._toggled === x) + return; + + if (x) + this.element.addStyleClass("toggled-on"); + else + this.element.removeStyleClass("toggled-on"); + this._toggled = x; + }, + + get visible() + { + return this._visible; + }, + + set visible(x) + { + if (this._visible === x) + return; + + if (x) + this.element.removeStyleClass("hidden"); + else + this.element.addStyleClass("hidden"); + this._visible = x; + } +} + +WebInspector.StatusBarButton.prototype.__proto__ = WebInspector.Object.prototype; diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js index 8a3a67f..db585e0 100644 --- a/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/WebCore/inspector/front-end/StylesSidebarPane.js @@ -67,10 +67,10 @@ WebInspector.StylesSidebarPane.prototype = { var callback = function(styles) { if (!styles) return; - var nodeWrapper = WebInspector.wrapNodeWithStyles(node, styles); - self._update(refresh, body, nodeWrapper, editedSection, forceUpdate); + node._setStyles(styles.computedStyle, styles.inlineStyle, styles.styleAttributes, styles.matchedCSSRules); + self._update(refresh, body, node, editedSection, forceUpdate); }; - InspectorController.getStyles(node, !Preferences.showUserAgentStyles, callback); + InspectorController.getStyles(node.id, !Preferences.showUserAgentStyles, callback); }, _update: function(refresh, body, node, editedSection, forceUpdate) @@ -322,8 +322,9 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl this.editable = (editable && !computedStyle); // Prevent editing the user agent and user rules. - var isUserAgent = this.styleRule.isUserAgent; - var isUser = this.styleRule.isUser; + var isUserAgent = this.rule && this.rule.isUserAgent; + var isUser = this.rule && this.rule.isUser; + var isViaInspector = this.rule && this.rule.isViaInspector; if (isUserAgent || isUser) this.editable = false; @@ -366,7 +367,7 @@ WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyl subtitle = WebInspector.UIString("user agent stylesheet"); else if (isUser) subtitle = WebInspector.UIString("user stylesheet"); - else if (this.styleRule.parentStyleSheet === WebInspector.panels.elements.stylesheet) + else if (isViaInspector) subtitle = WebInspector.UIString("via inspector"); else subtitle = WebInspector.UIString("inline stylesheet"); @@ -611,24 +612,12 @@ WebInspector.StylePropertiesSection.prototype = { moveToNextIfNeeded.call(self); }; - InspectorController.applyStyleRuleText(this.rule._id, newContent, this.pane.node, callback); + InspectorController.applyStyleRuleText(this.rule.id, newContent, this.pane.node.id, callback); }, editingSelectorCancelled: function(element, context) { element.textContent = context; - }, - - _doesSelectorAffectSelectedNode: function(selector) - { - var selectedNode = this.pane.node; - var nodes = selectedNode.ownerDocument.querySelectorAll(selector); - for (var i = 0; i < nodes.length; ++i) { - if (nodes[i] === selectedNode) - return true; - } - - return false; } } @@ -673,15 +662,17 @@ WebInspector.BlankStylePropertiesSection.prototype = { editingCommitted: function(element, newContent, oldContent, context) { var self = this; - var callback = function(styleRule) { - if (!styleRule) { + var callback = function(result) { + if (!result) { // Invalid Syntax for a Selector self.editingCancelled(); return; } + var styleRule = result[0]; + var doesSelectorAffectSelectedNode = result[1]; self.makeNormal(WebInspector.CSSStyleDeclaration.parseRule(styleRule)); - if (!self._doesSelectorAffectSelectedNode(newContent)) { + if (!doesSelectorAffectSelectedNode) { self.noAffect = true; self.element.addStyleClass("no-affect"); } @@ -692,7 +683,7 @@ WebInspector.BlankStylePropertiesSection.prototype = { self.pane.addBlankSection(); self.addNewBlankProperty().startEditing(); }; - InspectorController.addStyleSelector(newContent, callback); + InspectorController.addStyleSelector(newContent, this.pane.node.id, callback); }, makeNormal: function(styleRule) @@ -896,63 +887,70 @@ WebInspector.StylePropertyTreeElement.prototype = { // Simple: rgb -> hsl -> nickname? -> shorthex? -> hex -> ... // Advanced: rgba -> hsla -> nickname? -> ... if (colors && colors.length === 1) { - var color = new WebInspector.Color(htmlValue); - swatch.addEventListener("click", changeColorDisplay, false); - swatch.addEventListener("dblclick", function(event) { - event.stopPropagation(); - }, false); - - var mode = color.mode; - var valueElement = this.valueElement; - function changeColorDisplay(event) { - - function changeTo(newMode, content) { - mode = newMode; - valueElement.textContent = content; - } + try { + var color = new WebInspector.Color(htmlValue); + } catch(e) { + var color = null; + } + + if (color) { + swatch.addEventListener("click", changeColorDisplay, false); + swatch.addEventListener("dblclick", function(event) { + event.stopPropagation(); + }, false); - switch (mode) { - case "rgb": - changeTo("hsl", color.toHsl()); - break; + var mode = color.mode; + var valueElement = this.valueElement; + function changeColorDisplay(event) { - case "shorthex": - changeTo("hex", color.toHex()); - break; + function changeTo(newMode, content) { + mode = newMode; + valueElement.textContent = content; + } - case "hex": - changeTo("rgb", color.toRgb()); - break; + switch (mode) { + case "rgb": + changeTo("hsl", color.toHsl()); + break; - case "nickname": - if (color.simple) { - if (color.hasShortHex()) + case "shorthex": + changeTo("hex", color.toHex()); + break; + + case "hex": + changeTo("rgb", color.toRgb()); + break; + + case "nickname": + if (color.simple) { + if (color.hasShortHex()) + changeTo("shorthex", color.toShortHex()); + else + changeTo("hex", color.toHex()); + } else + changeTo("rgba", color.toRgba()); + break; + + case "hsl": + if (color.nickname) + changeTo("nickname", color.toNickname()); + else if (color.hasShortHex()) changeTo("shorthex", color.toShortHex()); else changeTo("hex", color.toHex()); - } else - changeTo("rgba", color.toRgba()); - break; - - case "hsl": - if (color.nickname) - changeTo("nickname", color.toNickname()); - else if (color.hasShortHex()) - changeTo("shorthex", color.toShortHex()); - else - changeTo("hex", color.toHex()); - break; - - case "rgba": - changeTo("hsla", color.toHsla()); - break; - - case "hsla": - if (color.nickname) - changeTo("nickname", color.toNickname()); - else - changeTo("rgba", color.toRgba()); - break; + break; + + case "rgba": + changeTo("hsla", color.toHsla()); + break; + + case "hsla": + if (color.nickname) + changeTo("nickname", color.toNickname()); + else + changeTo("rgba", color.toRgba()); + break; + } } } } @@ -992,7 +990,7 @@ WebInspector.StylePropertyTreeElement.prototype = { self.updateAll(true); }; - InspectorController.toggleStyleEnabled(this.style._id, this.name, disabled, callback); + InspectorController.toggleStyleEnabled(this.style.id, this.name, disabled, callback); }, updateState: function() @@ -1155,7 +1153,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. - InspectorController.setStyleText(this.style, this.originalCSSText); + InspectorController.setStyleText(this.style.id, this.originalCSSText); } this.applyStyleText(this.listItemElement.textContent); @@ -1175,7 +1173,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (this._newProperty) this.treeOutline.removeChild(this); else if (this.originalCSSText) { - InspectorController.setStyleText(this.style, this.originalCSSText); + InspectorController.setStyleText(this.style.id, this.originalCSSText); if (this.treeOutline.section && this.treeOutline.section.pane) this.treeOutline.section.pane.dispatchEventToListeners("style edited"); @@ -1294,7 +1292,7 @@ WebInspector.StylePropertyTreeElement.prototype = { if (!self.rule) WebInspector.panels.elements.treeOutline.update(); }; - InspectorController.applyStyleText(this.style._id, styleText.trimWhitespace(), this.name, callback); + InspectorController.applyStyleText(this.style.id, styleText.trimWhitespace(), this.name, callback); } } diff --git a/WebCore/inspector/front-end/WebKit.qrc b/WebCore/inspector/front-end/WebKit.qrc index c39c95b..c82de61 100644 --- a/WebCore/inspector/front-end/WebKit.qrc +++ b/WebCore/inspector/front-end/WebKit.qrc @@ -9,6 +9,7 @@ <file>ChangesView.js</file> <file>Color.js</file> <file>ConsoleView.js</file> + <file>CookieItemsView.js</file> <file>Database.js</file> <file>DatabaseQueryView.js</file> <file>DatabasesPanel.js</file> @@ -50,6 +51,7 @@ <file>SidebarTreeElement.js</file> <file>SourceFrame.js</file> <file>SourceView.js</file> + <file>StatusBarButton.js</file> <file>StylesSidebarPane.js</file> <file>TextPrompt.js</file> <file>TopDownProfileDataGridTree.js</file> @@ -62,6 +64,7 @@ <file>Images/clearConsoleButtonGlyph.png</file> <file>Images/closeButtons.png</file> <file>Images/consoleButtonGlyph.png</file> + <file>Images/cookie.png</file> <file>Images/database.png</file> <file>Images/databasesIcon.png</file> <file>Images/databaseTable.png</file> diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css index 51d626a..3292d8d 100644 --- a/WebCore/inspector/front-end/inspector.css +++ b/WebCore/inspector/front-end/inspector.css @@ -1626,6 +1626,10 @@ body.inactive .sidebar { content: url(Images/domStorage.png); } +.cookie-sidebar-tree-item .icon { + content: url(Images/cookie.png); +} + #storage-views { position: absolute; top: 0; @@ -1785,6 +1789,14 @@ body.inactive .sidebar { overflow: hidden; } +.data-grid .centered div { + text-align: center; +} + +.data-grid .right div { + text-align: right; +} + .data-grid th.sortable div { position: relative; } @@ -2091,7 +2103,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { -webkit-mask-image: url(Images/enableSolidButtonGlyph.png); } -#scripts-pause-on-exceptions-status-bar-item .glyph { +.scripts-pause-on-exceptions-status-bar-item .glyph { -webkit-mask-image: url(Images/pauseOnExceptionButtonGlyph.png); } @@ -2209,7 +2221,7 @@ button.enable-toggle-status-bar-item.toggled-on .glyph { overflow: auto; } -#resources-larger-resources-status-bar-item .glyph { +.resources-larger-resources-status-bar-item .glyph { -webkit-mask-image: url(Images/largerResourcesButtonGlyph.png); } @@ -3093,16 +3105,16 @@ body.inactive .sidebar-tree-item.selected .bubble.search-matches { button.enable-toggle-status-bar-item .glyph { } -#record-profile-status-bar-item .glyph { +.record-profile-status-bar-item .glyph { -webkit-mask-image: url(Images/recordButtonGlyph.png); } -#record-profile-status-bar-item.toggled-on .glyph { +.record-profile-status-bar-item.toggled-on .glyph { -webkit-mask-image: url(Images/recordToggledButtonGlyph.png); - background-color: rgb(216, 0, 0); + background-color: rgb(216, 0, 0) !important; } -#node-search-status-bar-item .glyph { +.node-search-status-bar-item .glyph { -webkit-mask-image: url(Images/nodeSearchButtonGlyph.png); } @@ -3136,12 +3148,8 @@ button.enable-toggle-status-bar-item .glyph { margin-left: -1px; } -.refresh-storage-status-bar-item { - background-image: url(Images/reloadButtons.png) !important; -} - -.refresh-storage-status-bar-item:active { - background-position: 32px 0; +.refresh-storage-status-bar-item .glyph { + -webkit-mask-image: url(Images/reloadButtonGlyph.png); } #storage-view-status-bar-items { diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html index a3dc407..4857c7a 100644 --- a/WebCore/inspector/front-end/inspector.html +++ b/WebCore/inspector/front-end/inspector.html @@ -49,6 +49,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="DOMStorageItemsView.js"></script> <script type="text/javascript" src="DataGrid.js"></script> <script type="text/javascript" src="DOMStorageDataGrid.js"></script> + <script type="text/javascript" src="CookieItemsView.js"></script> <script type="text/javascript" src="Script.js"></script> <script type="text/javascript" src="Breakpoint.js"></script> <script type="text/javascript" src="SidebarPane.js"></script> @@ -66,6 +67,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <script type="text/javascript" src="StylesSidebarPane.js"></script> <script type="text/javascript" src="Panel.js"></script> <script type="text/javascript" src="PanelEnablerView.js"></script> + <script type="text/javascript" src="StatusBarButton.js"></script> <script type="text/javascript" src="ElementsPanel.js"></script> <script type="text/javascript" src="ResourcesPanel.js"></script> <script type="text/javascript" src="ScriptsPanel.js"></script> diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js index aa21a86..f6377c2 100644 --- a/WebCore/inspector/front-end/inspector.js +++ b/WebCore/inspector/front-end/inspector.js @@ -39,7 +39,6 @@ var Preferences = { showInheritedComputedStyleProperties: false, styleRulesExpandedState: {}, showMissingLocalizedStrings: false, - useDOMAgent: false } var WebInspector = { @@ -307,7 +306,7 @@ var WebInspector = { set hoveredDOMNode(x) { - if (objectsAreSame(this._hoveredDOMNode, x)) + if (this._hoveredDOMNode === x) return; this._hoveredDOMNode = x; @@ -333,7 +332,7 @@ var WebInspector = { } if (this._hoveredDOMNode) { - InspectorController.highlightDOMNode(this._hoveredDOMNode); + InspectorController.highlightDOMNode(this._hoveredDOMNode.id); this.showingDOMNodeHighlight = true; } else { InspectorController.hideDOMNodeHighlight(); @@ -353,9 +352,7 @@ WebInspector.loaded = function() // this.changes = new WebInspector.ChangesView(this.drawer); // TODO: Remove class="hidden" from inspector.html on button#changes-status-bar-item this.drawer.visibleView = this.console; - - if (Preferences.useDOMAgent) - this.domAgent = new WebInspector.DOMAgent(); + this.domAgent = new WebInspector.DOMAgent(); this.resourceCategories = { documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), @@ -441,7 +438,7 @@ WebInspector.loaded = function() document.getElementById("toolbar").addEventListener("mousedown", this.toolbarDragStart, true); document.getElementById("close-button").addEventListener("click", this.close, true); - InspectorController.loaded(Preferences.useDOMAgent); + InspectorController.loaded(); } var windowLoaded = function() @@ -853,12 +850,12 @@ WebInspector.elementDragEnd = function(event) WebInspector.showConsole = function() { - this.drawer.visibleView = this.console; + this.drawer.showView(this.console); } WebInspector.showChanges = function() { - this.drawer.visibleView = this.changes; + this.drawer.showView(this.changes); } WebInspector.showElementsPanel = function() @@ -909,6 +906,23 @@ WebInspector.addResource = function(identifier, payload) this.panels.resources.addResource(resource); } +WebInspector.clearConsoleMessages = function() +{ + WebInspector.console.clearMessages(false); +} + +WebInspector.selectDatabase = function(o) +{ + WebInspector.showDatabasesPanel(); + WebInspector.panels.databases.selectDatabase(o); +} + +WebInspector.selectDOMStorage = function(o) +{ + WebInspector.showDatabasesPanel(); + WebInspector.panels.databases.selectDOMStorage(o); +} + WebInspector.updateResource = function(identifier, payload) { var resource = this.resources[identifier]; @@ -1073,11 +1087,6 @@ WebInspector.reset = function() this.console.clearMessages(); } -WebInspector.inspectedWindowCleared = function(inspectedWindow) -{ - this.panels.elements.inspectedWindowCleared(inspectedWindow); -} - WebInspector.resourceURLChanged = function(resource, oldURL) { delete this.resourceURLMap[oldURL]; @@ -1138,8 +1147,9 @@ WebInspector.drawLoadingPieChart = function(canvas, percent) { g.fill(); } -WebInspector.updateFocusedNode = function(node) +WebInspector.updateFocusedNode = function(nodeId) { + var node = WebInspector.domAgent.nodeForId(nodeId); if (!node) // FIXME: Should we deselect if null is passed in? return; @@ -1329,6 +1339,11 @@ WebInspector.performSearch = function(event) this.currentPanel.performSearch(query); } +WebInspector.addNodesToSearchResult = function(nodeIds) +{ + WebInspector.panels.elements.addNodesToSearchResult(nodeIds); +} + WebInspector.updateSearchMatchesCount = function(matches, panel) { if (!panel) diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js index 579e7fb..67f35c2 100644 --- a/WebCore/inspector/front-end/treeoutline.js +++ b/WebCore/inspector/front-end/treeoutline.js @@ -249,21 +249,18 @@ TreeOutline.prototype._forgetChildrenRecursive = function(parentElement) } } -TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent, equal) +TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent) { if (!representedObject) return null; - if (!equal) - equal = function(a, b) { return a === b }; - if ("__treeElementIdentifier" in representedObject) { // If this representedObject has a tree element identifier, and it is a known TreeElement // in our tree we can just return that tree element. var elements = this._knownTreeElements[representedObject.__treeElementIdentifier]; if (elements) { for (var i = 0; i < elements.length; ++i) - if (equal(elements[i].representedObject, representedObject)) + if (elements[i].representedObject === representedObject) return elements[i]; } } @@ -277,7 +274,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var found = false; for (var i = 0; i < this.children.length; ++i) { item = this.children[i]; - if (equal(item.representedObject, representedObject) || isAncestor(item.representedObject, representedObject)) { + if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) { found = true; break; } @@ -292,7 +289,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var currentObject = representedObject; while (currentObject) { ancestors.unshift(currentObject); - if (equal(currentObject, item.representedObject)) + if (currentObject === item.representedObject) break; currentObject = getParent(currentObject); } @@ -301,18 +298,18 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, for (var i = 0; i < ancestors.length; ++i) { // Make sure we don't call findTreeElement with the same representedObject // again, to prevent infinite recursion. - if (equal(ancestors[i], representedObject)) + if (ancestors[i] === representedObject) continue; // FIXME: we could do something faster than findTreeElement since we will know the next // ancestor exists in the tree. - item = this.findTreeElement(ancestors[i], isAncestor, getParent, equal); + item = this.findTreeElement(ancestors[i], isAncestor, getParent); if (item && item.onpopulate) item.onpopulate(item); } // Now that all the ancestors are populated, try to find the representedObject again. This time // without the isAncestor and getParent functions to prevent an infinite recursion if it isn't found. - return this.findTreeElement(representedObject, null, null, equal); + return this.findTreeElement(representedObject); } TreeOutline.prototype.treeElementFromPoint = function(x, y) diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js index eec0b87..e60af42 100644 --- a/WebCore/inspector/front-end/utilities.js +++ b/WebCore/inspector/front-end/utilities.js @@ -56,6 +56,18 @@ Object.type = function(obj, win) return type; } +Object.proxyType = function(objectProxy) +{ + if (objectProxy === null) + return "null"; + + var type = typeof objectProxy; + if (type !== "object" && type !== "function") + return type; + + return objectProxy.type; +} + Object.hasProperties = function(obj) { if (typeof obj === "undefined" || typeof obj === "null") @@ -65,9 +77,9 @@ Object.hasProperties = function(obj) return false; } -Object.describe = function(obj, abbreviated) +Object.describe = function(obj, abbreviated, win) { - var type1 = Object.type(obj); + var type1 = Object.type(obj, win); var type2 = Object.prototype.toString.call(obj).replace(/^\[object (.*)\]$/i, "$1"); switch (type1) { @@ -238,7 +250,7 @@ Element.prototype.hasStyleClass = function(className) Node.prototype.enclosingNodeOrSelfWithNodeNameInArray = function(nameArray) { - for (var node = this; node && !objectsAreSame(node, this.ownerDocument); node = node.parentNode) + for (var node = this; node && node !== this.ownerDocument; node = node.parentNode) for (var i = 0; i < nameArray.length; ++i) if (node.nodeName.toLowerCase() === nameArray[i].toLowerCase()) return node; @@ -252,7 +264,7 @@ Node.prototype.enclosingNodeOrSelfWithNodeName = function(nodeName) Node.prototype.enclosingNodeOrSelfWithClass = function(className) { - for (var node = this; node && !objectsAreSame(node, this.ownerDocument); node = node.parentNode) + for (var node = this; node && node !== this.ownerDocument; node = node.parentNode) if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className)) return node; return null; @@ -518,21 +530,6 @@ function nodeContentPreview() return preview.collapseWhitespace(); } -function objectsAreSame(a, b) -{ - // FIXME: Make this more generic so is works with any wrapped object, not just nodes. - // This function is used to compare nodes that might be JSInspectedObjectWrappers, since - // JavaScript equality is not true for JSInspectedObjectWrappers of the same node wrapped - // with different global ExecStates, we use isSameNode to compare them. - if (a === b) - return true; - if (!a || !b) - return false; - if (a.isSameNode && b.isSameNode) - return a.isSameNode(b); - return false; -} - function isAncestorNode(ancestor) { if (!this || !ancestor) @@ -540,7 +537,7 @@ function isAncestorNode(ancestor) var currentNode = ancestor.parentNode; while (currentNode) { - if (objectsAreSame(this, currentNode)) + if (this === currentNode) return true; currentNode = currentNode.parentNode; } @@ -561,13 +558,13 @@ function firstCommonNodeAncestor(node) var node1 = this.parentNode; var node2 = node.parentNode; - if ((!node1 || !node2) || !objectsAreSame(node1, node2)) + if ((!node1 || !node2) || node1 !== node2) return null; while (node1 && node2) { if (!node1.parentNode || !node2.parentNode) break; - if (!objectsAreSame(node1, node2)) + if (node1 !== node2) break; node1 = node1.parentNode; @@ -626,7 +623,7 @@ function traverseNextNode(skipWhitespace, stayWithin) if (node) return node; - if (stayWithin && objectsAreSame(this, stayWithin)) + if (stayWithin && this === stayWithin) return null; node = skipWhitespace ? nextSiblingSkippingWhitespace.call(this) : this.nextSibling; @@ -634,7 +631,7 @@ function traverseNextNode(skipWhitespace, stayWithin) return node; node = this; - while (node && !(skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling) && (!stayWithin || !node.parentNode || !objectsAreSame(node.parentNode, stayWithin))) + while (node && !(skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling) && (!stayWithin || !node.parentNode || node.parentNode !== stayWithin)) node = node.parentNode; if (!node) return null; @@ -646,7 +643,7 @@ function traversePreviousNode(skipWhitespace, stayWithin) { if (!this) return; - if (stayWithin && objectsAreSame(this, stayWithin)) + if (stayWithin && this === stayWithin) return null; var node = skipWhitespace ? previousSiblingSkippingWhitespace.call(this) : this.previousSibling; while (node && (skipWhitespace ? lastChildSkippingWhitespace.call(node) : node.lastChild) ) @@ -756,10 +753,10 @@ function parentNodeOrFrameElement(node) { } function isAncestorIncludingParentFrames(a, b) { - if (objectsAreSame(a, b)) + if (a === b) return false; for (var node = b; node; node = getDocumentForNode(node).defaultView.frameElement) - if (objectsAreSame(a, node) || isAncestorNode.call(a, node)) + if (a === node || isAncestorNode.call(a, node)) return true; return false; } @@ -790,20 +787,27 @@ Number.secondsToString = function(seconds, formatterFunction, higherResolution) return formatterFunction("%.1f days", days); } -Number.bytesToString = function(bytes, formatterFunction) +Number.bytesToString = function(bytes, formatterFunction, higherResolution) { if (!formatterFunction) formatterFunction = String.sprintf; + if (typeof higherResolution === "undefined") + higherResolution = true; if (bytes < 1024) return formatterFunction("%.0fB", bytes); var kilobytes = bytes / 1024; - if (kilobytes < 1024) + if (higherResolution && kilobytes < 1024) return formatterFunction("%.2fKB", kilobytes); + else if (kilobytes < 1024) + return formatterFunction("%.0fKB", kilobytes); var megabytes = kilobytes / 1024; - return formatterFunction("%.3fMB", megabytes); + if (higherResolution) + return formatterFunction("%.3fMB", megabytes); + else + return formatterFunction("%.0fMB", megabytes); } Number.constrain = function(num, min, max) diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp index dfb9dd8..8da746c 100644 --- a/WebCore/loader/CachedFont.cpp +++ b/WebCore/loader/CachedFont.cpp @@ -31,7 +31,7 @@ #include "CachedResourceClientWalker.h" #include "DOMImplementation.h" #include "FontPlatformData.h" -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) #include "FontCustomPlatformData.h" #endif #include "TextResourceDecoder.h" @@ -60,7 +60,7 @@ CachedFont::CachedFont(const String &url) CachedFont::~CachedFont() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) delete m_fontData; #endif } @@ -98,7 +98,7 @@ void CachedFont::beginLoadIfNeeded(DocLoader* dl) bool CachedFont::ensureCustomFontData() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) #if ENABLE(SVG_FONTS) ASSERT(!m_isSVGFont); #endif @@ -117,7 +117,7 @@ FontPlatformData CachedFont::platformDataFromCustomData(float size, bool bold, b if (m_externalSVGDocument) return FontPlatformData(size, bold, italic); #endif -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) ASSERT(m_fontData); return m_fontData->fontPlatformData(static_cast<int>(size), bold, italic, renderingMode); #else @@ -173,7 +173,7 @@ SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const void CachedFont::allClientsRemoved() { -#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) +#if PLATFORM(CG) || PLATFORM(QT) || PLATFORM(GTK) || (PLATFORM(CHROMIUM) && (PLATFORM(WIN_OS) || PLATFORM(LINUX))) || PLATFORM(HAIKU) if (m_fontData) { delete m_fontData; m_fontData = 0; diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp index 4ec69a7..2c170d0 100644 --- a/WebCore/loader/DocumentLoader.cpp +++ b/WebCore/loader/DocumentLoader.cpp @@ -148,7 +148,6 @@ DocumentLoader::DocumentLoader(const ResourceRequest& req, const SubstituteData& , m_gotFirstByte(false) , m_primaryLoadComplete(false) , m_isClientRedirect(false) - , m_loadingFromCachedPage(false) , m_stopRecordingResponses(false) , m_substituteResourceDeliveryTimer(this, &DocumentLoader::substituteResourceDeliveryTimerFired) , m_didCreateGlobalHistoryEntry(false) @@ -697,16 +696,6 @@ bool DocumentLoader::urlForHistoryReflectsFailure() const return m_substituteData.isValid() || m_response.httpStatusCode() >= 400; } -void DocumentLoader::loadFromCachedPage(PassRefPtr<CachedPage> cachedPage) -{ - LOG(PageCache, "WebCorePageCache: DocumentLoader %p loading from cached page %p", this, cachedPage.get()); - - prepareForLoadStart(); - setLoadingFromCachedPage(true); - setCommitted(true); - frameLoader()->commitProvisionalLoad(cachedPage); -} - const KURL& DocumentLoader::originalURL() const { return m_originalRequestCopy.url(); diff --git a/WebCore/loader/DocumentLoader.h b/WebCore/loader/DocumentLoader.h index 134d954..cd28e06 100644 --- a/WebCore/loader/DocumentLoader.h +++ b/WebCore/loader/DocumentLoader.h @@ -174,10 +174,6 @@ namespace WebCore { bool didCreateGlobalHistoryEntry() const { return m_didCreateGlobalHistoryEntry; } void setDidCreateGlobalHistoryEntry(bool didCreateGlobalHistoryEntry) { m_didCreateGlobalHistoryEntry = didCreateGlobalHistoryEntry; } - void loadFromCachedPage(PassRefPtr<CachedPage>); - void setLoadingFromCachedPage(bool loading) { m_loadingFromCachedPage = loading; } - bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } - void setDefersLoading(bool); bool startLoadingMainResource(unsigned long identifier); @@ -264,7 +260,6 @@ namespace WebCore { bool m_gotFirstByte; bool m_primaryLoadComplete; bool m_isClientRedirect; - bool m_loadingFromCachedPage; String m_pageTitle; diff --git a/WebCore/loader/DocumentThreadableLoader.cpp b/WebCore/loader/DocumentThreadableLoader.cpp index dd5ca76..0d8dc18 100644 --- a/WebCore/loader/DocumentThreadableLoader.cpp +++ b/WebCore/loader/DocumentThreadableLoader.cpp @@ -32,8 +32,9 @@ #include "DocumentThreadableLoader.h" #include "AuthenticationChallenge.h" +#include "CrossOriginAccessControl.h" +#include "CrossOriginPreflightResultCache.h" #include "Document.h" -#include "DocumentThreadableLoader.h" #include "Frame.h" #include "FrameLoader.h" #include "ResourceRequest.h" @@ -43,61 +44,107 @@ namespace WebCore { -void DocumentThreadableLoader::loadResourceSynchronously(Document* document, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials) +void DocumentThreadableLoader::loadResourceSynchronously(Document* document, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { - bool sameOriginRequest = document->securityOrigin()->canRequest(request.url()); - - Vector<char> data; - ResourceError error; - ResourceResponse response; - unsigned long identifier = std::numeric_limits<unsigned long>::max(); - if (document->frame()) - identifier = document->frame()->loader()->loadResourceSynchronously(request, storedCredentials, error, response, data); - - // No exception for file:/// resources, see <rdar://problem/4962298>. - // Also, if we have an HTTP response, then it wasn't a network error in fact. - if (!error.isNull() && !request.url().isLocalFile() && response.httpStatusCode() <= 0) { - client.didFail(error); - return; - } - - // FIXME: This check along with the one in willSendRequest is specific to xhr and - // should be made more generic. - if (sameOriginRequest && !document->securityOrigin()->canRequest(response.url())) { - client.didFailRedirectCheck(); - return; - } - - client.didReceiveResponse(response); - - const char* bytes = static_cast<const char*>(data.data()); - int len = static_cast<int>(data.size()); - client.didReceiveData(bytes, len); - - client.didFinishLoading(identifier); + // The loader will be deleted as soon as this function exits. + RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, &client, LoadSynchronously, request, options)); + ASSERT(loader->hasOneRef()); } -PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +PassRefPtr<DocumentThreadableLoader> DocumentThreadableLoader::create(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options) { - ASSERT(document); - RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + RefPtr<DocumentThreadableLoader> loader = adoptRef(new DocumentThreadableLoader(document, client, LoadAsynchronously, request, options)); if (!loader->m_loader) loader = 0; return loader.release(); } -DocumentThreadableLoader::DocumentThreadableLoader(Document* document, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +DocumentThreadableLoader::DocumentThreadableLoader(Document* document, ThreadableLoaderClient* client, BlockingBehavior blockingBehavior, const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_client(client) , m_document(document) - , m_allowStoredCredentials(storedCredentials == AllowStoredCredentials) + , m_options(options) , m_sameOriginRequest(document->securityOrigin()->canRequest(request.url())) - , m_denyCrossOriginRedirect(crossOriginRedirectPolicy == DenyCrossOriginRedirect) + , m_async(blockingBehavior == LoadAsynchronously) { ASSERT(document); ASSERT(client); - ASSERT(storedCredentials == AllowStoredCredentials || storedCredentials == DoNotAllowStoredCredentials); - ASSERT(crossOriginRedirectPolicy == DenyCrossOriginRedirect || crossOriginRedirectPolicy == AllowCrossOriginRedirect); - m_loader = SubresourceLoader::create(document->frame(), this, request, false, callbacksSetting == SendLoadCallbacks, contentSniff == SniffContent); + + if (m_sameOriginRequest || m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) { + bool skipCanLoadCheck = false; + loadRequest(request, skipCanLoadCheck); + return; + } + + if (m_options.crossOriginRequestPolicy == DenyCrossOriginRequests) { + m_client->didFail(ResourceError()); + return; + } + + ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); + + if (!m_options.forcePreflight && isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())) + makeSimpleCrossOriginAccessRequest(request); + else { + m_actualRequest.set(new ResourceRequest(request)); + m_actualRequest->setAllowHTTPCookies(m_options.allowCredentials); + + if (CrossOriginPreflightResultCache::shared().canSkipPreflight(document->securityOrigin()->toString(), request.url(), m_options.allowCredentials, request.httpMethod(), request.httpHeaderFields())) + preflightSuccess(); + else + makeCrossOriginAccessRequestWithPreflight(request); + } +} + +void DocumentThreadableLoader::makeSimpleCrossOriginAccessRequest(const ResourceRequest& request) +{ + ASSERT(isSimpleCrossOriginAccessRequest(request.httpMethod(), request.httpHeaderFields())); + + // Cross-origin requests are only defined for HTTP. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied. + if (!request.url().protocolInHTTPFamily()) { + m_client->didFail(ResourceError()); + return; + } + + // Make a copy of the passed request so that we can modify some details. + ResourceRequest crossOriginRequest(request); + crossOriginRequest.removeCredentials(); + crossOriginRequest.setAllowHTTPCookies(m_options.allowCredentials); + crossOriginRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); + + bool skipCanLoadCheck = false; + loadRequest(crossOriginRequest, skipCanLoadCheck); +} + +void DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request) +{ + ResourceRequest preflightRequest(request.url()); + preflightRequest.removeCredentials(); + preflightRequest.setHTTPOrigin(m_document->securityOrigin()->toString()); + preflightRequest.setAllowHTTPCookies(m_options.allowCredentials); + preflightRequest.setHTTPMethod("OPTIONS"); + preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", request.httpMethod()); + + const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields(); + + if (requestHeaderFields.size() > 0) { + Vector<UChar> headerBuffer; + HTTPHeaderMap::const_iterator it = requestHeaderFields.begin(); + append(headerBuffer, it->first); + ++it; + + HTTPHeaderMap::const_iterator end = requestHeaderFields.end(); + for (; it != end; ++it) { + headerBuffer.append(','); + headerBuffer.append(' '); + append(headerBuffer, it->first); + } + + preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer)); + preflightRequest.addHTTPHeaderFields(requestHeaderFields); + } + + bool skipCanLoadCheck = false; + loadRequest(preflightRequest, skipCanLoadCheck); } DocumentThreadableLoader::~DocumentThreadableLoader() @@ -122,8 +169,7 @@ void DocumentThreadableLoader::willSendRequest(SubresourceLoader* loader, Resour ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); - // FIXME: This needs to be fixed to follow the redirect correctly even for cross-domain requests. - if (m_denyCrossOriginRedirect && !m_document->securityOrigin()->canRequest(request.url())) { + if (!isAllowedRedirect(request.url())) { RefPtr<DocumentThreadableLoader> protect(this); m_client->didFailRedirectCheck(); request = ResourceRequest(); @@ -143,7 +189,31 @@ void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, con ASSERT(m_client); ASSERT_UNUSED(loader, loader == m_loader); - m_client->didReceiveResponse(response); + if (m_actualRequest) { + if (!passesAccessControlCheck(response, m_options.allowCredentials, m_document->securityOrigin())) { + preflightFailure(); + return; + } + + OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult(new CrossOriginPreflightResultCacheItem(m_options.allowCredentials)); + if (!preflightResult->parse(response) + || !preflightResult->allowsCrossOriginMethod(m_actualRequest->httpMethod()) + || !preflightResult->allowsCrossOriginHeaders(m_actualRequest->httpHeaderFields())) { + preflightFailure(); + return; + } + + CrossOriginPreflightResultCache::shared().appendEntry(m_document->securityOrigin()->toString(), m_actualRequest->url(), preflightResult.release()); + } else { + if (!m_sameOriginRequest && m_options.crossOriginRequestPolicy == UseAccessControl) { + if (!passesAccessControlCheck(response, m_options.allowCredentials, m_document->securityOrigin())) { + m_client->didFail(ResourceError()); + return; + } + } + + m_client->didReceiveResponse(response); + } } void DocumentThreadableLoader::didReceiveData(SubresourceLoader* loader, const char* data, int lengthReceived) @@ -158,7 +228,17 @@ void DocumentThreadableLoader::didFinishLoading(SubresourceLoader* loader) { ASSERT(loader == m_loader); ASSERT(m_client); - m_client->didFinishLoading(loader->identifier()); + didFinishLoading(loader->identifier()); +} + +void DocumentThreadableLoader::didFinishLoading(unsigned long identifier) +{ + if (m_actualRequest) { + ASSERT(!m_sameOriginRequest); + ASSERT(m_options.crossOriginRequestPolicy == UseAccessControl); + preflightSuccess(); + } else + m_client->didFinishLoading(identifier); } void DocumentThreadableLoader::didFail(SubresourceLoader* loader, const ResourceError& error) @@ -174,7 +254,7 @@ bool DocumentThreadableLoader::getShouldUseCredentialStorage(SubresourceLoader* { ASSERT_UNUSED(loader, loader == m_loader); - if (!m_allowStoredCredentials) { + if (!m_options.allowCredentials) { shouldUseCredentialStorage = false; return true; } @@ -200,4 +280,73 @@ void DocumentThreadableLoader::receivedCancellation(SubresourceLoader* loader, c m_client->didReceiveAuthenticationCancellation(challenge.failureResponse()); } +void DocumentThreadableLoader::preflightSuccess() +{ + OwnPtr<ResourceRequest> actualRequest; + actualRequest.swap(m_actualRequest); + + bool skipCanLoadCheck = true; // ok to skip load check since we already asked about the preflight request + loadRequest(*actualRequest, skipCanLoadCheck); +} + +void DocumentThreadableLoader::preflightFailure() +{ + m_client->didFail(ResourceError()); +} + +void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, bool skipCanLoadCheck) +{ + if (m_async) { + // Don't sniff content or send load callbacks for the preflight request. + bool sendLoadCallbacks = m_options.sendLoadCallbacks && !m_actualRequest; + bool sniffContent = m_options.sniffContent && !m_actualRequest; + m_loader = SubresourceLoader::create(m_document->frame(), this, request, skipCanLoadCheck, sendLoadCallbacks, sniffContent); + return; + } + + // FIXME: ThreadableLoaderOptions.sniffContent is not supported for synchronous requests. + StoredCredentials storedCredentials = m_options.allowCredentials ? AllowStoredCredentials : DoNotAllowStoredCredentials; + + Vector<char> data; + ResourceError error; + ResourceResponse response; + unsigned long identifier = std::numeric_limits<unsigned long>::max(); + if (m_document->frame()) + identifier = m_document->frame()->loader()->loadResourceSynchronously(request, storedCredentials, error, response, data); + + // No exception for file:/// resources, see <rdar://problem/4962298>. + // Also, if we have an HTTP response, then it wasn't a network error in fact. + if (!error.isNull() && !request.url().isLocalFile() && response.httpStatusCode() <= 0) { + m_client->didFail(error); + return; + } + + // FIXME: FrameLoader::loadSynchronously() does not tell us whether a redirect happened or not, so we guess by comparing the + // request and response URLs. This isn't a perfect test though, since a server can serve a redirect to the same URL that was + // requested. + if (request.url() != response.url() && !isAllowedRedirect(response.url())) { + m_client->didFailRedirectCheck(); + return; + } + + didReceiveResponse(0, response); + + const char* bytes = static_cast<const char*>(data.data()); + int len = static_cast<int>(data.size()); + didReceiveData(0, bytes, len); + + didFinishLoading(identifier); +} + +bool DocumentThreadableLoader::isAllowedRedirect(const KURL& url) +{ + if (m_options.crossOriginRequestPolicy == AllowCrossOriginRequests) + return true; + + // FIXME: We need to implement access control for each redirect. This will require some refactoring though, because the code + // that processes redirects doesn't know about access control and expects a synchronous answer from its client about whether + // a redirect should proceed. + return m_sameOriginRequest && m_document->securityOrigin()->canRequest(url); +} + } // namespace WebCore diff --git a/WebCore/loader/DocumentThreadableLoader.h b/WebCore/loader/DocumentThreadableLoader.h index 465475f..64b1a22 100644 --- a/WebCore/loader/DocumentThreadableLoader.h +++ b/WebCore/loader/DocumentThreadableLoader.h @@ -33,19 +33,21 @@ #include "SubresourceLoaderClient.h" #include "ThreadableLoader.h" +#include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> namespace WebCore { class Document; + class KURL; struct ResourceRequest; class ThreadableLoaderClient; class DocumentThreadableLoader : public RefCounted<DocumentThreadableLoader>, public ThreadableLoader, private SubresourceLoaderClient { public: - static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials); - static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void loadResourceSynchronously(Document*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<DocumentThreadableLoader> create(Document*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); virtual ~DocumentThreadableLoader(); virtual void cancel(); @@ -58,7 +60,13 @@ namespace WebCore { virtual void derefThreadableLoader() { deref(); } private: - DocumentThreadableLoader(Document*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + enum BlockingBehavior { + LoadSynchronously, + LoadAsynchronously + }; + + DocumentThreadableLoader(Document*, ThreadableLoaderClient*, BlockingBehavior blockingBehavior, const ResourceRequest&, const ThreadableLoaderOptions& options); + virtual void willSendRequest(SubresourceLoader*, ResourceRequest&, const ResourceResponse& redirectResponse); virtual void didSendData(SubresourceLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent); @@ -71,12 +79,22 @@ namespace WebCore { virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&); virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&); + void didFinishLoading(unsigned long identifier); + void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request); + void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request); + void preflightSuccess(); + void preflightFailure(); + + void loadRequest(const ResourceRequest&, bool skipCanLoadCheck); + bool isAllowedRedirect(const KURL&); + RefPtr<SubresourceLoader> m_loader; ThreadableLoaderClient* m_client; Document* m_document; - bool m_allowStoredCredentials; + ThreadableLoaderOptions m_options; bool m_sameOriginRequest; - bool m_denyCrossOriginRedirect; + bool m_async; + OwnPtr<ResourceRequest> m_actualRequest; // non-null during Access Control preflight checks }; } // namespace WebCore diff --git a/WebCore/loader/EmptyClients.h b/WebCore/loader/EmptyClients.h index 3f70c43..8d748a7 100644 --- a/WebCore/loader/EmptyClients.h +++ b/WebCore/loader/EmptyClients.h @@ -137,6 +137,10 @@ public: virtual void reachedMaxAppCacheSize(int64_t) { } #endif +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const { return 0; } +#endif + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) { } virtual void formStateDidChange(const Node*) { } diff --git a/WebCore/loader/FTPDirectoryDocument.cpp b/WebCore/loader/FTPDirectoryDocument.cpp index ace4cfe..ee0f4ca 100644 --- a/WebCore/loader/FTPDirectoryDocument.cpp +++ b/WebCore/loader/FTPDirectoryDocument.cpp @@ -118,7 +118,7 @@ void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& si rowElement->setAttribute("class", "ftpDirectoryEntryRow", ec); RefPtr<Element> element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, String(&noBreakSpace, 1)), ec); + element->appendChild(Text::create(m_doc, String(&noBreakSpace, 1)), ec); if (isDirectory) element->setAttribute("class", "ftpDirectoryIcon ftpDirectoryTypeDirectory", ec); else @@ -130,12 +130,12 @@ void FTPDirectoryTokenizer::appendEntry(const String& filename, const String& si rowElement->appendChild(element, ec); element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, date), ec); + element->appendChild(Text::create(m_doc, date), ec); element->setAttribute("class", "ftpDirectoryFileDate", ec); rowElement->appendChild(element, ec); element = m_doc->createElement(tdTag, false); - element->appendChild(new Text(m_doc, size), ec); + element->appendChild(Text::create(m_doc, size), ec); element->setAttribute("class", "ftpDirectoryFileSize", ec); rowElement->appendChild(element, ec); } @@ -152,7 +152,7 @@ PassRefPtr<Element> FTPDirectoryTokenizer::createTDForFilename(const String& fil RefPtr<Element> anchorElement = m_doc->createElement(aTag, false); anchorElement->setAttribute("href", fullURL, ec); - anchorElement->appendChild(new Text(m_doc, filename), ec); + anchorElement->appendChild(Text::create(m_doc, filename), ec); RefPtr<Element> tdElement = m_doc->createElement(tdTag, false); tdElement->appendChild(anchorElement, ec); diff --git a/WebCore/loader/FTPDirectoryDocument.h b/WebCore/loader/FTPDirectoryDocument.h index ecc6f73..b208c4e 100644 --- a/WebCore/loader/FTPDirectoryDocument.h +++ b/WebCore/loader/FTPDirectoryDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 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 @@ -35,7 +35,7 @@ class FTPDirectoryDocument : public HTMLDocument { public: static PassRefPtr<FTPDirectoryDocument> create(Frame* frame) { - return new FTPDirectoryDocument(frame); + return adoptRef(new FTPDirectoryDocument(frame)); } private: diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp index 256c82d..dd584ca 100644 --- a/WebCore/loader/FrameLoader.cpp +++ b/WebCore/loader/FrameLoader.cpp @@ -89,6 +89,7 @@ #include "SecurityOrigin.h" #include "SegmentedString.h" #include "Settings.h" +#include "SharedWorkerRepository.h" #include "TextResourceDecoder.h" #include "WindowFeatures.h" #include "XMLHttpRequest.h" @@ -277,6 +278,7 @@ FrameLoader::FrameLoader(Frame* frame, FrameLoaderClient* client) , m_isDisplayingInitialEmptyDocument(false) , m_committedFirstRealDocumentLoad(false) , m_didPerformFirstNavigation(false) + , m_loadingFromCachedPage(false) #ifndef NDEBUG , m_didDispatchDidCommitLoad(false) #endif @@ -929,9 +931,6 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->setDocument(document); - if (dispatch) - dispatchWindowObjectAvailable(); - document->setURL(m_URL); if (m_decoder) document->setDecoder(m_decoder.get()); @@ -941,6 +940,9 @@ void FrameLoader::begin(const KURL& url, bool dispatch, SecurityOrigin* origin) m_frame->domWindow()->setURL(document->url()); m_frame->domWindow()->setSecurityOrigin(document->securityOrigin()); + if (dispatch) + dispatchWindowObjectAvailable(); + updateFirstPartyForCookies(); Settings* settings = document->settings(); @@ -1843,6 +1845,9 @@ bool FrameLoader::canCachePageContainingThisFrame() #if ENABLE(DATABASE) && !m_frame->document()->hasOpenDatabases() #endif +#if ENABLE(SHARED_WORKERS) + && !SharedWorkerRepository::hasSharedWorkers(m_frame->document()) +#endif && !m_frame->document()->usingGeolocation() && m_currentHistoryItem && !m_quickRedirectComing @@ -1989,6 +1994,10 @@ bool FrameLoader::logCanCacheFrameDecision(int indentLevel) 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 (!m_currentHistoryItem) @@ -2833,7 +2842,8 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) RefPtr<CachedPage> cachedPage = prpCachedPage; RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader; - LOG(Loading, "WebCoreLoading %s: About to commit provisional load from previous URL %s", m_frame->tree()->name().string().utf8().data(), m_URL.string().utf8().data()); + 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(), + pdl ? pdl->url().string().utf8().data() : "<no provisional DocumentLoader>"); // 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. @@ -2874,7 +2884,7 @@ void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage) if (m_loadType == FrameLoadTypeStandard && m_documentLoader->isClientRedirect()) updateHistoryForClientRedirect(); - if (m_documentLoader->isLoadingFromCachedPage()) { + if (m_loadingFromCachedPage) { m_frame->document()->documentDidBecomeActive(); // Force a layout to update view size and thereby update scrollbars. @@ -3451,7 +3461,7 @@ void FrameLoader::continueLoadAfterWillSubmitForm(PolicyAction) if (activeDocLoader && activeDocLoader->isLoadingMainResource()) return; - m_provisionalDocumentLoader->setLoadingFromCachedPage(false); + m_loadingFromCachedPage = false; unsigned long identifier = 0; @@ -4236,7 +4246,17 @@ bool FrameLoader::loadProvisionalItemFromCachedPage() RefPtr<CachedPage> cachedPage = pageCache()->get(m_provisionalHistoryItem.get()); if (!cachedPage || !cachedPage->document()) return false; - provisionalDocumentLoader()->loadFromCachedPage(cachedPage.release()); + + 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; } @@ -5111,8 +5131,6 @@ void FrameLoader::dispatchWindowObjectAvailable() m_client->windowObjectCleared(); if (Page* page = m_frame->page()) { - if (InspectorController* inspector = page->inspectorController()) - inspector->inspectedWindowScriptObjectCleared(m_frame); if (InspectorController* inspector = page->parentInspectorController()) inspector->windowScriptObjectAvailable(); } diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h index 5a8ee91..17013b5 100644 --- a/WebCore/loader/FrameLoader.h +++ b/WebCore/loader/FrameLoader.h @@ -350,6 +350,7 @@ namespace WebCore { void setTitle(const String&); void commitProvisionalLoad(PassRefPtr<CachedPage>); + bool isLoadingFromCachedPage() const { return m_loadingFromCachedPage; } void goToItem(HistoryItem*, FrameLoadType); void saveDocumentAndScrollState(); @@ -622,6 +623,7 @@ namespace WebCore { RefPtr<HistoryItem> m_provisionalHistoryItem; bool m_didPerformFirstNavigation; + bool m_loadingFromCachedPage; #ifndef NDEBUG bool m_didDispatchDidCommitLoad; diff --git a/WebCore/loader/ImageDocument.h b/WebCore/loader/ImageDocument.h index 1bc5245..080b250 100644 --- a/WebCore/loader/ImageDocument.h +++ b/WebCore/loader/ImageDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 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 @@ -35,7 +35,7 @@ class ImageDocument : public HTMLDocument { public: static PassRefPtr<ImageDocument> create(Frame* frame) { - return new ImageDocument(frame); + return adoptRef(new ImageDocument(frame)); } CachedImage* cachedImage(); diff --git a/WebCore/loader/MediaDocument.h b/WebCore/loader/MediaDocument.h index ac286f0..aa751ab 100644 --- a/WebCore/loader/MediaDocument.h +++ b/WebCore/loader/MediaDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright (C) 2008,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 @@ -36,22 +36,23 @@ class MediaDocument : public HTMLDocument { public: static PassRefPtr<MediaDocument> create(Frame* frame) { - return new MediaDocument(frame); + return adoptRef(new MediaDocument(frame)); } - - virtual void defaultEventHandler(Event*); + virtual ~MediaDocument(); void mediaElementSawUnsupportedTracks(); private: MediaDocument(Frame*); - virtual ~MediaDocument(); - Timer<MediaDocument> m_replaceMediaElementTimer; virtual bool isMediaDocument() const { return true; } virtual Tokenizer* createTokenizer(); + virtual void defaultEventHandler(Event*); + void replaceMediaElementTimerFired(Timer<MediaDocument>*); + + Timer<MediaDocument> m_replaceMediaElementTimer; }; } diff --git a/WebCore/loader/PlaceholderDocument.h b/WebCore/loader/PlaceholderDocument.h index c542370..a759266 100644 --- a/WebCore/loader/PlaceholderDocument.h +++ b/WebCore/loader/PlaceholderDocument.h @@ -34,7 +34,7 @@ class PlaceholderDocument : public Document { public: static PassRefPtr<PlaceholderDocument> create(Frame* frame) { - return new PlaceholderDocument(frame); + return adoptRef(new PlaceholderDocument(frame)); } virtual void attach(); diff --git a/WebCore/loader/PluginDocument.h b/WebCore/loader/PluginDocument.h index 35e4038..1d5c964 100644 --- a/WebCore/loader/PluginDocument.h +++ b/WebCore/loader/PluginDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 2009Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,7 +33,7 @@ class PluginDocument : public HTMLDocument { public: static PassRefPtr<PluginDocument> create(Frame* frame) { - return new PluginDocument(frame); + return adoptRef(new PluginDocument(frame)); } private: diff --git a/WebCore/loader/TextDocument.h b/WebCore/loader/TextDocument.h index c67fea5..53e3074 100644 --- a/WebCore/loader/TextDocument.h +++ b/WebCore/loader/TextDocument.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2008, 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 @@ -35,7 +35,7 @@ class TextDocument : public HTMLDocument { public: static PassRefPtr<TextDocument> create(Frame* frame) { - return new TextDocument(frame); + return adoptRef(new TextDocument(frame)); } private: diff --git a/WebCore/loader/ThreadableLoader.cpp b/WebCore/loader/ThreadableLoader.cpp index b174af7..720ba4e 100644 --- a/WebCore/loader/ThreadableLoader.cpp +++ b/WebCore/loader/ThreadableLoader.cpp @@ -40,33 +40,33 @@ namespace WebCore { -PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +PassRefPtr<ThreadableLoader> ThreadableLoader::create(ScriptExecutionContext* context, ThreadableLoaderClient* client, const ResourceRequest& request, const ThreadableLoaderOptions& options) { ASSERT(client); ASSERT(context); #if ENABLE(WORKERS) if (context->isWorkerContext()) - return WorkerThreadableLoader::create(static_cast<WorkerContext*>(context), client, WorkerRunLoop::defaultMode(), request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + return WorkerThreadableLoader::create(static_cast<WorkerContext*>(context), client, WorkerRunLoop::defaultMode(), request, options); #endif // ENABLE(WORKERS) ASSERT(context->isDocument()); - return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + return DocumentThreadableLoader::create(static_cast<Document*>(context), client, request, options); } -void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials) +void ThreadableLoader::loadResourceSynchronously(ScriptExecutionContext* context, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { ASSERT(context); #if ENABLE(WORKERS) if (context->isWorkerContext()) { - WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(context), request, client, storedCredentials, DenyCrossOriginRedirect); + WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(context), request, client, options); return; } #endif // ENABLE(WORKERS) ASSERT(context->isDocument()); - DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client, storedCredentials); + DocumentThreadableLoader::loadResourceSynchronously(static_cast<Document*>(context), request, client, options); } } // namespace WebCore diff --git a/WebCore/loader/ThreadableLoader.h b/WebCore/loader/ThreadableLoader.h index 1ac12cb..a52bfad 100644 --- a/WebCore/loader/ThreadableLoader.h +++ b/WebCore/loader/ThreadableLoader.h @@ -43,32 +43,32 @@ namespace WebCore { class ScriptExecutionContext; class ThreadableLoaderClient; - enum LoadCallbacks { - SendLoadCallbacks, - DoNotSendLoadCallbacks - }; - - enum ContentSniff { - SniffContent, - DoNotSniffContent - }; - enum StoredCredentials { AllowStoredCredentials, DoNotAllowStoredCredentials }; - - enum CrossOriginRedirectPolicy { - DenyCrossOriginRedirect, - AllowCrossOriginRedirect + + enum CrossOriginRequestPolicy { + DenyCrossOriginRequests, + UseAccessControl, + AllowCrossOriginRequests + }; + + struct ThreadableLoaderOptions { + ThreadableLoaderOptions() : sendLoadCallbacks(false), sniffContent(false), allowCredentials(false), forcePreflight(false), crossOriginRequestPolicy(DenyCrossOriginRequests) { } + bool sendLoadCallbacks; + bool sniffContent; + bool allowCredentials; // Whether HTTP credentials and cookies are sent with the request. + bool forcePreflight; // If AccessControl is used, whether to force a preflight. + CrossOriginRequestPolicy crossOriginRequestPolicy; }; // Useful for doing loader operations from any thread (not threadsafe, // just able to run on threads other than the main thread). class ThreadableLoader : public Noncopyable { public: - static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials); - static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void loadResourceSynchronously(ScriptExecutionContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<ThreadableLoader> create(ScriptExecutionContext*, ThreadableLoaderClient*, const ResourceRequest&, const ThreadableLoaderOptions&); virtual void cancel() = 0; void ref() { refThreadableLoader(); } diff --git a/WebCore/loader/WorkerThreadableLoader.cpp b/WebCore/loader/WorkerThreadableLoader.cpp index 4d12b8d..6819759 100644 --- a/WebCore/loader/WorkerThreadableLoader.cpp +++ b/WebCore/loader/WorkerThreadableLoader.cpp @@ -53,11 +53,10 @@ namespace WebCore { static const char loadResourceSynchronouslyMode[] = "loadResourceSynchronouslyMode"; -WorkerThreadableLoader::WorkerThreadableLoader(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, LoadCallbacks callbacksSetting, - ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +WorkerThreadableLoader::WorkerThreadableLoader(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_workerContext(workerContext) , m_workerClientWrapper(ThreadableLoaderClientWrapper::create(client)) - , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, m_workerContext->thread()->workerLoaderProxy(), taskMode, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy))) + , m_bridge(*(new MainThreadBridge(m_workerClientWrapper, m_workerContext->thread()->workerLoaderProxy(), taskMode, request, options))) { } @@ -66,7 +65,7 @@ WorkerThreadableLoader::~WorkerThreadableLoader() m_bridge.destroy(); } -void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerContext, const ResourceRequest& request, ThreadableLoaderClient& client, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerContext, const ResourceRequest& request, ThreadableLoaderClient& client, const ThreadableLoaderOptions& options) { WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); @@ -74,9 +73,7 @@ void WorkerThreadableLoader::loadResourceSynchronously(WorkerContext* workerCont String mode = loadResourceSynchronouslyMode; mode.append(String::number(runLoop.createUniqueId())); - ContentSniff contentSniff = request.url().isLocalFile() ? SniffContent : DoNotSniffContent; - RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(workerContext, &client, mode, request, DoNotSendLoadCallbacks, contentSniff, storedCredentials, crossOriginRedirectPolicy); - + RefPtr<WorkerThreadableLoader> loader = WorkerThreadableLoader::create(workerContext, &client, mode, request, options); MessageQueueWaitResult result = MessageQueueMessageReceived; while (!loader->done() && result != MessageQueueTerminated) result = runLoop.runInMode(workerContext, mode); @@ -91,21 +88,20 @@ void WorkerThreadableLoader::cancel() } WorkerThreadableLoader::MainThreadBridge::MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, WorkerLoaderProxy& loaderProxy, const String& taskMode, - const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, - CrossOriginRedirectPolicy crossOriginRedirectPolicy) + const ResourceRequest& request, const ThreadableLoaderOptions& options) : m_workerClientWrapper(workerClientWrapper) , m_loaderProxy(loaderProxy) , m_taskMode(taskMode.copy()) { ASSERT(m_workerClientWrapper.get()); - m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCreateLoader, this, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + m_loaderProxy.postTaskToLoader(createCallbackTask(&MainThreadBridge::mainThreadCreateLoader, this, request, options)); } WorkerThreadableLoader::MainThreadBridge::~MainThreadBridge() { } -void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExecutionContext* context, MainThreadBridge* thisPtr, auto_ptr<CrossThreadResourceRequestData> requestData, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExecutionContext* context, MainThreadBridge* thisPtr, auto_ptr<CrossThreadResourceRequestData> requestData, ThreadableLoaderOptions options) { ASSERT(isMainThread()); ASSERT(context->isDocument()); @@ -117,7 +113,7 @@ void WorkerThreadableLoader::MainThreadBridge::mainThreadCreateLoader(ScriptExec // FIXME: If the a site requests a local resource, then this will return a non-zero value but the sync path // will return a 0 value. Either this should return 0 or the other code path should do a callback with // a failure. - thisPtr->m_mainThreadLoader = ThreadableLoader::create(context, thisPtr, *request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy); + thisPtr->m_mainThreadLoader = ThreadableLoader::create(context, thisPtr, *request, options); ASSERT(thisPtr->m_mainThreadLoader); } diff --git a/WebCore/loader/WorkerThreadableLoader.h b/WebCore/loader/WorkerThreadableLoader.h index 8b11b70..230c77d 100644 --- a/WebCore/loader/WorkerThreadableLoader.h +++ b/WebCore/loader/WorkerThreadableLoader.h @@ -55,10 +55,10 @@ namespace WebCore { class WorkerThreadableLoader : public RefCounted<WorkerThreadableLoader>, public ThreadableLoader { public: - static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, StoredCredentials, CrossOriginRedirectPolicy); - static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, LoadCallbacks callbacksSetting, ContentSniff contentSniff, StoredCredentials storedCredentials, CrossOriginRedirectPolicy crossOriginRedirectPolicy) + static void loadResourceSynchronously(WorkerContext*, const ResourceRequest&, ThreadableLoaderClient&, const ThreadableLoaderOptions&); + static PassRefPtr<WorkerThreadableLoader> create(WorkerContext* workerContext, ThreadableLoaderClient* client, const String& taskMode, const ResourceRequest& request, const ThreadableLoaderOptions& options) { - return adoptRef(new WorkerThreadableLoader(workerContext, client, taskMode, request, callbacksSetting, contentSniff, storedCredentials, crossOriginRedirectPolicy)); + return adoptRef(new WorkerThreadableLoader(workerContext, client, taskMode, request, options)); } ~WorkerThreadableLoader(); @@ -97,7 +97,7 @@ namespace WebCore { class MainThreadBridge : ThreadableLoaderClient { public: // All executed on the worker context's thread. - MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + MainThreadBridge(PassRefPtr<ThreadableLoaderClientWrapper>, WorkerLoaderProxy&, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); void cancel(); void destroy(); @@ -109,7 +109,7 @@ namespace WebCore { static void mainThreadDestroy(ScriptExecutionContext*, MainThreadBridge*); ~MainThreadBridge(); - static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, std::auto_ptr<CrossThreadResourceRequestData>, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, std::auto_ptr<CrossThreadResourceRequestData>, ThreadableLoaderOptions); static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*); virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void didReceiveResponse(const ResourceResponse&); @@ -133,7 +133,7 @@ namespace WebCore { String m_taskMode; }; - WorkerThreadableLoader(WorkerContext*, ThreadableLoaderClient*, const String& taskMode, const ResourceRequest&, LoadCallbacks, ContentSniff, StoredCredentials, CrossOriginRedirectPolicy); + WorkerThreadableLoader(WorkerContext*, ThreadableLoaderClient*, const String& taskMode, const ResourceRequest&, const ThreadableLoaderOptions&); RefPtr<WorkerContext> m_workerContext; RefPtr<ThreadableLoaderClientWrapper> m_workerClientWrapper; diff --git a/WebCore/loader/loader.cpp b/WebCore/loader/loader.cpp index 65d15a5..4ab4f34 100644 --- a/WebCore/loader/loader.cpp +++ b/WebCore/loader/loader.cpp @@ -355,7 +355,7 @@ void Loader::Host::didFinishLoading(SubresourceLoader* loader) DocLoader* docLoader = request->docLoader(); // Prevent the document from being destroyed before we are done with // the docLoader that it will delete when the document gets deleted. - DocPtr<Document> protector(docLoader->doc()); + RefPtr<Document> protector(docLoader->doc()); if (!request->isMultipart()) docLoader->decrementRequestCount(); @@ -403,7 +403,7 @@ void Loader::Host::didFail(SubresourceLoader* loader, bool cancelled) DocLoader* docLoader = request->docLoader(); // Prevent the document from being destroyed before we are done with // the docLoader that it will delete when the document gets deleted. - DocPtr<Document> protector(docLoader->doc()); + RefPtr<Document> protector(docLoader->doc()); if (!request->isMultipart()) docLoader->decrementRequestCount(); diff --git a/WebCore/manual-tests/gtk/copy-htmltext.html b/WebCore/manual-tests/gtk/copy-htmltext.html new file mode 100644 index 0000000..0b811f6 --- /dev/null +++ b/WebCore/manual-tests/gtk/copy-htmltext.html @@ -0,0 +1,24 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <title>Copy HTML content</title> + </head> + <body> + <h1>Copy HTML content from currently editable area</h1> + <div title="EditableArea" contentEditable="true" + style="display: block; border: 2px solid black; margin: 5px; padding: 15px;"> + Here is a Editable Area,<br /> + <img title="It's the test image" src="http://webkit.org/images/icon-gold.png" /><br /><br /> + <b>STEPS TO TEST:</b><br /> + <ol> + <li>Select all that text or picture in this editable area (type <b>Ctrl-A</b> / Option-A)</li> + <li><b>Copy</b> them use <b>Ctrl-C</b> / Option-C</li> + <li>Move the cursor to a blank line below</li> + <li>Paste them use <b>Ctrl-V</b> / Option-V</li> + </ol> + <p><b>Ensure</b> that text and image has been pasted with formats and no garbled.</p> + <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> + </div> + </body> +</html> diff --git a/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html b/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html new file mode 100644 index 0000000..8e3c102 --- /dev/null +++ b/WebCore/manual-tests/keyboard_select_elements_with_same_beginning.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<head> +<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=UTF-8"> +<title> +Test select on elements with same beginning letter +</title> +</head> +<body> +See bug:<a href="https://bugs.webkit.org/show_bug.cgi?id=28205">28205</a>. +<p> +Click the drop-down to show selections (not navigate to the selection box). +Type the first letter 'A' to go to the elements start with 'A'. +It should select the first item starts with 'A'. +In windows, Continue typing 'A', it should continue to select the next item starts with 'A'. +<p> +<select name="selOrigin"> + <option value="">Select Station</option> + <option value="37169_NJCL">Aberdeen Matawan</option> + <option value="2_ATLC">Absecon</option> + <option value="3_MNBN">Allendale</option> + <option value="4_NJCL">Allenhurst</option> + <option value="12_MNE">Basking Ridge</option> + <option value="13_NJCL">Bay Head</option> + <option value="14_BNTN">Bay Street</option> + <option value="15_NJCL">Belmar</option> +</select> +</body> +</html> diff --git a/WebCore/manual-tests/wml/select-onpick-event-crash.wml b/WebCore/manual-tests/wml/select-onpick-event-crash.wml new file mode 100644 index 0000000..07d0262 --- /dev/null +++ b/WebCore/manual-tests/wml/select-onpick-event-crash.wml @@ -0,0 +1,12 @@ +<?xml version="1.0"?> +<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> +<wml> + <card> + <select name="result" dmultiple="true"> + <option onpick="#card2" value="foo">Foo</option> + <option onpick="#card2" value="bar">Bar</option> + </select> + </card> + + <card id="card2">Test pass, if it didn't crash.</card> +</wml> diff --git a/WebCore/notifications/Notification.cpp b/WebCore/notifications/Notification.cpp new file mode 100644 index 0000000..266392b --- /dev/null +++ b/WebCore/notifications/Notification.cpp @@ -0,0 +1,234 @@ +/* + * 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(NOTIFICATIONS) + +#include "Notification.h" +#include "NotificationContents.h" + +#include "Document.h" +#include "EventNames.h" +#include "WorkerContext.h" + +namespace WebCore { + +Notification::Notification(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) + : ActiveDOMObject(context, this) + , m_isHTML(true) + , m_isShowing(false) + , m_presenter(provider) +{ + if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PERMISSION_ALLOWED) { + ec = SECURITY_ERR; + return; + } + + m_notificationURL = context->completeURL(url); + if (url.isEmpty() || !m_notificationURL.isValid()) { + ec = SYNTAX_ERR; + return; + } +} + +Notification::Notification(const NotificationContents& contents, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider) + : ActiveDOMObject(context, this) + , m_isHTML(false) + , m_contents(contents) + , m_isShowing(false) + , m_presenter(provider) +{ + if (m_presenter->checkPermission(context->securityOrigin()) != NotificationPresenter::PERMISSION_ALLOWED) { + ec = SECURITY_ERR; + return; + } + + KURL icon = context->completeURL(contents.icon()); + if (!icon.isEmpty() && !icon.isValid()) { + ec = SYNTAX_ERR; + return; + } +} + +Notification::~Notification() +{ + m_presenter->notificationObjectDestroyed(this); +} + +void Notification::show() +{ + // prevent double-showing + if (!m_isShowing) + m_isShowing = m_presenter->show(this); +} + +void Notification::cancel() +{ + if (m_isShowing) + m_presenter->cancel(this); +} + +EventListener* Notification::ondisplay() const +{ + return getAttributeEventListener("display"); +} + +void Notification::setOndisplay(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener("display", eventListener); +} + +EventListener* Notification::onerror() const +{ + return getAttributeEventListener(eventNames().errorEvent); +} + +void Notification::setOnerror(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().errorEvent, eventListener); +} + +EventListener* Notification::onclose() const +{ + return getAttributeEventListener(eventNames().closeEvent); +} + +void Notification::setOnclose(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().closeEvent, eventListener); +} + +EventListener* Notification::getAttributeEventListener(const AtomicString& eventType) const +{ + const RegisteredEventListenerVector& listeners = m_eventListeners; + size_t size = listeners.size(); + for (size_t i = 0; i < size; ++i) { + const RegisteredEventListener& r = *listeners[i]; + if (r.eventType() == eventType && r.listener()->isAttribute()) + return r.listener(); + } + return 0; +} + +void Notification::setAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener) +{ + clearAttributeEventListener(eventType); + if (listener) + addEventListener(eventType, listener, false); +} + +void Notification::clearAttributeEventListener(const AtomicString& eventType) +{ + RegisteredEventListenerVector* listeners = &m_eventListeners; + size_t size = listeners->size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *listeners->at(i); + if (r.eventType() != eventType || !r.listener()->isAttribute()) + continue; + + r.setRemoved(true); + listeners->remove(i); + return; + } +} + +void Notification::dispatchDisplayEvent() +{ + RefPtr<Event> event = Event::create("display", false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::dispatchErrorEvent() +{ + RefPtr<Event> event = Event::create(eventNames().errorEvent, false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::dispatchCloseEvent() +{ + RefPtr<Event> event = Event::create(eventNames().closeEvent, false, true); + ExceptionCode ec = 0; + dispatchEvent(event.release(), ec); + ASSERT(!ec); +} + +void Notification::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> listener, bool useCapture) +{ + RefPtr<RegisteredEventListener> registeredListener = RegisteredEventListener::create(eventType, listener, useCapture); + m_eventListeners.append(registeredListener); +} + +void Notification::removeEventListener(const AtomicString& eventType, EventListener* listener, bool useCapture) +{ + size_t size = m_eventListeners.size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *m_eventListeners[i]; + if (r.eventType() == eventType && r.listener() == listener && r.useCapture() == useCapture) { + r.setRemoved(true); + m_eventListeners.remove(i); + return; + } + } +} + +void Notification::handleEvent(PassRefPtr<Event> event, bool useCapture) +{ + RegisteredEventListenerVector listenersCopy = m_eventListeners; + size_t size = listenersCopy.size(); + for (size_t i = 0; i < size; ++i) { + RegisteredEventListener& r = *listenersCopy[i]; + if (r.eventType() == event->type() && r.useCapture() == useCapture && !r.removed()) + r.listener()->handleEvent(event.get()); + } +} + +bool Notification::dispatchEvent(PassRefPtr<Event> inEvent, ExceptionCode&) +{ + RefPtr<Event> event(inEvent); + + event->setEventPhase(Event::AT_TARGET); + event->setCurrentTarget(this); + + handleEvent(event.get(), true); + if (!event->propagationStopped()) { + handleEvent(event.get(), false); + } + + return !event->defaultPrevented(); +} + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/notifications/Notification.h b/WebCore/notifications/Notification.h new file mode 100644 index 0000000..9286c55 --- /dev/null +++ b/WebCore/notifications/Notification.h @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef Notification_h +#define Notification_h + +#include "ActiveDOMObject.h" +#include "AtomicStringHash.h" +#include "Event.h" +#include "EventListener.h" +#include "EventTarget.h" +#include "ExceptionCode.h" +#include "KURL.h" +#include "NotificationPresenter.h" +#include "NotificationContents.h" +#include "RegisteredEventListener.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +#if ENABLE(NOTIFICATIONS) +namespace WebCore { + + class WorkerContext; + + class Notification : public RefCounted<Notification>, public ActiveDOMObject, public EventTarget { + public: + static Notification* create(const String& 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); } + + virtual ~Notification(); + + void show(); + void cancel(); + + bool isHTML() { return m_isHTML; } + KURL url() { return m_notificationURL; } + NotificationContents& contents() { return m_contents; } + + EventListener* ondisplay() const; + void setOndisplay(PassRefPtr<EventListener> eventListener); + EventListener* onerror() const; + void setOnerror(PassRefPtr<EventListener> eventListener); + EventListener* onclose() const; + void setOnclose(PassRefPtr<EventListener> eventListener); + + using RefCounted<Notification>::ref; + using RefCounted<Notification>::deref; + + // Dispatching of events on the notification. The presenter should call these when events occur. + void dispatchDisplayEvent(); + void dispatchErrorEvent(); + void dispatchCloseEvent(); + + // EventTarget interface + virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } + virtual void addEventListener(const AtomicString&, PassRefPtr<EventListener>, bool); + virtual void removeEventListener(const AtomicString&, EventListener*, bool); + virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + virtual Notification* toNotification() { return this; } + + private: + Notification(const String& url, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); + Notification(const NotificationContents& fields, ScriptExecutionContext* context, ExceptionCode& ec, NotificationPresenter* provider); + + // EventTarget interface + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + + void handleEvent(PassRefPtr<Event> event, bool useCapture); + EventListener* getAttributeEventListener(const AtomicString&) const; + void setAttributeEventListener(const AtomicString&, PassRefPtr<EventListener>); + void clearAttributeEventListener(const AtomicString&); + + bool m_isHTML; + KURL m_notificationURL; + NotificationContents m_contents; + + bool m_isShowing; + + RegisteredEventListenerVector m_eventListeners; + + NotificationPresenter* m_presenter; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // Notifications_h diff --git a/WebCore/notifications/Notification.idl b/WebCore/notifications/Notification.idl new file mode 100644 index 0000000..eca2eb4 --- /dev/null +++ b/WebCore/notifications/Notification.idl @@ -0,0 +1,54 @@ +/* + * 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. + */ + +module threads { + + interface [ + Conditional=NOTIFICATIONS + ] Notification { + void show(); + void cancel(); + + attribute EventListener ondisplay; + attribute EventListener onerror; + attribute EventListener onclose; + + // EventTarget interface + [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 evt) + raises(EventException); + }; + +} diff --git a/WebCore/notifications/NotificationCenter.cpp b/WebCore/notifications/NotificationCenter.cpp new file mode 100644 index 0000000..94976a2 --- /dev/null +++ b/WebCore/notifications/NotificationCenter.cpp @@ -0,0 +1,60 @@ +/* + * 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(NOTIFICATIONS) + +#include "NotificationCenter.h" + +#include "Document.h" +#include "VoidCallback.h" +#include "WorkerContext.h" + +namespace WebCore { + +NotificationCenter::NotificationCenter(ScriptExecutionContext* context, NotificationPresenter* presenter) + : ActiveDOMObject(context, this) + , m_scriptExecutionContext(context) + , m_notificationPresenter(presenter) {} + +int NotificationCenter::checkPermission() +{ + return m_notificationPresenter->checkPermission(m_scriptExecutionContext->securityOrigin()); +} + +void NotificationCenter::requestPermission(PassRefPtr<VoidCallback> callback) +{ + m_notificationPresenter->requestPermission(m_scriptExecutionContext->securityOrigin(), callback); +} + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) diff --git a/WebCore/notifications/NotificationCenter.h b/WebCore/notifications/NotificationCenter.h new file mode 100644 index 0000000..c40693f --- /dev/null +++ b/WebCore/notifications/NotificationCenter.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationCenter_h +#define NotificationCenter_h + +#include "Notification.h" +#include "NotificationContents.h" +#include "WorkerThread.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefCounted.h> +#include <wtf/RefPtr.h> + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class ScriptExecutionContext; + + class NotificationCenter : public RefCounted<NotificationCenter>, public ActiveDOMObject { + public: + static PassRefPtr<NotificationCenter> create(ScriptExecutionContext* context, NotificationPresenter* presenter) { return adoptRef(new NotificationCenter(context, presenter)); } + + Notification* createHTMLNotification(const String& URI, ExceptionCode& ec) + { + return Notification::create(KURL(URI), context(), ec, presenter()); + } + + Notification* createNotification(const String& iconURI, const String& title, const String& body, ExceptionCode& ec) + { + NotificationContents contents(iconURI, title, body); + return Notification::create(contents, context(), ec, presenter()); + } + + ScriptExecutionContext* context() const { return m_scriptExecutionContext; } + NotificationPresenter* presenter() const { return m_notificationPresenter; } + + int checkPermission(); + void requestPermission(PassRefPtr<VoidCallback> callback); + + private: + NotificationCenter(ScriptExecutionContext*, NotificationPresenter*); + + ScriptExecutionContext* m_scriptExecutionContext; + NotificationPresenter* m_notificationPresenter; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationCenter_h diff --git a/WebCore/notifications/NotificationCenter.idl b/WebCore/notifications/NotificationCenter.idl new file mode 100644 index 0000000..9918b15 --- /dev/null +++ b/WebCore/notifications/NotificationCenter.idl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 threads { + + interface [ + Conditional=NOTIFICATIONS + ] NotificationCenter { + Notification createHTMLNotification(in DOMString url) raises(Exception); + Notification createNotification(in DOMString iconUrl, in DOMString title, in DOMString body) raises(Exception); + + int checkPermission(); + [Custom] void requestPermission(in VoidCallback callback); + }; + +} diff --git a/WebCore/notifications/NotificationContents.h b/WebCore/notifications/NotificationContents.h new file mode 100644 index 0000000..ebdc514 --- /dev/null +++ b/WebCore/notifications/NotificationContents.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationContents_h +#define NotificationContents_h + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class NotificationContents { + public: + NotificationContents() {} + NotificationContents(const String& iconUrl, const String& title, const String& body) + : m_icon(iconUrl) + , m_title(title) + , m_body(body) {} + + String icon() const { return m_icon; } + String title() const { return m_title; } + String body() const { return m_body; } + + private: + String m_icon; + String m_title; + String m_body; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationContents_h diff --git a/WebCore/notifications/NotificationPresenter.h b/WebCore/notifications/NotificationPresenter.h new file mode 100644 index 0000000..90d6c4c --- /dev/null +++ b/WebCore/notifications/NotificationPresenter.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef NotificationPresenter_h +#define NotificationPresenter_h + +#include <wtf/PassRefPtr.h> +#include "VoidCallback.h" + +#if ENABLE(NOTIFICATIONS) + +namespace WebCore { + + class Notification; + class SecurityOrigin; + class String; + + class NotificationPresenter { + + public: + enum Permission { + PERMISSION_ALLOWED, // User has allowed notifications + PERMISSION_NOT_ALLOWED, // User has not yet allowed + PERMISSION_DENIED // User has explictly denied permission + }; + + virtual ~NotificationPresenter() {} + + // Requests that a notification be shown. + virtual bool show(Notification* object) = 0; + + // Requests that a notification that has already been shown be canceled. + virtual void cancel(Notification* object) = 0; + + // Informs the presenter that a Notification object has been destroyed + // (such as by a page transition). The presenter may continue showing + // the notification, but must not attempt to call the event handlers. + virtual void notificationObjectDestroyed(Notification* object) = 0; + + // Requests user permission to show desktop notifications from a particular + // origin. The callback parameter should be run when the user has + // made a decision. + virtual void requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) = 0; + + // Checks the current level of permission. + virtual Permission checkPermission(SecurityOrigin* origin) = 0; + }; + +} // namespace WebCore + +#endif // ENABLE(NOTIFICATIONS) + +#endif // NotificationPresenter_h diff --git a/WebCore/page/Chrome.cpp b/WebCore/page/Chrome.cpp index 5a5670e..bcfef79 100644 --- a/WebCore/page/Chrome.cpp +++ b/WebCore/page/Chrome.cpp @@ -403,6 +403,13 @@ bool Chrome::setCursor(PlatformCursorHandle cursor) return m_client->setCursor(cursor); } +#if ENABLE(NOTIFICATIONS) +NotificationPresenter* Chrome::notificationPresenter() const +{ + return m_client->notificationPresenter(); +} +#endif + // -------- #if ENABLE(DASHBOARD_SUPPORT) diff --git a/WebCore/page/Chrome.h b/WebCore/page/Chrome.h index c26e450..e28661c 100644 --- a/WebCore/page/Chrome.h +++ b/WebCore/page/Chrome.h @@ -44,6 +44,9 @@ namespace WebCore { class IntRect; class Page; class String; +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif struct FrameLoadRequest; struct WindowFeatures; @@ -128,6 +131,10 @@ namespace WebCore { void focusNSView(NSView*); #endif +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* notificationPresenter() const; +#endif + private: Page* m_page; ChromeClient* m_client; diff --git a/WebCore/page/ChromeClient.h b/WebCore/page/ChromeClient.h index 409a492..1010273 100644 --- a/WebCore/page/ChromeClient.h +++ b/WebCore/page/ChromeClient.h @@ -62,6 +62,10 @@ namespace WebCore { class GraphicsLayer; #endif +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif + class ChromeClient { public: virtual void chromeDestroyed() = 0; @@ -152,6 +156,10 @@ namespace WebCore { virtual void dashboardRegionsChanged(); #endif +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const = 0; +#endif + virtual void populateVisitedLinks(); virtual FloatRect customHighlightRect(Node*, const AtomicString& type, const FloatRect& lineRect); diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp index e50b488..0cc3e5f 100644 --- a/WebCore/page/DOMWindow.cpp +++ b/WebCore/page/DOMWindow.cpp @@ -80,6 +80,10 @@ #include "DOMApplicationCache.h" #endif +#if ENABLE(NOTIFICATIONS) +#include "NotificationCenter.h" +#endif + using std::min; using std::max; @@ -454,6 +458,10 @@ void DOMWindow::clear() m_applicationCache->disconnectFrame(); m_applicationCache = 0; #endif + +#if ENABLE(NOTIFICATIONS) + m_notifications = 0; +#endif } Screen* DOMWindow::screen() const @@ -593,6 +601,28 @@ Storage* DOMWindow::localStorage() const } #endif +#if ENABLE(NOTIFICATIONS) +NotificationCenter* DOMWindow::webkitNotifications() const +{ + if (m_notifications) + return m_notifications.get(); + + Document* document = this->document(); + if (!document) + return 0; + + Page* page = document->page(); + if (!page) + return 0; + + NotificationPresenter* provider = page->chrome()->notificationPresenter(); + if (provider) + m_notifications = NotificationCenter::create(document, provider); + + return m_notifications.get(); +} +#endif + void DOMWindow::postMessage(const String& message, MessagePort* messagePort, const String& targetOrigin, DOMWindow* source, ExceptionCode& ec) { if (!m_frame) @@ -1532,6 +1562,16 @@ void DOMWindow::setOnfocus(PassRefPtr<EventListener> eventListener) setAttributeEventListener(eventNames().focusEvent, eventListener); } +EventListener* DOMWindow::onhashchange() const +{ + return getAttributeEventListener(eventNames().hashchangeEvent); +} + +void DOMWindow::setOnhashchange(PassRefPtr<EventListener> eventListener) +{ + setAttributeEventListener(eventNames().hashchangeEvent, eventListener); +} + EventListener* DOMWindow::onkeydown() const { return getAttributeEventListener(eventNames().keydownEvent); diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h index 12caf7e..ffe4ef5 100644 --- a/WebCore/page/DOMWindow.h +++ b/WebCore/page/DOMWindow.h @@ -56,6 +56,7 @@ namespace WebCore { class MessagePort; class Navigator; class Node; + class NotificationCenter; class PostMessageTimer; class ScheduledAction; class Screen; @@ -205,6 +206,10 @@ namespace WebCore { DOMApplicationCache* applicationCache() const; #endif +#if ENABLE(NOTIFICATIONS) + NotificationCenter* webkitNotifications() const; +#endif + void postMessage(const String& message, MessagePort*, const String& targetOrigin, DOMWindow* source, ExceptionCode&); void postMessageTimerFired(PostMessageTimer*); @@ -274,6 +279,8 @@ namespace WebCore { void setOnerror(PassRefPtr<EventListener>); EventListener* onfocus() const; void setOnfocus(PassRefPtr<EventListener>); + EventListener* onhashchange() const; + void setOnhashchange(PassRefPtr<EventListener>); EventListener* onkeydown() const; void setOnkeydown(PassRefPtr<EventListener>); EventListener* onkeypress() const; @@ -441,6 +448,9 @@ namespace WebCore { #if ENABLE(OFFLINE_WEB_APPLICATIONS) mutable RefPtr<DOMApplicationCache> m_applicationCache; #endif +#if ENABLE(NOTIFICATIONS) + mutable RefPtr<NotificationCenter> m_notifications; +#endif RegisteredEventListenerVector m_eventListeners; }; diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl index aba92f0..4e7835e 100644 --- a/WebCore/page/DOMWindow.idl +++ b/WebCore/page/DOMWindow.idl @@ -55,7 +55,7 @@ module window { attribute [Replaceable] Navigator clientInformation; attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8DisallowShadowing] Location location; - attribute [Replaceable, CustomGetter] Event event; + attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; readonly attribute [Custom] Crypto crypto; @@ -169,6 +169,9 @@ module window { readonly attribute Storage sessionStorage; readonly attribute Storage localStorage; #endif +#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS + readonly attribute NotificationCenter webkitNotifications; +#endif attribute [Replaceable] Console console; @@ -221,6 +224,7 @@ module window { attribute EventListener onended; attribute EventListener onerror; attribute EventListener onfocus; + attribute EventListener onhashchange; attribute EventListener oninput; attribute EventListener onkeydown; attribute EventListener onkeypress; @@ -454,6 +458,10 @@ module window { attribute RangeConstructor Range; attribute RangeExceptionConstructor RangeException; +#if ENABLE_EVENTSOURCE + attribute [JSCCustomGetter] EventSourceConstructor EventSource; // Usable with new the operator +#endif + // Mozilla has a separate XMLDocument object for XML documents. // We just use Document for this. attribute DocumentConstructor XMLDocument; diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp index 41e859f..99ecce0 100644 --- a/WebCore/page/EventHandler.cpp +++ b/WebCore/page/EventHandler.cpp @@ -442,7 +442,7 @@ bool EventHandler::handleMouseDraggedEvent(const MouseEventWithHitTestResults& e // If the selection is contained in a layer that can scroll, that layer should handle the autoscroll // Otherwise, let the bridge handle it so the view can scroll itself. RenderObject* renderer = targetNode->renderer(); - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) { + while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) renderer = renderer->document()->ownerElement()->renderer(); else @@ -732,7 +732,7 @@ void EventHandler::updateAutoscrollRenderer() if (Node* nodeAtPoint = hitTest.innerNode()) m_autoscrollRenderer = nodeAtPoint->renderer(); - while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeProgramaticallyScrolled(false))) + while (m_autoscrollRenderer && (!m_autoscrollRenderer->isBox() || !toRenderBox(m_autoscrollRenderer)->canBeScrolledAndHasScrollableArea())) m_autoscrollRenderer = m_autoscrollRenderer->parent(); } @@ -1172,7 +1172,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) if (mouseEvent.button() == MiddleButton && !mev.isOverLink()) { RenderObject* renderer = mev.targetNode()->renderer(); - while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeProgramaticallyScrolled(false))) { + while (renderer && (!renderer->isBox() || !toRenderBox(renderer)->canBeScrolledAndHasScrollableArea())) { if (!renderer->parent() && renderer->node() == renderer->document() && renderer->document()->ownerElement()) renderer = renderer->document()->ownerElement()->renderer(); else @@ -2339,7 +2339,7 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve } -#if !PLATFORM(MAC) && !PLATFORM(QT) +#if !PLATFORM(MAC) && !PLATFORM(QT) && !PLATFORM(HAIKU) bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent*) const { return false; diff --git a/WebCore/page/EventSource.cpp b/WebCore/page/EventSource.cpp new file mode 100644 index 0000000..47243d9 --- /dev/null +++ b/WebCore/page/EventSource.cpp @@ -0,0 +1,372 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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(EVENTSOURCE) + +#include "EventSource.h" + +#include "Cache.h" +#include "DOMWindow.h" +#include "Event.h" +#include "EventException.h" +#include "PlatformString.h" +#include "MessageEvent.h" +#include "ResourceError.h" +#include "ResourceRequest.h" +#include "ResourceResponse.h" +#include "ScriptExecutionContext.h" +#include "TextResourceDecoder.h" +#include "ThreadableLoader.h" + +namespace WebCore { + +const unsigned long long EventSource::defaultReconnectDelay = 3000; + +EventSource::EventSource(const String& url, ScriptExecutionContext* context, ExceptionCode& ec) + : ActiveDOMObject(context, this) + , m_state(CONNECTING) + , m_reconnectTimer(this, &EventSource::reconnectTimerFired) + , m_failSilently(false) + , m_requestInFlight(false) + , m_reconnectDelay(defaultReconnectDelay) +{ + if (url.isEmpty() || !(m_url = context->completeURL(url)).isValid()) { + ec = SYNTAX_ERR; + return; + } + // FIXME: should support cross-origin requests + if (!scriptExecutionContext()->securityOrigin()->canRequest(m_url)) { + ec = SECURITY_ERR; + return; + } + + m_origin = scriptExecutionContext()->securityOrigin()->toString(); + m_decoder = TextResourceDecoder::create("text/plain", "UTF-8"); + + setPendingActivity(this); + connect(); +} + +EventSource::~EventSource() +{ +} + +void EventSource::connect() +{ + ResourceRequest request(m_url); + request.setHTTPMethod("GET"); + request.setHTTPHeaderField("Accept", "text/event-stream"); + request.setHTTPHeaderField("Cache-Control", "no-cache"); + if (!m_lastEventId.isEmpty()) + request.setHTTPHeaderField("Last-Event-ID", m_lastEventId); + + ThreadableLoaderOptions options; + options.sendLoadCallbacks = true; + options.sniffContent = false; + options.allowCredentials = true; + + m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); + + m_requestInFlight = true; + + if (!scriptExecutionContext()->isWorkerContext()) + cache()->loader()->nonCacheRequestInFlight(m_url); +} + +void EventSource::endRequest() +{ + m_requestInFlight = false; + + if (!m_failSilently) + dispatchGenericEvent(eventNames().errorEvent); + + if (!scriptExecutionContext()->isWorkerContext()) + cache()->loader()->nonCacheRequestComplete(m_url); + + if (m_state != CLOSED) + scheduleReconnect(); + else + unsetPendingActivity(this); +} + +void EventSource::scheduleReconnect() +{ + m_state = CONNECTING; + m_reconnectTimer.startOneShot(m_reconnectDelay / 1000); +} + +void EventSource::reconnectTimerFired(Timer<EventSource>*) +{ + connect(); +} + +String EventSource::url() const +{ + return m_url.string(); +} + +EventSource::State EventSource::readyState() const +{ + return m_state; +} + +void EventSource::close() +{ + if (m_state == CLOSED) + return; + + if (m_reconnectTimer.isActive()) { + m_reconnectTimer.stop(); + unsetPendingActivity(this); + } + + m_state = CLOSED; + m_failSilently = true; + + if (m_requestInFlight) + m_loader->cancel(); +} + +ScriptExecutionContext* EventSource::scriptExecutionContext() const +{ + return ActiveDOMObject::scriptExecutionContext(); +} + +void EventSource::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool) +{ + EventListenersMap::iterator iter = m_eventListeners.find(eventType); + if (iter == m_eventListeners.end()) { + ListenerVector listeners; + listeners.append(eventListener); + m_eventListeners.add(eventType, listeners); + } else { + ListenerVector& listeners = iter->second; + for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { + if (*listenerIter == eventListener) + return; + } + + listeners.append(eventListener); + m_eventListeners.add(eventType, listeners); + } +} + +void EventSource::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool) +{ + EventListenersMap::iterator iter = m_eventListeners.find(eventType); + if (iter == m_eventListeners.end()) + return; + + ListenerVector& listeners = iter->second; + for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) { + if (*listenerIter == eventListener) { + listeners.remove(listenerIter - listeners.begin()); + return; + } + } +} + +bool EventSource::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec) +{ + if (!event || event->type().isEmpty()) { + ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR; + return true; + } + + EventListener* attributeListener = m_attributeListeners.get(event->type()).get(); + if (attributeListener) { + event->setTarget(this); + event->setCurrentTarget(this); + attributeListener->handleEvent(event.get(), false); + } + + ListenerVector listenersCopy = m_eventListeners.get(event->type()); + for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) { + event->setTarget(this); + event->setCurrentTarget(this); + listenerIter->get()->handleEvent(event.get(), false); + } + + return !event->defaultPrevented(); +} + +void EventSource::didReceiveResponse(const ResourceResponse& response) +{ + int statusCode = response.httpStatusCode(); + if (statusCode == 200 && response.httpHeaderField("Content-Type") == "text/event-stream") { + m_state = OPEN; + dispatchGenericEvent(eventNames().openEvent); + } else { + if (statusCode <= 200 || statusCode > 299) + m_state = CLOSED; + m_loader->cancel(); + } +} + +void EventSource::didReceiveData(const char* data, int length) +{ + append(m_receiveBuf, m_decoder->decode(data, length)); + parseEventStream(); +} + +void EventSource::didFinishLoading(unsigned long) +{ + if (m_receiveBuf.size() > 0 || m_data.size() > 0) { + append(m_receiveBuf, "\n\n"); + parseEventStream(); + } + m_state = CONNECTING; + endRequest(); +} + +void EventSource::didFail(const ResourceError& error) +{ + int canceled = error.isCancellation(); + if (((m_state == CONNECTING) && !canceled) || ((m_state == OPEN) && canceled)) + m_state = CLOSED; + endRequest(); +} + +void EventSource::didFailRedirectCheck() +{ + m_state = CLOSED; + m_loader->cancel(); +} + +void EventSource::parseEventStream() +{ + unsigned int bufPos = 0; + unsigned int bufSize = m_receiveBuf.size(); + for (;;) { + int lineLength = -1; + int fieldLength = -1; + int carriageReturn = 0; + for (unsigned int i = bufPos; lineLength < 0 && i < bufSize; i++) { + switch (m_receiveBuf[i]) { + case ':': + if (fieldLength < 0) + fieldLength = i - bufPos; + break; + case '\n': + if (i > bufPos && m_receiveBuf[i - 1] == '\r') { + carriageReturn++; + i--; + } + lineLength = i - bufPos; + break; + } + } + + if (lineLength < 0) + break; + + parseEventStreamLine(bufPos, fieldLength, lineLength); + bufPos += lineLength + carriageReturn + 1; + } + + if (bufPos == bufSize) + m_receiveBuf.clear(); + else if (bufPos) + m_receiveBuf.remove(0, bufPos); +} + +void EventSource::parseEventStreamLine(unsigned int bufPos, int fieldLength, int lineLength) +{ + if (!lineLength) { + if (!m_data.isEmpty()) + dispatchMessageEvent(); + if (!m_eventName.isEmpty()) + m_eventName = ""; + } else if (fieldLength) { + bool noValue = fieldLength < 0; + + String field(&m_receiveBuf[bufPos], noValue ? lineLength : fieldLength); + int step; + if (noValue) + step = lineLength; + else if (m_receiveBuf[bufPos + fieldLength + 1] != ' ') + step = fieldLength + 1; + else + step = fieldLength + 2; + bufPos += step; + int valueLength = lineLength - step; + + if (field == "data") { + if (m_data.size() > 0) + m_data.append('\n'); + if (valueLength) + m_data.append(&m_receiveBuf[bufPos], valueLength); + } else if (field == "event") + m_eventName = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : ""; + else if (field == "id") + m_lastEventId = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : ""; + else if (field == "retry") { + if (!valueLength) + m_reconnectDelay = defaultReconnectDelay; + else { + String value(&m_receiveBuf[bufPos], valueLength); + bool ok; + unsigned long long retry = value.toUInt64(&ok); + if (ok) + m_reconnectDelay = retry; + } + } + } +} + +void EventSource::dispatchGenericEvent(const AtomicString& type) +{ + RefPtr<Event> evt = Event::create(type, false, false); + ExceptionCode ec = 0; + dispatchEvent(evt.release(), ec); + ASSERT(!ec); +} + +void EventSource::dispatchMessageEvent() +{ + RefPtr<MessageEvent> evt = MessageEvent::create(); + String eventName = m_eventName.isEmpty() ? eventNames().messageEvent.string() : m_eventName; + evt->initMessageEvent(eventName, false, false, String::adopt(m_data), m_origin, m_lastEventId, 0, 0); + ExceptionCode ec = 0; + dispatchEvent(evt.release(), ec); + ASSERT(!ec); +} + +void EventSource::stop() +{ + close(); +} + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) diff --git a/WebCore/page/EventSource.h b/WebCore/page/EventSource.h new file mode 100644 index 0000000..df55694 --- /dev/null +++ b/WebCore/page/EventSource.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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 EventSource_h +#define EventSource_h + +#if ENABLE(EVENTSOURCE) + +#include "ActiveDOMObject.h" +#include "AtomicStringHash.h" +#include "EventListener.h" +#include "EventNames.h" +#include "EventTarget.h" +#include "KURL.h" +#include "ThreadableLoaderClient.h" +#include "Timer.h" + +#include <wtf/HashMap.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/Vector.h> + +namespace WebCore { + + class ResourceResponse; + class TextResourceDecoder; + class ThreadableLoader; + + class EventSource : public RefCounted<EventSource>, public EventTarget, private ThreadableLoaderClient, public ActiveDOMObject { + public: + static PassRefPtr<EventSource> create(const String& url, ScriptExecutionContext* context, ExceptionCode& ec) { return adoptRef(new EventSource(url, context, ec)); } + virtual ~EventSource(); + + static const unsigned long long defaultReconnectDelay; + + String url() const; + + enum State { + CONNECTING = 0, + OPEN = 1, + CLOSED = 2, + }; + + State readyState() const; + + void setOnopen(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().openEvent, eventListener); } + EventListener* onopen() const { return m_attributeListeners.get(eventNames().openEvent).get(); } + + void setOnmessage(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().messageEvent, eventListener); } + EventListener* onmessage() const { return m_attributeListeners.get(eventNames().messageEvent).get(); } + + void setOnerror(PassRefPtr<EventListener> eventListener) { m_attributeListeners.set(eventNames().errorEvent, eventListener); } + EventListener* onerror() const { return m_attributeListeners.get(eventNames().errorEvent).get(); } + + void close(); + + using RefCounted<EventSource>::ref; + using RefCounted<EventSource>::deref; + + virtual EventSource* toEventSource() { return this; } + virtual ScriptExecutionContext* scriptExecutionContext() const; + + typedef Vector<RefPtr<EventListener> > ListenerVector; + typedef HashMap<AtomicString, ListenerVector> EventListenersMap; + + virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); + virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); + virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); + EventListenersMap& eventListeners() { return m_eventListeners; } + + virtual void stop(); + + private: + EventSource(const String& url, ScriptExecutionContext* context, ExceptionCode& ec); + + virtual void refEventTarget() { ref(); } + virtual void derefEventTarget() { deref(); } + + virtual void didReceiveResponse(const ResourceResponse& response); + virtual void didReceiveData(const char* data, int length); + virtual void didFinishLoading(unsigned long); + virtual void didFail(const ResourceError& error); + virtual void didFailRedirectCheck(); + + void connect(); + void endRequest(); + void scheduleReconnect(); + void reconnectTimerFired(Timer<EventSource>*); + void parseEventStream(); + void parseEventStreamLine(unsigned int pos, int fieldLength, int lineLength); + void dispatchGenericEvent(const AtomicString& type); + void dispatchMessageEvent(); + + KURL m_url; + State m_state; + + HashMap<AtomicString, RefPtr<EventListener> > m_attributeListeners; + EventListenersMap m_eventListeners; + + RefPtr<TextResourceDecoder> m_decoder; + RefPtr<ThreadableLoader> m_loader; + Timer<EventSource> m_reconnectTimer; + Vector<UChar> m_receiveBuf; + bool m_failSilently; + bool m_requestInFlight; + + String m_eventName; + Vector<UChar> m_data; + String m_lastEventId; + unsigned long long m_reconnectDelay; + String m_origin; + }; + +} // namespace WebCore + +#endif // ENABLE(EVENTSOURCE) + +#endif // EventSource_h diff --git a/WebCore/page/EventSource.idl b/WebCore/page/EventSource.idl new file mode 100644 index 0000000..c438e68 --- /dev/null +++ b/WebCore/page/EventSource.idl @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Ericsson AB + * 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 Ericsson 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 [ + Conditional=EVENTSOURCE, + CustomMarkFunction, + NoStaticTables + ] EventSource { + + readonly attribute DOMString URL; + + // ready state + const unsigned short CONNECTING = 0; + const unsigned short OPEN = 1; + const unsigned short CLOSED = 2; + readonly attribute unsigned short readyState; + + // networking + attribute EventListener onopen; + attribute EventListener onmessage; + attribute EventListener onerror; + void close(); + + // EventTarget interface + [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 evt) + raises(EventException); + + }; +} diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index e57a8b5..f8cc111 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -334,6 +334,7 @@ void Geolocation::requestPermission() void Geolocation::geolocationServicePositionChanged(GeolocationService*) { + ASSERT_UNUSED(service, service == m_service); ASSERT(m_service->lastPosition()); // Stop all currently running timers. diff --git a/WebCore/page/Navigator.cpp b/WebCore/page/Navigator.cpp index 3603b86..4922860 100644 --- a/WebCore/page/Navigator.cpp +++ b/WebCore/page/Navigator.cpp @@ -31,11 +31,13 @@ #include "Language.h" #include "MimeTypeArray.h" #include "Page.h" +#include "PageGroup.h" #include "PlatformString.h" #include "PluginArray.h" #include "PluginData.h" #include "ScriptController.h" #include "Settings.h" +#include "StorageNamespace.h" namespace WebCore { @@ -150,5 +152,21 @@ Geolocation* Navigator::geolocation() const m_geolocation = Geolocation::create(m_frame); return m_geolocation.get(); } - + +#if ENABLE(DOM_STORAGE) +void Navigator::getStorageUpdates() +{ + if (!m_frame) + return; + + Page* page = m_frame->page(); + if (!page) + return; + + StorageNamespace* localStorage = page->group().localStorage(); + if (localStorage) + localStorage->unlock(); +} +#endif + } // namespace WebCore diff --git a/WebCore/page/Navigator.h b/WebCore/page/Navigator.h index d50721e..4adebe1 100644 --- a/WebCore/page/Navigator.h +++ b/WebCore/page/Navigator.h @@ -55,6 +55,11 @@ namespace WebCore { // This is used for GC marking. Geolocation* optionalGeolocation() const { return m_geolocation.get(); } +#if ENABLE(DOM_STORAGE) + // Relinquishes the storage lock, if one exists. + void getStorageUpdates(); +#endif + private: Navigator(Frame*); Frame* m_frame; diff --git a/WebCore/page/Navigator.idl b/WebCore/page/Navigator.idl index 8048ff3..80ef4fb 100644 --- a/WebCore/page/Navigator.idl +++ b/WebCore/page/Navigator.idl @@ -42,6 +42,10 @@ module window { #if defined(ENABLE_GEOLOCATION) && ENABLE_GEOLOCATION readonly attribute Geolocation geolocation; #endif + +#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE + void getStorageUpdates(); +#endif }; } diff --git a/WebCore/page/Page.h b/WebCore/page/Page.h index 9d9af86..fb212a4 100644 --- a/WebCore/page/Page.h +++ b/WebCore/page/Page.h @@ -71,6 +71,9 @@ namespace WebCore { #if ENABLE(WML) class WMLPageState; #endif +#if ENABLE(NOTIFICATIONS) + class NotificationPresenter; +#endif enum FindDirection { FindDirectionForward, FindDirectionBackward }; @@ -272,6 +275,10 @@ namespace WebCore { #if ENABLE(WML) OwnPtr<WMLPageState> m_wmlPageState; #endif + +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* m_notificationPresenter; +#endif }; } // namespace WebCore diff --git a/WebCore/page/PositionOptions.h b/WebCore/page/PositionOptions.h index ee8530a..ed7074b 100644 --- a/WebCore/page/PositionOptions.h +++ b/WebCore/page/PositionOptions.h @@ -33,7 +33,7 @@ namespace WebCore { class PositionOptions : public RefCounted<PositionOptions> { public: - static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions); } + static PassRefPtr<PositionOptions> create() { return adoptRef(new PositionOptions()); } bool enableHighAccuracy() const { return m_highAccuracy; } void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; } diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp index 14a1b59..8274e0e 100644 --- a/WebCore/page/SecurityOrigin.cpp +++ b/WebCore/page/SecurityOrigin.cpp @@ -32,15 +32,10 @@ #include "CString.h" #include "FrameLoader.h" #include "KURL.h" -#include "PlatformString.h" -#include "StringHash.h" -#include <wtf/HashSet.h> #include <wtf/StdLibExtras.h> namespace WebCore { -typedef HashSet<String, CaseFoldingHash> URLSchemesMap; - static URLSchemesMap& localSchemes() { DEFINE_STATIC_LOCAL(URLSchemesMap, localSchemes, ()); @@ -346,6 +341,28 @@ void SecurityOrigin::registerURLSchemeAsLocal(const String& scheme) } // static +void SecurityOrigin::removeURLSchemeRegisteredAsLocal(const String& scheme) +{ + if (scheme == "file") + return; +#if PLATFORM(MAC) + if (scheme == "applewebdata") + return; +#endif +#if PLATFORM(QT) + if (scheme == "qrc") + return; +#endif + localSchemes().remove(scheme); +} + +// static +const URLSchemesMap& SecurityOrigin::localURLSchemes() +{ + return localSchemes(); +} + +// static bool SecurityOrigin::shouldTreatURLAsLocal(const String& url) { // This avoids an allocation of another String and the HashSet contains() diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h index ab92683..335ed28 100644 --- a/WebCore/page/SecurityOrigin.h +++ b/WebCore/page/SecurityOrigin.h @@ -29,14 +29,18 @@ #ifndef SecurityOrigin_h #define SecurityOrigin_h +#include <wtf/HashSet.h> #include <wtf/RefCounted.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> #include "PlatformString.h" +#include "StringHash.h" namespace WebCore { + typedef HashSet<String, CaseFoldingHash> URLSchemesMap; + class KURL; class SecurityOrigin : public ThreadSafeShared<SecurityOrigin> { @@ -129,6 +133,8 @@ namespace WebCore { bool isSameSchemeHostPort(const SecurityOrigin*) const; static void registerURLSchemeAsLocal(const String&); + static void removeURLSchemeRegisteredAsLocal(const String&); + static const URLSchemesMap& localURLSchemes(); static bool shouldTreatURLAsLocal(const String&); static bool shouldTreatURLSchemeAsLocal(const String&); diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp index 7503f0a..f85d8e4 100644 --- a/WebCore/page/animation/AnimationBase.cpp +++ b/WebCore/page/animation/AnimationBase.cpp @@ -302,11 +302,21 @@ public: { ShadowData* shadowA = (a->*m_getter)(); ShadowData* shadowB = (b->*m_getter)(); + + while (true) { + if (!shadowA && !shadowB) // end of both lists + return true; + + if (!shadowA || !shadowB) // end of just one of the lists + return false; + + if (*shadowA != *shadowB) + return false; + + shadowA = shadowA->next; + shadowB = shadowB->next; + } - if ((!shadowA && shadowB) || (shadowA && !shadowB)) - return false; - if (shadowA && shadowB && (*shadowA != *shadowB)) - return false; return true; } @@ -316,12 +326,22 @@ public: ShadowData* shadowB = (b->*m_getter)(); ShadowData defaultShadowData(0, 0, 0, 0, Normal, Color::transparent); - if (!shadowA) - shadowA = &defaultShadowData; - if (!shadowB) - shadowB = &defaultShadowData; + ShadowData* newShadowData = 0; + + while (shadowA || shadowB) { + ShadowData* srcShadow = shadowA ? shadowA : &defaultShadowData; + ShadowData* dstShadow = shadowB ? shadowB : &defaultShadowData; + + if (!newShadowData) + newShadowData = blendFunc(anim, srcShadow, dstShadow, progress); + else + newShadowData->next = blendFunc(anim, srcShadow, dstShadow, progress); - (dst->*m_setter)(blendFunc(anim, shadowA, shadowB, progress), false); + shadowA = shadowA ? shadowA->next : 0; + shadowB = shadowB ? shadowB->next : 0; + } + + (dst->*m_setter)(newShadowData, false); } private: @@ -365,6 +385,124 @@ private: void (RenderStyle::*m_setter)(const Color&); }; +// Wrapper base class for an animatable property in a FillLayer +class FillLayerPropertyWrapperBase { +public: + FillLayerPropertyWrapperBase() + { + } + + virtual ~FillLayerPropertyWrapperBase() { } + + virtual bool equals(const FillLayer* a, const FillLayer* b) const = 0; + virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const = 0; +}; + +template <typename T> +class FillLayerPropertyWrapperGetter : public FillLayerPropertyWrapperBase { +public: + FillLayerPropertyWrapperGetter(T (FillLayer::*getter)() const) + : m_getter(getter) + { + } + + virtual bool equals(const FillLayer* a, const FillLayer* b) const + { + // If the style pointers are the same, don't bother doing the test. + // If either is null, return false. If both are null, return true. + if ((!a && !b) || a == b) + return true; + if (!a || !b) + return false; + return (a->*m_getter)() == (b->*m_getter)(); + } + +protected: + T (FillLayer::*m_getter)() const; +}; + +template <typename T> +class FillLayerPropertyWrapper : public FillLayerPropertyWrapperGetter<T> { +public: + FillLayerPropertyWrapper(T (FillLayer::*getter)() const, void (FillLayer::*setter)(T)) + : FillLayerPropertyWrapperGetter<T>(getter) + , m_setter(setter) + { + } + + virtual void blend(const AnimationBase* anim, FillLayer* dst, const FillLayer* a, const FillLayer* b, double progress) const + { + (dst->*m_setter)(blendFunc(anim, (a->*FillLayerPropertyWrapperGetter<T>::m_getter)(), (b->*FillLayerPropertyWrapperGetter<T>::m_getter)(), progress)); + } + +protected: + void (FillLayer::*m_setter)(T); +}; + + +class FillLayersPropertyWrapper : public PropertyWrapperBase { +public: + typedef const FillLayer* (RenderStyle::*LayersGetter)() const; + typedef FillLayer* (RenderStyle::*LayersAccessor)(); + + FillLayersPropertyWrapper(int prop, LayersGetter getter, LayersAccessor accessor) + : PropertyWrapperBase(prop) + , m_layersGetter(getter) + , m_layersAccessor(accessor) + { + switch (prop) { + case CSSPropertyBackgroundPositionX: + case CSSPropertyWebkitMaskPositionX: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::xPosition, &FillLayer::setXPosition); + break; + case CSSPropertyBackgroundPositionY: + case CSSPropertyWebkitMaskPositionY: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<Length>(&FillLayer::yPosition, &FillLayer::setYPosition); + break; + case CSSPropertyWebkitBackgroundSize: + case CSSPropertyWebkitMaskSize: + m_fillLayerPropertyWrapper = new FillLayerPropertyWrapper<LengthSize>(&FillLayer::size, &FillLayer::setSize); + break; + } + } + + virtual bool equals(const RenderStyle* a, const RenderStyle* b) const + { + const FillLayer* fromLayer = (a->*m_layersGetter)(); + const FillLayer* toLayer = (b->*m_layersGetter)(); + + while (fromLayer && toLayer) { + if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer)) + return false; + + fromLayer = fromLayer->next(); + toLayer = toLayer->next(); + } + + return true; + } + + virtual void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const + { + const FillLayer* aLayer = (a->*m_layersGetter)(); + const FillLayer* bLayer = (b->*m_layersGetter)(); + FillLayer* dstLayer = (dst->*m_layersAccessor)(); + + while (aLayer && bLayer && dstLayer) { + m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress); + aLayer = aLayer->next(); + bLayer = bLayer->next(); + dstLayer = dstLayer->next(); + } + } + +private: + FillLayerPropertyWrapperBase* m_fillLayerPropertyWrapper; + + LayersGetter m_layersGetter; + LayersAccessor m_layersAccessor; +}; + class ShorthandPropertyWrapper : public PropertyWrapperBase { public: ShorthandPropertyWrapper(int property, const CSSPropertyLonghand& longhand) @@ -442,13 +580,14 @@ static void ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor)); gPropertyWrappers->append(new PropertyWrapper<const Color&>(CSSPropertyBackgroundColor, &RenderStyle::backgroundColor, &RenderStyle::setBackgroundColor)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundXPosition, &RenderStyle::setBackgroundXPosition)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundYPosition, &RenderStyle::setBackgroundYPosition)); - gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundSize, &RenderStyle::setBackgroundSize)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskXPosition, &RenderStyle::setMaskXPosition)); - gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskYPosition, &RenderStyle::setMaskYPosition)); - gPropertyWrappers->append(new PropertyWrapper<LengthSize>(CSSPropertyWebkitMaskSize, &RenderStyle::maskSize, &RenderStyle::setMaskSize)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionX, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyBackgroundPositionY, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitBackgroundSize, &RenderStyle::backgroundLayers, &RenderStyle::accessBackgroundLayers)); + + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionX, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskPositionY, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); + gPropertyWrappers->append(new FillLayersPropertyWrapper(CSSPropertyWebkitMaskSize, &RenderStyle::maskLayers, &RenderStyle::accessMaskLayers)); gPropertyWrappers->append(new PropertyWrapper<int>(CSSPropertyFontSize, &RenderStyle::fontSize, &RenderStyle::setBlendedFontSize)); gPropertyWrappers->append(new PropertyWrapper<unsigned short>(CSSPropertyWebkitColumnRuleWidth, &RenderStyle::columnRuleWidth, &RenderStyle::setColumnRuleWidth)); diff --git a/WebCore/page/haiku/DragControllerHaiku.cpp b/WebCore/page/haiku/DragControllerHaiku.cpp index 0b95558..ef08ac2 100644 --- a/WebCore/page/haiku/DragControllerHaiku.cpp +++ b/WebCore/page/haiku/DragControllerHaiku.cpp @@ -32,10 +32,9 @@ #include <InterfaceDefs.h> -namespace WebCore -{ +namespace WebCore { -// FIXME: These values are straight out of DragControllerMac, so probably have +// FIXME: These values are straight out of DragControllerMac, so probably have // little correlation with Haiku standards... const int DragController::LinkDragBorderInset = 2; const int DragController::MaxOriginalImageArea = 1500 * 1500; diff --git a/WebCore/page/haiku/EventHandlerHaiku.cpp b/WebCore/page/haiku/EventHandlerHaiku.cpp index 64b8519..203344e 100644 --- a/WebCore/page/haiku/EventHandlerHaiku.cpp +++ b/WebCore/page/haiku/EventHandlerHaiku.cpp @@ -36,14 +36,13 @@ #include "HitTestResult.h" #include "KeyboardEvent.h" #include "MouseEventWithHitTestResults.h" +#include "NotImplemented.h" #include "Page.h" #include "PlatformKeyboardEvent.h" #include "PlatformScrollBar.h" #include "PlatformWheelEvent.h" #include "RenderWidget.h" -#include "NotImplemented.h" - #include <interface/View.h> @@ -117,13 +116,15 @@ bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults& eve bool EventHandler::passWheelEventToWidget(PlatformWheelEvent& event, Widget* widget) { - notImplemented(); - return false; + if (!widget->isFrameView()) + return false; + + return static_cast<FrameView*>(widget)->frame()->eventHandler()->handleWheelEvent(event); } PassRefPtr<Clipboard> EventHandler::createDraggingClipboard() const { - return new ClipboardHaiku(ClipboardWritable, true); + return ClipboardHaiku::create(ClipboardWritable, true); } bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe) diff --git a/WebCore/platform/ContextMenuItem.h b/WebCore/platform/ContextMenuItem.h index 3a4cdfa..d6ab519 100644 --- a/WebCore/platform/ContextMenuItem.h +++ b/WebCore/platform/ContextMenuItem.h @@ -46,6 +46,8 @@ typedef struct _GtkMenuItem GtkMenuItem; #include <QAction> #elif PLATFORM(WX) class wxMenuItem; +#elif PLATFORM(HAIKU) +class BMenuItem; #endif namespace WebCore { @@ -204,6 +206,8 @@ namespace WebCore { bool checked; bool enabled; }; +#elif PLATFORM(HAIKU) + typedef BMenuItem* PlatformMenuItemDescription; #else typedef void* PlatformMenuItemDescription; #endif diff --git a/WebCore/platform/Cookie.h b/WebCore/platform/Cookie.h new file mode 100644 index 0000000..f646d3a --- /dev/null +++ b/WebCore/platform/Cookie.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Joseph Pecoraro. 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 Cookie_h +#define Cookie_h + +#include "PlatformString.h" + +namespace WebCore { + + struct Cookie { + Cookie(const String& name, const String& value, const String& domain, + const String& path, double expires, bool httpOnly, bool secure, + bool session) + : name(name) + , value(value) + , domain(domain) + , path(path) + , expires(expires) + , httpOnly(httpOnly) + , secure(secure) + , session(session) + { + } + + String name; + String value; + String domain; + String path; + double expires; + bool httpOnly; + bool secure; + bool session; + }; + +} + +#endif diff --git a/WebCore/platform/CookieJar.h b/WebCore/platform/CookieJar.h index 6159386..987543e 100644 --- a/WebCore/platform/CookieJar.h +++ b/WebCore/platform/CookieJar.h @@ -26,15 +26,21 @@ #ifndef CookieJar_h #define CookieJar_h +#include <wtf/Vector.h> + namespace WebCore { + class Document; class KURL; class String; - class Document; + + struct Cookie; String cookies(const Document*, const KURL&); void setCookies(Document*, const KURL&, const String&); bool cookiesEnabled(const Document*); + bool getRawCookies(const Document*, const KURL&, Vector<Cookie>&); + void deleteCookie(const Document*, const KURL&, const String&); } diff --git a/WebCore/platform/CrossThreadCopier.h b/WebCore/platform/CrossThreadCopier.h index d12d72d..178e056 100644 --- a/WebCore/platform/CrossThreadCopier.h +++ b/WebCore/platform/CrossThreadCopier.h @@ -46,6 +46,7 @@ namespace WebCore { class String; struct CrossThreadResourceResponseData; struct CrossThreadResourceRequestData; + struct ThreadableLoaderOptions; template<typename T> struct CrossThreadCopierPassThrough { typedef T Type; @@ -65,6 +66,9 @@ namespace WebCore { template<typename T> struct CrossThreadCopierBase<false, T*> : public CrossThreadCopierPassThrough<T*> { }; + template<> struct CrossThreadCopierBase<false, ThreadableLoaderOptions> : public CrossThreadCopierPassThrough<ThreadableLoaderOptions> { + }; + // Custom copy methods. template<typename T> struct CrossThreadCopierBase<false, RefPtr<ThreadSafeShared<T> > > { typedef PassRefPtr<T> Type; diff --git a/WebCore/platform/Cursor.h b/WebCore/platform/Cursor.h index ea75191..2d041d2 100644 --- a/WebCore/platform/Cursor.h +++ b/WebCore/platform/Cursor.h @@ -40,6 +40,8 @@ typedef struct _GdkCursor GdkCursor; #include <QCursor> #elif PLATFORM(CHROMIUM) #include "PlatformCursor.h" +#elif PLATFORM(HAIKU) +#include <app/Cursor.h> #endif #if PLATFORM(MAC) @@ -86,6 +88,9 @@ namespace WebCore { #elif PLATFORM(CHROMIUM) // See PlatformCursor.h typedef void* PlatformCursorHandle; +#elif PLATFORM(HAIKU) + typedef BCursor* PlatformCursor; + typedef BCursor* PlatformCursorHandle; #else typedef void* PlatformCursor; typedef void* PlatformCursorHandle; diff --git a/WebCore/platform/DragData.h b/WebCore/platform/DragData.h index a1555e3..116ffdd 100644 --- a/WebCore/platform/DragData.h +++ b/WebCore/platform/DragData.h @@ -58,6 +58,9 @@ typedef void* DragDataRef; typedef void* DragDataRef; #elif PLATFORM(CHROMIUM) #include "DragDataRef.h" +#elif PLATFORM(HAIKU) +class BMessage; +typedef class BMessage* DragDataRef; #endif diff --git a/WebCore/platform/DragImage.h b/WebCore/platform/DragImage.h index 0196971..611eb8a 100644 --- a/WebCore/platform/DragImage.h +++ b/WebCore/platform/DragImage.h @@ -48,6 +48,8 @@ class wxDragImage; #include "DragImageRef.h" #elif PLATFORM(GTK) typedef struct _GdkPixbuf GdkPixbuf; +#elif PLATFORM(HAIKU) +class BBitmap; #endif //We need to #define YOffset as it needs to be shared with WebKit @@ -72,6 +74,8 @@ namespace WebCore { typedef wxDragImage* DragImageRef; #elif PLATFORM(GTK) typedef GdkPixBuf* DragImageRef; +#elif PLATFORM(HAIKU) + typedef BBitmap* DragImageRef; #elif PLATFORM(ANDROID) typedef void* DragImageRef; #endif diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h index 883364a..5d63254 100644 --- a/WebCore/platform/Pasteboard.h +++ b/WebCore/platform/Pasteboard.h @@ -102,6 +102,7 @@ public: #if PLATFORM(GTK) void setHelper(PasteboardHelper*); + PasteboardHelper* m_helper; #endif private: @@ -117,10 +118,6 @@ private: HWND m_owner; #endif -#if PLATFORM(GTK) - PasteboardHelper* m_helper; -#endif - #if PLATFORM(QT) bool m_selectionMode; #endif diff --git a/WebCore/platform/PlatformKeyboardEvent.h b/WebCore/platform/PlatformKeyboardEvent.h index 1499ac5..b5c2e95 100644 --- a/WebCore/platform/PlatformKeyboardEvent.h +++ b/WebCore/platform/PlatformKeyboardEvent.h @@ -59,6 +59,10 @@ QT_END_NAMESPACE class wxKeyEvent; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { class PlatformKeyboardEvent { @@ -155,6 +159,10 @@ namespace WebCore { PlatformKeyboardEvent(wxKeyEvent&); #endif +#if PLATFORM(HAIKU) + PlatformKeyboardEvent(BMessage*); +#endif + #if PLATFORM(WIN) || PLATFORM(CHROMIUM) bool isSystemKey() const { return m_isSystemKey; } #endif diff --git a/WebCore/platform/PlatformMenuDescription.h b/WebCore/platform/PlatformMenuDescription.h index ab71710..c986207 100644 --- a/WebCore/platform/PlatformMenuDescription.h +++ b/WebCore/platform/PlatformMenuDescription.h @@ -40,6 +40,8 @@ typedef struct HMENU__* HMENU; typedef struct _GtkMenu GtkMenu; #elif PLATFORM(WX) class wxMenu; +#elif PLATFORM(HAIKU) +class BMenu; #endif namespace WebCore { @@ -58,6 +60,8 @@ namespace WebCore { typedef void* PlatformMenuDescription; #elif PLATFORM(WX) typedef wxMenu* PlatformMenuDescription; +#elif PLATFORM(HAIKU) + typedef BMenu* PlatformMenuDescription; #else typedef void* PlatformMenuDescription; #endif diff --git a/WebCore/platform/PlatformMouseEvent.h b/WebCore/platform/PlatformMouseEvent.h index 2543d40..d01636e 100644 --- a/WebCore/platform/PlatformMouseEvent.h +++ b/WebCore/platform/PlatformMouseEvent.h @@ -50,6 +50,10 @@ typedef long LPARAM; class wxMouseEvent; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { // These button numbers match the ones used in the DOM API, 0 through 2, except for NoButton which isn't specified. @@ -128,6 +132,10 @@ namespace WebCore { PlatformMouseEvent(const wxMouseEvent&, const wxPoint& globalPoint, int clickCount); #endif +#if PLATFORM(HAIKU) + PlatformMouseEvent(const BMessage*); +#endif + protected: IntPoint m_position; IntPoint m_globalPosition; diff --git a/WebCore/platform/PlatformWheelEvent.h b/WebCore/platform/PlatformWheelEvent.h index ae8df4e..1978438 100644 --- a/WebCore/platform/PlatformWheelEvent.h +++ b/WebCore/platform/PlatformWheelEvent.h @@ -49,6 +49,10 @@ class wxMouseEvent; class wxPoint; #endif +#if PLATFORM(HAIKU) +class BMessage; +#endif + namespace WebCore { class FloatPoint; @@ -109,6 +113,10 @@ namespace WebCore { PlatformWheelEvent(const wxMouseEvent&, const wxPoint&); #endif +#if PLATFORM(HAIKU) + PlatformWheelEvent(BMessage*); +#endif + protected: IntPoint m_position; IntPoint m_globalPosition; diff --git a/WebCore/platform/PopupMenu.h b/WebCore/platform/PopupMenu.h index fc85d60..04b5a68 100644 --- a/WebCore/platform/PopupMenu.h +++ b/WebCore/platform/PopupMenu.h @@ -59,6 +59,8 @@ class wxMenu; #include <wx/event.h> #elif PLATFORM(CHROMIUM) #include "PopupMenuPrivate.h" +#elif PLATFORM(HAIKU) +class BMenu; #endif namespace WebCore { @@ -92,6 +94,8 @@ public: #if PLATFORM(WIN) Scrollbar* scrollbar() const { return m_scrollbar.get(); } + static LPCTSTR popupClassName(); + bool up(unsigned lines = 1); bool down(unsigned lines = 1); @@ -177,6 +181,8 @@ private: void OnMenuItemSelected(wxCommandEvent&); #elif PLATFORM(CHROMIUM) PopupMenuPrivate p; +#elif PLATFORM(HAIKU) + BMenu* m_menu; #endif }; diff --git a/WebCore/platform/TreeShared.h b/WebCore/platform/TreeShared.h index 1ac1b33..02728ff 100644 --- a/WebCore/platform/TreeShared.h +++ b/WebCore/platform/TreeShared.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 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 @@ -28,17 +28,8 @@ namespace WebCore { template<class T> class TreeShared : public Noncopyable { public: - TreeShared() - : m_refCount(0) - , m_parent(0) - { -#ifndef NDEBUG - m_deletionHasBegun = false; - m_inRemovedLastRefFunction = false; -#endif - } - TreeShared(T* parent) - : m_refCount(0) + TreeShared(int initialRefCount = 1) + : m_refCount(initialRefCount) , m_parent(0) { #ifndef NDEBUG diff --git a/WebCore/platform/Widget.h b/WebCore/platform/Widget.h index 4534d58..798ab9e 100644 --- a/WebCore/platform/Widget.h +++ b/WebCore/platform/Widget.h @@ -70,6 +70,11 @@ class wxWindow; typedef wxWindow* PlatformWidget; #endif +#if PLATFORM(HAIKU) +class BView; +typedef BView* PlatformWidget; +#endif + #if PLATFORM(CHROMIUM) #include "PlatformWidget.h" #endif diff --git a/WebCore/platform/chromium/PopupMenuChromium.cpp b/WebCore/platform/chromium/PopupMenuChromium.cpp index 51ed6ce..20e0901 100644 --- a/WebCore/platform/chromium/PopupMenuChromium.cpp +++ b/WebCore/platform/chromium/PopupMenuChromium.cpp @@ -601,6 +601,22 @@ bool PopupListBox::isInterestedInEventForKey(int keyCode) } } +static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) +{ + // Check whether the event is a character-typed event or not. + // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event + // is considered as character type event. In Mac OS, KeyDown (not + // KeyUp) is considered as character type event. +#if PLATFORM(WIN_OS) + if (event.type() == PlatformKeyboardEvent::Char) + return true; +#else + if (event.type() == PlatformKeyboardEvent::KeyDown) + return true; +#endif + return false; +} + bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) { if (event.type() == PlatformKeyboardEvent::KeyUp) @@ -641,7 +657,8 @@ bool PopupListBox::handleKeyEvent(const PlatformKeyboardEvent& event) break; default: if (!event.ctrlKey() && !event.altKey() && !event.metaKey() - && isPrintableChar(event.windowsVirtualKeyCode())) + && isPrintableChar(event.windowsVirtualKeyCode()) + && isCharacterTypeEvent(event)) typeAheadFind(event); break; } @@ -690,21 +707,6 @@ static String stripLeadingWhiteSpace(const String& string) return string.substring(i, length - i); } -static bool isCharacterTypeEvent(const PlatformKeyboardEvent& event) { - // Check whether the event is a character-typed event or not. - // In Windows, PlatformKeyboardEvent::Char (not RawKeyDown) type event - // is considered as character type event. In Mac OS, KeyDown (not - // KeyUp) is considered as character type event. -#if PLATFORM(WIN_OS) - if (event.type() == PlatformKeyboardEvent::Char) - return true; -#else - if (event.type() == PlatformKeyboardEvent::KeyDown) - return true; -#endif - return false; -} - // From HTMLSelectElement.cpp, with modifications void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) { @@ -714,8 +716,7 @@ void PopupListBox::typeAheadFind(const PlatformKeyboardEvent& event) // Reset the time when user types in a character. The time gap between // last character and the current character is used to indicate whether // user typed in a string or just a character as the search prefix. - if (isCharacterTypeEvent(event)) - m_lastCharTime = now; + m_lastCharTime = now; UChar c = event.windowsVirtualKeyCode(); diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h index 807c11b..6a7c02c 100644 --- a/WebCore/platform/graphics/BitmapImage.h +++ b/WebCore/platform/graphics/BitmapImage.h @@ -45,6 +45,10 @@ class NSImage; typedef struct HBITMAP__ *HBITMAP; #endif +#if PLATFORM(HAIKU) +class BBitmap; +#endif + namespace WebCore { struct FrameData; } @@ -165,10 +169,16 @@ protected: virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator); #endif virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator); + #if PLATFORM(WX) || PLATFORM(WINCE) virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect); -#endif +#endif + +#if PLATFORM(HAIKU) + virtual BBitmap* getBBitmap() const; +#endif + size_t currentFrame() const { return m_currentFrame; } size_t frameCount(); NativeImagePtr frameAtIndex(size_t); diff --git a/WebCore/platform/graphics/Color.h b/WebCore/platform/graphics/Color.h index 5baa56e..8e51b95 100644 --- a/WebCore/platform/graphics/Color.h +++ b/WebCore/platform/graphics/Color.h @@ -47,6 +47,10 @@ typedef struct _GdkColor GdkColor; class wxColour; #endif +#if PLATFORM(HAIKU) +struct rgb_color; +#endif + namespace WebCore { class String; @@ -121,6 +125,11 @@ public: Color(CGColorRef); #endif +#if PLATFORM(HAIKU) + Color(const rgb_color&); + operator rgb_color() const; +#endif + static bool parseHexColor(const String& name, RGBA32& rgb); static const RGBA32 black = 0xFF000000; diff --git a/WebCore/platform/graphics/FloatPoint.h b/WebCore/platform/graphics/FloatPoint.h index 0c97c49..a239173 100644 --- a/WebCore/platform/graphics/FloatPoint.h +++ b/WebCore/platform/graphics/FloatPoint.h @@ -51,6 +51,10 @@ class QPointF; QT_END_NAMESPACE #endif +#if PLATFORM(HAIKU) +class BPoint; +#endif + #if PLATFORM(SKIA) struct SkPoint; #endif @@ -90,6 +94,11 @@ public: operator QPointF() const; #endif +#if PLATFORM(HAIKU) + FloatPoint(const BPoint&); + operator BPoint() const; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) operator SkPoint() const; FloatPoint(const SkPoint&); diff --git a/WebCore/platform/graphics/FloatRect.h b/WebCore/platform/graphics/FloatRect.h index e906812..7c7d32a 100644 --- a/WebCore/platform/graphics/FloatRect.h +++ b/WebCore/platform/graphics/FloatRect.h @@ -51,6 +51,10 @@ QT_END_NAMESPACE class wxRect2DDouble; #endif +#if PLATFORM(HAIKU) +class BRect; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) struct SkRect; #endif @@ -138,6 +142,11 @@ public: operator wxRect2DDouble() const; #endif +#if PLATFORM(HAIKU) + FloatRect(const BRect&); + operator BRect() const; +#endif + #if (PLATFORM(SKIA) || PLATFORM(SGL)) FloatRect(const SkRect&); operator SkRect() const; diff --git a/WebCore/platform/graphics/FontDescription.h b/WebCore/platform/graphics/FontDescription.h index c893b8a..e5c52bf 100644 --- a/WebCore/platform/graphics/FontDescription.h +++ b/WebCore/platform/graphics/FontDescription.h @@ -80,6 +80,8 @@ public: FontWeight bolderWeight() const; GenericFamilyType genericFamily() const { return static_cast<GenericFamilyType>(m_genericFamily); } bool usePrinterFont() const { return m_usePrinterFont; } + // only use fixed default size when there is only one font family, and that family is "monospace" + bool useFixedDefaultSize() const { return genericFamily() == MonospaceFamily && !family().next() && family().family() == "-webkit-monospace"; } FontRenderingMode renderingMode() const { return static_cast<FontRenderingMode>(m_renderingMode); } unsigned keywordSize() const { return m_keywordSize; } diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp index a4e8408..ccdce08 100644 --- a/WebCore/platform/graphics/GraphicsContext.cpp +++ b/WebCore/platform/graphics/GraphicsContext.cpp @@ -27,9 +27,9 @@ #include "GraphicsContext.h" #include "BidiResolver.h" +#include "Font.h" #include "Generator.h" #include "GraphicsContextPrivate.h" -#include "Font.h" using namespace std; @@ -89,7 +89,7 @@ void GraphicsContext::save() return; m_common->stack.append(m_common->state); - + savePlatformState(); } @@ -104,7 +104,7 @@ void GraphicsContext::restore() } m_common->state = m_common->stack.last(); m_common->stack.removeLast(); - + restorePlatformState(); } @@ -305,7 +305,7 @@ bool GraphicsContext::paintingDisabled() const } void GraphicsContext::drawImage(Image* image, const IntPoint& p, CompositeOperator op) -{ +{ drawImage(image, p, IntRect(0, 0, -1, -1), op); } @@ -329,7 +329,7 @@ void GraphicsContext::drawText(const Font& font, const TextRun& run, const IntPo { if (paintingDisabled()) return; - + font.drawText(this, run, point, from, to); } #endif @@ -383,7 +383,7 @@ void GraphicsContext::initFocusRing(int width, int offset) if (paintingDisabled()) return; clearFocusRing(); - + m_common->m_focusRingWidth = width; m_common->m_focusRingOffset = offset; } @@ -396,12 +396,12 @@ void GraphicsContext::clearFocusRing() IntRect GraphicsContext::focusRingBoundingRect() { IntRect result = IntRect(0, 0, 0, 0); - + const Vector<IntRect>& rects = focusRingRects(); unsigned rectCount = rects.size(); for (unsigned i = 0; i < rectCount; i++) result.unite(rects[i]); - + return result; } @@ -436,7 +436,7 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float float tsh = src.height(); float tw = dest.width(); float th = dest.height(); - + if (tsw == -1) tsw = image->width(); if (tsh == -1) @@ -540,10 +540,39 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode) } #endif -#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) +#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) && !PLATFORM(HAIKU) void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle&) { } #endif +void GraphicsContext::adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle& penStyle) +{ + // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic + // works out. For example, with a border width of 3, WebKit will pass us (y1+y2)/2, e.g., + // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave + // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. + if (penStyle == DottedStroke || penStyle == DashedStroke) { + if (p1.x() == p2.x()) { + p1.setY(p1.y() + strokeWidth); + p2.setY(p2.y() - strokeWidth); + } else { + p1.setX(p1.x() + strokeWidth); + p2.setX(p2.x() - strokeWidth); + } + } + + if (static_cast<int>(strokeWidth) % 2) { //odd + if (p1.x() == p2.x()) { + // We're a vertical line. Adjust our x. + p1.setX(p1.x() + 0.5f); + p2.setX(p2.x() + 0.5f); + } else { + // We're a horizontal line. Adjust our y. + p1.setY(p1.y() + 0.5f); + p2.setY(p2.y() + 0.5f); + } + } +} + } diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h index b52344d..02914b0 100644 --- a/WebCore/platform/graphics/GraphicsContext.h +++ b/WebCore/platform/graphics/GraphicsContext.h @@ -55,8 +55,8 @@ struct SkPoint; class wxGCDC; class wxWindowDC; -// wxGraphicsContext allows us to support Path, etc. -// but on some platforms, e.g. Linux, it requires fairly +// wxGraphicsContext allows us to support Path, etc. +// but on some platforms, e.g. Linux, it requires fairly // new software. #if USE(WXGC) // On OS X, wxGCDC is just a typedef for wxDC, so use wxDC explicitly to make @@ -72,6 +72,10 @@ class wxWindowDC; #endif #elif PLATFORM(SKIA) typedef class PlatformContextSkia PlatformGraphicsContext; +#elif PLATFORM(HAIKU) +class BView; +typedef BView PlatformGraphicsContext; +struct pattern; #elif PLATFORM(WINCE) typedef struct HDC__ PlatformGraphicsContext; #else @@ -124,7 +128,7 @@ namespace WebCore { const int cTextFill = 1; const int cTextStroke = 2; const int cTextClip = 4; - + enum StrokeStyle { NoStroke, SolidStroke, @@ -132,12 +136,12 @@ namespace WebCore { DashedStroke }; -// FIXME: This is a place-holder until we decide to add -// real color space support to WebCore. At that time, ColorSpace will be a -// class and instances will be held off of Colors. There will be -// special singleton Gradient and Pattern color spaces to mark when -// a fill or stroke is using a gradient or pattern instead of a solid color. -// https://bugs.webkit.org/show_bug.cgi?id=20558 + // FIXME: This is a place-holder until we decide to add + // real color space support to WebCore. At that time, ColorSpace will be a + // class and instances will be held off of Colors. There will be + // special singleton Gradient and Pattern color spaces to mark when + // a fill or stroke is using a gradient or pattern instead of a solid color. + // https://bugs.webkit.org/show_bug.cgi?id=20558 enum ColorSpace { SolidColorSpace, PatternColorSpace, @@ -156,11 +160,11 @@ namespace WebCore { public: GraphicsContext(PlatformGraphicsContext*); ~GraphicsContext(); - + #if !PLATFORM(WINCE) || PLATFORM(QT) PlatformGraphicsContext* platformContext() const; #endif - + float strokeThickness() const; void setStrokeThickness(float); StrokeStyle strokeStyle() const; @@ -265,7 +269,7 @@ namespace WebCore { CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false); void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator = CompositeSourceOver); - void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, + void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect, Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile, CompositeOperator = CompositeSourceOver); @@ -289,13 +293,13 @@ namespace WebCore { void drawHighlightForText(const Font&, const TextRun&, const IntPoint&, int h, const Color& backgroundColor, int from = 0, int to = -1); FloatRect roundToDevicePixels(const FloatRect&); - + void drawLineForText(const IntPoint&, int width, bool printing); void drawLineForMisspellingOrBadGrammar(const IntPoint&, int width, bool grammar); - + bool paintingDisabled() const; void setPaintingDisabled(bool); - + bool updatingControlTints() const; void setUpdatingControlTints(bool); @@ -334,7 +338,7 @@ namespace WebCore { void rotate(float angleInRadians); void translate(float x, float y); IntPoint origin(); - + void setURLForRect(const KURL&, const IntRect&); void concatCTM(const TransformationMatrix&); @@ -416,6 +420,10 @@ namespace WebCore { GdkEventExpose* gdkExposeEvent() const; #endif +#if PLATFORM(HAIKU) + pattern getHaikuStrokeStyle(); +#endif + private: void savePlatformState(); void restorePlatformState(); @@ -438,6 +446,8 @@ namespace WebCore { void setPlatformShadow(const IntSize&, int blur, const Color&); void clearPlatformShadow(); + static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, const StrokeStyle&); + int focusRingWidth() const; int focusRingOffset() const; const Vector<IntRect>& focusRingRects() const; diff --git a/WebCore/platform/graphics/GraphicsLayer.cpp b/WebCore/platform/graphics/GraphicsLayer.cpp index 7d43832..b375bd3 100644 --- a/WebCore/platform/graphics/GraphicsLayer.cpp +++ b/WebCore/platform/graphics/GraphicsLayer.cpp @@ -69,10 +69,11 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) , m_usingTiledLayer(false) , m_masksToBounds(false) , m_drawsContent(false) - , m_paintingPhase(GraphicsLayerPaintAllMask) + , m_paintingPhase(GraphicsLayerPaintAll) , m_geometryOrientation(CompositingCoordinatesTopDown) , m_contentsOrientation(CompositingCoordinatesTopDown) , m_parent(0) + , m_maskLayer(0) #ifndef NDEBUG , m_repaintCount(0) #endif diff --git a/WebCore/platform/graphics/GraphicsLayer.h b/WebCore/platform/graphics/GraphicsLayer.h index 4d7668a..d3e5fb1 100644 --- a/WebCore/platform/graphics/GraphicsLayer.h +++ b/WebCore/platform/graphics/GraphicsLayer.h @@ -38,6 +38,7 @@ #include "TransformationMatrix.h" #include "TransformOperations.h" #include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #if PLATFORM(MAC) #ifdef __OBJC__ @@ -152,7 +153,7 @@ protected: class GraphicsLayer { public: - static GraphicsLayer* createGraphicsLayer(GraphicsLayerClient*); + static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*); virtual ~GraphicsLayer(); @@ -180,6 +181,9 @@ public: void removeAllChildren(); virtual void removeFromParent(); + GraphicsLayer* maskLayer() const { return m_maskLayer; } + virtual void setMaskLayer(GraphicsLayer* layer) { m_maskLayer = layer; } + // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative). IntSize offsetFromRenderer() const { return m_offsetFromRenderer; } void setOffsetFromRenderer(const IntSize& offset) { m_offsetFromRenderer = offset; } @@ -229,8 +233,8 @@ public: virtual void setOpacity(float opacity) { m_opacity = opacity; } // Some GraphicsLayers paint only the foreground or the background content - GraphicsLayerPaintingPhase drawingPhase() const { return m_paintingPhase; } - void setDrawingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; } + GraphicsLayerPaintingPhase paintingPhase() const { return m_paintingPhase; } + void setPaintingPhase(GraphicsLayerPaintingPhase phase) { m_paintingPhase = phase; } virtual void setNeedsDisplay() = 0; // mark the given rect (in layer coords) as needing dispay. Never goes deep. @@ -347,6 +351,8 @@ protected: Vector<GraphicsLayer*> m_children; GraphicsLayer* m_parent; + GraphicsLayer* m_maskLayer; // Reference to mask layer. We don't own this. + IntRect m_contentsRect; #ifndef NDEBUG diff --git a/WebCore/platform/graphics/GraphicsLayerClient.h b/WebCore/platform/graphics/GraphicsLayerClient.h index 8c0b7ed..5facc94 100644 --- a/WebCore/platform/graphics/GraphicsLayerClient.h +++ b/WebCore/platform/graphics/GraphicsLayerClient.h @@ -37,9 +37,10 @@ class IntRect; class FloatPoint; enum GraphicsLayerPaintingPhase { - GraphicsLayerPaintBackgroundMask = (1 << 0), - GraphicsLayerPaintForegroundMask = (1 << 1), - GraphicsLayerPaintAllMask = (GraphicsLayerPaintBackgroundMask | GraphicsLayerPaintForegroundMask) + GraphicsLayerPaintBackground = (1 << 0), + GraphicsLayerPaintForeground = (1 << 1), + GraphicsLayerPaintMask = (1 << 2), + GraphicsLayerPaintAll = (GraphicsLayerPaintBackground | GraphicsLayerPaintForeground | GraphicsLayerPaintMask) }; enum AnimatedPropertyID { diff --git a/WebCore/platform/graphics/Icon.h b/WebCore/platform/graphics/Icon.h index 444c67c..8650130 100644 --- a/WebCore/platform/graphics/Icon.h +++ b/WebCore/platform/graphics/Icon.h @@ -78,6 +78,8 @@ private: #elif PLATFORM(CHROMIUM) Icon(const PlatformIcon&); PlatformIcon m_icon; +#elif PLATFORM(HAIKU) + Icon(); #endif }; diff --git a/WebCore/platform/graphics/ImageBuffer.h b/WebCore/platform/graphics/ImageBuffer.h index 2a96d3b..9432058 100644 --- a/WebCore/platform/graphics/ImageBuffer.h +++ b/WebCore/platform/graphics/ImageBuffer.h @@ -50,6 +50,11 @@ namespace WebCore { LinearRGB }; + enum Multiply { + Premultiplied, + Unmultiplied + }; + class ImageBuffer : public Noncopyable { public: // Will return a null pointer on allocation failure. @@ -71,8 +76,11 @@ namespace WebCore { void clearImage() { m_image.clear(); } - PassRefPtr<ImageData> getImageData(const IntRect& rect) const; - void putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint); + PassRefPtr<ImageData> getUnmultipliedImageData(const IntRect&) const; + PassRefPtr<ImageData> getPremultipliedImageData(const IntRect&) const; + + void putUnmultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); + void putPremultipliedImageData(ImageData*, const IntRect& sourceRect, const IntPoint& destPoint); String toDataURL(const String& mimeType) const; #if !PLATFORM(CG) diff --git a/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp b/WebCore/platform/graphics/ImageSource.cpp index df62618..3bea57f 100644 --- a/WebCore/platform/graphics/cairo/ImageSourceCairo.cpp +++ b/WebCore/platform/graphics/ImageSource.cpp @@ -1,6 +1,8 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * Copyright (C) 2007 Alp Toker <alp.toker@collabora.co.uk> + * Copyright (C) 2008, Google Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, Inc * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,16 +29,19 @@ #include "config.h" #include "ImageSource.h" -#if PLATFORM(CAIRO) - #include "BMPImageDecoder.h" #include "GIFImageDecoder.h" #include "ICOImageDecoder.h" #include "JPEGImageDecoder.h" #include "PNGImageDecoder.h" -#include "XBMImageDecoder.h" #include "SharedBuffer.h" -#include <cairo.h> +#include "XBMImageDecoder.h" + +#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 +#endif namespace WebCore { @@ -120,21 +125,21 @@ void ImageSource::setData(SharedBuffer* data, bool allDataReceived) // This method will examine the data and instantiate an instance of the appropriate decoder plugin. // If insufficient bytes are available to determine the image type, no decoder plugin will be // made. - if (!m_decoder) + if (!m_decoder) { m_decoder = createDecoder(data->buffer()); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_decoder) + m_decoder->setMaxNumPixels(IMAGE_DECODER_DOWN_SAMPLING_MAX_NUMBER_OF_PIXELS); +#endif + } - if (!m_decoder) - return; - - m_decoder->setData(data, allDataReceived); + if (m_decoder) + m_decoder->setData(data, allDataReceived); } String ImageSource::filenameExtension() const { - if (!m_decoder) - return String(); - - return m_decoder->filenameExtension(); + return m_decoder ? m_decoder->filenameExtension() : String(); } bool ImageSource::isSizeAvailable() @@ -176,9 +181,6 @@ size_t ImageSource::frameCount() const NativeImagePtr ImageSource::createFrameAtIndex(size_t index) { - if (!initialized()) - return 0; - if (!m_decoder) return 0; @@ -186,11 +188,13 @@ NativeImagePtr ImageSource::createFrameAtIndex(size_t index) if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) return 0; - // Cairo does not like zero height images. - // If we have a zero height image, just pretend we don't have enough data yet. - if (!size().height()) + // Zero-height images can cause problems for some ports. If we have an + // empty image dimension, just bail. + if (size().isEmpty()) return 0; + // Return the buffer contents as a native image. For some ports, the data + // is already in a native container, and this just increments its refcount. return buffer->asNewNativeImage(); } @@ -223,17 +227,14 @@ float ImageSource::frameDurationAtIndex(size_t index) bool ImageSource::frameHasAlphaAtIndex(size_t index) { - // When a frame has not finished decoding, always mark it as having alpha, - // so we don't get a black background for the undecoded sections. - // TODO: A better solution is probably to have the underlying buffer's - // hasAlpha() return true in these cases, since it is, in fact, technically - // true. - if (!frameIsCompleteAtIndex(index)) - return true; - - return m_decoder->frameBufferAtIndex(index)->hasAlpha(); + // When a frame has not finished decoding, always mark it as having alpha. + // Ports that check the result of this function to determine their + // compositing op need this in order to not draw the undecoded portion as + // black. + // TODO: Perhaps we should ensure that each individual decoder returns true + // in this case. + return frameIsCompleteAtIndex(index) ? + m_decoder->frameBufferAtIndex(index)->hasAlpha() : true; } } - -#endif // PLATFORM(CAIRO) diff --git a/WebCore/platform/graphics/ImageSource.h b/WebCore/platform/graphics/ImageSource.h index 173d50b..dee3eda 100644 --- a/WebCore/platform/graphics/ImageSource.h +++ b/WebCore/platform/graphics/ImageSource.h @@ -51,6 +51,8 @@ class SkBitmapRef; class PrivateAndroidImageSourceRec; #elif PLATFORM(SKIA) class NativeImageSkia; +#elif PLATFORM(HAIKU) +class BBitmap; #elif PLATFORM(WINCE) #include "SharedBitmap.h" #endif @@ -105,6 +107,10 @@ typedef cairo_surface_t* NativeImagePtr; class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; typedef NativeImageSkia* NativeImagePtr; +#elif PLATFORM(HAIKU) +class ImageDecoder; +typedef ImageDecoder* NativeImageSourcePtr; +typedef BBitmap* NativeImagePtr; #elif PLATFORM(WINCE) class ImageDecoder; typedef ImageDecoder* NativeImageSourcePtr; diff --git a/WebCore/platform/graphics/IntPoint.h b/WebCore/platform/graphics/IntPoint.h index e6d4816..afbfb46 100644 --- a/WebCore/platform/graphics/IntPoint.h +++ b/WebCore/platform/graphics/IntPoint.h @@ -55,6 +55,8 @@ class QPoint; QT_END_NAMESPACE #elif PLATFORM(GTK) typedef struct _GdkPoint GdkPoint; +#elif PLATFORM(HAIKU) +class BPoint; #endif #if PLATFORM(WX) @@ -121,6 +123,9 @@ public: #elif PLATFORM(GTK) IntPoint(const GdkPoint&); operator GdkPoint() const; +#elif PLATFORM(HAIKU) + explicit IntPoint(const BPoint&); + operator BPoint() const; #endif #if PLATFORM(WX) diff --git a/WebCore/platform/graphics/IntRect.h b/WebCore/platform/graphics/IntRect.h index 0b607f5..c5a12cb 100644 --- a/WebCore/platform/graphics/IntRect.h +++ b/WebCore/platform/graphics/IntRect.h @@ -49,6 +49,8 @@ class QRect; QT_END_NAMESPACE #elif PLATFORM(GTK) typedef struct _GdkRectangle GdkRectangle; +#elif PLATFORM(HAIKU) +class BRect; #endif #if PLATFORM(WX) @@ -144,6 +146,9 @@ public: #elif PLATFORM(GTK) IntRect(const GdkRectangle&); operator GdkRectangle() const; +#elif PLATFORM(HAIKU) + explicit IntRect(const BRect&); + operator BRect() const; #endif #if PLATFORM(CG) diff --git a/WebCore/platform/graphics/IntSize.h b/WebCore/platform/graphics/IntSize.h index dc7a85d..e80b0fa 100644 --- a/WebCore/platform/graphics/IntSize.h +++ b/WebCore/platform/graphics/IntSize.h @@ -47,6 +47,8 @@ typedef struct tagSIZE SIZE; QT_BEGIN_NAMESPACE class QSize; QT_END_NAMESPACE +#elif PLATFORM(HAIKU) +class BSize; #endif namespace WebCore { @@ -113,6 +115,11 @@ public: operator QSize() const; #endif +#if PLATFORM(HAIKU) + explicit IntSize(const BSize&); + operator BSize() const; +#endif + private: int m_width, m_height; diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h index da324bc..6b617a0 100644 --- a/WebCore/platform/graphics/Path.h +++ b/WebCore/platform/graphics/Path.h @@ -52,6 +52,9 @@ typedef WebCore::CairoPath PlatformPath; #elif PLATFORM(SKIA) class SkPath; typedef SkPath PlatformPath; +#elif PLATFORM(HAIKU) +class BRegion; +typedef BRegion PlatformPath; #elif PLATFORM(WINCE) namespace WebCore { class PlatformPath; diff --git a/WebCore/platform/graphics/Pattern.h b/WebCore/platform/graphics/Pattern.h index 02ad3ec..2f1192c 100644 --- a/WebCore/platform/graphics/Pattern.h +++ b/WebCore/platform/graphics/Pattern.h @@ -53,6 +53,9 @@ typedef wxGraphicsBrush* PlatformPatternPtr; class wxBrush; typedef wxBrush* PlatformPatternPtr; #endif // USE(WXGC) +#elif PLATFORM(HAIKU) +#include <interface/GraphicsDefs.h> +typedef pattern* PlatformPatternPtr; #elif PLATFORM(WINCE) typedef void* PlatformPatternPtr; #endif diff --git a/WebCore/platform/graphics/SimpleFontData.h b/WebCore/platform/graphics/SimpleFontData.h index cb472b0..8cb8268 100644 --- a/WebCore/platform/graphics/SimpleFontData.h +++ b/WebCore/platform/graphics/SimpleFontData.h @@ -45,6 +45,10 @@ typedef struct OpaqueATSUStyle* ATSUStyle; #include <QFont> #endif +#if PLATFORM(HAIKU) +#include <Font.h> +#endif + namespace WebCore { class FontDescription; diff --git a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 5765546..de8afb3 100644 --- a/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -31,7 +31,6 @@ #if PLATFORM(CAIRO) -#include "TransformationMatrix.h" #include "CairoPath.h" #include "FloatRect.h" #include "Font.h" @@ -41,6 +40,7 @@ #include "Path.h" #include "Pattern.h" #include "SimpleFontData.h" +#include "TransformationMatrix.h" #include <cairo.h> #include <math.h> @@ -53,8 +53,8 @@ #elif PLATFORM(WIN) #include <cairo-win32.h> #endif -#include "GraphicsContextPrivate.h" #include "GraphicsContextPlatformPrivateCairo.h" +#include "GraphicsContextPrivate.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -142,38 +142,6 @@ void GraphicsContext::drawRect(const IntRect& rect) cairo_restore(cr); } -// FIXME: Now that this is refactored, it should be shared by all contexts. -static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, StrokeStyle style) -{ - // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic - // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g., - // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave - // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. - if (style == DottedStroke || style == DashedStroke) { - if (p1.x() == p2.x()) { - p1.setY(p1.y() + strokeWidth); - p2.setY(p2.y() - strokeWidth); - } - else { - p1.setX(p1.x() + strokeWidth); - p2.setX(p2.x() - strokeWidth); - } - } - - if (static_cast<int>(strokeWidth) % 2) { - if (p1.x() == p2.x()) { - // We're a vertical line. Adjust our x. - p1.setX(p1.x() + 0.5); - p2.setX(p2.x() + 0.5); - } - else { - // We're a horizontal line. Adjust our y. - p1.setY(p1.y() + 0.5); - p2.setY(p2.y() + 0.5); - } - } -} - // This is only used to draw borders. void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { @@ -239,20 +207,18 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0; else { - bool evenNumberOfSegments = numSegments%2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { if (remainder) { patternOffset += patWidth - remainder; - patternOffset += remainder/2; - } - else - patternOffset = patWidth/2; - } - else if (!evenNumberOfSegments) { + patternOffset += remainder / 2; + } else + patternOffset = patWidth / 2; + } else if (!evenNumberOfSegments) { if (remainder) - patternOffset = (patWidth - remainder)/2; + patternOffset = (patWidth - remainder) / 2; } } @@ -318,7 +284,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (w != h) cairo_scale(cr, 1., scaleFactor); - + cairo_arc_negative(cr, x + hRadius, (y + vRadius) * reverseScaleFactor, hRadius, -fa * M_PI/180, -falen * M_PI/180); if (w != h) @@ -326,16 +292,16 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp float width = strokeThickness(); int patWidth = 0; - + switch (strokeStyle()) { - case DottedStroke: - patWidth = static_cast<int>(width / 2); - break; - case DashedStroke: - patWidth = 3 * static_cast<int>(width / 2); - break; - default: - break; + case DottedStroke: + patWidth = static_cast<int>(width / 2); + break; + case DashedStroke: + patWidth = 3 * static_cast<int>(width / 2); + break; + default: + break; } setColor(cr, strokeColor()); @@ -349,7 +315,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp distance = static_cast<int>((M_PI * hRadius) / 2.0); else // We are elliptical and will have to estimate the distance distance = static_cast<int>((M_PI * sqrtf((hRadius * hRadius + vRadius * vRadius) / 2.0)) / 2.0); - + int remainder = distance % patWidth; int coverage = distance - remainder; int numSegments = coverage / patWidth; @@ -359,7 +325,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (patWidth == 1) patternOffset = 1.0; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -828,15 +794,15 @@ void GraphicsContext::setLineCap(LineCap lineCap) cairo_line_cap_t cairoCap = CAIRO_LINE_CAP_BUTT; switch (lineCap) { - case ButtCap: - // no-op - break; - case RoundCap: - cairoCap = CAIRO_LINE_CAP_ROUND; - break; - case SquareCap: - cairoCap = CAIRO_LINE_CAP_SQUARE; - break; + case ButtCap: + // no-op + break; + case RoundCap: + cairoCap = CAIRO_LINE_CAP_ROUND; + break; + case SquareCap: + cairoCap = CAIRO_LINE_CAP_SQUARE; + break; } cairo_set_line_cap(m_data->cr, cairoCap); } @@ -853,15 +819,15 @@ void GraphicsContext::setLineJoin(LineJoin lineJoin) cairo_line_join_t cairoJoin = CAIRO_LINE_JOIN_MITER; switch (lineJoin) { - case MiterJoin: - // no-op - break; - case RoundJoin: - cairoJoin = CAIRO_LINE_JOIN_ROUND; - break; - case BevelJoin: - cairoJoin = CAIRO_LINE_JOIN_BEVEL; - break; + case MiterJoin: + // no-op + break; + case RoundJoin: + cairoJoin = CAIRO_LINE_JOIN_ROUND; + break; + case BevelJoin: + cairoJoin = CAIRO_LINE_JOIN_BEVEL; + break; } cairo_set_line_join(m_data->cr, cairoJoin); } @@ -887,37 +853,37 @@ float GraphicsContext::getAlpha() static inline cairo_operator_t toCairoOperator(CompositeOperator op) { switch (op) { - case CompositeClear: - return CAIRO_OPERATOR_CLEAR; - case CompositeCopy: - return CAIRO_OPERATOR_SOURCE; - case CompositeSourceOver: - return CAIRO_OPERATOR_OVER; - case CompositeSourceIn: - return CAIRO_OPERATOR_IN; - case CompositeSourceOut: - return CAIRO_OPERATOR_OUT; - case CompositeSourceAtop: - return CAIRO_OPERATOR_ATOP; - case CompositeDestinationOver: - return CAIRO_OPERATOR_DEST_OVER; - case CompositeDestinationIn: - return CAIRO_OPERATOR_DEST_IN; - case CompositeDestinationOut: - return CAIRO_OPERATOR_DEST_OUT; - case CompositeDestinationAtop: - return CAIRO_OPERATOR_DEST_ATOP; - case CompositeXOR: - return CAIRO_OPERATOR_XOR; - case CompositePlusDarker: - return CAIRO_OPERATOR_SATURATE; - case CompositeHighlight: - // There is no Cairo equivalent for CompositeHighlight. - return CAIRO_OPERATOR_OVER; - case CompositePlusLighter: - return CAIRO_OPERATOR_ADD; - default: - return CAIRO_OPERATOR_SOURCE; + case CompositeClear: + return CAIRO_OPERATOR_CLEAR; + case CompositeCopy: + return CAIRO_OPERATOR_SOURCE; + case CompositeSourceOver: + return CAIRO_OPERATOR_OVER; + case CompositeSourceIn: + return CAIRO_OPERATOR_IN; + case CompositeSourceOut: + return CAIRO_OPERATOR_OUT; + case CompositeSourceAtop: + return CAIRO_OPERATOR_ATOP; + case CompositeDestinationOver: + return CAIRO_OPERATOR_DEST_OVER; + case CompositeDestinationIn: + return CAIRO_OPERATOR_DEST_IN; + case CompositeDestinationOut: + return CAIRO_OPERATOR_DEST_OUT; + case CompositeDestinationAtop: + return CAIRO_OPERATOR_DEST_ATOP; + case CompositeXOR: + return CAIRO_OPERATOR_XOR; + case CompositePlusDarker: + return CAIRO_OPERATOR_SATURATE; + case CompositeHighlight: + // There is no Cairo equivalent for CompositeHighlight. + return CAIRO_OPERATOR_OVER; + case CompositePlusLighter: + return CAIRO_OPERATOR_ADD; + default: + return CAIRO_OPERATOR_SOURCE; } } diff --git a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index c905ee8..0213944 100644 --- a/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -138,16 +138,17 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) } } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& data, const IntSize& size) { - ASSERT(cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + ASSERT(cairo_surface_get_type(data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); - unsigned char* dataSrc = cairo_image_surface_get_data(m_data.m_surface); + unsigned char* dataSrc = cairo_image_surface_get_data(data.m_surface); unsigned char* dataDst = result->data()->data()->data(); - if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > m_size.width() || (rect.y() + rect.height()) > m_size.height()) - memset(dataSrc, 0, result->data()->length()); + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) + memset(dataDst, 0, result->data()->length()); int originx = rect.x(); int destx = 0; @@ -156,8 +157,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -167,11 +168,11 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - int stride = cairo_image_surface_get_stride(m_data.m_surface); + int stride = cairo_image_surface_get_stride(data.m_surface); unsigned destBytesPerRow = 4 * rect.width(); unsigned char* destRows = dataDst + desty * destBytesPerRow + destx * 4; @@ -180,7 +181,11 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const for (int x = 0; x < numColumns; x++) { int basex = x * 4; unsigned* pixel = row + x + originx; - Color pixelColor = colorFromPremultipliedARGB(*pixel); + Color pixelColor; + if (multiplied == Unmultiplied) + pixelColor = colorFromPremultipliedARGB(*pixel); + else + pixelColor = Color(*pixel); destRows[basex] = pixelColor.red(); destRows[basex + 1] = pixelColor.green(); destRows[basex + 2] = pixelColor.blue(); @@ -192,11 +197,22 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { - ASSERT(cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + return getImageData<Unmultiplied>(rect, m_data, m_size); +} - unsigned char* dataDst = cairo_image_surface_get_data(m_data.m_surface); +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) +{ + ASSERT(cairo_surface_get_type(data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + + unsigned char* dataDst = cairo_image_surface_get_data(data.m_surface); ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -204,28 +220,28 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= size.width()); int numColumns = endx - destx; int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); - ASSERT(desty < m_size.height()); + ASSERT(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - int stride = cairo_image_surface_get_stride(m_data.m_surface); + int stride = cairo_image_surface_get_stride(data.m_surface); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; for (int y = 0; y < numRows; ++y) { @@ -237,12 +253,25 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con srcRows[basex + 1], srcRows[basex + 2], srcRows[basex + 3]); - *pixel = premultipliedARGBFromColor(pixelColor); + if (multiplied == Unmultiplied) + *pixel = premultipliedARGBFromColor(pixelColor); + else + *pixel = pixelColor.rgb(); } srcRows += srcBytesPerRow; } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) { Vector<char>* in = reinterpret_cast<Vector<char>*>(closure); diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index ab8eb3c..f1e6a1f 100644 --- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -28,14 +28,15 @@ #include "config.h" #include "GraphicsContext.h" -#include "TransformationMatrix.h" #include "FloatConversion.h" -#include "GraphicsContextPrivate.h" #include "GraphicsContextPlatformPrivateCG.h" +#include "GraphicsContextPrivate.h" #include "ImageBuffer.h" #include "KURL.h" #include "Path.h" #include "Pattern.h" +#include "TransformationMatrix.h" + #include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGPDFContext.h> #include <wtf/MathExtras.h> @@ -178,19 +179,19 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) int patWidth = 0; switch (strokeStyle()) { - case NoStroke: - case SolidStroke: - break; - case DottedStroke: - patWidth = (int)width; - break; - case DashedStroke: - patWidth = 3 * (int)width; - break; + case NoStroke: + case SolidStroke: + break; + case DottedStroke: + patWidth = (int)width; + break; + case DashedStroke: + patWidth = 3 * (int)width; + break; } CGContextRef context = platformContext(); - + if (shouldAntialias()) CGContextSetShouldAntialias(context, false); @@ -221,7 +222,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -235,7 +236,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) patternOffset = (patWidth - remainder)/2; } } - + const CGFloat dottedLine[2] = { patWidth, patWidth }; CGContextSetLineDash(context, patternOffset, dottedLine, 2); } @@ -248,7 +249,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth) CGContextRestoreGState(context); - + if (shouldAntialias()) CGContextSetShouldAntialias(context, true); } @@ -263,7 +264,7 @@ void GraphicsContext::drawEllipse(const IntRect& rect) if (paintingDisabled()) return; - + CGContextRef context = platformContext(); CGContextBeginPath(context); float r = (float)rect.width() / 2; @@ -275,25 +276,25 @@ void GraphicsContext::drawEllipse(const IntRect& rect) void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) -{ +{ if (paintingDisabled() || strokeStyle() == NoStroke || strokeThickness() <= 0.0f) return; - + CGContextRef context = platformContext(); CGContextSaveGState(context); CGContextBeginPath(context); CGContextSetShouldAntialias(context, false); - + int x = rect.x(); int y = rect.y(); float w = (float)rect.width(); float h = (float)rect.height(); float scaleFactor = h / w; float reverseScaleFactor = w / h; - + if (w != h) scale(FloatSize(1, scaleFactor)); - + float hRadius = w / 2; float vRadius = h / 2; float fa = startAngle; @@ -304,22 +305,21 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (w != h) scale(FloatSize(1, reverseScaleFactor)); - - + float width = strokeThickness(); int patWidth = 0; - + switch (strokeStyle()) { - case DottedStroke: - patWidth = (int)(width / 2); - break; - case DashedStroke: - patWidth = 3 * (int)(width / 2); - break; - default: - break; + case DottedStroke: + patWidth = (int)(width / 2); + break; + case DashedStroke: + patWidth = 3 * (int)(width / 2); + break; + default: + break; } - + if (patWidth) { // Example: 80 pixels with a width of 30 pixels. // Remainder is 20. The maximum pixels of line we could paint @@ -329,7 +329,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp distance = static_cast<int>((piFloat * hRadius) / 2.0f); else // We are elliptical and will have to estimate the distance distance = static_cast<int>((piFloat * sqrtf((hRadius * hRadius + vRadius * vRadius) / 2.0f)) / 2.0f); - + int remainder = distance % patWidth; int coverage = distance - remainder; int numSegments = coverage / patWidth; @@ -339,7 +339,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -353,13 +353,13 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp patternOffset = (patWidth - remainder) / 2.0f; } } - + const CGFloat dottedLine[2] = { patWidth, patWidth }; CGContextSetLineDash(context, patternOffset, dottedLine, 2); } CGContextStrokePath(context); - + CGContextRestoreGState(context); } @@ -375,7 +375,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points if (antialiased != shouldAntialias()) CGContextSetShouldAntialias(context, antialiased); - + CGContextBeginPath(context); CGContextMoveToPoint(context, points[0].x(), points[0].y()); for (size_t i = 1; i < npoints; i++) @@ -383,7 +383,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points CGContextClosePath(context); drawPath(); - + if (antialiased != shouldAntialias()) CGContextSetShouldAntialias(context, shouldAntialias()); } @@ -391,7 +391,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points void GraphicsContext::applyStrokePattern() { CGContextRef cgContext = platformContext(); - + CGPatternRef platformPattern = m_common->state.strokePattern.get()->createPlatformPattern(getCTM()); if (!platformPattern) return; @@ -463,7 +463,7 @@ void GraphicsContext::drawPath() strokePath(); return; } - + if (state.fillColorSpace == PatternColorSpace) applyFillPattern(); if (state.strokeColorSpace == PatternColorSpace) @@ -599,7 +599,7 @@ void GraphicsContext::clipOut(const IntRect& rect) { if (paintingDisabled()) return; - + CGRect rects[2] = { CGContextGetClipBoundingBox(platformContext()), rect }; CGContextBeginPath(platformContext()); CGContextAddRects(platformContext(), rects, 2); @@ -610,7 +610,7 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) { if (paintingDisabled()) return; - + CGContextBeginPath(platformContext()); CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext())); CGContextAddEllipseInRect(platformContext(), rect); @@ -639,13 +639,13 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness clip(rect); CGContextRef context = platformContext(); - + // Add outer ellipse CGContextAddEllipseInRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); // Add inner ellipse. CGContextAddEllipseInRect(context, CGRectMake(rect.x() + thickness, rect.y() + thickness, rect.width() - (thickness * 2), rect.height() - (thickness * 2))); - + CGContextEOClip(context); } @@ -653,7 +653,7 @@ void GraphicsContext::clipToImageBuffer(const FloatRect& rect, const ImageBuffer { if (paintingDisabled()) return; - + CGContextTranslateCTM(platformContext(), rect.x(), rect.y() + rect.height()); CGContextScaleCTM(platformContext(), 1, -1); CGContextClipToMask(platformContext(), FloatRect(FloatPoint(), rect.size()), imageBuffer->image()->getCGImageRef()); @@ -734,7 +734,7 @@ void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Col CGColorRef colorCG = createCGColor(color); CGContextSetShadowWithColor(context, CGSizeMake(width, height), - blurRadius, + blurRadius, colorCG); CGColorRelease(colorCG); } @@ -799,15 +799,15 @@ void GraphicsContext::setLineCap(LineCap cap) if (paintingDisabled()) return; switch (cap) { - case ButtCap: - CGContextSetLineCap(platformContext(), kCGLineCapButt); - break; - case RoundCap: - CGContextSetLineCap(platformContext(), kCGLineCapRound); - break; - case SquareCap: - CGContextSetLineCap(platformContext(), kCGLineCapSquare); - break; + case ButtCap: + CGContextSetLineCap(platformContext(), kCGLineCapButt); + break; + case RoundCap: + CGContextSetLineCap(platformContext(), kCGLineCapRound); + break; + case SquareCap: + CGContextSetLineCap(platformContext(), kCGLineCapSquare); + break; } } @@ -821,15 +821,15 @@ void GraphicsContext::setLineJoin(LineJoin join) if (paintingDisabled()) return; switch (join) { - case MiterJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinMiter); - break; - case RoundJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinRound); - break; - case BevelJoin: - CGContextSetLineJoin(platformContext(), kCGLineJoinBevel); - break; + case MiterJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinMiter); + break; + case RoundJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinRound); + break; + case BevelJoin: + CGContextSetLineJoin(platformContext(), kCGLineJoinBevel); + break; } } @@ -858,7 +858,7 @@ void GraphicsContext::clipOut(const Path& path) { if (paintingDisabled()) return; - + CGContextBeginPath(platformContext()); CGContextAddRect(platformContext(), CGContextGetClipBoundingBox(platformContext())); CGContextAddPath(platformContext(), path.platformPath()); @@ -909,9 +909,9 @@ TransformationMatrix GraphicsContext::getCTM() const FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) { - // It is not enough just to round to pixels in device space. The rotation part of the + // It is not enough just to round to pixels in device space. The rotation part of the // affine transform matrix to device space can mess with this conversion if we have a - // rotating image like the hands of the world clock widget. We just need the scale, so + // rotating image like the hands of the world clock widget. We just need the scale, so // we get the affine transform matrix and extract the scale. if (m_data->m_userToDeviceTransformKnownToBeIdentity) @@ -934,11 +934,11 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) deviceOrigin.y = roundf(deviceOrigin.y); deviceLowerRight.x = roundf(deviceLowerRight.x); deviceLowerRight.y = roundf(deviceLowerRight.y); - + // Don't let the height or width round to 0 unless either was originally 0 - if (deviceOrigin.y == deviceLowerRight.y && rect.height() != 0) + if (deviceOrigin.y == deviceLowerRight.y && rect.height()) deviceLowerRight.y += 1; - if (deviceOrigin.x == deviceLowerRight.x && rect.width() != 0) + if (deviceOrigin.x == deviceLowerRight.x && rect.width()) deviceLowerRight.x += 1; FloatPoint roundedOrigin = FloatPoint(deviceOrigin.x / deviceScaleX, deviceOrigin.y / deviceScaleY); @@ -984,13 +984,13 @@ void GraphicsContext::drawLineForText(const IntPoint& point, int width, bool pri } } } - + if (fillColor() != strokeColor()) setCGFillColor(platformContext(), strokeColor()); CGContextFillRect(platformContext(), CGRectMake(x, y, lineLength, thickness)); if (fillColor() != strokeColor()) setCGFillColor(platformContext(), fillColor()); - + if (restoreAntialiasMode) CGContextSetShouldAntialias(platformContext(), true); } @@ -999,11 +999,11 @@ void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) { if (paintingDisabled()) return; - + CFURLRef urlRef = link.createCFURL(); if (urlRef) { CGContextRef context = platformContext(); - + // Get the bounding box to handle clipping. CGRect box = CGContextGetClipBoundingBox(context); @@ -1022,28 +1022,28 @@ void GraphicsContext::setImageInterpolationQuality(InterpolationQuality mode) { if (paintingDisabled()) return; - + CGInterpolationQuality quality = kCGInterpolationDefault; switch (mode) { - case InterpolationDefault: - quality = kCGInterpolationDefault; - break; - case InterpolationNone: - quality = kCGInterpolationNone; - break; - case InterpolationLow: - quality = kCGInterpolationLow; - break; - - // Fall through to InterpolationHigh if kCGInterpolationMedium is not available - case InterpolationMedium: + case InterpolationDefault: + quality = kCGInterpolationDefault; + break; + case InterpolationNone: + quality = kCGInterpolationNone; + break; + case InterpolationLow: + quality = kCGInterpolationLow; + break; + + // Fall through to InterpolationHigh if kCGInterpolationMedium is not available + case InterpolationMedium: #if HAVE(CG_INTERPOLATION_MEDIUM) - quality = kCGInterpolationMedium; - break; + quality = kCGInterpolationMedium; + break; #endif - case InterpolationHigh: - quality = kCGInterpolationHigh; - break; + case InterpolationHigh: + quality = kCGInterpolationHigh; + break; } CGContextSetInterpolationQuality(platformContext(), quality); } @@ -1055,18 +1055,18 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const CGInterpolationQuality quality = CGContextGetInterpolationQuality(platformContext()); switch (quality) { - case kCGInterpolationDefault: - return InterpolationDefault; - case kCGInterpolationNone: - return InterpolationNone; - case kCGInterpolationLow: - return InterpolationLow; + case kCGInterpolationDefault: + return InterpolationDefault; + case kCGInterpolationNone: + return InterpolationNone; + case kCGInterpolationLow: + return InterpolationLow; #if HAVE(CG_INTERPOLATION_MEDIUM) - case kCGInterpolationMedium: - return InterpolationMedium; + case kCGInterpolationMedium: + return InterpolationMedium; #endif - case kCGInterpolationHigh: - return InterpolationHigh; + case kCGInterpolationHigh: + return InterpolationHigh; } return InterpolationDefault; } @@ -1079,32 +1079,32 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode) // Wow, wish CG had used bits here. CGContextRef context = platformContext(); switch (mode) { - case cTextInvisible: // Invisible - CGContextSetTextDrawingMode(context, kCGTextInvisible); - break; - case cTextFill: // Fill - CGContextSetTextDrawingMode(context, kCGTextFill); - break; - case cTextStroke: // Stroke - CGContextSetTextDrawingMode(context, kCGTextStroke); - break; - case 3: // Fill | Stroke - CGContextSetTextDrawingMode(context, kCGTextFillStroke); - break; - case cTextClip: // Clip - CGContextSetTextDrawingMode(context, kCGTextClip); - break; - case 5: // Fill | Clip - CGContextSetTextDrawingMode(context, kCGTextFillClip); - break; - case 6: // Stroke | Clip - CGContextSetTextDrawingMode(context, kCGTextStrokeClip); - break; - case 7: // Fill | Stroke | Clip - CGContextSetTextDrawingMode(context, kCGTextFillStrokeClip); - break; - default: - break; + case cTextInvisible: // Invisible + CGContextSetTextDrawingMode(context, kCGTextInvisible); + break; + case cTextFill: // Fill + CGContextSetTextDrawingMode(context, kCGTextFill); + break; + case cTextStroke: // Stroke + CGContextSetTextDrawingMode(context, kCGTextStroke); + break; + case 3: // Fill | Stroke + CGContextSetTextDrawingMode(context, kCGTextFillStroke); + break; + case cTextClip: // Clip + CGContextSetTextDrawingMode(context, kCGTextClip); + break; + case 5: // Fill | Clip + CGContextSetTextDrawingMode(context, kCGTextFillClip); + break; + case 6: // Stroke | Clip + CGContextSetTextDrawingMode(context, kCGTextStrokeClip); + break; + case 7: // Fill | Stroke | Clip + CGContextSetTextDrawingMode(context, kCGTextFillStrokeClip); + break; + default: + break; } } @@ -1138,54 +1138,54 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable) #ifndef BUILDING_ON_TIGER // Tiger's setCompositeOperation() is defined in GraphicsContextMac.mm. void GraphicsContext::setCompositeOperation(CompositeOperator mode) -{ +{ if (paintingDisabled()) return; - CGBlendMode target = kCGBlendModeNormal; + CGBlendMode target = kCGBlendModeNormal; switch (mode) { - case CompositeClear: - target = kCGBlendModeClear; - break; - case CompositeCopy: - target = kCGBlendModeCopy; - break; - case CompositeSourceOver: - //kCGBlendModeNormal - break; - case CompositeSourceIn: - target = kCGBlendModeSourceIn; - break; - case CompositeSourceOut: - target = kCGBlendModeSourceOut; - break; - case CompositeSourceAtop: - target = kCGBlendModeSourceAtop; - break; - case CompositeDestinationOver: - target = kCGBlendModeDestinationOver; - break; - case CompositeDestinationIn: - target = kCGBlendModeDestinationIn; - break; - case CompositeDestinationOut: - target = kCGBlendModeDestinationOut; - break; - case CompositeDestinationAtop: - target = kCGBlendModeDestinationAtop; - break; - case CompositeXOR: - target = kCGBlendModeXOR; - break; - case CompositePlusDarker: - target = kCGBlendModePlusDarker; - break; - case CompositeHighlight: - // currently unsupported - break; - case CompositePlusLighter: - target = kCGBlendModePlusLighter; - break; + case CompositeClear: + target = kCGBlendModeClear; + break; + case CompositeCopy: + target = kCGBlendModeCopy; + break; + case CompositeSourceOver: + //kCGBlendModeNormal + break; + case CompositeSourceIn: + target = kCGBlendModeSourceIn; + break; + case CompositeSourceOut: + target = kCGBlendModeSourceOut; + break; + case CompositeSourceAtop: + target = kCGBlendModeSourceAtop; + break; + case CompositeDestinationOver: + target = kCGBlendModeDestinationOver; + break; + case CompositeDestinationIn: + target = kCGBlendModeDestinationIn; + break; + case CompositeDestinationOut: + target = kCGBlendModeDestinationOut; + break; + case CompositeDestinationAtop: + target = kCGBlendModeDestinationAtop; + break; + case CompositeXOR: + target = kCGBlendModeXOR; + break; + case CompositePlusDarker: + target = kCGBlendModePlusDarker; + break; + case CompositeHighlight: + // currently unsupported + break; + case CompositePlusLighter: + target = kCGBlendModePlusLighter; + break; } CGContextSetBlendMode(platformContext(), target); } diff --git a/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 6db7e88..97bcba5 100644 --- a/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -65,7 +65,9 @@ ImageBuffer::ImageBuffer(const IntSize& size, ImageColorSpace imageColorSpace, b bytesPerRow *= 4; } - m_data.m_data = tryFastCalloc(size.height(), bytesPerRow); + if (!tryFastCalloc(size.height(), bytesPerRow).getValue(m_data.m_data)) + return; + ASSERT((reinterpret_cast<size_t>(m_data.m_data) & 2) == 0); CGColorSpaceRef colorSpace; @@ -122,12 +124,13 @@ Image* ImageBuffer::image() const return m_image.get(); } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& imageData, const IntSize& size) { PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); unsigned char* data = result->data()->data()->data(); - if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > m_size.width() || (rect.y() + rect.height()) > m_size.height()) + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originx = rect.x(); @@ -137,8 +140,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -148,20 +151,21 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - unsigned srcBytesPerRow = 4 * m_size.width(); + unsigned srcBytesPerRow = 4 * size.width(); unsigned destBytesPerRow = 4 * rect.width(); // ::create ensures that all ImageBuffers have valid data, so we don't need to check it here. - unsigned char* srcRows = reinterpret_cast<unsigned char*>(m_data.m_data) + originy * srcBytesPerRow + originx * 4; + unsigned char* srcRows = reinterpret_cast<unsigned char*>(imageData.m_data) + originy * srcBytesPerRow + originx * 4; unsigned char* destRows = data + desty * destBytesPerRow + destx * 4; for (int y = 0; y < numRows; ++y) { for (int x = 0; x < numColumns; x++) { int basex = x * 4; - if (unsigned char alpha = srcRows[basex + 3]) { + unsigned char alpha = srcRows[basex + 3]; + if (multiplied == Unmultiplied && alpha) { destRows[basex] = (srcRows[basex] * 255) / alpha; destRows[basex + 1] = (srcRows[basex + 1] * 255) / alpha; destRows[basex + 2] = (srcRows[basex + 2] * 255) / alpha; @@ -175,7 +179,18 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, m_data, m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& imageData, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -183,36 +198,36 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= size.width()); int numColumns = endx - destx; int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); - ASSERT(desty < m_size.height()); + ASSERT(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - unsigned destBytesPerRow = 4 * m_size.width(); + unsigned destBytesPerRow = 4 * size.width(); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; - unsigned char* destRows = reinterpret_cast<unsigned char*>(m_data.m_data) + desty * destBytesPerRow + destx * 4; + unsigned char* destRows = reinterpret_cast<unsigned char*>(imageData.m_data) + desty * destBytesPerRow + destx * 4; for (int y = 0; y < numRows; ++y) { for (int x = 0; x < numColumns; x++) { int basex = x * 4; unsigned char alpha = srcRows[basex + 3]; - if (alpha != 255) { + if (multiplied == Unmultiplied && alpha != 255) { destRows[basex] = (srcRows[basex] * alpha + 254) / 255; destRows[basex + 1] = (srcRows[basex + 1] * alpha + 254) / 255; destRows[basex + 2] = (srcRows[basex + 2] * alpha + 254) / 255; @@ -225,6 +240,16 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + static RetainPtr<CFStringRef> utiFromMIMEType(const String& mimeType) { #if PLATFORM(MAC) diff --git a/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/WebCore/platform/graphics/filters/FEColorMatrix.cpp index fb0a194..1e2e552 100644 --- a/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -166,7 +166,7 @@ void FEColorMatrix::apply(Filter* filter) filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion())); IntRect imageRect(IntPoint(), resultImage()->size()); - PassRefPtr<ImageData> imageData(resultImage()->getImageData(imageRect)); + PassRefPtr<ImageData> imageData(resultImage()->getUnmultipliedImageData(imageRect)); PassRefPtr<CanvasPixelArray> srcPixelArray(imageData->data()); switch (m_type) { @@ -186,7 +186,7 @@ void FEColorMatrix::apply(Filter* filter) break; } - resultImage()->putImageData(imageData.get(), imageRect, IntPoint()); + resultImage()->putUnmultipliedImageData(imageData.get(), imageRect, IntPoint()); } void FEColorMatrix::dump() diff --git a/WebCore/platform/graphics/haiku/ColorHaiku.cpp b/WebCore/platform/graphics/haiku/ColorHaiku.cpp new file mode 100644 index 0000000..a9ac186 --- /dev/null +++ b/WebCore/platform/graphics/haiku/ColorHaiku.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Color.h" + +#include <InterfaceDefs.h> + + +namespace WebCore { + +Color::Color(const rgb_color& color) + : m_color(makeRGBA(color.red, color.green, color.blue, color.alpha)) + , m_valid(true) +{ +} + +Color::operator rgb_color() const +{ + return make_color(red(), green(), blue(), alpha()); +} + + +Color focusRingColor() +{ + return Color(keyboard_navigation_color()); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp b/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp new file mode 100644 index 0000000..0f50898 --- /dev/null +++ b/WebCore/platform/graphics/haiku/FloatPointHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FloatPoint.h" + +#include <Point.h> + + +namespace WebCore { + +FloatPoint::FloatPoint(const BPoint& point) + : m_x(point.x) + , m_y(point.y) +{ +} + +FloatPoint::operator BPoint() const +{ + return BPoint(m_x, m_y); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp new file mode 100644 index 0000000..67af3af --- /dev/null +++ b/WebCore/platform/graphics/haiku/FloatRectHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FloatRect.h" + +#include <Rect.h> + + +namespace WebCore { + +FloatRect::FloatRect(const BRect& rect) + : m_location(rect.LeftTop()) + , m_size(rect.Width(), rect.Height()) +{ +} + +FloatRect::operator BRect() const +{ + return BRect(BPoint(x(), y()), BSize(width(), height())); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/GradientHaiku.cpp b/WebCore/platform/graphics/haiku/GradientHaiku.cpp new file mode 100644 index 0000000..469a17f --- /dev/null +++ b/WebCore/platform/graphics/haiku/GradientHaiku.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All rights reserved. + * Copyright (C) 2009 Maxime Simon <simon.maxime@theolliviers.com> + * + * 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 "Gradient.h" + +#include "CSSParser.h" +#include "NotImplemented.h" + + +namespace WebCore { + +void Gradient::platformDestroy() +{ + notImplemented(); +} + +PlatformGradient Gradient::platformGradient() +{ + notImplemented(); + return 0; +} + +void Gradient::fill(GraphicsContext*, const FloatRect&) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp new file mode 100644 index 0000000..d785ef4 --- /dev/null +++ b/WebCore/platform/graphics/haiku/GraphicsContextHaiku.cpp @@ -0,0 +1,536 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "GraphicsContext.h" + +#include "CString.h" +#include "Color.h" +#include "Font.h" +#include "FontData.h" +#include "NotImplemented.h" +#include "Path.h" +#include "Pen.h" +#include "TransformationMatrix.h" +#include <GraphicsDefs.h> +#include <Region.h> +#include <View.h> +#include <Window.h> +#include <stdio.h> + + +namespace WebCore { + +class GraphicsContextPlatformPrivate { +public: + GraphicsContextPlatformPrivate(BView* view); + ~GraphicsContextPlatformPrivate(); + + BView* m_view; +}; + +GraphicsContextPlatformPrivate::GraphicsContextPlatformPrivate(BView* view) + : m_view(view) +{ +} + +GraphicsContextPlatformPrivate::~GraphicsContextPlatformPrivate() +{ +} + +GraphicsContext::GraphicsContext(PlatformGraphicsContext* context) + : m_common(createGraphicsContextPrivate()) + , m_data(new GraphicsContextPlatformPrivate(context)) +{ + setPaintingDisabled(!context); +} + +GraphicsContext::~GraphicsContext() +{ + destroyGraphicsContextPrivate(m_common); + delete m_data; +} + +PlatformGraphicsContext* GraphicsContext::platformContext() const +{ + return m_data->m_view; +} + +void GraphicsContext::savePlatformState() +{ + m_data->m_view->PushState(); +} + +void GraphicsContext::restorePlatformState() +{ + m_data->m_view->PopState(); +} + +// Draws a filled rectangle with a stroked border. +void GraphicsContext::drawRect(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + m_data->m_view->FillRect(rect); + if (strokeStyle() != NoStroke) + m_data->m_view->StrokeRect(rect, getHaikuStrokeStyle()); +} + +// This is only used to draw borders. +void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) +{ + if (paintingDisabled()) + return; + + if (strokeStyle() == NoStroke) + return; + + m_data->m_view->StrokeLine(point1, point2, getHaikuStrokeStyle()); +} + +// This method is only used to draw the little circles used in lists. +void GraphicsContext::drawEllipse(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + m_data->m_view->FillEllipse(rect); + if (strokeStyle() != NoStroke) + m_data->m_view->StrokeEllipse(rect, getHaikuStrokeStyle()); +} + +void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan) +{ + if (paintingDisabled()) + return; + + m_data->m_view->StrokeArc(rect, startAngle, angleSpan, getHaikuStrokeStyle()); +} + +void GraphicsContext::strokePath() +{ + notImplemented(); +} + +void GraphicsContext::drawConvexPolygon(size_t pointsLength, const FloatPoint* points, bool shouldAntialias) +{ + if (paintingDisabled()) + return; + + BPoint bPoints[pointsLength]; + for (size_t i = 0; i < pointsLength; i++) + bPoints[i] = points[i]; + + m_data->m_view->FillPolygon(bPoints, pointsLength); + if (strokeStyle() != NoStroke) + // Stroke with low color + m_data->m_view->StrokePolygon(bPoints, pointsLength, true, getHaikuStrokeStyle()); +} + +void GraphicsContext::fillRect(const FloatRect& rect, const Color& color) +{ + if (paintingDisabled()) + return; + + rgb_color oldColor = m_data->m_view->HighColor(); + m_data->m_view->SetHighColor(color); + m_data->m_view->FillRect(rect); + m_data->m_view->SetHighColor(oldColor); +} + +void GraphicsContext::fillRect(const FloatRect& rect) +{ + if (paintingDisabled()) + return; +} + +void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color) +{ + if (paintingDisabled() || !color.alpha()) + return; + + notImplemented(); + // FIXME: A simple implementation could just use FillRoundRect if all + // the sizes are the same, or even if they are not. Otherwise several + // FillRect and FillArc calls are needed. +} + +void GraphicsContext::fillPath() +{ + notImplemented(); +} + +void GraphicsContext::beginPath() +{ + notImplemented(); +} + +void GraphicsContext::addPath(const Path& path) +{ + notImplemented(); +} + +void GraphicsContext::clip(const FloatRect& rect) +{ + if (paintingDisabled()) + return; + + BRegion region(rect); + m_data->m_view->ConstrainClippingRegion(®ion); +} + +void GraphicsContext::drawFocusRing(const Color& color) +{ + if (paintingDisabled()) + return; + + const Vector<IntRect>& rects = focusRingRects(); + unsigned rectCount = rects.size(); + + // FIXME: maybe we should implement this with BShape? + + if (rects.size() > 1) { + BRegion region; + for (int i = 0; i < rectCount; ++i) + region.Include(BRect(rects[i])); + + m_data->m_view->SetHighColor(color); + m_data->m_view->StrokeRect(region.Frame(), B_MIXED_COLORS); + } +} + +void GraphicsContext::drawLineForText(const IntPoint& origin, int width, bool printing) +{ + if (paintingDisabled()) + return; + + IntPoint endPoint = origin + IntSize(width, 0); + drawLine(origin, endPoint); +} + +void GraphicsContext::drawLineForMisspellingOrBadGrammar(const IntPoint&, int width, bool grammar) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) +{ + notImplemented(); + return rect; +} + +void GraphicsContext::beginTransparencyLayer(float opacity) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::endTransparencyLayer() +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clearRect(const FloatRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::strokeRect(const FloatRect& rect, float width) +{ + if (paintingDisabled()) + return; + + float oldSize = m_data->m_view->PenSize(); + m_data->m_view->SetPenSize(width); + m_data->m_view->StrokeRect(rect, getHaikuStrokeStyle()); + m_data->m_view->SetPenSize(oldSize); +} + +void GraphicsContext::setLineCap(LineCap lineCap) +{ + if (paintingDisabled()) + return; + + cap_mode mode = B_BUTT_CAP; + switch (lineCap) { + case RoundCap: + mode = B_ROUND_CAP; + break; + case SquareCap: + mode = B_SQUARE_CAP; + break; + case ButtCap: + default: + break; + } + + m_data->m_view->SetLineMode(mode, m_data->m_view->LineJoinMode(), m_data->m_view->LineMiterLimit()); +} + +void GraphicsContext::setLineJoin(LineJoin lineJoin) +{ + if (paintingDisabled()) + return; + + join_mode mode = B_MITER_JOIN; + switch (lineJoin) { + case RoundJoin: + mode = B_ROUND_JOIN; + break; + case BevelJoin: + mode = B_BEVEL_JOIN; + break; + case MiterJoin: + default: + break; + } + + m_data->m_view->SetLineMode(m_data->m_view->LineCapMode(), mode, m_data->m_view->LineMiterLimit()); +} + +void GraphicsContext::setMiterLimit(float limit) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetLineMode(m_data->m_view->LineCapMode(), m_data->m_view->LineJoinMode(), limit); +} + +void GraphicsContext::setAlpha(float opacity) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setCompositeOperation(CompositeOperator op) +{ + if (paintingDisabled()) + return; + + drawing_mode mode = B_OP_COPY; + switch (op) { + case CompositeClear: + case CompositeCopy: + // Use the default above + break; + case CompositeSourceOver: + mode = B_OP_OVER; + break; + default: + printf("GraphicsContext::setCompositeOperation: Unsupported composite operation %s\n", + compositeOperatorName(op).utf8().data()); + } + m_data->m_view->SetDrawingMode(mode); +} + +void GraphicsContext::clip(const Path& path) +{ + if (paintingDisabled()) + return; + + m_data->m_view->ConstrainClippingRegion(path.platformPath()); +} + +void GraphicsContext::clipOut(const Path& path) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipToImageBuffer(const FloatRect&, const ImageBuffer*) +{ + notImplemented(); +} + +TransformationMatrix GraphicsContext::getCTM() const +{ + notImplemented(); + return TransformationMatrix(); +} + +void GraphicsContext::translate(float x, float y) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +IntPoint GraphicsContext::origin() +{ + notImplemented(); + return IntPoint(0, 0); +} + +void GraphicsContext::rotate(float radians) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::scale(const FloatSize& size) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipOut(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::concatCTM(const TransformationMatrix& transform) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setPlatformShouldAntialias(bool enable) +{ + if (paintingDisabled()) + return; + + notImplemented(); +} + +void GraphicsContext::setImageInterpolationQuality(InterpolationQuality) +{ +} + +void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) +{ + notImplemented(); +} + +void GraphicsContext::setPlatformFont(const Font& font) +{ + m_data->m_view->SetFont(font.primaryFont()->platformData().font()); +} + +void GraphicsContext::setPlatformStrokeColor(const Color& color) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetHighColor(color); +} + +pattern GraphicsContext::getHaikuStrokeStyle() +{ + switch (strokeStyle()) { + case SolidStroke: + return B_SOLID_HIGH; + break; + case DottedStroke: + return B_MIXED_COLORS; + break; + case DashedStroke: + // FIXME: use a better dashed stroke! + notImplemented(); + return B_MIXED_COLORS; + break; + default: + return B_SOLID_LOW; + break; + } +} + +void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle& strokeStyle) +{ + // FIXME: see getHaikuStrokeStyle. + notImplemented(); +} + +void GraphicsContext::setPlatformStrokeThickness(float thickness) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetPenSize(thickness); +} + +void GraphicsContext::setPlatformFillColor(const Color& color) +{ + if (paintingDisabled()) + return; + + m_data->m_view->SetHighColor(color); +} + +void GraphicsContext::clearPlatformShadow() +{ + notImplemented(); +} + +void GraphicsContext::setPlatformShadow(IntSize const&, int, Color const&) +{ + notImplemented(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntPointHaiku.cpp b/WebCore/platform/graphics/haiku/IntPointHaiku.cpp new file mode 100644 index 0000000..327e503 --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntPointHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IntPoint.h" + +#include <Point.h> + + +namespace WebCore { + +IntPoint::IntPoint(const BPoint& point) + : m_x(static_cast<int>(point.x)) + , m_y(static_cast<int>(point.y)) +{ +} + +IntPoint::operator BPoint() const +{ + return BPoint(m_x, m_y); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntRectHaiku.cpp b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp new file mode 100644 index 0000000..74a0b9d --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntRectHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IntRect.h" + +#include <Rect.h> + + +namespace WebCore { + +IntRect::IntRect(const BRect& rect) + : m_location(rect.LeftTop()) + , m_size(rect.IntegerWidth(), rect.IntegerHeight()) +{ +} + +IntRect::operator BRect() const +{ + return BRect(BPoint(x(), y()), BSize(width(), height())); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp b/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp new file mode 100644 index 0000000..08c3a9d --- /dev/null +++ b/WebCore/platform/graphics/haiku/IntSizeHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "IntSize.h" + +#include <Size.h> + + +namespace WebCore { + +IntSize::IntSize(const BSize& size) + : m_width(size.IntegerWidth()) + , m_height(size.IntegerHeight()) +{ +} + +IntSize::operator BSize() const +{ + return BSize(width(), height()); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/haiku/PathHaiku.cpp b/WebCore/platform/graphics/haiku/PathHaiku.cpp new file mode 100644 index 0000000..d0da025 --- /dev/null +++ b/WebCore/platform/graphics/haiku/PathHaiku.cpp @@ -0,0 +1,161 @@ +/* + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "Path.h" + +#include "FloatRect.h" +#include "NotImplemented.h" +#include "PlatformString.h" +#include <Region.h> + + +namespace WebCore { + +Path::Path() + : m_path(new BRegion()) +{ +} + +Path::~Path() +{ + delete m_path; +} + +Path::Path(const Path& other) + : m_path(new BRegion(*other.platformPath())) +{ +} + +Path& Path::operator=(const Path& other) +{ + if (&other != this) + m_path = other.platformPath(); + + return *this; +} + +bool Path::hasCurrentPoint() const +{ + return !isEmpty(); +} + +bool Path::contains(const FloatPoint& point, WindRule rule) const +{ + return m_path->Contains(point); +} + +void Path::translate(const FloatSize& size) +{ + notImplemented(); +} + +FloatRect Path::boundingRect() const +{ + return m_path->Frame(); +} + +void Path::moveTo(const FloatPoint& point) +{ + // FIXME: Use OffsetBy? + notImplemented(); +} + +void Path::addLineTo(const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + notImplemented(); +} + +void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) +{ + notImplemented(); +} + +void Path::closeSubpath() +{ + notImplemented(); +} + +void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise) +{ + notImplemented(); +} + +void Path::addRect(const FloatRect& r) +{ + m_path->Include(r); +} + +void Path::addEllipse(const FloatRect& r) +{ + notImplemented(); +} + +void Path::clear() +{ + m_path->MakeEmpty(); +} + +bool Path::isEmpty() const +{ + return !m_path->Frame().IsValid(); +} + +String Path::debugString() const +{ + notImplemented(); + return String(); +} + +void Path::apply(void* info, PathApplierFunction function) const +{ + notImplemented(); +} + +void Path::transform(const TransformationMatrix& transform) +{ + notImplemented(); +} + +FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier) +{ + notImplemented(); + return FloatRect(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/graphics/mac/FontMacATSUI.mm b/WebCore/platform/graphics/mac/FontMacATSUI.mm index 051abb7..35c40bf 100644 --- a/WebCore/platform/graphics/mac/FontMacATSUI.mm +++ b/WebCore/platform/graphics/mac/FontMacATSUI.mm @@ -504,8 +504,8 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint& firstGlyphBounds = zeroTrapezoid; } - float beforeWidth = MIN(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x)); - float afterWidth = MAX(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x)); + float beforeWidth = min(FixedToFloat(firstGlyphBounds.lowerLeft.x), FixedToFloat(firstGlyphBounds.upperLeft.x)); + float afterWidth = max(FixedToFloat(firstGlyphBounds.lowerRight.x), FixedToFloat(firstGlyphBounds.upperRight.x)); FloatRect rect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h); @@ -591,8 +591,8 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon if (actualNumBounds != 1) LOG_ERROR("unexpected result from ATSUGetGlyphBounds(): actualNumBounds(%d) != 1", actualNumBounds); - return MAX(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) - - MIN(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x)); + return max(FixedToFloat(firstGlyphBounds.upperRight.x), FixedToFloat(firstGlyphBounds.lowerRight.x)) - + min(FixedToFloat(firstGlyphBounds.upperLeft.x), FixedToFloat(firstGlyphBounds.lowerLeft.x)); } int Font::offsetForPositionForComplexText(const TextRun& run, int x, bool /*includePartialGlyphs*/) const diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.h b/WebCore/platform/graphics/mac/GraphicsLayerCA.h index ebdc6ac..d1bdb7e 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.h +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.h @@ -62,6 +62,8 @@ public: virtual void removeFromParent(); + virtual void setMaskLayer(GraphicsLayer*); + virtual void setPosition(const FloatPoint&); virtual void setAnchorPoint(const FloatPoint3D&); virtual void setSize(const FloatSize&); @@ -172,6 +174,7 @@ private: void updateContentsVideo(); void updateContentsRect(); void updateGeometryOrientation(); + void updateMaskLayer(); void updateLayerAnimations(); @@ -200,7 +203,8 @@ private: ContentsImageChanged = 1 << 17, ContentsVideoChanged = 1 << 18, ContentsRectChanged = 1 << 19, - GeometryOrientationChanged = 1 << 20 + GeometryOrientationChanged = 1 << 20, + MaskLayerChanged = 1 << 21 }; typedef unsigned LayerChangeFlags; void noteLayerPropertyChanged(LayerChangeFlags flags); diff --git a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm index e5b9035..abb310a 100644 --- a/WebCore/platform/graphics/mac/GraphicsLayerCA.mm +++ b/WebCore/platform/graphics/mac/GraphicsLayerCA.mm @@ -331,7 +331,7 @@ static NSDictionary* nullActionsDictionary() return actions; } -GraphicsLayer* GraphicsLayer::createGraphicsLayer(GraphicsLayerClient* client) +PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client) { return new GraphicsLayerCA(client); } @@ -432,6 +432,15 @@ void GraphicsLayerCA::removeFromParent() GraphicsLayer::removeFromParent(); } +void GraphicsLayerCA::setMaskLayer(GraphicsLayer* layer) +{ + if (layer == m_maskLayer) + return; + + GraphicsLayer::setMaskLayer(layer); + noteLayerPropertyChanged(MaskLayerChanged); +} + void GraphicsLayerCA::setPosition(const FloatPoint& point) { if (point == m_position) @@ -733,6 +742,9 @@ void GraphicsLayerCA::recursiveCommitChanges() { commitLayerChanges(); + if (m_maskLayer) + static_cast<GraphicsLayerCA*>(m_maskLayer)->commitLayerChanges(); + const Vector<GraphicsLayer*>& childLayers = children(); size_t numChildren = childLayers.size(); for (size_t i = 0; i < numChildren; ++i) { @@ -812,6 +824,9 @@ void GraphicsLayerCA::commitLayerChanges() if (m_uncommittedChanges & GeometryOrientationChanged) updateGeometryOrientation(); + if (m_uncommittedChanges & MaskLayerChanged) + updateMaskLayer(); + m_uncommittedChanges = NoChange; END_BLOCK_OBJC_EXCEPTIONS } @@ -821,10 +836,12 @@ void GraphicsLayerCA::updateSublayerList() NSMutableArray* newSublayers = nil; if (m_transformLayer) { - // FIXME: add the primary layer in the correct order with negative z-order children. + // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind. newSublayers = [[NSMutableArray alloc] initWithObjects:m_layer.get(), nil]; } else if (m_contentsLayer) { // FIXME: add the contents layer in the correct order with negative z-order children. + // This does not cause visible rendering issues because currently contents layers are only used + // for replaced elements that don't have children. newSublayers = [[NSMutableArray alloc] initWithObjects:m_contentsLayer.get(), nil]; } @@ -1094,6 +1111,12 @@ void GraphicsLayerCA::updateGeometryOrientation() #endif } +void GraphicsLayerCA::updateMaskLayer() +{ + CALayer* maskCALayer = m_maskLayer ? m_maskLayer->platformLayer() : 0; + [m_layer.get() setMask:maskCALayer]; +} + void GraphicsLayerCA::updateLayerAnimations() { if (m_transitionPropertiesToRemove.size()) { diff --git a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm index cdde7cf..acb97a7 100644 --- a/WebCore/platform/graphics/mac/SimpleFontDataMac.mm +++ b/WebCore/platform/graphics/mac/SimpleFontDataMac.mm @@ -50,6 +50,8 @@ - (BOOL)_isFakeFixedPitch; @end +using namespace std; + namespace WebCore { const float smallCapsFontSizeMultiplier = 0.7f; @@ -269,7 +271,7 @@ void SimpleFontData::platformInit() // and web pages that foolishly use this metric for width will be laid out // poorly if we return an accurate height. Classic case is Times 13 point, // which has an "x" that is 7x6 pixels. - m_xHeight = MAX(NSMaxX(xBox), NSMaxY(xBox)); + m_xHeight = max(NSMaxX(xBox), NSMaxY(xBox)); } else m_xHeight = [m_platformData.font() xHeight]; } diff --git a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index e259a4e..5e04b85 100644 --- a/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -34,29 +34,29 @@ */ #include "config.h" +#include "GraphicsContext.h" #ifdef Q_WS_WIN #include <windows.h> #endif -#include "TransformationMatrix.h" #include "Color.h" #include "FloatConversion.h" #include "Font.h" -#include "GraphicsContext.h" #include "GraphicsContextPrivate.h" #include "ImageBuffer.h" +#include "NotImplemented.h" #include "Path.h" #include "Pattern.h" #include "Pen.h" -#include "NotImplemented.h" +#include "TransformationMatrix.h" #include <QBrush> #include <QDebug> #include <QGradient> -#include <QPainter> #include <QPaintDevice> #include <QPaintEngine> +#include <QPainter> #include <QPainterPath> #include <QPixmap> #include <QPolygonF> @@ -72,35 +72,35 @@ namespace WebCore { static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op) { switch (op) { - case CompositeClear: - return QPainter::CompositionMode_Clear; - case CompositeCopy: - return QPainter::CompositionMode_Source; - case CompositeSourceOver: - return QPainter::CompositionMode_SourceOver; - case CompositeSourceIn: - return QPainter::CompositionMode_SourceIn; - case CompositeSourceOut: - return QPainter::CompositionMode_SourceOut; - case CompositeSourceAtop: - return QPainter::CompositionMode_SourceAtop; - case CompositeDestinationOver: - return QPainter::CompositionMode_DestinationOver; - case CompositeDestinationIn: - return QPainter::CompositionMode_DestinationIn; - case CompositeDestinationOut: - return QPainter::CompositionMode_DestinationOut; - case CompositeDestinationAtop: - return QPainter::CompositionMode_DestinationAtop; - case CompositeXOR: - return QPainter::CompositionMode_Xor; - case CompositePlusDarker: - // there is no exact match, but this is the closest - return QPainter::CompositionMode_Darken; - case CompositeHighlight: - return QPainter::CompositionMode_SourceOver; - case CompositePlusLighter: - return QPainter::CompositionMode_Plus; + case CompositeClear: + return QPainter::CompositionMode_Clear; + case CompositeCopy: + return QPainter::CompositionMode_Source; + case CompositeSourceOver: + return QPainter::CompositionMode_SourceOver; + case CompositeSourceIn: + return QPainter::CompositionMode_SourceIn; + case CompositeSourceOut: + return QPainter::CompositionMode_SourceOut; + case CompositeSourceAtop: + return QPainter::CompositionMode_SourceAtop; + case CompositeDestinationOver: + return QPainter::CompositionMode_DestinationOver; + case CompositeDestinationIn: + return QPainter::CompositionMode_DestinationIn; + case CompositeDestinationOut: + return QPainter::CompositionMode_DestinationOut; + case CompositeDestinationAtop: + return QPainter::CompositionMode_DestinationAtop; + case CompositeXOR: + return QPainter::CompositionMode_Xor; + case CompositePlusDarker: + // there is no exact match, but this is the closest + return QPainter::CompositionMode_Darken; + case CompositeHighlight: + return QPainter::CompositionMode_SourceOver; + case CompositePlusLighter: + return QPainter::CompositionMode_Plus; } return QPainter::CompositionMode_SourceOver; @@ -109,12 +109,12 @@ static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op static inline Qt::PenCapStyle toQtLineCap(LineCap lc) { switch (lc) { - case ButtCap: - return Qt::FlatCap; - case RoundCap: - return Qt::RoundCap; - case SquareCap: - return Qt::SquareCap; + case ButtCap: + return Qt::FlatCap; + case RoundCap: + return Qt::RoundCap; + case SquareCap: + return Qt::SquareCap; } return Qt::FlatCap; @@ -123,12 +123,12 @@ static inline Qt::PenCapStyle toQtLineCap(LineCap lc) static inline Qt::PenJoinStyle toQtLineJoin(LineJoin lj) { switch (lj) { - case MiterJoin: - return Qt::SvgMiterJoin; - case RoundJoin: - return Qt::RoundJoin; - case BevelJoin: - return Qt::BevelJoin; + case MiterJoin: + return Qt::SvgMiterJoin; + case RoundJoin: + return Qt::RoundJoin; + case BevelJoin: + return Qt::BevelJoin; } return Qt::MiterJoin; @@ -210,8 +210,8 @@ public: return redirect; return painter; - } else - return &layers.top()->painter; + } + return &layers.top()->painter; } bool antiAliasingForRectsAndLines; @@ -411,46 +411,25 @@ void GraphicsContext::drawRect(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { + IntRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + shadowRect.inflate(p->pen().widthF()); + p->fillRect(shadowRect, QColor(shadowColor)); + } + p->drawRect(rect); p->setRenderHint(QPainter::Antialiasing, antiAlias); } -// FIXME: Now that this is refactored, it should be shared by all contexts. -static void adjustLineToPixelBoundaries(FloatPoint& p1, FloatPoint& p2, float strokeWidth, - const StrokeStyle& penStyle) -{ - // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic - // works out. For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g., - // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave - // us a perfect position, but an odd width gave us a position that is off by exactly 0.5. - if (penStyle == DottedStroke || penStyle == DashedStroke) { - if (p1.x() == p2.x()) { - p1.setY(p1.y() + strokeWidth); - p2.setY(p2.y() - strokeWidth); - } else { - p1.setX(p1.x() + strokeWidth); - p2.setX(p2.x() - strokeWidth); - } - } - - if (((int) strokeWidth) % 2) { - if (p1.x() == p2.x()) { - // We're a vertical line. Adjust our x. - p1.setX(p1.x() + 0.5); - p2.setX(p2.x() + 0.5); - } else { - // We're a horizontal line. Adjust our y. - p1.setY(p1.y() + 0.5); - p2.setY(p2.y() + 0.5); - } - } -} - // This is only used to draw borders. void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) { @@ -468,7 +447,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) FloatPoint p2 = point2; bool isVerticalLine = (p1.x() == p2.x()); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); adjustLineToPixelBoundaries(p1, p2, width, style); @@ -486,15 +465,15 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) int patWidth = 0; switch (style) { - case NoStroke: - case SolidStroke: - break; - case DottedStroke: - patWidth = (int)width; - break; - case DashedStroke: - patWidth = 3 * (int)width; - break; + case NoStroke: + case SolidStroke: + break; + case DottedStroke: + patWidth = static_cast<int>(width); + break; + case DashedStroke: + patWidth = 3 * static_cast<int>(width); + break; } if (patWidth) { @@ -523,7 +502,7 @@ void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) if (patWidth == 1) patternOffset = 1.0f; else { - bool evenNumberOfSegments = numSegments % 2 == 0; + bool evenNumberOfSegments = !(numSegments % 2); if (remainder) evenNumberOfSegments = !evenNumberOfSegments; if (evenNumberOfSegments) { @@ -571,7 +550,7 @@ void GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSp if (paintingDisabled() || strokeStyle() == NoStroke || strokeThickness() <= 0.0f || !strokeColor().alpha()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); @@ -593,7 +572,7 @@ void GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points for (size_t i = 0; i < npoints; i++) polygon[i] = points[i]; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->save(); p->setRenderHint(QPainter::Antialiasing, shouldAntialias); p->drawConvexPolygon(polygon); @@ -605,7 +584,7 @@ QPen GraphicsContext::pen() if (paintingDisabled()) return QPen(); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); return p->pen(); } @@ -614,7 +593,7 @@ void GraphicsContext::fillPath() if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainterPath path = m_data->currentPath; path.setFillRule(toQtFillRule(fillRule())); @@ -642,7 +621,7 @@ void GraphicsContext::strokePath() if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen pen = p->pen(); QPainterPath path = m_data->currentPath; path.setFillRule(toQtFillRule(fillRule())); @@ -676,7 +655,16 @@ void GraphicsContext::fillRect(const FloatRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); + + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + if (getShadow(shadowSize, shadowBlur, shadowColor)) { + FloatRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + p->fillRect(shadowRect, QColor(shadowColor)); + } switch (m_common->state.fillColorSpace) { case SolidColorSpace: @@ -703,7 +691,17 @@ void GraphicsContext::fillRect(const FloatRect& rect, const Color& c) return; m_data->solidColor.setColor(QColor(c)); - m_data->p()->fillRect(rect, m_data->solidColor); + IntSize shadowSize; + int shadowBlur; + Color shadowColor; + QPainter* p = m_data->p(); + if (textDrawingMode() == cTextFill && getShadow(shadowSize, shadowBlur, shadowColor)) { + FloatRect shadowRect = rect; + shadowRect.move(shadowSize.width(), shadowSize.height()); + shadowRect.inflate(p->pen().widthF()); + p->fillRect(shadowRect, QColor(shadowColor)); + } + p->fillRect(rect, m_data->solidColor); } void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight, const IntSize& bottomLeft, const IntSize& bottomRight, const Color& color) @@ -750,7 +748,7 @@ void GraphicsContext::clipPath(WindRule clipRule) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainterPath newPath = m_data->currentPath; newPath.setFillRule(clipRule == RULE_EVENODD ? Qt::OddEvenFill : Qt::WindingFill); p->setClipPath(newPath); @@ -769,10 +767,10 @@ void GraphicsContext::drawFocusRing(const Color& color) const Vector<IntRect>& rects = focusRingRects(); unsigned rectCount = rects.size(); - if (rects.size() == 0) + if (!rects.size()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, m_data->antiAliasingForRectsAndLines); @@ -829,10 +827,16 @@ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& frect) return FloatRect(QRectF(result)); } -void GraphicsContext::setPlatformShadow(const IntSize& pos, int blur, const Color &color) +void GraphicsContext::setPlatformShadow(const IntSize& size, int blur, const Color &color) { // Qt doesn't support shadows natively, they are drawn manually in the draw* // functions + + if (m_common->state.shadowsIgnoreTransforms) { + // Meaning that this graphics context is associated with a CanvasRenderingContext + // We flip the height since CG and HTML5 Canvas have opposite Y axis + m_common->state.shadowSize = IntSize(size.width(), -size.height()); + } } void GraphicsContext::clearPlatformShadow() @@ -848,8 +852,8 @@ void GraphicsContext::beginTransparencyLayer(float opacity) int x, y, w, h; x = y = 0; - QPainter *p = m_data->p(); - const QPaintDevice *device = p->device(); + QPainter* p = m_data->p(); + const QPaintDevice* device = p->device(); w = device->width(); h = device->height(); @@ -871,10 +875,10 @@ void GraphicsContext::endTransparencyLayer() if (paintingDisabled()) return; - TransparencyLayer *layer = m_data->layers.pop(); + TransparencyLayer* layer = m_data->layers.pop(); layer->painter.end(); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->save(); p->resetTransform(); p->setOpacity(layer->opacity); @@ -889,7 +893,7 @@ void GraphicsContext::clearRect(const FloatRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPainter::CompositionMode currentCompositionMode = p->compositionMode(); if (p->paintEngine()->hasFeature(QPaintEngine::PorterDuff)) p->setCompositionMode(QPainter::CompositionMode_Source); @@ -916,7 +920,7 @@ void GraphicsContext::setLineCap(LineCap lc) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setCapStyle(toQtLineCap(lc)); p->setPen(nPen); @@ -948,7 +952,7 @@ void GraphicsContext::setLineJoin(LineJoin lj) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setJoinStyle(toQtLineJoin(lj)); p->setPen(nPen); @@ -959,7 +963,7 @@ void GraphicsContext::setMiterLimit(float limit) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen nPen = p->pen(); nPen.setMiterLimit(limit); p->setPen(nPen); @@ -969,7 +973,7 @@ void GraphicsContext::setAlpha(float opacity) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); p->setOpacity(opacity); } @@ -995,7 +999,7 @@ void GraphicsContext::clipOut(const Path& path) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath clippedOut = *path.platformPath(); QPainterPath newClip; @@ -1061,7 +1065,7 @@ void GraphicsContext::clipOut(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath newClip; newClip.setFillRule(Qt::OddEvenFill); @@ -1076,7 +1080,7 @@ void GraphicsContext::clipOutEllipseInRect(const IntRect& rect) if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QRectF clipBounds = p->clipPath().boundingRect(); QPainterPath newClip; newClip.setFillRule(Qt::OddEvenFill); @@ -1109,7 +1113,7 @@ void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, path.setFillRule(Qt::OddEvenFill); - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); const bool antiAlias = p->testRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::Antialiasing, true); @@ -1143,7 +1147,7 @@ void GraphicsContext::setPlatformStrokeColor(const Color& color) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setColor(color); p->setPen(newPen); @@ -1153,7 +1157,7 @@ void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle& strokeStyle) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setStyle(toQPenStyle(strokeStyle)); p->setPen(newPen); @@ -1163,7 +1167,7 @@ void GraphicsContext::setPlatformStrokeThickness(float thickness) { if (paintingDisabled()) return; - QPainter *p = m_data->p(); + QPainter* p = m_data->p(); QPen newPen(p->pen()); newPen.setWidthF(thickness); p->setPen(newPen); @@ -1184,7 +1188,6 @@ void GraphicsContext::setPlatformShouldAntialias(bool enable) } #ifdef Q_WS_WIN -#include <windows.h> HDC GraphicsContext::getWindowsContext(const IntRect& dstRect, bool supportAlphaBlend, bool mayCreateBitmap) { diff --git a/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/WebCore/platform/graphics/qt/ImageBufferQt.cpp index 22a5a43..6637092 100644 --- a/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -125,12 +125,13 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) m_data.m_painter->begin(&m_data.m_pixmap); } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const ImageBufferData& imageData, const IntSize& size) { PassRefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); unsigned char* data = result->data()->data()->data(); - if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > m_size.width() || (rect.y() + rect.height()) > m_size.height()) + if (rect.x() < 0 || rect.y() < 0 || (rect.x() + rect.width()) > size.width() || (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originx = rect.x(); @@ -140,8 +141,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originx = 0; } int endx = rect.x() + rect.width(); - if (endx > m_size.width()) - endx = m_size.width(); + if (endx > size.width()) + endx = size.width(); int numColumns = endx - originx; int originy = rect.y(); @@ -151,11 +152,16 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originy = 0; } int endy = rect.y() + rect.height(); - if (endy > m_size.height()) - endy = m_size.height(); + if (endy > size.height()) + endy = size.height(); int numRows = endy - originy; - QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage image = imageData.m_pixmap.toImage(); + if (multiplied == Unmultiplied) + image = image.convertToFormat(QImage::Format_ARGB32); + else + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); + ASSERT(!image.isNull()); unsigned destBytesPerRow = 4 * rect.width(); @@ -176,7 +182,18 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, m_data, m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, m_data, m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -184,33 +201,37 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < m_size.width()); + ASSERT(destx < size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.right()); int endx = destPoint.x() + sourceRect.right(); - ASSERT(endx <= m_size.width()); + ASSERT(endx <= size.width()); int numColumns = endx - destx; int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); - ASSERT(desty < m_size.height()); + ASSERT(desty < size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.bottom()); int endy = destPoint.y() + sourceRect.bottom(); - ASSERT(endy <= m_size.height()); + ASSERT(endy <= size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * source->width(); - bool isPainting = m_data.m_painter->isActive(); + bool isPainting = data.m_painter->isActive(); if (isPainting) - m_data.m_painter->end(); + data.m_painter->end(); - QImage image = m_data.m_pixmap.toImage().convertToFormat(QImage::Format_ARGB32); + QImage image = data.m_pixmap.toImage(); + if (multiplied == Unmultiplied) + image = image.convertToFormat(QImage::Format_ARGB32); + else + image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; for (int y = 0; y < numRows; ++y) { @@ -223,10 +244,20 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, con srcRows += srcBytesPerRow; } - m_data.m_pixmap = QPixmap::fromImage(image); + data.m_pixmap = QPixmap::fromImage(image); if (isPainting) - m_data.m_painter->begin(&m_data.m_pixmap); + data.m_painter->begin(&data.m_pixmap); +} + +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, m_data, m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, m_data, m_size); } // We get a mimeType here but QImageWriter does not support mimetypes but diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index 7935ff1..c429bcf 100644 --- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -118,16 +118,16 @@ void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) } } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const +template <Multiply multiplied> +PassRefPtr<ImageData> getImageData(const IntRect& rect, const SkBitmap& bitmap, + const IntSize& size) { - ASSERT(context()); - RefPtr<ImageData> result = ImageData::create(rect.width(), rect.height()); unsigned char* data = result->data()->data()->data(); if (rect.x() < 0 || rect.y() < 0 || - (rect.x() + rect.width()) > m_size.width() || - (rect.y() + rect.height()) > m_size.height()) + (rect.x() + rect.width()) > size.width() || + (rect.y() + rect.height()) > size.height()) memset(data, 0, result->data()->length()); int originX = rect.x(); @@ -137,8 +137,8 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originX = 0; } int endX = rect.x() + rect.width(); - if (endX > m_size.width()) - endX = m_size.width(); + if (endX > size.width()) + endX = size.width(); int numColumns = endX - originX; int originY = rect.y(); @@ -148,11 +148,10 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const originY = 0; } int endY = rect.y() + rect.height(); - if (endY > m_size.height()) - endY = m_size.height(); + if (endY > size.height()) + endY = size.height(); int numRows = endY - originY; - const SkBitmap& bitmap = *context()->platformContext()->bitmap(); ASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); SkAutoLockPixels bitmapLock(bitmap); @@ -162,6 +161,7 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const for (int y = 0; y < numRows; ++y) { uint32_t* srcRow = bitmap.getAddr32(originX, originY + y); for (int x = 0; x < numColumns; ++x) { + // TODO: Support for premultiplied colors SkColor color = SkPMColorToColor(srcRow[x]); unsigned char* destPixel = &destRow[x * 4]; destPixel[0] = SkColorGetR(color); @@ -175,8 +175,19 @@ PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect& rect) const return result; } -void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, - const IntPoint& destPoint) +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const +{ + return getImageData<Unmultiplied>(rect, *context()->platformContext()->bitmap(), m_size); +} + +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size); +} + +template <Multiply multiplied> +void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, + const SkBitmap& bitmap, const IntSize& size) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -184,27 +195,26 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, int originX = sourceRect.x(); int destX = destPoint.x() + sourceRect.x(); ASSERT(destX >= 0); - ASSERT(destX < m_size.width()); + ASSERT(destX < size.width()); ASSERT(originX >= 0); ASSERT(originX < sourceRect.right()); int endX = destPoint.x() + sourceRect.right(); - ASSERT(endX <= m_size.width()); + ASSERT(endX <= size.width()); int numColumns = endX - destX; int originY = sourceRect.y(); int destY = destPoint.y() + sourceRect.y(); ASSERT(destY >= 0); - ASSERT(destY < m_size.height()); + ASSERT(destY < size.height()); ASSERT(originY >= 0); ASSERT(originY < sourceRect.bottom()); int endY = destPoint.y() + sourceRect.bottom(); - ASSERT(endY <= m_size.height()); + ASSERT(endY <= size.height()); int numRows = endY - destY; - const SkBitmap& bitmap = *context()->platformContext()->bitmap(); ASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); SkAutoLockPixels bitmapLock(bitmap); @@ -215,6 +225,7 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, for (int y = 0; y < numRows; ++y) { uint32_t* destRow = bitmap.getAddr32(destX, destY + y); for (int x = 0; x < numColumns; ++x) { + // TODO: Support for premultiplied colors const unsigned char* srcPixel = &srcRow[x * 4]; destRow[x] = SkPreMultiplyARGB(srcPixel[3], srcPixel[0], srcPixel[1], srcPixel[2]); @@ -223,6 +234,16 @@ void ImageBuffer::putImageData(ImageData* source, const IntRect& sourceRect, } } +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Unmultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + putImageData<Premultiplied>(source, sourceRect, destPoint, *context()->platformContext()->bitmap(), m_size); +} + String ImageBuffer::toDataURL(const String&) const { // Encode the image into a vector. diff --git a/WebCore/platform/graphics/skia/ImageSourceSkia.cpp b/WebCore/platform/graphics/skia/ImageSourceSkia.cpp deleted file mode 100644 index 1647b86..0000000 --- a/WebCore/platform/graphics/skia/ImageSourceSkia.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright (c) 2008, 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 "ImageSource.h" -#include "SharedBuffer.h" - -#include "GIFImageDecoder.h" -#include "ICOImageDecoder.h" -#include "JPEGImageDecoder.h" -#include "PNGImageDecoder.h" -#include "BMPImageDecoder.h" -#include "XBMImageDecoder.h" - -#include "SkBitmap.h" - -namespace WebCore { - -ImageDecoder* createDecoder(const Vector<char>& data) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - int length = data.size(); - if (length < 4) - return 0; - - const unsigned char* uContents = (const unsigned char*)data.data(); - const char* contents = data.data(); - - // GIFs begin with GIF8(7 or 9). - if (strncmp(contents, "GIF8", 4) == 0) - return new GIFImageDecoder(); - - // Test for PNG. - if (uContents[0]==0x89 && - uContents[1]==0x50 && - uContents[2]==0x4E && - uContents[3]==0x47) - return new PNGImageDecoder(); - - // JPEG - if (uContents[0]==0xFF && - uContents[1]==0xD8 && - uContents[2]==0xFF) - return new JPEGImageDecoder(); - - // BMP - if (strncmp(contents, "BM", 2) == 0) - return new BMPImageDecoder(); - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // CURs begin with 2-byte 0 followed by 2-byte 2. - if (!memcmp(contents, "\000\000\001\000", 4) || - !memcmp(contents, "\000\000\002\000", 4)) - return new ICOImageDecoder(); - - // XBMs require 8 bytes of info. - if (length >= 8 && strncmp(contents, "#define ", 8) == 0) - return new XBMImageDecoder(); - - // Give up. We don't know what the heck this is. - return 0; -} - -ImageSource::ImageSource() - : m_decoder(0) -{} - -ImageSource::~ImageSource() -{ - clear(true); -} - -void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) -{ - if (!destroyAll) { - if (m_decoder) - m_decoder->clearFrameBufferCache(clearBeforeFrame); - return; - } - - delete m_decoder; - m_decoder = 0; - if (data) - setData(data, allDataReceived); -} - -bool ImageSource::initialized() const -{ - return m_decoder; -} - -void ImageSource::setData(SharedBuffer* data, bool allDataReceived) -{ - // Make the decoder by sniffing the bytes. - // This method will examine the data and instantiate an instance of the appropriate decoder plugin. - // If insufficient bytes are available to determine the image type, no decoder plugin will be - // made. - if (!m_decoder) - m_decoder = createDecoder(data->buffer()); - - // CreateDecoder will return NULL if the decoder could not be created. Plus, - // we should not send more data to a decoder which has already decided it - // has failed. - if (!m_decoder || m_decoder->failed()) - return; - m_decoder->setData(data, allDataReceived); -} - -bool ImageSource::isSizeAvailable() -{ - if (!m_decoder) - return false; - - return m_decoder->isSizeAvailable(); -} - -IntSize ImageSource::size() const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->size(); -} - -IntSize ImageSource::frameSizeAtIndex(size_t index) const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->frameSizeAtIndex(index); -} - -int ImageSource::repetitionCount() -{ - if (!m_decoder) - return cAnimationNone; - - return m_decoder->repetitionCount(); -} - -size_t ImageSource::frameCount() const -{ - if (!m_decoder) - return 0; - return m_decoder->failed() ? 0 : m_decoder->frameCount(); -} - -NativeImagePtr ImageSource::createFrameAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - // Note that the buffer can have NULL bytes even when it is marked as - // non-empty. It seems "FrameEmpty" is only set before the frame has been - // initialized. If it is decoded and it happens to be empty, it will be - // marked as "FrameComplete" but will still have NULL bytes. - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - // Copy the bitmap. The pixel data is refcounted internally by SkBitmap, so - // this doesn't cost much. - return buffer->asNewNativeImage(); -} - -bool ImageSource::frameIsCompleteAtIndex(size_t index) -{ - if (!m_decoder) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - return buffer && buffer->status() == RGBA32Buffer::FrameComplete; -} - -float ImageSource::frameDurationAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - // Many annoying ads specify a 0 duration to make an image flash as quickly - // as possible. We follow WinIE's behavior and use a duration of 100 ms - // for any frames that specify a duration of <= 50 ms. See - // <http://bugs.webkit.org/show_bug.cgi?id=14413> or Radar 4051389 for - // more. - const float duration = buffer->duration() / 1000.0f; - return (duration < 0.051f) ? 0.100f : duration; -} - -bool ImageSource::frameHasAlphaAtIndex(size_t index) -{ - if (!m_decoder || !m_decoder->supportsAlpha()) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return false; - - return buffer->hasAlpha(); -} - -String ImageSource::filenameExtension() const -{ - return m_decoder ? m_decoder->filenameExtension() : String(); -} - -} diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index e0a292c..bf6bae2 100644 --- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -295,7 +295,7 @@ void PlatformContextSkia::drawRect(SkRect rect) void PlatformContextSkia::setupPaintCommon(SkPaint* paint) const { -#ifdef SK_DEBUGx +#ifdef SK_DEBUG { SkPaint defaultPaint; SkASSERT(*paint == defaultPaint); diff --git a/WebCore/platform/graphics/wince/ColorWince.cpp b/WebCore/platform/graphics/wince/ColorWince.cpp new file mode 100644 index 0000000..820b9d2 --- /dev/null +++ b/WebCore/platform/graphics/wince/ColorWince.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "Color.h" + +#include "NotImplemented.h" + +namespace WebCore { + +Color focusRingColor() +{ + return Color(0, 0, 0); +} + +void setFocusRingColorChangeFunction(void (*)()) +{ + notImplemented(); +} + +} // namespace WebCore diff --git a/WebCore/platform/graphics/wince/GradientWince.cpp b/WebCore/platform/graphics/wince/GradientWince.cpp new file mode 100644 index 0000000..49fa970 --- /dev/null +++ b/WebCore/platform/graphics/wince/GradientWince.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Torch Mobile, 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 "Gradient.h" + +#include "GraphicsContext.h" + +namespace WebCore { + +void Gradient::platformDestroy() +{ +} + +static inline bool compareStops(const Gradient::ColorStop& a, const Gradient::ColorStop& b) +{ + return a.stop < b.stop; +} + +const Vector<Gradient::ColorStop>& Gradient::getStops() const +{ + if (!m_stopsSorted) { + if (m_stops.size()) + std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); + m_stopsSorted = true; + } + return m_stops; +} + +void Gradient::fill(GraphicsContext* c, const FloatRect& r) +{ + c->fillRect(r, this); +} + +} diff --git a/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h new file mode 100644 index 0000000..ff38ada --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerPrivateWince.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile 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 MediaPlayerPrivateWince_h +#define MediaPlayerPrivateWince_h + +#if ENABLE(VIDEO) + +#include "MediaPlayerPrivate.h" +#include "Timer.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + + class GraphicsContext; + class IntSize; + class IntRect; + class String; + + class MediaPlayerPrivate : public MediaPlayerPrivateInterface { + public: + static void registerMediaEngine(MediaEngineRegistrar); + + ~MediaPlayerPrivate(); + + IntSize naturalSize() const; + bool hasVideo() const; + + void load(const String& url); + void cancelLoad(); + + void play(); + void pause(); + + bool paused() const; + bool seeking() const; + + float duration() const; + float currentTime() const; + void seek(float time); + void setEndTime(float); + + void setRate(float); + void setVolume(float); + + int dataRate() const; + + MediaPlayer::NetworkState networkState() const { return m_networkState; } + MediaPlayer::ReadyState readyState() const { return m_readyState; } + + float maxTimeBuffered() const; + float maxTimeSeekable() const; + unsigned bytesLoaded() const; + bool totalBytesKnown() const; + unsigned totalBytes() const; + + void setVisible(bool); + void setSize(const IntSize&); + + void loadStateChanged(); + void didEnd(); + + void paint(GraphicsContext*, const IntRect&); + + private: + MediaPlayerPrivate(MediaPlayer*); + + void updateStates(); + void doSeek(); + void cancelSeek(); + void seekTimerFired(Timer<MediaPlayerPrivate>*); + float maxTimeLoaded() const; + void sawUnsupportedTracks(); +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + void setMediaPlayerProxy(WebMediaPlayerProxy*); + void setPoster(const String& url); + void deliverNotification(MediaPlayerProxyNotificationType); +#endif + + // engine support + static MediaPlayerPrivateInterface* create(MediaPlayer*); + static void getSupportedTypes(HashSet<String>& types); + static MediaPlayer::SupportsType supportsType(const String& type, const String& codecs); + static bool isAvailable(); + + MediaPlayer* m_player; + float m_seekTo; + float m_endTime; + Timer<MediaPlayerPrivate> m_seekTimer; + MediaPlayer::NetworkState m_networkState; + MediaPlayer::ReadyState m_readyState; + unsigned m_enabledTrackCount; + unsigned m_totalTrackCount; + bool m_hasUnsupportedTracks; + bool m_startedPlaying; + bool m_isStreaming; +#if ENABLE(PLUGIN_PROXY_FOR_VIDEO) + WebMediaPlayerProxy* m_proxy; +#endif + }; + +} + +#endif + +#endif diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp new file mode 100644 index 0000000..9673d18 --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.cpp @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2009 Torch Mobile, 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. + */ + +#if ENABLE(VIDEO) + +#include "config.h" +#include "MediaPlayerProxy.h" + +#include "c_class.h" +#include "c_instance.h" +#include "c_runtime.h" +#include "DocumentLoader.h" +#include "HTMLPlugInElement.h" +#include "HTMLVideoElement.h" +#include "JSDOMBinding.h" +#include "JSPluginElementFunctions.h" +#include "MediaPlayer.h" +#include "Node.h" +#include "npruntime_impl.h" +#include "PlatformString.h" +#include "PluginView.h" +#include "RenderPartObject.h" +#include "RenderWidget.h" +#include "runtime.h" +#include <runtime/Identifier.h> +#include "Widget.h" + +using namespace JSC; + +namespace WebCore { + +using namespace Bindings; +using namespace HTMLNames; + +WebMediaPlayerProxy::WebMediaPlayerProxy(MediaPlayer* player) + : m_mediaPlayer(player) + , m_init(false) + , m_hasSentResponseToPlugin(false) +{ + if (!m_init) + initEngine(); +} + +WebMediaPlayerProxy::~WebMediaPlayerProxy() +{ + m_instance.release(); +} + +ScriptInstance WebMediaPlayerProxy::pluginInstance() +{ + if (!m_instance) { + RenderObject* r = element()->renderer(); + if (!r || !r->isWidget()) + return 0; + + Frame* frame = element()->document()->frame(); + + RenderWidget* renderWidget = static_cast<RenderWidget*>(element()->renderer()); + if (renderWidget && renderWidget->widget()) + m_instance = frame->script()->createScriptInstanceForWidget(renderWidget->widget()); + } + + return m_instance; +} + +void WebMediaPlayerProxy::load(const String& url) +{ + if (!m_init) + initEngine(); + if (m_init) + invokeMethod("play"); +} + +void WebMediaPlayerProxy::initEngine() +{ + HTMLMediaElement* element = static_cast<HTMLMediaElement*>(m_mediaPlayer->mediaPlayerClient()); + String url = element->initialURL(); + + if (url.isEmpty()) + return; + + Frame* frame = element->document()->frame(); + Vector<String> paramNames; + Vector<String> paramValues; + String serviceType; + + // add all attributes set on the embed object + if (NamedNodeMap* attributes = element->attributes()) { + for (unsigned i = 0; i < attributes->length(); ++i) { + Attribute* it = attributes->attributeItem(i); + paramNames.append(it->name().localName().string()); + paramValues.append(it->value().string()); + } + } + serviceType = "application/x-mplayer2"; + frame->loader()->requestObject(static_cast<RenderPartObject*>(element->renderer()), url, nullAtom, serviceType, paramNames, paramValues); + m_init = true; + +} + +HTMLMediaElement* WebMediaPlayerProxy::element() +{ + return static_cast<HTMLMediaElement*>(m_mediaPlayer->mediaPlayerClient()); + +} + +void WebMediaPlayerProxy::invokeMethod(const String& methodName) +{ + Frame* frame = element()->document()->frame(); + RootObject *root = frame->script()->bindingRootObject(); + if (!root) + return; + ExecState *exec = root->globalObject()->globalExec(); + Instance* instance = pluginInstance().get(); + if (!instance) + return; + + instance->begin(); + Class *aClass = instance->getClass(); + Identifier iden(exec, methodName); + MethodList methodList = aClass->methodsNamed(iden, instance); + ArgList args; + instance->invokeMethod(exec, methodList , args); + instance->end(); +} + +} + +#endif diff --git a/WebCore/platform/graphics/wince/MediaPlayerProxy.h b/WebCore/platform/graphics/wince/MediaPlayerProxy.h new file mode 100644 index 0000000..05f9b21 --- /dev/null +++ b/WebCore/platform/graphics/wince/MediaPlayerProxy.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Torch Mobile, 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 MediaPlayerProxy_h +#define MediaPlayerProxy_h + +#if ENABLE(VIDEO) + +#include "ScriptInstance.h" + +namespace WebCore { + + class IntRect; + class IntSize; + class String; + class MediaPlayer; + class PluginView; + class HTMLMediaElement; + + enum MediaPlayerProxyNotificationType { + MediaPlayerNotificationPlayPauseButtonPressed, + Idle, + Loading, + Loaded, + FormatError, + NetworkError, + DecodeError + }; + + class WebMediaPlayerProxy { + public: + WebMediaPlayerProxy(MediaPlayer* player); + ~WebMediaPlayerProxy(); + + MediaPlayer* mediaPlayer() {return m_mediaPlayer;} + void initEngine(); + void load(const String& url); + HTMLMediaElement* element(); + void invokeMethod(const String& methodName); + ScriptInstance pluginInstance(); + + private: + MediaPlayer* m_mediaPlayer; + bool m_init; + WebCore::PluginView* m_pluginView; + bool m_hasSentResponseToPlugin; + ScriptInstance m_instance; + }; + +} +#endif // ENABLE(VIDEO) + +#endif diff --git a/WebCore/platform/graphics/wince/PathWince.cpp b/WebCore/platform/graphics/wince/PathWince.cpp new file mode 100644 index 0000000..7589ccb --- /dev/null +++ b/WebCore/platform/graphics/wince/PathWince.cpp @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "Path.h" + +#include "FloatRect.h" +#include "NotImplemented.h" +#include "PlatformPathWince.h" +#include "PlatformString.h" +#include "TransformationMatrix.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + +Path::Path() + : m_path(new PlatformPath()) +{ +} + +Path::Path(const Path& other) + : m_path(new PlatformPath(*other.m_path)) +{ +} + +Path::~Path() +{ + delete m_path; +} + +Path& Path::operator=(const Path& other) +{ + if (&other != this) { + delete m_path; + m_path = new PlatformPath(*other.m_path); + } + return *this; +} + +bool Path::contains(const FloatPoint& point, WindRule rule) const +{ + return m_path->contains(point, rule); +} + +void Path::translate(const FloatSize& size) +{ + m_path->translate(size); +} + +FloatRect Path::boundingRect() const +{ + return m_path->boundingRect(); +} + +void Path::moveTo(const FloatPoint& point) +{ + m_path->moveTo(point); +} + +void Path::addLineTo(const FloatPoint& point) +{ + m_path->addLineTo(point); +} + +void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + m_path->addQuadCurveTo(cp, p); +} + +void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + m_path->addBezierCurveTo(cp1, cp2, p); +} + +void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius) +{ + m_path->addArcTo(p1, p2, radius); +} + +void Path::closeSubpath() +{ + m_path->closeSubpath(); +} + +void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise) +{ + m_path->addEllipse(p, r, r, sar, ear, anticlockwise); +} + +void Path::addRect(const FloatRect& r) +{ + m_path->addRect(r); +} + +void Path::addEllipse(const FloatRect& r) +{ + m_path->addEllipse(r); +} + +void Path::clear() +{ + m_path->clear(); +} + +bool Path::isEmpty() const +{ + return m_path->isEmpty(); +} + +String Path::debugString() const +{ + return m_path->debugString(); +} + +void Path::apply(void* info, PathApplierFunction function) const +{ + m_path->apply(info, function); +} + +void Path::transform(const TransformationMatrix& t) +{ + m_path->transform(t); +} + +FloatRect Path::strokeBoundingRect(StrokeStyleApplier *) +{ + notImplemented(); + return FloatRect(); +} + +bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const +{ + notImplemented(); + return false; +} + +bool Path::hasCurrentPoint() const +{ + // Not sure if this is correct. At the meantime, we do what other ports + // do. + // See https://bugs.webkit.org/show_bug.cgi?id=27266, + // https://bugs.webkit.org/show_bug.cgi?id=27187, and + // http://trac.webkit.org/changeset/45873 + return !isEmpty(); +} + +} diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.cpp b/WebCore/platform/graphics/wince/PlatformPathWince.cpp new file mode 100644 index 0000000..66fad50 --- /dev/null +++ b/WebCore/platform/graphics/wince/PlatformPathWince.cpp @@ -0,0 +1,810 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "PlatformPathWince.h" + +#include "FloatRect.h" +#include "GraphicsContext.h" +#include "Path.h" +#include "PlatformString.h" +#include "TransformationMatrix.h" +#include "WinceGraphicsExtras.h" +#include <wtf/MathExtras.h> +#include <wtf/OwnPtr.h> + +#include <windows.h> + +namespace WebCore { + +// Implemented in GraphicsContextWince.cpp +void getEllipsePointByAngle(double angle, double a, double b, float& x, float& y); + +static void quadCurve(int segments, Vector<PathPoint>& pts, const PathPoint* control) +{ + const float step = 1.0 / segments; + register float tA = 0.0; + register float tB = 1.0; + + float c1x = control[0].x(); + float c1y = control[0].y(); + float c2x = control[1].x(); + float c2y = control[1].y(); + float c3x = control[2].x(); + float c3y = control[2].y(); + + const int offset = pts.size(); + pts.resize(offset + segments); + PathPoint pp; + pp.m_x = c1x; + pp.m_y = c1y; + + for (int i = 1; i < segments; ++i) { + tA += step; + tB -= step; + + const float a = tB * tB; + const float b = 2.0 * tA * tB; + const float c = tA * tA; + + pp.m_x = c1x * a + c2x * b + c3x * c; + pp.m_y = c1y * a + c2y * b + c3y * c; + + pts[offset + i - 1] = pp; + } + + pp.m_x = c3x; + pp.m_y = c3y; + pts[offset + segments - 1] = pp; +} + +static inline void bezier(int segments, Vector<PathPoint>& pts, const PathPoint* control) +{ + const float step = 1.0 / segments; + register float tA = 0.0; + register float tB = 1.0; + + float c1x = control[0].x(); + float c1y = control[0].y(); + float c2x = control[1].x(); + float c2y = control[1].y(); + float c3x = control[2].x(); + float c3y = control[2].y(); + float c4x = control[3].x(); + float c4y = control[3].y(); + + const int offset = pts.size(); + pts.resize(offset + segments); + PathPoint pp; + pp.m_x = c1x; + pp.m_y = c1y; + + for (int i = 1; i < segments; ++i) { + tA += step; + tB -= step; + const float tAsq = tA * tA; + const float tBsq = tB * tB; + + const float a = tBsq * tB; + const float b = 3.0 * tA * tBsq; + const float c = 3.0 * tB * tAsq; + const float d = tAsq * tA; + + pp.m_x = c1x * a + c2x * b + c3x * c + c4x * d; + pp.m_y = c1y * a + c2y * b + c3y * c + c4y * d; + + pts[offset + i - 1] = pp; + } + + pp.m_x = c4x; + pp.m_y = c4y; + pts[offset + segments - 1] = pp; +} + +static bool containsPoint(const FloatRect& r, const FloatPoint& p) +{ + return p.x() >= r.x() && p.y() >= r.y() && p.x() < r.right() && p.y() < r.bottom(); +} + +static void normalizeAngle(float& angle) +{ + angle = fmod(angle, 2 * piFloat); + if (angle < 0) + angle += 2 * piFloat; + if (angle < 0.00001f) + angle = 0; +} + +static void transformArcPoint(float& x, float& y, const FloatPoint& c) +{ + x += c.x(); + y += c.y(); +} + +static void inflateRectToContainPoint(FloatRect& r, float x, float y) +{ + if (r.isEmpty()) { + r.setX(x); + r.setY(y); + r.setSize(FloatSize(1, 1)); + return; + } + if (x < r.x()) { + r.setWidth(r.right() - x); + r.setX(x); + } else { + float w = x - r.x() + 1; + if (w > r.width()) + r.setWidth(w); + } + if (y < r.y()) { + r.setHeight(r.bottom() - y); + r.setY(y); + } else { + float h = y - r.y() + 1; + if (h > r.height()) + r.setHeight(h); + } +} + +// return 0-based value: 0 - first Quadrant ( 0 - 90 degree) +static inline int quadrant(const PathPoint& point, const PathPoint& origin) +{ + return point.m_x < origin.m_x ? + (point.m_y < origin.m_y ? 2 : 1) + : (point.m_y < origin.m_y ? 3 : 0); +} + +static inline bool isQuadrantOnLeft(int q) { return q == 1 || q == 2; } +static inline bool isQuadrantOnRight(int q) { return q == 0 || q == 3; } +static inline bool isQuadrantOnTop(int q) { return q == 2 || q == 3; } +static inline bool isQuadrantOnBottom(int q) { return q == 0 || q == 1; } + +static inline int nextQuadrant(int q) { return q == 3 ? 0 : q + 1; } +static inline int quadrantDiff(int q1, int q2) +{ + int d = q1 - q2; + while (d < 0) + d += 4; + return d; +} + +struct PathVector { + float m_x; + float m_y; + + PathVector() : m_x(0), m_y(0) {} + PathVector(float x, float y) : m_x(x), m_y(y) {} + double angle() const { return atan2(m_y, m_x); } + operator double () const { return angle(); } + double length() const { return _hypot(m_x, m_y); } +}; + +PathVector operator-(const PathPoint& p1, const PathPoint& p2) +{ + return PathVector(p1.m_x - p2.m_x, p1.m_y - p2.m_y); +} + +static void addArcPoint(PathPolygon& poly, const PathPoint& center, const PathPoint& radius, double angle) +{ + PathPoint p; + getEllipsePointByAngle(angle, radius.m_x, radius.m_y, p.m_x, p.m_y); + transformArcPoint(p.m_x, p.m_y, center); + if (poly.isEmpty() || poly.last() != p) + poly.append(p); +} + +static void addArcPoints(PathPolygon& poly, const PlatformPathElement::ArcTo& data) +{ + const PathPoint& startPoint = poly.last(); + double curAngle = startPoint - data.m_center; + double endAngle = data.m_end - data.m_center; + double angleStep = 2. / std::max(data.m_radius.m_x, data.m_radius.m_y); + if (data.m_clockwise) { + if (endAngle <= curAngle || startPoint == data.m_end) + endAngle += 2 * piDouble; + } else { + angleStep = -angleStep; + if (endAngle >= curAngle || startPoint == data.m_end) + endAngle -= 2 * piDouble; + } + + for (curAngle += angleStep; data.m_clockwise ? curAngle < endAngle : curAngle > endAngle; curAngle += angleStep) + addArcPoint(poly, data.m_center, data.m_radius, curAngle); + + if (poly.isEmpty() || poly.last() != data.m_end) + poly.append(data.m_end); +} + +static void drawPolygons(HDC dc, const Vector<PathPolygon>& polygons, bool fill, const TransformationMatrix* transformation) +{ + MemoryAllocationCanFail canFail; + for (Vector<PathPolygon>::const_iterator i = polygons.begin(); i != polygons.end(); ++i) { + int npoints = i->size(); + if (!npoints) + continue; + + POINT* winPoints = 0; + if (fill) { + if (npoints > 2) + winPoints = new POINT[npoints + 1]; + } else + winPoints = new POINT[npoints]; + + if (winPoints) { + if (transformation) { + for (int i2 = 0; i2 < npoints; ++i2) { + FloatPoint trPoint = transformation->mapPoint(i->at(i2)); + winPoints[i2].x = stableRound(trPoint.x()); + winPoints[i2].y = stableRound(trPoint.y()); + } + } else { + for (int i2 = 0; i2 < npoints; ++i2) { + winPoints[i2].x = stableRound(i->at(i2).x()); + winPoints[i2].y = stableRound(i->at(i2).y()); + } + } + + if (fill && winPoints[npoints - 1] != winPoints[0]) { + winPoints[npoints].x = winPoints[0].x; + winPoints[npoints].y = winPoints[0].y; + ++npoints; + } + + if (fill) + ::Polygon(dc, winPoints, npoints); + else + ::Polyline(dc, winPoints, npoints); + delete[] winPoints; + } + } +} + + +int PlatformPathElement::numControlPoints() const +{ + switch (m_type) { + case PathMoveTo: + case PathLineTo: + return 1; + case PathQuadCurveTo: + case PathArcTo: + return 2; + case PathBezierCurveTo: + return 3; + default: + ASSERT(m_type == PathCloseSubpath); + return 0; + } +} + +int PlatformPathElement::numPoints() const +{ + switch (m_type) { + case PathMoveTo: + case PathLineTo: + case PathArcTo: + return 1; + case PathQuadCurveTo: + return 2; + case PathBezierCurveTo: + return 3; + default: + ASSERT(m_type == PathCloseSubpath); + return 0; + } +} + +void PathPolygon::move(const FloatSize& offset) +{ + for (Vector<PathPoint>::iterator i = begin(); i < end(); ++i) + i->move(offset); +} + +void PathPolygon::transform(const TransformationMatrix& t) +{ + for (Vector<PathPoint>::iterator i = begin(); i < end(); ++i) + *i = t.mapPoint(*i); +} + +bool PathPolygon::contains(const FloatPoint& point) const +{ + if (size() < 3) + return false; + + // Test intersections between the polygon and the vertical line: x = point.x() + + int intersected = 0; + const PathPoint* point1 = &last(); + Vector<PathPoint>::const_iterator last = end(); + // wasNegative: -1 means unknown, 0 means false, 1 means true. + int wasNegative = -1; + for (Vector<PathPoint>::const_iterator i = begin(); i != last; ++i) { + const PathPoint& point2 = *i; + if (point1->x() != point.x()) { + if (point2.x() == point.x()) { + // We are getting on the vertical line + wasNegative = point1->x() < point.x() ? 1 : 0; + } else if (point2.x() < point.x() != point1->x() < point.x()) { + float y = (point2.y() - point1->y()) / (point2.x() - point1->x()) * (point.x() - point1->x()) + point1->y(); + if (y >= point.y()) + ++intersected; + } + } else { + // We were on the vertical line + + // handle special case + if (point1->y() == point.y()) + return true; + + if (point1->y() > point.y()) { + if (point2.x() == point.x()) { + // see if the point is on this segment + if (point2.y() <= point.y()) + return true; + + // We are still on the line + } else { + // We are leaving the line now. + // We have to get back to see which side we come from. If we come from + // the same side we are leaving, no intersection should be counted + if (wasNegative < 0) { + Vector<PathPoint>::const_iterator jLast = i; + Vector<PathPoint>::const_iterator j = i; + do { + if (j == begin()) + j = last; + else + --j; + if (j->x() != point.x()) { + if (j->x() > point.x()) + wasNegative = 0; + else + wasNegative = 1; + break; + } + } while (j != jLast); + + if (wasNegative < 0) + return false; + } + if (wasNegative ? point2.x() > point.x() : point2.x() < point.x()) + ++intersected; + } + } else if (point2.x() == point.x() && point2.y() >= point.y()) + return true; + } + point1 = &point2; + } + + return intersected & 1; +} + +void PlatformPathElement::move(const FloatSize& offset) +{ + int n = numControlPoints(); + for (int i = 0; i < n; ++i) + m_data.m_points[i].move(offset); +} + +void PlatformPathElement::transform(const TransformationMatrix& t) +{ + int n = numControlPoints(); + for (int i = 0; i < n; ++i) { + FloatPoint p = t.mapPoint(m_data.m_points[i]); + m_data.m_points[i].set(p.x(), p.y()); + } +} + +void PlatformPathElement::inflateRectToContainMe(FloatRect& r, const FloatPoint& lastPoint) const +{ + if (m_type == PathArcTo) { + const ArcTo& data = m_data.m_arcToData; + PathPoint startPoint; + startPoint = lastPoint; + PathPoint endPoint = data.m_end; + if (!data.m_clockwise) + std::swap(startPoint, endPoint); + + int q0 = quadrant(startPoint, data.m_center); + int q1 = quadrant(endPoint, data.m_center); + bool containsExtremes[4] = { false }; // bottom, left, top, right + static const PathPoint extremeVectors[4] = { { 0, 1 }, { -1, 0 }, { 0, -1 }, { 1, 0 } }; + if (q0 == q1) { + if (startPoint.m_x == endPoint.m_x || isQuadrantOnBottom(q0) != startPoint.m_x > endPoint.m_x) { + for (int i = 0; i < 4; ++i) + containsExtremes[i] = true; + } + } else { + int extreme = q0; + int diff = quadrantDiff(q1, q0); + for (int i = 0; i < diff; ++i) { + containsExtremes[extreme] = true; + extreme = nextQuadrant(extreme); + } + } + + inflateRectToContainPoint(r, startPoint.m_x, startPoint.m_y); + inflateRectToContainPoint(r, endPoint.m_x, endPoint.m_y); + for (int i = 0; i < 4; ++i) { + if (containsExtremes[i]) + inflateRectToContainPoint(r, data.m_center.m_x + data.m_radius.m_x * extremeVectors[i].m_x, data.m_center.m_y + data.m_radius.m_y * extremeVectors[i].m_y); + } + } else { + int n = numPoints(); + for (int i = 0; i < n; ++i) + inflateRectToContainPoint(r, m_data.m_points[i].m_x, m_data.m_points[i].m_y); + } +} + +PathElementType PlatformPathElement::type() const +{ + switch (m_type) { + case PathMoveTo: + return PathElementMoveToPoint; + case PathLineTo: + return PathElementAddLineToPoint; + case PathArcTo: + // FIXME: there's no arcTo type for PathElement + return PathElementAddLineToPoint; + // return PathElementAddQuadCurveToPoint; + case PathQuadCurveTo: + return PathElementAddQuadCurveToPoint; + case PathBezierCurveTo: + return PathElementAddCurveToPoint; + default: + ASSERT(m_type == PathCloseSubpath); + return PathElementCloseSubpath; + } +} + +PlatformPath::PlatformPath() + : m_penLifted(true) +{ + m_currentPoint.clear(); +} + +void PlatformPath::ensureSubpath() +{ + if (m_penLifted) { + m_penLifted = false; + m_subpaths.append(PathPolygon()); + m_subpaths.last().append(m_currentPoint); + } else + ASSERT(!m_subpaths.isEmpty()); +} + +void PlatformPath::addToSubpath(const PlatformPathElement& e) +{ + if (e.platformType() == PlatformPathElement::PathMoveTo) { + m_penLifted = true; + m_currentPoint = e.pointAt(0); + } else if (e.platformType() == PlatformPathElement::PathCloseSubpath) { + m_penLifted = true; + if (!m_subpaths.isEmpty()) { + if (m_currentPoint != m_subpaths.last()[0]) { + // According to W3C, we have to draw a line from current point to the initial point + m_subpaths.last().append(m_subpaths.last()[0]); + m_currentPoint = m_subpaths.last()[0]; + } + } else + m_currentPoint.clear(); + } else { + ensureSubpath(); + switch (e.platformType()) { + case PlatformPathElement::PathLineTo: + m_subpaths.last().append(e.pointAt(0)); + break; + case PlatformPathElement::PathArcTo: + addArcPoints(m_subpaths.last(), e.arcTo()); + break; + case PlatformPathElement::PathQuadCurveTo: + { + PathPoint control[] = { + m_currentPoint, + e.pointAt(0), + e.pointAt(1), + }; + // FIXME: magic number? + quadCurve(50, m_subpaths.last(), control); + } + break; + case PlatformPathElement::PathBezierCurveTo: + { + PathPoint control[] = { + m_currentPoint, + e.pointAt(0), + e.pointAt(1), + e.pointAt(2), + }; + // FIXME: magic number? + bezier(100, m_subpaths.last(), control); + } + break; + default: + ASSERT_NOT_REACHED(); + break; + } + m_currentPoint = m_subpaths.last().last(); + } +} + +void PlatformPath::append(const PlatformPathElement& e) +{ + e.inflateRectToContainMe(m_boundingRect, lastPoint()); + addToSubpath(e); + m_elements.append(e); +} + +void PlatformPath::append(const PlatformPath& p) +{ + const PlatformPathElements& e = p.elements(); + for (PlatformPathElements::const_iterator it(e.begin()); it != e.end(); ++it) { + addToSubpath(*it); + it->inflateRectToContainMe(m_boundingRect, lastPoint()); + m_elements.append(*it); + } +} + +void PlatformPath::clear() +{ + m_elements.clear(); + m_boundingRect = FloatRect(); + m_subpaths.clear(); + m_currentPoint.clear(); + m_penLifted = true; +} + +void PlatformPath::strokePath(HDC dc, const TransformationMatrix* transformation) const +{ + drawPolygons(dc, m_subpaths, false, transformation); +} + +void PlatformPath::fillPath(HDC dc, const TransformationMatrix* transformation) const +{ + HGDIOBJ oldPen = SelectObject(dc, GetStockObject(NULL_PEN)); + drawPolygons(dc, m_subpaths, true, transformation); + SelectObject(dc, oldPen); +} + +void PlatformPath::translate(const FloatSize& size) +{ + for (PlatformPathElements::iterator it(m_elements.begin()); it != m_elements.end(); ++it) + it->move(size); + + m_boundingRect.move(size); + for (Vector<PathPolygon>::iterator it = m_subpaths.begin(); it != m_subpaths.end(); ++it) + it->move(size); +} + +void PlatformPath::transform(const TransformationMatrix& t) +{ + for (PlatformPathElements::iterator it(m_elements.begin()); it != m_elements.end(); ++it) + it->transform(t); + + m_boundingRect = t.mapRect(m_boundingRect); + for (Vector<PathPolygon>::iterator it = m_subpaths.begin(); it != m_subpaths.end(); ++it) + it->transform(t); +} + +bool PlatformPath::contains(const FloatPoint& point, WindRule rule) const +{ + // optimization: check the bounding rect first + if (!containsPoint(m_boundingRect, point)) + return false; + + for (Vector<PathPolygon>::const_iterator i = m_subpaths.begin(); i != m_subpaths.end(); ++i) { + if (i->contains(point)) + return true; + } + + return false; +} + +void PlatformPath::moveTo(const FloatPoint& point) +{ + PlatformPathElement::MoveTo data = { { point.x(), point.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addLineTo(const FloatPoint& point) +{ + PlatformPathElement::LineTo data = { { point.x(), point.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p) +{ + PlatformPathElement::QuadCurveTo data = { { cp.x(), cp.y() }, { p.x(), p.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p) +{ + PlatformPathElement::BezierCurveTo data = { { cp1.x(), cp1.y() }, { cp2.x(), cp2.y() }, { p.x(), p.y() } }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::addArcTo(const FloatPoint& fp1, const FloatPoint& fp2, float radius) +{ + const PathPoint& p0 = m_currentPoint; + PathPoint p1; + p1 = fp1; + PathPoint p2; + p2 = fp2; + if (!radius || p0 == p1 || p1 == p2) { + addLineTo(p1); + return; + } + + PathVector v01 = p0 - p1; + PathVector v21 = p2 - p1; + + // sin(A - B) = sin(A) * cos(B) - sin(B) * cos(A) + double cross = v01.m_x * v21.m_y - v01.m_y * v21.m_x; + + if (fabs(cross) < 1E-10) { + // on one line + addLineTo(p1); + return; + } + + double d01 = v01.length(); + double d21 = v21.length(); + double angle = (piDouble - abs(asin(cross / (d01 * d21)))) * 0.5; + double span = radius * tan(angle); + double rate = span / d01; + PathPoint startPoint; + startPoint.m_x = p1.m_x + v01.m_x * rate; + startPoint.m_y = p1.m_y + v01.m_y * rate; + + addLineTo(startPoint); + + PathPoint endPoint; + rate = span / d21; + endPoint.m_x = p1.m_x + v21.m_x * rate; + endPoint.m_y = p1.m_y + v21.m_y * rate; + + PathPoint midPoint; + midPoint.m_x = (startPoint.m_x + endPoint.m_x) * 0.5; + midPoint.m_y = (startPoint.m_y + endPoint.m_y) * 0.5; + + PathVector vm1 = midPoint - p1; + double dm1 = vm1.length(); + double d = _hypot(radius, span); + + PathPoint centerPoint; + rate = d / dm1; + centerPoint.m_x = p1.m_x + vm1.m_x * rate; + centerPoint.m_y = p1.m_y + vm1.m_y * rate; + + PlatformPathElement::ArcTo data = { + endPoint, + centerPoint, + { radius, radius }, + cross < 0 + }; + PlatformPathElement pe(data); + append(pe); +} + +void PlatformPath::closeSubpath() +{ + PlatformPathElement pe; + append(pe); +} + +// add a circular arc centred at p with radius r from start angle sar (radians) to end angle ear +void PlatformPath::addEllipse(const FloatPoint& p, float a, float b, float sar, float ear, bool anticlockwise) +{ + float startX, startY, endX, endY; + + normalizeAngle(sar); + normalizeAngle(ear); + + getEllipsePointByAngle(sar, a, b, startX, startY); + getEllipsePointByAngle(ear, a, b, endX, endY); + + transformArcPoint(startX, startY, p); + transformArcPoint(endX, endY, p); + + FloatPoint start(startX, startY); + moveTo(start); + + PlatformPathElement::ArcTo data = { { endX, endY }, { p.x(), p.y() }, { a, b }, !anticlockwise }; + PlatformPathElement pe(data); + append(pe); +} + + +void PlatformPath::addRect(const FloatRect& r) +{ + moveTo(r.location()); + + float right = r.right() - 1; + float bottom = r.bottom() - 1; + addLineTo(FloatPoint(right, r.y())); + addLineTo(FloatPoint(right, bottom)); + addLineTo(FloatPoint(r.x(), bottom)); + addLineTo(r.location()); +} + +void PlatformPath::addEllipse(const FloatRect& r) +{ + FloatSize radius(r.width() * 0.5, r.height() * 0.5); + addEllipse(r.location() + radius, radius.width(), radius.height(), 0, 0, true); +} + +String PlatformPath::debugString() const +{ + String ret; + for (PlatformPathElements::const_iterator i(m_elements.begin()); i != m_elements.end(); ++i) { + switch (i->platformType()) { + case PlatformPathElement::PathMoveTo: + case PlatformPathElement::PathLineTo: + ret += String::format("M %f %f\n", i->pointAt(0).m_x, i->pointAt(0).m_y); + break; + case PlatformPathElement::PathArcTo: + ret += String::format("A %f %f %f %f %f %f %c\n" + , i->arcTo().m_end.m_x, i->arcTo().m_end.m_y + , i->arcTo().m_center.m_x, i->arcTo().m_center.m_y + , i->arcTo().m_radius.m_x, i->arcTo().m_radius.m_y + , i->arcTo().m_clockwise? 'Y' : 'N'); + break; + case PlatformPathElement::PathQuadCurveTo: + ret += String::format("Q %f %f %f %f\n" + , i->pointAt(0).m_x, i->pointAt(0).m_y + , i->pointAt(1).m_x, i->pointAt(1).m_y); + break; + case PlatformPathElement::PathBezierCurveTo: + ret += String::format("B %f %f %f %f %f %f\n" + , i->pointAt(0).m_x, i->pointAt(0).m_y + , i->pointAt(1).m_x, i->pointAt(1).m_y + , i->pointAt(2).m_x, i->pointAt(2).m_y); + break; + default: + ASSERT(i->platformType() == PlatformPathElement::PathCloseSubpath); + ret += "S\n"; + break; + } + } + + return ret; +} + +void PlatformPath::apply(void* info, PathApplierFunction function) const +{ + PathElement pelement; + FloatPoint points[3]; + pelement.points = points; + + for (PlatformPathElements::const_iterator it(m_elements.begin()); it != m_elements.end(); ++it) { + pelement.type = it->type(); + int n = it->numPoints(); + for (int i = 0; i < n; ++i) + points[i] = it->pointAt(i); + function(info, &pelement); + } +} + +} // namespace Webcore diff --git a/WebCore/platform/graphics/wince/PlatformPathWince.h b/WebCore/platform/graphics/wince/PlatformPathWince.h new file mode 100644 index 0000000..fca00a7 --- /dev/null +++ b/WebCore/platform/graphics/wince/PlatformPathWince.h @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef PlatformPathWince_h +#define PlatformPathWince_h + +namespace WebCore { + + class GraphicsContext; + + struct PathPoint { + float m_x; + float m_y; + const float& x() const { return m_x; } + const float& y() const { return m_y; } + void set(float x, float y) + { + m_x = x; + m_y = y; + }; + operator FloatPoint() const { return FloatPoint(m_x, m_y); } + void move(const FloatSize& offset) + { + m_x += offset.width(); + m_y += offset.height(); + } + PathPoint& operator=(const FloatPoint& p) + { + m_x = p.x(); + m_y = p.y(); + return *this; + } + void clear() { m_x = m_y = 0; } + }; + + struct PathPolygon: public Vector<PathPoint> { + void move(const FloatSize& offset); + void transform(const TransformationMatrix& t); + bool contains(const FloatPoint& point) const; + }; + + class PlatformPathElement { + public: + enum PlaformPathElementType { + PathMoveTo, + PathLineTo, + PathArcTo, + PathQuadCurveTo, + PathBezierCurveTo, + PathCloseSubpath, + }; + + struct MoveTo { + PathPoint m_end; + }; + + struct LineTo { + PathPoint m_end; + }; + + struct ArcTo { + PathPoint m_end; + PathPoint m_center; + PathPoint m_radius; + bool m_clockwise; + }; + + struct QuadCurveTo { + PathPoint m_point0; + PathPoint m_point1; + }; + + struct BezierCurveTo { + PathPoint m_point0; + PathPoint m_point1; + PathPoint m_point2; + }; + + PlatformPathElement(): m_type(PathCloseSubpath) { m_data.m_points[0].set(0, 0); } + PlatformPathElement(const MoveTo& data): m_type(PathMoveTo) { m_data.m_moveToData = data; } + PlatformPathElement(const LineTo& data): m_type(PathLineTo) { m_data.m_lineToData = data; } + PlatformPathElement(const ArcTo& data): m_type(PathArcTo) { m_data.m_arcToData = data; } + PlatformPathElement(const QuadCurveTo& data): m_type(PathQuadCurveTo) { m_data.m_quadCurveToData = data; } + PlatformPathElement(const BezierCurveTo& data): m_type(PathBezierCurveTo) { m_data.m_bezierCurveToData = data; } + + const MoveTo& moveTo() const { return m_data.m_moveToData; } + const LineTo& lineTo() const { return m_data.m_lineToData; } + const ArcTo& arcTo() const { return m_data.m_arcToData; } + const QuadCurveTo& quadCurveTo() const { return m_data.m_quadCurveToData; } + const BezierCurveTo& bezierCurveTo() const { return m_data.m_bezierCurveToData; } + const PathPoint& lastPoint() const + { + int n = numPoints(); + return n > 1 ? m_data.m_points[n - 1] : m_data.m_points[0]; + } + const PathPoint& pointAt(int index) const { return m_data.m_points[index]; } + int numPoints() const; + int numControlPoints() const; + void move(const FloatSize& offset); + void transform(const TransformationMatrix& t); + PathElementType type() const; + PlaformPathElementType platformType() const { return m_type; } + void inflateRectToContainMe(FloatRect& r, const FloatPoint& lastPoint) const; + + private: + PlaformPathElementType m_type; + union { + MoveTo m_moveToData; + LineTo m_lineToData; + ArcTo m_arcToData; + QuadCurveTo m_quadCurveToData; + BezierCurveTo m_bezierCurveToData; + PathPoint m_points[4]; + } m_data; + }; + + typedef Vector<PlatformPathElement> PlatformPathElements; + + class PlatformPath { + public: + PlatformPath(); + const PlatformPathElements& elements() const { return m_elements; } + void append(const PlatformPathElement& e); + void append(const PlatformPath& p); + void clear(); + bool isEmpty() const { return m_elements.isEmpty(); } + + void strokePath(HDC, const TransformationMatrix* tr) const; + void fillPath(HDC, const TransformationMatrix* tr) const; + FloatPoint lastPoint() const { return m_elements.isEmpty() ? FloatPoint(0, 0) : m_elements.last().lastPoint(); } + + const FloatRect& boundingRect() const { return m_boundingRect; } + bool contains(const FloatPoint& point, WindRule rule) const; + void translate(const FloatSize& size); + void transform(const TransformationMatrix& t); + + void moveTo(const FloatPoint&); + void addLineTo(const FloatPoint&); + void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& point); + void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint& controlPoint2, const FloatPoint&); + void addArcTo(const FloatPoint&, const FloatPoint&, float radius); + void closeSubpath(); + void addEllipse(const FloatPoint& p, float a, float b, float sar, float ear, bool anticlockwise); + void addRect(const FloatRect& r); + void addEllipse(const FloatRect& r); + String debugString() const; + void apply(void* info, PathApplierFunction function) const; + + private: + void ensureSubpath(); + void addToSubpath(const PlatformPathElement& e); + + PlatformPathElements m_elements; + FloatRect m_boundingRect; + Vector<PathPolygon> m_subpaths; + PathPoint m_currentPoint; + bool m_penLifted; + }; + +} + +#endif // PlatformPathWince_h diff --git a/WebCore/platform/graphics/wince/WinceGraphicsExtras.h b/WebCore/platform/graphics/wince/WinceGraphicsExtras.h new file mode 100644 index 0000000..2a6fae1 --- /dev/null +++ b/WebCore/platform/graphics/wince/WinceGraphicsExtras.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2009 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WinceGraphicsExtras_h +#define WinceGraphicsExtras_h + +// This file is used to contain small utilities used by WINCE graphics code. + +namespace WebCore { + // Always round to same direction. 0.5 is rounded to 1, + // and -0.5 (0.5 - 1) is rounded to 0 (1 - 1), so that it + // is consistent when transformation shifts. + static inline int stableRound(double d) + { + if (d > 0) + return static_cast<int>(d + 0.5); + + int i = static_cast<int>(d); + return i - d > 0.5 ? i - 1 : i; + } +} + +#endif WinceGraphicsExtras_h diff --git a/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/WebCore/platform/graphics/wx/ImageBufferWx.cpp index e71dbde..49f3f3b 100644 --- a/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -53,13 +53,24 @@ GraphicsContext* ImageBuffer::context() const return 0; } -PassRefPtr<ImageData> ImageBuffer::getImageData(const IntRect&) const +PassRefPtr<ImageData> ImageBuffer::getUnmultipliedImageData(const IntRect& rect) const { notImplemented(); return 0; } -void ImageBuffer::putImageData(ImageData*, const IntRect&, const IntPoint&) +PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect) const +{ + notImplemented(); + return 0; +} + +void ImageBuffer::putUnmultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) +{ + notImplemented(); +} + +void ImageBuffer::putPremultipliedImageData(ImageData* source, const IntRect& sourceRect, const IntPoint& destPoint) { notImplemented(); } diff --git a/WebCore/platform/graphics/wx/ImageSourceWx.cpp b/WebCore/platform/graphics/wx/ImageSourceWx.cpp deleted file mode 100644 index 06c165d..0000000 --- a/WebCore/platform/graphics/wx/ImageSourceWx.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Computer, Kevin Ollivier. 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 "ImageSource.h" - -#include "BMPImageDecoder.h" -#include "GIFImageDecoder.h" -#include "ICOImageDecoder.h" -#include "JPEGImageDecoder.h" -#include "NotImplemented.h" -#include "PNGImageDecoder.h" -#include "SharedBuffer.h" -#include "XBMImageDecoder.h" - -#include <wx/defs.h> -#include <wx/bitmap.h> -#if USE(WXGC) -#include <wx/graphics.h> -#endif -#include <wx/image.h> -#include <wx/rawbmp.h> - -namespace WebCore { - -ImageDecoder* createDecoder(const SharedBuffer& data) -{ - // We need at least 4 bytes to figure out what kind of image we're dealing with. - int length = data.size(); - if (length < 4) - return 0; - - const unsigned char* uContents = (const unsigned char*)data.data(); - const char* contents = data.data(); - - // GIFs begin with GIF8(7 or 9). - if (strncmp(contents, "GIF8", 4) == 0) - return new GIFImageDecoder(); - - // Test for PNG. - if (uContents[0]==0x89 && - uContents[1]==0x50 && - uContents[2]==0x4E && - uContents[3]==0x47) - return new PNGImageDecoder(); - - // JPEG - if (uContents[0]==0xFF && - uContents[1]==0xD8 && - uContents[2]==0xFF) - return new JPEGImageDecoder(); - - // BMP - if (strncmp(contents, "BM", 2) == 0) - return new BMPImageDecoder(); - - // ICOs always begin with a 2-byte 0 followed by a 2-byte 1. - // CURs begin with 2-byte 0 followed by 2-byte 2. - if (!memcmp(contents, "\000\000\001\000", 4) || - !memcmp(contents, "\000\000\002\000", 4)) - return new ICOImageDecoder(); - - // XBMs require 8 bytes of info. - if (length >= 8 && strncmp(contents, "#define ", 8) == 0) - return new XBMImageDecoder(); - - // Give up. We don't know what the heck this is. - return 0; -} - -ImageSource::ImageSource() - : m_decoder(0) -{} - -ImageSource::~ImageSource() -{ - clear(true); -} - -bool ImageSource::initialized() const -{ - return m_decoder; -} - -void ImageSource::setData(SharedBuffer* data, bool allDataReceived) -{ - // Make the decoder by sniffing the bytes. - // This method will examine the data and instantiate an instance of the appropriate decoder plugin. - // If insufficient bytes are available to determine the image type, no decoder plugin will be - // made. - if (m_decoder) - delete m_decoder; - m_decoder = createDecoder(*data); - if (!m_decoder) - return; - m_decoder->setData(data, allDataReceived); -} - -bool ImageSource::isSizeAvailable() -{ - if (!m_decoder) - return false; - - return m_decoder->isSizeAvailable(); -} - -IntSize ImageSource::size() const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->size(); -} - -IntSize ImageSource::frameSizeAtIndex(size_t index) const -{ - if (!m_decoder) - return IntSize(); - - return m_decoder->frameSizeAtIndex(index); -} - -int ImageSource::repetitionCount() -{ - if (!m_decoder) - return cAnimationNone; - - return m_decoder->repetitionCount(); -} - -String ImageSource::filenameExtension() const -{ - notImplemented(); - return String(); -} - -size_t ImageSource::frameCount() const -{ - return m_decoder ? m_decoder->frameCount() : 0; -} - -bool ImageSource::frameIsCompleteAtIndex(size_t index) -{ - // FIXME: should we be testing the RGBA32Buffer's status as well? - return (m_decoder && m_decoder->frameBufferAtIndex(index) != 0); -} - -void ImageSource::clear(bool destroyAll, size_t clearBeforeFrame, SharedBuffer* data, bool allDataReceived) -{ - if (!destroyAll) { - if (m_decoder) - m_decoder->clearFrameBufferCache(clearBeforeFrame); - return; - } - - delete m_decoder; - m_decoder = 0; - if (data) - setData(data, allDataReceived); -} - -NativeImagePtr ImageSource::createFrameAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - return buffer->asNewNativeImage(); -} - -float ImageSource::frameDurationAtIndex(size_t index) -{ - if (!m_decoder) - return 0; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return 0; - - float duration = buffer->duration() / 1000.0f; - - // Follow other ports (and WinIE's) behavior to slow annoying ads that - // specify a 0 duration. - if (duration < 0.051f) - return 0.100f; - return duration; -} - -bool ImageSource::frameHasAlphaAtIndex(size_t index) -{ - if (!m_decoder || !m_decoder->supportsAlpha()) - return false; - - RGBA32Buffer* buffer = m_decoder->frameBufferAtIndex(index); - if (!buffer || buffer->status() == RGBA32Buffer::FrameEmpty) - return false; - - return buffer->hasAlpha(); -} - -} diff --git a/WebCore/platform/gtk/ClipboardGtk.cpp b/WebCore/platform/gtk/ClipboardGtk.cpp index 8cbf590..450966e 100644 --- a/WebCore/platform/gtk/ClipboardGtk.cpp +++ b/WebCore/platform/gtk/ClipboardGtk.cpp @@ -17,11 +17,18 @@ #include "config.h" #include "ClipboardGtk.h" +#include "CachedImage.h" +#include "CString.h" +#include "Editor.h" +#include "Element.h" #include "FileList.h" +#include "Frame.h" +#include "markup.h" #include "NotImplemented.h" +#include "RenderImage.h" #include "StringHash.h" -#include "Editor.h" +#include <gtk/gtk.h> namespace WebCore { @@ -33,12 +40,10 @@ PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) ClipboardGtk::ClipboardGtk(ClipboardAccessPolicy policy, bool forDragging) : Clipboard(policy, forDragging) { - notImplemented(); } ClipboardGtk::~ClipboardGtk() { - notImplemented(); } void ClipboardGtk::clearData(const String&) @@ -110,19 +115,65 @@ DragImageRef ClipboardGtk::createDragImage(IntPoint&) const return 0; } -void ClipboardGtk::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +static CachedImage* getCachedImage(Element* element) { - notImplemented(); + // Attempt to pull CachedImage from element + ASSERT(element); + RenderObject* renderer = element->renderer(); + if (!renderer || !renderer->isImage()) + return 0; + + RenderImage* image = static_cast<RenderImage*>(renderer); + if (image->cachedImage() && !image->cachedImage()->errorOccurred()) + return image->cachedImage(); + + return 0; } -void ClipboardGtk::writeURL(const KURL&, const String&, Frame*) +void ClipboardGtk::declareAndWriteDragImage(Element* element, const KURL& url, const String& label, Frame*) { - notImplemented(); + CachedImage* cachedImage = getCachedImage(element); + if (!cachedImage || !cachedImage->isLoaded()) + return; + + GdkPixbuf* pixbuf = cachedImage->image()->getGdkPixbuf(); + if (!pixbuf) + return; + + GtkClipboard* imageClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardImage")); + gtk_clipboard_clear(imageClipboard); + + gtk_clipboard_set_image(imageClipboard, pixbuf); + g_object_unref(pixbuf); + + writeURL(url, label, 0); } -void ClipboardGtk::writeRange(Range*, Frame*) +void ClipboardGtk::writeURL(const KURL& url, const String& label, Frame*) { - notImplemented(); + GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); + GtkClipboard* urlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrl")); + GtkClipboard* urlLabelClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardUrlLabel")); + + gtk_clipboard_clear(textClipboard); + gtk_clipboard_clear(urlClipboard); + gtk_clipboard_clear(urlLabelClipboard); + + gtk_clipboard_set_text(textClipboard, url.string().utf8().data(), -1); + gtk_clipboard_set_text(urlClipboard, url.string().utf8().data(), -1); + gtk_clipboard_set_text(urlLabelClipboard, label.utf8().data(), -1); +} + +void ClipboardGtk::writeRange(Range* range, Frame* frame) +{ + GtkClipboard* textClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardText")); + GtkClipboard* htmlClipboard = gtk_clipboard_get(gdk_atom_intern_static_string("WebKitClipboardHtml")); + + gtk_clipboard_clear(textClipboard); + gtk_clipboard_clear(htmlClipboard); + + gtk_clipboard_set_text(textClipboard, frame->selectedText().utf8().data(), -1); + gtk_clipboard_set_text(htmlClipboard, createMarkup(range, 0, AnnotateForInterchange).utf8().data(), -1); } bool ClipboardGtk::hasData() diff --git a/WebCore/platform/gtk/ClipboardGtk.h b/WebCore/platform/gtk/ClipboardGtk.h index 7314ae4..bb21d92 100644 --- a/WebCore/platform/gtk/ClipboardGtk.h +++ b/WebCore/platform/gtk/ClipboardGtk.h @@ -24,8 +24,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef ClipboardGdk_h -#define ClipboardGdk_h +#ifndef ClipboardGtk_h +#define ClipboardGtk_h #include "Clipboard.h" diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp index 9f72923..6949b0a 100644 --- a/WebCore/platform/gtk/PasteboardGtk.cpp +++ b/WebCore/platform/gtk/PasteboardGtk.cpp @@ -35,13 +35,6 @@ namespace WebCore { -/* FIXME: we must get rid of this and use the enum in webkitwebview.h someway */ -typedef enum -{ - WEBKIT_WEB_VIEW_TARGET_INFO_HTML = - 1, - WEBKIT_WEB_VIEW_TARGET_INFO_TEXT = - 2 -} WebKitWebViewTargetInfo; - class PasteboardSelectionData { public: PasteboardSelectionData(gchar* text, gchar* markup) @@ -65,11 +58,11 @@ static void clipboard_get_contents_cb(GtkClipboard *clipboard, GtkSelectionData guint info, gpointer data) { PasteboardSelectionData* clipboardData = reinterpret_cast<PasteboardSelectionData*>(data); ASSERT(clipboardData); - if ((gint)info == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) { + if ((gint)info == Pasteboard::generalPasteboard()->m_helper->getWebViewTargetInfoHtml()) gtk_selection_data_set(selection_data, selection_data->target, 8, reinterpret_cast<const guchar*>(clipboardData->markup()), g_utf8_strlen(clipboardData->markup(), -1)); - } else + else gtk_selection_data_set_text(selection_data, clipboardData->text(), -1); } diff --git a/WebCore/platform/gtk/PasteboardHelper.h b/WebCore/platform/gtk/PasteboardHelper.h index 9943a2d..8e67127 100644 --- a/WebCore/platform/gtk/PasteboardHelper.h +++ b/WebCore/platform/gtk/PasteboardHelper.h @@ -43,6 +43,7 @@ public: virtual GtkClipboard* getPrimary(Frame*) const = 0; virtual GtkTargetList* getCopyTargetList(Frame*) const = 0; virtual GtkTargetList* getPasteTargetList(Frame*) const = 0; + virtual gint getWebViewTargetInfoHtml() const = 0; }; } diff --git a/WebCore/platform/haiku/ClipboardHaiku.cpp b/WebCore/platform/haiku/ClipboardHaiku.cpp index 845c08c..a62c30c 100644 --- a/WebCore/platform/haiku/ClipboardHaiku.cpp +++ b/WebCore/platform/haiku/ClipboardHaiku.cpp @@ -27,8 +27,8 @@ #include "config.h" #include "ClipboardHaiku.h" -#include "IntPoint.h" #include "FileList.h" +#include "IntPoint.h" #include "NotImplemented.h" #include "PlatformString.h" #include "StringHash.h" @@ -42,7 +42,7 @@ namespace WebCore { -ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, bool forDragging) +ClipboardHaiku::ClipboardHaiku(ClipboardAccessPolicy policy, bool forDragging) : Clipboard(policy, forDragging) { } @@ -61,7 +61,7 @@ void ClipboardHaiku::clearData(const String& type) } } -void ClipboardHaiku::clearAllData() +void ClipboardHaiku::clearAllData() { if (be_clipboard->Lock()) { be_clipboard->Clear(); @@ -70,7 +70,7 @@ void ClipboardHaiku::clearAllData() } } -String ClipboardHaiku::getData(const String& type, bool& success) const +String ClipboardHaiku::getData(const String& type, bool& success) const { BString result; success = false; @@ -88,7 +88,7 @@ String ClipboardHaiku::getData(const String& type, bool& success) const return result; } -bool ClipboardHaiku::setData(const String& type, const String& data) +bool ClipboardHaiku::setData(const String& type, const String& data) { bool result = false; @@ -110,7 +110,7 @@ bool ClipboardHaiku::setData(const String& type, const String& data) } // Extensions beyond IE's API. -HashSet<String> ClipboardHaiku::types() const +HashSet<String> ClipboardHaiku::types() const { HashSet<String> result; @@ -138,27 +138,27 @@ PassRefPtr<FileList> ClipboardHaiku::files() const return 0; } -IntPoint ClipboardHaiku::dragLocation() const -{ +IntPoint ClipboardHaiku::dragLocation() const +{ notImplemented(); return IntPoint(0, 0); } -CachedImage* ClipboardHaiku::dragImage() const +CachedImage* ClipboardHaiku::dragImage() const { notImplemented(); - return 0; + return 0; } -void ClipboardHaiku::setDragImage(CachedImage*, const IntPoint&) +void ClipboardHaiku::setDragImage(CachedImage*, const IntPoint&) { notImplemented(); } -Node* ClipboardHaiku::dragImageElement() +Node* ClipboardHaiku::dragImageElement() { notImplemented(); - return 0; + return 0; } void ClipboardHaiku::setDragImageElement(Node*, const IntPoint&) @@ -167,27 +167,27 @@ void ClipboardHaiku::setDragImageElement(Node*, const IntPoint&) } DragImageRef ClipboardHaiku::createDragImage(IntPoint& dragLocation) const -{ +{ notImplemented(); return 0; } -void ClipboardHaiku::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) +void ClipboardHaiku::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) { notImplemented(); } -void ClipboardHaiku::writeURL(const KURL&, const String&, Frame*) +void ClipboardHaiku::writeURL(const KURL&, const String&, Frame*) { notImplemented(); } -void ClipboardHaiku::writeRange(Range*, Frame*) +void ClipboardHaiku::writeRange(Range*, Frame*) { notImplemented(); } -bool ClipboardHaiku::hasData() +bool ClipboardHaiku::hasData() { bool result = false; diff --git a/WebCore/platform/haiku/ContextMenuHaiku.cpp b/WebCore/platform/haiku/ContextMenuHaiku.cpp index 03b8978..b978433 100644 --- a/WebCore/platform/haiku/ContextMenuHaiku.cpp +++ b/WebCore/platform/haiku/ContextMenuHaiku.cpp @@ -27,30 +27,27 @@ #include "config.h" #include "ContextMenu.h" -#include "ContextMenuItem.h" #include "ContextMenuController.h" +#include "ContextMenuItem.h" +#include "Document.h" #include "Frame.h" #include "FrameView.h" -#include "Document.h" - -#include <wtf/Assertions.h> - #include <Looper.h> #include <Menu.h> #include <Message.h> +#include <wtf/Assertions.h> namespace WebCore { // FIXME: This class isn't used yet -class ContextMenuReceiver : public BLooper -{ +class ContextMenuReceiver : public BLooper { public: ContextMenuReceiver(ContextMenu* menu) : BLooper("context_menu_receiver") , m_menu(menu) + , m_result(-1) { - m_result = -1; } void HandleMessage(BMessage* msg) @@ -80,21 +77,8 @@ private: ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) - , m_platformDescription(NULL) + , m_platformDescription(new BMenu("context_menu")) { - /* Get position */ - if (result.innerNode() && result.innerNode()->document()) { - BView* view = result.innerNode()->document()->frame()->view()->platformWidget(); - int child = 0; - while (view->ChildAt(child)) { - if (view->ChildAt(child)->Name() == "scroll_view_canvas") { - m_point = view->ChildAt(child)->ConvertToScreen(BPoint(result.point().x(), result.point().y())); - break; - } - child++; - } - } - m_platformDescription = new BMenu("context_menu"); } ContextMenu::~ContextMenu() @@ -106,9 +90,9 @@ void ContextMenu::appendItem(ContextMenuItem& item) { checkOrEnableIfNeeded(item); - BMenuItem* bItem = item.releasePlatformDescription(); - if (bItem) - m_platformDescription->AddItem(bItem); + BMenuItem* menuItem = item.releasePlatformDescription(); + if (menuItem) + m_platformDescription->AddItem(menuItem); } unsigned ContextMenu::itemCount() const @@ -120,9 +104,9 @@ void ContextMenu::insertItem(unsigned position, ContextMenuItem& item) { checkOrEnableIfNeeded(item); - BMenuItem* bItem = item.releasePlatformDescription(); - if (bItem) - m_platformDescription->AddItem(bItem, position); + BMenuItem* menuItem = item.releasePlatformDescription(); + if (menuItem) + m_platformDescription->AddItem(menuItem, position); } PlatformMenuDescription ContextMenu::platformDescription() const diff --git a/WebCore/platform/haiku/CookieJarHaiku.cpp b/WebCore/platform/haiku/CookieJarHaiku.cpp index 73519d7..831b379 100644 --- a/WebCore/platform/haiku/CookieJarHaiku.cpp +++ b/WebCore/platform/haiku/CookieJarHaiku.cpp @@ -29,6 +29,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "KURL.h" #include "PlatformString.h" #include "StringHash.h" @@ -41,21 +42,33 @@ namespace WebCore { // FIXME: Shouldn't this be saved to and restored from disk too? static HashMap<String, String> cookieJar; -void setCookies(const KURL& url, const KURL& /*policyURL*/, const String& value) +void setCookies(Document*, const KURL& url, const String& value) { cookieJar.set(url.string(), value); } -String cookies(const KURL& url) +String cookies(const Document*, const KURL& url) { return cookieJar.get(url.string()); } -bool cookiesEnabled() +bool cookiesEnabled(const Document*) { // FIXME: This should probably be a setting return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // namespace WebCore diff --git a/WebCore/platform/haiku/DragDataHaiku.cpp b/WebCore/platform/haiku/DragDataHaiku.cpp index b42b311..4a20147 100644 --- a/WebCore/platform/haiku/DragDataHaiku.cpp +++ b/WebCore/platform/haiku/DragDataHaiku.cpp @@ -27,10 +27,9 @@ #include "config.h" #include "DragData.h" +#include "ClipboardHaiku.h" #include "Document.h" #include "DocumentFragment.h" -#include "ClipboardHaiku.h" - #include "NotImplemented.h" @@ -79,7 +78,7 @@ Color DragData::asColor() const WTF::PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const { - return new ClipboardHaiku(policy, true); + return ClipboardHaiku::create(policy, true); } bool DragData::containsCompatibleContent() const @@ -104,6 +103,6 @@ PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const notImplemented(); return 0; } - + } // namespace WebCore diff --git a/WebCore/platform/haiku/LocalizedStringsHaiku.cpp b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp new file mode 100644 index 0000000..a37ffcc --- /dev/null +++ b/WebCore/platform/haiku/LocalizedStringsHaiku.cpp @@ -0,0 +1,346 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "LocalizedStrings.h" + +#include "PlatformString.h" + + +namespace WebCore { +String submitButtonDefaultLabel() +{ + return "Submit"; +} + +String inputElementAltText() +{ + return String(); +} + +String resetButtonDefaultLabel() +{ + return "Reset"; +} + +String defaultLanguage() +{ + return "en"; +} + +String searchableIndexIntroduction() +{ + return "Searchable Index"; +} + +String fileButtonChooseFileLabel() +{ + return "Choose File"; +} + +String fileButtonNoFileSelectedLabel() +{ + return "No file selected"; +} + +String contextMenuItemTagOpenLinkInNewWindow() +{ + return "Open in new tab"; +} + +String contextMenuItemTagDownloadLinkToDisk() +{ + return "Download link to disk"; +} + +String contextMenuItemTagCopyLinkToClipboard() +{ + return "Copy link to clipboard"; +} + +String contextMenuItemTagOpenImageInNewWindow() +{ + return "Open image in new window"; +} + +String contextMenuItemTagDownloadImageToDisk() +{ + return "Download image to disk"; +} + +String contextMenuItemTagCopyImageToClipboard() +{ + return "Copy image to clipboard"; +} + +String contextMenuItemTagOpenFrameInNewWindow() +{ + return "Open frame in new window"; +} + +String contextMenuItemTagCopy() +{ + return "Copy"; +} + +String contextMenuItemTagGoBack() +{ + return "Go back"; +} + +String contextMenuItemTagGoForward() +{ + return "Go forward"; +} + +String contextMenuItemTagStop() +{ + return "Stop"; +} + +String contextMenuItemTagReload() +{ + return "Reload"; +} + +String contextMenuItemTagCut() +{ + return "Cut"; +} + +String contextMenuItemTagPaste() +{ + return "Paste"; +} + +String contextMenuItemTagNoGuessesFound() +{ + return "No guesses found"; +} + +String contextMenuItemTagIgnoreSpelling() +{ + return "Ignore spelling"; +} + +String contextMenuItemTagLearnSpelling() +{ + return "Learn spelling"; +} + +String contextMenuItemTagSearchWeb() +{ + return "Search web"; +} + +String contextMenuItemTagLookUpInDictionary() +{ + return "Lookup in dictionary"; +} + +String contextMenuItemTagOpenLink() +{ + return "Open link"; +} + +String contextMenuItemTagIgnoreGrammar() +{ + return "Ignore grammar"; +} + +String contextMenuItemTagSpellingMenu() +{ + return "Spelling menu"; +} + +String contextMenuItemTagShowSpellingPanel(bool show) +{ + return "Show spelling panel"; +} + +String contextMenuItemTagCheckSpelling() +{ + return "Check spelling"; +} + +String contextMenuItemTagCheckSpellingWhileTyping() +{ + return "Check spelling while typing"; +} + +String contextMenuItemTagCheckGrammarWithSpelling() +{ + return "Check for grammar with spelling"; +} + +String contextMenuItemTagFontMenu() +{ + return "Font menu"; +} + +String contextMenuItemTagBold() +{ + return "Bold"; +} + +String contextMenuItemTagItalic() +{ + return "Italic"; +} + +String contextMenuItemTagUnderline() +{ + return "Underline"; +} + +String contextMenuItemTagOutline() +{ + return "Outline"; +} + +String contextMenuItemTagWritingDirectionMenu() +{ + return "Writing direction menu"; +} + +String contextMenuItemTagDefaultDirection() +{ + return "Default direction"; +} + +String contextMenuItemTagLeftToRight() +{ + return "Left to right"; +} + +String contextMenuItemTagRightToLeft() +{ + return "Right to left"; +} + +String contextMenuItemTagInspectElement() +{ + return "Inspect"; +} + +String searchMenuNoRecentSearchesText() +{ + return "No recent text searches"; +} + +String searchMenuRecentSearchesText() +{ + return "Recent text searches"; +} + +String searchMenuClearRecentSearchesText() +{ + return "Clear recent text searches"; +} + +String unknownFileSizeText() +{ + return "Unknown"; +} + +String AXWebAreaText() +{ + return String(); +} + +String AXLinkText() +{ + return String(); +} + +String AXListMarkerText() +{ + return String(); +} + +String AXImageMapText() +{ + return String(); +} + +String AXHeadingText() +{ + return String(); +} + +String imageTitle(const String& filename, const IntSize& size) +{ + return String(filename); +} + +String contextMenuItemTagTextDirectionMenu() +{ + return String(); +} + +String AXButtonActionVerb() +{ + return String(); +} + +String AXTextFieldActionVerb() +{ + return String(); +} + +String AXRadioButtonActionVerb() +{ + return String(); +} + +String AXCheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXUncheckedCheckBoxActionVerb() +{ + return String(); +} + +String AXLinkActionVerb() +{ + return String(); +} + +String AXDefinitionListTermText() +{ + return String(); +} + +String AXDefinitionListDefinitionText() +{ + return String(); +} + +} // namespace WebCore + diff --git a/WebCore/platform/haiku/LoggingHaiku.cpp b/WebCore/platform/haiku/LoggingHaiku.cpp new file mode 100644 index 0000000..f09c483 --- /dev/null +++ b/WebCore/platform/haiku/LoggingHaiku.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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 "Logging.h" + + +namespace WebCore { + +void InitializeLoggingChannelsIfNecessary() +{ + // FIXME: Should read the logging channels from a file. + static bool haveInitializedLoggingChannels = false; + if (haveInitializedLoggingChannels) + return; + + haveInitializedLoggingChannels = true; + + LogEvents.state = WTFLogChannelOn; + LogFrames.state = WTFLogChannelOn; + LogLoading.state = WTFLogChannelOn; + LogPlatformLeaks.state = WTFLogChannelOn; +} + +} // namespace WebCore + diff --git a/WebCore/platform/haiku/RenderThemeHaiku.cpp b/WebCore/platform/haiku/RenderThemeHaiku.cpp new file mode 100644 index 0000000..4327795 --- /dev/null +++ b/WebCore/platform/haiku/RenderThemeHaiku.cpp @@ -0,0 +1,178 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> + * 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2007 Ryan Leavengood <leavengood@gmail.com> + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" +#include "RenderThemeHaiku.h" + +#include "GraphicsContext.h" +#include "NotImplemented.h" +#include <ControlLook.h> +#include <View.h> + + +namespace WebCore { + +PassRefPtr<RenderTheme> RenderThemeHaiku::create() +{ + return adoptRef(new RenderThemeHaiku()); +} + +PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page*) +{ + static RenderTheme* renderTheme = RenderThemeHaiku::create().releaseRef(); + return renderTheme; +} + +RenderThemeHaiku::RenderThemeHaiku() +{ +} + +RenderThemeHaiku::~RenderThemeHaiku() +{ +} + +static bool supportsFocus(ControlPart appearance) +{ + switch (appearance) { + case PushButtonPart: + case ButtonPart: + case TextFieldPart: + case TextAreaPart: + case SearchFieldPart: + case MenulistPart: + case RadioPart: + case CheckboxPart: + return true; + default: + return false; + } +} + +bool RenderThemeHaiku::supportsFocusRing(const RenderStyle* style) const +{ + return supportsFocus(style->appearance()); +} + +Color RenderThemeHaiku::platformActiveSelectionBackgroundColor() const +{ + return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); +} + +Color RenderThemeHaiku::platformInactiveSelectionBackgroundColor() const +{ + return Color(ui_color(B_CONTROL_HIGHLIGHT_COLOR)); +} + +Color RenderThemeHaiku::platformActiveSelectionForegroundColor() const +{ + return Color(ui_color(B_CONTROL_TEXT_COLOR)); +} + +Color RenderThemeHaiku::platformInactiveSelectionForegroundColor() const +{ + return Color(ui_color(B_CONTROL_TEXT_COLOR)); +} + +Color RenderThemeHaiku::platformTextSearchHighlightColor() const +{ + return Color(ui_color(B_MENU_SELECTED_BACKGROUND_COLOR)); +} + +void RenderThemeHaiku::systemFont(int propId, FontDescription&) const +{ + notImplemented(); +} + +bool RenderThemeHaiku::paintCheckbox(RenderObject*, const RenderObject::PaintInfo& info, const IntRect& intRect) +{ + if (info.context->paintingDisabled()) + return false; + + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + BRect rect = intRect; + BView* view = info.context->platformContext(); + + if (!be_control_look) + return false; + + be_control_look->DrawCheckBox(view, rect, rect, base); + return true; +} + +void RenderThemeHaiku::setCheckboxSize(RenderStyle* style) const +{ + int size = 10; + + // If the width and height are both specified, then we have nothing to do. + if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) + return; + + // FIXME: A hard-coded size of 'size' is used. This is wrong but necessary for now. + if (style->width().isIntrinsicOrAuto()) + style->setWidth(Length(size, Fixed)); + + if (style->height().isAuto()) + style->setHeight(Length(size, Fixed)); +} + +bool RenderThemeHaiku::paintRadio(RenderObject*, const RenderObject::PaintInfo& info, const IntRect& intRect) +{ + if (info.context->paintingDisabled()) + return false; + + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + BRect rect = intRect; + BView* view = info.context->platformContext(); + + if (!be_control_look) + return false; + + be_control_look->DrawRadioButton(view, rect, rect, base); + return true; +} + +void RenderThemeHaiku::setRadioSize(RenderStyle* style) const +{ + // This is the same as checkboxes. + setCheckboxSize(style); +} + +void RenderThemeHaiku::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const +{ + // Leave some space for the arrow. + style->setPaddingRight(Length(22, Fixed)); + const int minHeight = 20; + style->setMinHeight(Length(minHeight, Fixed)); +} + +bool RenderThemeHaiku::paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) +{ + notImplemented(); + return false; +} + +} // namespace WebCore diff --git a/WebCore/platform/haiku/RenderThemeHaiku.h b/WebCore/platform/haiku/RenderThemeHaiku.h new file mode 100644 index 0000000..7daebc4 --- /dev/null +++ b/WebCore/platform/haiku/RenderThemeHaiku.h @@ -0,0 +1,70 @@ +/* + * This file is part of the WebKit project. + * + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef RenderThemeHaiku_h +#define RenderThemeHaiku_h + +#include "RenderTheme.h" + +namespace WebCore { + + class RenderThemeHaiku : public RenderTheme { + private: + RenderThemeHaiku(); + virtual ~RenderThemeHaiku(); + + public: + static PassRefPtr<RenderTheme> create(); + + // A method asking if the theme's controls actually care about redrawing when hovered. + virtual bool supportsHover(const RenderStyle* style) const { return false; } + + // A method asking if the theme is able to draw the focus ring. + virtual bool supportsFocusRing(const RenderStyle*) const; + + // The platform selection color. + virtual Color platformActiveSelectionBackgroundColor() const; + virtual Color platformInactiveSelectionBackgroundColor() const; + virtual Color platformActiveSelectionForegroundColor() const; + virtual Color platformInactiveSelectionForegroundColor() const; + + virtual Color platformTextSearchHighlightColor() const; + + // System fonts. + virtual void systemFont(int propId, FontDescription&) const; + + protected: + virtual bool paintCheckbox(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void setCheckboxSize(RenderStyle*) const; + + virtual bool paintRadio(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + virtual void setRadioSize(RenderStyle*) const; + + virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; + virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); + }; + +} // namespace WebCore + +#endif // RenderThemeHaiku_h diff --git a/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp b/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp new file mode 100644 index 0000000..8adab3d --- /dev/null +++ b/WebCore/platform/haiku/ScrollbarThemeHaiku.cpp @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright 2009 Maxime Simon <simon.maxime@gmail.com> All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 "ScrollbarThemeHaiku.h" + +#include "GraphicsContext.h" +#include "Scrollbar.h" +#include <ControlLook.h> +#include <InterfaceDefs.h> + + +int buttonWidth(int scrollbarWidth, int thickness) +{ + return scrollbarWidth < 2 * thickness ? scrollbarWidth / 2 : thickness; +} + +namespace WebCore { + +ScrollbarTheme* ScrollbarTheme::nativeTheme() +{ + static ScrollbarThemeHaiku theme; + return &theme; +} + +ScrollbarThemeHaiku::ScrollbarThemeHaiku() +{ +} + +ScrollbarThemeHaiku::~ScrollbarThemeHaiku() +{ +} + +int ScrollbarThemeHaiku::scrollbarThickness(ScrollbarControlSize controlSize) +{ + // FIXME: Should we make a distinction between a Small and a Regular Scrollbar? + return 16; +} + +bool ScrollbarThemeHaiku::hasButtons(Scrollbar* scrollbar) +{ + return scrollbar->enabled(); +} + +bool ScrollbarThemeHaiku::hasThumb(Scrollbar* scrollbar) +{ + return scrollbar->enabled() && thumbLength(scrollbar) > 0; +} + +IntRect ScrollbarThemeHaiku::backButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + if (part == BackButtonEndPart) + return IntRect(); + + int thickness = scrollbarThickness(); + IntPoint buttonOrigin(scrollbar->x(), scrollbar->y()); + IntSize buttonSize = scrollbar->orientation() == HorizontalScrollbar + ? IntSize(buttonWidth(scrollbar->width(), thickness), thickness) + : IntSize(thickness, buttonWidth(scrollbar->height(), thickness)); + IntRect buttonRect(buttonOrigin, buttonSize); + + return buttonRect; +} + +IntRect ScrollbarThemeHaiku::forwardButtonRect(Scrollbar* scrollbar, ScrollbarPart part, bool) +{ + if (part == BackButtonStartPart) + return IntRect(); + + int thickness = scrollbarThickness(); + if (scrollbar->orientation() == HorizontalScrollbar) { + int width = buttonWidth(scrollbar->width(), thickness); + return IntRect(scrollbar->x() + scrollbar->width() - width, scrollbar->y(), width, thickness); + } + + int height = buttonWidth(scrollbar->height(), thickness); + return IntRect(scrollbar->x(), scrollbar->y() + scrollbar->height() - height, thickness, height); +} + +IntRect ScrollbarThemeHaiku::trackRect(Scrollbar* scrollbar, bool) +{ + int thickness = scrollbarThickness(); + if (scrollbar->orientation() == HorizontalScrollbar) { + if (scrollbar->width() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x() + thickness, scrollbar->y(), scrollbar->width() - 2 * thickness, thickness); + } + if (scrollbar->height() < 2 * thickness) + return IntRect(); + return IntRect(scrollbar->x(), scrollbar->y() + thickness, thickness, scrollbar->height() - 2 * thickness); +} + +void ScrollbarThemeHaiku::paintScrollbarBackground(GraphicsContext* context, Scrollbar* scrollbar) +{ + if (!be_control_look) + return; + + BRect rect = trackRect(scrollbar, false); + orientation scrollbarOrientation = scrollbar->orientation() == HorizontalScrollbar ? B_HORIZONTAL : B_VERTICAL; + + be_control_look->DrawScrollBarBackground(context->platformContext(), rect, rect, ui_color(B_PANEL_BACKGROUND_COLOR), 0, scrollbarOrientation); +} + +void ScrollbarThemeHaiku::paintButton(GraphicsContext* context, Scrollbar* scrollbar, const IntRect& rect, ScrollbarPart part) +{ + if (!be_control_look) + return; + + BRect drawRect = BRect(rect); + BView* view = context->platformContext(); + rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + + be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor); + be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor); + + int arrowDirection; + if (scrollbar->orientation() == VerticalScrollbar) + arrowDirection = part == BackButtonStartPart ? BControlLook::B_UP_ARROW : BControlLook::B_DOWN_ARROW; + else + arrowDirection = part == BackButtonStartPart ? BControlLook::B_LEFT_ARROW : BControlLook::B_RIGHT_ARROW; + + be_control_look->DrawArrowShape(view, drawRect, drawRect, ui_color(B_CONTROL_TEXT_COLOR), arrowDirection); +} + +void ScrollbarThemeHaiku::paintThumb(GraphicsContext* context, Scrollbar*, const IntRect& rect) +{ + if (!be_control_look) + return; + + BRect drawRect = BRect(rect); + BView* view = context->platformContext(); + rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + + be_control_look->DrawButtonFrame(view, drawRect, drawRect, buttonBgColor, panelBgColor); + be_control_look->DrawButtonBackground(view, drawRect, drawRect, buttonBgColor); +} + +} + diff --git a/WebCore/platform/haiku/ScrollbarThemeHaiku.h b/WebCore/platform/haiku/ScrollbarThemeHaiku.h new file mode 100644 index 0000000..18e2cc0 --- /dev/null +++ b/WebCore/platform/haiku/ScrollbarThemeHaiku.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2008 Apple Inc. All Rights Reserved. + * Copyright 2009 Maxime Simon <simon.maxime@gmail.com> All Rights Reserved + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 ScrollbarThemeHaiku_h +#define ScrollbarThemeHaiku_h + +#include "ScrollbarThemeComposite.h" + +namespace WebCore { + class Scrollbar; + + class ScrollbarThemeHaiku : public ScrollbarThemeComposite { + public: + ScrollbarThemeHaiku(); + virtual ~ScrollbarThemeHaiku(); + + virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar); + + virtual bool hasButtons(Scrollbar*); + virtual bool hasThumb(Scrollbar*); + + virtual IntRect backButtonRect(Scrollbar*, ScrollbarPart, bool painting); + virtual IntRect forwardButtonRect(Scrollbar*, ScrollbarPart, bool painting); + virtual IntRect trackRect(Scrollbar*, bool painting); + + virtual void paintScrollbarBackground(GraphicsContext*, Scrollbar*); + virtual void paintButton(GraphicsContext*, Scrollbar*, const IntRect&, ScrollbarPart); + virtual void paintThumb(GraphicsContext*, Scrollbar*, const IntRect&); + }; + +} +#endif diff --git a/WebCore/platform/haiku/SharedBufferHaiku.cpp b/WebCore/platform/haiku/SharedBufferHaiku.cpp new file mode 100644 index 0000000..113cd2e --- /dev/null +++ b/WebCore/platform/haiku/SharedBufferHaiku.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2009 Maxime Simon <simon.maxime@gmail.com> + * + * 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 "SharedBuffer.h" + +#include <File.h> +#include <String.h> + +namespace WebCore { + +PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String& fileName) +{ + if (fileName.isEmpty()) + return 0; + + BFile file(BString(fileName).String(), B_READ_ONLY); + 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; + + file.Read(result->m_buffer.data(), result->m_buffer.size()); + return result.release(); +} + +} // namespace WebCore diff --git a/WebCore/platform/haiku/TemporaryLinkStubs.cpp b/WebCore/platform/haiku/TemporaryLinkStubs.cpp index 48380fc..aa3d538 100644 --- a/WebCore/platform/haiku/TemporaryLinkStubs.cpp +++ b/WebCore/platform/haiku/TemporaryLinkStubs.cpp @@ -33,40 +33,11 @@ #include "config.h" -#include "AXObjectCache.h" -#include "CachedResource.h" -#include "CookieJar.h" -#include "Cursor.h" -#include "DataGridColumnList.h" -#include "FileSystem.h" -#include "Font.h" -#include "Frame.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "History.h" -#include "IconLoader.h" -#include "InspectorController.h" -#include "IntPoint.h" #include "KURL.h" -#include "Language.h" -#include "Node.h" #include "NotImplemented.h" -#include "Path.h" -#include "PlatformMouseEvent.h" -#include "PlatformScrollBar.h" -#include "PluginInfoStore.h" -#include "RenderTheme.h" -#include "Screen.h" -#include "Scrollbar.h" -#include "ScrollbarTheme.h" -#include "SharedBuffer.h" -#include "TextBoundaries.h" -#include "Threading.h" -#include "Widget.h" -#include "loader.h" -#include <runtime/JSValue.h> -#include <stdio.h> -#include <stdlib.h> +#include "PlatformString.h" +#include "SSLKeyGenerator.h" +#include "SystemTime.h" using namespace WebCore; @@ -78,20 +49,14 @@ Vector<char> loadResourceIntoArray(const char*) namespace WebCore { -bool historyContains(String const&) +String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { - return false; + return String(); } -Vector<String> supportedKeySizes() +void getSupportedKeySizes(Vector<String>&) { notImplemented(); - return Vector<String>(); -} - -String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) -{ - return String(); } float userIdleTime() @@ -105,22 +70,11 @@ void callOnMainThread(void (*)()) notImplemented(); } -PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) -{ - notImplemented(); - return 0; -} - String KURL::fileSystemPath() const { notImplemented(); return String(); } -void getSupportedKeySizes(Vector<String>&) -{ - notImplemented(); -} - } // namespace WebCore diff --git a/WebCore/platform/image-decoders/ImageDecoder.cpp b/WebCore/platform/image-decoders/ImageDecoder.cpp new file mode 100644 index 0000000..9c723cc --- /dev/null +++ b/WebCore/platform/image-decoders/ImageDecoder.cpp @@ -0,0 +1,103 @@ +/*
+ * Copyright (C) 2008-2009 Torch Mobile, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
+
+#include "config.h"
+#include "ImageDecoder.h"
+
+#include <algorithm>
+
+namespace WebCore {
+
+namespace {
+
+enum MatchType {
+ Exact,
+ UpperBound,
+ LowerBound
+};
+
+}
+
+template <MatchType type> static int getScaledValue(const Vector<int>& scaledValues, int valueToMatch, int searchStart)
+{
+ const int* dataStart = scaledValues.data();
+ const int* dataEnd = dataStart + scaledValues.size();
+ const int* matched = std::lower_bound(dataStart + searchStart, dataEnd, valueToMatch);
+ switch (type) {
+ case Exact:
+ return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : -1;
+ case LowerBound:
+ return matched != dataEnd && *matched == valueToMatch ? matched - dataStart : matched - dataStart - 1;
+ case UpperBound:
+ default:
+ return matched != dataEnd ? matched - dataStart : -1;
+ }
+}
+
+int ImageDecoder::upperBoundScaledX(int origX, int searchStart)
+{
+ return getScaledValue<UpperBound>(m_scaledColumns, origX, searchStart);
+}
+
+int ImageDecoder::lowerBoundScaledX(int origX, int searchStart)
+{
+ return getScaledValue<LowerBound>(m_scaledColumns, origX, searchStart);
+}
+
+int ImageDecoder::scaledY(int origY, int searchStart)
+{
+ return getScaledValue<Exact>(m_scaledRows, origY, searchStart);
+}
+
+static inline void fillScaledValues(Vector<int>& scaledValues, double scaleRate, int length)
+{
+ double inflateRate = 1. / scaleRate;
+ scaledValues.reserveCapacity(static_cast<int>(length * scaleRate + 0.5));
+ for (int scaledIndex = 0;;) {
+ int index = static_cast<int>(scaledIndex * inflateRate + 0.5);
+ if (index < length) {
+ scaledValues.append(index);
+ ++scaledIndex;
+ } else
+ break;
+ }
+}
+
+void ImageDecoder::prepareScaleDataIfNecessary()
+{
+ int width = m_size.width();
+ int height = m_size.height();
+ int numPixels = height * width;
+ if (m_maxNumPixels <= 0 || numPixels <= m_maxNumPixels) {
+ m_scaled = false;
+ return;
+ }
+
+ m_scaled = true;
+ double scale = sqrt(m_maxNumPixels / (double)numPixels);
+ fillScaledValues(m_scaledColumns, scale, width);
+ fillScaledValues(m_scaledRows, scale, height);
+}
+
+}
+
+#endif // ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
diff --git a/WebCore/platform/image-decoders/ImageDecoder.h b/WebCore/platform/image-decoders/ImageDecoder.h index 57f8735..9256afe 100644 --- a/WebCore/platform/image-decoders/ImageDecoder.h +++ b/WebCore/platform/image-decoders/ImageDecoder.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -140,7 +141,7 @@ namespace WebCore { inline PixelData* getAddr(int x, int y) { -#if PLATFORM(CAIRO) || PLATFORM(WX) +#if PLATFORM(CAIRO) || PLATFORM(WX) || PLATFORM(HAIKU) return m_bytes.data() + (y * width()) + x; #elif (PLATFORM(SKIA) || PLATFORM(SGL)) return m_bitmap.getAddr32(x, y); @@ -166,7 +167,7 @@ namespace WebCore { } } -#if PLATFORM(CAIRO) || PLATFORM(WX) +#if PLATFORM(CAIRO) || PLATFORM(WX) || PLATFORM(HAIKU) Vector<PixelData> m_bytes; IntSize m_size; // The size of the buffer. This should be the // same as ImageDecoder::m_size. @@ -188,9 +189,17 @@ namespace WebCore { // and the base class manages the RGBA32 frame cache. class ImageDecoder { public: + // ENABLE(IMAGE_DECODER_DOWN_SAMPLING) allows image decoders to write directly to + // scaled output buffers by down sampling. Call setMaxNumPixels() to specify the + // biggest size that decoded images can have. Image decoders will deflate those + // images that are bigger than m_maxNumPixels. (Not supported by all image decoders yet) ImageDecoder() : m_failed(false) , m_sizeAvailable(false) +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , m_maxNumPixels(-1) + , m_scaled(false) +#endif { } @@ -272,8 +281,25 @@ namespace WebCore { // since in practice only GIFs will ever use this. virtual void clearFrameBufferCache(size_t clearBeforeFrame) { } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + void setMaxNumPixels(int m) { m_maxNumPixels = m; } +#endif + protected: +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + void prepareScaleDataIfNecessary(); + int upperBoundScaledX(int origX, int searchStart = 0); + int lowerBoundScaledX(int origX, int searchStart = 0); + int scaledY(int origY, int searchStart = 0); +#endif + RefPtr<SharedBuffer> m_data; // The encoded data. +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + int m_maxNumPixels; + Vector<int> m_scaledColumns; + Vector<int> m_scaledRows; + bool m_scaled; +#endif Vector<RGBA32Buffer> m_frameBufferCache; bool m_failed; diff --git a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp index e9296ad..bc4f357 100644 --- a/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp +++ b/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp @@ -249,7 +249,7 @@ bool ICOImageDecoder::processDirectory() ICON = 1, CURSOR = 2, }; - if (((fileType != ICON) && (fileType != CURSOR)) || (idCount == 0)) { + if (((fileType != ICON) && (fileType != CURSOR)) || (!idCount)) { setFailed(); return false; } @@ -303,10 +303,10 @@ ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() // matching uint8_ts) is so we can record dimensions of size 256 (which is // what a zero byte really means). int width = static_cast<uint8_t>(m_data->data()[m_decodedOffset]); - if (width == 0) + if (!width) width = 256; int height = static_cast<uint8_t>(m_data->data()[m_decodedOffset + 1]); - if (height == 0) + if (!height) height = 256; IconDirectoryEntry entry; entry.m_size = IntSize(width, height); @@ -318,11 +318,12 @@ ICOImageDecoder::IconDirectoryEntry ICOImageDecoder::readDirectoryEntry() // this isn't quite what the bitmap info header says later, as we only use // this value to determine which icon entry is best. if (!entry.m_bitCount) { - uint8_t colorCount = m_data->data()[m_decodedOffset + 2]; - if (colorCount) { - for (--colorCount; colorCount; colorCount >>= 1) - ++entry.m_bitCount; - } + int colorCount = + static_cast<uint8_t>(m_data->data()[m_decodedOffset + 2]); + if (!colorCount) + colorCount = 256; // Vague in the spec, needed by real-world icons. + for (--colorCount; colorCount; colorCount >>= 1) + ++entry.m_bitCount; } m_decodedOffset += sizeOfDirEntry; diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp index ae09586..2565ea6 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.cpp @@ -461,11 +461,27 @@ void JPEGImageDecoder::decode(bool sizeOnly) } } -static void convertCMYKToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_struct* info) +static void convertCMYKToRGBA(RGBA32Buffer& dest, int destY, JSAMPROW src, int srcWidth +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , bool scaled, const Vector<int>& scaledColumns +#endif + ) { - ASSERT(info->out_color_space == JCS_CMYK); - - for (unsigned x = 0; x < info->output_width; ++x) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (scaled) { + int numColumns = scaledColumns.size(); + for (int x = 0; x < numColumns; ++x) { + JSAMPLE* jsample = src + scaledColumns[x] * 3; + unsigned c = jsample[0]; + unsigned m = jsample[1]; + unsigned y = jsample[2]; + unsigned k = jsample[3]; + dest.setRGBA(x, destY, c * k / 255, m * k / 255, y * k / 255, 0xFF); + } + return; + } +#endif + for (unsigned x = 0; x < srcWidth; ++x) { unsigned c = *src++; unsigned m = *src++; unsigned y = *src++; @@ -489,23 +505,31 @@ static void convertCMYKToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_ // G = 1 - M => 1 - (1 - iM*iK) => iM*iK // B = 1 - Y => 1 - (1 - iY*iK) => iY*iK - // read_scanlines has increased the scanline counter, so we - // actually mean the previous one. - dest.setRGBA(x, info->output_scanline - 1, c * k / 255, m * k / 255, y * k / 255, 0xFF); + dest.setRGBA(x, destY, c * k / 255, m * k / 255, y * k / 255, 0xFF); } } -static void convertRGBToRGBA(RGBA32Buffer& dest, JSAMPROW src, jpeg_decompress_struct* info) +static void convertRGBToRGBA(RGBA32Buffer& dest, int destY, JSAMPROW src, int srcWidth +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + , bool scaled, const Vector<int>& scaledColumns +#endif + ) { - ASSERT(info->out_color_space == JCS_RGB); - - for (unsigned x = 0; x < info->output_width; ++x) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (scaled) { + int numColumns = scaledColumns.size(); + for (int x = 0; x < numColumns; ++x) { + JSAMPLE* jsample = src + scaledColumns[x] * 3; + dest.setRGBA(x, destY, jsample[0], jsample[1], jsample[2], 0xFF); + } + return; + } +#endif + for (unsigned x = 0; x < srcWidth; ++x) { unsigned r = *src++; unsigned g = *src++; unsigned b = *src++; - // read_scanlines has increased the scanline counter, so we - // actually mean the previous one. - dest.setRGBA(x, info->output_scanline - 1, r, g, b, 0xFF); + dest.setRGBA(x, destY, r, g, b, 0xFF); } } @@ -517,7 +541,17 @@ bool JPEGImageDecoder::outputScanlines() // Initialize the framebuffer if needed. RGBA32Buffer& buffer = m_frameBufferCache[0]; if (buffer.status() == RGBA32Buffer::FrameEmpty) { - if (!buffer.setSize(size().width(), size().height())) { + int bufferWidth = size().width(); + int bufferHeight = size().height(); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + // Let's resize our buffer now to the correct width/height. + if (m_scaled) { + bufferWidth = m_scaledColumns.size(); + bufferHeight = m_scaledRows.size(); + } +#endif + + if (!buffer.setSize(bufferWidth, bufferHeight)) { m_failed = true; return false; } @@ -532,16 +566,34 @@ bool JPEGImageDecoder::outputScanlines() JSAMPARRAY samples = m_reader->samples(); while (info->output_scanline < info->output_height) { + // jpeg_read_scanlines will increase the scanline counter, so we + // save the scanline before calling it. + int sourceY = info->output_scanline; /* Request one scanline. Returns 0 or 1 scanlines. */ if (jpeg_read_scanlines(info, samples, 1) != 1) return false; + int destY = sourceY; +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_scaled) { + destY = scaledY(sourceY); + if (destY < 0) + continue; + } if (info->out_color_space == JCS_RGB) - convertRGBToRGBA(buffer, *samples, info); + convertRGBToRGBA(buffer, destY, *samples, info->output_width, m_scaled, m_scaledColumns); else if (info->out_color_space == JCS_CMYK) - convertCMYKToRGBA(buffer, *samples, info); + convertCMYKToRGBA(buffer, destY, *samples, info->output_width, m_scaled, m_scaledColumns); else return false; +#else + if (info->out_color_space == JCS_RGB) + convertRGBToRGBA(buffer, destY, *samples, info->output_width); + else if (info->out_color_space == JCS_CMYK) + convertCMYKToRGBA(buffer, destY, *samples, info->output_width); + else + return false; +#endif } return true; diff --git a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h index 56e007d..4a822d7 100644 --- a/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h +++ b/WebCore/platform/image-decoders/jpeg/JPEGImageDecoder.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008-2009 Torch Mobile, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +58,16 @@ namespace WebCore { bool outputScanlines(); void jpegComplete(); +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + bool setSize(int width, int height) + { + if (!ImageDecoder::setSize(width, height)) + return false; + prepareScaleDataIfNecessary(); + return true; + } +#endif + private: JPEGImageReader* m_reader; }; diff --git a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp index d14333f..ad79fc8 100644 --- a/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp +++ b/WebCore/platform/image-decoders/png/PNGImageDecoder.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2007-2009 Torch Mobile, Inc. * * Portions are Copyright (C) 2001 mozilla.org * @@ -242,6 +243,9 @@ void PNGImageDecoder::headerAvailable() longjmp(png->jmpbuf, 1); return; } +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + prepareScaleDataIfNecessary(); +#endif } int bitDepth, colorType, interlaceType, compressionType, filterType, channels; @@ -313,7 +317,14 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, // Initialize the framebuffer if needed. RGBA32Buffer& buffer = m_frameBufferCache[0]; if (buffer.status() == RGBA32Buffer::FrameEmpty) { - if (!buffer.setSize(size().width(), size().height())) { +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + int width = m_scaled ? m_scaledColumns.size() : size().width(); + int height = m_scaled ? m_scaledRows.size() : size().height(); +#else + int width = size().width(); + int height = size().height(); +#endif + if (!buffer.setSize(width, height)) { static_cast<PNGImageDecoder*>(png_get_progressive_ptr(reader()->pngPtr()))->decodingFailed(); longjmp(reader()->pngPtr()->jmpbuf, 1); return; @@ -358,7 +369,7 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, * to pass the current row, and the function will combine the * old row and the new row. */ - + png_structp png = reader()->pngPtr(); bool hasAlpha = reader()->hasAlpha(); unsigned colorChannels = hasAlpha ? 4 : 3; @@ -372,8 +383,27 @@ void PNGImageDecoder::rowAvailable(unsigned char* rowBuffer, unsigned rowIndex, row = rowBuffer; // Copy the data into our buffer. +#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING) + if (m_scaled) { + int destY = scaledY(rowIndex); + if (destY < 0) + return; + int columns = m_scaledColumns.size(); + bool sawAlpha = buffer.hasAlpha(); + for (int x = 0; x < columns; ++x) { + png_bytep pixel = row + m_scaledColumns[x] * 4; + unsigned alpha = pixel[3]; + buffer.setRGBA(x, destY, pixel[0], pixel[1], pixel[2], alpha); + if (!sawAlpha && alpha < 255) { + sawAlpha = true; + buffer.setHasAlpha(true); + } + } + return; + } +#endif int width = size().width(); - bool sawAlpha = false; + bool sawAlpha = buffer.hasAlpha(); for (int x = 0; x < width; x++) { unsigned red = *row++; unsigned green = *row++; diff --git a/WebCore/platform/mac/CookieJar.mm b/WebCore/platform/mac/CookieJar.mm index d8df601..e1d3e5a 100644 --- a/WebCore/platform/mac/CookieJar.mm +++ b/WebCore/platform/mac/CookieJar.mm @@ -27,6 +27,7 @@ #import "CookieJar.h" #import "BlockExceptions.h" +#import "Cookie.h" #import "Document.h" #import "KURL.h" #import <wtf/RetainPtr.h> @@ -116,4 +117,52 @@ bool cookiesEnabled(const Document*) return false; } +bool getRawCookies(const Document*, const KURL& url, Vector<Cookie>& rawCookies) +{ + rawCookies.clear(); + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSURL *cookieURL = url; + NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:cookieURL]; + + NSUInteger count = [cookies count]; + rawCookies.reserveCapacity(count); + for (NSUInteger i = 0; i < count; ++i) { + NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; + NSString *name = [cookie name]; + NSString *value = [cookie value]; + NSString *domain = [cookie domain]; + NSString *path = [cookie path]; + NSTimeInterval expires = [[cookie expiresDate] timeIntervalSince1970] * 1000; + bool httpOnly = [cookie isHTTPOnly]; + bool secure = [cookie isSecure]; + bool session = [cookie isSessionOnly]; + rawCookies.uncheckedAppend(Cookie(name, value, domain, path, expires, httpOnly, secure, session)); + } + + END_BLOCK_OBJC_EXCEPTIONS; + return true; +} + +void deleteCookie(const Document*, const KURL& url, const String& cookieName) +{ + BEGIN_BLOCK_OBJC_EXCEPTIONS; + + NSURL *cookieURL = url; + NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + NSArray *cookies = [cookieStorage cookiesForURL:cookieURL]; + NSString *cookieNameString = (NSString *) cookieName; + + NSUInteger count = [cookies count]; + for (NSUInteger i = 0; i < count; ++i) { + NSHTTPCookie *cookie = (NSHTTPCookie *)[cookies objectAtIndex:i]; + if ([[cookie name] isEqualToString:cookieNameString]) { + [cookieStorage deleteCookie:cookie]; + break; + } + } + + END_BLOCK_OBJC_EXCEPTIONS; +} + } diff --git a/WebCore/platform/network/cf/DNSCFNet.cpp b/WebCore/platform/network/cf/DNSCFNet.cpp index bf21ab1..9ae15cb 100644 --- a/WebCore/platform/network/cf/DNSCFNet.cpp +++ b/WebCore/platform/network/cf/DNSCFNet.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Collin Jackson <collinj@webkit.org> + * 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 @@ -26,13 +27,33 @@ #include "config.h" #include "DNS.h" -#include "NotImplemented.h" +#include "PlatformString.h" +#include <wtf/RetainPtr.h> + +#ifdef BUILDING_ON_TIGER +// This function is available on Tiger, but not declared in the CFRunLoop.h header on Tiger. +extern "C" CFRunLoopRef CFRunLoopGetMain(); +#endif namespace WebCore { -void prefetchDNS(const String&) +static void clientCallback(CFHostRef theHost, CFHostInfoType, const CFStreamError*, void*) +{ + CFRelease(theHost); +} + +void prefetchDNS(const String& hostname) { - notImplemented(); + RetainPtr<CFStringRef> hostnameCF(AdoptCF, hostname.createCFString()); + RetainPtr<CFHostRef> host(AdoptCF, CFHostCreateWithName(0, hostnameCF.get())); + if (!host) + return; + CFHostClientContext context = { 0, 0, 0, 0, 0 }; + Boolean result = CFHostSetClient(host.get(), clientCallback, &context); + ASSERT_UNUSED(result, result); + CFHostScheduleWithRunLoop(host.get(), CFRunLoopGetMain(), kCFRunLoopCommonModes); + CFHostStartInfoResolution(host.get(), kCFHostAddresses, 0); + host.releaseRef(); // The host will be released from clientCallback(). } } diff --git a/WebCore/platform/network/chromium/CookieJarChromium.cpp b/WebCore/platform/network/chromium/CookieJarChromium.cpp index 65be451..7862cc3 100644 --- a/WebCore/platform/network/chromium/CookieJarChromium.cpp +++ b/WebCore/platform/network/chromium/CookieJarChromium.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "ChromiumBridge.h" #include "Document.h" @@ -52,4 +53,16 @@ bool cookiesEnabled(const Document*) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // namespace WebCore diff --git a/WebCore/platform/network/curl/CookieJarCurl.cpp b/WebCore/platform/network/curl/CookieJarCurl.cpp index 5ac0f9c..3bad4e4 100644 --- a/WebCore/platform/network/curl/CookieJarCurl.cpp +++ b/WebCore/platform/network/curl/CookieJarCurl.cpp @@ -17,6 +17,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "Document.h" #include "KURL.h" #include "PlatformString.h" @@ -43,4 +44,16 @@ bool cookiesEnabled(const Document* /*document*/) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/curl/ResourceHandleManager.cpp b/WebCore/platform/network/curl/ResourceHandleManager.cpp index 2aa286a..baca717 100644 --- a/WebCore/platform/network/curl/ResourceHandleManager.cpp +++ b/WebCore/platform/network/curl/ResourceHandleManager.cpp @@ -5,6 +5,8 @@ * Copyright (C) 2007 Holger Hans Peter Freyther * Copyright (C) 2008 Collabora Ltd. * Copyright (C) 2008 Nuanti Ltd. + * Copyright (C) 2009 Appcelerator Inc. + * Copyright (C) 2009 Brent Fulgham <bfulgham@webkit.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,10 +56,29 @@ const int maxRunningJobs = 5; static const bool ignoreSSLErrors = getenv("WEBKIT_IGNORE_SSL_ERRORS"); +static CString certificatePath() +{ +#if PLATFORM(CF) + CFBundleRef webKitBundle = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.WebKit")); + RetainPtr<CFURLRef> certURLRef(AdoptCF, CFBundleCopyResourceURL(webKitBundle, CFSTR("cacert"), CFSTR("pem"), CFSTR("certificates"))); + if (certURLRef) { + char path[MAX_PATH]; + CFURLGetFileSystemRepresentation(certURLRef.get(), false, reinterpret_cast<UInt8*>(path), MAX_PATH); + return path; + } +#endif + char* envPath = getenv("CURL_CA_BUNDLE_PATH"); + if (envPath) + return envPath; + + return CString(); +} + ResourceHandleManager::ResourceHandleManager() : m_downloadTimer(this, &ResourceHandleManager::downloadTimerCallback) , m_cookieJarFileName(0) , m_runningJobs(0) + , m_certificatePath (certificatePath()) { curl_global_init(CURL_GLOBAL_ALL); m_curlMultiHandle = curl_multi_init(); @@ -88,6 +109,23 @@ ResourceHandleManager* ResourceHandleManager::sharedInstance() return sharedInstance; } +static void handleLocalReceiveResponse (CURL* handle, ResourceHandle* job, ResourceHandleInternal* d) +{ + // since the code in headerCallback will not have run for local files + // the code to set the URL and fire didReceiveResponse is never run, + // which means the ResourceLoader's response does not contain the URL. + // Run the code here for local files to resolve the issue. + // TODO: See if there is a better approach for handling this. + const char* hdr; + CURLcode err = curl_easy_getinfo(handle, CURLINFO_EFFECTIVE_URL, &hdr); + ASSERT(CURLE_OK == err); + d->m_response.setURL(KURL(hdr)); + if (d->client()) + d->client()->didReceiveResponse(job, d->m_response); + d->m_response.setResponseFired(true); +} + + // called with data after all headers have been processed via headerCallback static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* data) { @@ -112,18 +150,10 @@ static size_t writeCallback(void* ptr, size_t size, size_t nmemb, void* data) if (CURLE_OK == err && httpCode >= 300 && httpCode < 400) return totalSize; - // since the code in headerCallback will not have run for local files - // the code to set the URL and fire didReceiveResponse is never run, - // which means the ResourceLoader's response does not contain the URL. - // Run the code here for local files to resolve the issue. - // TODO: See if there is a better approach for handling this. if (!d->m_response.responseFired()) { - const char* hdr; - err = curl_easy_getinfo(h, CURLINFO_EFFECTIVE_URL, &hdr); - d->m_response.setURL(KURL(hdr)); - if (d->client()) - d->client()->didReceiveResponse(job, d->m_response); - d->m_response.setResponseFired(true); + handleLocalReceiveResponse(h, job, d); + if (d->m_cancelled) + return 0; } if (d->client()) @@ -222,6 +252,7 @@ size_t readCallback(void* ptr, size_t size, size_t nmemb, void* data) { ResourceHandle* job = static_cast<ResourceHandle*>(data); ResourceHandleInternal* d = job->getInternal(); + if (d->m_cancelled) return 0; @@ -311,6 +342,14 @@ void ResourceHandleManager::downloadTimerCallback(Timer<ResourceHandleManager>* continue; if (CURLE_OK == msg->data.result) { + if (!d->m_response.responseFired()) { + handleLocalReceiveResponse(d->m_handle, job, d); + if (d->m_cancelled) { + removeFromCurl(job); + continue; + } + } + if (d->client()) d->client()->didFinishLoading(job); } else { @@ -629,6 +668,10 @@ void ResourceHandleManager::initializeHandle(ResourceHandle* job) // and/or reporting SSL errors to the user. if (ignoreSSLErrors) curl_easy_setopt(d->m_handle, CURLOPT_SSL_VERIFYPEER, false); + + if (!m_certificatePath.isNull()) + curl_easy_setopt(d->m_handle, CURLOPT_CAINFO, m_certificatePath.data()); + // enable gzip and deflate through Accept-Encoding: curl_easy_setopt(d->m_handle, CURLOPT_ENCODING, ""); diff --git a/WebCore/platform/network/curl/ResourceHandleManager.h b/WebCore/platform/network/curl/ResourceHandleManager.h index d38e577..89b27d7 100644 --- a/WebCore/platform/network/curl/ResourceHandleManager.h +++ b/WebCore/platform/network/curl/ResourceHandleManager.h @@ -29,6 +29,7 @@ #define ResourceHandleManager_h #include "Frame.h" +#include "CString.h" #include "Timer.h" #include "ResourceHandleClient.h" @@ -71,6 +72,7 @@ private: char* m_cookieJarFileName; char m_curlErrorBuffer[CURL_ERROR_SIZE]; Vector<ResourceHandle*> m_resourceHandleList; + const CString m_certificatePath; int m_runningJobs; }; diff --git a/WebCore/platform/network/soup/CookieJarSoup.cpp b/WebCore/platform/network/soup/CookieJarSoup.cpp index 705fdf2..3eb578a 100644 --- a/WebCore/platform/network/soup/CookieJarSoup.cpp +++ b/WebCore/platform/network/soup/CookieJarSoup.cpp @@ -21,6 +21,7 @@ #include "config.h" #include "CookieJarSoup.h" +#include "Cookie.h" #include "CString.h" #include "Document.h" #include "KURL.h" @@ -86,4 +87,16 @@ bool cookiesEnabled(const Document* /*document*/) return defaultCookieJar(); } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp index 4a22d8a..280fc38 100644 --- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp +++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp @@ -118,7 +118,7 @@ void WebCoreSynchronousLoader::run() g_main_loop_run(m_mainLoop); } -static void cleanupGioOperation(ResourceHandleInternal* handle); +static void cleanupGioOperation(ResourceHandle* handle, bool isDestroying); static bool startData(ResourceHandle* handle, String urlString); static bool startGio(ResourceHandle* handle, KURL url); @@ -129,8 +129,6 @@ ResourceHandleInternal::~ResourceHandleInternal() m_msg = 0; } - cleanupGioOperation(this); - if (m_idleHandler) { g_source_remove(m_idleHandler); m_idleHandler = 0; @@ -142,6 +140,8 @@ ResourceHandle::~ResourceHandle() if (d->m_msg) g_signal_handlers_disconnect_matched(d->m_msg, G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, this); + + cleanupGioOperation(this, true); } static void fillResponseFromMessage(SoupMessage* msg, ResourceResponse* response) @@ -276,7 +276,7 @@ static void gotChunkCallback(SoupMessage* msg, SoupBuffer* chunk, gpointer data) // Doesn't get called for redirects. static void finishedCallback(SoupSession *session, SoupMessage* msg, gpointer data) { - RefPtr<ResourceHandle>handle = adoptRef(static_cast<ResourceHandle*>(data)); + RefPtr<ResourceHandle> handle = adoptRef(static_cast<ResourceHandle*>(data)); // TODO: maybe we should run this code even if there's no client? if (!handle) return; @@ -625,8 +625,10 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S // GIO-based loader -static void cleanupGioOperation(ResourceHandleInternal* d) +static void cleanupGioOperation(ResourceHandle* handle, bool isDestroying = false) { + ResourceHandleInternal* d = handle->getInternal(); + if (d->m_gfile) { g_object_set_data(G_OBJECT(d->m_gfile), "webkit-resource", 0); g_object_unref(d->m_gfile); @@ -648,11 +650,14 @@ static void cleanupGioOperation(ResourceHandleInternal* d) g_free(d->m_buffer); d->m_buffer = 0; } + + if (!isDestroying) + handle->deref(); } static void closeCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -660,13 +665,12 @@ static void closeCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); g_input_stream_close_finish(d->m_inputStream, res, 0); - cleanupGioOperation(d); - client->didFinishLoading(handle); + cleanupGioOperation(handle.get()); + client->didFinishLoading(handle.get()); } static void readCallback(GObject* source, GAsyncResult* res, gpointer) { - // didReceiveData may cancel the load, which may release the last reference. RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -675,7 +679,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled || !client) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -690,7 +694,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); client->didFail(handle.get(), resourceError); return; } @@ -704,8 +708,9 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) d->m_total += bytesRead; client->didReceiveData(handle.get(), d->m_buffer, bytesRead, d->m_total); + // didReceiveData may cancel the load, which may release the last reference. if (d->m_cancelled) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -716,7 +721,7 @@ static void readCallback(GObject* source, GAsyncResult* res, gpointer) static void openCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -724,7 +729,7 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled || !client) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -738,8 +743,8 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -747,7 +752,8 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) d->m_bufferSize = 8192; d->m_buffer = static_cast<char*>(g_malloc(d->m_bufferSize)); d->m_total = 0; - g_object_set_data(G_OBJECT(d->m_inputStream), "webkit-resource", handle); + + g_object_set_data(G_OBJECT(d->m_inputStream), "webkit-resource", handle.get()); g_input_stream_read_async(d->m_inputStream, d->m_buffer, d->m_bufferSize, G_PRIORITY_DEFAULT, d->m_cancellable, readCallback, 0); @@ -755,7 +761,7 @@ static void openCallback(GObject* source, GAsyncResult* res, gpointer) static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) { - ResourceHandle* handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); + RefPtr<ResourceHandle> handle = static_cast<ResourceHandle*>(g_object_get_data(source, "webkit-resource")); if (!handle) return; @@ -763,7 +769,7 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) ResourceHandleClient* client = handle->client(); if (d->m_cancelled) { - cleanupGioOperation(d); + cleanupGioOperation(handle.get()); return; } @@ -790,8 +796,8 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) error ? String::fromUTF8(error->message) : String()); g_free(uri); g_error_free(error); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -804,8 +810,8 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) uri, String()); g_free(uri); - cleanupGioOperation(d); - client->didFail(handle, resourceError); + cleanupGioOperation(handle.get()); + client->didFail(handle.get(), resourceError); return; } @@ -816,7 +822,12 @@ static void queryInfoCallback(GObject* source, GAsyncResult* res, gpointer) g_file_info_get_modification_time(info, &tv); response.setLastModifiedDate(tv.tv_sec); - client->didReceiveResponse(handle, response); + client->didReceiveResponse(handle.get(), response); + + if (d->m_cancelled) { + cleanupGioOperation(handle.get()); + return; + } g_file_read_async(d->m_gfile, G_PRIORITY_DEFAULT, d->m_cancellable, openCallback, 0); @@ -852,6 +863,10 @@ static bool startGio(ResourceHandle* handle, KURL url) #endif d->m_gfile = g_file_new_for_uri(url.string().utf8().data()); g_object_set_data(G_OBJECT(d->m_gfile), "webkit-resource", handle); + + // balanced by a deref() in cleanupGioOperation, which should always run + handle->ref(); + d->m_cancellable = g_cancellable_new(); g_file_query_info_async(d->m_gfile, G_FILE_ATTRIBUTE_STANDARD_TYPE "," diff --git a/WebCore/platform/network/win/CookieJarCFNetWin.cpp b/WebCore/platform/network/win/CookieJarCFNetWin.cpp index af9e3f3..519a1b9 100644 --- a/WebCore/platform/network/win/CookieJarCFNetWin.cpp +++ b/WebCore/platform/network/win/CookieJarCFNetWin.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "CookieStorageWin.h" #include "Document.h" #include "KURL.h" @@ -113,4 +114,16 @@ bool cookiesEnabled(const Document* /*document*/) return policy == CFHTTPCookieStorageAcceptPolicyOnlyFromMainDocumentDomain || policy == CFHTTPCookieStorageAcceptPolicyAlways; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/network/win/CookieJarWin.cpp b/WebCore/platform/network/win/CookieJarWin.cpp index 41d12d9..6576e07 100644 --- a/WebCore/platform/network/win/CookieJarWin.cpp +++ b/WebCore/platform/network/win/CookieJarWin.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "KURL.h" #include "PlatformString.h" #include "Document.h" @@ -35,7 +36,6 @@ namespace WebCore { - void setCookies(Document* /*document*/, const KURL& url, const String& value) { // FIXME: Deal with document->firstPartyForCookies(). @@ -64,4 +64,16 @@ bool cookiesEnabled(const Document* /*document*/) return true; } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } diff --git a/WebCore/platform/qt/CookieJarQt.cpp b/WebCore/platform/qt/CookieJarQt.cpp index 40d9309..56d3372 100644 --- a/WebCore/platform/qt/CookieJarQt.cpp +++ b/WebCore/platform/qt/CookieJarQt.cpp @@ -28,6 +28,7 @@ #include "config.h" #include "CookieJar.h" +#include "Cookie.h" #include "Document.h" #include "KURL.h" #include "PlatformString.h" @@ -128,6 +129,18 @@ bool cookiesEnabled(const Document* document) #endif } +bool getRawCookies(const Document*, const KURL&, Vector<Cookie>& rawCookies) +{ + // FIXME: Not yet implemented + rawCookies.clear(); + return false; // return true when implemented +} + +void deleteCookie(const Document*, const KURL&, const String&) +{ + // FIXME: Not yet implemented +} + } // vim: ts=4 sw=4 et diff --git a/WebCore/platform/qt/FileSystemQt.cpp b/WebCore/platform/qt/FileSystemQt.cpp index 28d3ca7..02bc678 100644 --- a/WebCore/platform/qt/FileSystemQt.cpp +++ b/WebCore/platform/qt/FileSystemQt.cpp @@ -81,7 +81,7 @@ bool makeAllDirectories(const String& path) String pathByAppendingComponent(const String& path, const String& component) { - return QDir(path).filePath(component); + return QDir::toNativeSeparators(QDir(path).filePath(component)); } String homeDirectoryPath() diff --git a/WebCore/platform/text/PlatformString.h b/WebCore/platform/text/PlatformString.h index 6d5384f..258b28d 100644 --- a/WebCore/platform/text/PlatformString.h +++ b/WebCore/platform/text/PlatformString.h @@ -56,6 +56,10 @@ QT_END_NAMESPACE class wxString; #endif +#if PLATFORM(HAIKU) +class BString; +#endif + namespace WebCore { class CString; @@ -229,6 +233,11 @@ public: operator wxString() const; #endif +#if PLATFORM(HAIKU) + String(const BString&); + operator BString() const; +#endif + #ifndef NDEBUG Vector<char> ascii() const; #endif diff --git a/WebCore/platform/text/UnicodeRange.h b/WebCore/platform/text/UnicodeRange.h index 7ecf03f..2278a0e 100644 --- a/WebCore/platform/text/UnicodeRange.h +++ b/WebCore/platform/text/UnicodeRange.h @@ -35,6 +35,10 @@ #ifndef UnicodeRange_H #define UnicodeRange_H +#if PLATFORM(HAIKU) +#include "stdint.h" +#endif + #include <wtf/unicode/Unicode.h> namespace WebCore { diff --git a/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp b/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp index 2c732d6..8bb8c70 100644 --- a/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp +++ b/WebCore/platform/text/haiku/TextBreakIteratorInternalICUHaiku.cpp @@ -26,6 +26,12 @@ namespace WebCore { +const char* currentSearchLocaleID() +{ + notImplemented(); + return ""; +} + const char* currentTextBreakLocaleID() { notImplemented(); diff --git a/WebCore/platform/text/mac/TextCodecMac.cpp b/WebCore/platform/text/mac/TextCodecMac.cpp index 93b9da2..1152cc2 100644 --- a/WebCore/platform/text/mac/TextCodecMac.cpp +++ b/WebCore/platform/text/mac/TextCodecMac.cpp @@ -36,7 +36,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/Threading.h> -using std::min; +using namespace std; namespace WebCore { @@ -141,7 +141,7 @@ OSStatus TextCodecMac::decode(const unsigned char* inputBuffer, int inputBufferL // First, fill the partial character buffer with as many bytes as are available. ASSERT(m_numBufferedBytes < sizeof(m_bufferedBytes)); const int spaceInBuffer = sizeof(m_bufferedBytes) - m_numBufferedBytes; - const int bytesToPutInBuffer = MIN(spaceInBuffer, inputBufferLength); + const int bytesToPutInBuffer = min(spaceInBuffer, inputBufferLength); ASSERT(bytesToPutInBuffer != 0); memcpy(m_bufferedBytes + m_numBufferedBytes, inputBuffer, bytesToPutInBuffer); diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp index e53053f..216c7c5 100644 --- a/WebCore/platform/win/PopupMenuWin.cpp +++ b/WebCore/platform/win/PopupMenuWin.cpp @@ -94,6 +94,11 @@ PopupMenu::~PopupMenu() ::DestroyWindow(m_popup); } +LPCTSTR PopupMenu::popupClassName() +{ + return kPopupWindowClassName; +} + void PopupMenu::show(const IntRect& r, FrameView* v, int index) { calculatePositionAndSize(r, v); diff --git a/WebCore/platform/wince/CursorWince.cpp b/WebCore/platform/wince/CursorWince.cpp new file mode 100644 index 0000000..e35f1f9 --- /dev/null +++ b/WebCore/platform/wince/CursorWince.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2009 Torch Mobile Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "Cursor.h" + +namespace WebCore { + +struct AllCursors { + AllCursors() + { + for (int i = 0; i < NumCursorTypes; ++i) + m_cursors[i] = (CursorType) i; + } + Cursor m_cursors[NumCursorTypes]; +}; + +static const Cursor& getCursor(CursorType type) +{ + static AllCursors allCursors; + return allCursors.m_cursors[type]; +} + +Cursor::Cursor(const Cursor& other) +: m_impl(other.m_impl) +{ +} + +Cursor::Cursor(Image* img, const IntPoint& hotspot) +: m_impl(CursorNone) +{ +} + +Cursor::~Cursor() +{ +} + +Cursor& Cursor::operator=(const Cursor& other) +{ + m_impl = other.m_impl; + return *this; +} + +Cursor::Cursor(PlatformCursor c) +: m_impl(c) +{ +} + +const Cursor& noneCursor() { return getCursor(CursorNone); } +const Cursor& pointerCursor() { return getCursor(CursorPointer); } +const Cursor& crossCursor() { return getCursor(CursorCross); } +const Cursor& handCursor() { return getCursor(CursorHand); } +const Cursor& iBeamCursor() { return getCursor(CursorBeam); } +const Cursor& waitCursor() { return getCursor(CursorWait); } +const Cursor& helpCursor() { return getCursor(CursorHelp); } +const Cursor& moveCursor() { return getCursor(CursorMove); } +const Cursor& eastResizeCursor() { return getCursor(CursorEastResize); } +const Cursor& northResizeCursor() { return getCursor(CursorNorthResize); } +const Cursor& northEastResizeCursor() { return getCursor(CursorNorthEastResize); } +const Cursor& northWestResizeCursor() { return getCursor(CursorNorthWestResize); } +const Cursor& southResizeCursor() { return getCursor(CursorSouthResize); } +const Cursor& southEastResizeCursor() { return getCursor(CursorSouthEastResize); } +const Cursor& southWestResizeCursor() { return getCursor(CursorSouthWestResize); } +const Cursor& westResizeCursor() { return getCursor(CursorWestResize); } +const Cursor& northSouthResizeCursor() { return getCursor(CursorNorthSouthResize); } +const Cursor& eastWestResizeCursor() { return getCursor(CursorEastWestResize); } +const Cursor& northEastSouthWestResizeCursor() { return getCursor(CursorNorthEastSouthWestResize); } +const Cursor& northWestSouthEastResizeCursor() { return getCursor(CursorNorthWestSouthEastResize); } +const Cursor& columnResizeCursor() { return getCursor(CursorColumnResize); } +const Cursor& rowResizeCursor() { return getCursor(CursorRowResize); } +const Cursor& verticalTextCursor() { return getCursor(CursorVerticalText); } +const Cursor& cellCursor() { return getCursor(CursorCell); } +const Cursor& contextMenuCursor() { return getCursor(CursorContextMenu); } +const Cursor& noDropCursor() { return getCursor(CursorNoDrop); } +const Cursor& notAllowedCursor() { return getCursor(CursorNotAllowed); } +const Cursor& progressCursor() { return getCursor(CursorProgress); } +const Cursor& aliasCursor() { return getCursor(CursorAlias); } +const Cursor& zoomInCursor() { return getCursor(CursorZoomIn); } +const Cursor& zoomOutCursor() { return getCursor(CursorZoomOut); } +const Cursor& copyCursor() { return getCursor(CursorCopy); } +const Cursor& middlePanningCursor() { return crossCursor(); } +const Cursor& eastPanningCursor() { return crossCursor(); } +const Cursor& northPanningCursor() { return crossCursor(); } +const Cursor& northEastPanningCursor() { return crossCursor(); } +const Cursor& northWestPanningCursor() { return crossCursor(); } +const Cursor& southPanningCursor() { return crossCursor(); } +const Cursor& southEastPanningCursor() { return crossCursor(); } +const Cursor& southWestPanningCursor() { return crossCursor(); } +const Cursor& westPanningCursor() { return crossCursor(); } +const Cursor& grabbingCursor() { return moveCursor(); } +const Cursor& grabCursor() { return moveCursor(); } + +} diff --git a/WebCore/platform/wince/DragDataWince.cpp b/WebCore/platform/wince/DragDataWince.cpp new file mode 100644 index 0000000..881d7d4 --- /dev/null +++ b/WebCore/platform/wince/DragDataWince.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "DragData.h" + +#include "Clipboard.h" +#include "DocumentFragment.h" +#include "PlatformString.h" + +namespace WebCore { + +PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy policy) const +{ + return 0; +} + +bool DragData::containsURL() const +{ + return false; +} + +String DragData::asURL(String* title) const +{ + return String(); +} + +bool DragData::containsFiles() const +{ + return false; +} + +void DragData::asFilenames(Vector<String>&) const +{ +} + +bool DragData::containsPlainText() const +{ + return false; +} + +String DragData::asPlainText() const +{ + return String(); +} + +bool DragData::containsColor() const +{ + return false; +} + +bool DragData::canSmartReplace() const +{ + return false; +} + +bool DragData::containsCompatibleContent() const +{ + return false; +} + +PassRefPtr<DocumentFragment> DragData::asFragment(Document* doc) const +{ + return 0; +} + +Color DragData::asColor() const +{ + return Color(); +} + +} + diff --git a/WebCore/platform/wince/DragImageWince.cpp b/WebCore/platform/wince/DragImageWince.cpp new file mode 100644 index 0000000..4d60f80 --- /dev/null +++ b/WebCore/platform/wince/DragImageWince.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" +#include "DragImage.h" + +#include "CachedImage.h" +#include "GraphicsContext.h" +#include "Image.h" + +#include <windows.h> + +namespace WebCore { + +IntSize dragImageSize(DragImageRef) +{ + return IntSize(0, 0); +} + +void deleteDragImage(DragImageRef image) +{ + if (image) + ::DeleteObject(image); +} + +DragImageRef scaleDragImage(DragImageRef, FloatSize) +{ + return 0; +} + +DragImageRef dissolveDragImageToFraction(DragImageRef image, float) +{ + return image; +} + +DragImageRef createDragImageFromImage(Image*) +{ + return 0; +} + +DragImageRef createDragImageIconForCachedImage(CachedImage*) +{ + return 0; +} + +} diff --git a/WebCore/platform/wince/EditorWince.cpp b/WebCore/platform/wince/EditorWince.cpp new file mode 100644 index 0000000..02af780 --- /dev/null +++ b/WebCore/platform/wince/EditorWince.cpp @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2007-2008 Torch Mobile, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include "Editor.h" + +#include "ClipboardWince.h" +#include "Document.h" +#include "EditorClient.h" +#include "Element.h" +#include "HtmlEditing.h" +#include "TextIterator.h" +#include "visible_units.h" + +#include <windows.h> +#define _SYS_GUID_OPERATORS_ + +namespace WebCore { + +PassRefPtr<Clipboard> Editor::newGeneralClipboard(ClipboardAccessPolicy policy) +{ + return adoptRef(new ClipboardWince(policy, false)); +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/FileChooserWince.cpp b/WebCore/platform/wince/FileChooserWince.cpp new file mode 100644 index 0000000..07c99b1 --- /dev/null +++ b/WebCore/platform/wince/FileChooserWince.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, 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 "FileChooser.h" + +#include "Chrome.h" +#include "ChromeClient.h" +#include "Document.h" +#include "Frame.h" +#include "Icon.h" +#include "LocalizedStrings.h" +#include "Page.h" +#include "StringTruncator.h" + +namespace WebCore { + +String pathGetFileName(const String& path); + +String FileChooser::basenameForWidth(const Font& font, int width) const +{ + if (width <= 0) + return String(); + + String string; + if (m_filenames.isEmpty()) + string = fileButtonNoFileSelectedLabel(); + else if (m_filenames.size() == 1) { + String tmpFilename = m_filenames[0]; + string = pathGetFileName(tmpFilename); + } else + return StringTruncator::rightTruncate(String::number(m_filenames.size()) + " files", width, font, false); + + return StringTruncator::centerTruncate(string, width, font, false); +} + +} diff --git a/WebCore/platform/wince/FileSystemWince.cpp b/WebCore/platform/wince/FileSystemWince.cpp new file mode 100644 index 0000000..2bb4dd5 --- /dev/null +++ b/WebCore/platform/wince/FileSystemWince.cpp @@ -0,0 +1,283 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2008 Collabora, Ltd. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, 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. + * 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. + */ + +#include "config.h" +#include "FileSystem.h" + +#include "CString.h" +#include "PlatformString.h" + +#include <windows.h> +#include <wincrypt.h> + +namespace WebCore { + +static bool getFileInfo(const String& path, BY_HANDLE_FILE_INFORMATION& fileInfo) +{ + String filename = path; + HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), GENERIC_READ, FILE_SHARE_READ, 0 + , OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0); + + if (hFile == INVALID_HANDLE_VALUE) + return false; + + bool rtn = GetFileInformationByHandle(hFile, &fileInfo) ? true : false; + + CloseHandle(hFile); + return rtn; +} + +bool getFileSize(const String& path, long long& result) +{ + BY_HANDLE_FILE_INFORMATION fileInformation; + if (!getFileInfo(path, fileInformation)) + return false; + + ULARGE_INTEGER fileSize; + fileSize.LowPart = fileInformation.nFileSizeLow; + fileSize.HighPart = fileInformation.nFileSizeHigh; + + result = fileSize.QuadPart; + + return true; +} + +bool getFileModificationTime(const String& path, time_t& result) +{ + BY_HANDLE_FILE_INFORMATION fileInformation; + if (!getFileInfo(path, fileInformation)) + return false; + + ULARGE_INTEGER t; + memcpy(&t, &fileInformation.ftLastWriteTime, sizeof(t)); + + result = t.QuadPart * 0.0000001 - 11644473600.0; + + return true; +} + +bool fileExists(const String& path) +{ + String filename = path; + HANDLE hFile = CreateFile(filename.charactersWithNullTermination(), 0, FILE_SHARE_READ | FILE_SHARE_WRITE + , 0, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0); + + CloseHandle(hFile); + + return hFile != INVALID_HANDLE_VALUE; +} + +bool deleteFile(const String& path) +{ + String filename = path; + return !!DeleteFileW(filename.charactersWithNullTermination()); +} + + +bool deleteEmptyDirectory(const String& path) +{ + String filename = path; + return !!RemoveDirectoryW(filename.charactersWithNullTermination()); +} + +String pathByAppendingComponent(const String& path, const String& component) +{ + if (component.isEmpty()) + return path; + + Vector<UChar, MAX_PATH> buffer; + + buffer.append(path.characters(), path.length()); + + if (buffer.last() != L'\\' && buffer.last() != L'/' + && component[0] != L'\\' && component[0] != L'/') + buffer.append(L'\\'); + + buffer.append(component.characters(), component.length()); + + return String(buffer.data(), buffer.size()); +} + +CString fileSystemRepresentation(const String&) +{ + return ""; +} + +bool makeAllDirectories(const String& path) +{ + int lastDivPos = max(path.reverseFind('/'), path.reverseFind('\\')); + int endPos = path.length(); + if (lastDivPos == path.length() - 1) { + endPos -= 1; + lastDivPos = max(path.reverseFind('/', lastDivPos), path.reverseFind('\\', lastDivPos)); + } + + if (lastDivPos > 0) { + if (!makeAllDirectories(path.substring(0, lastDivPos))) + return false; + } + + String folder(path.substring(0, endPos)); + CreateDirectory(folder.charactersWithNullTermination(), 0); + + DWORD fileAttr = GetFileAttributes(folder.charactersWithNullTermination()); + return fileAttr != 0xFFFFFFFF && (fileAttr & FILE_ATTRIBUTE_DIRECTORY); +} + +String homeDirectoryPath() +{ + notImplemented(); + return ""; +} + +String pathGetFileName(const String& path) +{ + return path.substring(max(path.reverseFind('/'), path.reverseFind('\\')) + 1); +} + +String directoryName(const String& path) +{ + notImplemented(); + return String(); +} + +CString openTemporaryFile(const char*, PlatformFileHandle& handle) +{ + handle = INVALID_HANDLE_VALUE; + + wchar_t tempPath[MAX_PATH]; + int tempPathLength = ::GetTempPath(_countof(tempPath), tempPath); + if (tempPathLength <= 0 || tempPathLength > _countof(tempPath)) + return CString(); + + HCRYPTPROV hCryptProv = 0; + if (!CryptAcquireContext(&hCryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) + return CString(); + + String proposedPath; + while (1) { + + wchar_t tempFile[] = L"XXXXXXXX.tmp"; // Use 8.3 style name (more characters aren't helpful due to 8.3 short file names) + const int randomPartLength = 8; + if (!CryptGenRandom(hCryptProv, randomPartLength * 2, reinterpret_cast<BYTE*>(tempFile))) + break; + + // Limit to valid filesystem characters, also excluding others that could be problematic, like punctuation. + // don't include both upper and lowercase since Windows file systems are typically not case sensitive. + const char validChars[] = "0123456789abcdefghijklmnopqrstuvwxyz"; + for (int i = 0; i < randomPartLength; ++i) + tempFile[i] = validChars[tempFile[i] % (sizeof(validChars) - 1)]; + + ASSERT(wcslen(tempFile) * 2 == sizeof(tempFile) - 2); + + proposedPath = pathByAppendingComponent(String(tempPath), String(tempFile)); + + // use CREATE_NEW to avoid overwriting an existing file with the same name + handle = CreateFile(proposedPath.charactersWithNullTermination(), GENERIC_READ | GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0); + if (!isHandleValid(handle) && GetLastError() == ERROR_ALREADY_EXISTS) + continue; + + break; + } + + CryptReleaseContext(hCryptProv, 0); + + if (!isHandleValid(handle)) + return CString(); + + return proposedPath.latin1(); +} + +void closeFile(PlatformFileHandle& handle) +{ + if (isHandleValid(handle)) { + ::CloseHandle(handle); + handle = invalidPlatformFileHandle; + } +} + +int writeToFile(PlatformFileHandle handle, const char* data, int length) +{ + if (!isHandleValid(handle)) + return -1; + + DWORD bytesWritten; + bool success = WriteFile(handle, data, length, &bytesWritten, 0); + + if (!success) + return -1; + return static_cast<int>(bytesWritten); +} + +bool unloadModule(PlatformModule module) +{ + return ::FreeLibrary(module); +} + +String localUserSpecificStorageDirectory() +{ + return String(L"\\"); +} + +String roamingUserSpecificStorageDirectory() +{ + return String(L"\\"); +} + +Vector<String> listDirectory(const String& path, const String& filter) +{ + Vector<String> entries; + + Vector<UChar, 256> pattern; + pattern.append(path.characters(), path.length()); + if (pattern.last() != L'/' && pattern.last() != L'\\') + pattern.append(L'\\'); + + String root(pattern.data(), pattern.size()); + pattern.append(filter.characters(), filter.length()); + pattern.append(0); + + WIN32_FIND_DATA findData; + HANDLE hFind = FindFirstFile(pattern.data(), &findData); + if (INVALID_HANDLE_VALUE != hFind) { + do { + // FIXEME: should we also add the folders? This function + // is so far only called by PluginDatabase.cpp to list + // all plugins in a folder, where it's not supposed to list sub-folders. + if (!(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + entries.append(root + findData.cFileName); + } while (FindNextFile(hFind, &findData)); + FindClose(hFind); + } + + return entries; +} + +} diff --git a/WebCore/platform/wince/KURLWince.cpp b/WebCore/platform/wince/KURLWince.cpp new file mode 100644 index 0000000..5ca1e4b --- /dev/null +++ b/WebCore/platform/wince/KURLWince.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2009 Torch Mobile Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "KURL.h" + +namespace WebCore { + +String KURL::fileSystemPath() const +{ + return path(); +} + +} diff --git a/WebCore/platform/wince/KeygenWince.cpp b/WebCore/platform/wince/KeygenWince.cpp new file mode 100644 index 0000000..b0f4d63 --- /dev/null +++ b/WebCore/platform/wince/KeygenWince.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2008-2009 Torch Mobile Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "SSLKeyGenerator.h" + +#include "Base64.h" +#include "CString.h" + +#include <windows.h> +#include <wincrypt.h> + +namespace WebCore { + +void WebCore::getSupportedKeySizes(Vector<String>& v) +{ + v.append("High Grade"); + v.append("Medium Grade"); +} + +String WebCore::signedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL& url) +{ + String keyString; + + HCRYPTPROV hContext = 0; + HCRYPTKEY hKey = 0; + PCERT_PUBLIC_KEY_INFO pPubInfo = 0; + + // Try to delete it if it exists already + CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + + do { + if (!CryptAcquireContext(&hContext, _T("keygen_container"), MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_NEWKEYSET)) + break; + + DWORD dwPubInfoLength = 0; + if (!CryptGenKey(hContext, AT_KEYEXCHANGE, 0, &hKey) || !CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, 0, &dwPubInfoLength)) + break; + + // Use malloc instead of new, because malloc guarantees to return a pointer aligned for all data types. + pPubInfo = reinterpret_cast<PCERT_PUBLIC_KEY_INFO>(fastMalloc(dwPubInfoLength)); + + if (!CryptExportPublicKeyInfo(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, pPubInfo, &dwPubInfoLength)) + break; + + CERT_KEYGEN_REQUEST_INFO requestInfo = { 0 }; + requestInfo.dwVersion = CERT_KEYGEN_REQUEST_V1; + requestInfo.pwszChallengeString = L""; + requestInfo.SubjectPublicKeyInfo = *pPubInfo; + + String localChallenge = challenge; + + // Windows API won't write to our buffer, although it's not declared with const. + requestInfo.pwszChallengeString = const_cast<wchar_t*>(localChallenge.charactersWithNullTermination()); + + CRYPT_ALGORITHM_IDENTIFIER signAlgo = { 0 }; + signAlgo.pszObjId = szOID_RSA_SHA1RSA; + + DWORD dwEncodedLength; + if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, 0, &dwEncodedLength)) + break; + + Vector<char> binary(dwEncodedLength); + if (!CryptSignAndEncodeCertificate(hContext, AT_KEYEXCHANGE, X509_ASN_ENCODING, X509_KEYGEN_REQUEST_TO_BE_SIGNED, &requestInfo, &signAlgo, 0, reinterpret_cast<LPBYTE>(binary.data()), &dwEncodedLength)) + break; + + Vector<char> base64; + base64Encode(binary, base64); + keyString = String(base64.data(), base64.size()); + + } while(0); + + if (pPubInfo) + fastFree(pPubInfo); + + if (hKey) + CryptDestroyKey(hKey); + + if (hContext) + CryptReleaseContext(hContext, 0); + + return keyString; +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/MIMETypeRegistryWince.cpp b/WebCore/platform/wince/MIMETypeRegistryWince.cpp new file mode 100644 index 0000000..2ecde48 --- /dev/null +++ b/WebCore/platform/wince/MIMETypeRegistryWince.cpp @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, 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 "MIMETypeRegistry.h" + +#include <windows.h> +#include <winreg.h> + +namespace WebCore { + +static String mimeTypeForExtension(const String& extension) +{ + String ext = "." + extension; + WCHAR contentTypeStr[256]; + DWORD contentTypeStrLen = sizeof(contentTypeStr); + DWORD valueType; + + HKEY key; + String result; + if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_CLASSES_ROOT, ext.charactersWithNullTermination(), 0, 0, &key)) + return result; + + if (ERROR_SUCCESS == RegQueryValueEx(key, L"Content Type", 0, &valueType, (LPBYTE)contentTypeStr, &contentTypeStrLen) && valueType == REG_SZ) + result = String(contentTypeStr, contentTypeStrLen / sizeof(contentTypeStr[0]) - 1); + + RegCloseKey(key); + + return result; +} + +static HashMap<String, String> mimetypeMap; + +static void initMIMETypeEntensionMap() +{ + if (mimetypeMap.isEmpty()) { + //fill with initial values + mimetypeMap.add("txt", "text/plain"); + mimetypeMap.add("pdf", "application/pdf"); + mimetypeMap.add("ps", "application/postscript"); + mimetypeMap.add("html", "text/html"); + mimetypeMap.add("htm", "text/html"); + mimetypeMap.add("xml", "text/xml"); + mimetypeMap.add("xsl", "text/xsl"); + mimetypeMap.add("js", "application/x-javascript"); + mimetypeMap.add("xhtml", "application/xhtml+xml"); + mimetypeMap.add("rss", "application/rss+xml"); + mimetypeMap.add("webarchive", "application/x-webarchive"); + mimetypeMap.add("svg", "image/svg+xml"); + mimetypeMap.add("svgz", "image/svg+xml"); + mimetypeMap.add("jpg", "image/jpeg"); + mimetypeMap.add("jpeg", "image/jpeg"); + mimetypeMap.add("png", "image/png"); + mimetypeMap.add("tif", "image/tiff"); + mimetypeMap.add("tiff", "image/tiff"); + mimetypeMap.add("ico", "image/ico"); + mimetypeMap.add("cur", "image/ico"); + mimetypeMap.add("bmp", "image/bmp"); + mimetypeMap.add("css", "text/css"); + // FIXME: Custom font works only when MIME is "text/plain" + mimetypeMap.add("ttf", "text/plain"); // "font/ttf" + mimetypeMap.add("otf", "text/plain"); // "font/otf" +#if ENABLE(WML) + mimetypeMap.add("wml", "text/vnd.wap.wml"); +#endif +#if ENABLE(WBXML) + mimetypeMap.add("wbxml", "application/vnd.wap.wmlc"); +#endif + } +} + +String MIMETypeRegistry::getPreferredExtensionForMIMEType(const String& type) +{ + if (type.isEmpty()) + return String(); + + // Avoid conflicts with "ttf" and "otf" + if (equalIgnoringCase(type, "text/plain")) + return "txt"; + + initMIMETypeEntensionMap(); + + for (HashMap<String, String>::iterator i = mimetypeMap.begin(); i != mimetypeMap.end(); ++i) { + if (equalIgnoringCase(i->second, type)) + return i->first; + } + +#if ENABLE(XHTMLMP) + if (equalIgnoringCase("application/vnd.wap.xhtml+xml", type)) + return String("xml"); +#endif + + return String(); +} + +String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) +{ + if (ext.isEmpty()) + return String(); + + initMIMETypeEntensionMap(); + + String result = mimetypeMap.get(ext.lower()); + if (result.isEmpty()) { + result = mimeTypeForExtension(ext); + if (!result.isEmpty()) + mimetypeMap.add(ext, result); + } + return result.isEmpty() ? "unknown/unknown" : result; +} + +} diff --git a/WebCore/platform/wince/PasteboardWince.cpp b/WebCore/platform/wince/PasteboardWince.cpp new file mode 100644 index 0000000..cba85b8 --- /dev/null +++ b/WebCore/platform/wince/PasteboardWince.cpp @@ -0,0 +1,315 @@ +/* + * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007-2009 Torch Mobile, 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 "Pasteboard.h" + +#include "CString.h" +#include "ClipboardUtilitiesWin.h" +#include "Document.h" +#include "DocumentFragment.h" +#include "Element.h" +#include "Frame.h" +#include "HitTestResult.h" +#include "Image.h" +#include "KURL.h" +#include "Page.h" +#include "Range.h" +#include "RenderImage.h" +#include "TextEncoding.h" +#include "markup.h" + +namespace WebCore { + +static UINT HTMLClipboardFormat = 0; +static UINT BookmarkClipboardFormat = 0; +static UINT WebSmartPasteFormat = 0; + +extern HDC hScreenDC; + +static LRESULT CALLBACK PasteboardOwnerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LRESULT lresult = 0; + LONG longPtr = GetWindowLong(hWnd, 0); + + switch (message) { + case WM_RENDERFORMAT: + // This message comes when SetClipboardData was sent a null data handle + // and now it's come time to put the data on the clipboard. + break; + case WM_RENDERALLFORMATS: + // This message comes when SetClipboardData was sent a null data handle + // and now this application is about to quit, so it must put data on + // the clipboard before it exits. + break; + case WM_DESTROY: + break; + default: + lresult = DefWindowProc(hWnd, message, wParam, lParam); + break; + } + return lresult; +} + +Pasteboard* Pasteboard::generalPasteboard() +{ + static Pasteboard* pasteboard = new Pasteboard; + return pasteboard; +} + +Pasteboard::Pasteboard() +{ + // make a dummy HWND to be the Windows clipboard's owner + WNDCLASS wc = {0}; + memset(&wc, 0, sizeof(wc)); + wc.lpfnWndProc = PasteboardOwnerWndProc; + wc.hInstance = Page::instanceHandle(); + wc.lpszClassName = L"PasteboardOwnerWindowClass"; + ::RegisterClass(&wc); + + m_owner = ::CreateWindow(L"PasteboardOwnerWindowClass", L"PasteboardOwnerWindow", 0, 0, 0, 0, 0, + HWND_MESSAGE, 0, 0, 0); + + HTMLClipboardFormat = ::RegisterClipboardFormat(L"HTML Format"); + BookmarkClipboardFormat = ::RegisterClipboardFormat(L"UniformResourceLocatorW"); + WebSmartPasteFormat = ::RegisterClipboardFormat(L"WebKit Smart Paste Format"); +} + +void Pasteboard::clear() +{ + if (::OpenClipboard(m_owner)) { + ::EmptyClipboard(); + ::CloseClipboard(); + } +} + +void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) +{ + clear(); + + // Put CF_HTML format on the pasteboard + if (::OpenClipboard(m_owner)) { + ExceptionCode ec = 0; + Vector<char> data; + markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url(), data); + HGLOBAL cbData = createGlobalData(data); + if (!::SetClipboardData(HTMLClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well + String str = frame->selectedText(); + replaceNewlinesWithWindowsStyleNewlines(str); + replaceNBSPWithSpace(str); + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(str); + if (!::SetClipboardData(CF_UNICODETEXT, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // enable smart-replacing later on by putting dummy data on the pasteboard + if (canSmartCopyOrDelete) { + if (::OpenClipboard(m_owner)) { + ::SetClipboardData(WebSmartPasteFormat, 0); + ::CloseClipboard(); + } + } +} + +void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) +{ + ASSERT(!url.isEmpty()); + + clear(); + + String title(titleStr); + if (title.isEmpty()) { + title = url.lastPathComponent(); + if (title.isEmpty()) + title = url.host(); + } + + // write to clipboard in format com.apple.safari.bookmarkdata to be able to paste into the bookmarks view with appropriate title + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(url, title); + if (!::SetClipboardData(BookmarkClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // write to clipboard in format CF_HTML to be able to paste into contenteditable areas as a link + if (::OpenClipboard(m_owner)) { + Vector<char> data; + markupToCF_HTML(urlToMarkup(url, title), "", data); + HGLOBAL cbData = createGlobalData(data); + if (!::SetClipboardData(HTMLClipboardFormat, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } + + // bare-bones CF_UNICODETEXT support + if (::OpenClipboard(m_owner)) { + HGLOBAL cbData = createGlobalData(url.string()); + if (!::SetClipboardData(CF_UNICODETEXT, cbData)) + ::GlobalFree(cbData); + ::CloseClipboard(); + } +} + +void Pasteboard::writeImage(Node* node, const KURL&, const String&) +{ + ASSERT(node && node->renderer() && node->renderer()->isImage()); + RenderImage* renderer = static_cast<RenderImage*>(node->renderer()); + CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage()); + ASSERT(cachedImage); + Image* image = cachedImage->image(); + ASSERT(image); + + clear(); + + RefPtr<SharedBitmap> sourceBmp = image->nativeImageForCurrentFrame(); + if (!sourceBmp) + return; + + IntRect rect(0, 0, sourceBmp->width(), sourceBmp->height()); + BitmapInfo bmpInfo; + void* pixels; + HBITMAP resultBitmap = sourceBmp->clipBitmap(rect, true, bmpInfo, pixels); + if (!resultBitmap) + return; + + if (::OpenClipboard(m_owner)) { + ::SetClipboardData(CF_BITMAP, resultBitmap); + ::CloseClipboard(); + } else + DeleteObject(resultBitmap); +} + +bool Pasteboard::canSmartReplace() +{ + return ::IsClipboardFormatAvailable(WebSmartPasteFormat); +} + +String Pasteboard::plainText(Frame* frame) +{ + if (::IsClipboardFormatAvailable(CF_UNICODETEXT) && ::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_UNICODETEXT); + if (cbData) { + UChar* buffer = (UChar*)GlobalLock(cbData); + String fromClipboard(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + return fromClipboard; + } else + CloseClipboard(); + } + + if (::IsClipboardFormatAvailable(CF_TEXT) && ::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_TEXT); + if (cbData) { + char* buffer = (char*)GlobalLock(cbData); + String fromClipboard(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + return fromClipboard; + } else + CloseClipboard(); + } + + return String(); +} + +PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) +{ + chosePlainText = false; + + if (::IsClipboardFormatAvailable(HTMLClipboardFormat) && ::OpenClipboard(m_owner)) { + // get data off of clipboard + HANDLE cbData = ::GetClipboardData(HTMLClipboardFormat); + if (cbData) { + SIZE_T dataSize = ::GlobalSize(cbData); + String cf_html(UTF8Encoding().decode((char*)GlobalLock(cbData), dataSize)); + GlobalUnlock(cbData); + CloseClipboard(); + + PassRefPtr<DocumentFragment> fragment = fragmentFromCF_HTML(frame->document(), cf_html); + if (fragment) + return fragment; + } else + CloseClipboard(); + } + + if (allowPlainText && IsClipboardFormatAvailable(CF_UNICODETEXT)) { + chosePlainText = true; + if (OpenClipboard(m_owner)) { + HANDLE cbData = GetClipboardData(CF_UNICODETEXT); + if (cbData) { + UChar* buffer = (UChar*)GlobalLock(cbData); + String str(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str); + if (fragment) + return fragment.release(); + } else + CloseClipboard(); + } + } + + if (allowPlainText && ::IsClipboardFormatAvailable(CF_TEXT)) { + chosePlainText = true; + if (::OpenClipboard(m_owner)) { + HANDLE cbData = ::GetClipboardData(CF_TEXT); + if (cbData) { + char* buffer = (char*)GlobalLock(cbData); + String str(buffer); + GlobalUnlock(cbData); + CloseClipboard(); + RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), str); + if (fragment) + return fragment.release(); + } else + CloseClipboard(); + } + } + + return 0; +} + +bool Pasteboard::hasData() +{ + return hasDataInFormat(CF_UNICODETEXT) || hasDataInFormat(CF_TEXT); +} + +bool Pasteboard::hasDataInFormat(unsigned int format) +{ + return ::IsClipboardFormatAvailable(format); +} + +} // namespace WebCore diff --git a/WebCore/platform/wince/SearchPopupMenuWince.cpp b/WebCore/platform/wince/SearchPopupMenuWince.cpp new file mode 100644 index 0000000..ca11292 --- /dev/null +++ b/WebCore/platform/wince/SearchPopupMenuWince.cpp @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Torch Mobile Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "SearchPopupMenu.h" + +#include "AtomicString.h" + +namespace WebCore { + +SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) +: PopupMenu(client) +{ +} + +bool SearchPopupMenu::enabled() +{ + return false; +} + +void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) +{ + if (name.isEmpty()) + return; + + notImplemented(); +} + +void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) +{ + if (name.isEmpty()) + return; + + notImplemented(); +} + +} diff --git a/WebCore/platform/wince/SharedTimerWince.cpp b/WebCore/platform/wince/SharedTimerWince.cpp new file mode 100644 index 0000000..ca2f104 --- /dev/null +++ b/WebCore/platform/wince/SharedTimerWince.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007-2008 Torch Mobile, 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 "SharedTimer.h" + +#include "Page.h" +#include "SystemTime.h" +#include "Widget.h" +#include <wtf/Assertions.h> +#include <wtf/CurrentTime.h> +#include <windows.h> + +namespace JSC { +extern void* g_stackBase; +} + +namespace WebCore { + +enum { + TimerIdNone = 0, + TimerIdAuto, + TimerIdManual, +}; +static UINT timerID = TimerIdNone; + +static void (*sharedTimerFiredFunction)(); + +static HWND timerWindowHandle = 0; +const LPCWSTR kTimerWindowClassName = L"TimerWindowClass"; + +LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int dummy; + JSC::g_stackBase = &dummy; + + if (message == WM_TIMER) { + if (timerID != TimerIdNone) + sharedTimerFiredFunction(); + } else if (message == WM_USER) { + if (timerID = TimerIdManual) { + sharedTimerFiredFunction(); + PostMessage(hWnd, WM_USER, 0, 0); + } + } else { + JSC::g_stackBase = 0; + return DefWindowProc(hWnd, message, wParam, lParam); + } + JSC::g_stackBase = 0; + return 0; +} + +static void initializeOffScreenTimerWindow() +{ + if (timerWindowHandle) + return; + + WNDCLASS wcex = {0}; + wcex.lpfnWndProc = TimerWindowWndProc; + wcex.hInstance = Page::instanceHandle(); + wcex.lpszClassName = kTimerWindowClassName; + RegisterClass(&wcex); + + timerWindowHandle = CreateWindow(kTimerWindowClassName, 0, 0, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, HWND_MESSAGE, 0, Page::instanceHandle(), 0); +} + +void setSharedTimerFiredFunction(void (*f)()) +{ + sharedTimerFiredFunction = f; +} + +#define USER_TIMER_MAXIMUM 0x7FFFFFFF +#define USER_TIMER_MINIMUM 0x0000000A + +void setSharedTimerFireTime(double fireTime) +{ + ASSERT(sharedTimerFiredFunction); + + double interval = (fireTime - currentTime()) * 1000.; + unsigned intervalInMS = interval < USER_TIMER_MINIMUM + ? USER_TIMER_MINIMUM + : interval > USER_TIMER_MAXIMUM + ? USER_TIMER_MAXIMUM + : static_cast<unsigned>(interval); + + if (timerID == TimerIdAuto) { + KillTimer(timerWindowHandle, TimerIdAuto); + timerID = TimerIdNone; + } + + initializeOffScreenTimerWindow(); + if (SetTimer(timerWindowHandle, TimerIdAuto, intervalInMS, 0)) + timerID = TimerIdAuto; + else if (timerID != TimerIdManual) + PostMessage(timerWindowHandle, WM_USER, 0, 0); +} + +void stopSharedTimer() +{ + if (timerID == TimerIdAuto) + KillTimer(timerWindowHandle, TimerIdAuto); + + timerID = TimerIdNone; +} + +} diff --git a/WebCore/platform/wince/SystemTimeWince.cpp b/WebCore/platform/wince/SystemTimeWince.cpp new file mode 100644 index 0000000..70b705b --- /dev/null +++ b/WebCore/platform/wince/SystemTimeWince.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2007-2008 Torch Mobile, 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 "SystemTime.h" + +#include <windows.h> + +namespace WebCore { + +float userIdleTime() +{ + return FLT_MAX; +} + +} diff --git a/WebCore/plugins/win/PaintHooks.asm b/WebCore/plugins/win/PaintHooks.asm new file mode 100644 index 0000000..1508813 --- /dev/null +++ b/WebCore/plugins/win/PaintHooks.asm @@ -0,0 +1,50 @@ +;/* +; Copyright (C) 2009 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. +;*/ + +;HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); + +PUBLIC _HBeginPaint + +_TEXT SEGMENT + +_HBeginPaint PROC + mov r10,rcx + mov eax,1017h + syscall + ret +_HBeginPaint ENDP + +_TEXT ENDS + +;BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint); + +PUBLIC _HEndPaint + +_TEXT SEGMENT + +_HEndPaint PROC + mov r10,rcx + mov eax,1019h + syscall + ret +_HEndPaint ENDP + +_TEXT ENDS + +END diff --git a/WebCore/plugins/win/PluginViewWin.cpp b/WebCore/plugins/win/PluginViewWin.cpp index 0da4402..4e94feb 100644 --- a/WebCore/plugins/win/PluginViewWin.cpp +++ b/WebCore/plugins/win/PluginViewWin.cpp @@ -115,6 +115,14 @@ static BYTE* beginPaint; static unsigned endPaintSysCall; static BYTE* endPaint; +typedef HDC (WINAPI *PtrBeginPaint)(HWND, PAINTSTRUCT*); +typedef BOOL (WINAPI *PtrEndPaint)(HWND, const PAINTSTRUCT*); + +#if PLATFORM(WIN_OS) && PLATFORM(X86_64) && COMPILER(MSVC) +extern "C" HDC __stdcall _HBeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint); +extern "C" BOOL __stdcall _HEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint); +#endif + HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) { PluginView* pluginView = reinterpret_cast<PluginView*>(GetProp(hWnd, kWebPluginViewProperty)); @@ -137,12 +145,14 @@ HDC WINAPI PluginView::hookedBeginPaint(HWND hWnd, PAINTSTRUCT* lpPaint) : "memory" ); return result; -#else +#elif defined(_M_IX86) // Call through to the original BeginPaint. __asm mov eax, beginPaintSysCall __asm push lpPaint __asm push hWnd __asm call beginPaint +#else + return _HBeginPaint(hWnd, lpPaint); #endif } @@ -164,12 +174,14 @@ BOOL WINAPI PluginView::hookedEndPaint(HWND hWnd, const PAINTSTRUCT* lpPaint) : "a" (endPaintSysCall), "g" (lpPaint), "g" (hWnd), "m" (*endPaint) ); return result; -#else +#elif defined (_M_IX86) // Call through to the original EndPaint. __asm mov eax, endPaintSysCall __asm push lpPaint __asm push hWnd __asm call endPaint +#else + return _HEndPaint(hWnd, lpPaint); #endif } @@ -182,6 +194,7 @@ static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE pProc = reinterpret_cast<BYTE*>(reinterpret_cast<ptrdiff_t>(GetProcAddress(hMod, proc))); +#if COMPILER(GCC) || defined(_M_IX86) if (pProc[0] != 0xB8) return; @@ -197,6 +210,35 @@ static void hook(const char* module, const char* proc, unsigned& sysCallID, BYTE *reinterpret_cast<unsigned*>(pProc + 1) = reinterpret_cast<intptr_t>(pNewProc) - reinterpret_cast<intptr_t>(pProc + 5); pProc += 5; +#else + /* Disassembly of BeginPaint() + 00000000779FC5B0 4C 8B D1 mov r10,rcx + 00000000779FC5B3 B8 17 10 00 00 mov eax,1017h + 00000000779FC5B8 0F 05 syscall + 00000000779FC5BA C3 ret + 00000000779FC5BB 90 nop + 00000000779FC5BC 90 nop + 00000000779FC5BD 90 nop + 00000000779FC5BE 90 nop + 00000000779FC5BF 90 nop + 00000000779FC5C0 90 nop + 00000000779FC5C1 90 nop + 00000000779FC5C2 90 nop + 00000000779FC5C3 90 nop + */ + // Check for the signature as in the above disassembly + DWORD guard = 0xB8D18B4C; + if (*reinterpret_cast<DWORD*>(pProc) != guard) + return; + + DWORD flOldProtect; + VirtualProtect(pProc, 12, PAGE_EXECUTE_READWRITE, & flOldProtect); + pProc[0] = 0x48; // mov rax, this + pProc[1] = 0xb8; + *(__int64*)(pProc+2) = (__int64)pNewProc; + pProc[10] = 0xff; // jmp rax + pProc[11] = 0xe0; +#endif } static void setUpOffscreenPaintingHooks(HDC (WINAPI*hookedBeginPaint)(HWND, PAINTSTRUCT*), BOOL (WINAPI*hookedEndPaint)(HWND, const PAINTSTRUCT*)) diff --git a/WebCore/rendering/HitTestResult.cpp b/WebCore/rendering/HitTestResult.cpp index b7de46b..0aaddc9 100644 --- a/WebCore/rendering/HitTestResult.cpp +++ b/WebCore/rendering/HitTestResult.cpp @@ -209,7 +209,7 @@ String HitTestResult::altDisplayString() const if (m_innerNonSharedNode->hasTagName(imgTag)) { HTMLImageElement* image = static_cast<HTMLImageElement*>(m_innerNonSharedNode.get()); - return displayString(image->alt(), m_innerNonSharedNode.get()); + return displayString(image->getAttribute(altAttr), m_innerNonSharedNode.get()); } if (m_innerNonSharedNode->hasTagName(inputTag)) { diff --git a/WebCore/rendering/InlineFlowBox.cpp b/WebCore/rendering/InlineFlowBox.cpp index 543c190..98c5c43 100644 --- a/WebCore/rendering/InlineFlowBox.cpp +++ b/WebCore/rendering/InlineFlowBox.cpp @@ -29,6 +29,7 @@ #include "RootInlineBox.h" #include "RenderBlock.h" #include "RenderInline.h" +#include "RenderLayer.h" #include "RenderListMarker.h" #include "RenderTableCell.h" #include "RootInlineBox.h" @@ -774,18 +775,23 @@ void InlineFlowBox::paintMask(RenderObject::PaintInfo& paintInfo, int tx, int ty int w = width(); int h = height(); - // Figure out if we need to push a transparency layer to render our mask. - bool pushTransparencyLayer = false; const NinePieceImage& maskNinePieceImage = renderer()->style()->maskBoxImage(); StyleImage* maskBoxImage = renderer()->style()->maskBoxImage().image(); - if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next()) - pushTransparencyLayer = true; - - CompositeOperator compositeOp = CompositeDestinationIn; - if (pushTransparencyLayer) { - paintInfo.context->setCompositeOperation(CompositeDestinationIn); - paintInfo.context->beginTransparencyLayer(1.0f); - compositeOp = CompositeSourceOver; + + // Figure out if we need to push a transparency layer to render our mask. + bool pushTransparencyLayer = false; + bool compositedMask = renderer()->hasLayer() && boxModelObject()->layer()->hasCompositedMask(); + CompositeOperator compositeOp = CompositeSourceOver; + if (!compositedMask) { + if ((maskBoxImage && renderer()->style()->maskLayers()->hasImage()) || renderer()->style()->maskLayers()->next()) + pushTransparencyLayer = true; + + compositeOp = CompositeDestinationIn; + if (pushTransparencyLayer) { + paintInfo.context->setCompositeOperation(CompositeDestinationIn); + paintInfo.context->beginTransparencyLayer(1.0f); + compositeOp = CompositeSourceOver; + } } paintFillLayers(paintInfo, Color(), renderer()->style()->maskLayers(), tx, ty, w, h, compositeOp); diff --git a/WebCore/rendering/MediaControlElements.cpp b/WebCore/rendering/MediaControlElements.cpp index 352f270..6715111 100644 --- a/WebCore/rendering/MediaControlElements.cpp +++ b/WebCore/rendering/MediaControlElements.cpp @@ -32,28 +32,27 @@ #include "MediaControlElements.h" -#include "LocalizedStrings.h" #include "EventNames.h" #include "FloatConversion.h" #include "Frame.h" #include "HTMLNames.h" +#include "LocalizedStrings.h" #include "MouseEvent.h" #include "RenderMedia.h" #include "RenderSlider.h" #include "RenderTheme.h" -#include "CString.h" namespace WebCore { using namespace HTMLNames; -// FIXME: These constants may need to be tweaked to better match the seeking in the QT plugin +// FIXME: These constants may need to be tweaked to better match the seeking in the QuickTime plug-in. static const float cSeekRepeatDelay = 0.1f; static const float cStepTime = 0.07f; static const float cSeekTime = 0.2f; -MediaControlShadowRootElement::MediaControlShadowRootElement(Document* doc, HTMLMediaElement* mediaElement) - : HTMLDivElement(divTag, doc) +MediaControlShadowRootElement::MediaControlShadowRootElement(Document* document, HTMLMediaElement* mediaElement) + : HTMLDivElement(divTag, document) , m_mediaElement(mediaElement) { RefPtr<RenderStyle> rootStyle = RenderStyle::create(); @@ -76,10 +75,9 @@ void MediaControlShadowRootElement::updateStyle() } // ---------------------------- - -MediaControlElement::MediaControlElement(Document* doc, PseudoId pseudo, HTMLMediaElement* mediaElement) - : HTMLDivElement(divTag, doc) +MediaControlElement::MediaControlElement(Document* document, PseudoId pseudo, HTMLMediaElement* mediaElement) + : HTMLDivElement(divTag, document) , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) { @@ -165,8 +163,8 @@ void MediaControlElement::updateStyle() // ---------------------------- -MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* doc, HTMLMediaElement* element) -: MediaControlElement(doc, MEDIA_CONTROLS_TIMELINE_CONTAINER, element) +MediaControlTimelineContainerElement::MediaControlTimelineContainerElement(Document* document, HTMLMediaElement* element) + : MediaControlElement(document, MEDIA_CONTROLS_TIMELINE_CONTAINER, element) { } @@ -188,9 +186,9 @@ bool MediaControlTimelineContainerElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* doc, HTMLMediaElement* element) -: MediaControlElement(doc, MEDIA_CONTROLS_STATUS_DISPLAY, element) -, m_stateBeingDisplayed(Nothing) +MediaControlStatusDisplayElement::MediaControlStatusDisplayElement(Document* document, HTMLMediaElement* element) + : MediaControlElement(document, MEDIA_CONTROLS_STATUS_DISPLAY, element) + , m_stateBeingDisplayed(Nothing) { } @@ -235,8 +233,8 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlInputElement::MediaControlInputElement(Document* doc, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType) - : HTMLInputElement(inputTag, doc) +MediaControlInputElement::MediaControlInputElement(Document* document, PseudoId pseudo, const String& type, HTMLMediaElement* mediaElement, MediaControlElementType displayType) + : HTMLInputElement(inputTag, document) , m_mediaElement(mediaElement) , m_pseudoStyleId(pseudo) , m_displayType(displayType) @@ -330,8 +328,8 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp // ---------------------------- -MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton) +MediaControlMuteButtonElement::MediaControlMuteButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_MUTE_BUTTON, "button", element, element->muted() ? MediaUnMuteButton : MediaMuteButton) { } @@ -351,8 +349,8 @@ void MediaControlMuteButtonElement::updateDisplayType() // ---------------------------- -MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton) +MediaControlPlayButtonElement::MediaControlPlayButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_PLAY_BUTTON, "button", element, element->canPlay() ? MediaPlayButton : MediaPauseButton) { } @@ -372,8 +370,8 @@ void MediaControlPlayButtonElement::updateDisplayType() // ---------------------------- -MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* doc, HTMLMediaElement* element, bool forward) - : MediaControlInputElement(doc, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON, +MediaControlSeekButtonElement::MediaControlSeekButtonElement(Document* document, HTMLMediaElement* element, bool forward) + : MediaControlInputElement(document, forward ? MEDIA_CONTROLS_SEEK_FORWARD_BUTTON : MEDIA_CONTROLS_SEEK_BACK_BUTTON, "button", element, forward ? MediaSeekForwardButton : MediaSeekBackButton) , m_forward(forward) , m_seeking(false) @@ -432,8 +430,8 @@ void MediaControlSeekButtonElement::detach() // ---------------------------- -MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* doc, HTMLMediaElement* element) -: MediaControlInputElement(doc, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton) +MediaControlRewindButtonElement::MediaControlRewindButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_REWIND_BUTTON, "button", element, MediaRewindButton) { } @@ -454,8 +452,8 @@ bool MediaControlRewindButtonElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* doc, HTMLMediaElement* element) -: MediaControlInputElement(doc, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton) +MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, "button", element, MediaReturnToRealtimeButton) { } @@ -482,8 +480,8 @@ MediaControlTimelineElement::MediaControlTimelineElement(Document* document, HTM void MediaControlTimelineElement::defaultEventHandler(Event* event) { - // Left button is 0. Accepts only if mouse event is from left button. - if (!event->isMouseEvent() || static_cast<MouseEvent*>(event)->button()) + // Left button is 0. Rejects mouse events not from left button. + if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button()) return; if (event->type() == eventNames().mousedownEvent) @@ -520,8 +518,8 @@ void MediaControlTimelineElement::update(bool updateDuration) // ---------------------------- -MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* doc, HTMLMediaElement* element) - : MediaControlInputElement(doc, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton) +MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(Document* document, HTMLMediaElement* element) + : MediaControlInputElement(document, MEDIA_CONTROLS_FULLSCREEN_BUTTON, "button", element, MediaFullscreenButton) { } @@ -541,8 +539,8 @@ bool MediaControlFullscreenButtonElement::rendererIsNeeded(RenderStyle* style) // ---------------------------- -MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* doc, PseudoId pseudo, HTMLMediaElement* element) - : MediaControlElement(doc, pseudo, element) +MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(Document* document, PseudoId pseudo, HTMLMediaElement* element) + : MediaControlElement(document, pseudo, element) , m_isVisible(true) { } diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp index e10c331..03f5781 100644 --- a/WebCore/rendering/RenderBlock.cpp +++ b/WebCore/rendering/RenderBlock.cpp @@ -33,6 +33,7 @@ #include "HTMLNames.h" #include "HitTestResult.h" #include "InlineTextBox.h" +#include "RenderFlexibleBox.h" #include "RenderImage.h" #include "RenderInline.h" #include "RenderMarquee.h" @@ -734,6 +735,31 @@ void RenderBlock::updateScrollInfoAfterLayout() } } +void RenderBlock::updateOverflowWithShadowAndReflection() +{ + if (hasOverflowClip()) + return; + + int shadowLeft; + int shadowRight; + int shadowTop; + int shadowBottom; + style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); + + m_overflowLeft = min(m_overflowLeft, shadowLeft); + m_overflowWidth = max(m_overflowWidth, width() + shadowRight); + m_overflowTop = min(m_overflowTop, shadowTop); + m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); + + if (hasReflection()) { + IntRect reflection(reflectionBox()); + m_overflowLeft = min(m_overflowLeft, reflection.x()); + m_overflowWidth = max(m_overflowWidth, reflection.right()); + m_overflowTop = min(m_overflowTop, reflection.y()); + m_overflowHeight = max(m_overflowHeight, reflection.bottom()); + } +} + void RenderBlock::layout() { // Update our first letter info now. @@ -884,26 +910,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren) m_overflowWidth = max(m_overflowWidth, width()); m_overflowHeight = max(m_overflowHeight, height()); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowWidth = max(m_overflowWidth, reflection.right()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); @@ -1032,7 +1039,10 @@ bool RenderBlock::handleRunInChild(RenderBox* child) // See if we have a run-in element with inline children. If the // children aren't inline, then just treat the run-in as a normal // block. - if (!child->isRunIn() || !child->childrenInline() && !child->isReplaced()) + if (!child->isRunIn() || !child->childrenInline()) + return false; + // FIXME: We don't handle non-block elements with run-in for now. + if (!child->isRenderBlock()) return false; // Get the next non-positioned/non-floating RenderBlock. @@ -3298,13 +3308,17 @@ int RenderBlock::getClearDelta(RenderBox* child, int yPos) // We also clear floats if we are too big to sit on the same line as a float (and wish to avoid floats by default). // FIXME: Note that the remaining space checks aren't quite accurate, since you should be able to clear only some floats (the minimum # needed // to fit) and not all (we should be using nextFloatBottomBelow and looping). - // Do not allow tables to wrap in quirks or even in almost strict mode - // (ebay on the PLT, finance.yahoo.com in the real world, versiontracker.com forces even almost strict mode not to work) int result = clearSet ? max(0, bottom - yPos) : 0; - if (!result && child->avoidsFloats() && child->style()->width().isFixed() && - child->minPrefWidth() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth() && - document()->inStrictMode()) - result = max(0, floatBottom() - yPos); + if (!result && child->avoidsFloats()) { + int oldYPos = child->y(); + int oldWidth = child->width(); + child->setY(yPos); + child->calcWidth(); + if (child->width() > lineWidth(yPos, false) && child->minPrefWidth() <= availableWidth()) + result = max(0, floatBottom() - yPos); + child->setY(oldYPos); + child->setWidth(oldWidth); + } return result; } @@ -5121,13 +5135,20 @@ void RenderBlock::addFocusRingRects(GraphicsContext* graphicsContext, int tx, in ty - y() + inlineContinuation()->containingBlock()->y()); } -RenderBlock* RenderBlock::createAnonymousBlock() const +RenderBlock* RenderBlock::createAnonymousBlock(bool isFlexibleBox) const { RefPtr<RenderStyle> newStyle = RenderStyle::create(); newStyle->inheritFrom(style()); - newStyle->setDisplay(BLOCK); - RenderBlock* newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); + RenderBlock* newBox = 0; + if (isFlexibleBox) { + newStyle->setDisplay(BOX); + newBox = new (renderArena()) RenderFlexibleBox(document() /* anonymous box */); + } else { + newStyle->setDisplay(BLOCK); + newBox = new (renderArena()) RenderBlock(document() /* anonymous box */); + } + newBox->setStyle(newStyle.release()); return newBox; } diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h index 839be16..88d2386 100644 --- a/WebCore/rendering/RenderBlock.h +++ b/WebCore/rendering/RenderBlock.h @@ -147,7 +147,7 @@ public: // This function is a convenience helper for creating an anonymous block that inherits its // style from this RenderBlock. - RenderBlock* createAnonymousBlock() const; + RenderBlock* createAnonymousBlock(bool isFlexibleBox = false) const; Vector<IntRect>* columnRects() const; int columnGap() const; @@ -207,7 +207,9 @@ protected: virtual bool hasLineIfEmpty() const; bool layoutOnlyPositionedObjects(); - + + void updateOverflowWithShadowAndReflection(); + private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp index 4c2bff0..a1a2d9a 100644 --- a/WebCore/rendering/RenderBox.cpp +++ b/WebCore/rendering/RenderBox.cpp @@ -416,6 +416,11 @@ bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, return b->scroll(direction, granularity, multiplier); return false; } + +bool RenderBox::canBeScrolledAndHasScrollableArea() const +{ + return canBeProgramaticallyScrolled(false) && (scrollHeight() != clientHeight() || scrollWidth() != clientWidth()); +} bool RenderBox::canBeProgramaticallyScrolled(bool) const { @@ -653,31 +658,36 @@ void RenderBox::paintMaskImages(const PaintInfo& paintInfo, int tx, int ty, int { // Figure out if we need to push a transparency layer to render our mask. bool pushTransparencyLayer = false; - StyleImage* maskBoxImage = style()->maskBoxImage().image(); - if (maskBoxImage && style()->maskLayers()->hasImage()) { - pushTransparencyLayer = true; - } else { - // We have to use an extra image buffer to hold the mask. Multiple mask images need - // to composite together using source-over so that they can then combine into a single unified mask that - // can be composited with the content using destination-in. SVG images need to be able to set compositing modes - // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer - // and composite that buffer as the mask. - // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering - // before pushing the transparency layer. - for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) { - if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) { - pushTransparencyLayer = true; - // We found one image that can be used in rendering, exit the loop - break; + bool compositedMask = hasLayer() && layer()->hasCompositedMask(); + CompositeOperator compositeOp = CompositeSourceOver; + + if (!compositedMask) { + StyleImage* maskBoxImage = style()->maskBoxImage().image(); + if (maskBoxImage && style()->maskLayers()->hasImage()) { + pushTransparencyLayer = true; + } else { + // We have to use an extra image buffer to hold the mask. Multiple mask images need + // to composite together using source-over so that they can then combine into a single unified mask that + // can be composited with the content using destination-in. SVG images need to be able to set compositing modes + // as they draw images contained inside their sub-document, so we paint all our images into a separate buffer + // and composite that buffer as the mask. + // We have to check that the mask images to be rendered contain at least one image that can be actually used in rendering + // before pushing the transparency layer. + for (const FillLayer* fillLayer = style()->maskLayers()->next(); fillLayer; fillLayer = fillLayer->next()) { + if (fillLayer->hasImage() && fillLayer->image()->canRender(style()->effectiveZoom())) { + pushTransparencyLayer = true; + // We found one image that can be used in rendering, exit the loop + break; + } } } - } - - CompositeOperator compositeOp = CompositeDestinationIn; - if (pushTransparencyLayer) { - paintInfo.context->setCompositeOperation(CompositeDestinationIn); - paintInfo.context->beginTransparencyLayer(1.0f); - compositeOp = CompositeSourceOver; + + compositeOp = CompositeDestinationIn; + if (pushTransparencyLayer) { + paintInfo.context->setCompositeOperation(CompositeDestinationIn); + paintInfo.context->beginTransparencyLayer(1.0f); + compositeOp = CompositeSourceOver; + } } paintFillLayers(paintInfo, Color(), style()->maskLayers(), tx, ty, w, h, compositeOp); @@ -2701,11 +2711,6 @@ int RenderBox::leftmostPosition(bool /*includeOverflowInterior*/, bool includeSe return left; } -bool RenderBox::isAfterContent(RenderObject* child) const -{ - return (child && child->style()->styleType() == AFTER && (!child->isText() || child->isBR())); -} - VisiblePosition RenderBox::positionForPoint(const IntPoint& point) { // no children...return this render object's element, if there is one, and offset 0 diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h index cb2297b..e86d073 100644 --- a/WebCore/rendering/RenderBox.h +++ b/WebCore/rendering/RenderBox.h @@ -230,6 +230,7 @@ public: virtual int verticalScrollbarWidth() const; int horizontalScrollbarHeight() const; virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1.0f); + bool canBeScrolledAndHasScrollableArea() const; virtual bool canBeProgramaticallyScrolled(bool) const; virtual void autoscroll(); virtual void stopAutoscroll() { } @@ -333,9 +334,6 @@ private: // These include tables, positioned objects, floats and flexible boxes. virtual void calcPrefWidths() { setPrefWidthsDirty(false); } -protected: - bool isAfterContent(RenderObject* child) const; - private: // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). IntRect m_frameRect; diff --git a/WebCore/rendering/RenderButton.cpp b/WebCore/rendering/RenderButton.cpp index 6d36a0f..f3ae558 100644 --- a/WebCore/rendering/RenderButton.cpp +++ b/WebCore/rendering/RenderButton.cpp @@ -52,7 +52,8 @@ void RenderButton::addChild(RenderObject* newChild, RenderObject* beforeChild) if (!m_inner) { // Create an anonymous block. ASSERT(!firstChild()); - m_inner = createAnonymousBlock(); + bool isFlexibleBox = style()->display() == BOX || style()->display() == INLINE_BOX; + m_inner = createAnonymousBlock(isFlexibleBox); setupInnerStyle(m_inner->style()); RenderFlexibleBox::addChild(m_inner); } @@ -108,6 +109,7 @@ void RenderButton::setupInnerStyle(RenderStyle* innerStyle) // RenderBlock::createAnonymousBlock creates a new RenderStyle, so this is // safe to modify. innerStyle->setBoxFlex(1.0f); + innerStyle->setBoxOrient(style()->boxOrient()); innerStyle->setPaddingTop(Length(theme()->buttonInternalPaddingTop(), Fixed)); innerStyle->setPaddingRight(Length(theme()->buttonInternalPaddingRight(), Fixed)); diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp index 437991a..8618d11 100644 --- a/WebCore/rendering/RenderFieldset.cpp +++ b/WebCore/rendering/RenderFieldset.cpp @@ -108,10 +108,11 @@ RenderBox* RenderFieldset::findLegend() const { for (RenderObject* legend = firstChild(); legend; legend = legend->nextSibling()) { if (!legend->isFloatingOrPositioned() && legend->node() && - legend->node()->hasTagName(legendTag) + (legend->node()->hasTagName(legendTag) #if ENABLE(WML) || legend->node()->hasTagName(WMLNames::insertedLegendTag) #endif + ) ) return toRenderBox(legend); } diff --git a/WebCore/rendering/RenderFlexibleBox.cpp b/WebCore/rendering/RenderFlexibleBox.cpp index 6bbcc43..fa6d7a0 100644 --- a/WebCore/rendering/RenderFlexibleBox.cpp +++ b/WebCore/rendering/RenderFlexibleBox.cpp @@ -295,26 +295,7 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren) if (m_overflowWidth < width()) m_overflowWidth = width(); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowHeight = max(m_overflowWidth, reflection.right()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); @@ -1161,6 +1142,8 @@ const char *RenderFlexibleBox::renderName() const return "RenderFlexibleBox (floating)"; if (isPositioned()) return "RenderFlexibleBox (positioned)"; + if (isAnonymous()) + return "RenderFlexibleBox (generated)"; if (isRelPositioned()) return "RenderFlexibleBox (relative positioned)"; return "RenderFlexibleBox"; diff --git a/WebCore/rendering/RenderHTMLCanvas.cpp b/WebCore/rendering/RenderHTMLCanvas.cpp index 1fc07f0..3a776ba 100644 --- a/WebCore/rendering/RenderHTMLCanvas.cpp +++ b/WebCore/rendering/RenderHTMLCanvas.cpp @@ -55,10 +55,13 @@ void RenderHTMLCanvas::canvasSizeChanged() IntSize canvasSize = static_cast<HTMLCanvasElement*>(node())->size(); IntSize zoomedSize(canvasSize.width() * style()->effectiveZoom(), canvasSize.height() * style()->effectiveZoom()); - if (canvasSize == intrinsicSize()) + if (zoomedSize == intrinsicSize()) return; - setIntrinsicSize(canvasSize); + setIntrinsicSize(zoomedSize); + + if (!parent()) + return; if (!prefWidthsDirty()) setPrefWidthsDirty(true); diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp index 5c11e41..9692a09 100644 --- a/WebCore/rendering/RenderImage.cpp +++ b/WebCore/rendering/RenderImage.cpp @@ -440,7 +440,7 @@ int RenderImage::minimumReplacedHeight() const HTMLMapElement* RenderImage::imageMap() { HTMLImageElement* i = node() && node()->hasTagName(imgTag) ? static_cast<HTMLImageElement*>(node()) : 0; - return i ? i->document()->getImageMap(i->useMap()) : 0; + return i ? i->document()->getImageMap(i->getAttribute(usemapAttr)) : 0; } bool RenderImage::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, int x, int y, int tx, int ty, HitTestAction hitTestAction) diff --git a/WebCore/rendering/RenderInline.cpp b/WebCore/rendering/RenderInline.cpp index 53962d2..664af93 100644 --- a/WebCore/rendering/RenderInline.cpp +++ b/WebCore/rendering/RenderInline.cpp @@ -131,18 +131,6 @@ void RenderInline::styleDidChange(StyleDifference diff, const RenderStyle* oldSt } } -static inline bool isAfterContent(RenderObject* child) -{ - if (!child) - return false; - if (child->style()->styleType() != AFTER) - return false; - // Text nodes don't have their own styles, so ignore the style on a text node. - if (child->isText() && !child->isBR()) - return false; - return true; -} - void RenderInline::addChild(RenderObject* newChild, RenderObject* beforeChild) { if (continuation()) diff --git a/WebCore/rendering/RenderLayer.cpp b/WebCore/rendering/RenderLayer.cpp index ab78f40..ca6e5a6 100644 --- a/WebCore/rendering/RenderLayer.cpp +++ b/WebCore/rendering/RenderLayer.cpp @@ -207,12 +207,8 @@ RenderLayer::~RenderLayer() // Make sure we have no lingering clip rects. ASSERT(!m_clipRects); - if (m_reflection) { - if (!m_reflection->documentBeingDestroyed()) - m_reflection->removeLayers(this); - m_reflection->setParent(0); - m_reflection->destroy(); - } + if (m_reflection) + removeReflection(); if (m_scrollCorner) m_scrollCorner->destroy(); @@ -997,6 +993,9 @@ void RenderLayer::panScrollFromPoint(const IntPoint& sourcePoint) void RenderLayer::scrollByRecursively(int xDelta, int yDelta) { + if (!xDelta && !yDelta) + return; + bool restrictedByLineClamp = false; if (renderer()->parent()) restrictedByLineClamp = renderer()->parent()->style()->lineClamp() >= 0; @@ -1006,17 +1005,30 @@ void RenderLayer::scrollByRecursively(int xDelta, int yDelta) int newOffsetY = scrollYOffset() + yDelta; scrollToOffset(newOffsetX, newOffsetY); - // If this layer can't do the scroll we ask its parent + // If this layer can't do the scroll we ask the next layer up that can scroll to try int leftToScrollX = newOffsetX - scrollXOffset(); int leftToScrollY = newOffsetY - scrollYOffset(); if ((leftToScrollX || leftToScrollY) && renderer()->parent()) { - renderer()->parent()->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY); + RenderObject* nextRenderer = renderer()->parent(); + while (nextRenderer) { + if (nextRenderer->isBox() && toRenderBox(nextRenderer)->canBeScrolledAndHasScrollableArea()) { + nextRenderer->enclosingLayer()->scrollByRecursively(leftToScrollX, leftToScrollY); + break; + } + nextRenderer = nextRenderer->parent(); + } + Frame* frame = renderer()->document()->frame(); if (frame) frame->eventHandler()->updateAutoscrollRenderer(); } - } else if (renderer()->view()->frameView()) + } else if (renderer()->view()->frameView()) { + // If we are here, we were called on a renderer that can be programatically scrolled, but doesn't + // have an overflow clip. Which means that it is a document node that can be scrolled. renderer()->view()->frameView()->scrollBy(IntSize(xDelta, yDelta)); + // FIXME: If we didn't scroll the whole way, do we want to try looking at the frames ownerElement? + // https://bugs.webkit.org/show_bug.cgi?id=28237 + } } @@ -2873,6 +2885,11 @@ void RenderLayer::clearBacking() { m_backing.clear(); } + +bool RenderLayer::hasCompositedMask() const +{ + return m_backing && m_backing->hasMaskLayer(); +} #endif void RenderLayer::setParent(RenderLayer* parent) @@ -3183,10 +3200,9 @@ void RenderLayer::styleChanged(StyleDifference diff, const RenderStyle*) m_marquee = 0; } - if (!hasReflection() && m_reflection) { - m_reflection->destroy(); - m_reflection = 0; - } else if (hasReflection()) { + if (!hasReflection() && m_reflection) + removeReflection(); + else if (hasReflection()) { if (!m_reflection) createReflection(); updateReflectionStyle(); @@ -3260,6 +3276,16 @@ void RenderLayer::createReflection() m_reflection->setParent(renderer()); // We create a 1-way connection. } +void RenderLayer::removeReflection() +{ + if (!m_reflection->documentBeingDestroyed()) + m_reflection->removeLayers(this); + + m_reflection->setParent(0); + m_reflection->destroy(); + m_reflection = 0; +} + void RenderLayer::updateReflectionStyle() { RefPtr<RenderStyle> newStyle = RenderStyle::create(); diff --git a/WebCore/rendering/RenderLayer.h b/WebCore/rendering/RenderLayer.h index 1772c66..16ad4d4 100644 --- a/WebCore/rendering/RenderLayer.h +++ b/WebCore/rendering/RenderLayer.h @@ -415,11 +415,13 @@ public: #if USE(ACCELERATED_COMPOSITING) bool isComposited() const { return m_backing != 0; } + bool hasCompositedMask() const; RenderLayerBacking* backing() const { return m_backing.get(); } RenderLayerBacking* ensureBacking(); void clearBacking(); #else bool isComposited() const { return false; } + bool hasCompositedMask() const { return false; } #endif bool paintsWithTransparency() const @@ -507,6 +509,8 @@ private: Node* enclosingElement() const; void createReflection(); + void removeReflection(); + void updateReflectionStyle(); bool paintingInsideReflection() const { return m_paintingInsideReflection; } void setPaintingInsideReflection(bool b) { m_paintingInsideReflection = b; } diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp index e98c458..b60e18f 100644 --- a/WebCore/rendering/RenderLayerBacking.cpp +++ b/WebCore/rendering/RenderLayerBacking.cpp @@ -47,16 +47,14 @@ using namespace std; namespace WebCore { +using namespace HTMLNames; + static bool hasBorderOutlineOrShadow(const RenderStyle*); static bool hasBoxDecorations(const RenderStyle*); static bool hasBoxDecorationsWithBackgroundImage(const RenderStyle*); RenderLayerBacking::RenderLayerBacking(RenderLayer* layer) : m_owningLayer(layer) - , m_ancestorClippingLayer(0) - , m_graphicsLayer(0) - , m_foregroundLayer(0) - , m_clippingLayer(0) , m_hasDirectlyCompositedContent(false) { createGraphicsLayer(); @@ -66,12 +64,13 @@ RenderLayerBacking::~RenderLayerBacking() { updateClippingLayers(false, false); updateForegroundLayer(false); + updateMaskLayer(false); destroyGraphicsLayer(); } void RenderLayerBacking::createGraphicsLayer() { - m_graphicsLayer = GraphicsLayer::createGraphicsLayer(this); + m_graphicsLayer = GraphicsLayer::create(this); #ifndef NDEBUG if (renderer()->node()) { @@ -79,7 +78,7 @@ void RenderLayerBacking::createGraphicsLayer() m_graphicsLayer->setName("Document Node"); else { if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID()) - m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->id()); + m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getAttribute(idAttr)); else m_graphicsLayer->setName(renderer()->renderName()); } @@ -96,14 +95,10 @@ void RenderLayerBacking::destroyGraphicsLayer() if (m_graphicsLayer) m_graphicsLayer->removeFromParent(); - delete m_graphicsLayer; m_graphicsLayer = 0; - - delete m_foregroundLayer; m_foregroundLayer = 0; - - delete m_clippingLayer; m_clippingLayer = 0; + m_maskLayer = 0; } void RenderLayerBacking::updateLayerOpacity() @@ -158,6 +153,9 @@ bool RenderLayerBacking::updateGraphicsLayerConfiguration() if (updateClippingLayers(compositor->clippedByAncestor(m_owningLayer), compositor->clipsCompositingDescendants(m_owningLayer))) layerConfigChanged = true; + if (updateMaskLayer(m_owningLayer->renderer()->hasMask())) + m_graphicsLayer->setMaskLayer(m_maskLayer.get()); + m_hasDirectlyCompositedContent = false; if (canUseDirectCompositing()) { if (renderer()->isImage()) { @@ -251,13 +249,19 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() } // If we have a layer that clips children, position it. + IntRect clippingBox; if (m_clippingLayer) { - IntRect clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0); + clippingBox = toRenderBox(renderer())->overflowClipRect(0, 0); m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location())); m_clippingLayer->setSize(clippingBox.size()); m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint()); } + if (m_maskLayer) { + m_maskLayer->setSize(m_graphicsLayer->size()); + m_maskLayer->setPosition(FloatPoint()); + } + if (m_owningLayer->hasTransform()) { const IntRect borderBox = toRenderBox(renderer())->borderBoxRect(); @@ -293,10 +297,20 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() } if (m_foregroundLayer) { - // The contents layer is always coincidental with the graphicsLayer for now. - m_foregroundLayer->setPosition(IntPoint(0, 0)); - m_foregroundLayer->setSize(newSize); - m_foregroundLayer->setOffsetFromRenderer(m_graphicsLayer->offsetFromRenderer()); + FloatPoint foregroundPosition; + FloatSize foregroundSize = newSize; + IntSize foregroundOffset = m_graphicsLayer->offsetFromRenderer(); + // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it, + // so that it gets correctly sorted with children. In that case, position relative to the clipping layer. + if (m_clippingLayer) { + foregroundPosition = FloatPoint() + (localCompositingBounds.location() - clippingBox.location()); + foregroundSize = FloatSize(clippingBox.size()); + foregroundOffset = clippingBox.location() - IntPoint(); + } + + m_foregroundLayer->setPosition(foregroundPosition); + m_foregroundLayer->setSize(foregroundSize); + m_foregroundLayer->setOffsetFromRenderer(foregroundOffset); } m_graphicsLayer->setContentsRect(contentsBox()); @@ -311,12 +325,12 @@ void RenderLayerBacking::updateInternalHierarchy() if (m_ancestorClippingLayer) { m_ancestorClippingLayer->removeAllChildren(); m_graphicsLayer->removeFromParent(); - m_ancestorClippingLayer->addChild(m_graphicsLayer); + m_ancestorClippingLayer->addChild(m_graphicsLayer.get()); } if (m_clippingLayer) { m_clippingLayer->removeFromParent(); - m_graphicsLayer->addChild(m_clippingLayer); + m_graphicsLayer->addChild(m_clippingLayer.get()); } } @@ -327,7 +341,7 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs if (needsAncestorClip) { if (!m_ancestorClippingLayer) { - m_ancestorClippingLayer = GraphicsLayer::createGraphicsLayer(this); + m_ancestorClippingLayer = GraphicsLayer::create(this); #ifndef NDEBUG m_ancestorClippingLayer->setName("Ancestor clipping Layer"); #endif @@ -336,14 +350,13 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs } } else if (m_ancestorClippingLayer) { m_ancestorClippingLayer->removeFromParent(); - delete m_ancestorClippingLayer; m_ancestorClippingLayer = 0; layersChanged = true; } if (needsDescendantClip) { if (!m_clippingLayer) { - m_clippingLayer = GraphicsLayer::createGraphicsLayer(0); + m_clippingLayer = GraphicsLayer::create(0); #ifndef NDEBUG m_clippingLayer->setName("Child clipping Layer"); #endif @@ -352,7 +365,6 @@ bool RenderLayerBacking::updateClippingLayers(bool needsAncestorClip, bool needs } } else if (m_clippingLayer) { m_clippingLayer->removeFromParent(); - delete m_clippingLayer; m_clippingLayer = 0; layersChanged = true; } @@ -368,25 +380,61 @@ bool RenderLayerBacking::updateForegroundLayer(bool needsForegroundLayer) bool layerChanged = false; if (needsForegroundLayer) { if (!m_foregroundLayer) { - m_foregroundLayer = GraphicsLayer::createGraphicsLayer(this); + m_foregroundLayer = GraphicsLayer::create(this); #ifndef NDEBUG - m_foregroundLayer->setName("Contents"); + m_foregroundLayer->setName("Foreground"); #endif m_foregroundLayer->setDrawsContent(true); - m_foregroundLayer->setDrawingPhase(GraphicsLayerPaintForegroundMask); - m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintBackgroundMask); + m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground); layerChanged = true; } } else if (m_foregroundLayer) { m_foregroundLayer->removeFromParent(); - delete m_foregroundLayer; m_foregroundLayer = 0; - m_graphicsLayer->setDrawingPhase(GraphicsLayerPaintAllMask); layerChanged = true; } + + if (layerChanged) + m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); + + return layerChanged; +} + +bool RenderLayerBacking::updateMaskLayer(bool needsMaskLayer) +{ + bool layerChanged = false; + if (needsMaskLayer) { + if (!m_maskLayer) { + m_maskLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_maskLayer->setName("Mask"); +#endif + m_maskLayer->setDrawsContent(true); + m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask); + layerChanged = true; + } + } else if (m_maskLayer) { + m_maskLayer = 0; + layerChanged = true; + } + + if (layerChanged) + m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer()); + return layerChanged; } +GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const +{ + unsigned phase = GraphicsLayerPaintBackground; + if (!m_foregroundLayer) + phase |= GraphicsLayerPaintForeground; + if (!m_maskLayer) + phase |= GraphicsLayerPaintMask; + + return static_cast<GraphicsLayerPaintingPhase>(phase); +} + float RenderLayerBacking::compositingOpacity(float rendererOpacity) const { float finalOpacity = rendererOpacity; @@ -500,7 +548,7 @@ bool RenderLayerBacking::isSimpleContainerCompositingLayer() const // Now look at the body's renderer. HTMLElement* body = renderObject->document()->body(); - RenderObject* bodyObject = (body && body->hasLocalName(HTMLNames::bodyTag)) ? body->renderer() : 0; + RenderObject* bodyObject = (body && body->hasLocalName(bodyTag)) ? body->renderer() : 0; if (!bodyObject) return false; @@ -705,13 +753,16 @@ void RenderLayerBacking::setContentsNeedDisplay() if (m_foregroundLayer && m_foregroundLayer->drawsContent()) m_foregroundLayer->setNeedsDisplay(); + + if (m_maskLayer && m_maskLayer->drawsContent()) + m_maskLayer->setNeedsDisplay(); } // r is in the coordinate space of the layer's render object void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) { if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { - FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer, FloatPoint(r.x(), r.y())); + FloatPoint dirtyOrigin = contentsToGraphicsLayerCoordinates(m_graphicsLayer.get(), FloatPoint(r.x(), r.y())); FloatRect dirtyRect(dirtyOrigin, r.size()); FloatRect bounds(FloatPoint(), m_graphicsLayer->size()); if (bounds.intersects(dirtyRect)) @@ -722,6 +773,11 @@ void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) // FIXME: do incremental repaint m_foregroundLayer->setNeedsDisplay(); } + + if (m_maskLayer && m_maskLayer->drawsContent()) { + // FIXME: do incremental repaint + m_maskLayer->setNeedsDisplay(); + } } static void setClip(GraphicsContext* p, const IntRect& paintDirtyRect, const IntRect& clipRect) @@ -779,7 +835,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* bool shouldPaint = m_owningLayer->hasVisibleContent() && m_owningLayer->isSelfPaintingLayer(); - if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackgroundMask)) { + if (shouldPaint && (paintingPhase & GraphicsLayerPaintBackground)) { // If this is the root then we need to send in a bigger bounding box // because we'll be painting the background as well (see RenderBox::paintRootBoxDecorations()). IntRect paintBox = clipRectToApply; @@ -823,7 +879,10 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* restoreClip(context, paintDirtyRect, damageRect); } - if (shouldPaint && (paintingPhase & GraphicsLayerPaintForegroundMask)) { + bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText; + bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText; + + if (shouldPaint && (paintingPhase & GraphicsLayerPaintForeground)) { // Now walk the sorted list of children with negative z-indices. Only RenderLayers without compositing layers will paint. // FIXME: should these be painted as background? Vector<RenderLayer*>* negZOrderList = m_owningLayer->negZOrderList(); @@ -832,9 +891,6 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot); } - bool forceBlackText = paintRestriction == PaintRestrictionSelectionOnlyBlackText; - bool selectionOnly = paintRestriction == PaintRestrictionSelectionOnly || paintRestriction == PaintRestrictionSelectionOnlyBlackText; - // Set up the clip used when painting our children. setClip(context, paintDirtyRect, clipRectToApply); RenderObject::PaintInfo paintInfo(context, clipRectToApply, @@ -877,7 +933,9 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* for (Vector<RenderLayer*>::iterator it = posZOrderList->begin(); it != posZOrderList->end(); ++it) it[0]->paintLayer(rootLayer, context, paintDirtyRect, paintRestriction, paintingRoot); } - + } + + if (shouldPaint && (paintingPhase & GraphicsLayerPaintMask)) { if (renderer()->hasMask() && !selectionOnly && !damageRect.isEmpty()) { setClip(context, paintDirtyRect, damageRect); @@ -894,7 +952,7 @@ void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* } // Up-call from compositing layer drawing callback. -void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase drawingPhase, const IntRect& clip) +void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip) { // We have to use the same root as for hit testing, because both methods // can compute and cache clipRects. @@ -912,7 +970,7 @@ void RenderLayerBacking::paintContents(const GraphicsLayer*, GraphicsContext& co IntRect dirtyRect = enclosingBBox; dirtyRect.intersect(clipRect); - paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, drawingPhase, renderer()); + paintIntoLayer(m_owningLayer, &context, dirtyRect, PaintRestrictionNone, paintingPhase, renderer()); } bool RenderLayerBacking::startAnimation(double beginTime, const Animation* anim, const KeyframeList& keyframes) diff --git a/WebCore/rendering/RenderLayerBacking.h b/WebCore/rendering/RenderLayerBacking.h index b027685..731e741 100644 --- a/WebCore/rendering/RenderLayerBacking.h +++ b/WebCore/rendering/RenderLayerBacking.h @@ -63,21 +63,23 @@ public: // Update contents and clipping structure. void updateInternalHierarchy(); // make private - GraphicsLayer* graphicsLayer() const { return m_graphicsLayer; } + GraphicsLayer* graphicsLayer() const { return m_graphicsLayer.get(); } // Layer to clip children bool hasClippingLayer() const { return m_clippingLayer != 0; } - GraphicsLayer* clippingLayer() const { return m_clippingLayer; } + GraphicsLayer* clippingLayer() const { return m_clippingLayer.get(); } // Layer to get clipped by ancestor bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer != 0; } - GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer; } + GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); } bool hasContentsLayer() const { return m_foregroundLayer != 0; } - GraphicsLayer* foregroundLayer() const { return m_foregroundLayer; } + GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); } - GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer : m_graphicsLayer; } - GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer : m_graphicsLayer; } + bool hasMaskLayer() const { return m_maskLayer != 0; } + + GraphicsLayer* parentForSublayers() const { return m_clippingLayer ? m_clippingLayer.get() : m_graphicsLayer.get(); } + GraphicsLayer* childForSuperlayers() const { return m_ancestorClippingLayer ? m_ancestorClippingLayer.get() : m_graphicsLayer.get(); } // RenderLayers with backing normally short-circuit paintLayer() because // their content is rendered via callbacks from GraphicsLayer. However, the document @@ -127,7 +129,10 @@ private: bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip); bool updateForegroundLayer(bool needsForegroundLayer); + bool updateMaskLayer(bool needsMaskLayer); + GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; + IntSize contentOffsetInCompostingLayer() const; // Result is transform origin in pixels. FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const; @@ -162,10 +167,11 @@ private: private: RenderLayer* m_owningLayer; - GraphicsLayer* m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context - GraphicsLayer* m_graphicsLayer; - GraphicsLayer* m_foregroundLayer; // only used in cases where we need to draw the foreground separately - GraphicsLayer* m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children + OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // only used if we are clipped by an ancestor which is not a stacking context + OwnPtr<GraphicsLayer> m_graphicsLayer; + OwnPtr<GraphicsLayer> m_foregroundLayer; // only used in cases where we need to draw the foreground separately + OwnPtr<GraphicsLayer> m_clippingLayer; // only used if we have clipping on a stacking context, with compositing children + OwnPtr<GraphicsLayer> m_maskLayer; // only used if we have a mask IntRect m_compositedBounds; diff --git a/WebCore/rendering/RenderLayerCompositor.cpp b/WebCore/rendering/RenderLayerCompositor.cpp index fb15800..10da951 100644 --- a/WebCore/rendering/RenderLayerCompositor.cpp +++ b/WebCore/rendering/RenderLayerCompositor.cpp @@ -92,7 +92,6 @@ RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) RenderLayerCompositor::~RenderLayerCompositor() { ASSERT(!m_rootLayerAttached); - delete m_rootPlatformLayer; } void RenderLayerCompositor::enableCompositingMode(bool enable /* = true */) @@ -503,8 +502,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O // If we have a software transform, and we have layers under us, we need to also // be composited. Also, if we have opacity < 1, then we need to be a layer so that // the child layers are opaque, then rendered with opacity on this layer. - if (childState.m_subtreeIsCompositing && - (layer->renderer()->hasTransform() || layer->renderer()->style()->opacity() < 1)) { + if (childState.m_subtreeIsCompositing && requiresCompositingWhenDescendantsAreCompositing(layer->renderer())) { layer->setMustOverlapCompositedLayers(true); if (overlapMap) addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); @@ -573,7 +571,7 @@ bool RenderLayerCompositor::canAccelerateVideoRendering(RenderVideo* o) const { // FIXME: ideally we need to look at all ancestors for mask or video. But for now, // just bail on the obvious cases. - if (o->hasMask() || o->hasReflection() || !m_hasAcceleratedCompositing) + if (o->hasReflection() || !m_hasAcceleratedCompositing) return false; return o->supportsAcceleratedRendering(); @@ -632,10 +630,10 @@ void RenderLayerCompositor::rebuildCompositingLayerTree(RenderLayer* layer, stru } if (updateHierarchy && layerBacking && layerBacking->foregroundLayer()) { - // we only have a contents layer if we have an m_layer layerBacking->foregroundLayer()->removeFromParent(); - - GraphicsLayer* hostingLayer = layerBacking->clippingLayer() ? layerBacking->clippingLayer() : layerBacking->graphicsLayer(); + + // The foreground layer has to be correctly sorted with child layers, so needs to become a child of the clipping layer. + GraphicsLayer* hostingLayer = layerBacking->parentForSublayers(); hostingLayer->addChild(layerBacking->foregroundLayer()); } } @@ -759,7 +757,7 @@ RenderLayer* RenderLayerCompositor::rootRenderLayer() const GraphicsLayer* RenderLayerCompositor::rootPlatformLayer() const { - return m_rootPlatformLayer; + return m_rootPlatformLayer.get(); } void RenderLayerCompositor::didMoveOnscreen() @@ -772,7 +770,7 @@ void RenderLayerCompositor::didMoveOnscreen() if (!page) return; - page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer); + page->chrome()->client()->attachRootGraphicsLayer(frame, m_rootPlatformLayer.get()); m_rootLayerAttached = true; } @@ -906,6 +904,11 @@ bool RenderLayerCompositor::requiresCompositingForAnimation(RenderObject* render return false; } +bool RenderLayerCompositor::requiresCompositingWhenDescendantsAreCompositing(RenderObject* renderer) const +{ + return renderer->hasTransform() || renderer->isTransparent() || renderer->hasMask(); +} + // If an element has negative z-index children, those children render in front of the // layer background, so we need an extra 'contents' layer for the foreground of the layer // object. @@ -919,7 +922,7 @@ void RenderLayerCompositor::ensureRootPlatformLayer() if (m_rootPlatformLayer) return; - m_rootPlatformLayer = GraphicsLayer::createGraphicsLayer(0); + m_rootPlatformLayer = GraphicsLayer::create(0); m_rootPlatformLayer->setSize(FloatSize(m_renderView->overflowWidth(), m_renderView->overflowHeight())); m_rootPlatformLayer->setPosition(FloatPoint(0, 0)); // The root layer does flipping if we need it on this platform. @@ -937,7 +940,6 @@ void RenderLayerCompositor::destroyRootPlatformLayer() return; willMoveOffscreen(); - delete m_rootPlatformLayer; m_rootPlatformLayer = 0; } diff --git a/WebCore/rendering/RenderLayerCompositor.h b/WebCore/rendering/RenderLayerCompositor.h index 02929dc..8dd689c 100644 --- a/WebCore/rendering/RenderLayerCompositor.h +++ b/WebCore/rendering/RenderLayerCompositor.h @@ -164,10 +164,11 @@ private: bool requiresCompositingForAnimation(RenderObject*) const; bool requiresCompositingForTransform(RenderObject*) const; bool requiresCompositingForVideo(RenderObject*) const; + bool requiresCompositingWhenDescendantsAreCompositing(RenderObject*) const; private: RenderView* m_renderView; - GraphicsLayer* m_rootPlatformLayer; + OwnPtr<GraphicsLayer> m_rootPlatformLayer; bool m_hasAcceleratedCompositing; bool m_compositingConsultsOverlap; bool m_compositing; diff --git a/WebCore/rendering/RenderListItem.h b/WebCore/rendering/RenderListItem.h index 21544f9..c4c41dc 100644 --- a/WebCore/rendering/RenderListItem.h +++ b/WebCore/rendering/RenderListItem.h @@ -44,6 +44,8 @@ public: void setNotInList(bool notInList) { m_notInList = notInList; } bool notInList() const { return m_notInList; } + const String& markerText() const; + private: virtual const char* renderName() const { return "RenderListItem"; } @@ -59,8 +61,6 @@ private: virtual void positionListMarker(); - const String& markerText() const; - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); void updateMarkerLocation(); diff --git a/WebCore/rendering/RenderMarquee.cpp b/WebCore/rendering/RenderMarquee.cpp index 31a8305..bb917f8 100644 --- a/WebCore/rendering/RenderMarquee.cpp +++ b/WebCore/rendering/RenderMarquee.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/) * * Portions are Copyright (C) 1998 Netscape Communications Corporation. * @@ -152,7 +153,11 @@ int RenderMarquee::computePosition(EMarqueeDirection dir, bool stopAtContentEdge void RenderMarquee::start() { - if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero()) + if (m_timer.isActive() || m_layer->renderer()->style()->marqueeIncrement().isZero() +#if ENABLE(WCSS) && ENABLE(XHTMLMP) + || (m_layer->renderer()->document()->isXHTMLMPDocument() && !m_layer->renderer()->style()->marqueeLoopCount()) +#endif + ) return; // We may end up propagating a scroll event. It is important that we suspend events until diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp index 5137338..728ff7a 100644 --- a/WebCore/rendering/RenderObject.cpp +++ b/WebCore/rendering/RenderObject.cpp @@ -4,6 +4,7 @@ * (C) 2000 Dirk Mueller (mueller@kde.org) * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) * Copyright (C) 2004, 2005, 2006, 2007, 2008 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 @@ -145,6 +146,12 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style) o = new (arena) RenderTableCell(node); break; case TABLE_CAPTION: +#if ENABLE(WCSS) + // As per the section 17.1 of the spec WAP-239-WCSS-20011026-a.pdf, + // the marquee box inherits and extends the characteristics of the + // principal block box ([CSS2] section 9.2.1). + case WAP_MARQUEE: +#endif o = new (arena) RenderBlock(node); break; case BOX: @@ -1612,15 +1619,20 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*) void RenderObject::updateFillImages(const FillLayer* oldLayers, const FillLayer* newLayers) { - // FIXME: This will be slow when a large number of images is used. Fix by using a dict. - for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) { - if (currOld->image() && (!newLayers || !newLayers->containsImage(currOld->image()))) - currOld->image()->removeClient(this); - } + // Optimize the common case + if (oldLayers && !oldLayers->next() && newLayers && !newLayers->next() && (oldLayers->image() == newLayers->image())) + return; + + // Go through the new layers and addClients first, to avoid removing all clients of an image. for (const FillLayer* currNew = newLayers; currNew; currNew = currNew->next()) { - if (currNew->image() && (!oldLayers || !oldLayers->containsImage(currNew->image()))) + if (currNew->image()) currNew->image()->addClient(this); } + + for (const FillLayer* currOld = oldLayers; currOld; currOld = currOld->next()) { + if (currOld->image()) + currOld->image()->removeClient(this); + } } void RenderObject::updateImage(StyleImage* oldImage, StyleImage* newImage) diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h index 911169d..eb558f6 100644 --- a/WebCore/rendering/RenderObject.h +++ b/WebCore/rendering/RenderObject.h @@ -285,6 +285,9 @@ public: bool isHTMLMarquee() const; + inline bool isAfterContent() const; + static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); } + bool childrenInline() const { return m_childrenInline; } void setChildrenInline(bool b = true) { m_childrenInline = b; } bool hasColumns() const { return m_hasColumns; } @@ -858,6 +861,16 @@ inline bool RenderObject::documentBeingDestroyed() const return !document()->renderer(); } +inline bool RenderObject::isAfterContent() const +{ + if (style()->styleType() != AFTER) + return false; + // Text nodes don't have their own styles, so ignore the style on a text node. + if (isText() && !isBR()) + return false; + return true; +} + inline void RenderObject::setNeedsLayout(bool b, bool markParents) { bool alreadyNeededLayout = m_needsLayout; diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp index 692a66e..0ab11b6 100644 --- a/WebCore/rendering/RenderReplaced.cpp +++ b/WebCore/rendering/RenderReplaced.cpp @@ -66,7 +66,7 @@ void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* old bool hadStyle = (oldStyle != 0); float oldZoom = hadStyle ? oldStyle->effectiveZoom() : RenderStyle::initialZoom(); - if (hadStyle && style() && style()->effectiveZoom() != oldZoom) + if (style() && style()->effectiveZoom() != oldZoom) intrinsicSizeChanged(); } diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp index 7599999..ebd7fbe 100644 --- a/WebCore/rendering/RenderTable.cpp +++ b/WebCore/rendering/RenderTable.cpp @@ -456,26 +456,7 @@ void RenderTable::layout() // FIXME: Only pass true if width or height changed. layoutPositionedObjects(true); - if (!hasOverflowClip()) { - int shadowLeft; - int shadowRight; - int shadowTop; - int shadowBottom; - style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); - - m_overflowLeft = min(m_overflowLeft, shadowLeft); - m_overflowWidth = max(m_overflowWidth, width() + shadowRight); - m_overflowTop = min(m_overflowTop, shadowTop); - m_overflowHeight = max(m_overflowHeight, height() + shadowBottom); - - if (hasReflection()) { - IntRect reflection(reflectionBox()); - m_overflowTop = min(m_overflowTop, reflection.y()); - m_overflowHeight = max(m_overflowHeight, reflection.bottom()); - m_overflowLeft = min(m_overflowLeft, reflection.x()); - m_overflowHeight = max(m_overflowWidth, reflection.right()); - } - } + updateOverflowWithShadowAndReflection(); statePusher.pop(); diff --git a/WebCore/rendering/RenderText.cpp b/WebCore/rendering/RenderText.cpp index ada3961..383a394 100644 --- a/WebCore/rendering/RenderText.cpp +++ b/WebCore/rendering/RenderText.cpp @@ -207,7 +207,7 @@ void RenderText::deleteTextBoxes() PassRefPtr<StringImpl> RenderText::originalText() const { Node* e = node(); - return e ? static_cast<Text*>(e)->string() : 0; + return e ? static_cast<Text*>(e)->dataImpl() : 0; } void RenderText::absoluteRects(Vector<IntRect>& rects, int tx, int ty) diff --git a/WebCore/rendering/RenderTextFragment.cpp b/WebCore/rendering/RenderTextFragment.cpp index 7da9e5a..9ff1106 100644 --- a/WebCore/rendering/RenderTextFragment.cpp +++ b/WebCore/rendering/RenderTextFragment.cpp @@ -47,7 +47,7 @@ RenderTextFragment::RenderTextFragment(Node* node, StringImpl* str) PassRefPtr<StringImpl> RenderTextFragment::originalText() const { Node* e = node(); - RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->string() : contentString()); + RefPtr<StringImpl> result = (e ? static_cast<Text*>(e)->dataImpl() : contentString()); if (result && (start() > 0 || start() < result->length())) result = result->substring(start(), end()); return result.release(); @@ -76,7 +76,7 @@ UChar RenderTextFragment::previousCharacter() { if (start()) { Node* e = node(); - StringImpl* original = (e ? static_cast<Text*>(e)->string() : contentString()); + StringImpl* original = (e ? static_cast<Text*>(e)->dataImpl() : contentString()); if (original) return (*original)[start() - 1]; } diff --git a/WebCore/rendering/RenderThemeChromiumMac.h b/WebCore/rendering/RenderThemeChromiumMac.h index ffb2548..0c417a2 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.h +++ b/WebCore/rendering/RenderThemeChromiumMac.h @@ -156,6 +156,7 @@ namespace WebCore { IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; void setFontFromControlSize(CSSStyleSelector*, RenderStyle*, NSControlSize) const; + void updateActiveState(NSCell*, const RenderObject*); void updateCheckedState(NSCell*, const RenderObject*); void updateEnabledState(NSCell*, const RenderObject*); void updateFocusedState(NSCell*, const RenderObject*); diff --git a/WebCore/rendering/RenderThemeChromiumMac.mm b/WebCore/rendering/RenderThemeChromiumMac.mm index 23201c9..42e2aca 100644 --- a/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/WebCore/rendering/RenderThemeChromiumMac.mm @@ -549,6 +549,25 @@ IntRect RenderThemeChromiumMac::inflateRect(const IntRect& r, const IntSize& siz return result; } +// Updates the control tint (a.k.a. active state) of |cell| (from |o|). +// In the Chromium port, the renderer runs as a background process and controls' +// NSCell(s) lack a parent NSView. Therefore controls don't have their tint +// color updated correctly when the application is activated/deactivated. +// FocusController's setActive() is called when the application is +// activated/deactivated, which causes a repaint at which time this code is +// called. +// This function should be called before drawing any NSCell-derived controls, +// unless you're sure it isn't needed. +void RenderThemeChromiumMac::updateActiveState(NSCell* cell, const RenderObject* o) +{ + NSControlTint oldTint = [cell controlTint]; + NSControlTint tint = isActive(o) ? [NSColor currentControlTint] : + NSClearControlTint; + + if (tint != oldTint) + [cell setControlTint:tint]; +} + void RenderThemeChromiumMac::updateCheckedState(NSCell* cell, const RenderObject* o) { bool oldIndeterminate = [cell state] == NSMixedState; @@ -765,6 +784,7 @@ void RenderThemeChromiumMac::setCheckboxCellState(const RenderObject* o, const I setControlSize(checkbox, checkboxSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(checkbox, o); updateCheckedState(checkbox, o); updateEnabledState(checkbox, o); updatePressedState(checkbox, o); @@ -846,6 +866,7 @@ void RenderThemeChromiumMac::setRadioCellState(const RenderObject* o, const IntR setControlSize(radio, radioSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(radio, o); updateCheckedState(radio, o); updateEnabledState(radio, o); updatePressedState(radio, o); @@ -976,6 +997,7 @@ void RenderThemeChromiumMac::setButtonCellState(const RenderObject* o, const Int [button setKeyEquivalent:(isDefaultButton ? @"\r" : @"")]; // Update the various states we respond to. + updateActiveState(button, o); updateCheckedState(button, o); updateEnabledState(button, o); updatePressedState(button, o); @@ -1414,6 +1436,7 @@ void RenderThemeChromiumMac::setPopupButtonCellState(const RenderObject* o, cons setControlSize(popupButton, popupButtonSizes(), r.size(), o->style()->effectiveZoom()); // Update the various states we respond to. + updateActiveState(popupButton, o); updateCheckedState(popupButton, o); updateEnabledState(popupButton, o); updatePressedState(popupButton, o); @@ -1496,6 +1519,7 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec LocalCurrentGraphicsContext localContext(paintInfo.context); // Update the various states we respond to. + updateActiveState(sliderThumbCell, o); updateEnabledState(sliderThumbCell, o->parent()); updateFocusedState(sliderThumbCell, o->parent()); @@ -1607,6 +1631,7 @@ void RenderThemeChromiumMac::setSearchCellState(RenderObject* o, const IntRect& [search setControlSize:controlSizeForFont(o->style())]; // Update the various states we respond to. + updateActiveState(search, o); updateEnabledState(search, o); updateFocusedState(search, o); } @@ -1667,6 +1692,7 @@ bool RenderThemeChromiumMac::paintSearchFieldCancelButton(RenderObject* o, const NSSearchFieldCell* search = this->search(); + updateActiveState([search cancelButtonCell], o); updatePressedState([search cancelButtonCell], o); paintInfo.context->save(); @@ -1742,6 +1768,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsDecoration(RenderObject* o, NSSearchFieldCell* search = this->search(); + updateActiveState([search searchButtonCell], o); + if ([search searchMenuTemplate] != nil) [search setSearchMenuTemplate:nil]; @@ -1769,6 +1797,8 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons NSSearchFieldCell* search = this->search(); + updateActiveState([search searchButtonCell], o); + if (![search searchMenuTemplate]) [search setSearchMenuTemplate:searchMenuTemplate()]; diff --git a/WebCore/rendering/RenderThemeChromiumSkia.cpp b/WebCore/rendering/RenderThemeChromiumSkia.cpp index 79804ac..c8875dc 100644 --- a/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -610,6 +610,10 @@ bool RenderThemeChromiumSkia::paintMediaPlayButton(RenderObject* object, const R static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef(); static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef(); + static Image* mediaPlayDisabled = Image::loadPlatformResource("mediaPlayDisabled").releaseRef(); + + if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE) + return paintMediaButtonInternal(paintInfo.context, rect, mediaPlayDisabled); return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause); #else diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h index c3944ad..aad7900 100644 --- a/WebCore/rendering/style/FillLayer.h +++ b/WebCore/rendering/style/FillLayer.h @@ -63,14 +63,14 @@ public: bool isSizeSet() const { return m_sizeSet; } void setImage(StyleImage* i) { m_image = i; m_imageSet = true; } - void setXPosition(const Length& l) { m_xPosition = l; m_xPosSet = true; } - void setYPosition(const Length& l) { m_yPosition = l; m_yPosSet = true; } + void setXPosition(Length l) { m_xPosition = l; m_xPosSet = true; } + void setYPosition(Length l) { m_yPosition = l; m_yPosSet = true; } void setAttachment(EFillAttachment attachment) { m_attachment = attachment; m_attachmentSet = true; } void setClip(EFillBox b) { m_clip = b; m_clipSet = true; } void setOrigin(EFillBox b) { m_origin = b; m_originSet = true; } void setRepeat(EFillRepeat r) { m_repeat = r; m_repeatSet = true; } void setComposite(CompositeOperator c) { m_composite = c; m_compositeSet = true; } - void setSize(const LengthSize& b) { m_size = b; m_sizeSet = true; } + void setSize(LengthSize b) { m_size = b; m_sizeSet = true; } void clearImage() { m_imageSet = false; } void clearXPosition() { m_xPosSet = false; } diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index c491816..013d335 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -4,6 +4,7 @@ * (C) 2000 Dirk Mueller (mueller@kde.org) * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.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 @@ -298,7 +299,11 @@ enum EDisplay { TABLE, INLINE_TABLE, TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL, - TABLE_CAPTION, BOX, INLINE_BOX, NONE + TABLE_CAPTION, BOX, INLINE_BOX, +#if ENABLE(WCSS) + WAP_MARQUEE, +#endif + NONE }; enum EPointerEvents { diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 5504cb1..12416e9 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -50,6 +50,7 @@ #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" #include "SQLResultSet.h" +#include "SQLTransactionCoordinator.h" #include <wtf/MainThread.h> #endif @@ -544,13 +545,17 @@ void Database::scheduleTransaction() m_transactionInProgress = false; } -void Database::scheduleTransactionStep(SQLTransaction* transaction) +void Database::scheduleTransactionStep(SQLTransaction* transaction, bool immediately) { - if (m_document->databaseThread()) { - RefPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); - LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); + if (!m_document->databaseThread()) + return; + + RefPtr<DatabaseTransactionTask> task = DatabaseTransactionTask::create(transaction); + LOG(StorageAPI, "Scheduling DatabaseTransactionTask %p for the transaction step\n", task.get()); + if (immediately) + m_document->databaseThread()->scheduleImmediateTask(task.release()); + else m_document->databaseThread()->scheduleTask(task.release()); - } } void Database::scheduleTransactionCallback(SQLTransaction* transaction) @@ -588,6 +593,11 @@ Vector<String> Database::performGetTableNames() return tableNames; } +SQLTransactionCoordinator* Database::transactionCoordinator() const +{ + return m_document->databaseThread()->transactionCoordinator(); +} + String Database::version() const { if (m_deleted) diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h index 0bdb37b..02736c8 100644 --- a/WebCore/storage/Database.h +++ b/WebCore/storage/Database.h @@ -57,6 +57,7 @@ class DatabaseThread; class Document; class SQLResultSet; class SQLTransactionCallback; +class SQLTransactionCoordinator; class SQLTransactionErrorCallback; class SQLValue; @@ -116,6 +117,8 @@ public: Vector<String> performGetTableNames(); + SQLTransactionCoordinator* transactionCoordinator() const; + private: Database(Document* document, const String& name, const String& expectedVersion); @@ -123,7 +126,7 @@ private: void scheduleTransaction(); void scheduleTransactionCallback(SQLTransaction*); - void scheduleTransactionStep(SQLTransaction* transaction); + void scheduleTransactionStep(SQLTransaction* transaction, bool immediately = false); MessageQueue<RefPtr<SQLTransaction> > m_transactionQueue; Mutex m_transactionInProgressMutex; diff --git a/WebCore/storage/DatabaseThread.cpp b/WebCore/storage/DatabaseThread.cpp index b6c9b5d..fb9b603 100644 --- a/WebCore/storage/DatabaseThread.cpp +++ b/WebCore/storage/DatabaseThread.cpp @@ -35,11 +35,13 @@ #include "Database.h" #include "DatabaseTask.h" #include "Logging.h" +#include "SQLTransactionCoordinator.h" namespace WebCore { DatabaseThread::DatabaseThread() : m_threadID(0) + , m_transactionCoordinator(new SQLTransactionCoordinator()) { m_selfRef = this; } @@ -97,6 +99,9 @@ void* DatabaseThread::databaseThread() pool.cycle(); } + // Clean up the list of all pending transactions on this database thread + m_transactionCoordinator->shutdown(); + LOG(StorageAPI, "About to detach thread %i and clear the ref to DatabaseThread %p, which currently has %i ref(s)", m_threadID, this, refCount()); // Close the databases that we ran transactions on. This ensures that if any transactions are still open, they are rolled back and we don't leave the database in an diff --git a/WebCore/storage/DatabaseThread.h b/WebCore/storage/DatabaseThread.h index 5aab5fd..59d7a5d 100644 --- a/WebCore/storage/DatabaseThread.h +++ b/WebCore/storage/DatabaseThread.h @@ -33,6 +33,7 @@ #include <wtf/HashMap.h> #include <wtf/HashSet.h> #include <wtf/MessageQueue.h> +#include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> @@ -42,6 +43,7 @@ namespace WebCore { class Database; class DatabaseTask; class Document; +class SQLTransactionCoordinator; class DatabaseThread : public ThreadSafeShared<DatabaseThread> { public: @@ -60,6 +62,8 @@ public: void recordDatabaseClosed(Database*); ThreadIdentifier getThreadID() { return m_threadID; } + SQLTransactionCoordinator* transactionCoordinator() { return m_transactionCoordinator.get(); } + private: DatabaseThread(); @@ -75,6 +79,8 @@ private: // This set keeps track of the open databases that have been used on this thread. typedef HashSet<RefPtr<Database> > DatabaseSet; DatabaseSet m_openDatabaseSet; + + OwnPtr<SQLTransactionCoordinator> m_transactionCoordinator; }; } // namespace WebCore diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp index 3331e6e..dc48ae1 100644 --- a/WebCore/storage/SQLTransaction.cpp +++ b/WebCore/storage/SQLTransaction.cpp @@ -50,6 +50,7 @@ #include "SQLStatement.h" #include "SQLStatementCallback.h" #include "SQLStatementErrorCallback.h" +#include "SQLTransactionCoordinator.h" #include "SQLValue.h" // There's no way of knowing exactly how much more space will be required when a statement hits the quota limit. @@ -67,7 +68,7 @@ PassRefPtr<SQLTransaction> SQLTransaction::create(Database* db, PassRefPtr<SQLTr SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback, PassRefPtr<SQLTransactionWrapper> wrapper) - : m_nextStep(&SQLTransaction::openTransactionAndPreflight) + : m_nextStep(&SQLTransaction::acquireLock) , m_executeSqlAllowed(false) , m_database(db) , m_wrapper(wrapper) @@ -76,6 +77,7 @@ SQLTransaction::SQLTransaction(Database* db, PassRefPtr<SQLTransactionCallback> , m_errorCallback(errorCallback) , m_shouldRetryCurrentStatement(false) , m_modifiedDatabase(false) + , m_lockAcquired(false) { ASSERT(m_database); } @@ -116,7 +118,9 @@ void SQLTransaction::enqueueStatement(PassRefPtr<SQLStatement> statement) #ifndef NDEBUG const char* SQLTransaction::debugStepName(SQLTransaction::TransactionStepMethod step) { - if (step == &SQLTransaction::openTransactionAndPreflight) + if (step == &SQLTransaction::acquireLock) + return "acquireLock"; + else if (step == &SQLTransaction::openTransactionAndPreflight) return "openTransactionAndPreflight"; else if (step == &SQLTransaction::runStatements) return "runStatements"; @@ -157,6 +161,9 @@ void SQLTransaction::checkAndHandleClosedDatabase() m_sqliteTransaction->stop(); m_sqliteTransaction.clear(); } + + if (m_lockAcquired) + m_database->transactionCoordinator()->releaseLock(this); } @@ -164,7 +171,8 @@ bool SQLTransaction::performNextStep() { LOG(StorageAPI, "Step %s\n", debugStepName(m_nextStep)); - ASSERT(m_nextStep == &SQLTransaction::openTransactionAndPreflight || + ASSERT(m_nextStep == &SQLTransaction::acquireLock || + m_nextStep == &SQLTransaction::openTransactionAndPreflight || m_nextStep == &SQLTransaction::runStatements || m_nextStep == &SQLTransaction::postflightAndCommit || m_nextStep == &SQLTransaction::cleanupAfterSuccessCallback || @@ -195,9 +203,23 @@ void SQLTransaction::performPendingCallback() (this->*m_nextStep)(); } +void SQLTransaction::acquireLock() +{ + m_database->transactionCoordinator()->acquireLock(this); +} + +void SQLTransaction::lockAcquired() +{ + m_lockAcquired = true; + m_nextStep = &SQLTransaction::openTransactionAndPreflight; + LOG(StorageAPI, "Scheduling openTransactionAndPreflight immediately for transaction %p\n", this); + m_database->scheduleTransactionStep(this, true); +} + void SQLTransaction::openTransactionAndPreflight() { ASSERT(!m_database->m_sqliteDatabase.transactionInProgress()); + ASSERT(m_lockAcquired); LOG(StorageAPI, "Opening and preflighting transaction %p", this); @@ -273,6 +295,8 @@ void SQLTransaction::scheduleToRunStatements() void SQLTransaction::runStatements() { + ASSERT(m_lockAcquired); + // If there is a series of statements queued up that are all successful and have no associated // SQLStatementCallback objects, then we can burn through the queue do { @@ -411,6 +435,8 @@ void SQLTransaction::deliverQuotaIncreaseCallback() void SQLTransaction::postflightAndCommit() { + ASSERT(m_lockAcquired); + // Transaction Step 7 - Peform postflight steps, jumping to the error callback if they fail if (m_wrapper && !m_wrapper->performPostflight(this)) { m_transactionError = m_wrapper->sqlError(); @@ -469,11 +495,16 @@ void SQLTransaction::deliverSuccessCallback() void SQLTransaction::cleanupAfterSuccessCallback() { + ASSERT(m_lockAcquired); + // 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()); m_nextStep = 0; + + // Release the lock on this database + m_database->transactionCoordinator()->releaseLock(this); } void SQLTransaction::handleTransactionError(bool inCallback) @@ -516,6 +547,8 @@ void SQLTransaction::deliverTransactionErrorCallback() void SQLTransaction::cleanupAfterTransactionErrorCallback() { + ASSERT(m_lockAcquired); + m_database->m_databaseAuthorizer->disable(); if (m_sqliteTransaction) { // Transaction Step 12 - Rollback the transaction. @@ -540,6 +573,9 @@ void SQLTransaction::cleanupAfterTransactionErrorCallback() // Now release our callbacks, to break reference cycles. m_callback = 0; m_errorCallback = 0; + + // Now release the lock on this database + m_database->transactionCoordinator()->releaseLock(this); } } // namespace WebCore diff --git a/WebCore/storage/SQLTransaction.h b/WebCore/storage/SQLTransaction.h index e77c183..141cef7 100644 --- a/WebCore/storage/SQLTransaction.h +++ b/WebCore/storage/SQLTransaction.h @@ -73,6 +73,7 @@ public: void executeSQL(const String& sqlStatement, const Vector<SQLValue>& arguments, PassRefPtr<SQLStatementCallback> callback, PassRefPtr<SQLStatementErrorCallback> callbackError, ExceptionCode& e); + void lockAcquired(); bool performNextStep(); void performPendingCallback(); @@ -88,6 +89,7 @@ private: void checkAndHandleClosedDatabase(); + void acquireLock(); void openTransactionAndPreflight(); void deliverTransactionCallback(); void scheduleToRunStatements(); @@ -120,6 +122,7 @@ private: RefPtr<SQLError> m_transactionError; bool m_shouldRetryCurrentStatement; bool m_modifiedDatabase; + bool m_lockAcquired; Mutex m_statementMutex; Deque<RefPtr<SQLStatement> > m_statementQueue; diff --git a/WebCore/storage/SQLTransactionCoordinator.cpp b/WebCore/storage/SQLTransactionCoordinator.cpp new file mode 100644 index 0000000..63fd38e --- /dev/null +++ b/WebCore/storage/SQLTransactionCoordinator.cpp @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "SQLTransactionCoordinator.h" + +#include "CString.h" +#include "Database.h" +#include "SQLTransaction.h" +#include <wtf/Deque.h> +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + +static String getDatabaseIdentifier(SQLTransaction* transaction) +{ + Database* database = transaction->database(); + ASSERT(database); + return database->stringIdentifier(); +} + +void SQLTransactionCoordinator::acquireLock(SQLTransaction* transaction) +{ + String dbIdentifier = getDatabaseIdentifier(transaction); + + TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); + if (it == m_pendingTransactions.end()) { + // No pending transactions for this DB + TransactionsQueue pendingTransactions; + pendingTransactions.append(transaction); + m_pendingTransactions.add(dbIdentifier, pendingTransactions); + + // Start the transaction + transaction->lockAcquired(); + } else { + // Another transaction is running on this DB; put this one in the queue + TransactionsQueue& pendingTransactions = it->second; + pendingTransactions.append(transaction); + } +} + +void SQLTransactionCoordinator::releaseLock(SQLTransaction* transaction) +{ + if (m_pendingTransactions.isEmpty()) + return; + + String dbIdentifier = getDatabaseIdentifier(transaction); + + TransactionsHashMap::iterator it = m_pendingTransactions.find(dbIdentifier); + ASSERT(it != m_pendingTransactions.end()); + TransactionsQueue& pendingTransactions = it->second; + ASSERT(!pendingTransactions.isEmpty()); + + // 'transaction' should always be the first transaction in this queue + ASSERT(pendingTransactions.first().get() == transaction); + + // Remove 'transaction' from the queue of pending transactions + pendingTransactions.removeFirst(); + if (pendingTransactions.isEmpty()) { + // No more pending transactions; delete dbIdentifier's queue + m_pendingTransactions.remove(it); + } else { + // We have more pending transactions; start the next one + pendingTransactions.first()->lockAcquired(); + } +} + +void SQLTransactionCoordinator::shutdown() +{ + // Clean up all pending transactions for all databases + m_pendingTransactions.clear(); +} + +} diff --git a/WebCore/storage/SQLTransactionCoordinator.h b/WebCore/storage/SQLTransactionCoordinator.h new file mode 100644 index 0000000..c6abfda --- /dev/null +++ b/WebCore/storage/SQLTransactionCoordinator.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SQLTransactionCoordinator_h +#define SQLTransactionCoordinator_h + +#include "CString.h" +#include "StringHash.h" +#include <wtf/Deque.h> +#include <wtf/HashMap.h> +#include <wtf/RefPtr.h> + +namespace WebCore { + + class SQLTransaction; + + class SQLTransactionCoordinator { + public: + void acquireLock(SQLTransaction*); + void releaseLock(SQLTransaction*); + void shutdown(); + private: + typedef Deque<RefPtr<SQLTransaction> > TransactionsQueue; + typedef HashMap<String, TransactionsQueue> TransactionsHashMap; + TransactionsHashMap m_pendingTransactions; + }; +} + +#endif // SQLTransactionCoordinator_h diff --git a/WebCore/storage/Storage.h b/WebCore/storage/Storage.h index d68e9bc..197e693 100644 --- a/WebCore/storage/Storage.h +++ b/WebCore/storage/Storage.h @@ -53,6 +53,7 @@ namespace WebCore { bool contains(const String& key) const; + Frame* frame() { return m_frame; } void disconnectFrame() { m_frame = 0; } private: diff --git a/WebCore/storage/StorageNamespace.h b/WebCore/storage/StorageNamespace.h index edbe339..825581f 100644 --- a/WebCore/storage/StorageNamespace.h +++ b/WebCore/storage/StorageNamespace.h @@ -48,6 +48,7 @@ namespace WebCore { virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*) = 0; virtual PassRefPtr<StorageNamespace> copy() = 0; virtual void close() = 0; + virtual void unlock() = 0; }; } // namespace WebCore diff --git a/WebCore/storage/StorageNamespaceImpl.cpp b/WebCore/storage/StorageNamespaceImpl.cpp index b4caaeb..23725a5 100644 --- a/WebCore/storage/StorageNamespaceImpl.cpp +++ b/WebCore/storage/StorageNamespaceImpl.cpp @@ -134,6 +134,11 @@ void StorageNamespaceImpl::close() m_isShutdown = true; } +void StorageNamespaceImpl::unlock() +{ + // Because there's a single event loop per-process, this is a no-op. +} + } // namespace WebCore #endif // ENABLE(DOM_STORAGE) diff --git a/WebCore/storage/StorageNamespaceImpl.h b/WebCore/storage/StorageNamespaceImpl.h index 0b15e43..d3ef37f 100644 --- a/WebCore/storage/StorageNamespaceImpl.h +++ b/WebCore/storage/StorageNamespaceImpl.h @@ -49,6 +49,7 @@ namespace WebCore { virtual PassRefPtr<StorageArea> storageArea(SecurityOrigin*); virtual PassRefPtr<StorageNamespace> copy(); virtual void close(); + virtual void unlock(); private: StorageNamespaceImpl(StorageType, const String& path); diff --git a/WebCore/svg/SVGColor.cpp b/WebCore/svg/SVGColor.cpp index f939ef0..d819ebf 100644 --- a/WebCore/svg/SVGColor.cpp +++ b/WebCore/svg/SVGColor.cpp @@ -62,9 +62,9 @@ unsigned short SVGColor::colorType() const return m_colorType; } -RGBColor* SVGColor::rgbColor() const +PassRefPtr<RGBColor> SVGColor::rgbColor() const { - return RGBColor::create(m_color.rgb()).releaseRef(); + return RGBColor::create(m_color.rgb()); } void SVGColor::setRGBColor(const String& rgbColor, ExceptionCode& ec) diff --git a/WebCore/svg/SVGColor.h b/WebCore/svg/SVGColor.h index 5dfb694..406166b 100644 --- a/WebCore/svg/SVGColor.h +++ b/WebCore/svg/SVGColor.h @@ -57,8 +57,8 @@ namespace WebCore { // 'SVGColor' functions unsigned short colorType() const; - RGBColor* rgbColor() const; - + PassRefPtr<RGBColor> rgbColor() const; + static Color colorFromRGBColorString(const String&); void setRGBColor(const String& rgbColor) { ExceptionCode ignored = 0; setRGBColor(rgbColor, ignored); } diff --git a/WebCore/svg/SVGDocument.h b/WebCore/svg/SVGDocument.h index 02e3649..c7006f9 100644 --- a/WebCore/svg/SVGDocument.h +++ b/WebCore/svg/SVGDocument.h @@ -35,13 +35,11 @@ namespace WebCore { public: static PassRefPtr<SVGDocument> create(Frame* frame) { - return new SVGDocument(frame); + return adoptRef(new SVGDocument(frame)); } virtual ~SVGDocument(); - virtual bool isSVGDocument() const { return true; } - SVGSVGElement* rootElement() const; void dispatchZoomEvent(float prevScale, float newScale); @@ -52,11 +50,13 @@ namespace WebCore { void startPan(const FloatPoint& start); void updatePan(const FloatPoint& pos) const; - virtual bool childShouldCreateRenderer(Node*) const; - private: SVGDocument(Frame*); + virtual bool isSVGDocument() const { return true; } + + virtual bool childShouldCreateRenderer(Node*) const; + FloatPoint m_translate; }; diff --git a/WebCore/svg/SVGElementInstance.cpp b/WebCore/svg/SVGElementInstance.cpp index 01555fc..3a82067 100644 --- a/WebCore/svg/SVGElementInstance.cpp +++ b/WebCore/svg/SVGElementInstance.cpp @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - This file is part of the KDE project - 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 @@ -25,7 +23,6 @@ #include "SVGElementInstance.h" #include "ContainerNodeAlgorithms.h" -#include "Document.h" #include "Event.h" #include "EventException.h" #include "EventListener.h" @@ -46,7 +43,7 @@ namespace WebCore { static WTF::RefCountedLeakCounter instanceCounter("WebCoreSVGElementInstance"); #endif -SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, SVGElement* originalElement) +SVGElementInstance::SVGElementInstance(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) : m_needsUpdate(false) , m_useElement(useElement) , m_element(originalElement) diff --git a/WebCore/svg/SVGElementInstance.h b/WebCore/svg/SVGElementInstance.h index c477718..048c66c 100644 --- a/WebCore/svg/SVGElementInstance.h +++ b/WebCore/svg/SVGElementInstance.h @@ -1,8 +1,6 @@ /* Copyright (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - This file is part of the KDE project - 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 @@ -27,9 +25,6 @@ #include "SVGElement.h" #include "TreeShared.h" -#include <wtf/RefPtr.h> -#include <wtf/PassRefPtr.h> - namespace WebCore { namespace Private { @@ -37,8 +32,6 @@ namespace WebCore { void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); }; - class EventListener; - class Frame; class SVGUseElement; class SVGElementInstanceList; @@ -46,7 +39,11 @@ namespace WebCore { class SVGElementInstance : public TreeShared<SVGElementInstance>, public EventTarget { public: - SVGElementInstance(SVGUseElement*, SVGElement* originalElement); + static PassRefPtr<SVGElementInstance> create(SVGUseElement* useElement, PassRefPtr<SVGElement> originalElement) + { + return adoptRef(new SVGElementInstance(useElement, originalElement)); + } + virtual ~SVGElementInstance(); bool needsUpdate() const { return m_needsUpdate; } @@ -54,9 +51,6 @@ namespace WebCore { virtual ScriptExecutionContext* scriptExecutionContext() const; - virtual Node* toNode() { return shadowTreeElement(); } - virtual SVGElementInstance* toSVGElementInstance() { return this; } - virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&); @@ -167,6 +161,11 @@ namespace WebCore { private: friend class SVGUseElement; + SVGElementInstance(SVGUseElement*, PassRefPtr<SVGElement> originalElement); + + virtual Node* toNode() { return shadowTreeElement(); } + virtual SVGElementInstance* toSVGElementInstance() { return this; } + void appendChild(PassRefPtr<SVGElementInstance> child); void setShadowTreeElement(SVGElement*); void forgetWrapper(); @@ -191,7 +190,6 @@ namespace WebCore { virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } - private: bool m_needsUpdate : 1; SVGUseElement* m_useElement; diff --git a/WebCore/svg/SVGUseElement.cpp b/WebCore/svg/SVGUseElement.cpp index b73a692..9cb3024 100644 --- a/WebCore/svg/SVGUseElement.cpp +++ b/WebCore/svg/SVGUseElement.cpp @@ -324,7 +324,7 @@ void SVGUseElement::buildPendingResource() // Spec: If the 'use' element references a simple graphics element such as a 'rect', then there is only a // single SVGElementInstance object, and the correspondingElement attribute on this SVGElementInstance object // is the SVGRectElement that corresponds to the referenced 'rect' element. - m_targetElementInstance = new SVGElementInstance(this, target); + m_targetElementInstance = SVGElementInstance::create(this, target); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children bool foundProblem = false; @@ -474,17 +474,17 @@ void SVGUseElement::buildInstanceTree(SVGElement* target, SVGElementInstance* ta continue; // Create SVGElementInstance object, for both container/non-container nodes. - SVGElementInstance* instancePtr = new SVGElementInstance(this, element); - targetInstance->appendChild(instancePtr); + RefPtr<SVGElementInstance> instancePtr = SVGElementInstance::create(this, element); + targetInstance->appendChild(instancePtr.get()); // Enter recursion, appending new instance tree nodes to the "instance" object. if (element->hasChildNodes()) - buildInstanceTree(element, instancePtr, foundProblem); + buildInstanceTree(element, instancePtr.get(), foundProblem); // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced // object, the instance tree will contain recursive expansion of the indirect references to form a complete tree. if (element->hasTagName(SVGNames::useTag)) - handleDeepUseReferencing(static_cast<SVGUseElement*>(element), instancePtr, foundProblem); + handleDeepUseReferencing(static_cast<SVGUseElement*>(element), instancePtr.get(), foundProblem); } // Spec: If the referenced object is itself a 'use', or if there are 'use' subelements within the referenced @@ -524,11 +524,11 @@ void SVGUseElement::handleDeepUseReferencing(SVGUseElement* use, SVGElementInsta } // Create an instance object, even if we're dealing with a cycle - SVGElementInstance* newInstance = new SVGElementInstance(this, target); + RefPtr<SVGElementInstance> newInstance = SVGElementInstance::create(this, target); targetInstance->appendChild(newInstance); // Eventually enter recursion to build SVGElementInstance objects for the sub-tree children - buildInstanceTree(target, newInstance, foundProblem); + buildInstanceTree(target, newInstance.get(), foundProblem); } void SVGUseElement::alterShadowTreeForSVGTag(SVGElement* target) diff --git a/WebCore/svg/graphics/SVGResourceMasker.cpp b/WebCore/svg/graphics/SVGResourceMasker.cpp index d6c401b..97467c1 100644 --- a/WebCore/svg/graphics/SVGResourceMasker.cpp +++ b/WebCore/svg/graphics/SVGResourceMasker.cpp @@ -76,8 +76,8 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou if (!luminancedImage) return; - PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getImageData(intImageRect)->data()); - PassRefPtr<ImageData> destImageData(luminancedImage->getImageData(intImageRect)); + PassRefPtr<CanvasPixelArray> srcPixelArray(m_mask->getUnmultipliedImageData(intImageRect)->data()); + PassRefPtr<ImageData> destImageData(luminancedImage->getUnmultipliedImageData(intImageRect)); for (unsigned pixelOffset = 0; pixelOffset < srcPixelArray->length(); pixelOffset++) { unsigned pixelByteOffset = pixelOffset * 4; @@ -93,7 +93,7 @@ void SVGResourceMasker::applyMask(GraphicsContext* context, const FloatRect& bou destImageData->data()->set(pixelByteOffset + 3, luma); } - luminancedImage->putImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); + luminancedImage->putUnmultipliedImageData(destImageData.get(), intImageRect, IntPoint(0, 0)); context->clipToImageBuffer(m_maskRect, luminancedImage.get()); } diff --git a/WebCore/webcore-wx.bkl b/WebCore/webcore-wx.bkl index b31a178..a058e18 100644 --- a/WebCore/webcore-wx.bkl +++ b/WebCore/webcore-wx.bkl @@ -58,7 +58,6 @@ wxWebCore port Bakefile project file. platform/graphics/wx/GradientWx.cpp platform/graphics/wx/GraphicsContextWx.cpp platform/graphics/wx/ImageBufferWx.cpp - platform/graphics/wx/ImageSourceWx.cpp platform/graphics/wx/ImageWx.cpp platform/graphics/wx/IntPointWx.cpp platform/graphics/wx/IntRectWx.cpp diff --git a/WebCore/wml/WMLAnchorElement.cpp b/WebCore/wml/WMLAnchorElement.cpp index 91526b9..b9b3f53 100644 --- a/WebCore/wml/WMLAnchorElement.cpp +++ b/WebCore/wml/WMLAnchorElement.cpp @@ -54,7 +54,7 @@ void WMLAnchorElement::defaultEventHandler(Event* event) shouldHandle = static_cast<KeyboardEvent*>(event)->keyIdentifier() == "Enter"; if (shouldHandle && m_task) { - m_task->executeTask(event); + m_task->executeTask(); event->setDefaultHandled(); return; } @@ -71,7 +71,7 @@ void WMLAnchorElement::registerTask(WMLTaskElement* task) void WMLAnchorElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLCardElement.cpp b/WebCore/wml/WMLCardElement.cpp index 63240f3..818b818 100644 --- a/WebCore/wml/WMLCardElement.cpp +++ b/WebCore/wml/WMLCardElement.cpp @@ -339,8 +339,6 @@ WMLCardElement* WMLCardElement::determineActiveCard(Document* doc) // Update the document title doc->setTitle(activeCard->title()); - // Set the active activeCard in the WMLPageState object - pageState->setActiveCard(activeCard); return activeCard; } diff --git a/WebCore/wml/WMLDoElement.cpp b/WebCore/wml/WMLDoElement.cpp index 34be6df..38ad5dd 100644 --- a/WebCore/wml/WMLDoElement.cpp +++ b/WebCore/wml/WMLDoElement.cpp @@ -70,14 +70,17 @@ void WMLDoElement::defaultEventHandler(Event* event) if (m_type == "accept" || m_type == "options") { if (m_task) - m_task->executeTask(event); + m_task->executeTask(); } else if (m_type == "prev") { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - + // Stop the timer of the current card if it is active - if (WMLCardElement* card = pageState->activeCard()) { + if (WMLCardElement* card = document->activeCard()) { if (WMLTimerElement* eventTimer = card->eventTimer()) eventTimer->stop(); } @@ -172,7 +175,7 @@ void WMLDoElement::registerTask(WMLTaskElement* task) void WMLDoElement::deregisterTask(WMLTaskElement* task) { - ASSERT(m_task == task); + ASSERT_UNUSED(task, m_task == task); m_task = 0; } diff --git a/WebCore/wml/WMLDocument.cpp b/WebCore/wml/WMLDocument.cpp index f2287be..ef0bfc8 100644 --- a/WebCore/wml/WMLDocument.cpp +++ b/WebCore/wml/WMLDocument.cpp @@ -79,10 +79,8 @@ void WMLDocument::finishedParsing() return; } - if (m_activeCard) { + if (m_activeCard) m_activeCard->handleIntrinsicEventIfNeeded(); - m_activeCard = 0; - } } bool WMLDocument::initialize(bool aboutToFinishParsing) diff --git a/WebCore/wml/WMLDocument.h b/WebCore/wml/WMLDocument.h index fb3e62e..9053518 100644 --- a/WebCore/wml/WMLDocument.h +++ b/WebCore/wml/WMLDocument.h @@ -34,7 +34,7 @@ class WMLDocument : public Document { public: static PassRefPtr<WMLDocument> create(Frame* frame) { - return new WMLDocument(frame); + return adoptRef(new WMLDocument(frame)); } virtual ~WMLDocument(); @@ -44,6 +44,8 @@ public: bool initialize(bool aboutToFinishParsing = false); + WMLCardElement* activeCard() const { return m_activeCard; } + private: WMLDocument(Frame*); WMLCardElement* m_activeCard; diff --git a/WebCore/wml/WMLGoElement.cpp b/WebCore/wml/WMLGoElement.cpp index 635302f..8076207 100644 --- a/WebCore/wml/WMLGoElement.cpp +++ b/WebCore/wml/WMLGoElement.cpp @@ -73,18 +73,20 @@ void WMLGoElement::parseMappedAttribute(MappedAttribute* attr) WMLTaskElement::parseMappedAttribute(attr); } -void WMLGoElement::executeTask(Event*) +void WMLGoElement::executeTask() { - Document* doc = document(); - WMLPageState* pageState = wmlPageStateForDocument(doc); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; - Frame* frame = doc->frame(); + Frame* frame = document->frame(); if (!frame) return; @@ -97,7 +99,7 @@ void WMLGoElement::executeTask(Event*) return; // Substitute variables within target url attribute value - KURL url = doc->completeURL(substituteVariableReferences(href, doc, WMLVariableEscapingEscape)); + KURL url = document->completeURL(substituteVariableReferences(href, document, WMLVariableEscapingEscape)); if (url.isEmpty()) return; @@ -108,9 +110,9 @@ void WMLGoElement::executeTask(Event*) eventTimer->stop(); // FIXME: 'newcontext' handling not implemented for external cards - bool inSameDeck = doc->url().path() == url.path(); + bool inSameDeck = document->url().path() == url.path(); if (inSameDeck && url.hasFragmentIdentifier()) { - if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(doc, url.fragmentIdentifier())) { + if (WMLCardElement* card = WMLCardElement::findNamedCardInDocument(document, url.fragmentIdentifier())) { if (card->isNewContext()) pageState->reset(); } diff --git a/WebCore/wml/WMLGoElement.h b/WebCore/wml/WMLGoElement.h index 75c1858..36c7be2 100644 --- a/WebCore/wml/WMLGoElement.h +++ b/WebCore/wml/WMLGoElement.h @@ -39,7 +39,7 @@ public: void deregisterPostfieldElement(WMLPostfieldElement*); virtual void parseMappedAttribute(MappedAttribute*); - virtual void executeTask(Event*); + virtual void executeTask(); private: void preparePOSTRequest(ResourceRequest&, bool inSameDeck, const String& cacheControl); diff --git a/WebCore/wml/WMLIntrinsicEventHandler.cpp b/WebCore/wml/WMLIntrinsicEventHandler.cpp index 67364d9..8e4c276 100644 --- a/WebCore/wml/WMLIntrinsicEventHandler.cpp +++ b/WebCore/wml/WMLIntrinsicEventHandler.cpp @@ -48,7 +48,7 @@ void WMLIntrinsicEventHandler::triggerIntrinsicEvent(WMLIntrinsicEventType type) { RefPtr<WMLIntrinsicEvent> event = m_events.get(type); ASSERT(event->taskElement()); - event->taskElement()->executeTask(0); + event->taskElement()->executeTask(); } bool WMLIntrinsicEventHandler::hasIntrinsicEvent(WMLIntrinsicEventType type) const diff --git a/WebCore/wml/WMLOptionElement.cpp b/WebCore/wml/WMLOptionElement.cpp index 764d3a1..61fa762 100644 --- a/WebCore/wml/WMLOptionElement.cpp +++ b/WebCore/wml/WMLOptionElement.cpp @@ -158,6 +158,10 @@ RenderStyle* WMLOptionElement::nonRendererRenderStyle() const void WMLOptionElement::handleIntrinsicEventIfNeeded() { + WMLSelectElement* select = ownerSelectElement(this); + if (!select || !select->initialized()) + return; + WMLIntrinsicEventHandler* eventHandler = this->eventHandler(); if (!eventHandler) return; diff --git a/WebCore/wml/WMLPageState.cpp b/WebCore/wml/WMLPageState.cpp index 5f431bb..3e1863d 100644 --- a/WebCore/wml/WMLPageState.cpp +++ b/WebCore/wml/WMLPageState.cpp @@ -35,7 +35,6 @@ namespace WebCore { WMLPageState::WMLPageState(Page* page) : m_page(page) - , m_activeCard(0) , m_hasAccessControlData(false) { } diff --git a/WebCore/wml/WMLPageState.h b/WebCore/wml/WMLPageState.h index de0af91..a5d8b23 100644 --- a/WebCore/wml/WMLPageState.h +++ b/WebCore/wml/WMLPageState.h @@ -54,9 +54,6 @@ public: Page* page() const { return m_page; } - WMLCardElement* activeCard() const { return m_activeCard; } - void setActiveCard(WMLCardElement* card) { m_activeCard = card; } - // Deck access control bool processAccessControlData(const String& dmain, const String& path); void resetAccessControlData(); @@ -70,7 +67,6 @@ private: private: Page* m_page; WMLVariableMap m_variables; - WMLCardElement* m_activeCard; String m_accessDomain; String m_accessPath; bool m_hasAccessControlData; diff --git a/WebCore/wml/WMLPrevElement.cpp b/WebCore/wml/WMLPrevElement.cpp index 2688d03..3d487ea 100644 --- a/WebCore/wml/WMLPrevElement.cpp +++ b/WebCore/wml/WMLPrevElement.cpp @@ -40,13 +40,16 @@ WMLPrevElement::~WMLPrevElement() { } -void WMLPrevElement::executeTask(Event*) +void WMLPrevElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; diff --git a/WebCore/wml/WMLPrevElement.h b/WebCore/wml/WMLPrevElement.h index 232c1b0..ce8596e 100644 --- a/WebCore/wml/WMLPrevElement.h +++ b/WebCore/wml/WMLPrevElement.h @@ -31,7 +31,7 @@ public: WMLPrevElement(const QualifiedName& tagName, Document*); virtual ~WMLPrevElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLRefreshElement.cpp b/WebCore/wml/WMLRefreshElement.cpp index c05a2c9..bcf87ac 100644 --- a/WebCore/wml/WMLRefreshElement.cpp +++ b/WebCore/wml/WMLRefreshElement.cpp @@ -41,13 +41,16 @@ WMLRefreshElement::~WMLRefreshElement() { } -void WMLRefreshElement::executeTask(Event*) +void WMLRefreshElement::executeTask() { - WMLPageState* pageState = wmlPageStateForDocument(document()); + ASSERT(document()->isWMLDocument()); + WMLDocument* document = static_cast<WMLDocument*>(this->document()); + + WMLPageState* pageState = wmlPageStateForDocument(document); if (!pageState) return; - WMLCardElement* card = pageState->activeCard(); + WMLCardElement* card = document->activeCard(); if (!card) return; @@ -62,7 +65,7 @@ void WMLRefreshElement::executeTask(Event*) storeVariableState(pageState); // Redisplay curremt card with current variable state - if (Frame* frame = document()->frame()) { + if (Frame* frame = document->frame()) { if (FrameLoader* loader = frame->loader()) loader->reload(); } diff --git a/WebCore/wml/WMLRefreshElement.h b/WebCore/wml/WMLRefreshElement.h index 7b1729e..43b71b5 100644 --- a/WebCore/wml/WMLRefreshElement.h +++ b/WebCore/wml/WMLRefreshElement.h @@ -31,7 +31,7 @@ public: WMLRefreshElement(const QualifiedName& tagName, Document*); virtual ~WMLRefreshElement(); - virtual void executeTask(Event*); + virtual void executeTask(); }; } diff --git a/WebCore/wml/WMLSelectElement.cpp b/WebCore/wml/WMLSelectElement.cpp index 2d03a3f..03ca05a 100644 --- a/WebCore/wml/WMLSelectElement.cpp +++ b/WebCore/wml/WMLSelectElement.cpp @@ -39,6 +39,7 @@ using namespace WMLNames; WMLSelectElement::WMLSelectElement(const QualifiedName& tagName, Document* document) : WMLFormControlElement(tagName, document) + , m_initialized(false) { } @@ -242,14 +243,17 @@ void WMLSelectElement::selectInitialOptions() // Spec: Step 1 - the default option index is determined using iname and ivalue calculateDefaultOptionIndices(); - if (m_defaultOptionIndices.isEmpty()) + if (m_defaultOptionIndices.isEmpty()) { + m_initialized = true; return; + } // Spec: Step 2 – initialise variables initializeVariables(); // Spec: Step 3 – pre-select option(s) specified by the default option index selectDefaultOptions(); + m_initialized = true; } void WMLSelectElement::insertedIntoTree(bool deep) diff --git a/WebCore/wml/WMLSelectElement.h b/WebCore/wml/WMLSelectElement.h index 412a950..5ab7da6 100644 --- a/WebCore/wml/WMLSelectElement.h +++ b/WebCore/wml/WMLSelectElement.h @@ -85,6 +85,8 @@ public: void scrollToSelection(); void selectInitialOptions(); + bool initialized() const { return m_initialized; } + private: virtual void insertedIntoTree(bool); @@ -104,6 +106,7 @@ private: String ivalue() const; SelectElementData m_data; + bool m_initialized; Vector<unsigned> m_defaultOptionIndices; }; diff --git a/WebCore/wml/WMLTaskElement.h b/WebCore/wml/WMLTaskElement.h index b5dab8c..b813285 100644 --- a/WebCore/wml/WMLTaskElement.h +++ b/WebCore/wml/WMLTaskElement.h @@ -40,7 +40,7 @@ public: virtual void insertedIntoDocument(); virtual void removedFromDocument(); - virtual void executeTask(Event*) = 0; + virtual void executeTask() = 0; void registerVariableSetter(WMLSetvarElement*); void deregisterVariableSetter(WMLSetvarElement*); diff --git a/WebCore/workers/DedicatedWorkerContext.cpp b/WebCore/workers/DedicatedWorkerContext.cpp index ae5c547..6e5a317 100644 --- a/WebCore/workers/DedicatedWorkerContext.cpp +++ b/WebCore/workers/DedicatedWorkerContext.cpp @@ -46,23 +46,6 @@ DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& us { } -DedicatedWorkerContext::~DedicatedWorkerContext() -{ - ASSERT(currentThread() == thread()->threadID()); - // Notify parent worker we are going away. This can free the WorkerThread object, so do not access it after this. - thread()->workerObjectProxy().workerContextDestroyed(); -} - -void DedicatedWorkerContext::forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) -{ - thread()->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); -} - -void DedicatedWorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) -{ - thread()->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL); -} - void DedicatedWorkerContext::postMessage(const String& message, ExceptionCode& ec) { postMessage(message, 0, ec); diff --git a/WebCore/workers/DedicatedWorkerContext.h b/WebCore/workers/DedicatedWorkerContext.h index e974cef..be9be0b 100644 --- a/WebCore/workers/DedicatedWorkerContext.h +++ b/WebCore/workers/DedicatedWorkerContext.h @@ -46,18 +46,12 @@ namespace WebCore { { return adoptRef(new DedicatedWorkerContext(url, userAgent, thread)); } - virtual ~DedicatedWorkerContext(); virtual bool isDedicatedWorkerContext() const { return true; } // Overridden to allow us to check our pending activity after executing imported script. virtual void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&); - // ScriptExecutionContext - virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL); - // EventTarget virtual DedicatedWorkerContext* toDedicatedWorkerContext() { return this; } void postMessage(const String&, ExceptionCode&); diff --git a/WebCore/workers/DedicatedWorkerThread.cpp b/WebCore/workers/DedicatedWorkerThread.cpp index 0905843..d4789a1 100644 --- a/WebCore/workers/DedicatedWorkerThread.cpp +++ b/WebCore/workers/DedicatedWorkerThread.cpp @@ -45,7 +45,7 @@ PassRefPtr<DedicatedWorkerThread> DedicatedWorkerThread::create(const KURL& scri } DedicatedWorkerThread::DedicatedWorkerThread(const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerObjectProxy& workerObjectProxy) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerObjectProxy) , m_workerObjectProxy(workerObjectProxy) { } diff --git a/WebCore/workers/DefaultSharedWorkerRepository.cpp b/WebCore/workers/DefaultSharedWorkerRepository.cpp index 1c1ed4c..e55d3e1 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.cpp +++ b/WebCore/workers/DefaultSharedWorkerRepository.cpp @@ -35,6 +35,7 @@ #include "DefaultSharedWorkerRepository.h" #include "ActiveDOMObject.h" +#include "Document.h" #include "MessagePort.h" #include "NotImplemented.h" #include "PlatformString.h" @@ -42,52 +43,118 @@ #include "SecurityOriginHash.h" #include "SharedWorker.h" #include "SharedWorkerContext.h" +#include "SharedWorkerRepository.h" #include "SharedWorkerThread.h" #include "WorkerLoaderProxy.h" +#include "WorkerReportingProxy.h" #include "WorkerScriptLoader.h" #include "WorkerScriptLoaderClient.h" - +#include <wtf/HashSet.h> #include <wtf/Threading.h> namespace WebCore { -class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy { +class SharedWorkerProxy : public ThreadSafeShared<SharedWorkerProxy>, public WorkerLoaderProxy, public WorkerReportingProxy { public: - static PassRefPtr<SharedWorkerProxy> create(const String& name, const KURL& url) { return adoptRef(new SharedWorkerProxy(name, url)); } + static PassRefPtr<SharedWorkerProxy> create(const String& name, const KURL& url, PassRefPtr<SecurityOrigin> origin) { return adoptRef(new SharedWorkerProxy(name, url, origin)); } void setThread(PassRefPtr<SharedWorkerThread> thread) { m_thread = thread; } SharedWorkerThread* thread() { return m_thread.get(); } - bool closing() const { return m_closing; } + bool isClosing() const { return m_closing; } + void close(); KURL url() const { return m_url.copy(); } String name() const { return m_name.copy(); } + bool matches(const String& name, PassRefPtr<SecurityOrigin> origin) const { return name == m_name && origin->equal(m_origin.get()); } // WorkerLoaderProxy // FIXME: Implement WorkerLoaderProxy APIs by proxying to an active document. virtual void postTaskToLoader(PassRefPtr<ScriptExecutionContext::Task>) { notImplemented(); } virtual void postTaskForModeToWorkerContext(PassRefPtr<ScriptExecutionContext::Task>, const String&) { notImplemented(); } + // WorkerReportingProxy + virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL); + virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL); + virtual void workerContextClosed(); + virtual void workerContextDestroyed(); + // Updates the list of the worker's documents, per section 4.5 of the WebWorkers spec. void addToWorkerDocuments(ScriptExecutionContext*); + + bool isInWorkerDocuments(Document* document) { return m_workerDocuments.contains(document); } + + // Removes a detached document from the list of worker's documents. May set the closing flag if this is the last document in the list. + void documentDetached(Document*); + private: - SharedWorkerProxy(const String& name, const KURL&); + SharedWorkerProxy(const String& name, const KURL&, PassRefPtr<SecurityOrigin>); bool m_closing; String m_name; KURL m_url; + // The thread is freed when the proxy is destroyed, so we need to make sure that the proxy stays around until the SharedWorkerContext exits. RefPtr<SharedWorkerThread> m_thread; + RefPtr<SecurityOrigin> m_origin; + HashSet<Document*> m_workerDocuments; }; -SharedWorkerProxy::SharedWorkerProxy(const String& name, const KURL& url) +SharedWorkerProxy::SharedWorkerProxy(const String& name, const KURL& url, PassRefPtr<SecurityOrigin> origin) : m_closing(false) , m_name(name.copy()) , m_url(url.copy()) + , m_origin(origin) +{ + // We should be the sole owner of the SecurityOrigin, as we will free it on another thread. + ASSERT(m_origin->hasOneRef()); +} + +void SharedWorkerProxy::postExceptionToWorkerObject(const String&, int, const String&) +{ + // FIXME: Log exceptions to all parent documents. + notImplemented(); +} + +void SharedWorkerProxy::postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, int, const String&) { + // FIXME: Log console messages to all parent documents. + notImplemented(); +} + +void SharedWorkerProxy::workerContextClosed() +{ + m_closing = true; +} + +void SharedWorkerProxy::workerContextDestroyed() +{ + // The proxy may be freed by this call, so do not reference it any further. + DefaultSharedWorkerRepository::instance().removeProxy(this); } void SharedWorkerProxy::addToWorkerDocuments(ScriptExecutionContext* context) { // Nested workers are not yet supported, so passed-in context should always be a Document. ASSERT(context->isDocument()); - // FIXME: track referring documents so we can shutdown the thread when the last one exits and remove the proxy from the cache. + ASSERT(!isClosing()); + Document* document = static_cast<Document*>(context); + m_workerDocuments.add(document); +} + +void SharedWorkerProxy::documentDetached(Document* document) +{ + if (isClosing()) + return; + // Remove the document from our set (if it's there) and if that was the last document in the set, mark the proxy as closed. + m_workerDocuments.remove(document); + if (!m_workerDocuments.size()) + close(); +} + +void SharedWorkerProxy::close() +{ + ASSERT(!isClosing()); + m_closing = true; + // Stop the worker thread - the proxy will stay around until we get workerThreadExited() notification. + if (m_thread) + m_thread->stop(); } class SharedWorkerConnectTask : public ScriptExecutionContext::Task { @@ -172,12 +239,12 @@ DefaultSharedWorkerRepository& DefaultSharedWorkerRepository::instance() void DefaultSharedWorkerRepository::workerScriptLoaded(SharedWorkerProxy& proxy, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel> port) { MutexLocker lock(m_lock); - if (proxy.closing()) + if (proxy.isClosing()) return; // Another loader may have already started up a thread for this proxy - if so, just send a connect to the pre-existing thread. if (!proxy.thread()) { - RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy); + RefPtr<SharedWorkerThread> thread = SharedWorkerThread::create(proxy.name(), proxy.url(), userAgent, workerScript, proxy, proxy); proxy.setThread(thread); thread->start(); } @@ -189,6 +256,44 @@ void SharedWorkerRepository::connect(PassRefPtr<SharedWorker> worker, PassOwnPtr DefaultSharedWorkerRepository::instance().connectToWorker(worker, port, url, name, ec); } +void SharedWorkerRepository::documentDetached(Document* document) +{ + DefaultSharedWorkerRepository::instance().documentDetached(document); +} + +bool SharedWorkerRepository::hasSharedWorkers(Document* document) +{ + return DefaultSharedWorkerRepository::instance().hasSharedWorkers(document); +} + +bool DefaultSharedWorkerRepository::hasSharedWorkers(Document* document) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (m_proxies[i]->isInWorkerDocuments(document)) + return true; + } + return false; +} + +void DefaultSharedWorkerRepository::removeProxy(SharedWorkerProxy* proxy) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (proxy == m_proxies[i].get()) { + m_proxies.remove(i); + return; + } + } +} + +void DefaultSharedWorkerRepository::documentDetached(Document* document) +{ + MutexLocker lock(m_lock); + for (unsigned i = 0; i < m_proxies.size(); i++) + m_proxies[i]->documentDetached(document); +} + void DefaultSharedWorkerRepository::connectToWorker(PassRefPtr<SharedWorker> worker, PassOwnPtr<MessagePortChannel> port, const KURL& url, const String& name, ExceptionCode& ec) { MutexLocker lock(m_lock); @@ -216,18 +321,14 @@ PassRefPtr<SharedWorkerProxy> DefaultSharedWorkerRepository::getProxy(const Stri // Look for an existing worker, and create one if it doesn't exist. // Items in the cache are freed on another thread, so copy the URL before creating the origin, to make sure no references to external strings linger. RefPtr<SecurityOrigin> origin = SecurityOrigin::create(url.copy()); - SharedWorkerNameMap* nameMap = m_cache.get(origin); - if (!nameMap) { - nameMap = new SharedWorkerNameMap(); - m_cache.set(origin, nameMap); - } - - RefPtr<SharedWorkerProxy> proxy = nameMap->get(name); - if (!proxy.get()) { - proxy = SharedWorkerProxy::create(name, url); - nameMap->set(proxy->name(), proxy); + for (unsigned i = 0; i < m_proxies.size(); i++) { + if (!m_proxies[i]->isClosing() && m_proxies[i]->matches(name, origin)) + return m_proxies[i]; } - return proxy; + // Proxy is not in the repository currently - create a new one. + RefPtr<SharedWorkerProxy> proxy = SharedWorkerProxy::create(name, url, origin.release()); + m_proxies.append(proxy); + return proxy.release(); } DefaultSharedWorkerRepository::DefaultSharedWorkerRepository() diff --git a/WebCore/workers/DefaultSharedWorkerRepository.h b/WebCore/workers/DefaultSharedWorkerRepository.h index 0b4e66c..c2eaff4 100644 --- a/WebCore/workers/DefaultSharedWorkerRepository.h +++ b/WebCore/workers/DefaultSharedWorkerRepository.h @@ -33,22 +33,24 @@ #if ENABLE(SHARED_WORKERS) -#include "SharedWorkerRepository.h" +#include "ExceptionCode.h" #include "StringHash.h" #include <wtf/HashMap.h> #include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/Threading.h> namespace WebCore { + class Document; class KURL; + class MessagePortChannel; class ScriptExecutionContext; - class SecurityOrigin; + class SharedWorker; class SharedWorkerProxy; - - struct SecurityOriginHash; - struct SecurityOriginTraits; + class String; // Platform-specific implementation of the SharedWorkerRepository static interface. class DefaultSharedWorkerRepository : public Noncopyable { @@ -59,6 +61,14 @@ namespace WebCore { // Internal implementation of SharedWorkerRepository::connect() void connectToWorker(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&); + // Notification that a document has been detached. + void documentDetached(Document*); + + // Removes the passed SharedWorkerProxy from the repository. + void removeProxy(SharedWorkerProxy*); + + bool hasSharedWorkers(Document*); + static DefaultSharedWorkerRepository& instance(); private: DefaultSharedWorkerRepository(); @@ -68,11 +78,9 @@ namespace WebCore { // Mutex used to protect internal data structures. Mutex m_lock; - typedef HashMap<String, RefPtr<SharedWorkerProxy> > SharedWorkerNameMap; - typedef HashMap<RefPtr<SecurityOrigin>, SharedWorkerNameMap*, SecurityOriginHash> SharedWorkerProxyCache; - - // Items in this cache may be freed on another thread, so all keys and values must be either copied before insertion or thread safe. - SharedWorkerProxyCache m_cache; + // List of shared workers. Expectation is that there will be a limited number of shared workers, and so tracking them in a Vector is more efficient than nested HashMaps. + typedef Vector<RefPtr<SharedWorkerProxy> > SharedWorkerProxyRepository; + SharedWorkerProxyRepository m_proxies; }; } // namespace WebCore diff --git a/WebCore/workers/SharedWorkerContext.cpp b/WebCore/workers/SharedWorkerContext.cpp index 2c50d94..ef35a60 100644 --- a/WebCore/workers/SharedWorkerContext.cpp +++ b/WebCore/workers/SharedWorkerContext.cpp @@ -39,7 +39,6 @@ #include "MessageEvent.h" #include "NotImplemented.h" #include "SharedWorkerThread.h" -#include "WorkerObjectProxy.h" namespace WebCore { @@ -53,17 +52,6 @@ SharedWorkerContext::~SharedWorkerContext() { } -void SharedWorkerContext::forwardException(const String&, int, const String&) -{ - // FIXME: forward to console (do not need to report to parent context). -} - -void SharedWorkerContext::addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String&, unsigned, const String&) -{ - // FIXME: forward to console. - notImplemented(); -} - void SharedWorkerContext::dispatchConnect(PassRefPtr<MessagePort> port) { // Since close() stops the thread event loop, this should not ever get called while closing. diff --git a/WebCore/workers/SharedWorkerContext.h b/WebCore/workers/SharedWorkerContext.h index a7e4133..d6956cd 100644 --- a/WebCore/workers/SharedWorkerContext.h +++ b/WebCore/workers/SharedWorkerContext.h @@ -50,11 +50,6 @@ namespace WebCore { virtual bool isSharedWorkerContext() const { return true; } - // ScriptExecutionContext - virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL); - // EventTarget virtual SharedWorkerContext* toSharedWorkerContext() { return this; } diff --git a/WebCore/workers/SharedWorkerRepository.h b/WebCore/workers/SharedWorkerRepository.h index 84acf77..96d2fb1 100644 --- a/WebCore/workers/SharedWorkerRepository.h +++ b/WebCore/workers/SharedWorkerRepository.h @@ -34,12 +34,12 @@ #if ENABLE(SHARED_WORKERS) #include "ExceptionCode.h" - #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> namespace WebCore { + class Document; class KURL; class MessagePortChannel; class SharedWorker; @@ -50,6 +50,12 @@ namespace WebCore { public: // Connects the passed SharedWorker object with the specified worker thread, creating a new thread if necessary. static void connect(PassRefPtr<SharedWorker>, PassOwnPtr<MessagePortChannel>, const KURL&, const String& name, ExceptionCode&); + + // Invoked when a document has been detached. + static void documentDetached(Document*); + + // Returns true if the passed document is associated with any SharedWorkers. + static bool hasSharedWorkers(Document*); private: SharedWorkerRepository() { } }; diff --git a/WebCore/workers/SharedWorkerThread.cpp b/WebCore/workers/SharedWorkerThread.cpp index 40bb2de..ded4834 100644 --- a/WebCore/workers/SharedWorkerThread.cpp +++ b/WebCore/workers/SharedWorkerThread.cpp @@ -38,13 +38,13 @@ namespace WebCore { -PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) +PassRefPtr<SharedWorkerThread> SharedWorkerThread::create(const String& name, const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) { - return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy)); + return adoptRef(new SharedWorkerThread(name, scriptURL, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy)); } -SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) - : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy) +SharedWorkerThread::SharedWorkerThread(const String& name, const KURL& url, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) + : WorkerThread(url, userAgent, sourceCode, workerLoaderProxy, workerReportingProxy) , m_name(name.copy()) { } diff --git a/WebCore/workers/SharedWorkerThread.h b/WebCore/workers/SharedWorkerThread.h index 15838d7..d96fd2a 100644 --- a/WebCore/workers/SharedWorkerThread.h +++ b/WebCore/workers/SharedWorkerThread.h @@ -38,14 +38,14 @@ namespace WebCore { class SharedWorkerThread : public WorkerThread { public: - static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + static PassRefPtr<SharedWorkerThread> create(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); ~SharedWorkerThread(); protected: virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL&, const String&); private: - SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + SharedWorkerThread(const String& name, const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); String m_name; }; diff --git a/WebCore/workers/Worker.cpp b/WebCore/workers/Worker.cpp index a906134..d4d0e9b 100644 --- a/WebCore/workers/Worker.cpp +++ b/WebCore/workers/Worker.cpp @@ -58,7 +58,7 @@ Worker::Worker(const String& url, ScriptExecutionContext* context, ExceptionCode return; m_scriptLoader = new WorkerScriptLoader(); - m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRedirect, this); + m_scriptLoader->loadAsynchronously(scriptExecutionContext(), scriptURL, DenyCrossOriginRequests, this); setPendingActivity(this); // The worker context does not exist while loading, so we must ensure that the worker object is not collected, as well as its event listeners. } diff --git a/WebCore/workers/WorkerContext.cpp b/WebCore/workers/WorkerContext.cpp index 722588f..3cb1733 100644 --- a/WebCore/workers/WorkerContext.cpp +++ b/WebCore/workers/WorkerContext.cpp @@ -50,6 +50,10 @@ #include "XMLHttpRequestException.h" #include <wtf/RefPtr.h> +#if ENABLE(NOTIFICATIONS) +#include "NotificationCenter.h" +#endif + namespace WebCore { WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThread* thread) @@ -64,6 +68,12 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr WorkerContext::~WorkerContext() { + ASSERT(currentThread() == thread()->threadID()); +#if ENABLE(NOTIFICATIONS) + m_notifications.clear(); +#endif + // Notify proxy that we are going away. This can free the WorkerThread object, so do not access it after this. + thread()->workerReportingProxy().workerContextDestroyed(); } ScriptExecutionContext* WorkerContext::scriptExecutionContext() const @@ -109,6 +119,8 @@ void WorkerContext::close() return; m_closing = true; + // Notify parent that this context is closed. + thread()->workerReportingProxy().workerContextClosed(); m_thread->stop(); } @@ -244,7 +256,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, const String& call for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++it) { WorkerScriptLoader scriptLoader; - scriptLoader.loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRedirect); + scriptLoader.loadSynchronously(scriptExecutionContext(), *it, AllowCrossOriginRequests); // If the fetching attempt failed, throw a NETWORK_ERR exception and abort all these steps. if (scriptLoader.failed()) { @@ -271,8 +283,22 @@ void WorkerContext::reportException(const String& errorMessage, int lineNumber, errorHandled = onerror()->reportError(errorMessage, sourceURL, lineNumber); if (!errorHandled) - forwardException(errorMessage, lineNumber, sourceURL); + thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); +} + +void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) +{ + thread()->workerReportingProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL); +} + +#if ENABLE(NOTIFICATIONS) +NotificationCenter* WorkerContext::webkitNotifications() const +{ + if (!m_notifications) + m_notifications = NotificationCenter::create(scriptExecutionContext(), m_thread->getNotificationPresenter()); + return m_notifications.get(); } +#endif } // namespace WebCore diff --git a/WebCore/workers/WorkerContext.h b/WebCore/workers/WorkerContext.h index aa47475..2131a7c 100644 --- a/WebCore/workers/WorkerContext.h +++ b/WebCore/workers/WorkerContext.h @@ -41,6 +41,7 @@ namespace WebCore { + class NotificationCenter; class ScheduledAction; class WorkerLocation; class WorkerNavigator; @@ -48,7 +49,6 @@ namespace WebCore { class WorkerContext : public RefCounted<WorkerContext>, public ScriptExecutionContext, public EventTarget { public: - virtual ~WorkerContext(); virtual bool isWorkerContext() const { return true; } @@ -103,8 +103,11 @@ namespace WebCore { // ScriptExecutionContext virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL); + virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL); - virtual void forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; +#if ENABLE(NOTIFICATIONS) + NotificationCenter* webkitNotifications() const; +#endif // These methods are used for GC marking. See JSWorkerContext::markChildren(MarkStack&) in // JSWorkerContextCustom.cpp. @@ -139,6 +142,9 @@ namespace WebCore { RefPtr<EventListener> m_onerrorListener; EventListenersMap m_eventListeners; +#if ENABLE_NOTIFICATIONS + mutable RefPtr<NotificationCenter> m_notifications; +#endif bool m_closing; }; diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl index 2404d22..6a4a7fa 100644 --- a/WebCore/workers/WorkerContext.idl +++ b/WebCore/workers/WorkerContext.idl @@ -69,6 +69,10 @@ module threads { boolean dispatchEvent(in Event evt) raises(EventException); +#if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS + // Notification interface + readonly attribute NotificationCenter webkitNotifications; +#endif // Constructors attribute MessageEventConstructor MessageEvent; @@ -77,6 +81,9 @@ module threads { #if ENABLE_CHANNEL_MESSAGING attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel; #endif +#if ENABLE_EVENTSOURCE + attribute [JSCCustomGetter] EventSourceConstructor EventSource; +#endif attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest; }; diff --git a/WebCore/workers/WorkerObjectProxy.h b/WebCore/workers/WorkerObjectProxy.h index c5f4456..586e7a0 100644 --- a/WebCore/workers/WorkerObjectProxy.h +++ b/WebCore/workers/WorkerObjectProxy.h @@ -33,31 +33,24 @@ #if ENABLE(WORKERS) -#include "Console.h" +#include "WorkerReportingProxy.h" #include <wtf/PassOwnPtr.h> namespace WebCore { class MessagePortChannel; - class String; // A proxy to talk to the worker object. - class WorkerObjectProxy { + class WorkerObjectProxy : public WorkerReportingProxy { public: - virtual ~WorkerObjectProxy() {} - virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0; - virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; - - virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0; - virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; - virtual void reportPendingActivity(bool hasPendingActivity) = 0; - virtual void workerContextDestroyed() = 0; + // No need to notify the parent page context when dedicated workers are closing. + virtual void workerContextClosed() { } }; } // namespace WebCore diff --git a/WebCore/workers/WorkerReportingProxy.h b/WebCore/workers/WorkerReportingProxy.h new file mode 100644 index 0000000..f0447c8 --- /dev/null +++ b/WebCore/workers/WorkerReportingProxy.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WorkerReportingProxy_h +#define WorkerReportingProxy_h + +#if ENABLE(WORKERS) + +#include "Console.h" + +namespace WebCore { + + class String; + + // APIs used by workers to report console activity. + class WorkerReportingProxy { + public: + virtual ~WorkerReportingProxy() {} + + virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0; + + // Invoked when close() is invoked on the worker context. + virtual void workerContextClosed() = 0; + + // Invoked when the thread has stopped. + virtual void workerContextDestroyed() = 0; + }; +} // namespace WebCore + +#endif // ENABLE(WORKERS) + +#endif // WorkerReportingProxy_h diff --git a/WebCore/workers/WorkerScriptLoader.cpp b/WebCore/workers/WorkerScriptLoader.cpp index 0162b26..52baf2d 100644 --- a/WebCore/workers/WorkerScriptLoader.cpp +++ b/WebCore/workers/WorkerScriptLoader.cpp @@ -50,7 +50,7 @@ WorkerScriptLoader::WorkerScriptLoader() { } -void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRedirectPolicy crossOriginRedirectPolicy) +void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy) { m_url = url; @@ -59,10 +59,15 @@ void WorkerScriptLoader::loadSynchronously(ScriptExecutionContext* scriptExecuti return; ASSERT(scriptExecutionContext->isWorkerContext()); - WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(scriptExecutionContext), *request, *this, AllowStoredCredentials, crossOriginRedirectPolicy); + + ThreadableLoaderOptions options; + options.allowCredentials = true; + options.crossOriginRequestPolicy = crossOriginRequestPolicy; + + WorkerThreadableLoader::loadResourceSynchronously(static_cast<WorkerContext*>(scriptExecutionContext), *request, *this, options); } -void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRedirectPolicy crossOriginRedirectPolicy, WorkerScriptLoaderClient* client) +void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecutionContext, const KURL& url, CrossOriginRequestPolicy crossOriginRequestPolicy, WorkerScriptLoaderClient* client) { ASSERT(client); m_client = client; @@ -72,7 +77,11 @@ void WorkerScriptLoader::loadAsynchronously(ScriptExecutionContext* scriptExecut if (!request) return; - m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, DoNotSendLoadCallbacks, DoNotSniffContent, AllowStoredCredentials, crossOriginRedirectPolicy); + ThreadableLoaderOptions options; + options.allowCredentials = true; + options.crossOriginRequestPolicy = crossOriginRequestPolicy; + + m_threadableLoader = ThreadableLoader::create(scriptExecutionContext, this, *request, options); } PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest() diff --git a/WebCore/workers/WorkerScriptLoader.h b/WebCore/workers/WorkerScriptLoader.h index 2924ec8..47623f6 100644 --- a/WebCore/workers/WorkerScriptLoader.h +++ b/WebCore/workers/WorkerScriptLoader.h @@ -46,8 +46,8 @@ namespace WebCore { public: WorkerScriptLoader(); - void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRedirectPolicy); - void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRedirectPolicy, WorkerScriptLoaderClient*); + void loadSynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy); + void loadAsynchronously(ScriptExecutionContext*, const KURL&, CrossOriginRequestPolicy, WorkerScriptLoaderClient*); void notifyError(); diff --git a/WebCore/workers/WorkerThread.cpp b/WebCore/workers/WorkerThread.cpp index 86a5fa8..752c178 100644 --- a/WebCore/workers/WorkerThread.cpp +++ b/WebCore/workers/WorkerThread.cpp @@ -61,9 +61,10 @@ WorkerThreadStartupData::WorkerThreadStartupData(const KURL& scriptURL, const St { } -WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy) +WorkerThread::WorkerThread(const KURL& scriptURL, const String& userAgent, const String& sourceCode, WorkerLoaderProxy& workerLoaderProxy, WorkerReportingProxy& workerReportingProxy) : m_threadID(0) , m_workerLoaderProxy(workerLoaderProxy) + , m_workerReportingProxy(workerReportingProxy) , m_startupData(WorkerThreadStartupData::create(scriptURL, userAgent, sourceCode)) { } diff --git a/WebCore/workers/WorkerThread.h b/WebCore/workers/WorkerThread.h index a6b22dc..5d861e1 100644 --- a/WebCore/workers/WorkerThread.h +++ b/WebCore/workers/WorkerThread.h @@ -37,9 +37,11 @@ namespace WebCore { class KURL; + class NotificationPresenter; class String; class WorkerContext; class WorkerLoaderProxy; + class WorkerReportingProxy; struct WorkerThreadStartupData; class WorkerThread : public RefCounted<WorkerThread> { @@ -52,9 +54,10 @@ namespace WebCore { ThreadIdentifier threadID() const { return m_threadID; } WorkerRunLoop& runLoop() { return m_runLoop; } WorkerLoaderProxy& workerLoaderProxy() const { return m_workerLoaderProxy; } + WorkerReportingProxy& workerReportingProxy() const { return m_workerReportingProxy; } protected: - WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&); + WorkerThread(const KURL&, const String& userAgent, const String& sourceCode, WorkerLoaderProxy&, WorkerReportingProxy&); // Factory method for creating a new worker context for the thread. virtual PassRefPtr<WorkerContext> createWorkerContext(const KURL& url, const String& userAgent) = 0; @@ -64,6 +67,11 @@ namespace WebCore { WorkerContext* workerContext() { return m_workerContext.get(); } +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* getNotificationPresenter() { return m_notificationPresenter; } + void setNotificationPresenter(NotificationPresenter* presenter) { m_notificationPresenter = presenter; } +#endif + private: // Static function executed as the core routine on the new thread. Passed a pointer to a WorkerThread object. static void* workerThreadStart(void*); @@ -72,11 +80,16 @@ namespace WebCore { ThreadIdentifier m_threadID; WorkerRunLoop m_runLoop; WorkerLoaderProxy& m_workerLoaderProxy; + WorkerReportingProxy& m_workerReportingProxy; RefPtr<WorkerContext> m_workerContext; Mutex m_threadCreationMutex; OwnPtr<WorkerThreadStartupData> m_startupData; + +#if ENABLE(NOTIFICATIONS) + NotificationPresenter* m_notificationPresenter; +#endif }; } // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index 5e20252..0b2fabb 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -25,7 +25,6 @@ #include "Cache.h" #include "CString.h" #include "CrossOriginAccessControl.h" -#include "CrossOriginPreflightResultCache.h" #include "DOMImplementation.h" #include "Document.h" #include "Event.h" @@ -93,25 +92,25 @@ static bool isValidToken(const String& name) unsigned length = name.length(); for (unsigned i = 0; i < length; i++) { UChar c = name[i]; - + if (c >= 127 || c <= 32) return false; - + if (c == '(' || c == ')' || c == '<' || c == '>' || c == '@' || c == ',' || c == ';' || c == ':' || c == '\\' || c == '\"' || c == '/' || c == '[' || c == ']' || c == '?' || c == '=' || c == '{' || c == '}') return false; } - + return true; } - + static bool isValidHeaderValue(const String& name) { - // FIXME: This should really match name against + // FIXME: This should really match name against // field-value in section 4.2 of RFC 2616. - + return !name.contains('\r') && !name.contains('\n'); } @@ -143,9 +142,9 @@ XMLHttpRequest::XMLHttpRequest(ScriptExecutionContext* context) , m_responseText("") , m_createdDocument(false) , m_error(false) + , m_uploadEventsAllowed(true) , m_uploadComplete(false) , m_sameOriginRequest(true) - , m_inPreflight(false) , m_didTellLoaderAboutRequest(false) , m_receivedLength(0) , m_lastSendLineNumber(0) @@ -207,7 +206,7 @@ Document* XMLHttpRequest::responseXML() const m_responseXML->write(String(m_responseText)); m_responseXML->finishParsing(); m_responseXML->close(); - + if (!m_responseXML->wellFormed()) m_responseXML = 0; } @@ -236,7 +235,7 @@ void XMLHttpRequest::addEventListener(const AtomicString& eventType, PassRefPtr< for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) if (*listenerIter == eventListener) return; - + listeners.append(eventListener); m_eventListeners.add(eventType, listeners); } @@ -322,10 +321,10 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc ec = SYNTAX_ERR; return; } - + // Method names are case sensitive. But since Firefox uppercases method names it knows, we'll do the same. String methodUpper(method.upper()); - + if (methodUpper == "TRACE" || methodUpper == "TRACK" || methodUpper == "CONNECT") { ec = SECURITY_ERR; return; @@ -335,7 +334,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc if (methodUpper == "COPY" || methodUpper == "DELETE" || methodUpper == "GET" || methodUpper == "HEAD" || methodUpper == "INDEX" || methodUpper == "LOCK" || methodUpper == "M-POST" || methodUpper == "MKCOL" || methodUpper == "MOVE" - || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT" + || methodUpper == "OPTIONS" || methodUpper == "POST" || methodUpper == "PROPFIND" || methodUpper == "PROPPATCH" || methodUpper == "PUT" || methodUpper == "UNLOCK") m_method = methodUpper; else @@ -357,7 +356,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, con { KURL urlWithCredentials(url); urlWithCredentials.setUser(user); - + open(method, urlWithCredentials, async, ec); } @@ -366,7 +365,7 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, con KURL urlWithCredentials(url); urlWithCredentials.setUser(user); urlWithCredentials.setPass(password); - + open(method, urlWithCredentials, async, ec); } @@ -463,34 +462,23 @@ void XMLHttpRequest::send(File* body, ExceptionCode& ec) void XMLHttpRequest::createRequest(ExceptionCode& ec) { - // Upload event listeners should be disallowed for simple cross-origin requests, because POSTing to an URL that does not - // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. If a listener exists - // when creating the request, it will force preflight. + // The presence of upload event listeners forces us to use preflighting because POSTing to an URL that does not + // permit cross origin requests should look exactly like POSTing to an URL that does not respond at all. // Also, only async requests support upload progress events. - m_uploadEventsAllowed = false; + bool forcePreflight = false; if (m_async) { dispatchLoadStartEvent(); if (m_requestEntityBody && m_upload) { - m_uploadEventsAllowed = m_upload->hasListeners(); + forcePreflight = m_upload->hasListeners(); m_upload->dispatchLoadStartEvent(); } } m_sameOriginRequest = scriptExecutionContext()->securityOrigin()->canRequest(m_url); - if (!m_sameOriginRequest) { - makeCrossOriginAccessRequest(ec); - return; - } - - m_uploadEventsAllowed = true; - - makeSameOriginRequest(ec); -} - -void XMLHttpRequest::makeSameOriginRequest(ExceptionCode& ec) -{ - ASSERT(m_sameOriginRequest); + // We also remember whether upload events should be allowed for this request in case the upload listeners are + // added after the request is started. + m_uploadEventsAllowed = !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); @@ -504,202 +492,28 @@ void XMLHttpRequest::makeSameOriginRequest(ExceptionCode& ec) if (m_requestHeaders.size() > 0) request.addHTTPHeaderFields(m_requestHeaders); - if (m_async) - loadRequestAsynchronously(request); - else - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::makeCrossOriginAccessRequest(ExceptionCode& ec) -{ - ASSERT(!m_sameOriginRequest); + ThreadableLoaderOptions options; + options.sendLoadCallbacks = true; + options.sniffContent = false; + options.forcePreflight = forcePreflight; + options.allowCredentials = m_sameOriginRequest || m_includeCredentials; + options.crossOriginRequestPolicy = UseAccessControl; - if (!m_uploadEventsAllowed && isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders)) - makeSimpleCrossOriginAccessRequest(ec); - else - makeCrossOriginAccessRequestWithPreflight(ec); -} - -void XMLHttpRequest::makeSimpleCrossOriginAccessRequest(ExceptionCode& ec) -{ - ASSERT(isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders)); - - // Cross-origin requests are only defined for HTTP. We would catch this when checking response headers later, but there is no reason to send a request that's guaranteed to be denied. - if (!m_url.protocolInHTTPFamily()) { - ec = XMLHttpRequestException::NETWORK_ERR; - networkError(); - return; - } - - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPOrigin(scriptExecutionContext()->securityOrigin()->toString()); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } - - if (m_async) - loadRequestAsynchronously(request); - else - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::makeCrossOriginAccessRequestWithPreflight(ExceptionCode& ec) -{ - String origin = scriptExecutionContext()->securityOrigin()->toString(); - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - if (!CrossOriginPreflightResultCache::shared().canSkipPreflight(origin, url, m_includeCredentials, m_method, m_requestHeaders)) { - m_inPreflight = true; - ResourceRequest preflightRequest(url); - preflightRequest.setHTTPMethod("OPTIONS"); - preflightRequest.setHTTPHeaderField("Origin", origin); - preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", m_method); - - if (m_requestHeaders.size() > 0) { - Vector<UChar> headerBuffer; - HTTPHeaderMap::const_iterator it = m_requestHeaders.begin(); - append(headerBuffer, it->first); - ++it; - - HTTPHeaderMap::const_iterator end = m_requestHeaders.end(); - for (; it != end; ++it) { - headerBuffer.append(','); - headerBuffer.append(' '); - append(headerBuffer, it->first); - } - - preflightRequest.setHTTPHeaderField("Access-Control-Request-Headers", String::adopt(headerBuffer)); - preflightRequest.addHTTPHeaderFields(m_requestHeaders); - } - - if (m_async) { - m_uploadEventsAllowed = true; - loadRequestAsynchronously(preflightRequest); - return; - } - - loadRequestSynchronously(preflightRequest, ec); - m_inPreflight = false; - - if (ec) - return; - } - - // Send the actual request. - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPHeaderField("Origin", origin); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } + m_exceptionCode = 0; + m_error = false; if (m_async) { - m_uploadEventsAllowed = true; - loadRequestAsynchronously(request); - return; - } - - loadRequestSynchronously(request, ec); -} - -void XMLHttpRequest::handleAsynchronousPreflightResult() -{ - ASSERT(m_inPreflight); - ASSERT(m_async); - - m_inPreflight = false; - - KURL url = m_url; - url.setUser(String()); - url.setPass(String()); - - ResourceRequest request(url); - request.setHTTPMethod(m_method); - request.setAllowHTTPCookies(m_includeCredentials); - request.setHTTPOrigin(scriptExecutionContext()->securityOrigin()->toString()); - - if (m_requestHeaders.size() > 0) - request.addHTTPHeaderFields(m_requestHeaders); - - if (m_requestEntityBody) { - ASSERT(m_method != "GET"); - ASSERT(m_method != "HEAD"); - request.setHTTPBody(m_requestEntityBody.release()); - } - - m_uploadEventsAllowed = true; - loadRequestAsynchronously(request); -} - -void XMLHttpRequest::loadRequestSynchronously(ResourceRequest& request, ExceptionCode& ec) -{ - ASSERT(!m_async); - - m_loader = 0; - m_exceptionCode = 0; - StoredCredentials storedCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; + request.setReportUploadProgress(true); + setPendingActivity(this); + m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); + } else + ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options); - ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, storedCredentials); if (!m_exceptionCode && m_error) m_exceptionCode = XMLHttpRequestException::NETWORK_ERR; ec = m_exceptionCode; } -void XMLHttpRequest::loadRequestAsynchronously(ResourceRequest& request) -{ - ASSERT(m_async); - m_exceptionCode = 0; - // SubresourceLoader::create can return null here, for example if we're no longer attached to a page. - // This is true while running onunload handlers. - // FIXME: We need to be able to send XMLHttpRequests from onunload, <http://bugs.webkit.org/show_bug.cgi?id=10904>. - // FIXME: Maybe create can return null for other reasons too? - LoadCallbacks callbacks = m_inPreflight ? DoNotSendLoadCallbacks : SendLoadCallbacks; - StoredCredentials storedCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; - - if (m_upload) - request.setReportUploadProgress(true); - - m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, callbacks, DoNotSniffContent, storedCredentials, DenyCrossOriginRedirect); - - if (m_loader) { - // Neither this object nor the JavaScript wrapper should be deleted while - // a request is in progress because we need to keep the listeners alive, - // and they are referenced by the JavaScript wrapper. - setPendingActivity(this); - - // For now we should only balance the nonCached request count for main-thread XHRs and not - // Worker XHRs, as the Cache is not thread-safe. - // This will become irrelevant after https://bugs.webkit.org/show_bug.cgi?id=27165 is resolved. - if (!scriptExecutionContext()->isWorkerContext()) { - ASSERT(isMainThread()); - ASSERT(!m_didTellLoaderAboutRequest); - cache()->loader()->nonCacheRequestInFlight(m_url); - m_didTellLoaderAboutRequest = true; - } - } -} - void XMLHttpRequest::abort() { // internalAbort() calls dropProtection(), which may release the last reference. @@ -711,7 +525,7 @@ void XMLHttpRequest::abort() // Clear headers as required by the spec m_requestHeaders.clear(); - + if ((m_state <= OPENED && !sendFlag) || m_state == DONE) m_state = UNSENT; else { @@ -794,7 +608,7 @@ void XMLHttpRequest::abortError() } } -void XMLHttpRequest::dropProtection() +void XMLHttpRequest::dropProtection() { #if USE(JSC) // The XHR object itself holds on to the responseText, and @@ -854,7 +668,7 @@ void XMLHttpRequest::setRequestHeader(const AtomicString& name, const String& va void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const String& value) { - pair<HTTPHeaderMap::iterator, bool> result = m_requestHeaders.add(name, value); + pair<HTTPHeaderMap::iterator, bool> result = m_requestHeaders.add(name, value); if (!result.second) result.first->second += ", " + value; } @@ -939,7 +753,7 @@ String XMLHttpRequest::responseMIMEType() const } if (mimeType.isEmpty()) mimeType = "text/xml"; - + return mimeType; } @@ -981,7 +795,7 @@ void XMLHttpRequest::didFail(const ResourceError& error) cache()->loader()->nonCacheRequestComplete(m_url); m_didTellLoaderAboutRequest = false; } - + // If we are already in an error state, for instance we called abort(), bail out early. if (m_error) return; @@ -1011,11 +825,6 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) if (m_error) return; - if (m_inPreflight) { - didFinishLoadingPreflight(); - return; - } - if (m_state < HEADERS_RECEIVED) changeState(HEADERS_RECEIVED); @@ -1035,19 +844,6 @@ void XMLHttpRequest::didFinishLoading(unsigned long identifier) dropProtection(); } -void XMLHttpRequest::didFinishLoadingPreflight() -{ - ASSERT(m_inPreflight); - ASSERT(!m_sameOriginRequest); - - // FIXME: this can probably be moved to didReceiveResponsePreflight. - if (m_async) - handleAsynchronousPreflightResult(); - - if (m_loader) - unsetPendingActivity(this); -} - void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { if (!m_upload) @@ -1065,45 +861,12 @@ void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long lon void XMLHttpRequest::didReceiveResponse(const ResourceResponse& response) { - if (m_inPreflight) { - didReceiveResponsePreflight(response); - return; - } - - if (!m_sameOriginRequest) { - if (!passesAccessControlCheck(response, m_includeCredentials, scriptExecutionContext()->securityOrigin())) { - networkError(); - return; - } - } - m_response = response; m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride); if (m_responseEncoding.isEmpty()) m_responseEncoding = response.textEncodingName(); } -void XMLHttpRequest::didReceiveResponsePreflight(const ResourceResponse& response) -{ - ASSERT(m_inPreflight); - ASSERT(!m_sameOriginRequest); - - if (!passesAccessControlCheck(response, m_includeCredentials, scriptExecutionContext()->securityOrigin())) { - networkError(); - return; - } - - OwnPtr<CrossOriginPreflightResultCacheItem> preflightResult(new CrossOriginPreflightResultCacheItem(m_includeCredentials)); - if (!preflightResult->parse(response) - || !preflightResult->allowsCrossOriginMethod(m_method) - || !preflightResult->allowsCrossOriginHeaders(m_requestHeaders)) { - networkError(); - return; - } - - CrossOriginPreflightResultCache::shared().appendEntry(scriptExecutionContext()->securityOrigin()->toString(), m_url, preflightResult.release()); -} - void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse& failureResponse) { m_response = failureResponse; @@ -1111,12 +874,12 @@ void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse void XMLHttpRequest::didReceiveData(const char* data, int len) { - if (m_inPreflight || m_error) + if (m_error) return; if (m_state < HEADERS_RECEIVED) changeState(HEADERS_RECEIVED); - + if (!m_decoder) { if (!m_responseEncoding.isEmpty()) m_decoder = TextResourceDecoder::create("text/plain", m_responseEncoding); @@ -1210,7 +973,7 @@ void XMLHttpRequest::dispatchLoadStartEvent() void XMLHttpRequest::dispatchProgressEvent(long long expectedLength) { - dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, + dispatchXMLHttpRequestProgressEvent(m_onProgressListener.get(), eventNames().progressEvent, expectedLength && m_receivedLength <= expectedLength, static_cast<unsigned>(m_receivedLength), static_cast<unsigned>(expectedLength)); } @@ -1235,4 +998,4 @@ ScriptExecutionContext* XMLHttpRequest::scriptExecutionContext() const return ActiveDOMObject::scriptExecutionContext(); } -} // namespace WebCore +} // namespace WebCore diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index d581d3d..aa33b8b 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -117,7 +117,7 @@ public: private: XMLHttpRequest(ScriptExecutionContext*); - + virtual void refEventTarget() { ref(); } virtual void derefEventTarget() { deref(); } @@ -135,10 +135,6 @@ private: virtual void didFailRedirectCheck(); virtual void didReceiveAuthenticationCancellation(const ResourceResponse&); - // Special versions for the preflight - void didReceiveResponsePreflight(const ResourceResponse&); - void didFinishLoadingPreflight(); - void updateAndDispatchOnProgress(unsigned int len); String responseMIMEType() const; @@ -159,16 +155,6 @@ private: void createRequest(ExceptionCode&); - void makeSameOriginRequest(ExceptionCode&); - void makeCrossOriginAccessRequest(ExceptionCode&); - - void makeSimpleCrossOriginAccessRequest(ExceptionCode&); - void makeCrossOriginAccessRequestWithPreflight(ExceptionCode&); - void handleAsynchronousPreflightResult(); - - void loadRequestSynchronously(ResourceRequest&, ExceptionCode&); - void loadRequestAsynchronously(ResourceRequest&); - void genericError(); void networkError(); void abortError(); @@ -223,13 +209,11 @@ private: bool m_uploadComplete; bool m_sameOriginRequest; - bool m_allowAccess; - bool m_inPreflight; bool m_didTellLoaderAboutRequest; // Used for onprogress tracking long long m_receivedLength; - + unsigned m_lastSendLineNumber; String m_lastSendURL; ExceptionCode m_exceptionCode; diff --git a/WebCore/xml/XPathNamespace.cpp b/WebCore/xml/XPathNamespace.cpp index 3c8c42c..9646402 100644 --- a/WebCore/xml/XPathNamespace.cpp +++ b/WebCore/xml/XPathNamespace.cpp @@ -1,6 +1,6 @@ /* * Copyright 2005 Frerich Raabe <raabe@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -33,18 +33,14 @@ namespace WebCore { -XPathNamespace::XPathNamespace(PassRefPtr<Element> ownerElement, const String& prefix, const String& uri) - : Node(ownerElement->document()) +XPathNamespace::XPathNamespace(PassRefPtr<Element> ownerElement, const AtomicString& prefix, const AtomicString& uri) + : Node(ownerElement->document(), CreateOther) , m_ownerElement(ownerElement) , m_prefix(prefix) , m_uri(uri) { } -XPathNamespace::~XPathNamespace() -{ -} - Document* XPathNamespace::ownerDocument() const { return m_ownerElement->ownerDocument(); diff --git a/WebCore/xml/XPathNamespace.h b/WebCore/xml/XPathNamespace.h index c0e4280..996cb9a 100644 --- a/WebCore/xml/XPathNamespace.h +++ b/WebCore/xml/XPathNamespace.h @@ -1,6 +1,6 @@ /* * Copyright 2005 Frerich Raabe <raabe@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. + * Copyright (C) 2006, 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 @@ -34,13 +34,11 @@ namespace WebCore { - class Document; - class Element; + // FIXME: This class is never instantiated. Maybe it should be removed. class XPathNamespace : public Node { - public: - XPathNamespace(PassRefPtr<Element> ownerElement, const String& prefix, const String& uri); - virtual ~XPathNamespace(); + private: + XPathNamespace(PassRefPtr<Element> ownerElement, const AtomicString& prefix, const AtomicString& uri); virtual Document* ownerDocument() const; virtual Element* ownerElement() const; @@ -50,9 +48,8 @@ namespace WebCore { virtual String nodeValue() const; virtual const AtomicString& namespaceURI() const; - virtual Node::NodeType nodeType() const; + virtual NodeType nodeType() const; - private: RefPtr<Element> m_ownerElement; AtomicString m_prefix; AtomicString m_uri; diff --git a/WebCore/xml/XSLTProcessor.cpp b/WebCore/xml/XSLTProcessor.cpp index a26fe77..9fdf31f 100644 --- a/WebCore/xml/XSLTProcessor.cpp +++ b/WebCore/xml/XSLTProcessor.cpp @@ -285,12 +285,12 @@ PassRefPtr<Document> XSLTProcessor::createDocumentFromSource(const String& sourc static inline RefPtr<DocumentFragment> createFragmentFromSource(const String& sourceString, const String& sourceMIMEType, Document* outputDoc) { - RefPtr<DocumentFragment> fragment = new DocumentFragment(outputDoc); + RefPtr<DocumentFragment> fragment = DocumentFragment::create(outputDoc); if (sourceMIMEType == "text/html") parseHTMLDocumentFragment(sourceString, fragment.get()); else if (sourceMIMEType == "text/plain") - fragment->addChild(new Text(outputDoc, sourceString)); + fragment->addChild(Text::create(outputDoc, sourceString)); else { bool successfulParse = parseXMLDocumentFragment(sourceString, fragment.get(), outputDoc->documentElement()); if (!successfulParse) diff --git a/WebKitTools/Scripts/make-js-test-wrappers b/WebKitTools/Scripts/make-js-test-wrappers deleted file mode 100755 index a030d3b..0000000 --- a/WebKitTools/Scripts/make-js-test-wrappers +++ /dev/null @@ -1,175 +0,0 @@ -#!/usr/bin/perl -w - -# Copyright (C) 2006, 2007, 2008 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. - -# Script to generate HTML wrappers for JavaScript tests from templates - -use strict; - -use FindBin; -use lib $FindBin::Bin; - -use File::Basename; -use File::Find; -use Getopt::Long; -use webkitdirs; - -sub directoryFilter; -sub findTemplateFiles(@); - -my $showHelp; - -my $result = GetOptions( - "help" => \$showHelp, -); - -if (!$result || $showHelp) { - print STDERR basename($0) . " [-h|--help] [path ...]\n"; - exit 1; -} - -setConfiguration(); -my $productDir = productDir(); - -chdirWebKit(); - -my @templates = findTemplateFiles(@ARGV); - -for my $tfile (@templates) { - - my $tpath = $tfile; - $tpath =~ s:/resources/TEMPLATE.html$::; - - print "${tpath}\n"; - - chdirWebKit(); - chdir($tpath); - - my @files; - my $fileFilter = sub { - push @files, $File::Find::name if substr($_, -3) eq ".js"; - }; - find({ preprocess => \&directoryFilter, wanted => $fileFilter }, "resources"); - - open TEMPLATE, "<resources/TEMPLATE.html"; - my $template = do { local $/; <TEMPLATE> }; - close TEMPLATE; - - my $templateNegative = $template; - if (-e "resources/TEMPLATE-n.html") { - open TEMPLATE, "<resources/TEMPLATE-n.html"; - $templateNegative = do { local $/; <TEMPLATE> }; - close TEMPLATE; - } - - for my $file (@files) { - next if $file =~ /js-test-.*\.js$/; - next if $file =~ /cookies-test-(post|pre)\.js$/; - next if $file =~ /standalone-.*\.js$/; - next if $file =~ /SVGTestCase\.js/; - next if $file =~ /WMLTestCase\.js/; - - next if $file =~ m:resources/bom-in-file-retains-correct-offset\.js$:; # has a custom template - next if $file =~ m:resources/NSResolver-exceptions\.js$:; - next if $file =~ m:resources/WindowProperties\.js$:; - next if $file =~ m:resources/altGlyph-dom\.js$:; - next if $file =~ m:resources/attr-case-sensitivity\.js$:; - next if $file =~ m:resources/box-shadow-overflow-scroll\.js$:; - next if $file =~ m:resources/codegen-temporaries-multiple-global-blocks-1\.js$:; - next if $file =~ m:resources/codegen-temporaries-multiple-global-blocks-2\.js$:; - next if $file =~ m:resources/constructors-cached-navigate\.js$:; - next if $file =~ m:resources/frame-loading-via-document-write\.js$:; - next if $file =~ m:resources/id-fastpath-almost-strict\.js$:; - next if $file =~ m:resources/id-fastpath-strict\.js$:; - next if $file =~ m:resources/intersectsNode\.js$:; - next if $file =~ m:resources/p-in-scope\.js$:; - next if $file =~ m:resources/paste-blockquote-before-blockquote\.js$:; - next if $file =~ m:resources/reflection-overflow-scroll\.js$:; - next if $file =~ m:resources/script-element-gc\.js$:; - next if $file =~ m:resources/script-element-gc\.js$:; - next if $file =~ m:resources/script3\.js$:; - next if $file =~ m:resources/script4\.js$:; - next if $file =~ m:resources/script5\.js$:; - next if $file =~ m:resources/scripted-random\.js$:; - next if $file =~ m:resources/select-options-remove\.js$:; - next if $file =~ m:resources/shadow-offset\.js$:; - next if $file =~ m:resources/tabindex-focus-blur-all\.js$:; - next if $file =~ m:resources/use-instanceRoot-event-bubbling\.js$:; - next if $file =~ m:resources/use-instanceRoot-event-listeners\.js$:; - next if $file =~ m:resources/window-properties\.js$:; - next if $file =~ m:resources/wrapper-identity-base\.js$:; - next if $file =~ m:resources/xhtml-scripts\.js$:; - next if $file =~ m:resources/instanceof-operator-dummy-worker\.js$:; - next if $file =~ m:resources/json2-es5-compat\.js$:; - next if $file =~ m:resources/JSON-stringify\.js$:; - next if $file =~ m:resources/JSON-parse\.js$:; - next if $file =~ m:resources/textarea-input-event\.js$:; - - my $html = $file; - $html =~ s:resources/(.*)\.js:$1.html:; - next if -f "$html-disabled"; - - system("grep -q 'successfullyParsed =' $file"); - if ($? != 0) { - `echo "" >> "${file}"`; - `echo "var successfullyParsed = true;" >> "${file}"`; - } - - print " ${html}\n"; - open HTML, ">$html"; - my $output = ($file =~ /-n\.js/) ? $templateNegative : $template; - $output =~ s:YOUR_JS_FILE_HERE:$file:; - print HTML $output; - - close HTML; - } -} - -exit 0; - -sub directoryFilter -{ - return () if basename($File::Find::dir) eq ".svn"; - return @_; -} - -sub findTemplateFiles(@) { - my @args = @_; - my @templateFiles; - - push @args, "LayoutTests" if scalar(@args) == 0; - - my @paths = map { -f $_ ? dirname($_) : $_ } @args; - - my $fileFilter = sub { - push @templateFiles, $File::Find::name if $_ eq "TEMPLATE.html"; - }; - - find({ preprocess => \&directoryFilter, wanted => $fileFilter }, @paths); - - return @templateFiles; -} diff --git a/WebKitTools/Scripts/modules/commiters_unittest.py b/WebKitTools/Scripts/modules/commiters_unittest.py deleted file mode 100644 index d221c8b..0000000 --- a/WebKitTools/Scripts/modules/commiters_unittest.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2009 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest -from committers import CommitterList, Committer, Reviewer - -class CommittersTest(unittest.TestCase): - - def test_committer_lookup(self): - committer = Committer('Test One', 'one@test.com') - reviewer = Reviewer('Test Two', 'two@test.com') - committer_list = CommitterList(committers=[committer], reviewers=[reviewer]) - - # Test valid committer and reviewer lookup - self.assertEqual(committer_list.committer_by_bugzilla_email('one@test.com'), committer) - self.assertEqual(committer_list.reviewer_by_bugzilla_email('two@test.com'), reviewer) - self.assertEqual(committer_list.committer_by_bugzilla_email('two@test.com'), reviewer) - - # Test that a known committer is not returned during reviewer lookup - self.assertRaises(Exception, committer_list.reviewer_by_bugzilla_email, 'one@test.com') - - # Test that unknown email address fail both committer and reviewer lookup - self.assertRaises(Exception, committer_list.committer_by_bugzilla_email, 'bar@bar.com') - self.assertRaises(Exception, committer_list.reviewer_by_bugzilla_email, 'bar@bar.com') - -if __name__ == '__main__': - unittest.main() |