diff options
Diffstat (limited to 'Source')
1549 files changed, 38160 insertions, 16467 deletions
diff --git a/Source/JavaScriptCore/CMakeLists.txt b/Source/JavaScriptCore/CMakeLists.txt index a620c5a52..eaa395e15 100644 --- a/Source/JavaScriptCore/CMakeLists.txt +++ b/Source/JavaScriptCore/CMakeLists.txt @@ -80,6 +80,7 @@ SET(JavaScriptCore_SOURCES heap/HandleHeap.cpp heap/HandleStack.cpp heap/MachineStackMarker.cpp + heap/MarkedAllocator.cpp heap/MarkedBlock.cpp heap/MarkedSpace.cpp heap/ConservativeRoots.cpp diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 1f53cd789..bbef23628 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,783 @@ +2012-02-08 Oliver Hunt <oliver@apple.com> + + Whoops, fix the build. + + * runtime/Executable.cpp: + (JSC::FunctionExecutable::FunctionExecutable): + +2012-02-08 Oliver Hunt <oliver@apple.com> + + Fix issue encountered while debugging stacktraces + https://bugs.webkit.org/show_bug.cgi?id=78147 + + Reviewed by Gavin Barraclough. + + Debugging is easier if we always ensure that we have a non-null + inferred name. + + * runtime/Executable.cpp: + (JSC::FunctionExecutable::FunctionExecutable): + +2012-02-08 Oliver Hunt <oliver@apple.com> + + updateTopCallframe in the baseline JIT doesn't provide enough information to the stubs + https://bugs.webkit.org/show_bug.cgi?id=78145 + + Reviewed by Gavin Barraclough. + + Fix the updateTopCallFrame helper to store additional information + that becomes necessary when we are trying to provide more stack + frame information. + + * interpreter/CallFrame.h: + (JSC::ExecState::bytecodeOffsetForBaselineJIT): + (ExecState): + * jit/JIT.cpp: + (JSC::JIT::privateCompile): + * jit/JIT.h: + (JSC::JIT::compileGetByIdProto): + (JSC::JIT::compileGetByIdSelfList): + (JSC::JIT::compileGetByIdProtoList): + (JSC::JIT::compileGetByIdChainList): + (JSC::JIT::compileGetByIdChain): + (JSC::JIT::compilePutByIdTransition): + (JIT): + * jit/JITInlineMethods.h: + (JSC::JIT::updateTopCallFrame): + +2012-02-07 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Remove the enable marcro for the no longer necessary Chromium + gesture recognizer. + https://bugs.webkit.org/show_bug.cgi?id=77492 + + Reviewed by Adam Barth. + + * wtf/Platform.h: + +2012-02-07 Tony Chang <tony@chromium.org> + + merge DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in + https://bugs.webkit.org/show_bug.cgi?id=78036 + + Reviewed by Darin Adler. + + * Configurations/FeatureDefines.xcconfig: Add ENABLE_DASHBOARD_SUPPORT to FEATURE_DEFINES. + +2012-02-07 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE] Use *bin* and *lib* directories for executable and libraries. + https://bugs.webkit.org/show_bug.cgi?id=77928 + + Reviewed by Daniel Bates. + + CMake has used *Programs* directory for executable. In addition, shared libraries are being + built in source directory. It is better to set common places in order to maintain executable + and libraries. *bin* is for executable and *lib* is for library. + + * shell/CMakeLists.txt: Change *Programs* with *bin*. + +2012-02-07 Gavin Barraclough <barraclough@apple.com> + + Crash on http://www.rickshawbags.com/ + https://bugs.webkit.org/show_bug.cgi?id=78045 + + Reviewed by Darin Adler. + + Problem URL is: http://www.rickshawbags.com/customize/custom-bag#!thl=rickshaw/bag() + + This is a bug introduced by https://bugs.webkit.org/show_bug.cgi?id=71933, + isVariableObject() checks were excluding StaticScopeObjects, this patch + inadvertently changed them to be included. + + * runtime/JSType.h: + - sort JSType enum such that StaticScopeObjectType comes before VariableObjectType, + and thus is excluded from isVariableObject() checks. + +2012-02-06 Jer Noble <jer.noble@apple.com> + + Use CMClock as a timing source for PlatformClock where available. + https://bugs.webkit.org/show_bug.cgi?id=77885 + + Reviewed by Eric Carlson. + + * wtf/Platform.h: Added WTF_USE_COREMEDIA. + +2012-02-06 Filip Pizlo <fpizlo@apple.com> + + ValueToNumber and ValueToDouble nodes don't do anything and should be removed + https://bugs.webkit.org/show_bug.cgi?id=77855 + <rdar://problem/10811325> + + Reviewed by Gavin Barraclough. + + Removed ValueToNumber and ValueToDouble, because the only thing they were doing + was wasting registers. + + This looks like a 1% win on V8 (with a 5% win on crypto) and a 2-3% win on Kraken, + mostly due to a >10% win on gaussian-blur. No win anywhere else. + + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::getToInt32): + (ByteCodeParser): + (JSC::DFG::ByteCodeParser::handleMinMax): + (JSC::DFG::ByteCodeParser::handleIntrinsic): + (JSC::DFG::ByteCodeParser::parseBlock): + * dfg/DFGNode.h: + (DFG): + (JSC::DFG::Node::hasArithNodeFlags): + * dfg/DFGPropagator.cpp: + (JSC::DFG::Propagator::propagateArithNodeFlags): + (JSC::DFG::Propagator::propagateNodePredictions): + (JSC::DFG::Propagator::vote): + (JSC::DFG::Propagator::doRoundOfDoubleVoting): + (Propagator): + (JSC::DFG::Propagator::fixupNode): + (JSC::DFG::Propagator::canonicalize): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-02-06 Patrick Gansterer <paroga@webkit.org> + + Unreviewed WinCE build fix after r106197. + + * tools/CodeProfiling.cpp: + (JSC::CodeProfiling::notifyAllocator): getenv() isn't supported by WinCE. Don't call it. + +2012-02-05 Gavin Barraclough <barraclough@apple.com> + + Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter + https://bugs.webkit.org/show_bug.cgi?id=77451 + + Reviewed by Sam Weinig. + + These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. + Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. + + * JavaScriptCore.exp: + * debugger/DebuggerActivation.cpp: + (JSC::DebuggerActivation::defineOwnProperty): + * debugger/DebuggerActivation.h: + (DebuggerActivation): + * runtime/ClassInfo.h: + (MethodTable): + (JSC): + * runtime/JSBoundFunction.cpp: + (JSC::JSBoundFunction::finishCreation): + * runtime/JSCell.cpp: + (JSC): + * runtime/JSCell.h: + (JSCell): + * runtime/JSFunction.cpp: + (JSC::JSFunction::getOwnPropertySlot): + (JSC::JSFunction::getOwnPropertyDescriptor): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::defineOwnProperty): + (JSC): + * runtime/JSGlobalObject.h: + (JSGlobalObject): + * runtime/JSObject.cpp: + (JSC): + * runtime/JSObject.h: + (JSObject): + * runtime/ObjectPrototype.cpp: + (JSC::objectProtoFuncDefineGetter): + (JSC::objectProtoFuncDefineSetter): + (JSC::objectProtoFuncLookupGetter): + (JSC::objectProtoFuncLookupSetter): + +2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix make distcheck. + + * GNUmakefile.list.am: Add missing files. + +2012-02-05 Filip Pizlo <fpizlo@apple.com> + + DFG's child references from one node to another should have room for type information + https://bugs.webkit.org/show_bug.cgi?id=77797 + + Reviewed by Oliver Hunt. + + The DFG::Node::child fields now contain both a DFG::NodeIndex (which is just an unsigned) + and a DFG::UseKind (which is currently an effectively empty enum). They are encapsulated + together as a DFG::NodeUse, which can in most cases still be used as an index (for + example DFG::Graph, AbstractState, and SpeculativeJIT all accept NodeUse in most places + where they really want a NodeIndex). + + The NodeUse stores both the index and the UseKind without bloating the memory usage of + DFG::Node, since we really don't need full 32 bits for the NodeIndex (a DFG::Node is + roughly 11 words, so if we assume that we never want to use more than 1GB to DFG compile + something - likely a sensible assumption! - then we will only be able to have room for + about 24 million nodes, which means we only need about 24.5 bits for the node index). + Currently the DFG::NodeUse allocates 4 bits for the UseKind and 28 bits for the index, + but stores the index as a signed number to make NoNode work naturally. Hence we really + just have 27 bits for the index. + + This is performance-neutral on all benchmarks we track. + + * JavaScriptCore.xcodeproj/project.pbxproj: + * dfg/DFGAbstractState.h: + (JSC::DFG::AbstractState::forNode): + (AbstractState): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::getLocal): + (JSC::DFG::ByteCodeParser::getArgument): + (JSC::DFG::ByteCodeParser::toInt32): + (JSC::DFG::ByteCodeParser::addVarArgChild): + (JSC::DFG::ByteCodeParser::processPhiStack): + * dfg/DFGCommon.h: + * dfg/DFGGraph.cpp: + (JSC::DFG::Graph::dump): + (DFG): + * dfg/DFGGraph.h: + (Graph): + (JSC::DFG::Graph::operator[]): + (JSC::DFG::Graph::at): + (JSC::DFG::Graph::ref): + (JSC::DFG::Graph::deref): + (JSC::DFG::Graph::clearAndDerefChild1): + (JSC::DFG::Graph::clearAndDerefChild2): + (JSC::DFG::Graph::clearAndDerefChild3): + * dfg/DFGJITCompiler.h: + (JSC::DFG::JITCompiler::getPrediction): + * dfg/DFGNode.h: + (JSC::DFG::Node::Node): + (JSC::DFG::Node::child1): + (JSC::DFG::Node::child1Unchecked): + (JSC::DFG::Node::child2): + (JSC::DFG::Node::child3): + (JSC::DFG::Node::firstChild): + (JSC::DFG::Node::numChildren): + (JSC::DFG::Node::dumpChildren): + (Node): + * dfg/DFGNodeReferenceBlob.h: Added. + (DFG): + (NodeReferenceBlob): + (JSC::DFG::NodeReferenceBlob::NodeReferenceBlob): + (JSC::DFG::NodeReferenceBlob::child): + (JSC::DFG::NodeReferenceBlob::child1): + (JSC::DFG::NodeReferenceBlob::child2): + (JSC::DFG::NodeReferenceBlob::child3): + (JSC::DFG::NodeReferenceBlob::child1Unchecked): + (JSC::DFG::NodeReferenceBlob::initialize): + (JSC::DFG::NodeReferenceBlob::firstChild): + (JSC::DFG::NodeReferenceBlob::setFirstChild): + (JSC::DFG::NodeReferenceBlob::numChildren): + (JSC::DFG::NodeReferenceBlob::setNumChildren): + * dfg/DFGNodeUse.h: Added. + (DFG): + (NodeUse): + (JSC::DFG::NodeUse::NodeUse): + (JSC::DFG::NodeUse::indexUnchecked): + (JSC::DFG::NodeUse::index): + (JSC::DFG::NodeUse::setIndex): + (JSC::DFG::NodeUse::useKind): + (JSC::DFG::NodeUse::setUseKind): + (JSC::DFG::NodeUse::isSet): + (JSC::DFG::NodeUse::operator!): + (JSC::DFG::NodeUse::operator==): + (JSC::DFG::NodeUse::operator!=): + (JSC::DFG::NodeUse::shift): + (JSC::DFG::NodeUse::makeWord): + (JSC::DFG::operator==): + (JSC::DFG::operator!=): + * dfg/DFGPropagator.cpp: + (JSC::DFG::Propagator::propagateArithNodeFlags): + (JSC::DFG::Propagator::vote): + (JSC::DFG::Propagator::toDouble): + (JSC::DFG::Propagator::fixupNode): + (JSC::DFG::Propagator::canonicalize): + (JSC::DFG::Propagator::startIndex): + (JSC::DFG::Propagator::globalVarLoadElimination): + (JSC::DFG::Propagator::getByValLoadElimination): + (JSC::DFG::Propagator::getByOffsetLoadElimination): + (JSC::DFG::Propagator::performSubstitution): + (JSC::DFG::Propagator::performNodeCSE): + * dfg/DFGScoreBoard.h: + (JSC::DFG::ScoreBoard::use): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::useChildren): + (JSC::DFG::SpeculativeJIT::writeBarrier): + (JSC::DFG::SpeculativeJIT::nonSpeculativeStrictEq): + (JSC::DFG::SpeculativeJIT::compilePeepHoleObjectEquality): + (JSC::DFG::SpeculativeJIT::compilePeepHoleIntegerBranch): + (JSC::DFG::SpeculativeJIT::compileMovHint): + (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor): + (JSC::DFG::SpeculativeJIT::compilePutByValForByteArray): + (JSC::DFG::SpeculativeJIT::compilePutByValForIntTypedArray): + (JSC::DFG::SpeculativeJIT::compilePutByValForFloatTypedArray): + (JSC::DFG::SpeculativeJIT::compileSoftModulo): + (JSC::DFG::SpeculativeJIT::compileAdd): + (JSC::DFG::SpeculativeJIT::compileArithSub): + (JSC::DFG::SpeculativeJIT::compileStrictEqForConstant): + (JSC::DFG::SpeculativeJIT::compileStrictEq): + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::at): + (JSC::DFG::SpeculativeJIT::canReuse): + (JSC::DFG::SpeculativeJIT::use): + (SpeculativeJIT): + (JSC::DFG::SpeculativeJIT::detectPeepHoleBranch): + (JSC::DFG::SpeculativeJIT::speculationCheck): + (JSC::DFG::SpeculativeJIT::terminateSpeculativeExecution): + (JSC::DFG::IntegerOperand::IntegerOperand): + (JSC::DFG::DoubleOperand::DoubleOperand): + (JSC::DFG::JSValueOperand::JSValueOperand): + (JSC::DFG::StorageOperand::StorageOperand): + (JSC::DFG::SpeculateIntegerOperand::SpeculateIntegerOperand): + (JSC::DFG::SpeculateStrictInt32Operand::SpeculateStrictInt32Operand): + (JSC::DFG::SpeculateDoubleOperand::SpeculateDoubleOperand): + (JSC::DFG::SpeculateCellOperand::SpeculateCellOperand): + (JSC::DFG::SpeculateBooleanOperand::SpeculateBooleanOperand): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::nonSpeculativeValueToNumber): + (JSC::DFG::SpeculativeJIT::nonSpeculativeValueToInt32): + (JSC::DFG::SpeculativeJIT::cachedPutById): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq): + (JSC::DFG::SpeculativeJIT::emitCall): + (JSC::DFG::SpeculativeJIT::compileValueAdd): + (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): + (JSC::DFG::SpeculativeJIT::compileLogicalNot): + (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): + (JSC::DFG::SpeculativeJIT::emitBranch): + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::nonSpeculativeValueToNumber): + (JSC::DFG::SpeculativeJIT::nonSpeculativeValueToInt32): + (JSC::DFG::SpeculativeJIT::cachedPutById): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranchNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativeCompareNull): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeBranch): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare): + (JSC::DFG::SpeculativeJIT::nonSpeculativePeepholeStrictEq): + (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq): + (JSC::DFG::SpeculativeJIT::emitCall): + (JSC::DFG::SpeculativeJIT::compileObjectEquality): + (JSC::DFG::SpeculativeJIT::compileValueAdd): + (JSC::DFG::SpeculativeJIT::compileObjectOrOtherLogicalNot): + (JSC::DFG::SpeculativeJIT::compileLogicalNot): + (JSC::DFG::SpeculativeJIT::emitObjectOrOtherBranch): + (JSC::DFG::SpeculativeJIT::emitBranch): + (JSC::DFG::SpeculativeJIT::compile): + +2012-02-05 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE] Support javascriptcore test for EFL port. + https://bugs.webkit.org/show_bug.cgi?id=77425 + + Reviewed by Daniel Bates. + + Efl and WinCE as well as Blackberry port are now using Cmake as its build system + and they are share the make file to create jsc excutable. In order to run + "run-javascriptcore-tests", EFL port needs to change jsc installation configuration + with executable output directory(e.g. Programs). So, this patch change jsc installation + configuration only for EFL port. + + * shell/CMakeLists.txt: + +2012-02-04 Gavin Barraclough <barraclough@apple.com> + + Rubber stamped by Sam Weinig. + + * yarr/YarrPattern.cpp: + (JSC::Yarr::YarrPatternConstructor::quantifyAtom): + - Fix comment. + +2012-02-04 Kalev Lember <kalevlember@gmail.com> + + [GTK] CurrentTime: Reorder headers for win32 + https://bugs.webkit.org/show_bug.cgi?id=77808 + + Reviewed by Martin Robinson. + + In GTK+ win32 port, monotonicallyIncreasingTime() implementation is + based on g_get_monotonic_time(). Reorder headers to make sure glib.h + gets included even when the platform is win32. + + CurrentTime.cpp: In function 'double WTF::monotonicallyIncreasingTime()': + CurrentTime.cpp:321:53: error: 'g_get_monotonic_time' was not declared in this scope + CurrentTime.cpp:322:1: warning: control reaches end of non-void function [-Wreturn-type] + + * wtf/CurrentTime.cpp: + +2012-02-03 Anders Carlsson <andersca@apple.com> + + Prefix the typedef in WTF_MAKE_FAST_ALLOCATED with underscores + https://bugs.webkit.org/show_bug.cgi?id=77788 + + Reviewed by Andreas Kling. + + The current typedef name, 'ThisIsHereToForceASemicolonAfterThisMacro', shows up when trying to + code-complete 'this' in Xcode. Prefix the typedef with two underscores to stop this from happening. + + * wtf/FastAllocBase.h: + +2012-02-03 Rob Buis <rbuis@rim.com> + + Fix alignment warnings in ARMv7 + https://bugs.webkit.org/show_bug.cgi?id=55368 + + Reviewed by Filip Pizlo. + + Use reinterpret_cast_ptr and static_cast to get rid of alignment issues in ARMv7 code. + + * heap/HandleTypes.h: + (JSC::HandleTypes::getFromSlot): + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::specializedSweep): + * heap/MarkedBlock.h: + (JSC::MarkedBlock::forEachCell): + * runtime/WriteBarrier.h: + (JSC::WriteBarrierBase::get): + (JSC::WriteBarrierBase::unvalidatedGet): + +2012-02-03 Mark Hahnenberg <mhahnenberg@apple.com> + + Build fix + + Unreviewed build fix + + Forgot to add a couple files. + + * heap/MarkedAllocator.cpp: Added. + (JSC): + (JSC::MarkedAllocator::tryAllocateHelper): + (JSC::MarkedAllocator::tryAllocate): + (JSC::MarkedAllocator::allocateSlowCase): + (JSC::MarkedAllocator::allocateBlock): + (JSC::MarkedAllocator::addBlock): + (JSC::MarkedAllocator::removeBlock): + * heap/MarkedAllocator.h: Added. + (JSC): + (DFG): + (MarkedAllocator): + (JSC::MarkedAllocator::cellSize): + (JSC::MarkedAllocator::heap): + (JSC::MarkedAllocator::setHeap): + (JSC::MarkedAllocator::setCellSize): + (JSC::MarkedAllocator::setMarkedSpace): + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::allocate): + (JSC::MarkedAllocator::reset): + (JSC::MarkedAllocator::zapFreeList): + (JSC::MarkedAllocator::forEachBlock): + +2012-02-03 Mark Hahnenberg <mhahnenberg@apple.com> + + Refactor MarkedBlock::SizeClass into a separate class + https://bugs.webkit.org/show_bug.cgi?id=77600 + + Reviewed by Geoffrey Garen. + + We pulled SizeClass out into its own class, named MarkedAllocator, and gave it + the responsibility of allocating objects from the collection of MarkedBlocks + that it manages. Also limited the amount of coupling to internal data fields + from other places, although it's mostly unavoidable in the JIT code. + + Eventually MarkedAllocator will implement various policies to do with object + management, e.g. whether or not to run destructors on objects that it manages. + MarkedSpace will manage a collection of MarkedAllocators with varying policies, + as it does now but to a larger extent. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * Target.pri: + * dfg/DFGSpeculativeJIT.h: + (JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject): + * heap/Heap.cpp: + (JSC::Heap::collect): + (JSC::Heap::resetAllocators): + * heap/Heap.h: + (JSC::Heap::allocatorForObject): + (Heap): + * heap/MarkedAllocator.cpp: Added. + (JSC): + (JSC::MarkedAllocator::tryAllocateHelper): + (JSC::MarkedAllocator::tryAllocate): + (JSC::MarkedAllocator::allocateSlowCase): + (JSC::MarkedAllocator::allocateBlock): + (JSC::MarkedAllocator::addBlock): + (JSC::MarkedAllocator::removeBlock): + * heap/MarkedAllocator.h: Added. + (JSC): + (DFG): + (MarkedAllocator): + (JSC::MarkedAllocator::cellSize): + (JSC::MarkedAllocator::heap): + (JSC::MarkedAllocator::setHeap): + (JSC::MarkedAllocator::setCellSize): + (JSC::MarkedAllocator::setMarkedSpace): + (JSC::MarkedAllocator::MarkedAllocator): + (JSC::MarkedAllocator::allocate): + (JSC::MarkedAllocator::reset): + (JSC::MarkedAllocator::zapFreeList): + (JSC::MarkedAllocator::forEachBlock): + * heap/MarkedSpace.cpp: + (JSC::MarkedSpace::MarkedSpace): + (JSC::MarkedSpace::resetAllocators): + (JSC::MarkedSpace::canonicalizeCellLivenessData): + (JSC::TakeIfUnmarked::operator()): + * heap/MarkedSpace.h: + (MarkedSpace): + (JSC::MarkedSpace::allocatorFor): + (JSC::MarkedSpace::allocate): + (JSC::MarkedSpace::forEachBlock): + (JSC::MarkedSpace::didAddBlock): + (JSC::MarkedSpace::didConsumeFreeList): + * jit/JITInlineMethods.h: + (JSC::JIT::emitAllocateBasicJSObject): + +2012-02-03 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Replace GNU linker script for exports with export macros in WTF/JSC + https://bugs.webkit.org/show_bug.cgi?id=77723 + + Reviewed by Tor Arne Vestbø. + + * wtf/Platform.h: Enable use of export macros. + +2012-02-02 Hajime Morrita <morrita@chromium.org> + + Unreviewed, removing an unnecessarily JS_PRIVATE_EXPORT annotation. + + * interpreter/Interpreter.h: + (Interpreter): + +2012-01-31 Hajime Morrita <morrita@chromium.org> + + [Mac] eliminate JavaScriptCore.exp + https://bugs.webkit.org/show_bug.cgi?id=72854 + + Reviewed by Darin Adler. + + - Removed exp files and corresponding makefile entries. + - Changed the build configuration no to use exp file. + + * Configurations/JavaScriptCore.xcconfig: + * DerivedSources.make: + * JavaScriptCore.JSVALUE32_64only.exp: Removed. + * JavaScriptCore.JSVALUE64only.exp: Removed. + * JavaScriptCore.exp: Removed. + * JavaScriptCore.xcodeproj/project.pbxproj: + * wtf/Platform.h: + +2012-02-02 Benjamin Poulain <bpoulain@apple.com> + + Running a Web Worker on about:blank crashes the interpreter + https://bugs.webkit.org/show_bug.cgi?id=77593 + + Reviewed by Michael Saboff. + + The method Interpreter::execute() was crashing on empty programs because + the assumption is made the source is not null. + + This patch shortcut the execution when the String is null to avoid invalid + memory access. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::execute): + +2012-02-02 Kalev Lember <kalevlember@gmail.com> + + [GTK] Use win32 native threading + https://bugs.webkit.org/show_bug.cgi?id=77676 + + Reviewed by Martin Robinson. + + r97269 switched from glib threading to pthreads, breaking win32 GTK+. + This is a follow up, removing some leftovers in ThreadSpecific.h and + switching win32 to use the native threading in ThreadingWin.cpp. + + * GNUmakefile.list.am: Compile in win32 native threading support + * wtf/ThreadSpecific.h: Remove GTK+-specific definitions + (ThreadSpecific): + (WTF::::destroy): + +2012-02-02 Filip Pizlo <fpizlo@apple.com> + + retrieveCallerFromVMCode should call trueCallerFrame + https://bugs.webkit.org/show_bug.cgi?id=77684 + + Reviewed by Oliver Hunt. + + * interpreter/Interpreter.cpp: + (JSC::Interpreter::retrieveCallerFromVMCode): + +2012-02-02 Kalev Lember <kalevlember@gmail.com> + + [GTK] Implement current executable path finding for win32 + https://bugs.webkit.org/show_bug.cgi?id=77677 + + Reviewed by Martin Robinson. + + The WTF helper for getting the binary path that was added in r101710 + left out the win32 implementation. Fix this. + + * wtf/gobject/GlibUtilities.cpp: + (getCurrentExecutablePath): + +2012-02-02 Filip Pizlo <fpizlo@apple.com> + + Throwing away bytecode and then reparsing during DFG optimization is just + plain wrong and makes things crash + https://bugs.webkit.org/show_bug.cgi?id=77680 + <rdar://problem/10798490> + + Reviewed by Oliver Hunt. + + This is the minimal surgical fix: it removes the code that triggered bytecode + throw-away. Once we're confident that this is a good idea, we can kill all of + the code that implements the feature. + + * bytecode/CodeBlock.h: + (JSC::CodeBlock::discardBytecodeLater): + (JSC::CodeBlock::addValueProfile): + * jit/JITDriver.h: + (JSC::jitCompileIfAppropriate): + (JSC::jitCompileFunctionIfAppropriate): + +2012-02-02 Filip Pizlo <fpizlo@apple.com> + + Release build debugging should be easier + https://bugs.webkit.org/show_bug.cgi?id=77669 + + Reviewed by Gavin Barraclough. + + * assembler/ARMAssembler.h: + (ARMAssembler): + (JSC::ARMAssembler::debugOffset): + * assembler/ARMv7Assembler.h: + (ARMv7Assembler): + (JSC::ARMv7Assembler::debugOffset): + (ARMInstructionFormatter): + (JSC::ARMv7Assembler::ARMInstructionFormatter::debugOffset): + * assembler/AbstractMacroAssembler.h: + (AbstractMacroAssembler): + (JSC::AbstractMacroAssembler::debugOffset): + * assembler/AssemblerBuffer.h: + (AssemblerBuffer): + (JSC::AssemblerBuffer::debugOffset): + * assembler/LinkBuffer.h: + (LinkBuffer): + (JSC::LinkBuffer::debugSize): + * assembler/MIPSAssembler.h: + (MIPSAssembler): + (JSC::MIPSAssembler::debugOffset): + * assembler/X86Assembler.h: + (X86Assembler): + (JSC::X86Assembler::debugOffset): + (X86InstructionFormatter): + (JSC::X86Assembler::X86InstructionFormatter::debugOffset): + * bytecode/CodeBlock.cpp: + (JSC): + * bytecode/CodeBlock.h: + (CodeBlock): + * bytecode/CodeOrigin.h: + (CodeOrigin): + (JSC): + (JSC::CodeOrigin::inlineStack): + * bytecode/DFGExitProfile.h: + (JSC::DFG::exitKindToString): + * bytecode/DataFormat.h: + (JSC::dataFormatToString): + * bytecode/PredictedType.cpp: + (JSC): + (JSC::predictionToString): + * bytecode/PredictedType.h: + (JSC): + * bytecode/ValueRecovery.h: + (ValueRecovery): + (JSC::ValueRecovery::dump): + * bytecompiler/BytecodeGenerator.cpp: + (JSC): + (JSC::BytecodeGenerator::setDumpsGeneratedCode): + (JSC::BytecodeGenerator::dumpsGeneratedCode): + (JSC::BytecodeGenerator::generate): + * dfg/DFGAbstractValue.h: + (StructureAbstractValue): + (JSC::DFG::StructureAbstractValue::dump): + (AbstractValue): + (JSC::DFG::AbstractValue::dump): + * dfg/DFGAssemblyHelpers.h: + (DFG): + (AssemblyHelpers): + (JSC::DFG::AssemblyHelpers::debugCall): + * dfg/DFGFPRInfo.h: + (FPRInfo): + (JSC::DFG::FPRInfo::debugName): + * dfg/DFGGPRInfo.h: + (GPRInfo): + (JSC::DFG::GPRInfo::debugName): + * dfg/DFGGraph.cpp: + (DFG): + * dfg/DFGGraph.h: + (Graph): + * dfg/DFGNode.h: + (DFG): + (JSC::DFG::arithNodeFlagsAsString): + (Node): + (JSC::DFG::Node::hasIdentifier): + (JSC::DFG::Node::dumpChildren): + * dfg/DFGOSRExit.cpp: + (DFG): + (JSC::DFG::OSRExit::dump): + * dfg/DFGOSRExit.h: + (OSRExit): + * runtime/JSValue.cpp: + (JSC): + (JSC::JSValue::description): + * runtime/JSValue.h: + (JSValue): + * wtf/BitVector.cpp: + (WTF): + (WTF::BitVector::dump): + * wtf/BitVector.h: + (BitVector): + +2012-02-02 Oliver Hunt <oliver@apple.com> + + Getters and setters cause line numbers in errors/console.log to be offset for the whole file + https://bugs.webkit.org/show_bug.cgi?id=77675 + + Reviewed by Timothy Hatcher. + + Our default literal parsing logic doesn't handle the extra work required for + getters and setters. When it encounters one, it rolls back the lexer and + then switches to a more complete parsing function. Unfortunately it was only + winding back the character position, and was ignoring the line number and + other lexer data. This led to every getter and setter causing the line number + to be incorrectly incremented leading to increasingly incorrect numbers for + the rest of the file. + + * parser/Parser.cpp: + (JSC::::parseObjectLiteral): + +2012-02-02 Andy Wingo <wingo@igalia.com> + + Fix type punning warning in HashTable.h debug builds + https://bugs.webkit.org/show_bug.cgi?id=77422 + + Reviewed by Gavin Barraclough. + + * wtf/HashTable.h (WTF::HashTable::checkKey): Fix type punning + warning appearing in debug builds with gcc-4.6.2 on GNU/Linux. + 2012-02-01 Michael Saboff <msaboff@apple.com> Yarr crash with regexp replace diff --git a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig index 3846b27bf..6447eb7ee 100644 --- a/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig +++ b/Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig @@ -37,6 +37,8 @@ ENABLE_BLOB_macosx = ENABLE_BLOB; ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; +ENABLE_DASHBOARD_SUPPORT = ENABLE_DASHBOARD_SUPPORT; + ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); ENABLE_DATALIST_macosx = ENABLE_DATALIST; @@ -123,4 +125,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig index 827749871..d88b46e4e 100644 --- a/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig +++ b/Source/JavaScriptCore/Configurations/JavaScriptCore.xcconfig @@ -33,8 +33,9 @@ JSVALUE_MODEL_ppc = 32_64; JSVALUE_MODEL_ppc64 = 64; JSVALUE_MODEL_x86_64 = 64; -EXPORTED_SYMBOLS_FILE = $(BUILT_PRODUCTS_DIR)/DerivedSources/JavaScriptCore/JavaScriptCore.JSVALUE$(JSVALUE_MODEL).exp; -OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3; +// Prevent C++ standard library operator new, delete and their related exception types from being exported as weak symbols. +OTHER_LDFLAGS_HIDE_SYMBOLS = -Wl,-unexported_symbol -Wl,__ZTISt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTISt9exception -Wl,-unexported_symbol -Wl,__ZTSSt9bad_alloc -Wl,-unexported_symbol -Wl,__ZTSSt9exception -Wl,-unexported_symbol -Wl,__ZdlPvS_ -Wl,-unexported_symbol -Wl,__ZnwmPv; +OTHER_LDFLAGS_BASE = -lobjc -Wl,-Y,3 $(OTHER_LDFLAGS_HIDE_SYMBOLS); OTHER_LDFLAGS = $(OTHER_LDFLAGS_$(REAL_PLATFORM_NAME)); OTHER_LDFLAGS_iphoneos = $(OTHER_LDFLAGS_BASE); OTHER_LDFLAGS_iphonesimulator = $(OTHER_LDFLAGS_iphoneos); @@ -43,6 +44,7 @@ OTHER_LDFLAGS_macosx_1070 = -Xlinker -objc_gc_compaction; OTHER_LDFLAGS_macosx_1080 = $(OTHER_LDFLAGS_macosx_1070); OTHER_LDFLAGS_macosx_1090 = $(OTHER_LDFLAGS_macosx_1070); GCC_PREFIX_HEADER = JavaScriptCorePrefix.h; +GCC_SYMBOLS_PRIVATE_EXTERN = YES; HEADER_SEARCH_PATHS = "${BUILT_PRODUCTS_DIR}/DerivedSources/JavaScriptCore" $(HEADER_SEARCH_PATHS); INFOPLIST_FILE = Info.plist; INSTALL_PATH = $(JAVASCRIPTCORE_FRAMEWORKS_DIR); diff --git a/Source/JavaScriptCore/Configurations/Version.xcconfig b/Source/JavaScriptCore/Configurations/Version.xcconfig index 0510654ff..73fc62d56 100644 --- a/Source/JavaScriptCore/Configurations/Version.xcconfig +++ b/Source/JavaScriptCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 19; +MINOR_VERSION = 20; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/JavaScriptCore/DerivedSources.make b/Source/JavaScriptCore/DerivedSources.make index 80af4b6d5..90e099d18 100644 --- a/Source/JavaScriptCore/DerivedSources.make +++ b/Source/JavaScriptCore/DerivedSources.make @@ -43,8 +43,6 @@ all : \ ErrorPrototype.lut.h \ HeaderDetection.h \ JSONObject.lut.h \ - JavaScriptCore.JSVALUE32_64.exp \ - JavaScriptCore.JSVALUE64.exp \ JSGlobalObject.lut.h \ KeywordLookup.h \ Lexer.lut.h \ @@ -80,15 +78,6 @@ RegExpJitTables.h: create_regex_tables KeywordLookup.h: KeywordLookupGenerator.py Keywords.table python $^ > $@ -# export files - -JavaScriptCore.JSVALUE32_64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE32_64only.exp - cat $^ > $@ - -JavaScriptCore.JSVALUE64.exp: JavaScriptCore.exp JavaScriptCore.JSVALUE64only.exp - cat $^ > $@ - - # header detection ifeq ($(OS),MACOS) diff --git a/Source/JavaScriptCore/GNUmakefile.list.am b/Source/JavaScriptCore/GNUmakefile.list.am index de5338dd4..79c68326d 100644 --- a/Source/JavaScriptCore/GNUmakefile.list.am +++ b/Source/JavaScriptCore/GNUmakefile.list.am @@ -154,6 +154,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/dfg/DFGJITCompiler.cpp \ Source/JavaScriptCore/dfg/DFGJITCompiler.h \ Source/JavaScriptCore/dfg/DFGNode.h \ + Source/JavaScriptCore/dfg/DFGNodeReferenceBlob.h \ + Source/JavaScriptCore/dfg/DFGNodeUse.h \ Source/JavaScriptCore/dfg/DFGOperands.h \ Source/JavaScriptCore/dfg/DFGOperations.cpp \ Source/JavaScriptCore/dfg/DFGOperations.h \ @@ -205,6 +207,8 @@ javascriptcore_sources += \ Source/JavaScriptCore/heap/MarkStack.cpp \ Source/JavaScriptCore/heap/MarkStack.h \ Source/JavaScriptCore/heap/HeapRootVisitor.h \ + Source/JavaScriptCore/heap/MarkedAllocator.cpp \ + Source/JavaScriptCore/heap/MarkedAllocator.h \ Source/JavaScriptCore/heap/MarkedBlock.cpp \ Source/JavaScriptCore/heap/MarkedBlock.h \ Source/JavaScriptCore/heap/MarkedBlockSet.h \ @@ -756,7 +760,10 @@ javascriptcore_sources += \ if TARGET_WIN32 javascriptcore_sources += \ - Source/JavaScriptCore/wtf/OSAllocatorWin.cpp + Source/JavaScriptCore/wtf/OSAllocatorWin.cpp \ + Source/JavaScriptCore/wtf/ThreadFunctionInvocation.h \ + Source/JavaScriptCore/wtf/ThreadingWin.cpp \ + Source/JavaScriptCore/wtf/ThreadSpecificWin.cpp else javascriptcore_sources += \ Source/JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp \ diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp deleted file mode 100644 index 44680ce98..000000000 --- a/Source/JavaScriptCore/JavaScriptCore.JSVALUE32_64only.exp +++ /dev/null @@ -1 +0,0 @@ -__ZN3JSC10JSFunction6createEPNS_9ExecStateEPNS_14JSGlobalObjectEiRKNS_10IdentifierEPFxS2_ES9_ diff --git a/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp b/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp deleted file mode 100644 index aad7228ce..000000000 --- a/Source/JavaScriptCore/JavaScriptCore.JSVALUE64only.exp +++ /dev/null @@ -1 +0,0 @@ -__ZN3JSC10JSFunction6createEPNS_9ExecStateEPNS_14JSGlobalObjectEiRKNS_10IdentifierEPFPvS2_ESA_ diff --git a/Source/JavaScriptCore/JavaScriptCore.exp b/Source/JavaScriptCore/JavaScriptCore.exp deleted file mode 100644 index 51032d742..000000000 --- a/Source/JavaScriptCore/JavaScriptCore.exp +++ /dev/null @@ -1,634 +0,0 @@ -_JSCheckScriptSyntax -_JSClassCreate -_JSClassRelease -_JSClassRetain -_JSContextCreateBacktrace -_JSContextGetGlobalContext -_JSContextGetGlobalObject -_JSContextGetGroup -_JSContextGroupCreate -_JSContextGroupRelease -_JSContextGroupRetain -_JSEndProfiling -_JSEvaluateScript -_JSGarbageCollect -_JSGlobalContextCreate -_JSGlobalContextCreateInGroup -_JSGlobalContextRelease -_JSGlobalContextRetain -_JSObjectCallAsConstructor -_JSObjectCallAsFunction -_JSObjectCopyPropertyNames -_JSObjectDeletePrivateProperty -_JSObjectDeleteProperty -_JSObjectGetPrivate -_JSObjectGetPrivateProperty -_JSObjectGetProperty -_JSObjectGetPropertyAtIndex -_JSObjectGetPrototype -_JSObjectHasProperty -_JSObjectIsConstructor -_JSObjectIsFunction -_JSObjectMake -_JSObjectMakeArray -_JSObjectMakeConstructor -_JSObjectMakeDate -_JSObjectMakeError -_JSObjectMakeFunction -_JSObjectMakeFunctionWithCallback -_JSObjectMakeRegExp -_JSObjectSetPrivate -_JSObjectSetPrivateProperty -_JSObjectSetProperty -_JSObjectSetPropertyAtIndex -_JSObjectSetPrototype -_JSPropertyNameAccumulatorAddName -_JSPropertyNameArrayGetCount -_JSPropertyNameArrayGetNameAtIndex -_JSPropertyNameArrayRelease -_JSPropertyNameArrayRetain -_JSReportExtraMemoryCost -_JSStartProfiling -_JSStringCopyCFString -_JSStringCreateWithCFString -_JSStringCreateWithCharacters -_JSStringCreateWithUTF8CString -_JSStringGetCharactersPtr -_JSStringGetLength -_JSStringGetMaximumUTF8CStringSize -_JSStringGetUTF8CString -_JSStringIsEqual -_JSStringIsEqualToUTF8CString -_JSStringRelease -_JSStringRetain -_JSValueCreateJSONString -_JSValueGetType -_JSValueIsBoolean -_JSValueIsEqual -_JSValueIsInstanceOfConstructor -_JSValueIsNull -_JSValueIsNumber -_JSValueIsObject -_JSValueIsObjectOfClass -_JSValueIsStrictEqual -_JSValueIsString -_JSValueIsUndefined -_JSValueMakeBoolean -_JSValueMakeFromJSONString -_JSValueMakeNull -_JSValueMakeNumber -_JSValueMakeString -_JSValueMakeUndefined -_JSValueProtect -_JSValueToBoolean -_JSValueToNumber -_JSValueToObject -_JSValueToStringCopy -_JSValueUnprotect -_JSWeakObjectMapClear -_JSWeakObjectMapCreate -_JSWeakObjectMapGet -_JSWeakObjectMapRemove -_JSWeakObjectMapSet -_WTFGetBacktrace -_WTFInvokeCrashHook -_WTFLog -_WTFLogVerbose -_WTFReportArgumentAssertionFailure -_WTFReportAssertionFailure -_WTFReportAssertionFailureWithMessage -_WTFReportBacktrace -_WTFReportError -_WTFReportFatalError -_WTFSetCrashHook -__ZN14OpaqueJSString6createERKN3JSC7UStringE -__ZN3JSC10HandleHeap12writeBarrierEPNS_7JSValueERKS1_ -__ZN3JSC10HandleHeap4growEv -__ZN3JSC10Identifier11addSlowCaseEPNS_12JSGlobalDataEPN3WTF10StringImplE -__ZN3JSC10Identifier11addSlowCaseEPNS_9ExecStateEPN3WTF10StringImplE -__ZN3JSC10Identifier27checkCurrentIdentifierTableEPNS_12JSGlobalDataE -__ZN3JSC10Identifier27checkCurrentIdentifierTableEPNS_9ExecStateE -__ZN3JSC10Identifier3addEPNS_9ExecStateEPKc -__ZN3JSC10Identifier4fromEPNS_9ExecStateEi -__ZN3JSC10Identifier4fromEPNS_9ExecStateEj -__ZN3JSC10Identifier8toUInt32ERKNS_7UStringERb -__ZN3JSC10JSFunction11displayNameEPNS_9ExecStateE -__ZN3JSC10JSFunction21calculatedDisplayNameEPNS_9ExecStateE -__ZN3JSC10JSFunction4nameEPNS_9ExecStateE -__ZN3JSC10JSFunction6s_infoE -__ZN3JSC10JSFunctionC1EPNS_9ExecStateEPNS_14JSGlobalObjectEPNS_9StructureE -__ZN3JSC10throwErrorEPNS_9ExecStateENS_7JSValueE -__ZN3JSC10throwErrorEPNS_9ExecStateEPNS_8JSObjectE -__ZN3JSC11JSByteArray10putByIndexEPNS_6JSCellEPNS_9ExecStateEjNS_7JSValueE -__ZN3JSC11JSByteArray15createStructureERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueEPKNS_9ClassInfoE -__ZN3JSC11JSByteArray18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE -__ZN3JSC11JSByteArray19getOwnPropertyNamesEPNS_8JSObjectEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE -__ZN3JSC11JSByteArray24getOwnPropertyDescriptorEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE -__ZN3JSC11JSByteArray25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE -__ZN3JSC11JSByteArray3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE -__ZN3JSC11JSByteArray6s_infoE -__ZN3JSC11JSByteArray7destroyEPNS_6JSCellE -__ZN3JSC11JSByteArrayC1EPNS_9ExecStateEPNS_9StructureEPN3WTF9ByteArrayE -__ZN3JSC11MarkedSpace16allocateSlowCaseERNS0_9SizeClassE -__ZN3JSC11ParserArena5resetEv -__ZN3JSC11checkSyntaxEPNS_9ExecStateERKNS_10SourceCodeEPNS_7JSValueE -__ZN3JSC11createErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC11regExpFlagsERKNS_7UStringE -__ZN3JSC12DateInstance14finishCreationERNS_12JSGlobalDataEd -__ZN3JSC12DateInstance6s_infoE -__ZN3JSC12DateInstanceC1EPNS_9ExecStateEPNS_9StructureE -__ZN3JSC12JSGlobalData10ClientDataD2Ev -__ZN3JSC12JSGlobalData12createLeakedENS_15ThreadStackTypeENS_8HeapSizeE -__ZN3JSC12JSGlobalData12stopSamplingEv -__ZN3JSC12JSGlobalData13startSamplingEv -__ZN3JSC12JSGlobalData14dumpSampleDataEPNS_9ExecStateE -__ZN3JSC12JSGlobalData14resetDateCacheEv -__ZN3JSC12JSGlobalData14sharedInstanceEv -__ZN3JSC12JSGlobalData15dumpRegExpTraceEv -__ZN3JSC12JSGlobalData22clearBuiltinStructuresEv -__ZN3JSC12JSGlobalData23releaseExecutableMemoryEv -__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeENS_8HeapSizeE -__ZN3JSC12JSGlobalDataD1Ev -__ZN3JSC12JSGlobalThis13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE -__ZN3JSC12JSGlobalThis6s_infoE -__ZN3JSC12RegExpObject14finishCreationEPNS_14JSGlobalObjectE -__ZN3JSC12RegExpObject6s_infoE -__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEPNS_9StructureEPNS_6RegExpE -__ZN3JSC12SamplingTool5setupEv -__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE -__ZN3JSC12SmallStrings24singleCharacterStringRepEh -__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh -__ZN3JSC12StringObject14finishCreationERNS_12JSGlobalDataEPNS_8JSStringE -__ZN3JSC12StringObject6s_infoE -__ZN3JSC12StringObjectC2ERNS_12JSGlobalDataEPNS_9StructureE -__ZN3JSC13JSFinalObject6s_infoE -__ZN3JSC13SamplingFlags4stopEv -__ZN3JSC13SamplingFlags5startEv -__ZN3JSC13SamplingFlags7s_flagsE -__ZN3JSC13StatementNode6setLocEii -__ZN3JSC14ExecutableBase6s_infoE -__ZN3JSC14JSGlobalObject10globalExecEv -__ZN3JSC14JSGlobalObject12defineGetterEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierES2_j -__ZN3JSC14JSGlobalObject12defineSetterEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierES2_j -__ZN3JSC14JSGlobalObject13clearRareDataEPNS_6JSCellE -__ZN3JSC14JSGlobalObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE -__ZN3JSC14JSGlobalObject16addStaticGlobalsEPNS0_18GlobalPropertyInfoEi -__ZN3JSC14JSGlobalObject16putDirectVirtualEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj -__ZN3JSC14JSGlobalObject18getOwnPropertySlotEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE -__ZN3JSC14JSGlobalObject24getOwnPropertyDescriptorEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE -__ZN3JSC14JSGlobalObject25s_globalObjectMethodTableE -__ZN3JSC14JSGlobalObject3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE -__ZN3JSC14JSGlobalObject4initEPNS_8JSObjectE -__ZN3JSC14JSGlobalObject6s_infoE -__ZN3JSC14JSGlobalObject7destroyEPNS_6JSCellE -__ZN3JSC14JSGlobalObjectD2Ev -__ZN3JSC14MachineThreads16addCurrentThreadEv -__ZN3JSC14MarkStackArray6expandEv -__ZN3JSC14SamplingRegion4dumpEv -__ZN3JSC14SamplingThread4stopEv -__ZN3JSC14SamplingThread5startEj -__ZN3JSC14ScopeChainNode6s_infoE -__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE -__ZN3JSC14TimeoutChecker5resetEv -__ZN3JSC14VTableSpectrum5countEPNS_6JSCellE -__ZN3JSC14throwTypeErrorEPNS_9ExecStateE -__ZN3JSC14throwTypeErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC15WeakHandleOwner26isReachableFromOpaqueRootsENS_6HandleINS_7UnknownEEEPvRNS_11SlotVisitorE -__ZN3JSC15WeakHandleOwner8finalizeENS_6HandleINS_7UnknownEEEPv -__ZN3JSC15WeakHandleOwnerD2Ev -__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC16InternalFunction14finishCreationERNS_12JSGlobalDataERKNS_10IdentifierE -__ZN3JSC16InternalFunction4nameEPNS_9ExecStateE -__ZN3JSC16InternalFunction6s_infoE -__ZN3JSC16InternalFunctionC2EPNS_14JSGlobalObjectEPNS_9StructureE -__ZN3JSC16JSNonFinalObject7destroyEPNS_6JSCellE -__ZN3JSC16JSVariableObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE -__ZN3JSC16JSVariableObject14symbolTableGetERKNS_10IdentifierERNS_18PropertyDescriptorE -__ZN3JSC16JSVariableObject19getOwnPropertyNamesEPNS_8JSObjectEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE -__ZN3JSC16JSVariableObject7destroyEPNS_6JSCellE -__ZN3JSC16createRangeErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC16slowValidateCellEPNS_14JSGlobalObjectE -__ZN3JSC16slowValidateCellEPNS_6JSCellE -__ZN3JSC16throwSyntaxErrorEPNS_9ExecStateE -__ZN3JSC17BytecodeGenerator21setDumpsGeneratedCodeEb -__ZN3JSC17JSAPIValueWrapper6s_infoE -__ZN3JSC17PropertyNameArray3addEPN3WTF10StringImplE -__ZN3JSC17createSyntaxErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC18DebuggerActivation14finishCreationERNS_12JSGlobalDataEPNS_8JSObjectE -__ZN3JSC18DebuggerActivation6s_infoE -__ZN3JSC18DebuggerActivationC1ERNS_12JSGlobalDataE -__ZN3JSC18PropertyDescriptor11setWritableEb -__ZN3JSC18PropertyDescriptor12setUndefinedEv -__ZN3JSC18PropertyDescriptor13setDescriptorENS_7JSValueEj -__ZN3JSC18PropertyDescriptor13setEnumerableEb -__ZN3JSC18PropertyDescriptor15setConfigurableEb -__ZN3JSC18PropertyDescriptor17defaultAttributesE -__ZN3JSC18PropertyDescriptor9setGetterENS_7JSValueE -__ZN3JSC18PropertyDescriptor9setSetterENS_7JSValueE -__ZN3JSC19SourceProviderCache5clearEv -__ZN3JSC19SourceProviderCacheD1Ev -__ZN3JSC19initializeThreadingEv -__ZN3JSC20MarkedArgumentBuffer10slowAppendENS_7JSValueE -__ZN3JSC20WriteBarrierCounters22usesWithBarrierFromCppE -__ZN3JSC20WriteBarrierCounters25usesWithoutBarrierFromCppE -__ZN3JSC20createReferenceErrorEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC22globalMemoryStatisticsEv -__ZN3JSC22objectConstructorTableE -__ZN3JSC23AbstractSamplingCounter30s_abstractSamplingCounterChainE -__ZN3JSC23AbstractSamplingCounter4dumpEv -__ZN3JSC23objectProtoFuncToStringEPNS_9ExecStateE -__ZN3JSC23setUpStaticFunctionSlotEPNS_9ExecStateEPKNS_9HashEntryEPNS_8JSObjectERKNS_10IdentifierERNS_12PropertySlotE -__ZN3JSC24DynamicGlobalObjectScopeC1ERNS_12JSGlobalDataEPNS_14JSGlobalObjectE -__ZN3JSC24TerminatedExecutionError6s_infoE -__ZN3JSC24createStackOverflowErrorEPNS_9ExecStateE -__ZN3JSC24getCalculatedDisplayNameEPNS_9ExecStateEPNS_8JSObjectE -__ZN3JSC25evaluateInGlobalCallFrameERKNS_7UStringERNS_7JSValueEPNS_14JSGlobalObjectE -__ZN3JSC29callHostFunctionAsConstructorEPNS_9ExecStateE -__ZN3JSC30isTerminatedExecutionExceptionENS_7JSValueE -__ZN3JSC35createInterruptedExecutionExceptionEPNS_12JSGlobalDataE -__ZN3JSC36StrictModeReadonlyPropertyWriteErrorE -__ZN3JSC41constructFunctionSkippingEvalEnabledCheckEPNS_9ExecStateEPNS_14JSGlobalObjectERKNS_7ArgListERKNS_10IdentifierERKNS_7UStringERKN3WTF12TextPositionE -__ZN3JSC4Heap11objectCountEv -__ZN3JSC4Heap12addFinalizerEPNS_6JSCellEPFvS2_E -__ZN3JSC4Heap16activityCallbackEv -__ZN3JSC4Heap16objectTypeCountsEv -__ZN3JSC4Heap17collectAllGarbageEv -__ZN3JSC4Heap17globalObjectCountEv -__ZN3JSC4Heap17isValidAllocationEm -__ZN3JSC4Heap19setActivityCallbackEN3WTF10PassOwnPtrINS_18GCActivityCallbackEEE -__ZN3JSC4Heap20protectedObjectCountEv -__ZN3JSC4Heap25protectedObjectTypeCountsEv -__ZN3JSC4Heap26protectedGlobalObjectCountEv -__ZN3JSC4Heap29reportExtraMemoryCostSlowCaseEm -__ZN3JSC4Heap4sizeEv -__ZN3JSC4Heap7destroyEv -__ZN3JSC4Heap7protectENS_7JSValueE -__ZN3JSC4Heap8capacityEv -__ZN3JSC4Heap9unprotectENS_7JSValueE -__ZN3JSC4Yarr11YarrPatternC1ERKNS_7UStringEbbPPKc -__ZN3JSC4Yarr11byteCompileERNS0_11YarrPatternEPN3WTF20BumpPointerAllocatorE -__ZN3JSC4Yarr9interpretEPNS0_15BytecodePatternERKNS_7UStringEjjPi -__ZN3JSC4callEPNS_9ExecStateENS_7JSValueENS_8CallTypeERKNS_8CallDataES2_RKNS_7ArgListE -__ZN3JSC6JSCell11getCallDataEPS0_RNS_8CallDataE -__ZN3JSC6JSCell16getConstructDataEPS0_RNS_13ConstructDataE -__ZN3JSC6JSCell7destroyEPS0_ -__ZN3JSC6JSCell9getObjectEv -__ZN3JSC6JSLock12DropAllLocksC1ENS_14JSLockBehaviorE -__ZN3JSC6JSLock12DropAllLocksC1EPNS_9ExecStateE -__ZN3JSC6JSLock12DropAllLocksD1Ev -__ZN3JSC6JSLock26currentThreadIsHoldingLockEv -__ZN3JSC6JSLock4lockENS_14JSLockBehaviorE -__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE -__ZN3JSC6JSLock9lockCountEv -__ZN3JSC6JSLockC1EPNS_9ExecStateE -__ZN3JSC6RegExp5matchERNS_12JSGlobalDataERKNS_7UStringEjPN3WTF6VectorIiLm32EEE -__ZN3JSC6RegExp6createERNS_12JSGlobalDataERKNS_7UStringENS_11RegExpFlagsE -__ZN3JSC7JSArray13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE -__ZN3JSC7JSArray14finishCreationERNS_12JSGlobalDataEj -__ZN3JSC7JSArray15setSubclassDataEPv -__ZN3JSC7JSArray17defineOwnPropertyEPNS_8JSObjectEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb -__ZN3JSC7JSArray25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE -__ZN3JSC7JSArray30tryFinishCreationUninitializedERNS_12JSGlobalDataEj -__ZN3JSC7JSArray6s_infoE -__ZN3JSC7JSArrayC1ERNS_12JSGlobalDataEPNS_9StructureE -__ZN3JSC7JSArrayC2ERNS_12JSGlobalDataEPNS_9StructureE -__ZN3JSC7JSValue13isValidCalleeEv -__ZN3JSC7Options17numberOfGCMarkersE -__ZN3JSC7Options24opaqueRootMergeThresholdE -__ZN3JSC7Profile10restoreAllEv -__ZN3JSC7Profile5focusEPKNS_11ProfileNodeE -__ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE -__ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE -__ZN3JSC7UString6numberEd -__ZN3JSC7UString6numberEi -__ZN3JSC7UString6numberEj -__ZN3JSC7UString6numberEl -__ZN3JSC7UStringC1EPKc -__ZN3JSC7UStringC1EPKcj -__ZN3JSC7UStringC1EPKt -__ZN3JSC7UStringC1EPKtj -__ZN3JSC7toInt32Ed -__ZN3JSC8Debugger23recompileAllJSFunctionsEPNS_12JSGlobalDataE -__ZN3JSC8Debugger6attachEPNS_14JSGlobalObjectE -__ZN3JSC8Debugger6detachEPNS_14JSGlobalObjectE -__ZN3JSC8DebuggerD2Ev -__ZN3JSC8JSObject10putByIndexEPNS_6JSCellEPNS_9ExecStateEjNS_7JSValueE -__ZN3JSC8JSObject11hasInstanceEPS0_PNS_9ExecStateENS_7JSValueES4_ -__ZN3JSC8JSObject12defaultValueEPKS0_PNS_9ExecStateENS_22PreferredPrimitiveTypeE -__ZN3JSC8JSObject12defineGetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j -__ZN3JSC8JSObject12defineSetterEPS0_PNS_9ExecStateERKNS_10IdentifierES1_j -__ZN3JSC8JSObject12lookupGetterEPNS_9ExecStateERKNS_10IdentifierE -__ZN3JSC8JSObject12lookupSetterEPNS_9ExecStateERKNS_10IdentifierE -__ZN3JSC8JSObject12toThisObjectEPNS_6JSCellEPNS_9ExecStateE -__ZN3JSC8JSObject13visitChildrenEPNS_6JSCellERNS_11SlotVisitorE -__ZN3JSC8JSObject14deletePropertyEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierE -__ZN3JSC8JSObject16getPropertyNamesEPS0_PNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE -__ZN3JSC8JSObject16putDirectVirtualEPS0_PNS_9ExecStateERKNS_10IdentifierENS_7JSValueEj -__ZN3JSC8JSObject17defineOwnPropertyEPS0_PNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorEb -__ZN3JSC8JSObject17preventExtensionsERNS_12JSGlobalDataE -__ZN3JSC8JSObject19getOwnPropertyNamesEPS0_PNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE -__ZN3JSC8JSObject21deletePropertyByIndexEPNS_6JSCellEPNS_9ExecStateEj -__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE -__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_16WriteBarrierBaseINS_7UnknownEEE -__ZN3JSC8JSObject23allocatePropertyStorageERNS_12JSGlobalDataEmm -__ZN3JSC8JSObject24getOwnPropertyDescriptorEPS0_PNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE -__ZN3JSC8JSObject25getOwnPropertySlotByIndexEPNS_6JSCellEPNS_9ExecStateEjRNS_12PropertySlotE -__ZN3JSC8JSObject3putEPNS_6JSCellEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE -__ZN3JSC8JSObject6s_infoE -__ZN3JSC8JSObject7destroyEPNS_6JSCellE -__ZN3JSC8JSObject9classNameEPKS0_ -__ZN3JSC8JSString6s_infoE -__ZN3JSC8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE -__ZN3JSC8Profiler8profilerEv -__ZN3JSC8evaluateEPNS_9ExecStateEPNS_14ScopeChainNodeERKNS_10SourceCodeENS_7JSValueEPS7_ -__ZN3JSC9CodeBlockD1Ev -__ZN3JSC9CodeBlockD2Ev -__ZN3JSC9MarkStack16mergeOpaqueRootsEv -__ZN3JSC9MarkStack8validateEPNS_6JSCellE -__ZN3JSC9Structure21addPropertyTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierEjPNS_6JSCellERm -__ZN3JSC9Structure22materializePropertyMapERNS_12JSGlobalDataE -__ZN3JSC9Structure25changePrototypeTransitionERNS_12JSGlobalDataEPS0_NS_7JSValueE -__ZN3JSC9Structure27despecifyDictionaryFunctionERNS_12JSGlobalDataERKNS_10IdentifierE -__ZN3JSC9Structure27despecifyFunctionTransitionERNS_12JSGlobalDataEPS0_RKNS_10IdentifierE -__ZN3JSC9Structure28addPropertyWithoutTransitionERNS_12JSGlobalDataERKNS_10IdentifierEjPNS_6JSCellE -__ZN3JSC9Structure3getERNS_12JSGlobalDataEPN3WTF10StringImplERjRPNS_6JSCellE -__ZN3JSC9Structure40addPropertyTransitionToExistingStructureEPS0_RKNS_10IdentifierEjPNS_6JSCellERm -__ZN3JSC9Structure6s_infoE -__ZN3JSC9StructureC1ERNS_12JSGlobalDataEPNS_14JSGlobalObjectENS_7JSValueERKNS_8TypeInfoEPKNS_9ClassInfoE -__ZN3JSC9constructEPNS_9ExecStateENS_7JSValueENS_13ConstructTypeERKNS_13ConstructDataERKNS_7ArgListE -__ZN3JSCeqERKNS_7UStringEPKc -__ZN3JSCgtERKNS_7UStringES2_ -__ZN3JSCltERKNS_7UStringES2_ -__ZN3WTF10StringImpl11reverseFindEPS0_j -__ZN3WTF10StringImpl11reverseFindEtj -__ZN3WTF10StringImpl16findIgnoringCaseEPS0_j -__ZN3WTF10StringImpl18simplifyWhiteSpaceEv -__ZN3WTF10StringImpl19characterStartingAtEj -__ZN3WTF10StringImpl19createUninitializedEjRPt -__ZN3WTF10StringImpl22containsOnlyWhitespaceEv -__ZN3WTF10StringImpl23defaultWritingDirectionEPb -__ZN3WTF10StringImpl23reverseFindIgnoringCaseEPS0_j -__ZN3WTF10StringImpl4fillEt -__ZN3WTF10StringImpl4findEPFbtEj -__ZN3WTF10StringImpl4findEPS0_j -__ZN3WTF10StringImpl4findEtj -__ZN3WTF10StringImpl5adoptERNS_12StringBufferItEE -__ZN3WTF10StringImpl5emptyEv -__ZN3WTF10StringImpl5lowerEv -__ZN3WTF10StringImpl5toIntEPb -__ZN3WTF10StringImpl5upperEv -__ZN3WTF10StringImpl6createEPKh -__ZN3WTF10StringImpl6createEPKtj -__ZN3WTF10StringImpl7replaceEPS0_S1_ -__ZN3WTF10StringImpl7replaceEjjPS0_ -__ZN3WTF10StringImpl7replaceEtPS0_ -__ZN3WTF10StringImpl7replaceEtt -__ZN3WTF10StringImpl8endsWithEPS0_b -__ZN3WTF10StringImpl9substringEjj -__ZN3WTF10StringImplD1Ev -__ZN3WTF10fastCallocEmm -__ZN3WTF10fastMallocEm -__ZN3WTF10fastStrDupEPKc -__ZN3WTF11OSAllocator16reserveAndCommitEmNS0_5UsageEbbb -__ZN3WTF11OSAllocator18releaseDecommittedEPvm -__ZN3WTF11commentAtomE -__ZN3WTF11currentTimeEv -__ZN3WTF11dtoaRoundDPEPcdiRbRiRj -__ZN3WTF11dtoaRoundSFEPcdiRbRiRj -__ZN3WTF11emptyStringEv -__ZN3WTF11fastReallocEPvm -__ZN3WTF12AtomicString11addSlowCaseEPNS_10StringImplE -__ZN3WTF12AtomicString16fromUTF8InternalEPKcS2_ -__ZN3WTF12AtomicString3addEPKh -__ZN3WTF12AtomicString3addEPKt -__ZN3WTF12AtomicString3addEPKtj -__ZN3WTF12AtomicString3addEPKtjj -__ZN3WTF12AtomicString3addEPNS_10StringImplEjj -__ZN3WTF12AtomicString4findEPKtjj -__ZN3WTF12AtomicString4initEv -__ZN3WTF12createThreadEPFPvS0_ES0_ -__ZN3WTF12createThreadEPFPvS0_ES0_PKc -__ZN3WTF12detachThreadEj -__ZN3WTF12isMainThreadEv -__ZN3WTF12randomNumberEv -__ZN3WTF13MetaAllocator17addFreshFreeSpaceEPvm -__ZN3WTF13MetaAllocator17freeFreeSpaceNodeEPNS0_13FreeSpaceNodeE -__ZN3WTF13MetaAllocator18debugFreeSpaceSizeEv -__ZN3WTF13MetaAllocator8allocateEmPv -__ZN3WTF13MetaAllocatorC2Em -__ZN3WTF13StringBuilder11shrinkToFitEv -__ZN3WTF13StringBuilder15reserveCapacityEj -__ZN3WTF13StringBuilder6appendEPKhj -__ZN3WTF13StringBuilder6appendEPKtj -__ZN3WTF13StringBuilder6resizeEj -__ZN3WTF13WTFThreadData10staticDataE -__ZN3WTF13WTFThreadDataC1Ev -__ZN3WTF13WTFThreadDataD1Ev -__ZN3WTF13currentThreadEv -__ZN3WTF13tryFastCallocEmm -__ZN3WTF13tryFastMallocEm -__ZN3WTF14fastMallocSizeEPKv -__ZN3WTF14numberToStringEdPc -__ZN3WTF14tryFastReallocEPvm -__ZN3WTF15ArrayBufferView6neuterEv -__ZN3WTF15ArrayBufferViewC2ENS_10PassRefPtrINS_11ArrayBufferEEEj -__ZN3WTF15ArrayBufferViewD2Ev -__ZN3WTF15ThreadCondition4waitERNS_5MutexE -__ZN3WTF15ThreadCondition6signalEv -__ZN3WTF15ThreadCondition9broadcastEv -__ZN3WTF15ThreadCondition9timedWaitERNS_5MutexEd -__ZN3WTF15ThreadConditionC1Ev -__ZN3WTF15ThreadConditionD1Ev -__ZN3WTF15charactersToIntEPKtmPb -__ZN3WTF16callOnMainThreadEPFvPvES0_ -__ZN3WTF16callOnMainThreadERKNS_8FunctionIFvvEEE -__ZN3WTF16codePointCompareEPKNS_10StringImplES2_ -__ZN3WTF16codePointCompareERKNS_6StringES2_ -__ZN3WTF16fastZeroedMallocEm -__ZN3WTF17charactersToFloatEPKtmPbS2_ -__ZN3WTF17equalIgnoringCaseEPKtPKhj -__ZN3WTF17equalIgnoringCaseEPNS_10StringImplEPKh -__ZN3WTF17equalIgnoringCaseEPNS_10StringImplES1_ -__ZN3WTF18calculateDSTOffsetEdd -__ZN3WTF18calculateUTCOffsetEv -__ZN3WTF18charactersToDoubleEPKhmPbS2_ -__ZN3WTF18charactersToDoubleEPKtmPbS2_ -__ZN3WTF18dateToDaysFrom1970Eiii -__ZN3WTF18monthFromDayInYearEib -__ZN3WTF19MetaAllocatorHandle6shrinkEm -__ZN3WTF19MetaAllocatorHandleD1Ev -__ZN3WTF19initializeThreadingEv -__ZN3WTF20equalIgnoringNullityEPNS_10StringImplES1_ -__ZN3WTF20fastMallocStatisticsEv -__ZN3WTF20initializeMainThreadEv -__ZN3WTF21RefCountedLeakCounter16suppressMessagesEPKc -__ZN3WTF21RefCountedLeakCounter24cancelMessageSuppressionEPKc -__ZN3WTF21RefCountedLeakCounter9decrementEv -__ZN3WTF21RefCountedLeakCounter9incrementEv -__ZN3WTF21RefCountedLeakCounterC1EPKc -__ZN3WTF21RefCountedLeakCounterD1Ev -__ZN3WTF21charactersToIntStrictEPKtmPbi -__ZN3WTF22cancelCallOnMainThreadEPFvPvES0_ -__ZN3WTF22charactersToUIntStrictEPKtmPbi -__ZN3WTF22isMainThreadOrGCThreadEv -__ZN3WTF23callOnMainThreadAndWaitEPFvPvES0_ -__ZN3WTF23dayInMonthFromDayInYearEib -__ZN3WTF23waitForThreadCompletionEjPPv -__ZN3WTF27monotonicallyIncreasingTimeEv -__ZN3WTF27releaseFastMallocFreeMemoryEv -__ZN3WTF28setMainThreadCallbacksPausedEb -__ZN3WTF29cryptographicallyRandomNumberEv -__ZN3WTF29cryptographicallyRandomValuesEPvm -__ZN3WTF36lockAtomicallyInitializedStaticMutexEv -__ZN3WTF37parseDateFromNullTerminatedCharactersEPKc -__ZN3WTF38unlockAtomicallyInitializedStaticMutexEv -__ZN3WTF39initializeMainThreadToProcessMainThreadEv -__ZN3WTF3MD58addBytesEPKhm -__ZN3WTF3MD58checksumERNS_6VectorIhLm16EEE -__ZN3WTF3MD5C1Ev -__ZN3WTF4SHA111computeHashERNS_6VectorIhLm20EEE -__ZN3WTF4SHA18addBytesEPKhm -__ZN3WTF4SHA1C1Ev -__ZN3WTF4dtoaEPcdRbRiRj -__ZN3WTF5Mutex4lockEv -__ZN3WTF5Mutex6unlockEv -__ZN3WTF5Mutex7tryLockEv -__ZN3WTF5MutexC1Ev -__ZN3WTF5MutexD1Ev -__ZN3WTF5equalEPKNS_10StringImplEPKh -__ZN3WTF5equalEPKNS_10StringImplEPKhj -__ZN3WTF5equalEPKNS_10StringImplEPKtj -__ZN3WTF5equalEPKNS_10StringImplES2_ -__ZN3WTF5yieldEv -__ZN3WTF6String26fromUTF8WithLatin1FallbackEPKhm -__ZN3WTF6String29charactersWithNullTerminationEv -__ZN3WTF6String6appendEPKtj -__ZN3WTF6String6appendERKS0_ -__ZN3WTF6String6appendEh -__ZN3WTF6String6appendEt -__ZN3WTF6String6formatEPKcz -__ZN3WTF6String6insertERKS0_j -__ZN3WTF6String6numberEdjj -__ZN3WTF6String6numberEi -__ZN3WTF6String6numberEj -__ZN3WTF6String6numberEl -__ZN3WTF6String6numberEm -__ZN3WTF6String6numberEt -__ZN3WTF6String6numberEx -__ZN3WTF6String6numberEy -__ZN3WTF6String6removeEji -__ZN3WTF6String8fromUTF8EPKh -__ZN3WTF6String8fromUTF8EPKhm -__ZN3WTF6String8truncateEj -__ZN3WTF6StringC1EPKc -__ZN3WTF6StringC1EPKcj -__ZN3WTF6StringC1EPKt -__ZN3WTF6StringC1EPKtj -__ZN3WTF6strtodEPKcPPc -__ZN3WTF7CString11mutableDataEv -__ZN3WTF7CString16newUninitializedEmRPc -__ZN3WTF7CStringC1EPKc -__ZN3WTF7CStringC1EPKcm -__ZN3WTF7Unicode18convertUTF16ToUTF8EPPKtS2_PPcS4_b -__ZN3WTF7Unicode18convertUTF8ToUTF16EPPKcS2_PPtS4_b -__ZN3WTF7xmlAtomE -__ZN3WTF8Collator18setOrderLowerFirstEb -__ZN3WTF8CollatorC1EPKc -__ZN3WTF8CollatorD1Ev -__ZN3WTF8Internal21fastMallocMatchFailedEPv -__ZN3WTF8fastFreeEPv -__ZN3WTF8msToYearEd -__ZN3WTF8nullAtomE -__ZN3WTF8pageSizeEv -__ZN3WTF8starAtomE -__ZN3WTF8textAtomE -__ZN3WTF9ByteArray6createEm -__ZN3WTF9dayInYearEdi -__ZN3WTF9emptyAtomE -__ZN3WTF9xmlnsAtomE -__ZN3WTFeqERKNS_7CStringES2_ -__ZNK3JSC10JSFunction10sourceCodeEv -__ZNK3JSC10JSFunction23isHostFunctionNonInlineEv -__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE -__ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE -__ZNK3JSC17DebuggerCallFrame10thisObjectEv -__ZNK3JSC17DebuggerCallFrame12functionNameEv -__ZNK3JSC17DebuggerCallFrame22calculatedFunctionNameEv -__ZNK3JSC17DebuggerCallFrame4typeEv -__ZNK3JSC17DebuggerCallFrame8evaluateERKNS_7UStringERNS_7JSValueE -__ZNK3JSC18PropertyDescriptor10enumerableEv -__ZNK3JSC18PropertyDescriptor12configurableEv -__ZNK3JSC18PropertyDescriptor16isDataDescriptorEv -__ZNK3JSC18PropertyDescriptor20isAccessorDescriptorEv -__ZNK3JSC18PropertyDescriptor6getterEv -__ZNK3JSC18PropertyDescriptor6setterEv -__ZNK3JSC18PropertyDescriptor8writableEv -__ZNK3JSC19SourceProviderCache8byteSizeEv -__ZNK3JSC6JSCell11toPrimitiveEPNS_9ExecStateENS_22PreferredPrimitiveTypeE -__ZNK3JSC6JSCell8toNumberEPNS_9ExecStateE -__ZNK3JSC6JSCell8toObjectEPNS_9ExecStateEPNS_14JSGlobalObjectE -__ZNK3JSC6JSCell9getStringEPNS_9ExecStateE -__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE -__ZNK3JSC7ArgList8getSliceEiRS0_ -__ZNK3JSC7JSArray12subclassDataEv -__ZNK3JSC7JSValue16toNumberSlowCaseEPNS_9ExecStateE -__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateEPNS_14JSGlobalObjectE -__ZNK3JSC7JSValue16toStringSlowCaseEPNS_9ExecStateE -__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE -__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE -__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE -__ZNK3JSC7UString20substringSharingImplEjj -__ZNK3JSC7UString4utf8Eb -__ZNK3JSC7UString5asciiEv -__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE -__ZNK3JSC8JSObject11hasPropertyEPNS_9ExecStateEj -__ZNK3JSC8JSObject8toNumberEPNS_9ExecStateE -__ZNK3JSC8JSObject8toStringEPNS_9ExecStateE -__ZNK3JSC8JSObject9toBooleanEPNS_9ExecStateE -__ZNK3JSC8JSString11resolveRopeEPNS_9ExecStateE -__ZNK3JSC8JSString9toBooleanEPNS_9ExecStateE -__ZNK3JSC9HashTable11createTableEPNS_12JSGlobalDataE -__ZNK3JSC9HashTable11deleteTableEv -__ZNK3WTF10StringImpl12hashSlowCaseEv -__ZNK3WTF10StringImpl17getData16SlowCaseEv -__ZNK3WTF10StringImpl19upconvertCharactersEjj -__ZNK3WTF12AtomicString5lowerEv -__ZNK3WTF13DecimalNumber15toStringDecimalEPtj -__ZNK3WTF13DecimalNumber19toStringExponentialEPtj -__ZNK3WTF13DecimalNumber28bufferLengthForStringDecimalEv -__ZNK3WTF13DecimalNumber32bufferLengthForStringExponentialEv -__ZNK3WTF13StringBuilder11reifyStringEv -__ZNK3WTF13StringBuilder9canShrinkEv -__ZNK3WTF6String11toIntStrictEPbi -__ZNK3WTF6String12isolatedCopyEv -__ZNK3WTF6String12toUIntStrictEPbi -__ZNK3WTF6String13toInt64StrictEPbi -__ZNK3WTF6String15stripWhiteSpaceEPFbtE -__ZNK3WTF6String15stripWhiteSpaceEv -__ZNK3WTF6String16removeCharactersEPFbtE -__ZNK3WTF6String18simplifyWhiteSpaceEPFbtE -__ZNK3WTF6String18simplifyWhiteSpaceEv -__ZNK3WTF6String19characterStartingAtEj -__ZNK3WTF6String4utf8Eb -__ZNK3WTF6String5asciiEv -__ZNK3WTF6String5lowerEv -__ZNK3WTF6String5splitERKS0_RNS_6VectorIS0_Lm0EEE -__ZNK3WTF6String5splitERKS0_bRNS_6VectorIS0_Lm0EEE -__ZNK3WTF6String5splitEtRNS_6VectorIS0_Lm0EEE -__ZNK3WTF6String5splitEtbRNS_6VectorIS0_Lm0EEE -__ZNK3WTF6String5toIntEPb -__ZNK3WTF6String5upperEv -__ZNK3WTF6String6latin1Ev -__ZNK3WTF6String6toUIntEPb -__ZNK3WTF6String7toFloatEPbS1_ -__ZNK3WTF6String8foldCaseEv -__ZNK3WTF6String8toDoubleEPbS1_ -__ZNK3WTF6String8toIntPtrEPb -__ZNK3WTF6String8toUInt64EPb -__ZNK3WTF6String9substringEjj -__ZNK3WTF8Collator7collateEPKtmS2_m -__ZTVN3JSC15WeakHandleOwnerE -__ZTVN3JSC8DebuggerE -_jscore_fastmalloc_introspection -_kJSClassDefinitionEmpty diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def index 93c9e7569..ad4c02634 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def @@ -64,7 +64,7 @@ EXPORTS ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z ?allocatePropertyStorage@JSObject@JSC@@QAEXAAVJSGlobalData@2@II@Z - ?allocateSlowCase@MarkedSpace@JSC@@AAEPAXAAUSizeClass@12@@Z + ?allocateSlowCase@MarkedAllocator@JSC@@AAEPAXXZ ?append@StringBuilder@WTF@@QAEXPBEI@Z ?append@StringBuilder@WTF@@QAEXPB_WI@Z ?ascii@UString@JSC@@QBE?AVCString@WTF@@XZ @@ -135,11 +135,8 @@ EXPORTS ?decrement@RefCountedLeakCounter@WTF@@QAEXXZ ?defaultAttributes@PropertyDescriptor@JSC@@0IA ?defaultValue@JSObject@JSC@@SA?AVJSValue@2@PBV12@PAVExecState@2@W4PreferredPrimitiveType@2@@Z - ?defineGetter@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@0I@Z - ?defineGetter@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@0I@Z + ?defineOwnProperty@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z ?defineOwnProperty@JSObject@JSC@@SA_NPAV12@PAVExecState@2@ABVIdentifier@2@AAVPropertyDescriptor@2@_N@Z - ?defineSetter@JSGlobalObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@ABVIdentifier@2@0I@Z - ?defineSetter@JSObject@JSC@@SAXPAV12@PAVExecState@2@ABVIdentifier@2@0I@Z ?deleteOwnedPtr@WTF@@YAXPAUHBITMAP__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHBRUSH__@@@Z ?deleteOwnedPtr@WTF@@YAXPAUHDC__@@@Z @@ -178,7 +175,7 @@ EXPORTS ?fastRealloc@WTF@@YAPAXPAXI@Z ?fastStrDup@WTF@@YAPADPBD@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z - ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z + ?fillGetterPropertySlot@JSObject@JSC@@AAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z ?finalize@WeakHandleOwner@JSC@@UAEXV?$Handle@W4Unknown@JSC@@@2@PAX@Z ?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVIdentifier@2@@Z @@ -283,6 +280,7 @@ EXPORTS ?reifyString@StringBuilder@WTF@@ABEXXZ ?releaseDecommitted@OSAllocator@WTF@@SAXPAXI@Z ?releaseExecutableMemory@JSGlobalData@JSC@@QAEXXZ + ?removeBlock@MarkedAllocator@JSC@@QAEXPAVMarkedBlock@2@@Z ?reportExtraMemoryCostSlowCase@Heap@JSC@@AAEXI@Z ?reserveAndCommit@OSAllocator@WTF@@SAPAXIW4Usage@12@_N11@Z ?reserveCapacity@StringBuilder@WTF@@QAEXI@Z diff --git a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index fea820ddc..bee218833 100644 --- a/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -2066,6 +2066,14 @@ > </File> <File + RelativePath="..\..\heap\MarkedAllocator.cpp" + > + </File> + <File + RelativePath="..\..\heap\MarkedAllocator.h" + > + </File> + <File RelativePath="..\..\heap\MarkedBlock.cpp" > </File> diff --git a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj index 9d8b3dd58..997b0bbf4 100644 --- a/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj +++ b/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj @@ -81,6 +81,8 @@ 0F620178143FCD440068B77C /* DFGAbstractState.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F62016E143FCD2F0068B77C /* DFGAbstractState.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F620179143FCD480068B77C /* DFGAbstractState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F62016D143FCD2F0068B77C /* DFGAbstractState.cpp */; }; 0F636DA0142D27D700B2E66A /* PackedIntVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F636D9F142D27D200B2E66A /* PackedIntVector.h */; }; + 0F66E16B14DF3F1600B7B2E4 /* DFGNodeReferenceBlob.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16814DF3F1300B7B2E4 /* DFGNodeReferenceBlob.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 0F66E16C14DF3F1600B7B2E4 /* DFGNodeUse.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F66E16914DF3F1300B7B2E4 /* DFGNodeUse.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F7700921402FF3C0078EB39 /* SamplingCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F7700911402FF280078EB39 /* SamplingCounter.cpp */; }; 0F7B294A14C3CD29007C3DB1 /* DFGCCallHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F7B294814C3CD23007C3DB1 /* DFGCCallHelpers.h */; settings = {ATTRIBUTES = (Private, ); }; }; 0F7B294B14C3CD2F007C3DB1 /* DFGCapabilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FD82E1F14172C2F00179C94 /* DFGCapabilities.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -721,6 +723,8 @@ C22C531413FAF6EF00B7DC0D /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = C22C52BA13FAF6EF00B7DC0D /* strtod.h */; settings = {ATTRIBUTES = (Private, ); }; }; C22C531513FAF6EF00B7DC0D /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = C22C52BB13FAF6EF00B7DC0D /* utils.h */; settings = {ATTRIBUTES = (Private, ); }; }; C240305514B404E60079EB64 /* BumpSpace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C240305314B404C90079EB64 /* BumpSpace.cpp */; }; + C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C2B916C514DA040C00CBAC86 /* MarkedAllocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */; }; C2C8D02D14A3C6E000578E65 /* BumpSpaceInlineMethods.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02B14A3C6B200578E65 /* BumpSpaceInlineMethods.h */; settings = {ATTRIBUTES = (Private, ); }; }; C2C8D03014A3CEFC00578E65 /* BumpBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02E14A3CEFC00578E65 /* BumpBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; C2C8D03114A3CEFC00578E65 /* HeapBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = C2C8D02F14A3CEFC00578E65 /* HeapBlock.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -873,6 +877,8 @@ 0F620171143FCD2F0068B77C /* DFGOperands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGOperands.h; path = dfg/DFGOperands.h; sourceTree = "<group>"; }; 0F620172143FCD2F0068B77C /* DFGVariableAccessData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGVariableAccessData.h; path = dfg/DFGVariableAccessData.h; sourceTree = "<group>"; }; 0F636D9F142D27D200B2E66A /* PackedIntVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PackedIntVector.h; sourceTree = "<group>"; }; + 0F66E16814DF3F1300B7B2E4 /* DFGNodeReferenceBlob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNodeReferenceBlob.h; path = dfg/DFGNodeReferenceBlob.h; sourceTree = "<group>"; }; + 0F66E16914DF3F1300B7B2E4 /* DFGNodeUse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGNodeUse.h; path = dfg/DFGNodeUse.h; sourceTree = "<group>"; }; 0F77008E1402FDD60078EB39 /* SamplingCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SamplingCounter.h; sourceTree = "<group>"; }; 0F7700911402FF280078EB39 /* SamplingCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SamplingCounter.cpp; sourceTree = "<group>"; }; 0F7B294814C3CD23007C3DB1 /* DFGCCallHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DFGCCallHelpers.h; path = dfg/DFGCCallHelpers.h; sourceTree = "<group>"; }; @@ -1015,7 +1021,6 @@ 14B3EF0412BC24DD00D29EFF /* PageBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageBlock.cpp; sourceTree = "<group>"; }; 14B7233F12D7D0DA003BD5ED /* MachineStackMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MachineStackMarker.cpp; sourceTree = "<group>"; }; 14B7234012D7D0DA003BD5ED /* MachineStackMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MachineStackMarker.h; sourceTree = "<group>"; }; - 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.exp; sourceTree = "<group>"; tabWidth = 4; usesTabs = 0; }; 14BA78F013AAB88F005B7C2C /* SlotVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlotVisitor.h; sourceTree = "<group>"; }; 14BA7A9513AADFF8005B7C2C /* Heap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Heap.cpp; sourceTree = "<group>"; }; 14BA7A9613AADFF8005B7C2C /* Heap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Heap.h; sourceTree = "<group>"; }; @@ -1164,8 +1169,6 @@ 86704B8112DBA33700A9FE7B /* YarrParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YarrParser.h; path = yarr/YarrParser.h; sourceTree = "<group>"; }; 86704B8212DBA33700A9FE7B /* YarrPattern.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = YarrPattern.cpp; path = yarr/YarrPattern.cpp; sourceTree = "<group>"; }; 86704B8312DBA33700A9FE7B /* YarrPattern.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = YarrPattern.h; path = yarr/YarrPattern.h; sourceTree = "<group>"; }; - 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE32_64only.exp; sourceTree = "<group>"; }; - 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.exports; path = JavaScriptCore.JSVALUE64only.exp; sourceTree = "<group>"; }; 86880F1B14328BB900B08D42 /* DFGSpeculativeJIT32_64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT32_64.cpp; path = dfg/DFGSpeculativeJIT32_64.cpp; sourceTree = "<group>"; }; 86880F4C14353B2100B08D42 /* DFGSpeculativeJIT64.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGSpeculativeJIT64.cpp; path = dfg/DFGSpeculativeJIT64.cpp; sourceTree = "<group>"; }; 868BFA00117CEFD100B908B1 /* AtomicString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicString.cpp; path = text/AtomicString.cpp; sourceTree = "<group>"; }; @@ -1506,6 +1509,8 @@ C22C52BA13FAF6EF00B7DC0D /* strtod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strtod.h; sourceTree = "<group>"; }; C22C52BB13FAF6EF00B7DC0D /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; }; C240305314B404C90079EB64 /* BumpSpace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BumpSpace.cpp; sourceTree = "<group>"; }; + C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkedAllocator.h; sourceTree = "<group>"; }; + C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkedAllocator.cpp; sourceTree = "<group>"; }; C2C8D02B14A3C6B200578E65 /* BumpSpaceInlineMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpSpaceInlineMethods.h; sourceTree = "<group>"; }; C2C8D02E14A3CEFC00578E65 /* BumpBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BumpBlock.h; sourceTree = "<group>"; }; C2C8D02F14A3CEFC00578E65 /* HeapBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapBlock.h; sourceTree = "<group>"; }; @@ -1669,9 +1674,6 @@ 937B63CC09E766D200A671DD /* DerivedSources.make */, A7C225CC139981F100FF1662 /* KeywordLookupGenerator.py */, F692A8540255597D01FF60F7 /* create_hash_table */, - 14B8ECA60A5653980062BE54 /* JavaScriptCore.exp */, - 867FC35F11B763950025105E /* JavaScriptCore.JSVALUE32_64only.exp */, - 867FC36111B763950025105E /* JavaScriptCore.JSVALUE64only.exp */, F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */, 45E12D8806A49B0F00E9DF84 /* jsc.cpp */, F68EBB8C0255D4C601FF60F7 /* config.h */, @@ -1806,6 +1808,8 @@ 142E3131134FF0A600AFADB5 /* LocalScope.h */, 14B7233F12D7D0DA003BD5ED /* MachineStackMarker.cpp */, 14B7234012D7D0DA003BD5ED /* MachineStackMarker.h */, + C2B916C414DA040C00CBAC86 /* MarkedAllocator.cpp */, + C2B916C114DA014E00CBAC86 /* MarkedAllocator.h */, 142D6F0613539A2800B02E86 /* MarkedBlock.cpp */, 142D6F0713539A2800B02E86 /* MarkedBlock.h */, 141448CA13A176EC00F5BA1A /* MarkedBlockSet.h */, @@ -2458,6 +2462,8 @@ 86EC9DBB1328DF82002B2AD7 /* DFGJITCompiler.cpp */, 86EC9DBC1328DF82002B2AD7 /* DFGJITCompiler.h */, 86ECA3E9132DEF1C002B2AD7 /* DFGNode.h */, + 0F66E16814DF3F1300B7B2E4 /* DFGNodeReferenceBlob.h */, + 0F66E16914DF3F1300B7B2E4 /* DFGNodeUse.h */, 0F620171143FCD2F0068B77C /* DFGOperands.h */, 86EC9DBF1328DF82002B2AD7 /* DFGOperations.cpp */, 86EC9DC01328DF82002B2AD7 /* DFGOperations.h */, @@ -2678,6 +2684,7 @@ A73BE169148420520091204B /* ArrayBuffer.h in Headers */, C2D9CA1314BCC04600304B46 /* CheckedBoolean.h in Headers */, A73BE16B148420520091204B /* ArrayBufferView.h in Headers */, + C2B916C214DA014E00CBAC86 /* MarkedAllocator.h in Headers */, BC18C3E60E16F5CD00B34460 /* ArrayConstructor.h in Headers */, BC18C3E70E16F5CD00B34460 /* ArrayPrototype.h in Headers */, BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */, @@ -3119,6 +3126,8 @@ 0F9332A414CA7DD90085F3C6 /* PutByIdStatus.h in Headers */, 0F9332A514CA7DDD0085F3C6 /* StructureSet.h in Headers */, 0F55F0F514D1063C00AC7649 /* AbstractPC.h in Headers */, + 0F66E16B14DF3F1600B7B2E4 /* DFGNodeReferenceBlob.h in Headers */, + 0F66E16C14DF3F1600B7B2E4 /* DFGNodeUse.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3664,6 +3673,7 @@ 0F55F0F414D1063900AC7649 /* AbstractPC.cpp in Sources */, 86B5826714D2796C00A9C306 /* CodeProfile.cpp in Sources */, 86B5826914D2797000A9C306 /* CodeProfiling.cpp in Sources */, + C2B916C514DA040C00CBAC86 /* MarkedAllocator.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/JavaScriptCore/Target.pri b/Source/JavaScriptCore/Target.pri index c61fb37f1..155ee124d 100644 --- a/Source/JavaScriptCore/Target.pri +++ b/Source/JavaScriptCore/Target.pri @@ -73,6 +73,7 @@ SOURCES += \ heap/Heap.cpp \ heap/MachineStackMarker.cpp \ heap/MarkStack.cpp \ + heap/MarkedAllocator.cpp \ heap/MarkedBlock.cpp \ heap/MarkedSpace.cpp \ heap/VTableSpectrum.cpp \ diff --git a/Source/JavaScriptCore/assembler/ARMAssembler.h b/Source/JavaScriptCore/assembler/ARMAssembler.h index a659eefee..ef199d2d1 100644 --- a/Source/JavaScriptCore/assembler/ARMAssembler.h +++ b/Source/JavaScriptCore/assembler/ARMAssembler.h @@ -681,9 +681,7 @@ namespace JSC { PassRefPtr<ExecutableMemoryHandle> executableCopy(JSGlobalData&, void* ownerUID); -#ifndef NDEBUG unsigned debugOffset() { return m_buffer.debugOffset(); } -#endif // Patching helpers diff --git a/Source/JavaScriptCore/assembler/ARMv7Assembler.h b/Source/JavaScriptCore/assembler/ARMv7Assembler.h index 0b83776df..5f376bf3d 100644 --- a/Source/JavaScriptCore/assembler/ARMv7Assembler.h +++ b/Source/JavaScriptCore/assembler/ARMv7Assembler.h @@ -1991,9 +1991,7 @@ public: return reinterpret_cast<void*>(readInt32(where)); } -#ifndef NDEBUG unsigned debugOffset() { return m_formatter.debugOffset(); } -#endif private: // VFP operations commonly take one or more 5-bit operands, typically representing a @@ -2490,9 +2488,7 @@ private: bool isAligned(int alignment) const { return m_buffer.isAligned(alignment); } void* data() const { return m_buffer.data(); } -#ifndef NDEBUG unsigned debugOffset() { return m_buffer.debugOffset(); } -#endif private: AssemblerBuffer m_buffer; diff --git a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h index 288c706d7..b4262e894 100644 --- a/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h +++ b/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h @@ -538,9 +538,7 @@ public: void beginUninterruptedSequence() { } void endUninterruptedSequence() { } -#ifndef NDEBUG unsigned debugOffset() { return m_assembler.debugOffset(); } -#endif protected: AssemblerType m_assembler; diff --git a/Source/JavaScriptCore/assembler/AssemblerBuffer.h b/Source/JavaScriptCore/assembler/AssemblerBuffer.h index c6e0a1003..55706c1ab 100644 --- a/Source/JavaScriptCore/assembler/AssemblerBuffer.h +++ b/Source/JavaScriptCore/assembler/AssemblerBuffer.h @@ -146,9 +146,7 @@ namespace JSC { return result.release(); } -#ifndef NDEBUG unsigned debugOffset() { return m_index; } -#endif protected: void append(const char* data, int size) diff --git a/Source/JavaScriptCore/assembler/LinkBuffer.h b/Source/JavaScriptCore/assembler/LinkBuffer.h index e8047e100..e078024b1 100644 --- a/Source/JavaScriptCore/assembler/LinkBuffer.h +++ b/Source/JavaScriptCore/assembler/LinkBuffer.h @@ -189,7 +189,6 @@ public: return CodePtr(MacroAssembler::AssemblerType_T::getRelocatedAddress(code(), applyOffset(label.m_label))); } -#ifndef NDEBUG void* debugAddress() { return m_code; @@ -199,7 +198,6 @@ public: { return m_size; } -#endif private: template <typename T> T applyOffset(T src) diff --git a/Source/JavaScriptCore/assembler/MIPSAssembler.h b/Source/JavaScriptCore/assembler/MIPSAssembler.h index 4471c1303..b59fa0b8f 100644 --- a/Source/JavaScriptCore/assembler/MIPSAssembler.h +++ b/Source/JavaScriptCore/assembler/MIPSAssembler.h @@ -655,9 +655,7 @@ public: return result.release(); } -#ifndef NDEBUG unsigned debugOffset() { return m_buffer.debugOffset(); } -#endif static unsigned getCallReturnOffset(AssemblerLabel call) { diff --git a/Source/JavaScriptCore/assembler/X86Assembler.h b/Source/JavaScriptCore/assembler/X86Assembler.h index 3b9e122cd..25f8602e8 100644 --- a/Source/JavaScriptCore/assembler/X86Assembler.h +++ b/Source/JavaScriptCore/assembler/X86Assembler.h @@ -1787,9 +1787,7 @@ public: return m_formatter.executableCopy(globalData, ownerUID); } -#ifndef NDEBUG unsigned debugOffset() { return m_formatter.debugOffset(); } -#endif void nop() { @@ -2137,9 +2135,7 @@ private: return m_buffer.executableCopy(globalData, ownerUID); } -#ifndef NDEBUG unsigned debugOffset() { return m_buffer.debugOffset(); } -#endif private: diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 4a953266e..191fafd62 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -59,8 +59,6 @@ namespace JSC { using namespace DFG; #endif -#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) - static UString escapeQuotes(const UString& str) { UString result = str; @@ -1286,8 +1284,6 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& } } -#endif // !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) - #if DUMP_CODE_BLOCK_STATISTICS static HashSet<CodeBlock*> liveCodeBlockSet; #endif diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index 23d6a6b6d..bc2feeb2a 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -134,11 +134,9 @@ namespace JSC { static void dumpStatistics(); -#if !defined(NDEBUG) || ENABLE_OPCODE_SAMPLING void dump(ExecState*) const; void printStructures(const Instruction*) const; void printStructure(const char* name, const Instruction*, int operand) const; -#endif bool isStrictMode() const { return m_isStrictMode; } @@ -354,17 +352,8 @@ namespace JSC { { m_shouldDiscardBytecode = true; } - void handleBytecodeDiscardingOpportunity() - { - if (!!alternative()) - discardBytecode(); - else - discardBytecodeLater(); - } -#ifndef NDEBUG bool usesOpcode(OpcodeID); -#endif unsigned instructionCount() { return m_instructionCount; } void setInstructionCount(unsigned instructionCount) { m_instructionCount = instructionCount; } @@ -522,6 +511,7 @@ namespace JSC { ValueProfile* addValueProfile(int bytecodeOffset) { ASSERT(bytecodeOffset != -1); + ASSERT(m_valueProfiles.isEmpty() || m_valueProfiles.last().m_bytecodeOffset < bytecodeOffset); m_valueProfiles.append(ValueProfile(bytecodeOffset)); return &m_valueProfiles.last(); } @@ -1016,7 +1006,6 @@ namespace JSC { void tallyFrequentExitSites() { } #endif -#if !defined(NDEBUG) || ENABLE(OPCODE_SAMPLING) void dump(ExecState*, const Vector<Instruction>::const_iterator& begin, Vector<Instruction>::const_iterator&) const; CString registerName(ExecState*, int r) const; @@ -1026,7 +1015,6 @@ namespace JSC { void printGetByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; void printCallOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; void printPutByIdOp(ExecState*, int location, Vector<Instruction>::const_iterator&, const char* op) const; -#endif void visitStructures(SlotVisitor&, Instruction* vPC) const; #if ENABLE(DFG_JIT) diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.h b/Source/JavaScriptCore/bytecode/CodeOrigin.h index 25a116c55..eda17648b 100644 --- a/Source/JavaScriptCore/bytecode/CodeOrigin.h +++ b/Source/JavaScriptCore/bytecode/CodeOrigin.h @@ -83,10 +83,8 @@ struct CodeOrigin { bool operator!=(const CodeOrigin& other) const { return !(*this == other); } -#ifndef NDEBUG // Get the inline stack. This is slow, and is intended for debugging only. Vector<CodeOrigin> inlineStack() const; -#endif }; struct InlineCallFrame { @@ -122,7 +120,6 @@ inline bool CodeOrigin::operator==(const CodeOrigin& other) const && inlineCallFrame == other.inlineCallFrame; } -#ifndef NDEBUG // Get the inline stack. This is slow, and is intended for debugging only. inline Vector<CodeOrigin> CodeOrigin::inlineStack() const { @@ -133,7 +130,6 @@ inline Vector<CodeOrigin> CodeOrigin::inlineStack() const result[index--] = current->caller; return result; } -#endif inline unsigned getCallReturnOffsetForCodeOrigin(CodeOriginAtCallReturnOffset* data) { diff --git a/Source/JavaScriptCore/bytecode/DFGExitProfile.h b/Source/JavaScriptCore/bytecode/DFGExitProfile.h index f18b69a54..edabfabf9 100644 --- a/Source/JavaScriptCore/bytecode/DFGExitProfile.h +++ b/Source/JavaScriptCore/bytecode/DFGExitProfile.h @@ -41,7 +41,6 @@ enum ExitKind { Uncountable, // We exited for none of the above reasons, and we should not count it. Most uses of this should be viewed as a FIXME. }; -#ifndef NDEBUG inline const char* exitKindToString(ExitKind kind) { switch (kind) { @@ -59,7 +58,6 @@ inline const char* exitKindToString(ExitKind kind) return "Unknown"; } } -#endif inline bool exitKindIsCountable(ExitKind kind) { diff --git a/Source/JavaScriptCore/bytecode/DataFormat.h b/Source/JavaScriptCore/bytecode/DataFormat.h index b78a6e8e6..4f015486a 100644 --- a/Source/JavaScriptCore/bytecode/DataFormat.h +++ b/Source/JavaScriptCore/bytecode/DataFormat.h @@ -50,7 +50,6 @@ enum DataFormat { DataFormatJSBoolean = DataFormatJS | DataFormatBoolean }; -#ifndef NDEBUG inline const char* dataFormatToString(DataFormat dataFormat) { switch (dataFormat) { @@ -80,7 +79,6 @@ inline const char* dataFormatToString(DataFormat dataFormat) return "Unknown"; } } -#endif #if USE(JSVALUE64) inline bool needDataFormatConversion(DataFormat from, DataFormat to) diff --git a/Source/JavaScriptCore/bytecode/PredictedType.cpp b/Source/JavaScriptCore/bytecode/PredictedType.cpp index 4b07ff446..a8118adf9 100644 --- a/Source/JavaScriptCore/bytecode/PredictedType.cpp +++ b/Source/JavaScriptCore/bytecode/PredictedType.cpp @@ -36,7 +36,6 @@ namespace JSC { -#ifndef NDEBUG const char* predictionToString(PredictedType value) { if (value == PredictNone) @@ -160,7 +159,6 @@ const char* predictionToString(PredictedType value) return description; } -#endif PredictedType predictionFromClassInfo(const ClassInfo* classInfo) { diff --git a/Source/JavaScriptCore/bytecode/PredictedType.h b/Source/JavaScriptCore/bytecode/PredictedType.h index 47583361d..efbe9b30d 100644 --- a/Source/JavaScriptCore/bytecode/PredictedType.h +++ b/Source/JavaScriptCore/bytecode/PredictedType.h @@ -217,9 +217,7 @@ inline bool isOtherPrediction(PredictedType value) return value == PredictOther; } -#ifndef NDEBUG const char* predictionToString(PredictedType value); -#endif // Merge two predictions. Note that currently this just does left | right. It may // seem tempting to do so directly, but you would be doing so at your own peril, diff --git a/Source/JavaScriptCore/bytecode/ValueRecovery.h b/Source/JavaScriptCore/bytecode/ValueRecovery.h index 356abe84f..4d2134e0a 100644 --- a/Source/JavaScriptCore/bytecode/ValueRecovery.h +++ b/Source/JavaScriptCore/bytecode/ValueRecovery.h @@ -30,11 +30,8 @@ #include "JSValue.h" #include "MacroAssembler.h" #include "VirtualRegister.h" -#include <wtf/Platform.h> - -#ifndef NDEBUG #include <stdio.h> -#endif +#include <wtf/Platform.h> namespace JSC { @@ -249,7 +246,6 @@ public: return JSValue::decode(m_source.constant); } -#ifndef NDEBUG void dump(FILE* out) const { switch (technique()) { @@ -314,7 +310,6 @@ public: break; } } -#endif private: ValueRecoveryTechnique m_technique; diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 3d363354e..437dd53b0 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -150,26 +150,16 @@ void ResolveResult::checkValidity() } #endif -#ifndef NDEBUG static bool s_dumpsGeneratedCode = false; -#endif void BytecodeGenerator::setDumpsGeneratedCode(bool dumpsGeneratedCode) { -#ifndef NDEBUG s_dumpsGeneratedCode = dumpsGeneratedCode; -#else - UNUSED_PARAM(dumpsGeneratedCode); -#endif } bool BytecodeGenerator::dumpsGeneratedCode() { -#ifndef NDEBUG return s_dumpsGeneratedCode; -#else - return false; -#endif } JSObject* BytecodeGenerator::generate() @@ -182,10 +172,8 @@ JSObject* BytecodeGenerator::generate() m_codeBlock->setInstructionCount(m_codeBlock->instructions().size()); -#ifndef NDEBUG if (s_dumpsGeneratedCode) m_codeBlock->dump(m_scopeChain->globalObject->globalExec()); -#endif if ((m_codeType == FunctionCode && !m_codeBlock->needsFullScopeChain() && !m_codeBlock->usesArguments()) || m_codeType == EvalCode) symbolTable().clear(); diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp index 330476da2..529a02f16 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.cpp +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -101,16 +101,10 @@ bool DebuggerActivation::getOwnPropertyDescriptor(JSObject* object, ExecState* e return thisObject->m_activation->methodTable()->getOwnPropertyDescriptor(thisObject->m_activation.get(), exec, propertyName, descriptor); } -void DebuggerActivation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) +bool DebuggerActivation::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); - thisObject->m_activation->methodTable()->defineGetter(thisObject->m_activation.get(), exec, propertyName, getterFunction, attributes); -} - -void DebuggerActivation::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) -{ - DebuggerActivation* thisObject = jsCast<DebuggerActivation*>(object); - thisObject->m_activation->methodTable()->defineSetter(thisObject->m_activation.get(), exec, propertyName, setterFunction, attributes); + return thisObject->m_activation->methodTable()->defineOwnProperty(thisObject->m_activation.get(), exec, propertyName, descriptor, shouldThrow); } } // namespace JSC diff --git a/Source/JavaScriptCore/debugger/DebuggerActivation.h b/Source/JavaScriptCore/debugger/DebuggerActivation.h index 8dba70b80..6560c3d11 100644 --- a/Source/JavaScriptCore/debugger/DebuggerActivation.h +++ b/Source/JavaScriptCore/debugger/DebuggerActivation.h @@ -49,8 +49,7 @@ namespace JSC { static bool deleteProperty(JSCell*, ExecState*, const Identifier& propertyName); static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&); - static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes); - static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes); + static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); JS_EXPORTDATA static const ClassInfo s_info; diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index bd35e1d43..72c1759c7 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -262,22 +262,6 @@ bool AbstractState::execute(NodeIndex nodeIndex) forNode(nodeIndex).set(PredictInt32); break; - case ValueToNumber: - if (m_graph[node.child1()].shouldNotSpeculateInteger()) { - forNode(node.child1()).filter(PredictNumber); - forNode(nodeIndex).set(PredictDouble); - break; - } - - forNode(node.child1()).filter(PredictInt32); - forNode(nodeIndex).set(PredictInt32); - break; - - case ValueToDouble: - forNode(node.child1()).filter(PredictNumber); - forNode(nodeIndex).set(PredictDouble); - break; - case ValueAdd: case ArithAdd: { if (m_graph.addShouldSpeculateInteger(node, m_codeBlock)) { diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.h b/Source/JavaScriptCore/dfg/DFGAbstractState.h index 337a4d0b4..015563485 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.h @@ -101,6 +101,11 @@ public: return m_nodes[nodeIndex - m_block->begin]; } + AbstractValue& forNode(NodeUse nodeUse) + { + return forNode(nodeUse.index()); + } + // Call this before beginning CFA to initialize the abstract values of // arguments, and to indicate which blocks should be listed for CFA // execution. diff --git a/Source/JavaScriptCore/dfg/DFGAbstractValue.h b/Source/JavaScriptCore/dfg/DFGAbstractValue.h index 15bc0d496..aa5518187 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractValue.h +++ b/Source/JavaScriptCore/dfg/DFGAbstractValue.h @@ -287,7 +287,6 @@ public: return m_structure == other.m_structure; } -#ifndef NDEBUG void dump(FILE* out) const { if (isTop()) { @@ -300,7 +299,6 @@ public: fprintf(out, "%p", m_structure); fprintf(out, "]"); } -#endif private: static Structure* topValue() { return reinterpret_cast<Structure*>(1); } @@ -466,14 +464,12 @@ struct AbstractValue { // complexity of the code. } -#ifndef NDEBUG void dump(FILE* out) const { fprintf(out, "(%s, ", predictionToString(m_type)); m_structure.dump(out); fprintf(out, ")"); } -#endif StructureAbstractValue m_structure; PredictedType m_type; diff --git a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h index e0d817c9f..0d7dd3a27 100644 --- a/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGAssemblyHelpers.h @@ -39,9 +39,7 @@ namespace JSC { namespace DFG { -#ifndef NDEBUG typedef void (*V_DFGDebugOperation_EP)(ExecState*, void*); -#endif class AssemblyHelpers : public MacroAssembler { public: @@ -152,7 +150,6 @@ public: return branch8(Below, Address(structureReg, Structure::typeInfoTypeOffset()), TrustedImm32(ObjectType)); } -#ifndef NDEBUG // Add a debug call. This call has no effect on JIT code execution state. void debugCall(V_DFGDebugOperation_EP function, void* argument) { @@ -182,7 +179,6 @@ public: for (unsigned i = 0; i < GPRInfo::numberOfRegisters; ++i) loadPtr(buffer + i, GPRInfo::toRegister(i)); } -#endif // These methods JIT generate dynamic, debug-only checks - akin to ASSERTs. #if DFG_ENABLE(JIT_ASSERT) diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index 87c3a23b9..2a5d249b3 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -170,7 +170,7 @@ private: Node& flushChild = m_graph[nodePtr->child1()]; if (flushChild.op == Phi) { VariableAccessData* variableAccessData = flushChild.variableAccessData(); - nodeIndex = addToGraph(GetLocal, OpInfo(variableAccessData), nodePtr->child1()); + nodeIndex = addToGraph(GetLocal, OpInfo(variableAccessData), nodePtr->child1().index()); m_currentBlock->variablesAtTail.local(operand) = nodeIndex; return nodeIndex; } @@ -179,7 +179,7 @@ private: if (nodePtr->op == GetLocal) return nodeIndex; ASSERT(nodePtr->op == SetLocal); - return nodePtr->child1(); + return nodePtr->child1().index(); } // Check for reads of temporaries from prior blocks, @@ -219,7 +219,7 @@ private: Node& flushChild = m_graph[nodePtr->child1()]; if (flushChild.op == Phi) { VariableAccessData* variableAccessData = flushChild.variableAccessData(); - nodeIndex = addToGraph(GetLocal, OpInfo(variableAccessData), nodePtr->child1()); + nodeIndex = addToGraph(GetLocal, OpInfo(variableAccessData), nodePtr->child1().index()); m_currentBlock->variablesAtTail.local(operand) = nodeIndex; return nodeIndex; } @@ -238,7 +238,7 @@ private: return nodeIndex; ASSERT(nodePtr->op == SetLocal); - return nodePtr->child1(); + return nodePtr->child1().index(); } VariableAccessData* variableAccessData = newVariableAccessData(operand); @@ -313,10 +313,6 @@ private: { return toInt32(get(operand)); } - NodeIndex getToNumber(int operand) - { - return toNumber(get(operand)); - } // Perform an ES5 ToInt32 operation - returns a node of type NodeResultInt32. NodeIndex toInt32(NodeIndex index) @@ -327,7 +323,7 @@ private: return index; if (node.op == UInt32ToNumber) - return node.child1(); + return node.child1().index(); // Check for numeric constants boxed as JSValues. if (node.op == JSConstant) { @@ -341,23 +337,6 @@ private: return addToGraph(ValueToInt32, index); } - // Perform an ES5 ToNumber operation - returns a node of type NodeResultDouble. - NodeIndex toNumber(NodeIndex index) - { - Node& node = m_graph[index]; - - if (node.hasNumberResult()) - return index; - - if (node.op == JSConstant) { - JSValue v = valueOfJSConstant(index); - if (v.isNumber()) - return getJSConstant(node.constantNumber()); - } - - return addToGraph(ValueToNumber, OpInfo(NodeUseBottom), index); - } - NodeIndex getJSConstantForValue(JSValue constantValue) { unsigned constantIndex = m_codeBlock->addOrFindConstant(constantValue); @@ -572,7 +551,7 @@ private: } void addVarArgChild(NodeIndex child) { - m_graph.m_varArgChildren.append(child); + m_graph.m_varArgChildren.append(NodeUse(child)); m_numPassedVarArgs++; } @@ -1198,12 +1177,12 @@ bool ByteCodeParser::handleMinMax(bool usesResult, int resultOperand, NodeType o } if (argumentCountIncludingThis == 2) { // Math.min(x) - set(resultOperand, getToNumber(registerOffset + argumentToOperand(1))); + set(resultOperand, get(registerOffset + argumentToOperand(1))); return true; } if (argumentCountIncludingThis == 3) { // Math.min(x, y) - set(resultOperand, addToGraph(op, OpInfo(NodeUseBottom), getToNumber(registerOffset + argumentToOperand(1)), getToNumber(registerOffset + argumentToOperand(2)))); + set(resultOperand, addToGraph(op, OpInfo(NodeUseBottom), get(registerOffset + argumentToOperand(1)), get(registerOffset + argumentToOperand(2)))); return true; } @@ -1231,7 +1210,7 @@ bool ByteCodeParser::handleIntrinsic(bool usesResult, int resultOperand, Intrins if (!MacroAssembler::supportsFloatingPointAbs()) return false; - NodeIndex nodeIndex = addToGraph(ArithAbs, OpInfo(NodeUseBottom), getToNumber(registerOffset + argumentToOperand(1))); + NodeIndex nodeIndex = addToGraph(ArithAbs, OpInfo(NodeUseBottom), get(registerOffset + argumentToOperand(1))); if (m_inlineStackTop->m_exitProfile.hasExitSite(m_currentIndex, Overflow)) m_graph[nodeIndex].mergeArithNodeFlags(NodeMayOverflow); set(resultOperand, nodeIndex); @@ -1256,7 +1235,7 @@ bool ByteCodeParser::handleIntrinsic(bool usesResult, int resultOperand, Intrins if (!MacroAssembler::supportsFloatingPointSqrt()) return false; - set(resultOperand, addToGraph(ArithSqrt, getToNumber(registerOffset + argumentToOperand(1)))); + set(resultOperand, addToGraph(ArithSqrt, get(registerOffset + argumentToOperand(1)))); return true; } @@ -1512,7 +1491,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) case op_pre_inc: { unsigned srcDst = currentInstruction[1].u.operand; - NodeIndex op = getToNumber(srcDst); + NodeIndex op = get(srcDst); set(srcDst, makeSafe(addToGraph(ArithAdd, OpInfo(NodeUseBottom), op, one()))); NEXT_OPCODE(op_pre_inc); } @@ -1521,7 +1500,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) unsigned result = currentInstruction[1].u.operand; unsigned srcDst = currentInstruction[2].u.operand; ASSERT(result != srcDst); // Required for assumptions we make during OSR. - NodeIndex op = getToNumber(srcDst); + NodeIndex op = get(srcDst); set(result, op); set(srcDst, makeSafe(addToGraph(ArithAdd, OpInfo(NodeUseBottom), op, one()))); NEXT_OPCODE(op_post_inc); @@ -1529,7 +1508,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) case op_pre_dec: { unsigned srcDst = currentInstruction[1].u.operand; - NodeIndex op = getToNumber(srcDst); + NodeIndex op = get(srcDst); set(srcDst, makeSafe(addToGraph(ArithSub, OpInfo(NodeUseBottom), op, one()))); NEXT_OPCODE(op_pre_dec); } @@ -1537,7 +1516,7 @@ bool ByteCodeParser::parseBlock(unsigned limit) case op_post_dec: { unsigned result = currentInstruction[1].u.operand; unsigned srcDst = currentInstruction[2].u.operand; - NodeIndex op = getToNumber(srcDst); + NodeIndex op = get(srcDst); set(result, op); set(srcDst, makeSafe(addToGraph(ArithSub, OpInfo(NodeUseBottom), op, one()))); NEXT_OPCODE(op_post_dec); @@ -1549,37 +1528,37 @@ bool ByteCodeParser::parseBlock(unsigned limit) NodeIndex op1 = get(currentInstruction[2].u.operand); NodeIndex op2 = get(currentInstruction[3].u.operand); if (m_graph[op1].hasNumberResult() && m_graph[op2].hasNumberResult()) - set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithAdd, OpInfo(NodeUseBottom), toNumber(op1), toNumber(op2)))); + set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithAdd, OpInfo(NodeUseBottom), op1, op2))); else set(currentInstruction[1].u.operand, makeSafe(addToGraph(ValueAdd, OpInfo(NodeUseBottom), op1, op2))); NEXT_OPCODE(op_add); } case op_sub: { - NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); - NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithSub, OpInfo(NodeUseBottom), op1, op2))); NEXT_OPCODE(op_sub); } case op_mul: { // Multiply requires that the inputs are not truncated, unfortunately. - NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); - NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithMul, OpInfo(NodeUseBottom), op1, op2))); NEXT_OPCODE(op_mul); } case op_mod: { - NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); - NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, makeSafe(addToGraph(ArithMod, OpInfo(NodeUseBottom), op1, op2))); NEXT_OPCODE(op_mod); } case op_div: { - NodeIndex op1 = getToNumber(currentInstruction[2].u.operand); - NodeIndex op2 = getToNumber(currentInstruction[3].u.operand); + NodeIndex op1 = get(currentInstruction[2].u.operand); + NodeIndex op2 = get(currentInstruction[3].u.operand); set(currentInstruction[1].u.operand, makeDivSafe(addToGraph(ArithDiv, OpInfo(NodeUseBottom), op1, op2))); NEXT_OPCODE(op_div); } @@ -2241,9 +2220,9 @@ void ByteCodeParser::processPhiStack() // GetLocal and its block-local Phi. Strictly speaking we only need the two // to be unified. But for efficiency, we want the code that creates GetLocals // and Phis to try to reuse VariableAccessDatas as much as possible. - ASSERT(m_graph[valueInPredecessor].variableAccessData() == m_graph[m_graph[valueInPredecessor].child1()].variableAccessData()); + ASSERT(m_graph[valueInPredecessor].variableAccessData() == m_graph[m_graph[valueInPredecessor].child1().index()].variableAccessData()); - valueInPredecessor = m_graph[valueInPredecessor].child1(); + valueInPredecessor = m_graph[valueInPredecessor].child1().index(); } else { #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Found @%u.\n", valueInPredecessor); @@ -2266,11 +2245,11 @@ void ByteCodeParser::processPhiStack() m_graph.ref(valueInPredecessor); } - if (phiNode->child1() == NoNode) { + if (!phiNode->child1()) { #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Setting @%u->child1 = @%u.\n", entry.m_phi, valueInPredecessor); #endif - phiNode->children.fixed.child1 = valueInPredecessor; + phiNode->children.setChild1(NodeUse(valueInPredecessor)); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Children of @%u: ", entry.m_phi); phiNode->dumpChildren(stdout); @@ -2278,11 +2257,11 @@ void ByteCodeParser::processPhiStack() #endif continue; } - if (phiNode->child2() == NoNode) { + if (!phiNode->child2()) { #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Setting @%u->child2 = @%u.\n", entry.m_phi, valueInPredecessor); #endif - phiNode->children.fixed.child2 = valueInPredecessor; + phiNode->children.setChild2(NodeUse(valueInPredecessor)); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Children of @%u: ", entry.m_phi); phiNode->dumpChildren(stdout); @@ -2290,11 +2269,11 @@ void ByteCodeParser::processPhiStack() #endif continue; } - if (phiNode->child3() == NoNode) { + if (!phiNode->child3()) { #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Setting @%u->child3 = @%u.\n", entry.m_phi, valueInPredecessor); #endif - phiNode->children.fixed.child3 = valueInPredecessor; + phiNode->children.setChild3(NodeUse(valueInPredecessor)); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Children of @%u: ", entry.m_phi); phiNode->dumpChildren(stdout); @@ -2314,9 +2293,7 @@ void ByteCodeParser::processPhiStack() if (phiNode->refCount()) m_graph.ref(newPhi); - newPhiNode.children.fixed.child1 = phiNode->child1(); - newPhiNode.children.fixed.child2 = phiNode->child2(); - newPhiNode.children.fixed.child3 = phiNode->child3(); + newPhiNode.children = phiNode->children; #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Children of @%u: ", newPhi); @@ -2324,9 +2301,7 @@ void ByteCodeParser::processPhiStack() printf(".\n"); #endif - phiNode->children.fixed.child1 = newPhi; - phiNode->children.fixed.child2 = valueInPredecessor; - phiNode->children.fixed.child3 = NoNode; + phiNode->children.initialize(newPhi, valueInPredecessor, NoNode); #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) printf(" Children of @%u: ", entry.m_phi); diff --git a/Source/JavaScriptCore/dfg/DFGCommon.h b/Source/JavaScriptCore/dfg/DFGCommon.h index 469dbd33e..14edff3a5 100644 --- a/Source/JavaScriptCore/dfg/DFGCommon.h +++ b/Source/JavaScriptCore/dfg/DFGCommon.h @@ -92,6 +92,11 @@ struct NodeIndexTraits { } }; +enum UseKind { + UntypedUse, + LastUseKind // Must always be the last entry in the enum, as it is used to denote the number of enum elements. +}; + } } // namespace JSC::DFG #endif // ENABLE(DFG_JIT) diff --git a/Source/JavaScriptCore/dfg/DFGFPRInfo.h b/Source/JavaScriptCore/dfg/DFGFPRInfo.h index dbd60a4e6..6af45dd81 100644 --- a/Source/JavaScriptCore/dfg/DFGFPRInfo.h +++ b/Source/JavaScriptCore/dfg/DFGFPRInfo.h @@ -78,7 +78,6 @@ public: return (unsigned)reg; } -#ifndef NDEBUG static const char* debugName(FPRReg reg) { ASSERT(reg != InvalidFPRReg); @@ -99,7 +98,6 @@ public: #endif return nameForRegister[reg]; } -#endif }; #endif @@ -141,7 +139,6 @@ public: return (unsigned)reg; } -#ifndef NDEBUG static const char* debugName(FPRReg reg) { ASSERT(reg != InvalidFPRReg); @@ -158,7 +155,6 @@ public: }; return nameForRegister[reg]; } -#endif }; #endif diff --git a/Source/JavaScriptCore/dfg/DFGGPRInfo.h b/Source/JavaScriptCore/dfg/DFGGPRInfo.h index 2f779d645..f010d8c18 100644 --- a/Source/JavaScriptCore/dfg/DFGGPRInfo.h +++ b/Source/JavaScriptCore/dfg/DFGGPRInfo.h @@ -292,7 +292,6 @@ public: return result; } -#ifndef NDEBUG static const char* debugName(GPRReg reg) { ASSERT(reg != InvalidGPRReg); @@ -303,7 +302,6 @@ public: }; return nameForRegister[reg]; } -#endif private: static const unsigned InvalidIndex = 0xffffffff; @@ -363,7 +361,6 @@ public: return result; } -#ifndef NDEBUG static const char* debugName(GPRReg reg) { ASSERT(reg != InvalidGPRReg); @@ -376,7 +373,6 @@ public: }; return nameForRegister[reg]; } -#endif private: static const unsigned InvalidIndex = 0xffffffff; @@ -436,7 +432,6 @@ public: return result; } -#ifndef NDEBUG static const char* debugName(GPRReg reg) { ASSERT(reg != InvalidGPRReg); @@ -449,7 +444,6 @@ public: }; return nameForRegister[reg]; } -#endif private: static const unsigned InvalidIndex = 0xffffffff; diff --git a/Source/JavaScriptCore/dfg/DFGGraph.cpp b/Source/JavaScriptCore/dfg/DFGGraph.cpp index e01bea195..c304dc8e7 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.cpp +++ b/Source/JavaScriptCore/dfg/DFGGraph.cpp @@ -32,8 +32,6 @@ namespace JSC { namespace DFG { -#ifndef NDEBUG - // Creates an array of stringized names. static const char* dfgOpNames[] = { #define STRINGIZE_DFG_OP_ENUM(opcode, flags) #opcode , @@ -165,16 +163,16 @@ void Graph::dump(NodeIndex nodeIndex, CodeBlock* codeBlock) printf(", "); else hasPrinted = true; - printf("@%u", m_varArgChildren[childIdx]); + printf("@%u", m_varArgChildren[childIdx].index()); } } else { - if (node.child1() != NoNode) - printf("@%u", node.child1()); - if (node.child2() != NoNode) - printf(", @%u", node.child2()); - if (node.child3() != NoNode) - printf(", @%u", node.child3()); - hasPrinted = node.child1() != NoNode; + if (!!node.child1()) + printf("@%u", node.child1().index()); + if (!!node.child2()) + printf(", @%u", node.child2().index()); + if (!!node.child3()) + printf(", @%u", node.child3().index()); + hasPrinted = !!node.child1(); } if (node.hasArithNodeFlags()) { @@ -298,8 +296,6 @@ void Graph::dump(CodeBlock* codeBlock) dump(i, codeBlock); } -#endif - // FIXME: Convert this to be iterative, not recursive. #define DO_TO_CHILDREN(node, thingToDo) do { \ Node& _node = (node); \ @@ -309,20 +305,20 @@ void Graph::dump(CodeBlock* codeBlock) _childIdx++) \ thingToDo(m_varArgChildren[_childIdx]); \ } else { \ - if (_node.child1() == NoNode) { \ - ASSERT(_node.child2() == NoNode \ - && _node.child3() == NoNode); \ + if (!_node.child1()) { \ + ASSERT(!_node.child2() \ + && !_node.child3()); \ break; \ } \ thingToDo(_node.child1()); \ \ - if (_node.child2() == NoNode) { \ - ASSERT(_node.child3() == NoNode); \ + if (!_node.child2()) { \ + ASSERT(!_node.child3()); \ break; \ } \ thingToDo(_node.child2()); \ \ - if (_node.child3() == NoNode) \ + if (!_node.child3()) \ break; \ thingToDo(_node.child3()); \ } \ diff --git a/Source/JavaScriptCore/dfg/DFGGraph.h b/Source/JavaScriptCore/dfg/DFGGraph.h index d3f16a0f4..ecd77b3a4 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.h +++ b/Source/JavaScriptCore/dfg/DFGGraph.h @@ -71,6 +71,15 @@ struct ResolveGlobalData { // Nodes that are 'dead' remain in the vector with refCount 0. class Graph : public Vector<Node, 64> { public: + using Vector<Node, 64>::operator[]; + using Vector<Node, 64>::at; + + Node& operator[](NodeUse nodeUse) { return at(nodeUse.index()); } + const Node& operator[](NodeUse nodeUse) const { return at(nodeUse.index()); } + + Node& at(NodeUse nodeUse) { return at(nodeUse.index()); } + const Node& at(NodeUse nodeUse) const { return at(nodeUse.index()); } + // Mark a node as being referenced. void ref(NodeIndex nodeIndex) { @@ -79,38 +88,45 @@ public: if (node.ref()) refChildren(nodeIndex); } + void ref(NodeUse nodeUse) + { + ref(nodeUse.index()); + } void deref(NodeIndex nodeIndex) { if (at(nodeIndex).deref()) derefChildren(nodeIndex); } + void deref(NodeUse nodeUse) + { + deref(nodeUse.index()); + } void clearAndDerefChild1(Node& node) { - if (node.children.fixed.child1 == NoNode) + if (!node.child1()) return; - deref(node.children.fixed.child1); - node.children.fixed.child1 = NoNode; + deref(node.child1()); + node.children.child1() = NodeUse(); } void clearAndDerefChild2(Node& node) { - if (node.children.fixed.child2 == NoNode) + if (!node.child2()) return; - deref(node.children.fixed.child2); - node.children.fixed.child2 = NoNode; + deref(node.child2()); + node.children.child2() = NodeUse(); } void clearAndDerefChild3(Node& node) { - if (node.children.fixed.child3 == NoNode) + if (!node.child3()) return; - deref(node.children.fixed.child3); - node.children.fixed.child3 = NoNode; + deref(node.child3()); + node.children.child3() = NodeUse(); } -#ifndef NDEBUG // CodeBlock is optional, but may allow additional information to be dumped (e.g. Identifier names). void dump(CodeBlock* = 0); void dump(NodeIndex, CodeBlock* = 0); @@ -118,7 +134,6 @@ public: // Dump the code origin of the given node as a diff from the code origin of the // preceding node. void dumpCodeOrigin(NodeIndex); -#endif BlockIndex blockIndexForBytecodeOffset(Vector<BlockIndex>& blocks, unsigned bytecodeBegin); @@ -214,12 +229,10 @@ public: return asFunction(function); } -#ifndef NDEBUG static const char *opName(NodeType); // This is O(n), and should only be used for verbose dumps. const char* nameOfVariableAccessData(VariableAccessData*); -#endif void predictArgumentTypes(CodeBlock*); @@ -259,7 +272,7 @@ public: } Vector< OwnPtr<BasicBlock> , 8> m_blocks; - Vector<NodeIndex, 16> m_varArgChildren; + Vector<NodeUse, 16> m_varArgChildren; Vector<StorageAccessData> m_storageAccessData; Vector<ResolveGlobalData> m_resolveGlobalData; Vector<NodeIndex, 8> m_arguments; diff --git a/Source/JavaScriptCore/dfg/DFGJITCompiler.h b/Source/JavaScriptCore/dfg/DFGJITCompiler.h index 451bee6ca..5596876fc 100644 --- a/Source/JavaScriptCore/dfg/DFGJITCompiler.h +++ b/Source/JavaScriptCore/dfg/DFGJITCompiler.h @@ -272,6 +272,7 @@ public: // Helper methods to get predictions PredictedType getPrediction(Node& node) { return node.prediction(); } PredictedType getPrediction(NodeIndex nodeIndex) { return getPrediction(graph()[nodeIndex]); } + PredictedType getPrediction(NodeUse nodeUse) { return getPrediction(nodeUse.index()); } #if USE(JSVALUE32_64) void* addressOfDoubleConstant(NodeIndex nodeIndex) diff --git a/Source/JavaScriptCore/dfg/DFGNode.h b/Source/JavaScriptCore/dfg/DFGNode.h index 7366c1c40..2b6ebdb7f 100644 --- a/Source/JavaScriptCore/dfg/DFGNode.h +++ b/Source/JavaScriptCore/dfg/DFGNode.h @@ -33,6 +33,7 @@ #include "CodeBlock.h" #include "CodeOrigin.h" #include "DFGCommon.h" +#include "DFGNodeReferenceBlob.h" #include "DFGOperands.h" #include "DFGVariableAccessData.h" #include "JSValue.h" @@ -96,7 +97,6 @@ static inline bool nodeCanSpeculateInteger(ArithNodeFlags flags) return true; } -#ifndef NDEBUG static inline const char* arithNodeFlagsAsString(ArithNodeFlags flags) { if (!flags) @@ -138,7 +138,6 @@ static inline const char* arithNodeFlagsAsString(ArithNodeFlags flags) return description; } -#endif // Entries in the NodeType enum (below) are composed of an id, a result type (possibly none) // and some additional informative flags (must generate, is constant, etc). @@ -212,11 +211,6 @@ static inline const char* arithNodeFlagsAsString(ArithNodeFlags flags) macro(ArithMin, NodeResultNumber) \ macro(ArithMax, NodeResultNumber) \ macro(ArithSqrt, NodeResultNumber) \ - /* Arithmetic operators call ToNumber on their operands. */\ - macro(ValueToNumber, NodeResultNumber | NodeMustGenerate) \ - \ - /* A variant of ValueToNumber, which a hint that the parents will always use this as a double. */\ - macro(ValueToDouble, NodeResultNumber | NodeMustGenerate) \ \ /* Add of values may either be arithmetic, or result in string concatenation. */\ macro(ValueAdd, NodeResultJS | NodeMustGenerate | NodeMightClobber) \ @@ -349,36 +343,33 @@ struct Node { Node(NodeType op, CodeOrigin codeOrigin, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode) : op(op) , codeOrigin(codeOrigin) + , children(NodeReferenceBlob::Fixed, child1, child2, child3) , m_virtualRegister(InvalidVirtualRegister) , m_refCount(0) , m_prediction(PredictNone) { ASSERT(!(op & NodeHasVarArgs)); ASSERT(!hasArithNodeFlags()); - children.fixed.child1 = child1; - children.fixed.child2 = child2; - children.fixed.child3 = child3; } // Construct a node with up to 3 children and an immediate value. Node(NodeType op, CodeOrigin codeOrigin, OpInfo imm, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode) : op(op) , codeOrigin(codeOrigin) + , children(NodeReferenceBlob::Fixed, child1, child2, child3) , m_virtualRegister(InvalidVirtualRegister) , m_refCount(0) , m_opInfo(imm.m_value) , m_prediction(PredictNone) { ASSERT(!(op & NodeHasVarArgs)); - children.fixed.child1 = child1; - children.fixed.child2 = child2; - children.fixed.child3 = child3; } // Construct a node with up to 3 children and two immediate values. Node(NodeType op, CodeOrigin codeOrigin, OpInfo imm1, OpInfo imm2, NodeIndex child1 = NoNode, NodeIndex child2 = NoNode, NodeIndex child3 = NoNode) : op(op) , codeOrigin(codeOrigin) + , children(NodeReferenceBlob::Fixed, child1, child2, child3) , m_virtualRegister(InvalidVirtualRegister) , m_refCount(0) , m_opInfo(imm1.m_value) @@ -386,15 +377,13 @@ struct Node { , m_prediction(PredictNone) { ASSERT(!(op & NodeHasVarArgs)); - children.fixed.child1 = child1; - children.fixed.child2 = child2; - children.fixed.child3 = child3; } // Construct a node with a variable number of children and two immediate values. Node(VarArgTag, NodeType op, CodeOrigin codeOrigin, OpInfo imm1, OpInfo imm2, unsigned firstChild, unsigned numChildren) : op(op) , codeOrigin(codeOrigin) + , children(NodeReferenceBlob::Variable, firstChild, numChildren) , m_virtualRegister(InvalidVirtualRegister) , m_refCount(0) , m_opInfo(imm1.m_value) @@ -402,8 +391,6 @@ struct Node { , m_prediction(PredictNone) { ASSERT(op & NodeHasVarArgs); - children.variable.firstChild = firstChild; - children.variable.numChildren = numChildren; } bool mustGenerate() @@ -499,7 +486,6 @@ struct Node { return variableAccessData()->local(); } -#ifndef NDEBUG bool hasIdentifier() { switch (op) { @@ -515,7 +501,6 @@ struct Node { return false; } } -#endif unsigned identifierNumber() { @@ -532,8 +517,6 @@ struct Node { bool hasArithNodeFlags() { switch (op) { - case ValueToNumber: - case ValueToDouble: case UInt32ToNumber: case ArithAdd: case ArithSub: @@ -849,42 +832,42 @@ struct Node { return !--m_refCount; } - NodeIndex child1() + NodeUse child1() { ASSERT(!(op & NodeHasVarArgs)); - return children.fixed.child1; + return children.child1(); } // This is useful if you want to do a fast check on the first child // before also doing a check on the opcode. Use this with care and // avoid it if possible. - NodeIndex child1Unchecked() + NodeUse child1Unchecked() { - return children.fixed.child1; + return children.child1Unchecked(); } - NodeIndex child2() + NodeUse child2() { ASSERT(!(op & NodeHasVarArgs)); - return children.fixed.child2; + return children.child2(); } - NodeIndex child3() + NodeUse child3() { ASSERT(!(op & NodeHasVarArgs)); - return children.fixed.child3; + return children.child3(); } unsigned firstChild() { ASSERT(op & NodeHasVarArgs); - return children.variable.firstChild; + return children.firstChild(); } unsigned numChildren() { ASSERT(op & NodeHasVarArgs); - return children.variable.numChildren; + return children.numChildren(); } PredictedType prediction() @@ -1036,35 +1019,25 @@ struct Node { return nodeCanSpeculateInteger(arithNodeFlags()); } -#ifndef NDEBUG void dumpChildren(FILE* out) { - if (child1() == NoNode) + if (!child1()) return; - fprintf(out, "@%u", child1()); - if (child2() == NoNode) + fprintf(out, "@%u", child1().index()); + if (!child2()) return; - fprintf(out, ", @%u", child2()); - if (child3() == NoNode) + fprintf(out, ", @%u", child2().index()); + if (!child3()) return; - fprintf(out, ", @%u", child3()); + fprintf(out, ", @%u", child3().index()); } -#endif // This enum value describes the type of the node. NodeType op; // Used to look up exception handling information (currently implemented as a bytecode index). CodeOrigin codeOrigin; - // References to up to 3 children (0 for no child). - union { - struct { - NodeIndex child1, child2, child3; - } fixed; - struct { - unsigned firstChild; - unsigned numChildren; - } variable; - } children; + // References to up to 3 children, or links to a variable length set of children. + NodeReferenceBlob children; private: // The virtual register number (spill location) associated with this . diff --git a/Source/JavaScriptCore/dfg/DFGNodeReferenceBlob.h b/Source/JavaScriptCore/dfg/DFGNodeReferenceBlob.h new file mode 100644 index 000000000..df3ff5f5f --- /dev/null +++ b/Source/JavaScriptCore/dfg/DFGNodeReferenceBlob.h @@ -0,0 +1,155 @@ +/* + * Copyright (C) 2011 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 DFGNodeReferenceBlob_h +#define DFGNodeReferenceBlob_h + +#include <wtf/Platform.h> + +#if ENABLE(DFG_JIT) + +#include "DFGCommon.h" +#include "DFGNodeUse.h" + +namespace JSC { namespace DFG { + +class NodeReferenceBlob { +public: + enum Kind { + Fixed, + Variable + }; + + NodeReferenceBlob(Kind kind) +#if !ASSERT_DISABLED + : m_kind(kind) +#endif + { + if (kind == Variable) { + m_words[0].m_encodedWord = UINT_MAX; + m_words[1].m_encodedWord = UINT_MAX; + } + } + + NodeReferenceBlob(Kind kind, NodeIndex child1, NodeIndex child2, NodeIndex child3) +#if !ASSERT_DISABLED + : m_kind(Fixed) +#endif + { + ASSERT_UNUSED(kind, kind == Fixed); + initialize(child1, child2, child3); + } + + NodeReferenceBlob(Kind kind, unsigned firstChild, unsigned numChildren) +#if !ASSERT_DISABLED + : m_kind(Variable) +#endif + { + ASSERT_UNUSED(kind, kind == Variable); + setFirstChild(firstChild); + setNumChildren(numChildren); + } + + const NodeUse& child(unsigned i) const + { + ASSERT(i < 3); + ASSERT(m_kind == Fixed); + return m_words[i]; + } + + NodeUse& child(unsigned i) + { + ASSERT(i < 3); + ASSERT(m_kind == Fixed); + return m_words[i]; + } + + void setChild(unsigned i, NodeUse nodeUse) + { + ASSERT(i < 30); + ASSERT(m_kind == Fixed); + m_words[i] = nodeUse; + } + + NodeUse child1() const { return child(0); } + NodeUse child2() const { return child(1); } + NodeUse child3() const { return child(2); } + + NodeUse& child1() { return child(0); } + NodeUse& child2() { return child(1); } + NodeUse& child3() { return child(2); } + + void setChild1(NodeUse nodeUse) { setChild(0, nodeUse); } + void setChild2(NodeUse nodeUse) { setChild(1, nodeUse); } + void setChild3(NodeUse nodeUse) { setChild(2, nodeUse); } + + NodeUse child1Unchecked() const { return m_words[0]; } + + void initialize(NodeUse child1, NodeUse child2, NodeUse child3) + { + child(0) = child1; + child(1) = child2; + child(2) = child3; + } + + void initialize(NodeIndex child1, NodeIndex child2, NodeIndex child3) + { + initialize(NodeUse(child1), NodeUse(child2), NodeUse(child3)); + } + + unsigned firstChild() const + { + ASSERT(m_kind == Variable); + return m_words[0].m_encodedWord; + } + void setFirstChild(unsigned firstChild) + { + ASSERT(m_kind == Variable); + m_words[0].m_encodedWord = firstChild; + } + + unsigned numChildren() const + { + ASSERT(m_kind == Variable); + return m_words[1].m_encodedWord; + } + void setNumChildren(unsigned numChildren) + { + ASSERT(m_kind == Variable); + m_words[1].m_encodedWord = numChildren; + } + +private: + NodeUse m_words[3]; +#if !ASSERT_DISABLED + Kind m_kind; +#endif +}; + +} } // namespace JSC::DFG + +#endif // ENABLE(DFG_JIT) + +#endif // DFGNodeReferenceBlob_h diff --git a/Source/JavaScriptCore/dfg/DFGNodeUse.h b/Source/JavaScriptCore/dfg/DFGNodeUse.h new file mode 100644 index 000000000..71154997c --- /dev/null +++ b/Source/JavaScriptCore/dfg/DFGNodeUse.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2011 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 DFGNodeUse_h +#define DFGNodeUse_h + +#include <wtf/Platform.h> + +#if ENABLE(DFG_JIT) + +#include "DFGCommon.h" + +namespace JSC { namespace DFG { + +class NodeReferenceBlob; + +class NodeUse { +public: + NodeUse() + : m_encodedWord(makeWord(NoNode, UntypedUse)) + { + } + + explicit NodeUse(NodeIndex nodeIndex) + : m_encodedWord(makeWord(nodeIndex, UntypedUse)) + { + } + + NodeUse(NodeIndex nodeIndex, UseKind useKind) + : m_encodedWord(makeWord(nodeIndex, useKind)) + { + } + + NodeIndex indexUnchecked() const { return m_encodedWord >> shift(); } + NodeIndex index() const + { + ASSERT(isSet()); + return m_encodedWord >> shift(); + } + void setIndex(NodeIndex nodeIndex) + { + m_encodedWord = makeWord(nodeIndex, useKind()); + } + + UseKind useKind() const + { + ASSERT(isSet()); + unsigned masked = m_encodedWord & (((1 << shift()) - 1)); + ASSERT(masked < LastUseKind); + return static_cast<UseKind>(masked); + } + void setUseKind(UseKind useKind) + { + ASSERT(isSet()); + m_encodedWord = makeWord(index(), useKind); + } + + bool isSet() const { return indexUnchecked() != NoNode; } + bool operator!() const { return !isSet(); } + + bool operator==(NodeUse other) const + { + return m_encodedWord == other.m_encodedWord; + } + bool operator!=(NodeUse other) const + { + return m_encodedWord != other.m_encodedWord; + } + +private: + friend class NodeReferenceBlob; + + static uint32_t shift() { return 4; } + + static int32_t makeWord(NodeIndex nodeIndex, UseKind useKind) + { + ASSERT(static_cast<uint32_t>(((static_cast<int32_t>(nodeIndex) << shift()) >> shift())) == nodeIndex); + ASSERT(useKind >= 0 && useKind < LastUseKind); + ASSERT(LastUseKind <= (1 << shift())); + return (nodeIndex << shift()) | useKind; + } + + int32_t m_encodedWord; +}; + +inline bool operator==(NodeUse nodeUse, NodeIndex nodeIndex) +{ + return nodeUse.indexUnchecked() == nodeIndex; +} +inline bool operator==(NodeIndex nodeIndex, NodeUse nodeUse) +{ + return nodeUse.indexUnchecked() == nodeIndex; +} +inline bool operator!=(NodeUse nodeUse, NodeIndex nodeIndex) +{ + return nodeUse.indexUnchecked() != nodeIndex; +} +inline bool operator!=(NodeIndex nodeIndex, NodeUse nodeUse) +{ + return nodeUse.indexUnchecked() != nodeIndex; +} + +} } // namespace JSC::DFG + +#endif // ENABLE(DFG_JIT) + +#endif // DFGNodeUse_h + diff --git a/Source/JavaScriptCore/dfg/DFGOSRExit.cpp b/Source/JavaScriptCore/dfg/DFGOSRExit.cpp index 7b1941146..113f2ea0d 100644 --- a/Source/JavaScriptCore/dfg/DFGOSRExit.cpp +++ b/Source/JavaScriptCore/dfg/DFGOSRExit.cpp @@ -53,7 +53,6 @@ OSRExit::OSRExit(ExitKind kind, JSValueSource jsValueSource, ValueProfile* value m_variables[variable] = jit->computeValueRecoveryFor(jit->m_variables[variable]); } -#ifndef NDEBUG void OSRExit::dump(FILE* out) const { for (unsigned argument = 0; argument < m_arguments.size(); ++argument) @@ -62,7 +61,6 @@ void OSRExit::dump(FILE* out) const for (unsigned variable = 0; variable < m_variables.size(); ++variable) m_variables[variable].dump(out); } -#endif bool OSRExit::considerAddingAsFrequentExitSiteSlow(CodeBlock* dfgCodeBlock, CodeBlock* profiledCodeBlock) { diff --git a/Source/JavaScriptCore/dfg/DFGOSRExit.h b/Source/JavaScriptCore/dfg/DFGOSRExit.h index cf96f4f3a..8e3fa6a5d 100644 --- a/Source/JavaScriptCore/dfg/DFGOSRExit.h +++ b/Source/JavaScriptCore/dfg/DFGOSRExit.h @@ -137,9 +137,7 @@ struct OSRExit { return considerAddingAsFrequentExitSiteSlow(dfgCodeBlock, profiledCodeBlock); } -#ifndef NDEBUG void dump(FILE* out) const; -#endif Vector<ValueRecovery, 0> m_arguments; Vector<ValueRecovery, 0> m_variables; diff --git a/Source/JavaScriptCore/dfg/DFGPropagator.cpp b/Source/JavaScriptCore/dfg/DFGPropagator.cpp index acfd2d364..f00f13e96 100644 --- a/Source/JavaScriptCore/dfg/DFGPropagator.cpp +++ b/Source/JavaScriptCore/dfg/DFGPropagator.cpp @@ -138,8 +138,6 @@ private: break; } - case ValueToNumber: - case ValueToDouble: case UInt32ToNumber: { changed |= m_graph[node.child1()].mergeArithNodeFlags(flags); break; @@ -147,7 +145,7 @@ private: case ArithAdd: case ValueAdd: { - if (isNotNegZero(node.child1()) || isNotNegZero(node.child2())) + if (isNotNegZero(node.child1().index()) || isNotNegZero(node.child2().index())) flags &= ~NodeNeedsNegZero; changed |= m_graph[node.child1()].mergeArithNodeFlags(flags); @@ -156,7 +154,7 @@ private: } case ArithSub: { - if (isNotZero(node.child1()) || isNotZero(node.child2())) + if (isNotZero(node.child1().index()) || isNotZero(node.child2().index())) flags &= ~NodeNeedsNegZero; changed |= m_graph[node.child1()].mergeArithNodeFlags(flags); @@ -210,13 +208,13 @@ private: for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) changed |= m_graph[m_graph.m_varArgChildren[childIdx]].mergeArithNodeFlags(flags); } else { - if (node.child1() == NoNode) + if (!node.child1()) break; changed |= m_graph[node.child1()].mergeArithNodeFlags(flags); - if (node.child2() == NoNode) + if (!node.child2()) break; changed |= m_graph[node.child2()].mergeArithNodeFlags(flags); - if (node.child3() == NoNode) + if (!node.child3()) break; changed |= m_graph[node.child3()].mergeArithNodeFlags(flags); } @@ -363,19 +361,6 @@ private: break; } - case ValueToNumber: { - PredictedType prediction = m_graph[node.child1()].prediction(); - - if (prediction) { - if (!(prediction & PredictDouble) && nodeCanSpeculateInteger(node.arithNodeFlags())) - changed |= mergePrediction(PredictInt32); - else - changed |= mergePrediction(PredictNumber); - } - - break; - } - case ValueAdd: { PredictedType left = m_graph[node.child1()].prediction(); PredictedType right = m_graph[node.child2()].prediction(); @@ -597,7 +582,6 @@ private: break; } - case ValueToDouble: case GetArrayLength: case GetByteArrayLength: case GetInt8ArrayLength: @@ -676,21 +660,19 @@ private: propagateNodePredictions(m_graph[m_compileIndex]); } - void vote(NodeIndex nodeIndex, VariableAccessData::Ballot ballot) + void vote(NodeUse nodeUse, VariableAccessData::Ballot ballot) { - switch (m_graph[nodeIndex].op) { - case ValueToNumber: - case ValueToDouble: + switch (m_graph[nodeUse].op) { case ValueToInt32: case UInt32ToNumber: - nodeIndex = m_graph[nodeIndex].child1(); + nodeUse = m_graph[nodeUse].child1(); break; default: break; } - if (m_graph[nodeIndex].op == GetLocal) - m_graph[nodeIndex].variableAccessData()->vote(ballot); + if (m_graph[nodeUse].op == GetLocal) + m_graph[nodeUse].variableAccessData()->vote(ballot); } void vote(Node& node, VariableAccessData::Ballot ballot) @@ -701,13 +683,13 @@ private: return; } - if (node.child1() == NoNode) + if (!node.child1()) return; vote(node.child1(), ballot); - if (node.child2() == NoNode) + if (!node.child2()) return; vote(node.child2(), ballot); - if (node.child3() == NoNode) + if (!node.child3()) return; vote(node.child3(), ballot); } @@ -775,11 +757,6 @@ private: vote(node.child1(), VariableAccessData::VoteDouble); break; - case ValueToNumber: - case ValueToDouble: - // Don't vote. - break; - case SetLocal: { PredictedType prediction = m_graph[node.child1()].prediction(); if (isDoublePrediction(prediction)) @@ -835,16 +812,6 @@ private: } while (m_changed); } - void toDouble(NodeIndex nodeIndex) - { - if (m_graph[nodeIndex].op == ValueToNumber) { -#if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) - printf(" @%u -> ValueToDouble", nodeIndex); -#endif - m_graph[nodeIndex].op = ValueToDouble; - } - } - void fixupNode(Node& node) { if (!node.shouldGenerate()) @@ -857,60 +824,6 @@ private: #endif switch (op) { - case ValueAdd: - case ArithAdd: - case ArithSub: { - PredictedType left = m_graph[node.child1()].prediction(); - PredictedType right = m_graph[node.child2()].prediction(); - - if (left && right - && isNumberPrediction(left) && isNumberPrediction(right) - && !m_graph.addShouldSpeculateInteger(node, m_codeBlock)) { - toDouble(node.child1()); - toDouble(node.child2()); - } - break; - } - - case ArithMul: - case ArithMin: - case ArithMax: - case ArithMod: - case ArithDiv: { - if (!nodeCanSpeculateInteger(node.arithNodeFlags())) { - toDouble(node.child1()); - toDouble(node.child2()); - break; - } - - PredictedType left = m_graph[node.child1()].prediction(); - PredictedType right = m_graph[node.child2()].prediction(); - - if (left && right - && ((left & PredictDouble) || (right & PredictDouble))) { - toDouble(node.child1()); - toDouble(node.child2()); - } - break; - } - - case ArithAbs: { - if (!nodeCanSpeculateInteger(node.arithNodeFlags())) { - toDouble(node.child1()); - break; - } - - PredictedType prediction = m_graph[node.child1()].prediction(); - if (prediction & PredictDouble) - toDouble(node.child1()); - break; - } - - case ArithSqrt: { - toDouble(node.child1()); - break; - } - case GetById: { if (!isInt32Prediction(m_graph[m_compileIndex].prediction())) break; @@ -977,8 +890,8 @@ private: case GetByVal: case StringCharAt: case StringCharCodeAt: { - if (node.child3() != NoNode && m_graph[node.child3()].op == Nop) - node.children.fixed.child3 = NoNode; + if (!!node.child3() && m_graph[node.child3()].op == Nop) + node.children.child3() = NodeUse(); break; } default: @@ -1004,14 +917,15 @@ private: if (nodeIndex == NoNode) return NoNode; - if (m_graph[nodeIndex].op == ValueToNumber) - nodeIndex = m_graph[nodeIndex].child1(); - if (m_graph[nodeIndex].op == ValueToInt32) - nodeIndex = m_graph[nodeIndex].child1(); + nodeIndex = m_graph[nodeIndex].child1().index(); return nodeIndex; } + NodeIndex canonicalize(NodeUse nodeUse) + { + return canonicalize(nodeUse.indexUnchecked()); + } // Computes where the search for a candidate for CSE should start. Don't call // this directly; call startIndex() instead as it does logging in debug mode. @@ -1061,7 +975,10 @@ private: NodeIndex startIndex() { Node& node = m_graph[m_compileIndex]; - return startIndexForChildren(node.child1(), node.child2(), node.child3()); + return startIndexForChildren( + node.child1().indexUnchecked(), + node.child2().indexUnchecked(), + node.child3().indexUnchecked()); } NodeIndex endIndexForPureCSE() @@ -1207,7 +1124,7 @@ private: break; case PutGlobalVar: if (node.varNumber() == varNumber && m_codeBlock->globalObjectFor(node.codeOrigin) == globalObject) - return node.child1(); + return node.child1().index(); break; default: break; @@ -1235,7 +1152,7 @@ private: if (!byValIsPure(node)) return NoNode; if (node.child1() == child1 && canonicalize(node.child2()) == canonicalize(child2)) - return node.child3(); + return node.child3().index(); // We must assume that the PutByVal will clobber the location we're getting from. // FIXME: We can do better; if we know that the PutByVal is accessing an array of a // different type than the GetByVal, then we know that they won't clobber each other. @@ -1328,7 +1245,7 @@ private: case PutByOffset: if (m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber == identifierNumber) { if (node.child2() == child1) - return node.child3(); + return node.child3().index(); return NoNode; } break; @@ -1442,22 +1359,22 @@ private: return NoNode; } - void performSubstitution(NodeIndex& child, bool addRef = true) + void performSubstitution(NodeUse& child, bool addRef = true) { // Check if this operand is actually unused. - if (child == NoNode) + if (!child) return; // Check if there is any replacement. - NodeIndex replacement = m_replacements[child]; + NodeIndex replacement = m_replacements[child.index()]; if (replacement == NoNode) return; - child = replacement; + child.setIndex(replacement); // There is definitely a replacement. Assert that the replacement does not // have a replacement. - ASSERT(m_replacements[child] == NoNode); + ASSERT(m_replacements[child.index()] == NoNode); if (addRef) m_graph[child].ref(); @@ -1505,9 +1422,9 @@ private: for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) performSubstitution(m_graph.m_varArgChildren[childIdx], shouldGenerate); } else { - performSubstitution(node.children.fixed.child1, shouldGenerate); - performSubstitution(node.children.fixed.child2, shouldGenerate); - performSubstitution(node.children.fixed.child3, shouldGenerate); + performSubstitution(node.children.child1(), shouldGenerate); + performSubstitution(node.children.child2(), shouldGenerate); + performSubstitution(node.children.child3(), shouldGenerate); } if (!shouldGenerate) @@ -1602,37 +1519,37 @@ private: case GetByVal: if (byValIsPure(node)) - setReplacement(getByValLoadElimination(node.child1(), node.child2())); + setReplacement(getByValLoadElimination(node.child1().index(), node.child2().index())); break; case PutByVal: - if (byValIsPure(node) && getByValLoadElimination(node.child1(), node.child2()) != NoNode) + if (byValIsPure(node) && getByValLoadElimination(node.child1().index(), node.child2().index()) != NoNode) node.op = PutByValAlias; break; case CheckStructure: - if (checkStructureLoadElimination(node.structureSet(), node.child1())) + if (checkStructureLoadElimination(node.structureSet(), node.child1().index())) eliminate(); break; case CheckFunction: - if (checkFunctionElimination(node.function(), node.child1())) + if (checkFunctionElimination(node.function(), node.child1().index())) eliminate(); break; case GetIndexedPropertyStorage: { PredictedType basePrediction = m_graph[node.child2()].prediction(); bool nodeHasIntegerIndexPrediction = !(!(basePrediction & PredictInt32) && basePrediction); - setReplacement(getIndexedPropertyStorageLoadElimination(node.child1(), nodeHasIntegerIndexPrediction)); + setReplacement(getIndexedPropertyStorageLoadElimination(node.child1().index(), nodeHasIntegerIndexPrediction)); break; } case GetPropertyStorage: - setReplacement(getPropertyStorageLoadElimination(node.child1())); + setReplacement(getPropertyStorageLoadElimination(node.child1().index())); break; case GetByOffset: - setReplacement(getByOffsetLoadElimination(m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber, node.child1())); + setReplacement(getByOffsetLoadElimination(m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber, node.child1().index())); break; default: diff --git a/Source/JavaScriptCore/dfg/DFGScoreBoard.h b/Source/JavaScriptCore/dfg/DFGScoreBoard.h index 7f9211a26..cc3272812 100644 --- a/Source/JavaScriptCore/dfg/DFGScoreBoard.h +++ b/Source/JavaScriptCore/dfg/DFGScoreBoard.h @@ -28,7 +28,7 @@ #if ENABLE(DFG_JIT) -#include <dfg/DFGGraph.h> +#include "DFGGraph.h" #include <wtf/BitVector.h> #include <wtf/Vector.h> @@ -106,6 +106,10 @@ public: m_free.append(index); } } + void use(NodeUse child) + { + use(child.indexUnchecked()); + } unsigned highWatermark() { diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index e647fb87a..77b3e54b1 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -87,22 +87,22 @@ void SpeculativeJIT::useChildren(Node& node) for (unsigned childIdx = node.firstChild(); childIdx < node.firstChild() + node.numChildren(); childIdx++) use(m_jit.graph().m_varArgChildren[childIdx]); } else { - NodeIndex child1 = node.child1(); - if (child1 == NoNode) { - ASSERT(node.child2() == NoNode && node.child3() == NoNode); + NodeUse child1 = node.child1(); + if (!child1) { + ASSERT(!node.child2() && !node.child3()); return; } use(child1); - NodeIndex child2 = node.child2(); - if (child2 == NoNode) { - ASSERT(node.child3() == NoNode); + NodeUse child2 = node.child2(); + if (!child2) { + ASSERT(!node.child3()); return; } use(child2); - NodeIndex child3 = node.child3(); - if (child3 == NoNode) + NodeUse child3 = node.child3(); + if (!child3) return; use(child3); } @@ -249,7 +249,7 @@ void SpeculativeJIT::markCellCard(MacroAssembler& jit, GPRReg owner, GPRReg scra #endif } -void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeIndex valueIndex, WriteBarrierUseKind useKind, GPRReg scratch1, GPRReg scratch2) +void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeUse valueUse, WriteBarrierUseKind useKind, GPRReg scratch1, GPRReg scratch2) { UNUSED_PARAM(ownerGPR); UNUSED_PARAM(valueGPR); @@ -257,7 +257,7 @@ void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeIndex va UNUSED_PARAM(scratch2); UNUSED_PARAM(useKind); - if (isKnownNotCell(valueIndex)) + if (isKnownNotCell(valueUse.index())) return; #if ENABLE(WRITE_BARRIER_PROFILING) @@ -280,7 +280,7 @@ void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeIndex va JITCompiler::Jump rhsNotCell; bool hadCellCheck = false; - if (!isKnownCell(valueIndex) && !isCellPrediction(m_jit.getPrediction(valueIndex))) { + if (!isKnownCell(valueUse.index()) && !isCellPrediction(m_jit.getPrediction(valueUse.index()))) { hadCellCheck = true; rhsNotCell = m_jit.branchIfNotCell(valueGPR); } @@ -325,14 +325,14 @@ void SpeculativeJIT::writeBarrier(GPRReg ownerGPR, JSCell* value, WriteBarrierUs #endif } -void SpeculativeJIT::writeBarrier(JSCell* owner, GPRReg valueGPR, NodeIndex valueIndex, WriteBarrierUseKind useKind, GPRReg scratch) +void SpeculativeJIT::writeBarrier(JSCell* owner, GPRReg valueGPR, NodeUse valueUse, WriteBarrierUseKind useKind, GPRReg scratch) { UNUSED_PARAM(owner); UNUSED_PARAM(valueGPR); UNUSED_PARAM(scratch); UNUSED_PARAM(useKind); - if (isKnownNotCell(valueIndex)) + if (isKnownNotCell(valueUse.index())) return; #if ENABLE(WRITE_BARRIER_PROFILING) @@ -342,7 +342,7 @@ void SpeculativeJIT::writeBarrier(JSCell* owner, GPRReg valueGPR, NodeIndex valu #if ENABLE(GGC) JITCompiler::Jump rhsNotCell; bool hadCellCheck = false; - if (!isKnownCell(valueIndex) && !isCellPrediction(m_jit.getPrediction(valueIndex))) { + if (!isKnownCell(valueUse.index()) && !isCellPrediction(m_jit.getPrediction(valueUse.index()))) { hadCellCheck = true; rhsNotCell = m_jit.branchIfNotCell(valueGPR); } @@ -383,7 +383,7 @@ bool SpeculativeJIT::nonSpeculativeCompare(Node& node, MacroAssembler::Relationa bool SpeculativeJIT::nonSpeculativeStrictEq(Node& node, bool invert) { - if (!invert && (isKnownNumeric(node.child1()) || isKnownNumeric(node.child2()))) + if (!invert && (isKnownNumeric(node.child1().index()) || isKnownNumeric(node.child2().index()))) return nonSpeculativeCompare(node, MacroAssembler::Equal, operationCompareStrictEq); NodeIndex branchNodeIndex = detectPeepHoleBranch(); @@ -831,9 +831,9 @@ void SpeculativeJIT::compilePeepHoleObjectEquality(Node& node, NodeIndex branchN GPRReg op2GPR = op2.gpr(); if (!predictionCheck(m_state.forNode(node.child1()).m_type)) - speculationCheck(BadType, JSValueSource::unboxedCell(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueSource::unboxedCell(op1GPR), node.child1().index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); if (!predictionCheck(m_state.forNode(node.child2()).m_type)) - speculationCheck(BadType, JSValueSource::unboxedCell(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueSource::unboxedCell(op2GPR), node.child2().index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); addBranch(m_jit.branchPtr(condition, op1GPR, op2GPR), taken); if (notTaken != (m_block + 1)) @@ -855,13 +855,13 @@ void SpeculativeJIT::compilePeepHoleIntegerBranch(Node& node, NodeIndex branchNo notTaken = tmp; } - if (isInt32Constant(node.child1())) { - int32_t imm = valueOfInt32Constant(node.child1()); + if (isInt32Constant(node.child1().index())) { + int32_t imm = valueOfInt32Constant(node.child1().index()); SpeculateIntegerOperand op2(this, node.child2()); addBranch(m_jit.branch32(condition, JITCompiler::Imm32(imm), op2.gpr()), taken); - } else if (isInt32Constant(node.child2())) { + } else if (isInt32Constant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); - int32_t imm = valueOfInt32Constant(node.child2()); + int32_t imm = valueOfInt32Constant(node.child2().index()); addBranch(m_jit.branch32(condition, op1.gpr(), JITCompiler::Imm32(imm)), taken); } else { SpeculateIntegerOperand op1(this, node.child1()); @@ -913,7 +913,7 @@ void SpeculativeJIT::compileMovHint(Node& node) { ASSERT(node.op == SetLocal); - setNodeIndexForOperand(node.child1(), node.local()); + setNodeIndexForOperand(node.child1().index(), node.local()); m_lastSetOperand = node.local(); } @@ -1268,15 +1268,8 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo // Try to see if there is an alternate node that would contain the value we want. // There are four possibilities: // - // ValueToNumber: If the only live version of the value is a ValueToNumber node - // then it means that all remaining uses of the value would have performed a - // ValueToNumber conversion anyway. Thus, we can substitute ValueToNumber. - // - // ValueToInt32: Likewise, if the only remaining live version of the value is - // ValueToInt32, then we can use it. But if there is both a ValueToInt32 - // and a ValueToNumber, then we better go with ValueToNumber because it - // means that some remaining uses would have converted to number while - // others would have converted to Int32. + // ValueToInt32: If the only remaining live version of the value is + // ValueToInt32, then we can use it. // // UInt32ToNumber: If the only live version of the value is a UInt32ToNumber // then the only remaining uses are ones that want a properly formed number @@ -1289,7 +1282,7 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo bool found = false; if (nodePtr->op == UInt32ToNumber) { - NodeIndex nodeIndex = nodePtr->child1(); + NodeIndex nodeIndex = nodePtr->child1().index(); nodePtr = &at(nodeIndex); infoPtr = &m_generationInfo[nodePtr->virtualRegister()]; if (infoPtr->alive() && infoPtr->nodeIndex() == nodeIndex) @@ -1297,7 +1290,6 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo } if (!found) { - NodeIndex valueToNumberIndex = NoNode; NodeIndex valueToInt32Index = NoNode; NodeIndex uint32ToNumberIndex = NoNode; @@ -1311,10 +1303,6 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo if (node.child1Unchecked() != valueSource.nodeIndex()) continue; switch (node.op) { - case ValueToNumber: - case ValueToDouble: - valueToNumberIndex = info.nodeIndex(); - break; case ValueToInt32: valueToInt32Index = info.nodeIndex(); break; @@ -1327,9 +1315,7 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo } NodeIndex nodeIndexToUse; - if (valueToNumberIndex != NoNode) - nodeIndexToUse = valueToNumberIndex; - else if (valueToInt32Index != NoNode) + if (valueToInt32Index != NoNode) nodeIndexToUse = valueToInt32Index; else if (uint32ToNumberIndex != NoNode) nodeIndexToUse = uint32ToNumberIndex; @@ -1594,16 +1580,16 @@ static void compileClampDoubleToByte(JITCompiler& jit, GPRReg result, FPRReg sou void SpeculativeJIT::compilePutByValForByteArray(GPRReg base, GPRReg property, Node& node) { - NodeIndex baseIndex = node.child1(); - NodeIndex valueIndex = node.child3(); + NodeUse baseUse = node.child1(); + NodeUse valueUse = node.child3(); - if (!isByteArrayPrediction(m_state.forNode(baseIndex).m_type)) - speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSByteArray::s_info))); + if (!isByteArrayPrediction(m_state.forNode(baseUse).m_type)) + speculationCheck(BadType, JSValueSource::unboxedCell(base), baseUse.index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(&JSByteArray::s_info))); GPRTemporary value; GPRReg valueGPR; - if (at(valueIndex).isConstant()) { - JSValue jsValue = valueOfJSConstant(valueIndex); + if (at(valueUse).isConstant()) { + JSValue jsValue = valueOfJSConstant(valueUse.index()); if (!jsValue.isNumber()) { terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode); noResult(m_compileIndex); @@ -1615,8 +1601,8 @@ void SpeculativeJIT::compilePutByValForByteArray(GPRReg base, GPRReg property, N m_jit.move(Imm32(clampedValue), scratchReg); value.adopt(scratch); valueGPR = scratchReg; - } else if (!at(valueIndex).shouldNotSpeculateInteger()) { - SpeculateIntegerOperand valueOp(this, valueIndex); + } else if (!at(valueUse).shouldNotSpeculateInteger()) { + SpeculateIntegerOperand valueOp(this, valueUse); GPRTemporary scratch(this); GPRReg scratchReg = scratch.gpr(); m_jit.move(valueOp.gpr(), scratchReg); @@ -1624,7 +1610,7 @@ void SpeculativeJIT::compilePutByValForByteArray(GPRReg base, GPRReg property, N value.adopt(scratch); valueGPR = scratchReg; } else { - SpeculateDoubleOperand valueOp(this, valueIndex); + SpeculateDoubleOperand valueOp(this, valueUse); GPRTemporary result(this); FPRTemporary floatScratch(this); FPRReg fpr = valueOp.fpr(); @@ -1745,16 +1731,16 @@ void SpeculativeJIT::compileGetByValOnIntTypedArray(const TypedArrayDescriptor& void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& descriptor, GPRReg base, GPRReg property, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements, TypedArraySignedness signedness, TypedArrayRounding rounding) { - NodeIndex baseIndex = node.child1(); - NodeIndex valueIndex = node.child3(); + NodeUse baseUse = node.child1(); + NodeUse valueUse = node.child3(); if (speculationRequirements != NoTypedArrayTypeSpecCheck) - speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); + speculationCheck(BadType, JSValueSource::unboxedCell(base), baseUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); GPRTemporary value; GPRReg valueGPR; - if (at(valueIndex).isConstant()) { - JSValue jsValue = valueOfJSConstant(valueIndex); + if (at(valueUse).isConstant()) { + JSValue jsValue = valueOfJSConstant(valueUse.index()); if (!jsValue.isNumber()) { terminateSpeculativeExecution(Uncountable, JSValueRegs(), NoNode); noResult(m_compileIndex); @@ -1770,8 +1756,8 @@ void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& m_jit.move(Imm32(static_cast<int>(d)), scratchReg); value.adopt(scratch); valueGPR = scratchReg; - } else if (!at(valueIndex).shouldNotSpeculateInteger()) { - SpeculateIntegerOperand valueOp(this, valueIndex); + } else if (!at(valueUse).shouldNotSpeculateInteger()) { + SpeculateIntegerOperand valueOp(this, valueUse); GPRTemporary scratch(this); GPRReg scratchReg = scratch.gpr(); m_jit.move(valueOp.gpr(), scratchReg); @@ -1783,7 +1769,7 @@ void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& valueGPR = scratchReg; } else if (rounding == ClampRounding) { ASSERT(elementSize == 1); - SpeculateDoubleOperand valueOp(this, valueIndex); + SpeculateDoubleOperand valueOp(this, valueUse); GPRTemporary result(this); FPRTemporary floatScratch(this); FPRReg fpr = valueOp.fpr(); @@ -1792,7 +1778,7 @@ void SpeculativeJIT::compilePutByValForIntTypedArray(const TypedArrayDescriptor& value.adopt(result); valueGPR = gpr; } else { - SpeculateDoubleOperand valueOp(this, valueIndex); + SpeculateDoubleOperand valueOp(this, valueUse); GPRTemporary result(this); FPRReg fpr = valueOp.fpr(); GPRReg gpr = result.gpr(); @@ -1891,13 +1877,13 @@ void SpeculativeJIT::compileGetByValOnFloatTypedArray(const TypedArrayDescriptor void SpeculativeJIT::compilePutByValForFloatTypedArray(const TypedArrayDescriptor& descriptor, GPRReg base, GPRReg property, Node& node, size_t elementSize, TypedArraySpeculationRequirements speculationRequirements) { - NodeIndex baseIndex = node.child1(); - NodeIndex valueIndex = node.child3(); + NodeUse baseUse = node.child1(); + NodeUse valueUse = node.child3(); - SpeculateDoubleOperand valueOp(this, valueIndex); + SpeculateDoubleOperand valueOp(this, valueUse); if (speculationRequirements != NoTypedArrayTypeSpecCheck) - speculationCheck(BadType, JSValueSource::unboxedCell(base), baseIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); + speculationCheck(BadType, JSValueSource::unboxedCell(base), baseUse.index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(base, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(descriptor.m_classInfo))); GPRTemporary result(this); @@ -2042,8 +2028,8 @@ void SpeculativeJIT::compileSoftModulo(Node& node) SpeculateStrictInt32Operand op1(this, node.child1()); GPRReg op1Gpr = op1.gpr(); - if (isInt32Constant(node.child2())) { - int32_t divisor = valueOfInt32Constant(node.child2()); + if (isInt32Constant(node.child2().index())) { + int32_t divisor = valueOfInt32Constant(node.child2().index()); if (divisor < 0) divisor = -divisor; @@ -2199,8 +2185,8 @@ void SpeculativeJIT::compileSoftModulo(Node& node) void SpeculativeJIT::compileAdd(Node& node) { if (m_jit.graph().addShouldSpeculateInteger(node, m_jit.codeBlock())) { - if (isNumberConstant(node.child1())) { - int32_t imm1 = valueOfNumberConstantAsInt32(node.child1()); + if (isNumberConstant(node.child1().index())) { + int32_t imm1 = valueOfNumberConstantAsInt32(node.child1().index()); SpeculateIntegerOperand op2(this, node.child2()); GPRTemporary result(this); @@ -2214,9 +2200,9 @@ void SpeculativeJIT::compileAdd(Node& node) return; } - if (isNumberConstant(node.child2())) { + if (isNumberConstant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); - int32_t imm2 = valueOfNumberConstantAsInt32(node.child2()); + int32_t imm2 = valueOfNumberConstantAsInt32(node.child2().index()); GPRTemporary result(this); if (nodeCanTruncateInteger(node.arithNodeFlags())) { @@ -2279,9 +2265,9 @@ void SpeculativeJIT::compileAdd(Node& node) void SpeculativeJIT::compileArithSub(Node& node) { if (m_jit.graph().addShouldSpeculateInteger(node, m_jit.codeBlock())) { - if (isNumberConstant(node.child2())) { + if (isNumberConstant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); - int32_t imm2 = valueOfNumberConstantAsInt32(node.child2()); + int32_t imm2 = valueOfNumberConstantAsInt32(node.child2().index()); GPRTemporary result(this); if (nodeCanTruncateInteger(node.arithNodeFlags())) { @@ -2294,8 +2280,8 @@ void SpeculativeJIT::compileArithSub(Node& node) return; } - if (isNumberConstant(node.child1())) { - int32_t imm1 = valueOfNumberConstantAsInt32(node.child1()); + if (isNumberConstant(node.child1().index())) { + int32_t imm1 = valueOfNumberConstantAsInt32(node.child1().index()); SpeculateIntegerOperand op2(this, node.child2()); GPRTemporary result(this); @@ -2421,7 +2407,7 @@ bool SpeculativeJIT::compare(Node& node, MacroAssembler::RelationalCondition con return false; } -bool SpeculativeJIT::compileStrictEqForConstant(Node& node, NodeIndex value, JSValue constant) +bool SpeculativeJIT::compileStrictEqForConstant(Node& node, NodeUse value, JSValue constant) { JSValueOperand op1(this, value); @@ -2498,14 +2484,14 @@ bool SpeculativeJIT::compileStrictEq(Node& node) // 1) If either operand is a constant and that constant is not a double, integer, // or string, then do a JSValue comparison. - if (isJSConstant(node.child1())) { - JSValue value = valueOfJSConstant(node.child1()); + if (isJSConstant(node.child1().index())) { + JSValue value = valueOfJSConstant(node.child1().index()); if (!value.isNumber() && !value.isString()) return compileStrictEqForConstant(node, node.child2(), value); } - if (isJSConstant(node.child2())) { - JSValue value = valueOfJSConstant(node.child2()); + if (isJSConstant(node.child2().index())) { + JSValue value = valueOfJSConstant(node.child2().index()); if (!value.isNumber() && !value.isString()) return compileStrictEqForConstant(node, node.child1(), value); } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index 0098da3a1..cfb2189cf 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -33,6 +33,7 @@ #include "DFGJITCompiler.h" #include "DFGOSRExit.h" #include "DFGOperations.h" +#include "MarkedAllocator.h" #include "ValueRecovery.h" namespace JSC { namespace DFG { @@ -181,6 +182,10 @@ public: { return m_jit.graph()[nodeIndex]; } + Node& at(NodeUse nodeUse) + { + return at(nodeUse.index()); + } GPRReg fillInteger(NodeIndex, DataFormat& returnFormat); FPRReg fillDouble(NodeIndex); @@ -217,6 +222,10 @@ public: GenerationInfo& info = m_generationInfo[virtualRegister]; return info.canReuse(); } + bool canReuse(NodeUse nodeUse) + { + return canReuse(nodeUse.index()); + } GPRReg reuse(GPRReg reg) { m_gprs.lock(reg); @@ -317,13 +326,17 @@ public: m_gprs.release(info.gpr()); #endif } + void use(NodeUse nodeUse) + { + use(nodeUse.index()); + } static void markCellCard(MacroAssembler&, GPRReg ownerGPR, GPRReg scratchGPR1, GPRReg scratchGPR2); static void writeBarrier(MacroAssembler&, GPRReg ownerGPR, GPRReg scratchGPR1, GPRReg scratchGPR2, WriteBarrierUseKind); - void writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeIndex valueIndex, WriteBarrierUseKind, GPRReg scratchGPR1 = InvalidGPRReg, GPRReg scratchGPR2 = InvalidGPRReg); + void writeBarrier(GPRReg ownerGPR, GPRReg valueGPR, NodeUse valueUse, WriteBarrierUseKind, GPRReg scratchGPR1 = InvalidGPRReg, GPRReg scratchGPR2 = InvalidGPRReg); void writeBarrier(GPRReg ownerGPR, JSCell* value, WriteBarrierUseKind, GPRReg scratchGPR1 = InvalidGPRReg, GPRReg scratchGPR2 = InvalidGPRReg); - void writeBarrier(JSCell* owner, GPRReg valueGPR, NodeIndex valueIndex, WriteBarrierUseKind, GPRReg scratchGPR1 = InvalidGPRReg); + void writeBarrier(JSCell* owner, GPRReg valueGPR, NodeUse valueUse, WriteBarrierUseKind, GPRReg scratchGPR1 = InvalidGPRReg); static GPRReg selectScratchGPR(GPRReg preserve1 = InvalidGPRReg, GPRReg preserve2 = InvalidGPRReg, GPRReg preserve3 = InvalidGPRReg, GPRReg preserve4 = InvalidGPRReg) { @@ -874,7 +887,7 @@ private: // Check if the lastNode is a branch on this node. Node& lastNode = at(lastNodeIndex); - return lastNode.op == Branch && lastNode.child1() == m_compileIndex ? lastNodeIndex : NoNode; + return lastNode.op == Branch && lastNode.child1().index() == m_compileIndex ? lastNodeIndex : NoNode; } void nonSpeculativeValueToNumber(Node&); @@ -884,15 +897,15 @@ private: enum SpillRegistersMode { NeedToSpill, DontSpill }; #if USE(JSVALUE64) JITCompiler::Call cachedGetById(CodeOrigin, GPRReg baseGPR, GPRReg resultGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill); - void cachedPutById(CodeOrigin, GPRReg base, GPRReg value, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); + void cachedPutById(CodeOrigin, GPRReg base, GPRReg value, NodeUse valueUse, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); #elif USE(JSVALUE32_64) JITCompiler::Call cachedGetById(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, GPRReg scratchGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget = JITCompiler::Jump(), SpillRegistersMode = NeedToSpill); - void cachedPutById(CodeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); + void cachedPutById(CodeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, NodeUse valueUse, GPRReg scratchGPR, unsigned identifierNumber, PutKind, JITCompiler::Jump slowPathTarget = JITCompiler::Jump()); #endif - void nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, bool invert = false); - void nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeIndex branchNodeIndex, bool invert = false); - bool nonSpeculativeCompareNull(Node&, NodeIndex operand, bool invert = false); + void nonSpeculativeNonPeepholeCompareNull(NodeUse operand, bool invert = false); + void nonSpeculativePeepholeBranchNull(NodeUse operand, NodeIndex branchNodeIndex, bool invert = false); + bool nonSpeculativeCompareNull(Node&, NodeUse operand, bool invert = false); void nonSpeculativePeepholeBranch(Node&, NodeIndex branchNodeIndex, MacroAssembler::RelationalCondition, S_DFGOperation_EJJ helperFunction); void nonSpeculativeNonPeepholeCompare(Node&, MacroAssembler::RelationalCondition, S_DFGOperation_EJJ helperFunction); @@ -1504,15 +1517,15 @@ private: void compilePeepHoleObjectEquality(Node&, NodeIndex branchNodeIndex, const ClassInfo*, PredictionChecker); void compileObjectEquality(Node&, const ClassInfo*, PredictionChecker); void compileValueAdd(Node&); - void compileObjectOrOtherLogicalNot(NodeIndex value, const ClassInfo*, bool needSpeculationCheck); + void compileObjectOrOtherLogicalNot(NodeUse value, const ClassInfo*, bool needSpeculationCheck); void compileLogicalNot(Node&); - void emitObjectOrOtherBranch(NodeIndex value, BlockIndex taken, BlockIndex notTaken, const ClassInfo*, bool needSpeculationCheck); + void emitObjectOrOtherBranch(NodeUse value, BlockIndex taken, BlockIndex notTaken, const ClassInfo*, bool needSpeculationCheck); void emitBranch(Node&); void compileIntegerCompare(Node&, MacroAssembler::RelationalCondition); void compileDoubleCompare(Node&, MacroAssembler::DoubleCondition); - bool compileStrictEqForConstant(Node&, NodeIndex value, JSValue constant); + bool compileStrictEqForConstant(Node&, NodeUse value, JSValue constant); bool compileStrictEq(Node&); @@ -1552,9 +1565,9 @@ private: template<typename T> void emitAllocateJSFinalObject(T structure, GPRReg resultGPR, GPRReg scratchGPR, MacroAssembler::JumpList& slowPath) { - MarkedSpace::SizeClass* sizeClass = &m_jit.globalData()->heap.sizeClassForObject(sizeof(JSFinalObject)); + MarkedAllocator* allocator = &m_jit.globalData()->heap.allocatorForObject(sizeof(JSFinalObject)); - m_jit.loadPtr(&sizeClass->firstFreeCell, resultGPR); + m_jit.loadPtr(&allocator->m_firstFreeCell, resultGPR); slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, resultGPR)); // The object is half-allocated: we have what we know is a fresh object, but @@ -1566,7 +1579,7 @@ private: // Now that we have scratchGPR back, remove the object from the free list m_jit.loadPtr(MacroAssembler::Address(resultGPR), scratchGPR); - m_jit.storePtr(scratchGPR, &sizeClass->firstFreeCell); + m_jit.storePtr(scratchGPR, &allocator->m_firstFreeCell); // Initialize the object's classInfo pointer m_jit.storePtr(MacroAssembler::TrustedImmPtr(&JSFinalObject::s_info), MacroAssembler::Address(resultGPR, JSCell::classInfoOffset())); @@ -1592,6 +1605,10 @@ private: return; m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this)); } + void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeUse nodeUse, MacroAssembler::Jump jumpToFail) + { + speculationCheck(kind, jsValueSource, nodeUse.index(), jumpToFail); + } // Add a set of speculation checks without additional recovery. void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::JumpList& jumpsToFail) { @@ -1599,6 +1616,10 @@ private: for (unsigned i = 0; i < JumpVector.size(); ++i) speculationCheck(kind, jsValueSource, nodeIndex, JumpVector[i]); } + void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeUse nodeUse, MacroAssembler::JumpList& jumpsToFail) + { + speculationCheck(kind, jsValueSource, nodeUse.index(), jumpsToFail); + } // Add a speculation check with additional recovery. void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeIndex nodeIndex, MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery) { @@ -1607,6 +1628,10 @@ private: m_jit.codeBlock()->appendSpeculationRecovery(recovery); m_jit.codeBlock()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.valueProfileFor(nodeIndex), jumpToFail, this, m_jit.codeBlock()->numberOfSpeculationRecoveries())); } + void speculationCheck(ExitKind kind, JSValueSource jsValueSource, NodeUse nodeUse, MacroAssembler::Jump jumpToFail, const SpeculationRecovery& recovery) + { + speculationCheck(kind, jsValueSource, nodeUse.index(), jumpToFail, recovery); + } // Called when we statically determine that a speculation will fail. void terminateSpeculativeExecution(ExitKind kind, JSValueRegs jsValueRegs, NodeIndex nodeIndex) @@ -1619,6 +1644,10 @@ private: speculationCheck(kind, jsValueRegs, nodeIndex, m_jit.jump()); m_compileOkay = false; } + void terminateSpeculativeExecution(ExitKind kind, JSValueRegs jsValueRegs, NodeUse nodeUse) + { + terminateSpeculativeExecution(kind, jsValueRegs, nodeUse.index()); + } template<bool strict> GPRReg fillSpeculateIntInternal(NodeIndex, DataFormat& returnFormat); @@ -1711,16 +1740,16 @@ private: class IntegerOperand { public: - explicit IntegerOperand(SpeculativeJIT* jit, NodeIndex index) + explicit IntegerOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) #ifndef NDEBUG , m_format(DataFormatNone) #endif { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } @@ -1763,13 +1792,13 @@ private: class DoubleOperand { public: - explicit DoubleOperand(SpeculativeJIT* jit, NodeIndex index) + explicit DoubleOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_fprOrInvalid(InvalidFPRReg) { ASSERT(m_jit); - if (jit->isFilledDouble(index)) + if (jit->isFilledDouble(m_index)) fpr(); } @@ -1804,9 +1833,9 @@ private: class JSValueOperand { public: - explicit JSValueOperand(SpeculativeJIT* jit, NodeIndex index) + explicit JSValueOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) #if USE(JSVALUE64) , m_gprOrInvalid(InvalidGPRReg) #elif USE(JSVALUE32_64) @@ -1815,12 +1844,12 @@ public: { ASSERT(m_jit); #if USE(JSVALUE64) - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); #elif USE(JSVALUE32_64) m_register.pair.tagGPR = InvalidGPRReg; m_register.pair.payloadGPR = InvalidGPRReg; - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) fill(); #endif } @@ -1918,13 +1947,13 @@ private: class StorageOperand { public: - explicit StorageOperand(SpeculativeJIT* jit, NodeIndex index) + explicit StorageOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } @@ -2087,16 +2116,16 @@ private: class SpeculateIntegerOperand { public: - explicit SpeculateIntegerOperand(SpeculativeJIT* jit, NodeIndex index) + explicit SpeculateIntegerOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) #ifndef NDEBUG , m_format(DataFormatNone) #endif { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } @@ -2134,13 +2163,13 @@ private: class SpeculateStrictInt32Operand { public: - explicit SpeculateStrictInt32Operand(SpeculativeJIT* jit, NodeIndex index) + explicit SpeculateStrictInt32Operand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } @@ -2175,13 +2204,13 @@ private: class SpeculateDoubleOperand { public: - explicit SpeculateDoubleOperand(SpeculativeJIT* jit, NodeIndex index) + explicit SpeculateDoubleOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_fprOrInvalid(InvalidFPRReg) { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) fpr(); } @@ -2211,13 +2240,13 @@ private: class SpeculateCellOperand { public: - explicit SpeculateCellOperand(SpeculativeJIT* jit, NodeIndex index) + explicit SpeculateCellOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } @@ -2252,13 +2281,13 @@ private: class SpeculateBooleanOperand { public: - explicit SpeculateBooleanOperand(SpeculativeJIT* jit, NodeIndex index) + explicit SpeculateBooleanOperand(SpeculativeJIT* jit, NodeUse use) : m_jit(jit) - , m_index(index) + , m_index(use.index()) , m_gprOrInvalid(InvalidGPRReg) { ASSERT(m_jit); - if (jit->isFilled(index)) + if (jit->isFilled(m_index)) gpr(); } diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index e1f92ba9e..a2cdec086 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -360,7 +360,7 @@ bool SpeculativeJIT::fillJSValue(NodeIndex nodeIndex, GPRReg& tagGPR, GPRReg& pa void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) { - if (isKnownNumeric(node.child1())) { + if (isKnownNumeric(node.child1().index())) { JSValueOperand op1(this, node.child1()); op1.fill(); if (op1.isDouble()) { @@ -381,8 +381,8 @@ void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) GPRTemporary resultTag(this, op1); GPRTemporary resultPayload(this, op1, false); - ASSERT(!isInt32Constant(node.child1())); - ASSERT(!isNumberConstant(node.child1())); + ASSERT(!isInt32Constant(node.child1().index())); + ASSERT(!isNumberConstant(node.child1().index())); GPRReg tagGPR = op1.tagGPR(); GPRReg payloadGPR = op1.payloadGPR(); @@ -415,9 +415,9 @@ void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) void SpeculativeJIT::nonSpeculativeValueToInt32(Node& node) { - ASSERT(!isInt32Constant(node.child1())); + ASSERT(!isInt32Constant(node.child1().index())); - if (isKnownInteger(node.child1())) { + if (isKnownInteger(node.child1().index())) { IntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); m_jit.move(op1.gpr(), result.gpr()); @@ -532,14 +532,14 @@ JITCompiler::Call SpeculativeJIT::cachedGetById(CodeOrigin codeOrigin, GPRReg ba return functionCall; } -void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget) +void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, GPRReg valueTagGPR, GPRReg valuePayloadGPR, NodeUse valueUse, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget) { m_jit.beginUninterruptedSequence(); JITCompiler::DataLabelPtr structureToCompare; JITCompiler::Jump structureCheck = m_jit.branchPtrWithPatch(JITCompiler::NotEqual, JITCompiler::Address(basePayloadGPR, JSCell::structureOffset()), structureToCompare, JITCompiler::TrustedImmPtr(reinterpret_cast<void*>(-1))); m_jit.endUninterruptedSequence(); - writeBarrier(basePayloadGPR, valueTagGPR, valueIndex, WriteBarrierForPropertyAccess, scratchGPR); + writeBarrier(basePayloadGPR, valueTagGPR, valueUse, WriteBarrierForPropertyAccess, scratchGPR); m_jit.loadPtr(JITCompiler::Address(basePayloadGPR, JSObject::offsetOfPropertyStorage()), scratchGPR); JITCompiler::DataLabel32 tagStoreWithPatch = m_jit.store32WithAddressOffsetPatch(valueTagGPR, JITCompiler::Address(scratchGPR, OBJECT_OFFSETOF(EncodedValueDescriptor, asBits.tag))); @@ -576,7 +576,7 @@ void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg basePayloadGPR, m_jit.addPropertyAccess(PropertyAccessRecord(codeOrigin, structureToCompare, functionCall, structureCheck, JITCompiler::DataLabelCompact(tagStoreWithPatch.label()), JITCompiler::DataLabelCompact(payloadStoreWithPatch.label()), slowCase, doneLabel, safeCast<int8_t>(basePayloadGPR), safeCast<int8_t>(valueTagGPR), safeCast<int8_t>(valuePayloadGPR), safeCast<int8_t>(scratchGPR))); } -void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, bool invert) +void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeUse operand, bool invert) { JSValueOperand arg(this, operand); GPRReg argTagGPR = arg.tagGPR(); @@ -586,13 +586,13 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, boo GPRReg resultPayloadGPR = resultPayload.gpr(); JITCompiler::Jump notCell; - if (!isKnownCell(operand)) + if (!isKnownCell(operand.index())) notCell = m_jit.branch32(MacroAssembler::NotEqual, argTagGPR, TrustedImm32(JSValue::CellTag)); m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultPayloadGPR); m_jit.test8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultPayloadGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), resultPayloadGPR); - if (!isKnownCell(operand)) { + if (!isKnownCell(operand.index())) { JITCompiler::Jump done = m_jit.jump(); notCell.link(&m_jit); @@ -608,7 +608,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, boo booleanResult(resultPayloadGPR, m_compileIndex); } -void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeIndex branchNodeIndex, bool invert) +void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeUse operand, NodeIndex branchNodeIndex, bool invert) { Node& branchNode = at(branchNodeIndex); BlockIndex taken = branchNode.takenBlockIndex(); @@ -630,13 +630,13 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeInd JITCompiler::Jump notCell; - if (!isKnownCell(operand)) + if (!isKnownCell(operand.index())) notCell = m_jit.branch32(MacroAssembler::NotEqual, argTagGPR, TrustedImm32(JSValue::CellTag)); m_jit.loadPtr(JITCompiler::Address(argPayloadGPR, JSCell::structureOffset()), resultGPR); addBranch(m_jit.branchTest8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined)), taken); - if (!isKnownCell(operand)) { + if (!isKnownCell(operand.index())) { addBranch(m_jit.jump(), notTaken); notCell.link(&m_jit); @@ -651,7 +651,7 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeInd addBranch(m_jit.jump(), notTaken); } -bool SpeculativeJIT::nonSpeculativeCompareNull(Node& node, NodeIndex operand, bool invert) +bool SpeculativeJIT::nonSpeculativeCompareNull(Node& node, NodeUse operand, bool invert) { NodeIndex branchNodeIndex = detectPeepHoleBranch(); if (branchNodeIndex != NoNode) { @@ -698,7 +698,7 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node& node, NodeIndex branchNo JITCompiler::JumpList slowPath; - if (isKnownNotInteger(node.child1()) || isKnownNotInteger(node.child2())) { + if (isKnownNotInteger(node.child1().index()) || isKnownNotInteger(node.child2().index())) { GPRResult result(this); GPRReg resultGPR = result.gpr(); @@ -716,14 +716,14 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node& node, NodeIndex branchNo arg1.use(); arg2.use(); - if (!isKnownInteger(node.child1())) + if (!isKnownInteger(node.child1().index())) slowPath.append(m_jit.branch32(MacroAssembler::NotEqual, arg1TagGPR, JITCompiler::TrustedImm32(JSValue::Int32Tag))); - if (!isKnownInteger(node.child2())) + if (!isKnownInteger(node.child2().index())) slowPath.append(m_jit.branch32(MacroAssembler::NotEqual, arg2TagGPR, JITCompiler::TrustedImm32(JSValue::Int32Tag))); addBranch(m_jit.branch32(cond, arg1PayloadGPR, arg2PayloadGPR), taken); - if (!isKnownInteger(node.child1()) || !isKnownInteger(node.child2())) { + if (!isKnownInteger(node.child1().index()) || !isKnownInteger(node.child2().index())) { addBranch(m_jit.jump(), notTaken); slowPath.link(&m_jit); @@ -751,7 +751,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node& node, MacroAssembler JITCompiler::JumpList slowPath; - if (isKnownNotInteger(node.child1()) || isKnownNotInteger(node.child2())) { + if (isKnownNotInteger(node.child1().index()) || isKnownNotInteger(node.child2().index())) { GPRResult result(this); GPRReg resultPayloadGPR = result.gpr(); @@ -769,14 +769,14 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node& node, MacroAssembler arg1.use(); arg2.use(); - if (!isKnownInteger(node.child1())) + if (!isKnownInteger(node.child1().index())) slowPath.append(m_jit.branch32(MacroAssembler::NotEqual, arg1TagGPR, JITCompiler::TrustedImm32(JSValue::Int32Tag))); - if (!isKnownInteger(node.child2())) + if (!isKnownInteger(node.child2().index())) slowPath.append(m_jit.branch32(MacroAssembler::NotEqual, arg2TagGPR, JITCompiler::TrustedImm32(JSValue::Int32Tag))); m_jit.compare32(cond, arg1PayloadGPR, arg2PayloadGPR, resultPayloadGPR); - if (!isKnownInteger(node.child1()) || !isKnownInteger(node.child2())) { + if (!isKnownInteger(node.child1().index()) || !isKnownInteger(node.child2().index())) { JITCompiler::Jump haveResult = m_jit.jump(); slowPath.link(&m_jit); @@ -822,7 +822,7 @@ void SpeculativeJIT::nonSpeculativePeepholeStrictEq(Node& node, NodeIndex branch arg1.use(); arg2.use(); - if (isKnownCell(node.child1()) && isKnownCell(node.child2())) { + if (isKnownCell(node.child1().index()) && isKnownCell(node.child2().index())) { // see if we get lucky: if the arguments are cells and they reference the same // cell, then they must be strictly equal. addBranch(m_jit.branchPtr(JITCompiler::Equal, arg1PayloadGPR, arg2PayloadGPR), invert ? notTaken : taken); @@ -861,7 +861,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq(Node& node, bool invert) arg1.use(); arg2.use(); - if (isKnownCell(node.child1()) && isKnownCell(node.child2())) { + if (isKnownCell(node.child1().index()) && isKnownCell(node.child2().index())) { // see if we get lucky: if the arguments are cells and they reference the same // cell, then they must be strictly equal. JITCompiler::Jump notEqualCase = m_jit.branchPtr(JITCompiler::NotEqual, arg1PayloadGPR, arg2PayloadGPR); @@ -908,11 +908,11 @@ void SpeculativeJIT::emitCall(Node& node) CallLinkInfo::CallType callType = node.op == Call ? CallLinkInfo::Call : CallLinkInfo::Construct; - NodeIndex calleeNodeIndex = m_jit.graph().m_varArgChildren[node.firstChild()]; - JSValueOperand callee(this, calleeNodeIndex); + NodeUse calleeNodeUse = m_jit.graph().m_varArgChildren[node.firstChild()]; + JSValueOperand callee(this, calleeNodeUse); GPRReg calleeTagGPR = callee.tagGPR(); GPRReg calleePayloadGPR = callee.payloadGPR(); - use(calleeNodeIndex); + use(calleeNodeUse); // The call instruction's first child is either the function (normal call) or the // receiver (method call). subsequent children are the arguments. @@ -924,11 +924,11 @@ void SpeculativeJIT::emitCall(Node& node) m_jit.store32(calleeTagGPR, callFrameTagSlot(RegisterFile::Callee)); for (int i = 0; i < numPassedArgs; i++) { - NodeIndex argNodeIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1 + i]; - JSValueOperand arg(this, argNodeIndex); + NodeUse argNodeUse = m_jit.graph().m_varArgChildren[node.firstChild() + 1 + i]; + JSValueOperand arg(this, argNodeUse); GPRReg argTagGPR = arg.tagGPR(); GPRReg argPayloadGPR = arg.payloadGPR(); - use(argNodeIndex); + use(argNodeUse); m_jit.store32(argTagGPR, argumentTagSlot(i + dummyThisArgument)); m_jit.store32(argPayloadGPR, argumentPayloadSlot(i + dummyThisArgument)); @@ -1439,7 +1439,7 @@ void SpeculativeJIT::compileValueAdd(Node& node) GPRResult2 resultTag(this); GPRResult resultPayload(this); - if (isKnownNotNumber(node.child1()) || isKnownNotNumber(node.child2())) + if (isKnownNotNumber(node.child1().index()) || isKnownNotNumber(node.child2().index())) callOperation(operationValueAddNotNumber, resultTag.gpr(), resultPayload.gpr(), op1TagGPR, op1PayloadGPR, op2TagGPR, op2PayloadGPR); else callOperation(operationValueAdd, resultTag.gpr(), resultPayload.gpr(), op1TagGPR, op1PayloadGPR, op2TagGPR, op2PayloadGPR); @@ -1447,9 +1447,9 @@ void SpeculativeJIT::compileValueAdd(Node& node) jsValueResult(resultTag.gpr(), resultPayload.gpr(), m_compileIndex); } -void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const ClassInfo* classInfo, bool needSpeculationCheck) +void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeUse nodeUse, const ClassInfo* classInfo, bool needSpeculationCheck) { - JSValueOperand value(this, nodeIndex); + JSValueOperand value(this, nodeUse); GPRTemporary resultPayload(this); GPRReg valueTagGPR = value.tagGPR(); GPRReg valuePayloadGPR = value.payloadGPR(); @@ -1457,7 +1457,7 @@ void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const C MacroAssembler::Jump notCell = m_jit.branch32(MacroAssembler::NotEqual, valueTagGPR, TrustedImm32(JSValue::CellTag)); if (needSpeculationCheck) - speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); m_jit.move(TrustedImm32(0), resultPayloadGPR); MacroAssembler::Jump done = m_jit.jump(); @@ -1467,7 +1467,7 @@ void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const C if (needSpeculationCheck) { m_jit.move(valueTagGPR, resultPayloadGPR); m_jit.or32(TrustedImm32(1), resultPayloadGPR); - speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, resultPayloadGPR, TrustedImm32(JSValue::NullTag))); + speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branch32(MacroAssembler::NotEqual, resultPayloadGPR, TrustedImm32(JSValue::NullTag))); } m_jit.move(TrustedImm32(1), resultPayloadGPR); @@ -1478,7 +1478,7 @@ void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const C void SpeculativeJIT::compileLogicalNot(Node& node) { - if (isKnownBoolean(node.child1()) || isBooleanPrediction(m_jit.getPrediction(node.child1()))) { + if (isKnownBoolean(node.child1().index()) || isBooleanPrediction(m_jit.getPrediction(node.child1().index()))) { SpeculateBooleanOperand value(this, node.child1()); GPRTemporary result(this, value); m_jit.xor32(TrustedImm32(1), value.gpr(), result.gpr()); @@ -1535,9 +1535,9 @@ void SpeculativeJIT::compileLogicalNot(Node& node) booleanResult(resultPayloadGPR, m_compileIndex, UseChildrenCalledExplicitly); } -void SpeculativeJIT::emitObjectOrOtherBranch(NodeIndex nodeIndex, BlockIndex taken, BlockIndex notTaken, const ClassInfo* classInfo, bool needSpeculationCheck) +void SpeculativeJIT::emitObjectOrOtherBranch(NodeUse nodeUse, BlockIndex taken, BlockIndex notTaken, const ClassInfo* classInfo, bool needSpeculationCheck) { - JSValueOperand value(this, nodeIndex); + JSValueOperand value(this, nodeUse); GPRTemporary scratch(this); GPRReg valueTagGPR = value.tagGPR(); GPRReg valuePayloadGPR = value.payloadGPR(); @@ -1545,7 +1545,7 @@ void SpeculativeJIT::emitObjectOrOtherBranch(NodeIndex nodeIndex, BlockIndex tak MacroAssembler::Jump notCell = m_jit.branch32(MacroAssembler::NotEqual, valueTagGPR, TrustedImm32(JSValue::CellTag)); if (needSpeculationCheck) - speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valuePayloadGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); addBranch(m_jit.jump(), taken); notCell.link(&m_jit); @@ -1554,7 +1554,7 @@ void SpeculativeJIT::emitObjectOrOtherBranch(NodeIndex nodeIndex, BlockIndex tak if (needSpeculationCheck) { m_jit.move(valueTagGPR, scratchGPR); m_jit.or32(TrustedImm32(1), scratchGPR); - speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeIndex, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag))); + speculationCheck(BadType, JSValueRegs(valueTagGPR, valuePayloadGPR), nodeUse, m_jit.branch32(MacroAssembler::NotEqual, scratchGPR, TrustedImm32(JSValue::NullTag))); } if (notTaken != (m_block + 1)) @@ -1568,7 +1568,7 @@ void SpeculativeJIT::emitBranch(Node& node) BlockIndex taken = node.takenBlockIndex(); BlockIndex notTaken = node.notTakenBlockIndex(); - if (isKnownBoolean(node.child1())) { + if (isKnownBoolean(node.child1().index())) { SpeculateBooleanOperand value(this, node.child1()); MacroAssembler::ResultCondition condition = MacroAssembler::NonZero; @@ -1800,18 +1800,18 @@ void SpeculativeJIT::compile(Node& node) case BitAnd: case BitOr: case BitXor: - if (isInt32Constant(node.child1())) { + if (isInt32Constant(node.child1().index())) { SpeculateIntegerOperand op2(this, node.child2()); GPRTemporary result(this, op2); - bitOp(op, valueOfInt32Constant(node.child1()), op2.gpr(), result.gpr()); + bitOp(op, valueOfInt32Constant(node.child1().index()), op2.gpr(), result.gpr()); integerResult(result.gpr(), m_compileIndex); - } else if (isInt32Constant(node.child2())) { + } else if (isInt32Constant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); - bitOp(op, valueOfInt32Constant(node.child2()), op1.gpr(), result.gpr()); + bitOp(op, valueOfInt32Constant(node.child2().index()), op1.gpr(), result.gpr()); integerResult(result.gpr(), m_compileIndex); } else { @@ -1830,11 +1830,11 @@ void SpeculativeJIT::compile(Node& node) case BitRShift: case BitLShift: case BitURShift: - if (isInt32Constant(node.child2())) { + if (isInt32Constant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); - shiftOp(op, op1.gpr(), valueOfInt32Constant(node.child2()) & 0x1f, result.gpr()); + shiftOp(op, op1.gpr(), valueOfInt32Constant(node.child2().index()) & 0x1f, result.gpr()); integerResult(result.gpr(), m_compileIndex); } else { @@ -1861,30 +1861,6 @@ void SpeculativeJIT::compile(Node& node) break; } - case ValueToNumber: { - if (at(node.child1()).shouldNotSpeculateInteger()) { - SpeculateDoubleOperand op1(this, node.child1()); - FPRTemporary result(this, op1); - m_jit.moveDouble(op1.fpr(), result.fpr()); - doubleResult(result.fpr(), m_compileIndex); - break; - } - - SpeculateIntegerOperand op1(this, node.child1()); - GPRTemporary result(this, op1); - m_jit.move(op1.gpr(), result.gpr()); - integerResult(result.gpr(), m_compileIndex, op1.format()); - break; - } - - case ValueToDouble: { - SpeculateDoubleOperand op1(this, node.child1()); - FPRTemporary result(this, op1); - m_jit.moveDouble(op1.fpr(), result.fpr()); - doubleResult(result.fpr(), m_compileIndex); - break; - } - case ValueAdd: case ArithAdd: compileAdd(node); @@ -2091,12 +2067,12 @@ void SpeculativeJIT::compile(Node& node) break; case CompareEq: - if (isNullConstant(node.child1())) { + if (isNullConstant(node.child1().index())) { if (nonSpeculativeCompareNull(node, node.child2())) return; break; } - if (isNullConstant(node.child2())) { + if (isNullConstant(node.child2().index())) { if (nonSpeculativeCompareNull(node, node.child1())) return; break; @@ -2631,7 +2607,7 @@ void SpeculativeJIT::compile(Node& node) } case Branch: - if (isStrictInt32(node.child1()) || at(node.child1()).shouldSpeculateInteger()) { + if (isStrictInt32(node.child1().index()) || at(node.child1()).shouldSpeculateInteger()) { SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = node.takenBlockIndex(); @@ -2720,7 +2696,7 @@ void SpeculativeJIT::compile(Node& node) // FIXME: Add string speculation here. - bool wasPrimitive = isKnownNumeric(node.child1()) || isKnownBoolean(node.child1()); + bool wasPrimitive = isKnownNumeric(node.child1().index()) || isKnownBoolean(node.child1().index()); JSValueOperand op1(this, node.child1()); GPRTemporary resultTag(this, op1); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 139dedded..0dc207f75 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -360,7 +360,7 @@ GPRReg SpeculativeJIT::fillJSValue(NodeIndex nodeIndex) void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) { - if (isKnownNumeric(node.child1())) { + if (isKnownNumeric(node.child1().index())) { JSValueOperand op1(this, node.child1()); GPRTemporary result(this, op1); m_jit.move(op1.gpr(), result.gpr()); @@ -371,8 +371,8 @@ void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) JSValueOperand op1(this, node.child1()); GPRTemporary result(this); - ASSERT(!isInt32Constant(node.child1())); - ASSERT(!isNumberConstant(node.child1())); + ASSERT(!isInt32Constant(node.child1().index())); + ASSERT(!isNumberConstant(node.child1().index())); GPRReg jsValueGpr = op1.gpr(); GPRReg gpr = result.gpr(); @@ -404,9 +404,9 @@ void SpeculativeJIT::nonSpeculativeValueToNumber(Node& node) void SpeculativeJIT::nonSpeculativeValueToInt32(Node& node) { - ASSERT(!isInt32Constant(node.child1())); + ASSERT(!isInt32Constant(node.child1().index())); - if (isKnownInteger(node.child1())) { + if (isKnownInteger(node.child1().index())) { IntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); m_jit.move(op1.gpr(), result.gpr()); @@ -512,13 +512,13 @@ JITCompiler::Call SpeculativeJIT::cachedGetById(CodeOrigin codeOrigin, GPRReg ba return functionCall; } -void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg valueGPR, NodeIndex valueIndex, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget) +void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg valueGPR, NodeUse valueUse, GPRReg scratchGPR, unsigned identifierNumber, PutKind putKind, JITCompiler::Jump slowPathTarget) { JITCompiler::DataLabelPtr structureToCompare; JITCompiler::Jump structureCheck = m_jit.branchPtrWithPatch(JITCompiler::NotEqual, JITCompiler::Address(baseGPR, JSCell::structureOffset()), structureToCompare, JITCompiler::TrustedImmPtr(reinterpret_cast<void*>(-1))); - writeBarrier(baseGPR, valueGPR, valueIndex, WriteBarrierForPropertyAccess, scratchGPR); + writeBarrier(baseGPR, valueGPR, valueUse, WriteBarrierForPropertyAccess, scratchGPR); m_jit.loadPtr(JITCompiler::Address(baseGPR, JSObject::offsetOfPropertyStorage()), scratchGPR); JITCompiler::DataLabel32 storeWithPatch = m_jit.storePtrWithAddressOffsetPatch(valueGPR, JITCompiler::Address(scratchGPR, 0)); @@ -554,7 +554,7 @@ void SpeculativeJIT::cachedPutById(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg m_jit.addPropertyAccess(PropertyAccessRecord(codeOrigin, structureToCompare, functionCall, structureCheck, JITCompiler::DataLabelCompact(storeWithPatch.label()), slowCase, doneLabel, safeCast<int8_t>(baseGPR), safeCast<int8_t>(valueGPR), safeCast<int8_t>(scratchGPR))); } -void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, bool invert) +void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeUse operand, bool invert) { JSValueOperand arg(this, operand); GPRReg argGPR = arg.gpr(); @@ -564,13 +564,13 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, boo JITCompiler::Jump notCell; - if (!isKnownCell(operand)) + if (!isKnownCell(operand.index())) notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, argGPR, GPRInfo::tagMaskRegister); m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); m_jit.test8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined), resultGPR); - if (!isKnownCell(operand)) { + if (!isKnownCell(operand.index())) { JITCompiler::Jump done = m_jit.jump(); notCell.link(&m_jit); @@ -586,7 +586,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompareNull(NodeIndex operand, boo jsValueResult(resultGPR, m_compileIndex, DataFormatJSBoolean); } -void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeIndex branchNodeIndex, bool invert) +void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeUse operand, NodeIndex branchNodeIndex, bool invert) { Node& branchNode = at(branchNodeIndex); BlockIndex taken = branchNode.takenBlockIndex(); @@ -607,13 +607,13 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeInd JITCompiler::Jump notCell; - if (!isKnownCell(operand)) + if (!isKnownCell(operand.index())) notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, argGPR, GPRInfo::tagMaskRegister); m_jit.loadPtr(JITCompiler::Address(argGPR, JSCell::structureOffset()), resultGPR); addBranch(m_jit.branchTest8(invert ? JITCompiler::Zero : JITCompiler::NonZero, JITCompiler::Address(resultGPR, Structure::typeInfoFlagsOffset()), JITCompiler::TrustedImm32(MasqueradesAsUndefined)), taken); - if (!isKnownCell(operand)) { + if (!isKnownCell(operand.index())) { addBranch(m_jit.jump(), notTaken); notCell.link(&m_jit); @@ -627,7 +627,7 @@ void SpeculativeJIT::nonSpeculativePeepholeBranchNull(NodeIndex operand, NodeInd addBranch(m_jit.jump(), notTaken); } -bool SpeculativeJIT::nonSpeculativeCompareNull(Node& node, NodeIndex operand, bool invert) +bool SpeculativeJIT::nonSpeculativeCompareNull(Node& node, NodeUse operand, bool invert) { NodeIndex branchNodeIndex = detectPeepHoleBranch(); if (branchNodeIndex != NoNode) { @@ -672,7 +672,7 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node& node, NodeIndex branchNo JITCompiler::JumpList slowPath; - if (isKnownNotInteger(node.child1()) || isKnownNotInteger(node.child2())) { + if (isKnownNotInteger(node.child1().index()) || isKnownNotInteger(node.child2().index())) { GPRResult result(this); GPRReg resultGPR = result.gpr(); @@ -690,14 +690,14 @@ void SpeculativeJIT::nonSpeculativePeepholeBranch(Node& node, NodeIndex branchNo arg1.use(); arg2.use(); - if (!isKnownInteger(node.child1())) + if (!isKnownInteger(node.child1().index())) slowPath.append(m_jit.branchPtr(MacroAssembler::Below, arg1GPR, GPRInfo::tagTypeNumberRegister)); - if (!isKnownInteger(node.child2())) + if (!isKnownInteger(node.child2().index())) slowPath.append(m_jit.branchPtr(MacroAssembler::Below, arg2GPR, GPRInfo::tagTypeNumberRegister)); addBranch(m_jit.branch32(cond, arg1GPR, arg2GPR), taken); - if (!isKnownInteger(node.child1()) || !isKnownInteger(node.child2())) { + if (!isKnownInteger(node.child1().index()) || !isKnownInteger(node.child2().index())) { addBranch(m_jit.jump(), notTaken); slowPath.link(&m_jit); @@ -723,7 +723,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node& node, MacroAssembler JITCompiler::JumpList slowPath; - if (isKnownNotInteger(node.child1()) || isKnownNotInteger(node.child2())) { + if (isKnownNotInteger(node.child1().index()) || isKnownNotInteger(node.child2().index())) { GPRResult result(this); GPRReg resultGPR = result.gpr(); @@ -742,14 +742,14 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeCompare(Node& node, MacroAssembler arg1.use(); arg2.use(); - if (!isKnownInteger(node.child1())) + if (!isKnownInteger(node.child1().index())) slowPath.append(m_jit.branchPtr(MacroAssembler::Below, arg1GPR, GPRInfo::tagTypeNumberRegister)); - if (!isKnownInteger(node.child2())) + if (!isKnownInteger(node.child2().index())) slowPath.append(m_jit.branchPtr(MacroAssembler::Below, arg2GPR, GPRInfo::tagTypeNumberRegister)); m_jit.compare32(cond, arg1GPR, arg2GPR, resultGPR); - if (!isKnownInteger(node.child1()) || !isKnownInteger(node.child2())) { + if (!isKnownInteger(node.child1().index()) || !isKnownInteger(node.child2().index())) { JITCompiler::Jump haveResult = m_jit.jump(); slowPath.link(&m_jit); @@ -795,7 +795,7 @@ void SpeculativeJIT::nonSpeculativePeepholeStrictEq(Node& node, NodeIndex branch arg1.use(); arg2.use(); - if (isKnownCell(node.child1()) && isKnownCell(node.child2())) { + if (isKnownCell(node.child1().index()) && isKnownCell(node.child2().index())) { // see if we get lucky: if the arguments are cells and they reference the same // cell, then they must be strictly equal. addBranch(m_jit.branchPtr(JITCompiler::Equal, arg1GPR, arg2GPR), invert ? notTaken : taken); @@ -844,7 +844,7 @@ void SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq(Node& node, bool invert) arg1.use(); arg2.use(); - if (isKnownCell(node.child1()) && isKnownCell(node.child2())) { + if (isKnownCell(node.child1().index()) && isKnownCell(node.child2().index())) { // see if we get lucky: if the arguments are cells and they reference the same // cell, then they must be strictly equal. JITCompiler::Jump notEqualCase = m_jit.branchPtr(JITCompiler::NotEqual, arg1GPR, arg2GPR); @@ -917,10 +917,10 @@ void SpeculativeJIT::emitCall(Node& node) CallLinkInfo::CallType callType = node.op == Call ? CallLinkInfo::Call : CallLinkInfo::Construct; - NodeIndex calleeNodeIndex = m_jit.graph().m_varArgChildren[node.firstChild()]; - JSValueOperand callee(this, calleeNodeIndex); + NodeUse calleeNodeUse = m_jit.graph().m_varArgChildren[node.firstChild()]; + JSValueOperand callee(this, calleeNodeUse); GPRReg calleeGPR = callee.gpr(); - use(calleeNodeIndex); + use(calleeNodeUse); // The call instruction's first child is either the function (normal call) or the // receiver (method call). subsequent children are the arguments. @@ -931,10 +931,10 @@ void SpeculativeJIT::emitCall(Node& node) m_jit.storePtr(calleeGPR, callFrameSlot(RegisterFile::Callee)); for (int i = 0; i < numPassedArgs; i++) { - NodeIndex argNodeIndex = m_jit.graph().m_varArgChildren[node.firstChild() + 1 + i]; - JSValueOperand arg(this, argNodeIndex); + NodeUse argNodeUse = m_jit.graph().m_varArgChildren[node.firstChild() + 1 + i]; + JSValueOperand arg(this, argNodeUse); GPRReg argGPR = arg.gpr(); - use(argNodeIndex); + use(argNodeUse); m_jit.storePtr(argGPR, argumentSlot(i + dummyThisArgument)); } @@ -1459,9 +1459,9 @@ void SpeculativeJIT::compileObjectEquality(Node& node, const ClassInfo* classInf GPRReg resultGPR = result.gpr(); if (!predictionCheck(m_state.forNode(node.child1()).m_type)) - speculationCheck(BadType, JSValueRegs(op1GPR), node.child1(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(op1GPR), node.child1().index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op1GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); if (!predictionCheck(m_state.forNode(node.child2()).m_type)) - speculationCheck(BadType, JSValueRegs(op2GPR), node.child2(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(op2GPR), node.child2().index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(op2GPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); MacroAssembler::Jump falseCase = m_jit.branchPtr(MacroAssembler::NotEqual, op1GPR, op2GPR); m_jit.move(Imm32(ValueTrue), resultGPR); @@ -1511,7 +1511,7 @@ void SpeculativeJIT::compileValueAdd(Node& node) flushRegisters(); GPRResult result(this); - if (isKnownNotNumber(node.child1()) || isKnownNotNumber(node.child2())) + if (isKnownNotNumber(node.child1().index()) || isKnownNotNumber(node.child2().index())) callOperation(operationValueAddNotNumber, result.gpr(), op1GPR, op2GPR); else callOperation(operationValueAdd, result.gpr(), op1GPR, op2GPR); @@ -1519,16 +1519,16 @@ void SpeculativeJIT::compileValueAdd(Node& node) jsValueResult(result.gpr(), m_compileIndex); } -void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const ClassInfo* classInfo, bool needSpeculationCheck) +void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeUse nodeUse, const ClassInfo* classInfo, bool needSpeculationCheck) { - JSValueOperand value(this, nodeIndex); + JSValueOperand value(this, nodeUse); GPRTemporary result(this); GPRReg valueGPR = value.gpr(); GPRReg resultGPR = result.gpr(); MacroAssembler::Jump notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, valueGPR, GPRInfo::tagMaskRegister); if (needSpeculationCheck) - speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); m_jit.move(TrustedImm32(static_cast<int32_t>(ValueFalse)), resultGPR); MacroAssembler::Jump done = m_jit.jump(); @@ -1537,7 +1537,7 @@ void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const C if (needSpeculationCheck) { m_jit.move(valueGPR, resultGPR); m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), resultGPR); - speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, resultGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull)))); + speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse, m_jit.branchPtr(MacroAssembler::NotEqual, resultGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull)))); } m_jit.move(TrustedImm32(static_cast<int32_t>(ValueTrue)), resultGPR); @@ -1548,7 +1548,7 @@ void SpeculativeJIT::compileObjectOrOtherLogicalNot(NodeIndex nodeIndex, const C void SpeculativeJIT::compileLogicalNot(Node& node) { - if (isKnownBoolean(node.child1())) { + if (isKnownBoolean(node.child1().index())) { SpeculateBooleanOperand value(this, node.child1()); GPRTemporary result(this, value); @@ -1623,16 +1623,16 @@ void SpeculativeJIT::compileLogicalNot(Node& node) jsValueResult(resultGPR, m_compileIndex, DataFormatJSBoolean, UseChildrenCalledExplicitly); } -void SpeculativeJIT::emitObjectOrOtherBranch(NodeIndex nodeIndex, BlockIndex taken, BlockIndex notTaken, const ClassInfo* classInfo, bool needSpeculationCheck) +void SpeculativeJIT::emitObjectOrOtherBranch(NodeUse nodeUse, BlockIndex taken, BlockIndex notTaken, const ClassInfo* classInfo, bool needSpeculationCheck) { - JSValueOperand value(this, nodeIndex); + JSValueOperand value(this, nodeUse); GPRTemporary scratch(this); GPRReg valueGPR = value.gpr(); GPRReg scratchGPR = scratch.gpr(); MacroAssembler::Jump notCell = m_jit.branchTestPtr(MacroAssembler::NonZero, valueGPR, GPRInfo::tagMaskRegister); if (needSpeculationCheck) - speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); + speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse.index(), m_jit.branchPtr(MacroAssembler::NotEqual, MacroAssembler::Address(valueGPR, JSCell::classInfoOffset()), MacroAssembler::TrustedImmPtr(classInfo))); addBranch(m_jit.jump(), taken); notCell.link(&m_jit); @@ -1640,7 +1640,7 @@ void SpeculativeJIT::emitObjectOrOtherBranch(NodeIndex nodeIndex, BlockIndex tak if (needSpeculationCheck) { m_jit.move(valueGPR, scratchGPR); m_jit.andPtr(MacroAssembler::TrustedImm32(~TagBitUndefined), scratchGPR); - speculationCheck(BadType, JSValueRegs(valueGPR), nodeIndex, m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull)))); + speculationCheck(BadType, JSValueRegs(valueGPR), nodeUse.index(), m_jit.branchPtr(MacroAssembler::NotEqual, scratchGPR, MacroAssembler::TrustedImmPtr(reinterpret_cast<void*>(ValueNull)))); } if (notTaken != (m_block + 1)) addBranch(m_jit.jump(), notTaken); @@ -1656,7 +1656,7 @@ void SpeculativeJIT::emitBranch(Node& node) BlockIndex taken = node.takenBlockIndex(); BlockIndex notTaken = node.notTakenBlockIndex(); - if (isKnownBoolean(node.child1())) { + if (isKnownBoolean(node.child1().index())) { MacroAssembler::ResultCondition condition = MacroAssembler::NonZero; if (taken == (m_block + 1)) { @@ -1879,18 +1879,18 @@ void SpeculativeJIT::compile(Node& node) case BitAnd: case BitOr: case BitXor: - if (isInt32Constant(node.child1())) { + if (isInt32Constant(node.child1().index())) { SpeculateIntegerOperand op2(this, node.child2()); GPRTemporary result(this, op2); - bitOp(op, valueOfInt32Constant(node.child1()), op2.gpr(), result.gpr()); + bitOp(op, valueOfInt32Constant(node.child1().index()), op2.gpr(), result.gpr()); integerResult(result.gpr(), m_compileIndex); - } else if (isInt32Constant(node.child2())) { + } else if (isInt32Constant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); - bitOp(op, valueOfInt32Constant(node.child2()), op1.gpr(), result.gpr()); + bitOp(op, valueOfInt32Constant(node.child2().index()), op1.gpr(), result.gpr()); integerResult(result.gpr(), m_compileIndex); } else { @@ -1909,11 +1909,11 @@ void SpeculativeJIT::compile(Node& node) case BitRShift: case BitLShift: case BitURShift: - if (isInt32Constant(node.child2())) { + if (isInt32Constant(node.child2().index())) { SpeculateIntegerOperand op1(this, node.child1()); GPRTemporary result(this, op1); - shiftOp(op, op1.gpr(), valueOfInt32Constant(node.child2()) & 0x1f, result.gpr()); + shiftOp(op, op1.gpr(), valueOfInt32Constant(node.child2().index()) & 0x1f, result.gpr()); integerResult(result.gpr(), m_compileIndex); } else { @@ -1940,30 +1940,6 @@ void SpeculativeJIT::compile(Node& node) break; } - case ValueToNumber: { - if (at(node.child1()).shouldNotSpeculateInteger()) { - SpeculateDoubleOperand op1(this, node.child1()); - FPRTemporary result(this, op1); - m_jit.moveDouble(op1.fpr(), result.fpr()); - doubleResult(result.fpr(), m_compileIndex); - break; - } - - SpeculateIntegerOperand op1(this, node.child1()); - GPRTemporary result(this, op1); - m_jit.move(op1.gpr(), result.gpr()); - integerResult(result.gpr(), m_compileIndex, op1.format()); - break; - } - - case ValueToDouble: { - SpeculateDoubleOperand op1(this, node.child1()); - FPRTemporary result(this, op1); - m_jit.moveDouble(op1.fpr(), result.fpr()); - doubleResult(result.fpr(), m_compileIndex); - break; - } - case ValueAdd: case ArithAdd: compileAdd(node); @@ -2147,12 +2123,12 @@ void SpeculativeJIT::compile(Node& node) break; case CompareEq: - if (isNullConstant(node.child1())) { + if (isNullConstant(node.child1().index())) { if (nonSpeculativeCompareNull(node, node.child2())) return; break; } - if (isNullConstant(node.child2())) { + if (isNullConstant(node.child2().index())) { if (nonSpeculativeCompareNull(node, node.child1())) return; break; @@ -2661,7 +2637,7 @@ void SpeculativeJIT::compile(Node& node) } case Branch: - if (isStrictInt32(node.child1()) || at(node.child1()).shouldSpeculateInteger()) { + if (isStrictInt32(node.child1().index()) || at(node.child1()).shouldSpeculateInteger()) { SpeculateIntegerOperand op(this, node.child1()); BlockIndex taken = node.takenBlockIndex(); @@ -2738,7 +2714,7 @@ void SpeculativeJIT::compile(Node& node) // FIXME: Add string speculation here. - bool wasPrimitive = isKnownNumeric(node.child1()) || isKnownBoolean(node.child1()); + bool wasPrimitive = isKnownNumeric(node.child1().index()) || isKnownBoolean(node.child1().index()); JSValueOperand op1(this, node.child1()); GPRTemporary result(this, op1); diff --git a/Source/JavaScriptCore/heap/HandleTypes.h b/Source/JavaScriptCore/heap/HandleTypes.h index 780ab85cd..bdfbcfda3 100644 --- a/Source/JavaScriptCore/heap/HandleTypes.h +++ b/Source/JavaScriptCore/heap/HandleTypes.h @@ -35,7 +35,7 @@ typedef JSValue* HandleSlot; template<typename T> struct HandleTypes { typedef T* ExternalType; - static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(slot->asCell()) : 0; } + static ExternalType getFromSlot(HandleSlot slot) { return (slot && *slot) ? reinterpret_cast<ExternalType>(static_cast<void*>(slot->asCell())) : 0; } static JSValue toJSValue(T* cell) { return reinterpret_cast<JSCell*>(cell); } template<typename U> static void validateUpcast() { T* temp; temp = (U*)0; } }; diff --git a/Source/JavaScriptCore/heap/Heap.cpp b/Source/JavaScriptCore/heap/Heap.cpp index a2136083a..9f5094a58 100644 --- a/Source/JavaScriptCore/heap/Heap.cpp +++ b/Source/JavaScriptCore/heap/Heap.cpp @@ -811,7 +811,7 @@ void Heap::collect(SweepToggle sweepToggle) { GCPHASE(ResetAllocator); - resetAllocator(); + resetAllocators(); } { @@ -846,10 +846,10 @@ void Heap::canonicalizeCellLivenessData() m_objectSpace.canonicalizeCellLivenessData(); } -void Heap::resetAllocator() +void Heap::resetAllocators() { m_extraCost = 0; - m_objectSpace.resetAllocator(); + m_objectSpace.resetAllocators(); } void Heap::setActivityCallback(PassOwnPtr<GCActivityCallback> activityCallback) diff --git a/Source/JavaScriptCore/heap/Heap.h b/Source/JavaScriptCore/heap/Heap.h index 40a8376f0..1d0ac5407 100644 --- a/Source/JavaScriptCore/heap/Heap.h +++ b/Source/JavaScriptCore/heap/Heap.h @@ -25,6 +25,7 @@ #include "DFGCodeBlocks.h" #include "HandleHeap.h" #include "HandleStack.h" +#include "MarkedAllocator.h" #include "MarkedBlock.h" #include "MarkedBlockSet.h" #include "MarkedSpace.h" @@ -94,7 +95,7 @@ namespace JSC { // true if an allocation or collection is in progress inline bool isBusy(); - MarkedSpace::SizeClass& sizeClassForObject(size_t bytes) { return m_objectSpace.sizeClassFor(bytes); } + MarkedAllocator& allocatorForObject(size_t bytes) { return m_objectSpace.allocatorFor(bytes); } void* allocate(size_t); CheckedBoolean tryAllocateStorage(size_t, void**); CheckedBoolean tryReallocateStorage(void**, size_t, size_t); @@ -136,6 +137,7 @@ namespace JSC { private: friend class MarkedSpace; + friend class MarkedAllocator; friend class MarkedBlock; friend class BumpSpace; friend class SlotVisitor; @@ -160,7 +162,7 @@ namespace JSC { // conservative marking, eager sweeping, or iterating the cells in a MarkedBlock.) void canonicalizeCellLivenessData(); - void resetAllocator(); + void resetAllocators(); void freeBlocks(MarkedBlock*); void clearMarks(); diff --git a/Source/JavaScriptCore/heap/MarkedAllocator.cpp b/Source/JavaScriptCore/heap/MarkedAllocator.cpp new file mode 100644 index 000000000..8239fbaed --- /dev/null +++ b/Source/JavaScriptCore/heap/MarkedAllocator.cpp @@ -0,0 +1,128 @@ +#include "config.h" +#include "MarkedAllocator.h" + +#include "Heap.h" + +namespace JSC { + +inline void* MarkedAllocator::tryAllocateHelper() +{ + MarkedBlock::FreeCell* firstFreeCell = m_firstFreeCell; + if (!firstFreeCell) { + for (MarkedBlock*& block = m_currentBlock; block; block = static_cast<MarkedBlock*>(block->next())) { + firstFreeCell = block->sweep(MarkedBlock::SweepToFreeList); + if (firstFreeCell) + break; + m_markedSpace->didConsumeFreeList(block); + block->didConsumeFreeList(); + } + + if (!firstFreeCell) + return 0; + } + + ASSERT(firstFreeCell); + m_firstFreeCell = firstFreeCell->next; + return firstFreeCell; +} + +inline void* MarkedAllocator::tryAllocate() +{ + m_heap->m_operationInProgress = Allocation; + void* result = tryAllocateHelper(); + m_heap->m_operationInProgress = NoOperation; + return result; +} + +void* MarkedAllocator::allocateSlowCase() +{ +#if COLLECT_ON_EVERY_ALLOCATION + m_heap->collectAllGarbage(); + ASSERT(m_heap->m_operationInProgress == NoOperation); +#endif + + void* result = tryAllocate(); + + if (LIKELY(result != 0)) + return result; + + AllocationEffort allocationEffort; + + if (( +#if ENABLE(GGC) + nurseryWaterMark() < m_heap->m_minBytesPerCycle +#else + m_heap->waterMark() < m_heap->highWaterMark() +#endif + ) || !m_heap->m_isSafeToCollect) + allocationEffort = AllocationMustSucceed; + else + allocationEffort = AllocationCanFail; + + MarkedBlock* block = allocateBlock(allocationEffort); + if (block) { + addBlock(block); + void* result = tryAllocate(); + ASSERT(result); + return result; + } + + m_heap->collect(Heap::DoNotSweep); + + result = tryAllocate(); + + if (result) + return result; + + ASSERT(m_heap->waterMark() < m_heap->highWaterMark()); + + addBlock(allocateBlock(AllocationMustSucceed)); + + result = tryAllocate(); + ASSERT(result); + return result; +} + +MarkedBlock* MarkedAllocator::allocateBlock(AllocationEffort allocationEffort) +{ + MarkedBlock* block; + + { + MutexLocker locker(m_heap->m_freeBlockLock); + if (m_heap->m_numberOfFreeBlocks) { + block = static_cast<MarkedBlock*>(m_heap->m_freeBlocks.removeHead()); + ASSERT(block); + m_heap->m_numberOfFreeBlocks--; + } else + block = 0; + } + if (block) + block = MarkedBlock::recycle(block, m_heap, m_cellSize); + else if (allocationEffort == AllocationCanFail) + return 0; + else + block = MarkedBlock::create(m_heap, m_cellSize); + + m_markedSpace->didAddBlock(block); + + return block; +} + +void MarkedAllocator::addBlock(MarkedBlock* block) +{ + ASSERT(!m_currentBlock); + ASSERT(!m_firstFreeCell); + + m_blockList.append(block); + m_currentBlock = block; + m_firstFreeCell = block->sweep(MarkedBlock::SweepToFreeList); +} + +void MarkedAllocator::removeBlock(MarkedBlock* block) +{ + if (m_currentBlock == block) + m_currentBlock = 0; + m_blockList.remove(block); +} + +} // namespace JSC diff --git a/Source/JavaScriptCore/heap/MarkedAllocator.h b/Source/JavaScriptCore/heap/MarkedAllocator.h new file mode 100644 index 000000000..5644c691b --- /dev/null +++ b/Source/JavaScriptCore/heap/MarkedAllocator.h @@ -0,0 +1,97 @@ +#ifndef MarkedAllocator_h +#define MarkedAllocator_h + +#include "MarkedBlock.h" +#include <wtf/DoublyLinkedList.h> + +namespace JSC { + +class Heap; +class MarkedSpace; + +namespace DFG { +class SpeculativeJIT; +} + +class MarkedAllocator { + friend class JIT; + friend class DFG::SpeculativeJIT; + +public: + MarkedAllocator(); + void reset(); + void zapFreeList(); + size_t cellSize() { return m_cellSize; } + void* allocate(); + Heap* heap() { return m_heap; } + + template<typename Functor> void forEachBlock(Functor&); + + void addBlock(MarkedBlock*); + void removeBlock(MarkedBlock*); + void setHeap(Heap* heap) { m_heap = heap; } + void setCellSize(size_t cellSize) { m_cellSize = cellSize; } + void setMarkedSpace(MarkedSpace* space) { m_markedSpace = space; } + +private: + JS_EXPORT_PRIVATE void* allocateSlowCase(); + void* tryAllocate(); + void* tryAllocateHelper(); + MarkedBlock* allocateBlock(AllocationEffort); + + MarkedBlock::FreeCell* m_firstFreeCell; + MarkedBlock* m_currentBlock; + DoublyLinkedList<HeapBlock> m_blockList; + size_t m_cellSize; + Heap* m_heap; + MarkedSpace* m_markedSpace; +}; + +inline MarkedAllocator::MarkedAllocator() + : m_firstFreeCell(0) + , m_currentBlock(0) + , m_cellSize(0) + , m_heap(0) + , m_markedSpace(0) +{ +} + +inline void* MarkedAllocator::allocate() +{ + MarkedBlock::FreeCell* firstFreeCell = m_firstFreeCell; + // This is a light-weight fast path to cover the most common case. + if (UNLIKELY(!firstFreeCell)) + return allocateSlowCase(); + + m_firstFreeCell = firstFreeCell->next; + return firstFreeCell; +} + +inline void MarkedAllocator::reset() +{ + m_currentBlock = static_cast<MarkedBlock*>(m_blockList.head()); +} + +inline void MarkedAllocator::zapFreeList() +{ + if (!m_currentBlock) { + ASSERT(!m_firstFreeCell); + return; + } + + m_currentBlock->zapFreeList(m_firstFreeCell); + m_firstFreeCell = 0; +} + +template <typename Functor> inline void MarkedAllocator::forEachBlock(Functor& functor) +{ + HeapBlock* next; + for (HeapBlock* block = m_blockList.head(); block; block = next) { + next = block->next(); + functor(static_cast<MarkedBlock*>(block)); + } +} + +} // namespace JSC + +#endif diff --git a/Source/JavaScriptCore/heap/MarkedBlock.cpp b/Source/JavaScriptCore/heap/MarkedBlock.cpp index 715f25d92..dd9233300 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.cpp +++ b/Source/JavaScriptCore/heap/MarkedBlock.cpp @@ -89,7 +89,7 @@ MarkedBlock::FreeCell* MarkedBlock::specializedSweep() if (blockState == Marked && m_marks.get(i)) continue; - JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[i]); + JSCell* cell = reinterpret_cast_ptr<JSCell*>(&atoms()[i]); if (blockState == Zapped && !cell->isZapped()) continue; diff --git a/Source/JavaScriptCore/heap/MarkedBlock.h b/Source/JavaScriptCore/heap/MarkedBlock.h index 00eb54b1f..0a4ebe47e 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.h +++ b/Source/JavaScriptCore/heap/MarkedBlock.h @@ -317,7 +317,7 @@ namespace JSC { template <typename Functor> inline void MarkedBlock::forEachCell(Functor& functor) { for (size_t i = firstAtom(); i < m_endAtom; i += m_atomsPerCell) { - JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[i]); + JSCell* cell = reinterpret_cast_ptr<JSCell*>(&atoms()[i]); if (!isLive(cell)) continue; diff --git a/Source/JavaScriptCore/heap/MarkedSpace.cpp b/Source/JavaScriptCore/heap/MarkedSpace.cpp index fcca188e4..87dc0493d 100644 --- a/Source/JavaScriptCore/heap/MarkedSpace.cpp +++ b/Source/JavaScriptCore/heap/MarkedSpace.cpp @@ -35,155 +35,40 @@ MarkedSpace::MarkedSpace(Heap* heap) , m_nurseryWaterMark(0) , m_heap(heap) { - for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) - sizeClassFor(cellSize).cellSize = cellSize; - - for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) - sizeClassFor(cellSize).cellSize = cellSize; -} - -void MarkedSpace::addBlock(SizeClass& sizeClass, MarkedBlock* block) -{ - ASSERT(!sizeClass.currentBlock); - ASSERT(!sizeClass.firstFreeCell); - - sizeClass.blockList.append(block); - sizeClass.currentBlock = block; - sizeClass.firstFreeCell = block->sweep(MarkedBlock::SweepToFreeList); -} + for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) { + allocatorFor(cellSize).setCellSize(cellSize); + allocatorFor(cellSize).setHeap(heap); + allocatorFor(cellSize).setMarkedSpace(this); + } -void MarkedSpace::removeBlock(MarkedBlock* block) -{ - SizeClass& sizeClass = sizeClassFor(block->cellSize()); - if (sizeClass.currentBlock == block) - sizeClass.currentBlock = 0; - sizeClass.blockList.remove(block); + for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) { + allocatorFor(cellSize).setCellSize(cellSize); + allocatorFor(cellSize).setHeap(heap); + allocatorFor(cellSize).setMarkedSpace(this); + } } -void MarkedSpace::resetAllocator() +void MarkedSpace::resetAllocators() { m_waterMark = 0; m_nurseryWaterMark = 0; for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) - sizeClassFor(cellSize).resetAllocator(); + allocatorFor(cellSize).reset(); for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) - sizeClassFor(cellSize).resetAllocator(); + allocatorFor(cellSize).reset(); } void MarkedSpace::canonicalizeCellLivenessData() { for (size_t cellSize = preciseStep; cellSize <= preciseCutoff; cellSize += preciseStep) - sizeClassFor(cellSize).zapFreeList(); + allocatorFor(cellSize).zapFreeList(); for (size_t cellSize = impreciseStep; cellSize <= impreciseCutoff; cellSize += impreciseStep) - sizeClassFor(cellSize).zapFreeList(); + allocatorFor(cellSize).zapFreeList(); } -inline void* MarkedSpace::tryAllocateHelper(MarkedSpace::SizeClass& sizeClass) -{ - MarkedBlock::FreeCell* firstFreeCell = sizeClass.firstFreeCell; - if (!firstFreeCell) { - for (MarkedBlock*& block = sizeClass.currentBlock; block; block = static_cast<MarkedBlock*>(block->next())) { - firstFreeCell = block->sweep(MarkedBlock::SweepToFreeList); - if (firstFreeCell) - break; - m_nurseryWaterMark += block->capacity() - block->size(); - m_waterMark += block->capacity(); - block->didConsumeFreeList(); - } - - if (!firstFreeCell) - return 0; - } - - ASSERT(firstFreeCell); - sizeClass.firstFreeCell = firstFreeCell->next; - return firstFreeCell; -} - -inline void* MarkedSpace::tryAllocate(MarkedSpace::SizeClass& sizeClass) -{ - m_heap->m_operationInProgress = Allocation; - void* result = tryAllocateHelper(sizeClass); - m_heap->m_operationInProgress = NoOperation; - return result; -} - -void* MarkedSpace::allocateSlowCase(MarkedSpace::SizeClass& sizeClass) -{ -#if COLLECT_ON_EVERY_ALLOCATION - m_heap->collectAllGarbage(); - ASSERT(m_heap->m_operationInProgress == NoOperation); -#endif - - void* result = tryAllocate(sizeClass); - - if (LIKELY(result != 0)) - return result; - - AllocationEffort allocationEffort; - - if (( -#if ENABLE(GGC) - nurseryWaterMark() < m_heap->m_minBytesPerCycle -#else - m_heap->waterMark() < m_heap->highWaterMark() -#endif - ) || !m_heap->m_isSafeToCollect) - allocationEffort = AllocationMustSucceed; - else - allocationEffort = AllocationCanFail; - - MarkedBlock* block = allocateBlock(sizeClass.cellSize, allocationEffort); - if (block) { - addBlock(sizeClass, block); - void* result = tryAllocate(sizeClass); - ASSERT(result); - return result; - } - - m_heap->collect(Heap::DoNotSweep); - - result = tryAllocate(sizeClass); - - if (result) - return result; - - ASSERT(m_heap->waterMark() < m_heap->highWaterMark()); - - addBlock(sizeClass, allocateBlock(sizeClass.cellSize, AllocationMustSucceed)); - - result = tryAllocate(sizeClass); - ASSERT(result); - return result; -} - -MarkedBlock* MarkedSpace::allocateBlock(size_t cellSize, AllocationEffort allocationEffort) -{ - MarkedBlock* block; - - { - MutexLocker locker(m_heap->m_freeBlockLock); - if (m_heap->m_numberOfFreeBlocks) { - block = static_cast<MarkedBlock*>(m_heap->m_freeBlocks.removeHead()); - ASSERT(block); - m_heap->m_numberOfFreeBlocks--; - } else - block = 0; - } - if (block) - block = MarkedBlock::recycle(block, m_heap, cellSize); - else if (allocationEffort == AllocationCanFail) - return 0; - else - block = MarkedBlock::create(m_heap, cellSize); - - m_blocks.add(block); - - return block; -} void MarkedSpace::freeBlocks(MarkedBlock* head) { @@ -222,7 +107,7 @@ inline void TakeIfUnmarked::operator()(MarkedBlock* block) if (!block->markCountIsZero()) return; - m_markedSpace->removeBlock(block); + m_markedSpace->allocatorFor(block->cellSize()).removeBlock(block); m_empties.append(block); } diff --git a/Source/JavaScriptCore/heap/MarkedSpace.h b/Source/JavaScriptCore/heap/MarkedSpace.h index f7d96c774..21a0b48de 100644 --- a/Source/JavaScriptCore/heap/MarkedSpace.h +++ b/Source/JavaScriptCore/heap/MarkedSpace.h @@ -23,6 +23,7 @@ #define MarkedSpace_h #include "MachineStackMarker.h" +#include "MarkedAllocator.h" #include "MarkedBlock.h" #include "MarkedBlockSet.h" #include "PageAllocationAligned.h" @@ -48,27 +49,13 @@ class MarkedSpace { public: static const size_t maxCellSize = 2048; - struct SizeClass { - SizeClass(); - void resetAllocator(); - void zapFreeList(); - - MarkedBlock::FreeCell* firstFreeCell; - MarkedBlock* currentBlock; - DoublyLinkedList<HeapBlock> blockList; - size_t cellSize; - }; - MarkedSpace(Heap*); - SizeClass& sizeClassFor(size_t); + MarkedAllocator& allocatorFor(size_t); void* allocate(size_t); - void* allocate(SizeClass&); - void resetAllocator(); + void resetAllocators(); - void addBlock(SizeClass&, MarkedBlock*); - void removeBlock(MarkedBlock*); MarkedBlockSet& blocks() { return m_blocks; } void canonicalizeCellLivenessData(); @@ -85,13 +72,10 @@ public: void shrink(); void freeBlocks(MarkedBlock* head); + void didAddBlock(MarkedBlock*); + void didConsumeFreeList(MarkedBlock*); private: - JS_EXPORT_PRIVATE void* allocateSlowCase(SizeClass&); - void* tryAllocateHelper(MarkedSpace::SizeClass&); - void* tryAllocate(MarkedSpace::SizeClass&); - MarkedBlock* allocateBlock(size_t, AllocationEffort); - // [ 32... 256 ] static const size_t preciseStep = MarkedBlock::atomSize; static const size_t preciseCutoff = 256; @@ -102,8 +86,8 @@ private: static const size_t impreciseCutoff = maxCellSize; static const size_t impreciseCount = impreciseCutoff / impreciseStep; - FixedArray<SizeClass, preciseCount> m_preciseSizeClasses; - FixedArray<SizeClass, impreciseCount> m_impreciseSizeClasses; + FixedArray<MarkedAllocator, preciseCount> m_preciseSizeClasses; + FixedArray<MarkedAllocator, impreciseCount> m_impreciseSizeClasses; size_t m_waterMark; size_t m_nurseryWaterMark; Heap* m_heap; @@ -136,7 +120,7 @@ template<typename Functor> inline typename Functor::ReturnType MarkedSpace::forE return forEachCell(functor); } -inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes) +inline MarkedAllocator& MarkedSpace::allocatorFor(size_t bytes) { ASSERT(bytes && bytes <= maxCellSize); if (bytes <= preciseCutoff) @@ -146,39 +130,17 @@ inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes) inline void* MarkedSpace::allocate(size_t bytes) { - SizeClass& sizeClass = sizeClassFor(bytes); - return allocate(sizeClass); -} - -inline void* MarkedSpace::allocate(SizeClass& sizeClass) -{ - // This is a light-weight fast path to cover the most common case. - MarkedBlock::FreeCell* firstFreeCell = sizeClass.firstFreeCell; - if (UNLIKELY(!firstFreeCell)) - return allocateSlowCase(sizeClass); - - sizeClass.firstFreeCell = firstFreeCell->next; - return firstFreeCell; + return allocatorFor(bytes).allocate(); } template <typename Functor> inline typename Functor::ReturnType MarkedSpace::forEachBlock(Functor& functor) { for (size_t i = 0; i < preciseCount; ++i) { - SizeClass& sizeClass = m_preciseSizeClasses[i]; - HeapBlock* next; - for (HeapBlock* block = sizeClass.blockList.head(); block; block = next) { - next = block->next(); - functor(static_cast<MarkedBlock*>(block)); - } + m_preciseSizeClasses[i].forEachBlock(functor); } for (size_t i = 0; i < impreciseCount; ++i) { - SizeClass& sizeClass = m_impreciseSizeClasses[i]; - HeapBlock* next; - for (HeapBlock* block = sizeClass.blockList.head(); block; block = next) { - next = block->next(); - functor(static_cast<MarkedBlock*>(block)); - } + m_impreciseSizeClasses[i].forEachBlock(functor); } return functor.returnValue(); @@ -190,27 +152,15 @@ template <typename Functor> inline typename Functor::ReturnType MarkedSpace::for return forEachBlock(functor); } -inline MarkedSpace::SizeClass::SizeClass() - : firstFreeCell(0) - , currentBlock(0) - , cellSize(0) -{ -} - -inline void MarkedSpace::SizeClass::resetAllocator() +inline void MarkedSpace::didAddBlock(MarkedBlock* block) { - currentBlock = static_cast<MarkedBlock*>(blockList.head()); + m_blocks.add(block); } -inline void MarkedSpace::SizeClass::zapFreeList() +inline void MarkedSpace::didConsumeFreeList(MarkedBlock* block) { - if (!currentBlock) { - ASSERT(!firstFreeCell); - return; - } - - currentBlock->zapFreeList(firstFreeCell); - firstFreeCell = 0; + m_nurseryWaterMark += block->capacity() - block->size(); + m_waterMark += block->capacity(); } } // namespace JSC diff --git a/Source/JavaScriptCore/interpreter/CallFrame.h b/Source/JavaScriptCore/interpreter/CallFrame.h index e0a291f8b..4fadfab28 100644 --- a/Source/JavaScriptCore/interpreter/CallFrame.h +++ b/Source/JavaScriptCore/interpreter/CallFrame.h @@ -106,6 +106,8 @@ namespace JSC { ReturnAddressPtr returnPC() const { return ReturnAddressPtr(this[RegisterFile::ReturnPC].vPC()); } #endif AbstractPC abstractReturnPC(JSGlobalData& globalData) { return AbstractPC(globalData, this); } + unsigned bytecodeOffsetForBaselineJIT() { return this[RegisterFile::ArgumentCount].tag(); } + #if ENABLE(DFG_JIT) InlineCallFrame* inlineCallFrame() const { return this[RegisterFile::ReturnPC].asInlineCallFrame(); } unsigned codeOriginIndexForDFGWithInlining() const { return this[RegisterFile::ArgumentCount].tag(); } diff --git a/Source/JavaScriptCore/interpreter/Interpreter.cpp b/Source/JavaScriptCore/interpreter/Interpreter.cpp index 51843f2d2..d42e869f1 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.cpp +++ b/Source/JavaScriptCore/interpreter/Interpreter.cpp @@ -885,6 +885,8 @@ JSValue Interpreter::execute(ProgramExecutable* program, CallFrame* callFrame, S Vector<JSONPData> JSONPData; bool parseResult; const UString programSource = program->source().toString(); + if (programSource.isNull()) + return jsUndefined(); if (programSource.is8Bit()) { LiteralParser<LChar> literalParser(callFrame, programSource.characters8(), programSource.length(), JSONP); parseResult = literalParser.tryJSONPParse(JSONPData, scopeChain->globalObject->globalObjectMethodTable()->supportsRichSourceInfo(scopeChain->globalObject.get())); @@ -5126,11 +5128,12 @@ JSValue Interpreter::retrieveCallerFromVMCode(CallFrame* callFrame, JSFunction* CallFrame* functionCallFrame = findFunctionCallFrameFromVMCode(callFrame, function); if (!functionCallFrame) return jsNull(); - - CallFrame* callerFrame = functionCallFrame->callerFrame(); - if (callerFrame->hasHostCallFrameFlag()) + + if (functionCallFrame->callerFrame()->hasHostCallFrameFlag()) return jsNull(); + CallFrame* callerFrame = functionCallFrame->trueCallerFrame(); + JSValue caller = callerFrame->callee(); if (!caller) return jsNull(); diff --git a/Source/JavaScriptCore/interpreter/Interpreter.h b/Source/JavaScriptCore/interpreter/Interpreter.h index 1943513ae..884c4248e 100644 --- a/Source/JavaScriptCore/interpreter/Interpreter.h +++ b/Source/JavaScriptCore/interpreter/Interpreter.h @@ -142,7 +142,7 @@ namespace JSC { JSValue execute(EvalExecutable*, CallFrame*, JSValue thisValue, ScopeChainNode*, int globalRegisterOffset); JSValue retrieveArgumentsFromVMCode(CallFrame*, JSFunction*) const; - JS_EXPORT_PRIVATE JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const; + JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const; JS_EXPORT_PRIVATE void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const; void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); diff --git a/Source/JavaScriptCore/jit/JIT.cpp b/Source/JavaScriptCore/jit/JIT.cpp index 247495aaf..c8584a316 100644 --- a/Source/JavaScriptCore/jit/JIT.cpp +++ b/Source/JavaScriptCore/jit/JIT.cpp @@ -606,7 +606,11 @@ JITCode JIT::privateCompile(CodePtr* functionEntryArityCheck) load32(payloadFor(RegisterFile::ArgumentCount), regT1); branch32(AboveOrEqual, regT1, TrustedImm32(m_codeBlock->m_numParameters)).linkTo(beginLabel, this); + m_bytecodeOffset = 0; JITStubCall(this, m_codeBlock->m_isConstructor ? cti_op_construct_arityCheck : cti_op_call_arityCheck).call(callFrameRegister); +#if !ASSERT_DISABLED + m_bytecodeOffset = (unsigned)-1; // Reset this, in order to guard its use with ASSERTs. +#endif jump(beginLabel); } diff --git a/Source/JavaScriptCore/jit/JIT.h b/Source/JavaScriptCore/jit/JIT.h index c357e8c39..8dd332893 100644 --- a/Source/JavaScriptCore/jit/JIT.h +++ b/Source/JavaScriptCore/jit/JIT.h @@ -207,34 +207,40 @@ namespace JSC { static void compileGetByIdProto(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompileGetByIdProto(stubInfo, structure, prototypeStructure, ident, slot, cachedOffset, returnAddress, callFrame); } static void compileGetByIdSelfList(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* polymorphicStructures, int currentIndex, Structure* structure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompileGetByIdSelfList(stubInfo, polymorphicStructures, currentIndex, structure, ident, slot, cachedOffset); } static void compileGetByIdProtoList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, Structure* prototypeStructure, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompileGetByIdProtoList(stubInfo, prototypeStructureList, currentIndex, structure, prototypeStructure, ident, slot, cachedOffset, callFrame); } static void compileGetByIdChainList(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, PolymorphicAccessStructureList* prototypeStructureList, int currentIndex, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompileGetByIdChainList(stubInfo, prototypeStructureList, currentIndex, structure, chain, count, ident, slot, cachedOffset, callFrame); } static void compileGetByIdChain(JSGlobalData* globalData, CallFrame* callFrame, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* structure, StructureChain* chain, size_t count, const Identifier& ident, const PropertySlot& slot, size_t cachedOffset, ReturnAddressPtr returnAddress) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompileGetByIdChain(stubInfo, structure, chain, count, ident, slot, cachedOffset, returnAddress, callFrame); } static void compilePutByIdTransition(JSGlobalData* globalData, CodeBlock* codeBlock, StructureStubInfo* stubInfo, Structure* oldStructure, Structure* newStructure, size_t cachedOffset, StructureChain* chain, ReturnAddressPtr returnAddress, bool direct) { JIT jit(globalData, codeBlock); + jit.m_bytecodeOffset = stubInfo->bytecodeIndex; jit.privateCompilePutByIdTransition(stubInfo, oldStructure, newStructure, cachedOffset, chain, returnAddress, direct); } @@ -398,9 +404,9 @@ namespace JSC { static const int patchOffsetGetByIdPropertyMapOffset2 = 22; static const int patchOffsetGetByIdPutResult = 22; #if ENABLE(OPCODE_SAMPLING) - static const int patchOffsetGetByIdSlowCaseCall = 37; + static const int patchOffsetGetByIdSlowCaseCall = 44; #else - static const int patchOffsetGetByIdSlowCaseCall = 33; + static const int patchOffsetGetByIdSlowCaseCall = 40; #endif static const int patchOffsetOpCallCompareToJump = 6; @@ -421,7 +427,7 @@ namespace JSC { #if ENABLE(OPCODE_SAMPLING) #error "OPCODE_SAMPLING is not yet supported" #else - static const int patchOffsetGetByIdSlowCaseCall = 40; + static const int patchOffsetGetByIdSlowCaseCall = 48; #endif static const int patchOffsetOpCallCompareToJump = 12; @@ -458,7 +464,7 @@ namespace JSC { #if ENABLE(OPCODE_SAMPLING) #error "OPCODE_SAMPLING is not yet supported" #else - static const int patchOffsetGetByIdSlowCaseCall = 40; + static const int patchOffsetGetByIdSlowCaseCall = 48; #endif static const int patchOffsetOpCallCompareToJump = 16; @@ -634,9 +640,9 @@ namespace JSC { static const int patchOffsetGetByIdPropertyMapOffset = 28; static const int patchOffsetGetByIdPutResult = 28; #if ENABLE(OPCODE_SAMPLING) - static const int patchOffsetGetByIdSlowCaseCall = 64; + static const int patchOffsetGetByIdSlowCaseCall = 72; #else - static const int patchOffsetGetByIdSlowCaseCall = 54; + static const int patchOffsetGetByIdSlowCaseCall = 62; #endif static const int patchOffsetOpCallCompareToJump = 9; diff --git a/Source/JavaScriptCore/jit/JITDriver.h b/Source/JavaScriptCore/jit/JITDriver.h index 7e010cdfe..4b8df4751 100644 --- a/Source/JavaScriptCore/jit/JITDriver.h +++ b/Source/JavaScriptCore/jit/JITDriver.h @@ -55,10 +55,6 @@ inline bool jitCompileIfAppropriate(JSGlobalData& globalData, OwnPtr<CodeBlockTy } jitCode = JIT::compile(&globalData, codeBlock.get()); } -#if !ENABLE(OPCODE_SAMPLING) - if (!BytecodeGenerator::dumpsGeneratedCode()) - codeBlock->handleBytecodeDiscardingOpportunity(); -#endif codeBlock->setJITCode(jitCode, MacroAssemblerCodePtr()); return true; @@ -83,10 +79,6 @@ inline bool jitCompileFunctionIfAppropriate(JSGlobalData& globalData, OwnPtr<Fun } jitCode = JIT::compile(&globalData, codeBlock.get(), &jitCodeWithArityCheck); } -#if !ENABLE(OPCODE_SAMPLING) - if (!BytecodeGenerator::dumpsGeneratedCode()) - codeBlock->handleBytecodeDiscardingOpportunity(); -#endif codeBlock->setJITCode(jitCode, jitCodeWithArityCheck); diff --git a/Source/JavaScriptCore/jit/JITInlineMethods.h b/Source/JavaScriptCore/jit/JITInlineMethods.h index e617961b5..dfcfbd499 100644 --- a/Source/JavaScriptCore/jit/JITInlineMethods.h +++ b/Source/JavaScriptCore/jit/JITInlineMethods.h @@ -264,6 +264,9 @@ ALWAYS_INLINE void JIT::restoreArgumentReference() ALWAYS_INLINE void JIT::updateTopCallFrame() { + ASSERT(static_cast<int>(m_bytecodeOffset) >= 0); + if (m_bytecodeOffset) + store32(Imm32(m_bytecodeOffset + 1), intTagFor(RegisterFile::ArgumentCount)); storePtr(callFrameRegister, &m_globalData->topCallFrame); } @@ -401,13 +404,13 @@ ALWAYS_INLINE bool JIT::isOperandConstantImmediateChar(unsigned src) template <typename ClassType, typename StructureType> inline void JIT::emitAllocateBasicJSObject(StructureType structure, RegisterID result, RegisterID storagePtr) { - MarkedSpace::SizeClass* sizeClass = &m_globalData->heap.sizeClassForObject(sizeof(ClassType)); - loadPtr(&sizeClass->firstFreeCell, result); + MarkedAllocator* allocator = &m_globalData->heap.allocatorForObject(sizeof(ClassType)); + loadPtr(&allocator->m_firstFreeCell, result); addSlowCase(branchTestPtr(Zero, result)); // remove the object from the free list loadPtr(Address(result), storagePtr); - storePtr(storagePtr, &sizeClass->firstFreeCell); + storePtr(storagePtr, &allocator->m_firstFreeCell); // initialize the object's structure storePtr(structure, Address(result, JSCell::structureOffset())); diff --git a/Source/JavaScriptCore/parser/Parser.cpp b/Source/JavaScriptCore/parser/Parser.cpp index ce6519873..25ada5606 100644 --- a/Source/JavaScriptCore/parser/Parser.cpp +++ b/Source/JavaScriptCore/parser/Parser.cpp @@ -1240,6 +1240,8 @@ template <typename LexerType> template <class TreeBuilder> TreeExpression Parser<LexerType>::parseObjectLiteral(TreeBuilder& context) { int startOffset = m_token.m_data.intValue; + unsigned oldLastLineNumber = m_lexer->lastLineNumber(); + unsigned oldLineNumber = m_lexer->lineNumber(); consumeOrFailWithFlags(OPENBRACE, TreeBuilder::DontBuildStrings); if (match(CLOSEBRACE)) { @@ -1252,6 +1254,8 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseObjectLitera if (!m_syntaxAlreadyValidated && context.getType(property) != PropertyNode::Constant) { m_lexer->setOffset(startOffset); next(); + m_lexer->setLastLineNumber(oldLastLineNumber); + m_lexer->setLineNumber(oldLineNumber); return parseStrictObjectLiteral(context); } TreePropertyList propertyList = context.createPropertyList(m_lexer->lastLineNumber(), property); @@ -1266,6 +1270,8 @@ template <class TreeBuilder> TreeExpression Parser<LexerType>::parseObjectLitera if (!m_syntaxAlreadyValidated && context.getType(property) != PropertyNode::Constant) { m_lexer->setOffset(startOffset); next(); + m_lexer->setLastLineNumber(oldLastLineNumber); + m_lexer->setLineNumber(oldLineNumber); return parseStrictObjectLiteral(context); } tail = context.createPropertyList(m_lexer->lastLineNumber(), property, tail); diff --git a/Source/JavaScriptCore/runtime/ClassInfo.h b/Source/JavaScriptCore/runtime/ClassInfo.h index 3d556d88c..9ebb33a74 100644 --- a/Source/JavaScriptCore/runtime/ClassInfo.h +++ b/Source/JavaScriptCore/runtime/ClassInfo.h @@ -66,12 +66,6 @@ namespace JSC { typedef JSObject* (*ToThisObjectFunctionPtr)(JSCell*, ExecState*); ToThisObjectFunctionPtr toThisObject; - typedef void (*DefineGetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); - DefineGetterFunctionPtr defineGetter; - - typedef void (*DefineSetterFunctionPtr)(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); - DefineSetterFunctionPtr defineSetter; - typedef JSValue (*DefaultValueFunctionPtr)(const JSObject*, ExecState*, PreferredPrimitiveType); DefaultValueFunctionPtr defaultValue; @@ -128,8 +122,6 @@ struct MemberCheck##member { \ &ClassName::getOwnPropertySlot, \ &ClassName::getOwnPropertySlotByIndex, \ &ClassName::toThisObject, \ - &ClassName::defineGetter, \ - &ClassName::defineSetter, \ &ClassName::defaultValue, \ &ClassName::getOwnPropertyNames, \ &ClassName::getPropertyNames, \ diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index c67c54cd2..bf49767ab 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -137,7 +137,7 @@ FunctionExecutable::FunctionExecutable(JSGlobalData& globalData, const Identifie , m_forceUsesArguments(forceUsesArguments) , m_parameters(parameters) , m_name(name) - , m_inferredName(inferredName) + , m_inferredName(inferredName.isNull() ? globalData.propertyNames->emptyIdentifier : inferredName) , m_symbolTable(0) { } @@ -148,7 +148,7 @@ FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, , m_forceUsesArguments(forceUsesArguments) , m_parameters(parameters) , m_name(name) - , m_inferredName(inferredName) + , m_inferredName(inferredName.isNull() ? exec->globalData().propertyNames->emptyIdentifier : inferredName) , m_symbolTable(0) { } diff --git a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp index 88260ea27..8ebf8c638 100644 --- a/Source/JavaScriptCore/runtime/JSBoundFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSBoundFunction.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "JSBoundFunction.h" +#include "GetterSetter.h" #include "JSGlobalObject.h" namespace JSC { @@ -111,8 +112,8 @@ void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executab Base::finishCreation(exec, executable, length, name); ASSERT(inherits(&s_info)); - initializeGetterSetterProperty(exec, exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); - initializeGetterSetterProperty(exec, exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + putDirectAccessor(exec->globalData(), exec->propertyNames().arguments, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + putDirectAccessor(exec->globalData(), exec->propertyNames().caller, globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); } void JSBoundFunction::visitChildren(JSCell* cell, SlotVisitor& visitor) diff --git a/Source/JavaScriptCore/runtime/JSCell.cpp b/Source/JavaScriptCore/runtime/JSCell.cpp index 9dcd6364b..4703b681b 100644 --- a/Source/JavaScriptCore/runtime/JSCell.cpp +++ b/Source/JavaScriptCore/runtime/JSCell.cpp @@ -158,16 +158,6 @@ void slowValidateCell(JSCell* cell) ASSERT_GC_OBJECT_LOOKS_VALID(cell); } -void JSCell::defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned) -{ - ASSERT_NOT_REACHED(); -} - -void JSCell::defineSetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned) -{ - ASSERT_NOT_REACHED(); -} - JSValue JSCell::defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType) { ASSERT_NOT_REACHED(); diff --git a/Source/JavaScriptCore/runtime/JSCell.h b/Source/JavaScriptCore/runtime/JSCell.h index a36bb7d58..74833d12f 100644 --- a/Source/JavaScriptCore/runtime/JSCell.h +++ b/Source/JavaScriptCore/runtime/JSCell.h @@ -152,8 +152,6 @@ namespace JSC { static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&); // Dummy implementations of override-able static functions for classes to put in their MethodTable - static NO_RETURN_DUE_TO_ASSERT void defineGetter(JSObject*, ExecState*, const Identifier&, JSObject*, unsigned); - static NO_RETURN_DUE_TO_ASSERT void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType); static NO_RETURN_DUE_TO_ASSERT void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode); diff --git a/Source/JavaScriptCore/runtime/JSFunction.cpp b/Source/JavaScriptCore/runtime/JSFunction.cpp index 15718a176..72e1ce14f 100644 --- a/Source/JavaScriptCore/runtime/JSFunction.cpp +++ b/Source/JavaScriptCore/runtime/JSFunction.cpp @@ -30,6 +30,7 @@ #include "CallFrame.h" #include "ExceptionHelpers.h" #include "FunctionPrototype.h" +#include "GetterSetter.h" #include "JSArray.h" #include "JSGlobalObject.h" #include "JSNotAnObject.h" @@ -219,7 +220,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif if (thisObject->jsExecutable()->isStrictMode()) { bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); if (!result) { - thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); ASSERT(result); } @@ -238,7 +239,7 @@ bool JSFunction::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identif if (thisObject->jsExecutable()->isStrictMode()) { bool result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); if (!result) { - thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); result = Base::getOwnPropertySlot(thisObject, exec, propertyName, slot); ASSERT(result); } @@ -267,7 +268,7 @@ bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, con if (thisObject->jsExecutable()->isStrictMode()) { bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); if (!result) { - thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); ASSERT(result); } @@ -286,7 +287,7 @@ bool JSFunction::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, con if (thisObject->jsExecutable()->isStrictMode()) { bool result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); if (!result) { - thisObject->initializeGetterSetterProperty(exec, propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); + thisObject->putDirectAccessor(exec->globalData(), propertyName, thisObject->globalObject()->throwTypeErrorGetterSetter(exec), DontDelete | DontEnum | Accessor); result = Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor); ASSERT(result); } @@ -369,7 +370,7 @@ UString getCalculatedDisplayName(CallFrame* callFrame, JSObject* object) return function->calculatedDisplayName(callFrame); if (InternalFunction* function = jsDynamicCast<InternalFunction*>(object)) return function->calculatedDisplayName(callFrame); - return UString(); + return callFrame->globalData().propertyNames->emptyIdentifier.ustring(); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index f28139d27..e648fbe21 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -171,21 +171,16 @@ void JSGlobalObject::putDirectVirtual(JSObject* object, ExecState* exec, const I } } -void JSGlobalObject::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes) +bool JSGlobalObject::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool shouldThrow) { JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); PropertySlot slot; - if (!thisObject->symbolTableGet(propertyName, slot)) - JSVariableObject::defineGetter(thisObject, exec, propertyName, getterFunc, attributes); + // silently ignore attempts to add accessors aliasing vars. + if (descriptor.isAccessorDescriptor() && thisObject->symbolTableGet(propertyName, slot)) + return false; + return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); } -void JSGlobalObject::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes) -{ - JSGlobalObject* thisObject = jsCast<JSGlobalObject*>(object); - PropertySlot slot; - if (!thisObject->symbolTableGet(propertyName, slot)) - JSVariableObject::defineSetter(thisObject, exec, propertyName, setterFunc, attributes); -} static inline JSObject* lastInPrototypeChain(JSObject* object) { diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h index 70368307d..b67ccb764 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.h +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h @@ -206,6 +206,7 @@ namespace JSC { JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunc, unsigned attributes); JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunc, unsigned attributes); + JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); // We use this in the code generator as we perform symbol table // lookups prior to initializing the properties diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index a443fda86..ba2d2a52a 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -361,106 +361,6 @@ const HashEntry* JSObject::findPropertyHashEntry(ExecState* exec, const Identifi return 0; } -void JSObject::defineGetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) -{ - if (propertyName == exec->propertyNames().underscoreProto) { - // Defining a getter for __proto__ is silently ignored. - return; - } - - JSValue object = thisObject->getDirect(exec->globalData(), propertyName); - if (object && object.isGetterSetter()) { - ASSERT(thisObject->structure()->hasGetterSetterProperties()); - asGetterSetter(object)->setGetter(exec->globalData(), getterFunction); - return; - } - - JSGlobalData& globalData = exec->globalData(); - PutPropertySlot slot; - GetterSetter* getterSetter = GetterSetter::create(exec); - thisObject->putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes | Accessor, slot, 0); - - // putDirect will change our Structure if we add a new property. For - // getters and setters, though, we also need to change our Structure - // if we override an existing non-getter or non-setter. - if (slot.type() != PutPropertySlot::NewProperty) - thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, thisObject->structure(), propertyName, attributes | Accessor)); - - thisObject->structure()->setHasGetterSetterProperties(true); - getterSetter->setGetter(globalData, getterFunction); -} - -void JSObject::initializeGetterSetterProperty(ExecState* exec, const Identifier& propertyName, GetterSetter* getterSetter, unsigned attributes) -{ - // Set an inital property on an object; the property must not already exist & the attribute flags must be set correctly. - ASSERT(structure()->get(exec->globalData(), propertyName) == WTF::notFound); - ASSERT(static_cast<bool>(attributes & Accessor)); - - JSGlobalData& globalData = exec->globalData(); - PutPropertySlot slot; - putDirectInternal<PutModeDefineOwnProperty>(globalData, propertyName, getterSetter, attributes, slot, 0); - - // putDirect will change our Structure if we add a new property. For - // getters and setters, though, we also need to change our Structure - // if we override an existing non-getter or non-setter. - if (slot.type() != PutPropertySlot::NewProperty) - setStructure(exec->globalData(), Structure::attributeChangeTransition(globalData, structure(), propertyName, attributes)); - - structure()->setHasGetterSetterProperties(true); -} - -void JSObject::defineSetter(JSObject* thisObject, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) -{ - if (propertyName == exec->propertyNames().underscoreProto) { - // Defining a setter for __proto__ is silently ignored. - return; - } - - JSValue object = thisObject->getDirect(exec->globalData(), propertyName); - if (object && object.isGetterSetter()) { - ASSERT(thisObject->structure()->hasGetterSetterProperties()); - asGetterSetter(object)->setSetter(exec->globalData(), setterFunction); - return; - } - - PutPropertySlot slot; - GetterSetter* getterSetter = GetterSetter::create(exec); - thisObject->putDirectInternal<PutModeDefineOwnProperty>(exec->globalData(), propertyName, getterSetter, attributes | Accessor, slot, 0); - - // putDirect will change our Structure if we add a new property. For - // getters and setters, though, we also need to change our Structure - // if we override an existing non-getter or non-setter. - if (slot.type() != PutPropertySlot::NewProperty) - thisObject->setStructure(exec->globalData(), Structure::attributeChangeTransition(exec->globalData(), thisObject->structure(), propertyName, attributes | Accessor)); - - thisObject->structure()->setHasGetterSetterProperties(true); - getterSetter->setSetter(exec->globalData(), setterFunction); -} - -JSValue JSObject::lookupGetter(ExecState* exec, const Identifier& propertyName) -{ - PropertyDescriptor descriptor; - if (!getPropertyDescriptor(exec, propertyName, descriptor)) - return jsUndefined(); - - if (!descriptor.getterPresent()) - return jsUndefined(); - - return descriptor.getter(); -} - -JSValue JSObject::lookupSetter(ExecState* exec, const Identifier& propertyName) -{ - PropertyDescriptor descriptor; - if (!getPropertyDescriptor(exec, propertyName, descriptor)) - return jsUndefined(); - - if (!descriptor.setterPresent()) - return jsUndefined(); - - return descriptor.setter(); -} - bool JSObject::hasInstance(JSObject*, ExecState* exec, JSValue value, JSValue proto) { if (!value.isObject()) diff --git a/Source/JavaScriptCore/runtime/JSObject.h b/Source/JavaScriptCore/runtime/JSObject.h index 433249c20..e9194fa01 100644 --- a/Source/JavaScriptCore/runtime/JSObject.h +++ b/Source/JavaScriptCore/runtime/JSObject.h @@ -192,13 +192,6 @@ namespace JSC { void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); } void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); } - JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); - void initializeGetterSetterProperty(ExecState*, const Identifier&, GetterSetter*, unsigned attributes); - - JS_EXPORT_PRIVATE static void defineGetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0); - JS_EXPORT_PRIVATE static void defineSetter(JSObject*, ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0); - JS_EXPORT_PRIVATE JSValue lookupGetter(ExecState*, const Identifier& propertyName); - JS_EXPORT_PRIVATE JSValue lookupSetter(ExecState*, const Identifier& propertyName); JS_EXPORT_PRIVATE static bool defineOwnProperty(JSObject*, ExecState*, const Identifier& propertyName, PropertyDescriptor&, bool shouldThrow); bool isGlobalObject() const; @@ -296,6 +289,7 @@ namespace JSC { bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*); bool inlineGetOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location); const HashEntry* findPropertyHashEntry(ExecState*, const Identifier& propertyName) const; Structure* createInheritorID(JSGlobalData&); diff --git a/Source/JavaScriptCore/runtime/JSType.h b/Source/JavaScriptCore/runtime/JSType.h index 84a27a7ea..880240e60 100644 --- a/Source/JavaScriptCore/runtime/JSType.h +++ b/Source/JavaScriptCore/runtime/JSType.h @@ -49,11 +49,12 @@ enum JSType { ErrorInstanceType, GlobalThisType, - // VariableObjectType must come before all of the types of its subclasses and only its subclasses. + StaticScopeObjectType, + // VariableObjectType must be less than MOST of the types of its subclasses and only its subclasses. + // We use >=VariableObjectType checks to test for Global & Activation objects, but exclude StaticScopes. VariableObjectType, GlobalObjectType, ActivationObjectType, - StaticScopeObjectType, }; } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/JSValue.cpp b/Source/JavaScriptCore/runtime/JSValue.cpp index 6b803c316..72cf5a8d5 100644 --- a/Source/JavaScriptCore/runtime/JSValue.cpp +++ b/Source/JavaScriptCore/runtime/JSValue.cpp @@ -116,7 +116,6 @@ JSObject* JSValue::synthesizePrototype(ExecState* exec) const return JSNotAnObject::create(exec); } -#ifndef NDEBUG char* JSValue::description() { static const size_t size = 64; @@ -152,7 +151,6 @@ char* JSValue::description() return description; } -#endif // This in the ToInt32 operation is defined in section 9.5 of the ECMA-262 spec. // Note that this operation is identical to ToUInt32 other than to interpretation diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 79e50fba0..b18c181f5 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -232,9 +232,7 @@ namespace JSC { JSCell* asCell() const; JS_EXPORT_PRIVATE bool isValidCallee(); -#ifndef NDEBUG char* description(); -#endif private: template <class T> JSValue(WriteBarrierBase<T>); diff --git a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp index 7ca7dae61..674bd7b7d 100644 --- a/Source/JavaScriptCore/runtime/ObjectPrototype.cpp +++ b/Source/JavaScriptCore/runtime/ObjectPrototype.cpp @@ -146,10 +146,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineGetter(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); + JSValue get = exec->argument(1); CallData callData; - if (getCallData(exec->argument(1), callData) == CallTypeNone) + if (getCallData(get, callData) == CallTypeNone) return throwVMError(exec, createSyntaxError(exec, "invalid getter usage")); - thisObject->methodTable()->defineGetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0); + + PropertyDescriptor descriptor; + descriptor.setGetter(get); + descriptor.setEnumerable(true); + descriptor.setConfigurable(true); + thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false); + return JSValue::encode(jsUndefined()); } @@ -159,10 +166,17 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncDefineSetter(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); + JSValue set = exec->argument(1); CallData callData; - if (getCallData(exec->argument(1), callData) == CallTypeNone) + if (getCallData(set, callData) == CallTypeNone) return throwVMError(exec, createSyntaxError(exec, "invalid setter usage")); - thisObject->methodTable()->defineSetter(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), asObject(exec->argument(1)), 0); + + PropertyDescriptor descriptor; + descriptor.setSetter(set); + descriptor.setEnumerable(true); + descriptor.setConfigurable(true); + thisObject->methodTable()->defineOwnProperty(thisObject, exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor, false); + return JSValue::encode(jsUndefined()); } @@ -172,7 +186,12 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupGetter(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); - return JSValue::encode(thisObject->lookupGetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))); + PropertyDescriptor descriptor; + if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor) + && descriptor.getterPresent()) + return JSValue::encode(descriptor.getter()); + + return JSValue::encode(jsUndefined()); } EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) @@ -181,7 +200,12 @@ EncodedJSValue JSC_HOST_CALL objectProtoFuncLookupSetter(ExecState* exec) if (exec->hadException()) return JSValue::encode(jsUndefined()); - return JSValue::encode(thisObject->lookupSetter(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)))); + PropertyDescriptor descriptor; + if (thisObject->getPropertyDescriptor(exec, Identifier(exec, exec->argument(0).toString(exec)->value(exec)), descriptor) + && descriptor.setterPresent()) + return JSValue::encode(descriptor.setter()); + + return JSValue::encode(jsUndefined()); } EncodedJSValue JSC_HOST_CALL objectProtoFuncPropertyIsEnumerable(ExecState* exec) diff --git a/Source/JavaScriptCore/runtime/WriteBarrier.h b/Source/JavaScriptCore/runtime/WriteBarrier.h index a7bd7a100..6ac52b7c7 100644 --- a/Source/JavaScriptCore/runtime/WriteBarrier.h +++ b/Source/JavaScriptCore/runtime/WriteBarrier.h @@ -93,7 +93,7 @@ public: { if (m_cell) validateCell(m_cell); - return reinterpret_cast<T*>(m_cell); + return reinterpret_cast<T*>(static_cast<void*>(m_cell)); } T* operator*() const @@ -128,7 +128,7 @@ public: } #if ENABLE(GC_VALIDATION) - T* unvalidatedGet() const { return reinterpret_cast<T*>(m_cell); } + T* unvalidatedGet() const { return reinterpret_cast<T*>(static_cast<void*>(m_cell)); } #endif private: diff --git a/Source/JavaScriptCore/shell/CMakeLists.txt b/Source/JavaScriptCore/shell/CMakeLists.txt index fa04b8598..44f02b93c 100644 --- a/Source/JavaScriptCore/shell/CMakeLists.txt +++ b/Source/JavaScriptCore/shell/CMakeLists.txt @@ -20,8 +20,8 @@ IF (JSC_LINK_FLAGS) ADD_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} LINK_FLAGS "${JSC_LINK_FLAGS}") ENDIF () -IF (SHARED_CORE) - SET_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} PROPERTIES VERSION ${PROJECT_VERSION}) +IF ("${PORT}" STREQUAL "Efl") + SET_TARGET_PROPERTIES(${JSC_EXECUTABLE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") ENDIF () IF (SHOULD_INSTALL_JS_SHELL) diff --git a/Source/JavaScriptCore/tools/CodeProfiling.cpp b/Source/JavaScriptCore/tools/CodeProfiling.cpp index f236484c9..d927a49f6 100644 --- a/Source/JavaScriptCore/tools/CodeProfiling.cpp +++ b/Source/JavaScriptCore/tools/CodeProfiling.cpp @@ -28,7 +28,10 @@ #include "CodeProfile.h" #include "MetaAllocator.h" -#include "signal.h" + +#if HAVE(SIGNAL_H) +#include <signal.h> +#endif namespace JSC { @@ -78,6 +81,7 @@ void CodeProfiling::sample(void* pc, void** framePointer) void CodeProfiling::notifyAllocator(WTF::MetaAllocator* allocator) { +#if !OS(WINCE) // Check for JSC_CODE_PROFILING. const char* codeProfilingMode = getenv("JSC_CODE_PROFILING"); if (!codeProfilingMode) @@ -104,6 +108,7 @@ void CodeProfiling::notifyAllocator(WTF::MetaAllocator* allocator) ASSERT(!s_tracker); s_tracker = new WTF::MetaAllocatorTracker(); allocator->trackAllocations(s_tracker); +#endif } void* CodeProfiling::getOwnerUIDForPC(void* address) diff --git a/Source/JavaScriptCore/wtf/BitVector.cpp b/Source/JavaScriptCore/wtf/BitVector.cpp index 49dc21129..863a5703a 100644 --- a/Source/JavaScriptCore/wtf/BitVector.cpp +++ b/Source/JavaScriptCore/wtf/BitVector.cpp @@ -105,7 +105,6 @@ void BitVector::resizeOutOfLine(size_t numBits) m_bitsOrPointer = bitwise_cast<uintptr_t>(newOutOfLineBits) >> 1; } -#ifndef NDEBUG void BitVector::dump(FILE* out) { for (size_t i = 0; i < size(); ++i) { @@ -115,6 +114,5 @@ void BitVector::dump(FILE* out) fprintf(out, "-"); } } -#endif } // namespace WTF diff --git a/Source/JavaScriptCore/wtf/BitVector.h b/Source/JavaScriptCore/wtf/BitVector.h index 109d3ffcf..335656c40 100644 --- a/Source/JavaScriptCore/wtf/BitVector.h +++ b/Source/JavaScriptCore/wtf/BitVector.h @@ -26,13 +26,10 @@ #ifndef BitVector_h #define BitVector_h +#include <stdio.h> #include <wtf/Assertions.h> #include <wtf/StdLibExtras.h> -#ifndef NDEBUG -#include <stdio.h> -#endif - namespace WTF { // This is a space-efficient, resizeable bitvector class. In the common case it @@ -165,9 +162,7 @@ public: clear(bit); } -#ifndef NDEBUG void dump(FILE* out); -#endif private: static unsigned bitsInPointer() diff --git a/Source/JavaScriptCore/wtf/CurrentTime.cpp b/Source/JavaScriptCore/wtf/CurrentTime.cpp index c8c77f54f..1ebd084d8 100644 --- a/Source/JavaScriptCore/wtf/CurrentTime.cpp +++ b/Source/JavaScriptCore/wtf/CurrentTime.cpp @@ -56,8 +56,6 @@ extern "C" time_t mktime(struct tm *t); #endif #endif -#elif PLATFORM(GTK) -#include <glib.h> #elif PLATFORM(WX) #include <wx/datetime.h> #elif PLATFORM(EFL) @@ -66,6 +64,10 @@ extern "C" time_t mktime(struct tm *t); #include <sys/time.h> #endif +#if PLATFORM(GTK) +#include <glib.h> +#endif + #if PLATFORM(QT) #include <QElapsedTimer> #endif diff --git a/Source/JavaScriptCore/wtf/FastAllocBase.h b/Source/JavaScriptCore/wtf/FastAllocBase.h index 1edbed94d..b9ab0cab1 100644 --- a/Source/JavaScriptCore/wtf/FastAllocBase.h +++ b/Source/JavaScriptCore/wtf/FastAllocBase.h @@ -129,7 +129,7 @@ public: \ return location; \ } \ private: \ -typedef int ThisIsHereToForceASemicolonAfterThisMacro +typedef int __thisIsHereToForceASemicolonAfterThisMacro namespace WTF { diff --git a/Source/JavaScriptCore/wtf/HashTable.h b/Source/JavaScriptCore/wtf/HashTable.h index 44f914330..cbcc09817 100644 --- a/Source/JavaScriptCore/wtf/HashTable.h +++ b/Source/JavaScriptCore/wtf/HashTable.h @@ -478,7 +478,8 @@ namespace WTF { return; ASSERT(!HashTranslator::equal(KeyTraits::emptyValue(), key)); AlignedBuffer<sizeof(ValueType), WTF_ALIGN_OF(ValueType)> deletedValueBuffer; - ValueType& deletedValue = *reinterpret_cast_ptr<ValueType*>(deletedValueBuffer.buffer); + ValueType* deletedValuePtr = reinterpret_cast_ptr<ValueType*>(deletedValueBuffer.buffer); + ValueType& deletedValue = *deletedValuePtr; Traits::constructDeletedValue(deletedValue); ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key)); } diff --git a/Source/JavaScriptCore/wtf/Platform.h b/Source/JavaScriptCore/wtf/Platform.h index cecd5ddcd..e6d43dac3 100644 --- a/Source/JavaScriptCore/wtf/Platform.h +++ b/Source/JavaScriptCore/wtf/Platform.h @@ -859,10 +859,6 @@ #define ENABLE_GEOLOCATION 0 #endif -#if !defined(ENABLE_GESTURE_RECOGNIZER) -#define ENABLE_GESTURE_RECOGNIZER 0 -#endif - #if !defined(ENABLE_VIEWPORT) #define ENABLE_VIEWPORT 0 #endif @@ -1113,7 +1109,11 @@ since most ports try to support sub-project independence, adding new headers to WTF causes many ports to break, and so this way we can address the build breakages one port at a time. */ +#if PLATFORM(MAC) || PLATFORM(QT) +#define WTF_USE_EXPORT_MACROS 1 +#else #define WTF_USE_EXPORT_MACROS 0 +#endif #if (PLATFORM(QT) && !OS(DARWIN)) || PLATFORM(GTK) || PLATFORM(EFL) #define WTF_USE_UNIX_DOMAIN_SOCKETS 1 @@ -1137,6 +1137,10 @@ #define WTF_USE_AVFOUNDATION 1 #endif +#if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#define WTF_USE_COREMEDIA 1 +#endif + #if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(EFL) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(QT) #define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1 #endif diff --git a/Source/JavaScriptCore/wtf/ThreadSpecific.h b/Source/JavaScriptCore/wtf/ThreadSpecific.h index 7c75a83ee..242acc0d3 100644 --- a/Source/JavaScriptCore/wtf/ThreadSpecific.h +++ b/Source/JavaScriptCore/wtf/ThreadSpecific.h @@ -46,8 +46,6 @@ #if USE(PTHREADS) #include <pthread.h> -#elif PLATFORM(GTK) -#include <glib.h> #elif OS(WINDOWS) #include <windows.h> #endif @@ -100,8 +98,6 @@ private: #if USE(PTHREADS) pthread_key_t m_key; -#elif PLATFORM(GTK) - GStaticPrivate m_key; #elif OS(WINDOWS) int m_index; #endif @@ -130,29 +126,6 @@ inline void ThreadSpecific<T>::set(T* ptr) pthread_setspecific(m_key, new Data(ptr, this)); } -#elif PLATFORM(GTK) - -template<typename T> -inline ThreadSpecific<T>::ThreadSpecific() -{ - g_static_private_init(&m_key); -} - -template<typename T> -inline T* ThreadSpecific<T>::get() -{ - Data* data = static_cast<Data*>(g_static_private_get(&m_key)); - return data ? data->value : 0; -} - -template<typename T> -inline void ThreadSpecific<T>::set(T* ptr) -{ - ASSERT(!get()); - Data* data = new Data(ptr, this); - g_static_private_set(&m_key, data, destroy); -} - #elif OS(WINDOWS) // TLS_OUT_OF_INDEXES is not defined on WinCE. @@ -218,9 +191,6 @@ inline void ThreadSpecific<T>::destroy(void* ptr) // We want get() to keep working while data destructor works, because it can be called indirectly by the destructor. // Some pthreads implementations zero out the pointer before calling destroy(), so we temporarily reset it. pthread_setspecific(data->owner->m_key, ptr); -#elif PLATFORM(GTK) - // See comment as above - g_static_private_set(&data->owner->m_key, data, 0); #endif data->value->~T(); @@ -228,8 +198,6 @@ inline void ThreadSpecific<T>::destroy(void* ptr) #if USE(PTHREADS) pthread_setspecific(data->owner->m_key, 0); -#elif PLATFORM(GTK) - g_static_private_set(&data->owner->m_key, 0, 0); #elif OS(WINDOWS) TlsSetValue(tlsKeys()[data->owner->m_index], 0); #else diff --git a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp index 6fcd806eb..1a2a8b1f1 100644 --- a/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp +++ b/Source/JavaScriptCore/wtf/gobject/GlibUtilities.cpp @@ -20,8 +20,13 @@ #include "config.h" #include "GlibUtilities.h" +#if OS(WINDOWS) +#include <windows.h> +#include <wtf/text/WTFString.h> +#else #include <limits.h> #include <unistd.h> +#endif #if OS(LINUX) CString getCurrentExecutablePath() @@ -41,4 +46,15 @@ CString getCurrentExecutablePath() return CString(); return CString(readLinkBuffer, result); } +#elif OS(WINDOWS) +CString getCurrentExecutablePath() +{ + static WCHAR buffer[MAX_PATH]; + DWORD length = GetModuleFileNameW(0, buffer, MAX_PATH); + if (!length || (length == MAX_PATH && GetLastError() == ERROR_INSUFFICIENT_BUFFER)) + return CString(); + + String path(buffer, length); + return path.utf8(); +} #endif diff --git a/Source/JavaScriptCore/yarr/YarrPattern.cpp b/Source/JavaScriptCore/yarr/YarrPattern.cpp index 1043e405d..f0d10e624 100644 --- a/Source/JavaScriptCore/yarr/YarrPattern.cpp +++ b/Source/JavaScriptCore/yarr/YarrPattern.cpp @@ -476,14 +476,23 @@ public: ASSERT(term.type > PatternTerm::TypeAssertionWordBoundary); ASSERT((term.quantityCount == 1) && (term.quantityType == QuantifierFixedCount)); - // For any assertion with a zero minimum, not matching is valid and has no effect, - // remove it. Otherwise, we need to match as least once, but there is no point - // matching more than once, so remove the quantifier. It is not entirely clear - // from the spec whether or not this behavior is correct, but I believe this - // matches Firefox. :-/ if (term.type == PatternTerm::TypeParentheticalAssertion) { + // If an assertion is quantified with a minimum count of zero, it can simply be removed. + // This arises from the RepeatMatcher behaviour in the spec. Matching an assertion never + // results in any input being consumed, however the continuation passed to the assertion + // (called in steps, 8c and 9 of the RepeatMatcher definition, ES5.1 15.10.2.5) will + // reject all zero length matches (see step 2.1). A match from the continuation of the + // expression will still be accepted regardless (via steps 8a and 11) - the upshot of all + // this is that matches from the assertion are not required, and won't be accepted anyway, + // so no need to ever run it. if (!min) m_alternative->removeLastTerm(); + // We never need to run an assertion more than once. Subsequent interations will be run + // with the same start index (since assertions are non-capturing) and the same captures + // (per step 4 of RepeatMatcher in ES5.1 15.10.2.5), and as such will always produce the + // same result and captures. If the first match succeeds then the subsequent (min - 1) + // matches will too. Any additional optional matches will fail (on the same basis as the + // minimum zero quantified assertions, above), but this will still result in a match. return; } diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index fc45347b2..45c8504ed 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,89 @@ +2012-02-08 James Robinson <jamesr@chromium.org> + + r107042 caused compile breakages on chromium try bots + https://bugs.webkit.org/show_bug.cgi?id=78125 + + Reviewed by Adam Barth. + + Replace the copy script with a copies GYP action since the MSVS generator tracks dependencies on a per-file + basis. + + * Platform.gyp/Platform.gyp: + * Platform.gyp/copy_webcore_headers.py: Removed. + +2012-02-07 James Robinson <jamesr@chromium.org> + + [chromium] Move geometry headers in Platform API to Platform directory + https://bugs.webkit.org/show_bug.cgi?id=78067 + + Reviewed by Adam Barth. + + This moves several geometry-related headers in the chromium WebKit platform API to Platform/chromium/public. + These require a bit of extra work since when WEBKIT_IMPLEMENTATION is set they #include headers from + WebCore/platform such as IntPoint so that the implementations of several functions can be inlined. Since we do + not want to add anything in WebCore to the include path of projects that depend on the Platform API this poses a + bit of an issue. I've added an extra build step to copy the specific headers used into the + SHARED_INTERMEDIATE_DIR to preserve this inlining. + + Eventually we'll move the cross-platform code, including these headers, into somewhere under Platform/, but doing + that requires non-trivial modifications to every build system in WebKit. + + * Platform.gyp/Platform.gyp: + * Platform.gyp/copy_webcore_headers.py: Added. + (CopyHeaders): + (Main): + * chromium/public/WebFloatPoint.h: Copied from Source/WebKit/chromium/public/platform/WebFloatPoint.h. + (WebKit): + (WebFloatPoint): + (WebKit::WebFloatPoint::WebFloatPoint): + (WebKit::WebFloatPoint::operator=): + (WebKit::WebFloatPoint::operator WebCore::FloatPoint): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebFloatQuad.h: Copied from Source/WebKit/chromium/public/platform/WebFloatQuad.h. + (WebKit): + (WebFloatQuad): + (WebKit::WebFloatQuad::WebFloatQuad): + (WebKit::WebFloatQuad::operator=): + * chromium/public/WebFloatRect.h: Copied from Source/WebKit/chromium/public/platform/WebFloatRect.h. + (WebKit): + (WebFloatRect): + (WebKit::WebFloatRect::isEmpty): + (WebKit::WebFloatRect::WebFloatRect): + (WebKit::WebFloatRect::operator=): + (WebKit::WebFloatRect::operator WebCore::FloatRect): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebPoint.h: Copied from Source/WebKit/chromium/public/platform/WebPoint.h. + (WebKit): + (WebPoint): + (WebKit::WebPoint::WebPoint): + (WebKit::WebPoint::operator=): + (WebKit::WebPoint::operator WebCore::IntPoint): + (WebKit::WebPoint::operator gfx::Point): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebRect.h: Copied from Source/WebKit/chromium/public/platform/WebRect.h. + (WebKit): + (WebRect): + (WebKit::WebRect::isEmpty): + (WebKit::WebRect::WebRect): + (WebKit::WebRect::operator=): + (WebKit::WebRect::operator WebCore::IntRect): + (WebKit::WebRect::operator gfx::Rect): + (WebKit::operator==): + (WebKit::operator!=): + * chromium/public/WebSize.h: Copied from Source/WebKit/chromium/public/platform/WebSize.h. + (WebKit): + (WebSize): + (WebKit::WebSize::isEmpty): + (WebKit::WebSize::WebSize): + (WebKit::WebSize::operator=): + (WebKit::WebSize::operator WebCore::IntSize): + (WebKit::WebSize::operator gfx::Size): + (WebKit::operator==): + (WebKit::operator!=): + 2012-01-19 Joi Sigurdsson <joi@chromium.org> Enable use of precompiled headers in Chromium port on Windows. diff --git a/Source/Platform/Platform.gyp/Platform.gyp b/Source/Platform/Platform.gyp/Platform.gyp index d3d4bbe07..9182ab392 100644 --- a/Source/Platform/Platform.gyp/Platform.gyp +++ b/Source/Platform/Platform.gyp/Platform.gyp @@ -43,6 +43,7 @@ ], 'include_dirs': [ '../chromium', + '<(output_dir)', ], 'defines': [ 'WEBKIT_IMPLEMENTATION=1', @@ -50,9 +51,28 @@ 'sources': [ '<@(platform_files)', ], + 'variables': { + # List of headers that are #included in Platform API headers that exist inside + # the WebCore directory. These are only included when WEBKIT_IMPLEMENTATION=1. + # Since Platform/ can't add WebCore/* to the include path, this build step + # copies these headers into the shared intermediate directory and adds that to the include path. + # This is temporary, the better solution is to move these headers into the Platform + # directory for all ports and just use them as normal. + 'webcore_headers': [ + '../../WebCore/platform/graphics/FloatPoint.h', + '../../WebCore/platform/graphics/FloatQuad.h', + '../../WebCore/platform/graphics/FloatRect.h', + '../../WebCore/platform/graphics/FloatSize.h', + '../../WebCore/platform/graphics/IntPoint.h', + '../../WebCore/platform/graphics/IntRect.h', + '../../WebCore/platform/graphics/IntSize.h', + ], + 'output_dir': '<(SHARED_INTERMEDIATE_DIR)/webcore_headers' + }, 'direct_dependent_settings': { 'include_dirs': [ '../chromium', + '<(output_dir)' ], }, 'conditions': [ @@ -65,6 +85,14 @@ }], ], }], + ], + 'copies': [ + { + 'destination': '<(output_dir)', + 'files': [ + '<@(webcore_headers)' + ] + } ] } ] diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index 17e50adc1..c4da4d9dc 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -33,9 +33,16 @@ 'platform_files': [ 'chromium/public/WebCString.h', 'chromium/public/WebCommon.h', - 'chromium/public/WebString.h', + 'chromium/public/WebFloatPoint.h', + 'chromium/public/WebFloatQuad.h', + 'chromium/public/WebFloatRect.h', 'chromium/public/WebMimeRegistry.h', + 'chromium/public/WebPoint.h', + 'chromium/public/WebRect.h', + 'chromium/public/WebSize.h', + 'chromium/public/WebString.h', 'chromium/src/WebCString.cpp', + 'chromium/src/WebFloatQuad.cpp', 'chromium/src/WebString.cpp', ] } diff --git a/Source/Platform/chromium/public/WebFloatPoint.h b/Source/Platform/chromium/public/WebFloatPoint.h new file mode 100644 index 000000000..4afc16b9c --- /dev/null +++ b/Source/Platform/chromium/public/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebFloatQuad.h b/Source/Platform/chromium/public/WebFloatQuad.h new file mode 100644 index 000000000..da5eb0542 --- /dev/null +++ b/Source/Platform/chromium/public/WebFloatQuad.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 WebFloatQuad_h +#define WebFloatQuad_h + +#include "WebCommon.h" +#include "WebFloatPoint.h" +#include "WebRect.h" + +#include <algorithm> +#include <cmath> + +#if WEBKIT_IMPLEMENTATION +#include "FloatQuad.h" +#endif + +namespace WebKit { + +struct WebFloatQuad { + WebFloatPoint p[4]; + + WebFloatQuad() + { + } + + WebFloatQuad(const WebFloatPoint& p0, const WebFloatPoint& p1, const WebFloatPoint& p2, const WebFloatPoint& p3) + { + p[0] = p0; + p[1] = p1; + p[2] = p2; + p[3] = p3; + } + + WEBKIT_EXPORT WebRect enclosingRect() const; + +#if WEBKIT_IMPLEMENTATION + WebFloatQuad& operator=(const WebCore::FloatQuad& q) + { + p[0] = q.p1(); + p[1] = q.p2(); + p[2] = q.p3(); + p[3] = q.p4(); + return *this; + } + WebFloatQuad(const WebCore::FloatQuad& q) + { + *this = q; + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebCore/html/IsIndexInputType.cpp b/Source/Platform/chromium/public/WebFloatRect.h index a275f28eb..a883513fc 100644 --- a/Source/WebCore/html/IsIndexInputType.cpp +++ b/Source/Platform/chromium/public/WebFloatRect.h @@ -28,52 +28,76 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#include "IsIndexInputType.h" +#ifndef WebFloatRect_h +#define WebFloatRect_h -#include "Document.h" -#include "HTMLFormElement.h" -#include "HTMLInputElement.h" -#include <wtf/PassOwnPtr.h> +#include "WebCommon.h" -namespace WebCore { +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif -PassOwnPtr<InputType> IsIndexInputType::create(HTMLInputElement* element) -{ - return adoptPtr(new IsIndexInputType(element)); -} +namespace WebKit { -const AtomicString& IsIndexInputType::formControlType() const -{ - return emptyAtom; -} +struct WebFloatRect { + float x; + float y; + float width; + float height; -bool IsIndexInputType::supportsRequired() const -{ - return false; -} + bool isEmpty() const { return width <= 0 || height <= 0; } -PassRefPtr<HTMLFormElement> IsIndexInputType::formForSubmission() const -{ - RefPtr<HTMLFormElement> form = InputType::formForSubmission(); - if (form) - return form.release(); - // If there is no form, then create a temporary form just to be used for submission. - Document* document = element()->document(); - form = HTMLFormElement::create(document); - form->registerFormElement(element()); - form->setMethod("GET"); - if (!document->baseURL().isEmpty()) { - // We treat the href property of the <base> element as the form action, as per section 7.5 - // "Queries and Indexes" of the HTML 2.0 spec. <http://www.w3.org/MarkUp/html-spec/html-spec_7.html#SEC7.5>. - form->setAction(document->baseURL().string()); + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { } - return form.release(); + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; } -bool IsIndexInputType::shouldRespectListAttribute() +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) { - return false; + return !(a == b); } -} // namespace WebCore +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebPoint.h b/Source/Platform/chromium/public/WebPoint.h new file mode 100644 index 000000000..766236398 --- /dev/null +++ b/Source/Platform/chromium/public/WebPoint.h @@ -0,0 +1,111 @@ +/* + * 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 WebPoint_h +#define WebPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#else +#include <ui/gfx/point.h> +#endif + +namespace WebKit { + +struct WebPoint { + int x; + int y; + + WebPoint() + : x(0) + , y(0) + { + } + + WebPoint(int x, int y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebPoint(const WebCore::IntPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const WebCore::IntPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::IntPoint() const + { + return WebCore::IntPoint(x, y); + } +#else + WebPoint(const gfx::Point& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const gfx::Point& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator gfx::Point() const + { + return gfx::Point(x, y); + } +#endif +}; + +inline bool operator==(const WebPoint& a, const WebPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebPoint& a, const WebPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebRect.h b/Source/Platform/chromium/public/WebRect.h new file mode 100644 index 000000000..045b7a8eb --- /dev/null +++ b/Source/Platform/chromium/public/WebRect.h @@ -0,0 +1,127 @@ +/* + * 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 WebRect_h +#define WebRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#else +#include <ui/gfx/rect.h> +#endif + +namespace WebKit { + +struct WebRect { + int x; + int y; + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebRect() + : x(0) + , y(0) + , width(0) + , height(0) + { + } + + WebRect(int x, int y, int width, int height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebRect(const WebCore::IntRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const WebCore::IntRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::IntRect() const + { + return WebCore::IntRect(x, y, width, height); + } +#else + WebRect(const gfx::Rect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const gfx::Rect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::Rect() const + { + return gfx::Rect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebRect& a, const WebRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebRect& a, const WebRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/WebSize.h b/Source/Platform/chromium/public/WebSize.h new file mode 100644 index 000000000..94a53654d --- /dev/null +++ b/Source/Platform/chromium/public/WebSize.h @@ -0,0 +1,113 @@ +/* + * 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 WebSize_h +#define WebSize_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntSize.h" +#else +#include <ui/gfx/size.h> +#endif + +namespace WebKit { + +struct WebSize { + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebSize() + : width(0) + , height(0) + { + } + + WebSize(int width, int height) + : width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebSize(const WebCore::IntSize& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const WebCore::IntSize& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator WebCore::IntSize() const + { + return WebCore::IntSize(width, height); + } +#else + WebSize(const gfx::Size& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const gfx::Size& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator gfx::Size() const + { + return gfx::Size(width, height); + } +#endif +}; + +inline bool operator==(const WebSize& a, const WebSize& b) +{ + return a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebSize& a, const WebSize& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/src/WebFloatQuad.cpp b/Source/Platform/chromium/src/WebFloatQuad.cpp index fe7d68a98..67cbdc601 100644 --- a/Source/WebKit/chromium/src/WebFloatQuad.cpp +++ b/Source/Platform/chromium/src/WebFloatQuad.cpp @@ -29,16 +29,21 @@ */ #include "config.h" -#include "platform/WebFloatQuad.h" +#include <public/WebFloatQuad.h> + +#include <algorithm> +#include <math.h> + +using namespace std; namespace WebKit { WebRect WebFloatQuad::enclosingRect() const { - int left = static_cast<int>(floorf(std::min(std::min(std::min(p[0].x, p[1].x), p[2].x), p[3].x))); - int top = static_cast<int>(floorf(std::min(std::min(std::min(p[0].y, p[1].y), p[2].y), p[3].y))); - int right = static_cast<int>(ceilf(std::max(std::max(std::max(p[0].x, p[1].x), p[2].x), p[3].x))); - int bottom = static_cast<int>(ceilf(std::max(std::max(std::max(p[0].y, p[1].y), p[2].y), p[3].y))); + int left = static_cast<int>(floorf(min(min(min(p[0].x, p[1].x), p[2].x), p[3].x))); + int top = static_cast<int>(floorf(min(min(min(p[0].y, p[1].y), p[2].y), p[3].y))); + int right = static_cast<int>(ceilf(max(max(max(p[0].x, p[1].x), p[2].x), p[3].x))); + int bottom = static_cast<int>(ceilf(max(max(max(p[0].y, p[1].y), p[2].y), p[3].y))); return WebRect(left, top, right - left, bottom - top); } diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index 58d551c62..77d449075 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,20 @@ +2012-02-03 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix build when cross-compiling + https://bugs.webkit.org/show_bug.cgi?id=77634 + + Reviewed by Tor Arne Vestbø. + + * WTF.pri: Don't use icu-config for determining the library search + path and libraries needed for ICU. Either we use icu-config for includes + _and_ libraries or we don't. Right now we assume that icu is a system library + and expect the headers in the default include search pathes (/usr/include for example). + However we use icu-config to figure out where the libraries are, which breaks when + cross-compiling, because icu-config isn't cross-compile friendly (I wish icu was using + pkg-config). I think for the time being we should require ICU as a _system_ library, + which implies the header and library availability in default search paths. This also + makes the build succeed when cross-compiling with --sysroot. + 2012-01-27 Zeno Albisser <zeno@webkit.org> [Qt][Mac] Build fails after adding ICU support (r105997). diff --git a/Source/WTF/WTF.pri b/Source/WTF/WTF.pri index f7a68c3d7..76cc40ff6 100644 --- a/Source/WTF/WTF.pri +++ b/Source/WTF/WTF.pri @@ -25,8 +25,7 @@ haveQt(5) { LIBS += -licucore } else { contains(QT_CONFIG,icu) { - unix: LIBS += $$system(icu-config --ldflags-searchpath --ldflags-libsonly) - else: LIBS += -licuin + LIBS += -licui18n -licuuc -licudata } else { error("To build QtWebKit with Qt 5 you need ICU") } diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index 9452b1472..c583668ef 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -307,6 +307,7 @@ SET(WebCore_IDL_FILES html/canvas/Uint8ClampedArray.idl html/shadow/HTMLContentElement.idl + html/shadow/HTMLShadowElement.idl html/track/TextTrackList.idl html/track/TrackEvent.idl @@ -452,7 +453,6 @@ SET(WebCore_SOURCES css/CSSInitialValue.cpp css/CSSLineBoxContainValue.cpp css/CSSMediaRule.cpp - css/CSSMutableStyleDeclaration.cpp css/CSSOMUtils.cpp css/CSSPageRule.cpp css/CSSParser.cpp @@ -493,6 +493,7 @@ SET(WebCore_SOURCES css/SelectorChecker.cpp css/ShadowValue.cpp css/StyleMedia.cpp + css/StylePropertySet.cpp css/StyleSheet.cpp css/StyleSheetList.cpp css/WebKitCSSFilterValue.cpp @@ -520,7 +521,6 @@ SET(WebCore_SOURCES dom/Comment.cpp dom/CompositionEvent.cpp dom/ContainerNode.cpp - dom/CSSMappedAttributeDeclaration.cpp dom/CustomEvent.cpp dom/DatasetDOMStringMap.cpp dom/DecodedDataDocumentParser.cpp @@ -808,7 +808,6 @@ SET(WebCore_SOURCES html/ImageDocument.cpp html/ImageInputType.cpp html/InputType.cpp - html/IsIndexInputType.cpp html/LabelsNodeList.cpp html/LinkRelAttribute.cpp html/MediaController.cpp @@ -867,6 +866,7 @@ SET(WebCore_SOURCES html/shadow/ContentInclusionSelector.cpp html/shadow/DetailsMarkerControl.cpp html/shadow/HTMLContentElement.cpp + html/shadow/HTMLShadowElement.cpp html/shadow/MediaControls.cpp html/shadow/MediaControlRootElement.cpp html/shadow/MeterShadowElement.cpp @@ -900,6 +900,7 @@ SET(WebCore_SOURCES inspector/InspectorFileSystemAgent.cpp inspector/InspectorFrontendClientLocal.cpp inspector/InspectorFrontendHost.cpp + inspector/InspectorHistory.cpp inspector/InspectorIndexedDBAgent.cpp inspector/InspectorInstrumentation.cpp inspector/InspectorMemoryAgent.cpp @@ -1585,6 +1586,7 @@ if (ENABLE_FILE_SYSTEM) fileapi/Entry.cpp fileapi/EntryArray.cpp fileapi/EntryArraySync.cpp + fileapi/EntryBase.cpp fileapi/EntrySync.cpp fileapi/FileEntry.cpp fileapi/FileEntrySync.cpp @@ -2022,8 +2024,8 @@ IF (ENABLE_VIDEO) html/HTMLSourceElement.cpp html/HTMLVideoElement.cpp html/MediaFragmentURIParser.cpp - html/shadow/MediaControlElements.cpp html/TimeRanges.cpp + html/shadow/MediaControlElements.cpp platform/graphics/MediaPlayer.cpp rendering/RenderMedia.cpp rendering/RenderVideo.cpp @@ -2137,21 +2139,27 @@ IF (ENABLE_WEBGL) ${DERIVED_SOURCES_WEBCORE_DIR}/glslang.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/glslang_tab.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/CodeGenGLSL.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/BuiltInFunctionEmulator.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/CodeGenGLSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/Compiler.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/debug.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/DetectRecursion.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/ForLoopUnroll.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/InfoSink.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/Initialize.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/InitializeDll.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/Intermediate.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/intermOut.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/IntermTraverse.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/MapLongVariableNames.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/ossource_posix.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/OutputESSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/OutputGLSL.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/OutputGLSLBase.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/OutputHLSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/parseConst.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/ParseHelper.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/PoolAlloc.cpp - ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/atom.c ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/cpp.c ${THIRDPARTY_DIR}/ANGLE/src/compiler/preprocessor/cppstruct.c @@ -2165,15 +2173,15 @@ IF (ENABLE_WEBGL) ${THIRDPARTY_DIR}/ANGLE/src/compiler/ShaderLang.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/SymbolTable.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/VersionGLSL.cpp + ${THIRDPARTY_DIR}/ANGLE/src/compiler/TranslatorESSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/TranslatorGLSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/TranslatorHLSL.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/UnfoldSelect.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/util.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/ValidateLimitations.cpp ${THIRDPARTY_DIR}/ANGLE/src/compiler/VariableInfo.cpp - html/canvas/WebGLBuffer.cpp - html/canvas/WebGLCompressedTextures.cpp + html/canvas/WebGLCompressedTextureS3TC.cpp html/canvas/WebGLContextAttributes.cpp html/canvas/WebGLContextEvent.cpp html/canvas/WebGLContextGroup.cpp @@ -2196,10 +2204,8 @@ IF (ENABLE_WEBGL) html/canvas/OESStandardDerivatives.cpp html/canvas/OESTextureFloat.cpp html/canvas/OESVertexArrayObject.cpp - platform/graphics/ANGLEWebKitBridge.cpp platform/graphics/GraphicsContext3D.cpp - platform/graphics/gpu/DrawingBuffer.cpp ) LIST(APPEND WebCore_IDL_FILES @@ -2208,7 +2214,7 @@ IF (ENABLE_WEBGL) html/canvas/OESVertexArrayObject.idl html/canvas/WebGLActiveInfo.idl html/canvas/WebGLBuffer.idl - html/canvas/WebGLCompressedTextures.idl + html/canvas/WebGLCompressedTextureS3TC.idl html/canvas/WebGLContextAttributes.idl html/canvas/WebGLContextEvent.idl html/canvas/WebGLDebugRendererInfo.idl diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 16cb54be2..b15d4c227 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,9917 @@ +2012-02-09 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: Timeline memory graph would have been more useful if it had used minUsedHeapSize as the lower bound. Currently it uses zero as the lower bound. + https://bugs.webkit.org/show_bug.cgi?id=78222 + + Reviewed by Pavel Feldman. + + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.HeapGraph): + (WebInspector.HeapGraph.prototype.update): + * inspector/front-end/timelinePanel.css: + (.memory-graph-label): + (.max.memory-graph-label): + (.min.memory-graph-label): + +2012-02-09 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Update protocol and UI to follow bug 77204 (Kill per-Attribute style declarations) + https://bugs.webkit.org/show_bug.cgi?id=77962 + + Reviewed by Pavel Feldman. + + * English.lproj/localizedStrings.js: + * inspector/Inspector.json: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getInlineStylesForNode): + (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/front-end/AuditRules.js: + (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun): + (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.getStyles): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSStyleModel.prototype.getInlineStylesAsync): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate.inlineCallback): + (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules): + (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules.get continue): + +2012-02-08 Pavel Feldman <pfeldman@google.com> + + Web Inspector: toggle Edit as HTML on F2, drag nodes up / down upon Ctrl(Cmd) Up / Down. + https://bugs.webkit.org/show_bug.cgi?id=78123 + + Reviewed by Yury Semikhatsky. + + * English.lproj/localizedStrings.js: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::SetOuterHTMLAction): + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::undo): + (InspectorDOMAgent::SetOuterHTMLAction): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._registerShortcuts): + (WebInspector.ElementsPanel.prototype.handleShortcut): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype._ondragstart): + (WebInspector.ElementsTreeOutline.prototype._ondragover): + (WebInspector.ElementsTreeOutline.prototype._doMove): + (WebInspector.ElementsTreeOutline.prototype._ondragend): + (WebInspector.ElementsTreeOutline.prototype._populateContextMenu): + (WebInspector.ElementsTreeOutline.prototype.handleShortcut): + (WebInspector.ElementsTreeOutline.prototype._toggleEditAsHTML): + (WebInspector.ElementsTreeOutline.prototype._selectNodeAfterEdit): + (WebInspector.ElementsTreeElement.prototype._startEditingAsHTML.commit): + (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted.changeTagNameCallback): + (WebInspector.ElementsTreeElement.prototype._tagNameEditingCommitted): + * inspector/front-end/UIUtils.js: + +2012-02-09 Roland Steiner <rolandsteiner@chromium.org> + + SelectorChecker::checkSelector: move parameters into a struct + https://bugs.webkit.org/show_bug.cgi?id=77525 + + Added 'SelectorCheckingContext' struct to hold parameters for the function. + Adapted calling sites. + (fixing change log after the commit message got bungled up). + + Reviewed by Antti Koivisto. + + No new tests. (refactoring) + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::checkSelector): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkSelector): + (WebCore): + (WebCore::SelectorChecker::checkOneSelector): + * css/SelectorChecker.h: + (SelectorCheckingContext): + (WebCore::SelectorChecker::SelectorCheckingContext::SelectorCheckingContext): + (SelectorChecker): + +2012-02-09 Philip Rogers <pdr@google.com> + + Fix mirroring with SVG fonts + https://bugs.webkit.org/show_bug.cgi?id=77067 + + Reviewed by Nikolas Zimmermann. + + SVG fonts were incorrectly handling mirrored characters in bidi text. + In this change I added the function createStringWithMirroredCharacters + which handles mirroring the characters when selecting glyphs for SVG + fonts. I also made a small cosmetic change in the function + charactersWithArabicForm, changing the bool parameter "mirror" to "rtl" + which better reflects what it actually does. + + Several new tests were added to test mirroring with SVG fonts in the + presence of Arabic forms and non-BMP characters. + + Tests: svg/custom/glyph-selection-arabic-forms.svg + svg/custom/glyph-selection-bidi-mirror.svg + svg/custom/glyph-selection-non-bmp.svg + + * platform/graphics/SVGGlyph.cpp: + (WebCore::charactersWithArabicForm): + * svg/SVGFontData.cpp: + (WebCore::SVGFontData::applySVGGlyphSelection): + (WebCore::SVGFontData::createStringWithMirroredCharacters): + * svg/SVGFontData.h: + (SVGFontData): + +2012-02-09 Vsevolod Vlasov <vsevik@chromium.org> + + Web Inspector: Scripts navigator fails to reopen previously closed script. + https://bugs.webkit.org/show_bug.cgi?id=78212 + + Reviewed by Pavel Feldman. + + * inspector/front-end/ScriptsPanel.js: + (WebInspector.ScriptsPanel.prototype._reset): + (WebInspector.ScriptsPanel.prototype._showFile): + (WebInspector.ScriptsPanel.prototype._editorClosed): + * inspector/front-end/TabbedEditorContainer.js: + (WebInspector.TabbedEditorContainer.prototype._tabClosed): + +2012-02-09 Shinya Kawanaka <shinyak@google.com> + + ASSERT_NO_EXCEPTION should be initialized with non-zero value. + https://bugs.webkit.org/show_bug.cgi?id=78194 + + Reviewed by Hajime Morita. + + ExceptionCode should not be checked without initializing it. + However, we encountered a bug that breaks this rule. + It was missed until now because ExceptionCode is sometimes set to 0 even if it is not initialized. + This patch ensures it is initialized as non-zero value. + + No new tests, no change in behavior. + + * dom/ExceptionCodePlaceholder.cpp: + (WebCore::NoExceptionAssertionChecker::NoExceptionAssertionChecker): + (WebCore::NoExceptionAssertionChecker::~NoExceptionAssertionChecker): + * dom/ExceptionCodePlaceholder.h: + (NoExceptionAssertionChecker): + +2012-02-09 Roland Steiner <rolandsteiner@chromium.org> + + Unreviewed, rolling out r107197. + http://trac.webkit.org/changeset/107197 + https://bugs.webkit.org/show_bug.cgi?id=77525 + + broke Chromium Linux + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::checkSelector): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkSelector): + (WebCore): + (WebCore::SelectorChecker::checkOneSelector): + * css/SelectorChecker.h: + +2012-02-09 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r107182, r107186, r107189, r107191, + and r107199. + http://trac.webkit.org/changeset/107182 + http://trac.webkit.org/changeset/107186 + http://trac.webkit.org/changeset/107189 + http://trac.webkit.org/changeset/107191 + http://trac.webkit.org/changeset/107199 + https://bugs.webkit.org/show_bug.cgi?id=78200 + + Layout tests of JSC-related port are crashing + + * Modules/gamepad/GamepadList.idl: + * Modules/intents/Intent.idl: + * bindings/js/JSDOMBinding.h: + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateParametersCheck): + (NativeToJSValue): + (GenerateConstructorDefinition): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheck): + (GenerateImplementationIndexer): + (RequiresCustomSignature): + (NativeToJSValue): + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSFloat64Array.cpp: + (WebCore::jsFloat64ArrayPrototypeFunctionFoo): + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: + (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): + (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): + * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: + (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: + (WebCore::jsTestEventTargetPrototypeFunctionItem): + (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): + (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): + * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: + (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): + * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: + (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): + (WebCore::jsTestObjPrototypeFunctionSerializedValue): + (WebCore::jsTestObjPrototypeFunctionIdbKey): + (WebCore::jsTestObjPrototypeFunctionOptionsObject): + (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): + (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): + (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): + (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): + (WebCore::jsTestObjPrototypeFunctionConvert1): + (WebCore::jsTestObjPrototypeFunctionConvert2): + (WebCore::jsTestObjPrototypeFunctionConvert3): + (WebCore::jsTestObjPrototypeFunctionConvert4): + (WebCore::jsTestObjPrototypeFunctionConvert5): + (WebCore::jsTestObjPrototypeFunctionStrictFunction): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: + (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + * bindings/scripts/test/TestInterface.idl: + * bindings/scripts/test/TestNamedConstructor.idl: + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8Float64Array.cpp: + (WebCore::Float64ArrayInternal::fooCallback): + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: + (WebCore::TestActiveDOMObjectInternal::excitingFunctionCallback): + (WebCore::TestActiveDOMObjectInternal::postMessageCallback): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: + (WebCore::TestCustomNamedGetterInternal::anotherFunctionCallback): + * bindings/scripts/test/V8/V8TestEventTarget.cpp: + (WebCore::TestEventTargetInternal::itemCallback): + (WebCore::TestEventTargetInternal::dispatchEventCallback): + * bindings/scripts/test/V8/V8TestInterface.cpp: + (WebCore::TestInterfaceInternal::supplementalMethod2Callback): + (WebCore::V8TestInterface::constructorCallback): + * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: + (WebCore::TestMediaQueryListListenerInternal::methodCallback): + * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: + (WebCore::V8TestNamedConstructorConstructorCallback): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::voidMethodWithArgsCallback): + (WebCore::TestObjInternal::intMethodWithArgsCallback): + (WebCore::TestObjInternal::objMethodWithArgsCallback): + (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback): + (WebCore::TestObjInternal::idbKeyCallback): + (WebCore::TestObjInternal::optionsObjectCallback): + (WebCore::TestObjInternal::customArgsAndExceptionCallback): + (WebCore::TestObjInternal::methodWithOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): + (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): + (WebCore::TestObjInternal::overloadedMethod1Callback): + (WebCore::TestObjInternal::overloadedMethod2Callback): + (WebCore::TestObjInternal::overloadedMethod3Callback): + (WebCore::TestObjInternal::overloadedMethod4Callback): + (WebCore::TestObjInternal::overloadedMethod6Callback): + (WebCore::TestObjInternal::overloadedMethod7Callback): + (WebCore::TestObjInternal::classMethodWithOptionalCallback): + (WebCore::TestObjInternal::overloadedMethod11Callback): + (WebCore::TestObjInternal::overloadedMethod12Callback): + (WebCore::TestObjInternal::enabledAtRuntimeMethod1Callback): + (WebCore::TestObjInternal::enabledAtRuntimeMethod2Callback): + (WebCore::TestObjInternal::convert1Callback): + (WebCore::TestObjInternal::convert2Callback): + (WebCore::TestObjInternal::convert3Callback): + (WebCore::TestObjInternal::convert4Callback): + (WebCore::TestObjInternal::convert5Callback): + (WebCore::TestObjInternal::strictFunctionCallback): + (WebCore): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): + * bindings/v8/V8Binding.h: + * bindings/v8/custom/V8BindingMacros.h: + * css/CSSCharsetRule.idl: + * css/CSSImportRule.idl: + * css/CSSMediaRule.idl: + * css/CSSPageRule.idl: + * css/CSSPrimitiveValue.idl: + * css/CSSRule.idl: + * css/CSSRuleList.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleRule.idl: + * css/CSSStyleSheet.idl: + * css/CSSValue.idl: + * css/CSSValueList.idl: + * css/MediaList.idl: + * css/MediaQueryList.idl: + * css/MediaQueryListListener.idl: + * css/StyleMedia.idl: + * css/StyleSheet.idl: + * css/StyleSheetList.idl: + * css/WebKitCSSKeyframesRule.idl: + * css/WebKitCSSMatrix.idl: + * dom/Attr.idl: + * dom/CharacterData.idl: + * dom/ClientRectList.idl: + * dom/Clipboard.idl: + * dom/CompositionEvent.idl: + * dom/CustomEvent.idl: + * dom/DOMImplementation.idl: + * dom/DOMStringList.idl: + * dom/DataTransferItem.idl: + * dom/DataTransferItemList.idl: + * dom/DeviceMotionEvent.idl: + * dom/DeviceOrientationEvent.idl: + * dom/Document.idl: + * dom/DocumentType.idl: + * dom/Element.idl: + * dom/Entity.idl: + * dom/Event.idl: + * dom/HashChangeEvent.idl: + * dom/KeyboardEvent.idl: + * dom/MessageEvent.idl: + * dom/MouseEvent.idl: + * dom/MutationEvent.idl: + * dom/MutationRecord.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/NodeFilter.idl: + * dom/NodeList.idl: + * dom/Notation.idl: + * dom/OverflowEvent.idl: + * dom/ProcessingInstruction.idl: + * dom/Range.idl: + * dom/ShadowRoot.idl: + * dom/Text.idl: + * dom/TextEvent.idl: + * dom/TouchEvent.idl: + * dom/UIEvent.idl: + * dom/WheelEvent.idl: + * html/DOMFormData.idl: + * html/DOMTokenList.idl: + * html/DOMURL.idl: + * html/HTMLAllCollection.idl: + * html/HTMLAudioElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLCollection.idl: + * html/HTMLDocument.idl: + * html/HTMLElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLOptionsCollection.idl: + * html/HTMLSelectElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/TextTrackCue.idl: + * html/canvas/CanvasGradient.idl: + * html/canvas/CanvasRenderingContext2D.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/canvas/WebGLDebugShaders.idl: + * html/canvas/WebGLRenderingContext.idl: + * page/Console.idl: + * page/DOMSelection.idl: + * page/DOMWindow.idl: + * page/History.idl: + * page/Location.idl: + * plugins/DOMMimeTypeArray.idl: + * plugins/DOMPlugin.idl: + * plugins/DOMPluginArray.idl: + * storage/IDBDatabase.idl: + * storage/IDBObjectStore.idl: + * storage/IDBRequest.idl: + * storage/Storage.idl: + * storage/StorageEvent.idl: + * svg/ElementTimeControl.idl: + * svg/SVGDocument.idl: + * svg/SVGElementInstanceList.idl: + * svg/SVGFEDropShadowElement.idl: + * svg/SVGFEGaussianBlurElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFilterElement.idl: + * svg/SVGLocatable.idl: + * svg/SVGMarkerElement.idl: + * svg/SVGPathElement.idl: + * svg/SVGSVGElement.idl: + * svg/SVGStylable.idl: + * svg/SVGTests.idl: + * svg/SVGTextContentElement.idl: + * webaudio/AudioNode.idl: + * websockets/WebSocket.idl: + * workers/SharedWorker.idl: + * workers/WorkerContext.idl: + * xml/DOMParser.idl: + * xml/XMLHttpRequest.idl: + * xml/XMLSerializer.idl: + * xml/XPathEvaluator.idl: + * xml/XPathExpression.idl: + * xml/XPathNSResolver.idl: + * xml/XPathResult.idl: + * xml/XSLTProcessor.idl: + +2012-02-09 Shinya Kawanaka <shinyak@google.com> + + Disable adding a shadow root to elements having a dynamic built-in shadow root. + https://bugs.webkit.org/show_bug.cgi?id=77935 + + Reviewed by Hajime Morita. + + We temporarily disable adding a shadow root in elements having a dynamic user agent shadow root. + These shadow roots are currently created using Element::ensureShadowRoot. + So we don't check the condition if a shadow root is created eaither using Element::ensureShadowRoot + or ShadowRoot::CreatingUserAgentShadowRoot is specified for ShadowRoot::create. + + Test: fast/dom/shadow/shadow-disable.html + + * dom/Element.cpp: + (WebCore::Element::ensureShadowRoot): + * dom/ShadowRoot.cpp: + (WebCore::allowsUserShadowRoot): + (WebCore): + (WebCore::ShadowRoot::create): + * dom/ShadowRoot.h: + (ShadowRoot): + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::createShadowSubtree): + ShadowRoot::CreatingUserAgentShadowRoot is specified. + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): ditto. + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::createShadowSubtree): ditto. + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::createShadowSubtree): ditto. + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::createShadowSubtree): ditto. + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::createShadowSubtree): ditto. + +2012-02-08 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: hovering over element with :hover style halts inspector + https://bugs.webkit.org/show_bug.cgi?id=78086 + + Reviewed by Pavel Feldman. + + Test: inspector/styles/updates-throttled.html + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate): + (WebInspector.StylesSidebarPane.prototype._innerUpdate.computedStyleCallback): + (WebInspector.StylesSidebarPane.prototype._innerUpdate): + +2012-02-09 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Fix build failure caused by r107191. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheck): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheck): + +2012-02-09 Roland Steiner <rolandsteiner@chromium.org> + + SelectorChecker::checkSelector: move parameters into a struct + https://bugs.webkit.org/show_bug.cgi?id=77525 + + Added 'SelectorCheckingContext' struct to hold parameters for the function. + Adapted calling sites. + + Reviewed by Antti Koivisto. + + No new tests. (refactoring) + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::checkSelector): + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkSelector): + (WebCore): + (WebCore::SelectorChecker::checkOneSelector): + * css/SelectorChecker.h: + (SelectorCheckingContext): + (WebCore::SelectorChecker::SelectorCheckingContext::SelectorCheckingContext): + (SelectorChecker): + +2012-02-09 Kent Tamura <tkent@chromium.org> + + Do not localize numbers in scientific notation + https://bugs.webkit.org/show_bug.cgi?id=78208 + + Reviewed by Hajime Morita. + + For a preparation of fixing http://wkb.ug/62939, we stop supporting + localized numbers in scientific notation in <input type=number>. + + We're going to change number localization processing so that it replaces + letters one by one. It will be very hard to support scientific notation. + + * html/NumberInputType.cpp: + (WebCore::isE): A helper functio for String::find() to detect scientific notation. + (WebCore::NumberInputType::visibleValue): Avoid localization for scientific notation. + (WebCore::NumberInputType::convertFromVisibleValue): ditto. + (WebCore::NumberInputType::isAcceptableValue): + Use convertFromVisibleValue, also stop accepting a standard format as a fallback. + +2012-02-09 Leo Yang <leo.yang@torchmobile.com.cn> + + EntryBase.cpp is missing in CMake build system when turning on ENABLE_FILE_SYSTEM + https://bugs.webkit.org/show_bug.cgi?id=78190 + + Reviewed by Antonio Gomes. + + EntryBase.cpp is not in the CMake build system, which causes build failure (undefined + symbols to EntryBase) when turning on ENABLE_FILE_SYSTEM. + + Build system fix, no new tests. + + * CMakeLists.txt: + +2012-02-09 Andreas Kling <awesomekling@apple.com> + + REGRESSION(r53878): Input elements don't share their styles if the document contains no validity style rules. + <http://webkit.org/b/69400> + + Reviewed by Kent Tamura. + + Don't reject style sharing candidates prematurely just because the document doesn't + have any :valid or :invalid selectors. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::canShareStyleWithControl): + +2012-02-09 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Fixed typo in the following files. [TreatUndefinedAs] => [TreatAsUndefined]. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateParametersCheck): + + * bindings/scripts/test/TestObj.idl: + + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated run-bindings-tests results. + (WebDOMTestObj::methodWithOptionalIsUndefinedString): + * bindings/scripts/test/CPP/WebDOMTestObj.h: + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + (webkit_dom_test_obj_method_with_optional_is_undefined_string): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: + * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: + (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsUndefinedString): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsNullStringString): + (WebCore::jsTestObjPrototypeFunctionConvert5): + * bindings/scripts/test/JS/JSTestObj.h: + (WebCore): + * bindings/scripts/test/ObjC/DOMTestObj.h: + * bindings/scripts/test/ObjC/DOMTestObj.mm: + (-[DOMTestObj methodWithOptionalIsUndefinedString:]): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::methodWithOptionalIsUndefinedStringCallback): + (WebCore): + +2012-02-09 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Fixed typo in the following files. [TreatReturnedNullStringTo=] => [TreatReturnedNullStringAs=]. + + * bindings/scripts/test/TestObj.idl: + * css/CSSCharsetRule.idl: + * css/CSSImportRule.idl: + * css/CSSPageRule.idl: + * css/CSSRule.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleRule.idl: + * css/CSSValue.idl: + * css/MediaList.idl: + * css/StyleSheet.idl: + * css/WebKitCSSKeyframesRule.idl: + * dom/Attr.idl: + * dom/CharacterData.idl: + * dom/Clipboard.idl: + * dom/DOMStringList.idl: + * dom/Document.idl: + * dom/DocumentType.idl: + * dom/Element.idl: + * dom/Entity.idl: + * dom/MutationRecord.idl: + * dom/Node.idl: + * dom/Notation.idl: + * dom/ProcessingInstruction.idl: + * html/DOMTokenList.idl: + * html/DOMURL.idl: + * html/HTMLMediaElement.idl: + * html/canvas/WebGLDebugShaders.idl: + * html/canvas/WebGLRenderingContext.idl: + * page/DOMWindow.idl: + * storage/IDBObjectStore.idl: + * storage/IDBRequest.idl: + * storage/Storage.idl: + * storage/StorageEvent.idl: + * websockets/WebSocket.idl: + * xml/XMLHttpRequest.idl: + * xml/XPathNSResolver.idl: + * xml/XSLTProcessor.idl: + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Rename [ConvertNullStringTo=] to [TreatReturnedNullStringAs=] + https://bugs.webkit.org/show_bug.cgi?id=78108 + + Reviewed by Adam Barth. + + [ConvertNullStringTo=] is not descriptive. To clarify that it specifies + the behavior when the null string is returned by WebCore, this patch renames + [ConvertNullStringTo=] to [TreatReturnedNullStringAs=]. This change is also + for naming consistency with [TreatNullAs] and [TreatUndefinedAs]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateImplementationIndexer): + (NativeToJSValue): + + * bindings/scripts/test/TestObj.idl: No change in run-bindings-tests results. + + * css/CSSCharsetRule.idl: + * css/CSSImportRule.idl: + * css/CSSPageRule.idl: + * css/CSSRule.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleRule.idl: + * css/CSSValue.idl: + * css/MediaList.idl: + * css/StyleSheet.idl: + * css/WebKitCSSKeyframesRule.idl: + * dom/Attr.idl: + * dom/CharacterData.idl: + * dom/Clipboard.idl: + * dom/DOMStringList.idl: + * dom/Document.idl: + * dom/DocumentType.idl: + * dom/Element.idl: + * dom/Entity.idl: + * dom/MutationRecord.idl: + * dom/Node.idl: + * dom/Notation.idl: + * dom/ProcessingInstruction.idl: + * html/DOMTokenList.idl: + * html/DOMURL.idl: + * html/HTMLMediaElement.idl: + * html/canvas/WebGLDebugShaders.idl: + * html/canvas/WebGLRenderingContext.idl: + * page/DOMWindow.idl: + * storage/IDBObjectStore.idl: + * storage/IDBRequest.idl: + * storage/Storage.idl: + * storage/StorageEvent.idl: + * websockets/WebSocket.idl: + * xml/XMLHttpRequest.idl: + * xml/XPathNSResolver.idl: + * xml/XSLTProcessor.idl: + +2012-02-08 Andreas Kling <awesomekling@apple.com> + + Simplify ownership of StyledElement::additionalAttributeStyles(). + <http://webkit.org/b/78204> + + Reviewed by Anders Carlsson. + + Change additionalAttributeStyle() to return a raw pointer rather than a PassRefPtr. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchAllRules): + (WebCore::CSSStyleSelector::canShareStyleWithElement): + * dom/StyledElement.h: + (WebCore::StyledElement::additionalAttributeStyle): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::additionalAttributeStyle): + * html/HTMLTableCellElement.h: + (HTMLTableCellElement): + * html/HTMLTableColElement.cpp: + (WebCore::HTMLTableColElement::additionalAttributeStyle): + * html/HTMLTableColElement.h: + (HTMLTableColElement): + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::additionalAttributeStyle): + (WebCore::HTMLTableElement::additionalCellStyle): + (WebCore::HTMLTableElement::additionalGroupStyle): + * html/HTMLTableElement.h: + (HTMLTableElement): + * html/HTMLTableSectionElement.cpp: + (WebCore::HTMLTableSectionElement::additionalAttributeStyle): + * html/HTMLTableSectionElement.h: + (HTMLTableSectionElement): + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Rename [Optional=CallWithDefalutValue] and [Optional=CallWithNullValue] + https://bugs.webkit.org/show_bug.cgi?id=78200 + + Reviewed by Adam Barth. + + [Optional=CallWithDefalutValue] and [Optional=CallWithNullValue] are confusing. + + - [Optional=CallWithDefalutValue] indicates that a missing value should be treated + as if the JavaScript undefined is passed. + - [Optional=CallWithNullValue] indicates that a missing value should be treated as + the WebKit null value (i.e. JSValue() or v8::Local<v8::Value>()). + - Actually, the difference between [Optional=CallWithDefalutValue] and + [Optional=CallWithNullValue] appears only when the type of the missing value is DOMString. + In case of [Optional=CallWithDefalutValue], the missing value is converted to the string + "undefined". On the other hand, in case of [Optional=CallWithNullValue], the missing + value is converted to the WebKit null string. + + With these observations, this patch renames them as follows: + + - Rename [Optional=CallWithDefalutValue] to [Optional=TreatAsUndefined]. + - Remove [Optional=CallWithNullValue]. Instead, we use + [Optional=TreatAsUndefined, TreatUndefinedAs=NullString]. + + Test: bindings/scripts/test/TestInterface.idl + + * bindings/js/JSDOMBinding.h: Renamed MissingIsUndefined to MissingIsUndefinedValue, + renamed MissingIsEmpty to MissingIsNullValue. + * bindings/v8/V8Binding.h: Ditto. + * bindings/v8/custom/V8BindingMacros.h: Ditto. + + * bindings/scripts/CodeGeneratorJS.pm: Modified to support the IDL attribute renaming. + (GenerateParametersCheck): + (GenerateConstructorDefinition): + * bindings/scripts/CodeGeneratorV8.pm: Ditto. + (GenerateParametersCheck): + (RequiresCustomSignature): + + * Modules/gamepad/GamepadList.idl: Renamed IDL attributes as described above. + * Modules/intents/Intent.idl: + * css/CSSMediaRule.idl: + * css/CSSPrimitiveValue.idl: + * css/CSSRuleList.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleSheet.idl: + * css/CSSValueList.idl: + * css/MediaList.idl: + * css/MediaQueryList.idl: + * css/MediaQueryListListener.idl: + * css/StyleMedia.idl: + * css/StyleSheetList.idl: + * css/WebKitCSSKeyframesRule.idl: + * css/WebKitCSSMatrix.idl: + * dom/CharacterData.idl: + * dom/ClientRectList.idl: + * dom/CompositionEvent.idl: + * dom/CustomEvent.idl: + * dom/DOMImplementation.idl: + * dom/DOMStringList.idl: + * dom/DataTransferItem.idl: + * dom/DataTransferItemList.idl: + * dom/DeviceMotionEvent.idl: + * dom/DeviceOrientationEvent.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/Event.idl: + * dom/HashChangeEvent.idl: + * dom/KeyboardEvent.idl: + * dom/MessageEvent.idl: + * dom/MouseEvent.idl: + * dom/MutationEvent.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/NodeFilter.idl: + * dom/NodeList.idl: + * dom/OverflowEvent.idl: + * dom/Range.idl: + * dom/ShadowRoot.idl: + * dom/Text.idl: + * dom/TextEvent.idl: + * dom/TouchEvent.idl: + * dom/UIEvent.idl: + * dom/WheelEvent.idl: + * html/DOMFormData.idl: + * html/HTMLAllCollection.idl: + * html/HTMLAudioElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLCollection.idl: + * html/HTMLDocument.idl: + * html/HTMLElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLOptionsCollection.idl: + * html/HTMLSelectElement.idl: + * html/HTMLTableElement.idl: + * html/HTMLTableRowElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLTextAreaElement.idl: + * html/TextTrackCue.idl: + * html/canvas/CanvasGradient.idl: + * html/canvas/CanvasRenderingContext2D.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * page/Console.idl: + * page/DOMSelection.idl: + * page/DOMWindow.idl: + * page/History.idl: + * page/Location.idl: + * plugins/DOMMimeTypeArray.idl: + * plugins/DOMPlugin.idl: + * plugins/DOMPluginArray.idl: + * storage/IDBDatabase.idl: + * storage/StorageEvent.idl: + * svg/ElementTimeControl.idl: + * svg/SVGDocument.idl: + * svg/SVGElementInstanceList.idl: + * svg/SVGFEDropShadowElement.idl: + * svg/SVGFEGaussianBlurElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFilterElement.idl: + * svg/SVGLocatable.idl: + * svg/SVGMarkerElement.idl: + * svg/SVGPathElement.idl: + * svg/SVGSVGElement.idl: + * svg/SVGStylable.idl: + * svg/SVGTests.idl: + * svg/SVGTextContentElement.idl: + * webaudio/AudioNode.idl: + * workers/SharedWorker.idl: + * workers/WorkerContext.idl: + * xml/DOMParser.idl: + * xml/XMLSerializer.idl: + * xml/XPathEvaluator.idl: + * xml/XPathExpression.idl: + * xml/XPathNSResolver.idl: + * xml/XPathResult.idl: + + * bindings/scripts/test/TestInterface.idl: Added test cases for [Optional], + [Optional=TreatAsUndefined] and [Optional=TreatAsUndefined, TreatUndefinedAs=NullString] + * bindings/scripts/test/TestNamedConstructor.idl: Renamed IDL attributes as described above. + * bindings/scripts/test/TestObj.idl: Ditto. + + * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Updated run-bindings-tests results. + (WebDOMTestObj::methodWithOptionalString): + (WebDOMTestObj::methodWithOptionalIsTreatAsUndefinedString): + (WebDOMTestObj::methodWithOptionalIsNullStringString): + * bindings/scripts/test/CPP/WebDOMTestObj.h: Ditto. + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. + (webkit_dom_test_obj_method_with_optional_string): + (webkit_dom_test_obj_method_with_optional_is_treat_as_undefined_string): + (webkit_dom_test_obj_method_with_optional_is_null_string_string): + * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto. + * bindings/scripts/test/JS/JSFloat64Array.cpp: Ditto. + (WebCore::jsFloat64ArrayPrototypeFunctionFoo): + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: Ditto. + (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): + (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): + * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: Ditto. + (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: Ditto. + (WebCore::jsTestEventTargetPrototypeFunctionItem): + (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): + * bindings/scripts/test/JS/JSTestInterface.cpp: Ditto. + (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): + (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): + * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: Ditto. + (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): + * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: Ditto. + (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): + * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. + (WebCore): + (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): + (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): + (WebCore::jsTestObjPrototypeFunctionSerializedValue): + (WebCore::jsTestObjPrototypeFunctionIdbKey): + (WebCore::jsTestObjPrototypeFunctionOptionsObject): + (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalString): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsTreatAsUndefinedString): + (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalIsNullStringString): + (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): + (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): + (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): + (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): + (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): + (WebCore::jsTestObjPrototypeFunctionConvert1): + (WebCore::jsTestObjPrototypeFunctionConvert2): + (WebCore::jsTestObjPrototypeFunctionConvert3): + (WebCore::jsTestObjPrototypeFunctionConvert4): + (WebCore::jsTestObjPrototypeFunctionConvert5): + (WebCore::jsTestObjPrototypeFunctionStrictFunction): + * bindings/scripts/test/JS/JSTestObj.h: Ditto. + (WebCore): + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: Ditto. + (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): + * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto. + (-[DOMTestObj methodWithOptionalString:]): + (-[DOMTestObj methodWithOptionalIsTreatAsUndefinedString:]): + (-[DOMTestObj methodWithOptionalIsNullStringString:]): + * bindings/scripts/test/V8/V8Float64Array.cpp: Ditto. + (WebCore::Float64ArrayInternal::fooCallback): + * bindings/scripts/test/V8/V8TestActiveDOMObject.cpp: Ditto. + (WebCore::TestActiveDOMObjectInternal::excitingFunctionCallback): + (WebCore::TestActiveDOMObjectInternal::postMessageCallback): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: Ditto. + (WebCore::TestCustomNamedGetterInternal::anotherFunctionCallback): + * bindings/scripts/test/V8/V8TestEventTarget.cpp: Ditto. + (WebCore::TestEventTargetInternal::itemCallback): + (WebCore::TestEventTargetInternal::dispatchEventCallback): + * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto. + (WebCore::TestInterfaceInternal::supplementalMethod2Callback): + (WebCore::V8TestInterface::constructorCallback): + * bindings/scripts/test/V8/V8TestMediaQueryListListener.cpp: Ditto. + (WebCore::TestMediaQueryListListenerInternal::methodCallback): + * bindings/scripts/test/V8/V8TestNamedConstructor.cpp: Ditto. + (WebCore::V8TestNamedConstructorConstructorCallback): + * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. + (WebCore::TestObjInternal::voidMethodWithArgsCallback): + (WebCore::TestObjInternal::intMethodWithArgsCallback): + (WebCore::TestObjInternal::objMethodWithArgsCallback): + (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback): + (WebCore::TestObjInternal::idbKeyCallback): + (WebCore::TestObjInternal::optionsObjectCallback): + (WebCore::TestObjInternal::customArgsAndExceptionCallback): + (WebCore::TestObjInternal::methodWithOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): + (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): + (WebCore::TestObjInternal::methodWithOptionalStringCallback): + (TestObjInternal): + (WebCore::TestObjInternal::methodWithOptionalIsTreatAsUndefinedStringCallback): + (WebCore::TestObjInternal::methodWithOptionalIsNullStringStringCallback): + (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): + (WebCore::TestObjInternal::overloadedMethod1Callback): + (WebCore::TestObjInternal::overloadedMethod2Callback): + (WebCore::TestObjInternal::overloadedMethod3Callback): + (WebCore::TestObjInternal::overloadedMethod4Callback): + (WebCore::TestObjInternal::overloadedMethod6Callback): + (WebCore::TestObjInternal::overloadedMethod7Callback): + (WebCore::TestObjInternal::classMethodWithOptionalCallback): + (WebCore::TestObjInternal::overloadedMethod11Callback): + (WebCore::TestObjInternal::overloadedMethod12Callback): + (WebCore::TestObjInternal::enabledAtRuntimeMethod1Callback): + (WebCore::TestObjInternal::enabledAtRuntimeMethod2Callback): + (WebCore::TestObjInternal::convert1Callback): + (WebCore::TestObjInternal::convert2Callback): + (WebCore::TestObjInternal::convert3Callback): + (WebCore::TestObjInternal::convert4Callback): + (WebCore::TestObjInternal::convert5Callback): + (WebCore::TestObjInternal::strictFunctionCallback): + (WebCore): + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: Ditto. + (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Rename [HasNumericIndexGetter] to [NumericIndexedGetter] + https://bugs.webkit.org/show_bug.cgi?id=78096 + + Reviewed by Adam Barth. + + This patch renames [HasNumericIndexGetter] to [NumericIndexedGetter], + for naming consistency with [IndexedGetter] and [CustomIndexedGetter]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateGetOwnPropertyDescriptorBody): + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeaderNamedAndIndexedPropertyAccessors): + (GenerateImplementationIndexer): + + * bindings/scripts/test/TestTypedArray.idl: No change in run-bindings-tests results. + + * html/canvas/CanvasPixelArray.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + +2012-02-08 Tony Chang <tony@chromium.org> + + refactor RenderFlexibleBox to return preferred sizes of all children + https://bugs.webkit.org/show_bug.cgi?id=78169 + + Reviewed by Ojan Vafai. + + This is in preparation for multi-line flexbox. We need the preferred + size of each child so we can compute where the multi-line breaks happen. + + No new tests, just refactoring. + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Renamed from preferredMainAxisContentExtentForFlexItem because + other methods are ForChild rather than ForFlexItem. + (WebCore::RenderFlexibleBox::layoutFlexItems): + (WebCore::RenderFlexibleBox::computeMainAxisPreferredSizes): + (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithm): + * rendering/RenderFlexibleBox.h: + (RenderFlexibleBox): + +2012-02-08 Shinya Kawanaka <shinyak@google.com> + + Stop calling Element::ensureShadowRoot() if it is used in construction phase. + https://bugs.webkit.org/show_bug.cgi?id=77929 + + Reviewed by Hajime Morita. + + ShadowRoot's life cycle can be consufing If Element::ensureShadowRoot() is used. + So we want to remove Element::ensureShadowRoot(). + This patch replaces Element::ensureShadowRoot() if it is used in object construction phase. + + No new tests, no change in behavior. + + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::create): + Initialize exception code before calling appendChild. + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::createShadowSubtree): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::createShadowSubtree): + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::createShadowSubtree): + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::createShadowSubtree): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::createShadowSubtree): + +2012-02-08 David Reveman <reveman@chromium.org> + + [Chromium] Avoid unnecessary full tile updates without breaking atomicity of commits. + https://bugs.webkit.org/show_bug.cgi?id=76740 + + Reviewed by James Robinson. + + Allow the final batch of texture uploads to be performed without + allocating new textures and re-painting complete tiles. + + This patch is tested by the following unit test: + - CCLayerTreeHostTestAtomicCommitWithPartialUpdate.runMultiThread + - TiledLayerChromiumTest.partialUpdates + + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::UpdatableTile::UpdatableTile): + (UpdatableTile): + (WebCore::TiledLayerChromium::updateCompositorResources): + (WebCore): + (WebCore::TiledLayerChromium::tileOnlyNeedsPartialUpdate): + (WebCore::TiledLayerChromium::tileNeedsBufferedUpdate): + (WebCore::TiledLayerChromium::prepareToUpdateTiles): + * platform/graphics/chromium/TiledLayerChromium.h: + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore::CCLayerTreeHost::updateLayers): + (WebCore::CCLayerTreeHost::requestPartialTextureUpdate): + (WebCore): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::CCSettings::CCSettings): + (CCSettings): + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCProxy.h: + (CCProxy): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::doCommit): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + (WebCore::CCSingleThreadProxy::maxPartialTextureUpdates): + * platform/graphics/chromium/cc/CCTextureUpdater.cpp: + (WebCore::CCTextureUpdater::append): + (WebCore): + (WebCore::CCTextureUpdater::appendPartial): + (WebCore::CCTextureUpdater::hasMoreUpdates): + (WebCore::CCTextureUpdater::update): + (WebCore::CCTextureUpdater::clear): + * platform/graphics/chromium/cc/CCTextureUpdater.h: + (CCTextureUpdater): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WTF): + (WebCore::CCThreadProxy::scheduledActionUpdateMoreResources): + (WebCore::CCThreadProxy::maxPartialTextureUpdates): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-02-07 MORITA Hajime <morrita@google.com> + + Replacement text should be available from the marker. + https://bugs.webkit.org/show_bug.cgi?id=77934 + + Reviewed by Kent Tamura. + + On spellchecking, TextCheckingResult can contain a replacement text + which is usable both for an automatic replacement and for showing a suggestion. + + But when marking a misspelled word ragarding to returned + TextCheckingResult, Editor uses only the misspelled range data and + discards the replacement value. Then it asks the same value again + when showing suggestion/autocorrection. + + It would be great if the marker holds the replacement text + and Editor can use it on suggesting a correction, without any re-request. + This is especially true in the case when it needs IPC messaging for spellchecking: + We can save one round-trip by this technique. + + Here is actual change: + + - Passed the replacement text to addMarker() for for misspelling markers. + Note that this is done only for the unified checker path because legacy + TextCheckerClient API doesn't provide such a replacement. + - Added an Internals API to retrieve a description text on a marker. + + Test: editing/spelling/spelling-marker-description.html + + * WebCore.exp.in: + * editing/Editor.cpp: + (WebCore::Editor::markAndReplaceFor): + * testing/Internals.cpp: + (WebCore::Internals::markerAt): + (WebCore): + (WebCore::Internals::markerRangeForNode): + (WebCore::Internals::markerDescriptionForNode): + * testing/Internals.h: + (WebCore): + (Internals): + * testing/Internals.idl: + +2012-02-08 Eric Seidel <eric@webkit.org> + + Remove more cruft now that HTMLIsIndexElement is gone + https://bugs.webkit.org/show_bug.cgi?id=77887 + + Reviewed by Darin Adler. + + Just removing dead code, thus no tests. + There is likely more to remove after this. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLInputElement.cpp: + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/InputType.cpp: + (WebCore::createInputTypeFactoryMap): + * html/InputType.h: + (InputTypeNames): + * html/IsIndexInputType.cpp: Removed. + * html/IsIndexInputType.h: Removed. + * rendering/HitTestResult.cpp: + (WebCore::HitTestResult::isContentEditable): + +2012-02-08 Andreas Kling <awesomekling@apple.com> + + Increased style sharing for elements with presentation attributes. + <http://webkit.org/b/78199> + + Reviewed by Antti Koivisto. + + When determining whether two elements can share style, we can do a lot better. + Instead of comparing the attribute maps for exact equality, do a property-by-property + comparison of the attributeStyle() and the additionalAttributeStyle() (if any.) + + This increases our style sharing hit rate and shaves 100ms off of each cycle on + Chromium's "Moz" page cycler test on my machine. + + The function that compares attribute styles has O(n^2) runtime in the worst case, + where n is the number of properties in the styles. However, given the low number of + properties found in attribute styles, this should be fine, and it doesn't seem to + heat up in profiles. + + * css/CSSStyleSelector.cpp: + (WebCore::attributeStylesEqual): + (WebCore::CSSStyleSelector::canShareStyleWithElement): + +2012-02-08 Raymond Liu <raymond.liu@intel.com> + + Fix the caculation of preDelayFrames in DynamicsCompressorKernel + https://bugs.webkit.org/show_bug.cgi?id=78057 + + Reviewed by Chris Rogers. + + No new tests required. + + * platform/audio/DynamicsCompressorKernel.cpp: + (WebCore::DynamicsCompressorKernel::setPreDelayTime): + +2012-02-08 Adam Klein <adamk@chromium.org> + + DOM mutations should not be delivered on worker threads + https://bugs.webkit.org/show_bug.cgi?id=77898 + + Reviewed by Dmitry Titov. + + In V8RecursionScope, only call WebKitMutationObserver::deliverAllMutations + if in a Document context. + + This is accomplished through a change to V8Proxy::instrumentedCallFunction + (which now takes a Frame* instead of a Page*), requiring an update to all + callers of that function (accounting for the majority of files changed + in this patch). + + Added ASSERT(isMainThread()) in a deliverAllMutations to confirm that + it's no longer called on worker threads, and in enqueueMutationRecord, + where the same global store of active observers is accessed. + + See also http://crbug.com/112586, where the problem was initially + reported. + + * bindings/v8/ScriptFunctionCall.cpp: + (WebCore::ScriptCallback::call): + * bindings/v8/V8NodeFilterCondition.cpp: + (WebCore::V8NodeFilterCondition::acceptNode): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::runScript): + (WebCore::V8Proxy::callFunction): + (WebCore::V8Proxy::instrumentedCallFunction): + * bindings/v8/V8Proxy.h: + (WebCore): + (V8Proxy): + * bindings/v8/V8RecursionScope.cpp: + (WebCore::V8RecursionScope::didLeaveScriptContext): + * bindings/v8/V8RecursionScope.h: + (WebCore): + (WebCore::V8RecursionScope::V8RecursionScope): + (V8RecursionScope): + (WebCore::V8RecursionScope::~V8RecursionScope): + * bindings/v8/V8WindowErrorHandler.cpp: + (WebCore::V8WindowErrorHandler::callListenerFunction): + * bindings/v8/custom/V8CustomVoidCallback.cpp: + (WebCore::invokeCallback): + * bindings/v8/custom/V8CustomXPathNSResolver.cpp: + (WebCore::V8CustomXPathNSResolver::lookupNamespaceURI): + * dom/WebKitMutationObserver.cpp: + (WebCore::WebKitMutationObserver::enqueueMutationRecord): + (WebCore::WebKitMutationObserver::deliverAllMutations): + +2012-02-08 Anders Carlsson <andersca@apple.com> + + Don't use the wheel event handler count to track if a page has horizontal scrollbars + https://bugs.webkit.org/show_bug.cgi?id=78192 + + Reviewed by Andreas Kling. + + Stop calling Document::didAddWheelEventHandler and Document::didRemoveWheelEventHandler when + adding and removing scrollbars. + + * page/FrameView.cpp: + * page/FrameView.h: + (FrameView): + * rendering/RenderLayer.cpp: + * rendering/RenderLayer.h: + +2012-02-08 Igor Oliveira <igor.o@sisa.samsung.com> + + Implement reverse animation direction + + Implement reverse animation direction + https://bugs.webkit.org/show_bug.cgi?id=60525 + + Implement reverse and alternate-reverse direction. + + Reviewed by Dean Jackson. + + Tests: animations/animation-direction-alternate-reverse.html + animations/animation-direction-reverse.html + animations/fill-mode-reverse.html + + * css/CSSParser.cpp: + (WebCore::CSSParser::parseAnimationDirection): + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::mapAnimationDirection): + * css/CSSValueKeywords.in: + * page/WebKitAnimation.cpp: + (WebCore::WebKitAnimation::direction): + * page/WebKitAnimation.h: + * page/animation/AnimationBase.cpp: + (WebCore::AnimationBase::fractionalTime): + * platform/animation/Animation.h: + (Animation): + * platform/graphics/texmap/TextureMapperAnimation.cpp: + (WebCore): + (WebCore::shouldReverseAnimationValue): + (WebCore::normalizedAnimationValue): + +2012-02-08 James Robinson <jamesr@chromium.org> + + [chromium] Avoid creating a temporary GraphicsContext3D if someone requests the WebView's GraphicsContext3D before initialization is complete + https://bugs.webkit.org/show_bug.cgi?id=78154 + + Reviewed by Kenneth Russell. + + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::context): + +2012-02-08 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=78157 + + Make multi-column layout work with line grids that are outside of the multi-column + block. + + Reviewed by Dan Bernstein. + + Added new tests in fast/line-grid. + + * rendering/LayoutState.cpp: + (WebCore::LayoutState::LayoutState): + (WebCore::LayoutState::propagateLineGridInfo): + (WebCore::LayoutState::establishLineGrid): + (WebCore): + (WebCore::LayoutState::computeLineGridPaginationOrigin): + * rendering/LayoutState.h: + (WebCore::LayoutState::LayoutState): + (WebCore::LayoutState::lineGrid): + (WebCore::LayoutState::lineGridOffset): + (WebCore::LayoutState::lineGridPaginationOrigin): + (WebCore::LayoutState::needsBlockDirectionLocationSetBeforeLayout): + (LayoutState): + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlockChildren): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::RenderBlock::layoutInlineChildren): + * rendering/RenderView.h: + (WebCore::RenderView::pushLayoutState): + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::lineGridSnapAdjustment): + +2012-02-08 Matthew Delaney <mdelaney@apple.com> + + GeneratorGeneratedImage::drawPattern does not factor in its destination context's scale when generating its image tiles + + https://bugs.webkit.org/show_bug.cgi?id=67729 + <rdar://problem/10087050> + + Reviewed by Beth Dakin. + + No new tests, current pixel tests will cover this. Though some pixel results might improve to become less pixel-y. + + * platform/graphics/GeneratorGeneratedImage.cpp: + (WebCore::GeneratorGeneratedImage::draw): Updated context to destContext for consistency. + (WebCore::GeneratorGeneratedImage::drawPattern): Taught drawPattern about the destination + scale factor to avoid having low-res generated images such as gradients in certain cases. + * platform/graphics/GraphicsContext.cpp: + (WebCore::GraphicsContext::createCompatibleBuffer): Have the image buffer match the + context acceleration setting as well. + +2012-02-08 Adam Klein <adamk@chromium.org> + + Simplify and correct mutation delivery timing for JSC + https://bugs.webkit.org/show_bug.cgi?id=78172 + + Reviewed by Adam Barth. + + Instead of keeping a static recursion counter in JSMainThreadExecState, + simply wait for a state change from non-null ExecState to null ExecState. + Because s_mainThreadState is initially null, this equivalent to + waiting for s_recursionLevel to rewind to zero. + + This also properly handles the usage of JSMainThreadNullState (and + does not do mutation delivery), since that class is only used by + non-JS bindings. Now fast/mutation/end-of-task-delivery.html properly + fails, whereas it was passing before due to usage of the ObjC DOM API + from DumpRenderTree. + + * bindings/js/JSMainThreadExecState.cpp: + (WebCore): + * bindings/js/JSMainThreadExecState.h: Added a comment explaining the purpose of JSMainThreadNullState. + (WebCore::JSMainThreadExecState::JSMainThreadExecState): + (WebCore::JSMainThreadExecState::~JSMainThreadExecState): + (JSMainThreadExecState): + (WebCore): + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Remove [ConvertToString] from CodeGeneratorCPP.pm and rename + it to [ObjCImplementedAsUnsignedLong] + https://bugs.webkit.org/show_bug.cgi?id=78100 + + Reviewed by Eric Seidel. + + Now [ConvertToString] is used by ObjC's HTMLElement.size only. + This patch removes [ConvertToString] code from CodeGeneratorCPP.pm, + and renames [ConvertToString] to [ObjCImplementedAsUnsignedLong]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorCPP.pm: + (GenerateImplementation): + * bindings/scripts/CodeGeneratorObjC.pm: + (GenerateImplementation): + * html/HTMLInputElement.idl: Removed FIXME comment, because the latest spec + says HTMLInputElement.size should be unsigned long. + (http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#the-input-element) + +2012-02-08 Leo Yang <leo.yang@torchmobile.com.cn> + + REGRESSION(r84194): Build fails when turning on ENABLE_FILE_SYSTEM + https://bugs.webkit.org/show_bug.cgi?id=78088 + + Reviewed by Antonio Gomes. + + WebCore::getDOMObjectWrapper was changed to WebCore::wrap in r84194. + Adapt to this change in JSEntryCustom.cpp and JSEntrySyncCustom.cpp. + + Build fix, no new tests. + + * bindings/js/JSEntryCustom.cpp: + (WebCore::toJS): + * bindings/js/JSEntrySyncCustom.cpp: + (WebCore::toJS): + +2012-02-08 Dana Jansens <danakj@chromium.org> + + [Chromium] Fix opaque tracking for box shadows and non-composited child elements + https://bugs.webkit.org/show_bug.cgi?id=78073 + + Reviewed by Stephen White. + + Tests: compositing/culling/scrolled-within-boxshadow.html + compositing/culling/translated-boxshadow.html + + Unit tests: PlatformContextSkiaTest.cpp + + When painting a box shadow, a filter is applied to the skia canvas, that can make + pixels painted with an opaque color end up non-opaque. So consider image/mask/color + filters when deciding if a paint is opaque. + + Also when painting the background of an element with a box shadow, the background is + painted with a transform on the skia canvas based on the size of the box shadow. This + transform needs to be considered when tracking an opaque paint. + + However, when a layer's contentRect position is non-zero, we translate the GraphicsContext + to put the contentRect at 0,0 in the skia canvas. For tracking opaque regions in the resulting + layer, we need to unto this translation. Scaling can also occur which we must undo. So we pass + the transform in to PlatformContextSkia to go from the SkCanvas back to the layer's content + coordinate space. Opaque paints can then be tracked in the layer's content space rather than + in the skia canvas space. + + * platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapCanvasLayerTextureUpdater::prepareToUpdate): + * platform/graphics/chromium/CanvasLayerTextureUpdater.cpp: + (WebCore::CanvasLayerTextureUpdater::paintContents): + * platform/graphics/chromium/CanvasLayerTextureUpdater.h: + (WebCore): + (CanvasLayerTextureUpdater): + * platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::SkPictureCanvasLayerTextureUpdater::prepareToUpdate): + * platform/graphics/skia/OpaqueRegionSkia.cpp: + (WebCore::paintIsOpaque): + (WebCore::OpaqueRegionSkia::didDrawRect): + (WebCore::OpaqueRegionSkia::didDrawPath): + (WebCore::OpaqueRegionSkia::didDrawPoints): + (WebCore::OpaqueRegionSkia::didDrawBounded): + (WebCore::OpaqueRegionSkia::didDraw): + (WebCore::OpaqueRegionSkia::markRectAsOpaque): + (WebCore::OpaqueRegionSkia::markRectAsNonOpaque): + * platform/graphics/skia/OpaqueRegionSkia.h: + (WebCore): + (OpaqueRegionSkia): + * platform/graphics/skia/PlatformContextSkia.cpp: + (WebCore::PlatformContextSkia::didDrawRect): + (WebCore::PlatformContextSkia::didDrawPath): + (WebCore::PlatformContextSkia::didDrawPoints): + (WebCore::PlatformContextSkia::didDrawBounded): + * platform/graphics/skia/PlatformContextSkia.h: + (PlatformContextSkia): + (WebCore::PlatformContextSkia::setOpaqueRegionTransform): + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Remove [CustomHeader] from CanvasPixelArray and rename [CustomHeader] to [JSCustomHeader] + https://bugs.webkit.org/show_bug.cgi?id=78089 + + Reviewed by Adam Barth. + + This patch removes [CustomHeader] from CanvasPixelArray.idl, since CanvasPixelArrayCustom.h + does not exist. (The reason why missing CanvasPixelArrayCustom.h has not caused build failure + is that [CustomHeader] has been JSC-specific and JSC has not enabled CanvasPixelArray.) + Also, this patch renames [CustomHeader] to [JSCustomHeader], since whether a given class + should have custom header or not will depend on JavaScript bindings. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + * dom/Node.idl: + * html/canvas/CanvasPixelArray.idl: + +2012-02-08 Zalan Bujtas <zbujtas@gmail.com> + + Dispatch updateViewportArguments(), when Document is finished + restoring from page cache. + + https://bugs.webkit.org/show_bug.cgi?id=77943 + + Reviewed by Kenneth Rohde Christiansen. + + Move updateViewportArguments() call from setPageInCache() to + documentDidResumeFromPageCache() to ensure, that the Document is + fully resumed from the page cache and attached to the mainframe, + when the viewport arguments are updated. + + No tests. No change in behaviour. + + * dom/Document.cpp: + (WebCore::Document::setInPageCache): + (WebCore::Document::documentDidResumeFromPageCache): + +2012-02-08 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove incorrect early exit in CCDamageTracker + https://bugs.webkit.org/show_bug.cgi?id=76924 + + Reviewed by James Robinson. + + New unit test added to CCDamageTrackerTest.cpp + + This patch does three things: (1) adds unit test that demonstrates + that early exiting in CCDamageTracker is wrong, (2) removes the + early exit and cleans up the surrounding code, and (3) re-names + several functions in CCDamageTracker so that state updating is + implied by the name, and not just a bad side-effect of the functions. + + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::updateDamageTrackingState): + (WebCore::CCDamageTracker::trackDamageFromActiveLayers): + (WebCore::CCDamageTracker::trackDamageFromSurfaceMask): + (WebCore::CCDamageTracker::trackDamageFromLeftoverRects): + * platform/graphics/chromium/cc/CCDamageTracker.h: + (CCDamageTracker): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::trackDamageForAllSurfaces): + +2012-02-08 James Robinson <jamesr@chromium.org> + + [chromium] Check that we can make the SharedGraphicsContext3D current before returning + https://bugs.webkit.org/show_bug.cgi?id=78142 + + Reviewed by Stephen White. + + If we can't make the context current, we can't use it. + + * platform/graphics/gpu/SharedGraphicsContext3D.cpp: + (WebCore::SharedGraphicsContext3D::get): + +2012-02-08 Abhishek Arya <inferno@chromium.org> + + Crash in Node::normalize. + https://bugs.webkit.org/show_bug.cgi?id=78135 + + Reviewed by Ryosuke Niwa. + + No new tests. Original testcase does not reduce to manageable + extent. + + * dom/Node.cpp: + (WebCore::Node::normalize): + +2012-02-08 Antoine Labour <piman@chromium.org> + + Make WebGL context current early to check validity + https://bugs.webkit.org/show_bug.cgi?id=78141 + + Reviewed by James Robinson. + + Covered by existing tests + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::create): + +2012-02-08 Jonathan Backer <backer@chromium.org> + + [chromium] Disable root layer clears on release builds. + https://bugs.webkit.org/show_bug.cgi?id=77478 + + Reviewed by James Robinson. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::LayerRendererChromium::clearRenderSurface): + (WebCore::LayerRendererChromium::drawRenderPass): + * platform/graphics/chromium/LayerRendererChromium.h: + (LayerRendererChromium): + +2012-02-08 Anders Carlsson <andersca@apple.com> + + Add a content shadow layer to the render layer compositor + https://bugs.webkit.org/show_bug.cgi?id=78133 + <rdar://problem/10797742> + + Reviewed by Beth Dakin. + + Have the render layer compositor optionally create a content shadow layer, + and add a ScrollbarTheme::setUpContentShadowLayer member function that subclasses + can use to set content shadow properties. + + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::ScrollbarThemeMac::setUpContentShadowLayer): + Set the layer properties once, and set the shadow path on every call, since we know that this + function will be called every time the size of the content shadow layer changes. + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateRootLayerPosition): + Reposition the content shadow layer, and call ScrollbarTheme::setUpContentShadowLayer if the size changes. + + (WebCore::RenderLayerCompositor::requiresContentShadowLayer): + Add new helper function. + + (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): + Create a content shadow layer if needed. + +2012-02-07 Andy Estes <aestes@apple.com> + + REGRESSION (r102983): ClicktoFlash drawing of old style youtube embeds missing until resize + https://bugs.webkit.org/show_bug.cgi?id=77167 + + Reviewed by Eric Seidel. + + Test: plugins/layout-in-beforeload-listener-affects-plugin-loading.html + + r102983 made FrameView::updateWidgets() check if the DOM node actually + needs a widget update before calling updateWidget(). Due to historical + reasons, however, updateWidget() can be legitimately called twice: once + at attach time for non-Netscape plug-ins and once at layout time for + Netscape plug-ins. + + If the widget represents a Netscape plug-in, but updateWidget() is + called for the CreateOnlyNonNetscapePlugins case after the DOM node was + marked as needing an update, updateWidget() will clear the update flag + and prevent a second call to updateWidget() at layout time for the + CreateAnyWidgetType case. + + As much as I loathe adding to the code duplication between + HTMLEmbedElement::updateWidget() and HTMLObjectElement::updateWidget(), + the simplest solution seems to be marking the DOM node as needing + update in the case where we are calling updateWidget() for the + CreateOnlyNonNetscapePlugins case and we know we will be loading a + Netscape plug-in. + + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::updateWidget): Call + setNeedsWidgetUpdate(true) if pluginCreationOption is + CreateOnlyNonNetscapePlugins but we will load a Netscape plug-in. + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::updateWidget): Ditto. + * html/HTMLPlugInElement.cpp: + (WebCore::HTMLPlugInElement::guardedDispatchBeforeLoadEvent): Remove an + invalid assertion that prevents the layout test from running in a Debug + configuration. + +2012-02-07 Ojan Vafai <ojan@chromium.org> + + Floated flexboxes render as regular RenderBlocks + https://bugs.webkit.org/show_bug.cgi?id=77909 + + Reviewed by Eric Seidel. + + Add grid/flexbox cases to adjusting the display of floated/positioned + elements. Also, move this logic into a switch statement. This makes + the code more readable and gives compile warnings when new display types + are added that aren't handled here. + + Test: css3/flexbox/floated-flexbox.html + + * css/CSSStyleSelector.cpp: + (WebCore::adjustDisplay): + (WebCore): + (WebCore::CSSStyleSelector::adjustRenderStyle): + +2012-02-08 Dirk Schulze <krit@webkit.org> + + viewBox on nested SVG causes wrong content size for relative values + https://bugs.webkit.org/show_bug.cgi?id=69459 + + Reviewed by Nikolas. + + In the past we just checked the change of the viewport size of the root SVG element. If the size changed, all childs + with relative length values needed a relayout. We did not consider that we might have other viewports in the document. + Childs with relative lengths had a strange zooming, if just the viewport size of an inner SVG element changed. + + With this patch we check if the size of the nearest viewport changes. Is this the case, childs with relative lengths + need a relayout. + + Test: inner-svg-change-viewBox.svg + + * rendering/svg/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::layout): + * rendering/svg/RenderSVGContainer.h: + (RenderSVGContainer): + (WebCore::RenderSVGContainer::determineIfLayoutSizeChanged): Check if we need layout and have relative length values. + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::layout): Remove resetting 'viewport size changed' flag for code operability. No influence on the layout. + * rendering/svg/RenderSVGViewportContainer.cpp: + (WebCore::RenderSVGViewportContainer::RenderSVGViewportContainer): Add a flag that indicates that the viewport size changes. + (WebCore::RenderSVGViewportContainer::determineIfLayoutSizeChanged): The flag gets set during the layout phase of the SVG element if the size changes. + (WebCore): + * rendering/svg/RenderSVGViewportContainer.h: + (WebCore::RenderSVGViewportContainer::isLayoutSizeChanged): Added getter to get flag status. + (RenderSVGViewportContainer): + (WebCore::toRenderSVGViewportContainer): Added casting function for constant RenderObjects. + (WebCore): + * rendering/svg/SVGRenderSupport.cpp: + (WebCore::layoutSizeOfNearestViewportChanged): Search the nearest viewport and check if the size changed. + (WebCore): + (WebCore::SVGRenderSupport::layoutChildren): Don't check the roots viewport for size changes, but the nearest viewport. + * svg/SVGSVGElement.cpp: + (WebCore::SVGSVGElement::svgAttributeChanged): Added viewBoxAttr to the list of attributes that cause relayout. + +2012-02-08 Gregg Tavares <gman@google.com> + + Implement new WEBGL compressed texture extensions + https://bugs.webkit.org/show_bug.cgi?id=77066 + + This removes the old experimental compressed + texture extension and implements the first new + one. + + A test is in the WebGL conformance tests in + extensions/webgl-compressed-texture-s3tc.html + and will be copied here in a future patch. + + Reviewed by Kenneth Russell. + + No new tests. Test coming in future patch. + + * CMakeLists.txt: + * DerivedSources.make: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSWebGLRenderingContextCustom.cpp: + (WebCore::toJS): + * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: + (WebCore::toV8Object): + * html/canvas/WebGLCompressedTextureS3TC.cpp: Added. + (WebCore): + (WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC): + (WebCore::WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC): + (WebCore::WebGLCompressedTextureS3TC::getName): + (WebCore::WebGLCompressedTextureS3TC::create): + (WebCore::WebGLCompressedTextureS3TC::supported): + * html/canvas/WebGLCompressedTextureS3TC.h: Copied from Source/WebCore/html/canvas/WebGLExtension.h. + (WebCore): + (WebGLCompressedTextureS3TC): + * html/canvas/WebGLCompressedTextureS3TC.idl: Renamed from Source/WebCore/html/canvas/WebGLCompressedTextures.idl. + * html/canvas/WebGLCompressedTextures.cpp: Removed. + * html/canvas/WebGLCompressedTextures.h: Removed. + * html/canvas/WebGLExtension.h: + * html/canvas/WebGLGetInfo.cpp: + (WebCore::WebGLGetInfo::WebGLGetInfo): + (WebCore): + (WebCore::WebGLGetInfo::getWebGLUnsignedIntArray): + * html/canvas/WebGLGetInfo.h: + * html/canvas/WebGLObject.cpp: + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::addCompressedTextureFormat): + (WebCore::WebGLRenderingContext::compressedTexImage2D): + (WebCore::WebGLRenderingContext::compressedTexSubImage2D): + (WebCore::WebGLRenderingContext::getExtension): + (WebCore::WebGLRenderingContext::getParameter): + (WebCore::WebGLRenderingContext::getSupportedExtensions): + (WebCore::WebGLRenderingContext::validateCompressedTexFormat): + (WebCore::WebGLRenderingContext::validateCompressedTexFuncData): + (WebCore::WebGLRenderingContext::validateCompressedTexDimensions): + (WebCore::WebGLRenderingContext::validateCompressedTexSubDimensions): + * html/canvas/WebGLRenderingContext.h: + (WebCore): + (WebGLRenderingContext): + * html/canvas/WebGLRenderingContext.idl: + +2012-02-08 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: heap snapshot: implement Distance column in Object's retaining tree. + https://bugs.webkit.org/show_bug.cgi?id=78113 + + Retaining path list was replaced with Retaining tree some time ago. + But it was not so useful when we want to track the retaining path from an object to a DOM Window node. + + Drive by fix: sort doesn't work in retaining tree panel. + Drive by fix: save/load child nodes doesn't work for the retaining tree panel. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotObjectNode): + (WebInspector.HeapSnapshotObjectNode.prototype._childHashForEntity): save/load children fix + (WebInspector.HeapSnapshotObjectNode.prototype._childHashForNode): save/load children fix + (WebInspector.HeapSnapshotObjectNode.prototype.comparator): + (WebInspector.HeapSnapshotObjectNode.prototype._enhanceData): + * inspector/front-end/DetailedHeapshotView.js: + (WebInspector.HeapSnapshotContainmentDataGrid): + (WebInspector.HeapSnapshotRetainmentDataGrid): + (WebInspector.HeapSnapshotRetainmentDataGrid.prototype._sortFields): + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshotRetainerEdge.prototype.set retainerIndex): + (WebInspector.HeapSnapshotRetainerEdge.prototype.set edgeIndex): + (WebInspector.HeapSnapshotRetainerEdge.prototype.get _node): + (WebInspector.HeapSnapshotRetainerEdge.prototype.get _edge): + (WebInspector.HeapSnapshotNode.prototype.get distanceToWindow): + (WebInspector.HeapSnapshot.prototype._init): + (WebInspector.HeapSnapshot.prototype._buildRetainers): + (WebInspector.HeapSnapshot.prototype._calculateObjectToWindowDistance): + (WebInspector.HeapSnapshot.prototype._bfs): + (WebInspector.HeapSnapshotEdgesProvider.prototype._serialize): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort.compareEdgeFieldName): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort.compareNodeField): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort.compareEdgeAndNode): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort.compareNodeAndEdge): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort.compareNodeAndNode): + (WebInspector.HeapSnapshotEdgesProvider.prototype.sort): + (WebInspector.HeapSnapshotNodesProvider.prototype._serialize): + * inspector/front-end/heapProfiler.css: + (.detailed-heapshot-view .data-grid td.distanceToWindow-column): + +2012-02-08 Anders Carlsson <andersca@apple.com> + + Fix assertion in svg/dom/SVGStyledElement-pendingResource-crash.html + https://bugs.webkit.org/show_bug.cgi?id=78126 + + Reviewed by Dan Bernstein. + + This broke in r106977 when I tried to change an early return into an ASSERT, + so let's bring back the early return. + + * page/FrameView.cpp: + (WebCore::FrameView::notifyPageThatContentAreaWillPaint): + +2012-02-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106920, r106924, r106933, r106939, + and r107090. + http://trac.webkit.org/changeset/106920 + http://trac.webkit.org/changeset/106924 + http://trac.webkit.org/changeset/106933 + http://trac.webkit.org/changeset/106939 + http://trac.webkit.org/changeset/107090 + https://bugs.webkit.org/show_bug.cgi?id=78124 + + Something is completely wrong this change (Requested by + Ossy_gardener on #webkit). + + * platform/FileSystem.h: + (WebCore): + * platform/qt/FileSystemQt.cpp: + +2012-02-08 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=78122 + + Add support for the "contains" value for line-grid-snap. This value centers the line box in between the + text-top and text-bottom of the minimum number of grid lines that enclose the line box. This is useful for + centering headers in a line grid. + + Reviewed by Adam Roben. + + Added a new test in fast/line-grid. + + * rendering/RootInlineBox.cpp: + (WebCore::RootInlineBox::lineGridSnapAdjustment): + +2012-02-08 Cary Clark <caryclark@google.com> + + [Skia Mac] Make misspelling underline dots unclipped + https://bugs.webkit.org/show_bug.cgi?id=78117 + http://code.google.com/p/chromium/issues/detail?id=113154 + + Reviewed by Stephen White. + + No new tests. Existing layout tests cover this. + + As is done on the CoreGraphics Mac platform, adjust the + underline width to remove partial dots, not including the + trailing transparent pixel column. + + * platform/graphics/skia/GraphicsContextSkia.cpp: + (WebCore::GraphicsContext::drawLineForTextChecking): + +2012-02-08 Pavel Feldman <pfeldman@google.com> + + Web Inspector: bind entire subtree upon childNodeInserted so that text node were accounted. + https://bugs.webkit.org/show_bug.cgi?id=78116 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode): + (WebInspector.DOMDocument): + (WebInspector.DOMAgent.prototype._setDocument): + (WebInspector.DOMAgent.prototype._setDetachedRoot): + (WebInspector.DOMAgent.prototype._setChildNodes): + (WebInspector.DOMAgent.prototype._childNodeRemoved): + (WebInspector.DOMAgent.prototype._unbind): + +2012-02-08 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: Optional out arguments are not supported in the Web Inspector protocol, which breaks the implementation + https://bugs.webkit.org/show_bug.cgi?id=77967 + + Reviewed by Yury Semikhatsky. + + Condition for RefPtr-based types added. This is more-or-less a hack + and it's should be redone together with the switch to type-safe API. + + * inspector/CodeGeneratorInspector.py: + (Generator.process_command): + +2012-02-07 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: inspected object wrapper should be released by InjectedScript when popover closes + https://bugs.webkit.org/show_bug.cgi?id=77972 + + When object popover is shown the object under cursor is resolved and its + wrapper is put into 'popover' object wrapper group. The group is discarded + when the popover closes. + + Reviewed by Pavel Feldman. + + * bindings/js/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::objectByHeapObjectId): + * bindings/js/ScriptProfiler.h: + (WebCore): + (ScriptProfiler): + * bindings/v8/ScriptProfiler.cpp: + (WebCore::ScriptProfiler::objectByHeapObjectId): + (WebCore): + * bindings/v8/ScriptProfiler.h: + (WebCore): + (ScriptProfiler): + * inspector/Inspector.json: + * inspector/InspectorProfilerAgent.cpp: + (WebCore::InspectorProfilerAgent::getObjectByHeapObjectId): + * inspector/InspectorProfilerAgent.h: + (InspectorProfilerAgent): + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotGenericObjectNode.prototype.queryObjectContent): + * inspector/front-end/DetailedHeapshotView.js: + (WebInspector.DetailedHeapshotView.prototype._resolveObjectForPopover): + * inspector/front-end/JavaScriptSourceFrame.js: + (WebInspector.JavaScriptSourceFrame): + (WebInspector.JavaScriptSourceFrame.prototype._resolveObjectForPopover): + (WebInspector.JavaScriptSourceFrame.prototype._onHidePopover): + * inspector/front-end/ObjectPopoverHelper.js: + (WebInspector.ObjectPopoverHelper): + (WebInspector.ObjectPopoverHelper.prototype._showObjectPopover): + (WebInspector.ObjectPopoverHelper.prototype._onHideObjectPopover): + +2012-02-08 Mario Sanchez Prada <msanchez@igalia.com> + + [Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps + https://bugs.webkit.org/show_bug.cgi?id=73431 + + Reviewed by Chris Fleizach. + + Don't replace item's markers with the objectReplacementCharacter + character, as they will be treated in an special way later on. + + * accessibility/gtk/WebKitAccessibleInterfaceText.cpp: + (textForRenderer): Don't append the objectReplacementCharacter + character for list item's markers. + +2012-02-08 Pavel Feldman <pfeldman@google.com> + + Web Inspector: do not clear entire tree map upon last element deletion. + https://bugs.webkit.org/show_bug.cgi?id=78112 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/treeoutline.js: + (TreeOutline.prototype._forgetChildrenRecursive): + +2012-02-08 Kaustubh Atrawalkar <kaustubh@motorola.com> + + Migrate createObjectURL & revokeObjectURL to static (Class) methods. + https://bugs.webkit.org/show_bug.cgi?id=74386 + + Reviewed by Kentaro Hara. + + Move createObjectURL & revokeObjectURL from DOMURL implementation to + static methods as per specs - http://www.w3.org/TR/FileAPI/#creating-revoking + + Test: fast/dom/DOMURL/check-instanceof-domurl-functions.html + Already Existing: + fast/files/revoke-blob-url.html + fast/dom/window-domurl-crash.html + fast/files/apply-blob-url-to-img.html + fast/files/create-blob-url-crash.html + fast/files/workers/inline-worker-via-blob-url.html + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::fileThread): + (WebCore): + (WebCore::ScriptExecutionContext::publicURLManager): + * dom/ScriptExecutionContext.h: + (WebCore): + (ScriptExecutionContext): + * html/DOMURL.cpp: + (WebCore): + (WebCore::DOMURL::createObjectURL): Changed to static. + (WebCore::DOMURL::revokeObjectURL): ditto. + * html/DOMURL.h: + (DOMURL): + (WebCore::DOMURL::create): + * html/DOMURL.idl: + * html/PublicURLManager.h: Added. + (WebCore): + (PublicURLManager): + (WebCore::PublicURLManager::create): + (WebCore::PublicURLManager::contextDestroyed): + (WebCore::PublicURLManager::blobURLs): + (WebCore::PublicURLManager::streamURLs): + * page/DOMWindow.cpp: Removed object initialization for DOMURL. + (WebCore): + * page/DOMWindow.h: ditto. + (DOMWindow): + * page/DOMWindow.idl: + * workers/WorkerContext.cpp: + (WebCore): + * workers/WorkerContext.h: + (WorkerContext): + * workers/WorkerContext.idl: + +2012-02-01 Brian Grinstead <briangrinstead@gmail.com> + + Web Inspector: Add changes for Spectrum colorpicker + https://bugs.webkit.org/show_bug.cgi?id=75454 + + Reviewed by Pavel Feldman. + + * inspector/front-end/Color.js: + (WebInspector.Color.fromRGB): + * inspector/front-end/utilities.js: + (Element.prototype.totalOffsetLeft): + (Element.prototype.totalOffsetTop): + (Element.prototype.totalOffset): + (Element.prototype.scrollOffset): + (): + +2012-02-08 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Avoid an avalanche of "class" attribute modifications in WatchExpressionsSidebarPane + https://bugs.webkit.org/show_bug.cgi?id=78102 + + Reviewed by Vsevolod Vlasov. + + * inspector/front-end/WatchExpressionsSidebarPane.js: + (WebInspector.WatchExpressionsSection.prototype._updateHoveredElement): + +2012-02-08 Antaryami Pandia <antaryami.pandia@motorola.com> + + CSS2 overflow: scrollbar not visible on SELECT elements when overflow: scroll is set. + https://bugs.webkit.org/show_bug.cgi?id=69993 + + Reviewed by Simon Fraser. + + The issue was that for overflow:scroll, currently webkit always places the horizontal + and vertical scrollbar. But Since the listbox renderer handles its scrolling, + we should not set scrollbar for list-box. + + Tests: fast/css/getComputedStyle/computed-style-select-overflow.html + fast/forms/select-overflow-scroll-inherited.html + fast/forms/select-overflow-scroll.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::layoutBlock): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateScrollInfoAfterLayout): + +2012-02-08 Nikolas Zimmermann <nzimmermann@rim.com> + + feImage doesn't invalidate when its target SVG element is animated + https://bugs.webkit.org/show_bug.cgi?id=73860 + + Reviewed by Dirk Schulze. + + Consider following testcase: + <defs> + <rect id="rect" fill="red" width="50" height="50"/> + <filter id="filter"> + <feImage xlink:href="#rect"/> + </filter> + </defs> + <rect width="50" height="50" filter="url(#filter)"/> + + If the <rect id="rect"> gets changed dynamically (attribute/property/style change) the <feImage> + doesn't notice this, as there's no link between the <rect> and the <feImage>, as the <rect> is not + a child of the <feImage/>. To get invalidations working for these situations, we have to track + the referencingElement & referencedElement in SVGDocumentExtensions. + + Fixes parts the SVG-Wow twirl testcase and David Daileys SVG waves example. + + Tests: svg/filters/feImage-animated-transform-on-target-rect.svg + svg/filters/feImage-late-indirect-update.svg + svg/filters/feImage-mutliple-targets-id-change.svg + svg/filters/feImage-target-attribute-change-with-use-indirection-2.svg + svg/filters/feImage-target-attribute-change-with-use-indirection.svg + svg/filters/feImage-target-attribute-change.svg + svg/filters/feImage-target-inline-style-change.svg + svg/filters/feImage-target-property-change.svg + svg/filters/feImage-target-style-change.svg + + * rendering/svg/RenderSVGResource.cpp: + (WebCore::removeFromFilterCacheAndInvalidateDependencies): Renamed from removeFromFilterCache, as it has another purpose now. + (WebCore::RenderSVGResource::markForLayoutAndParentResourceInvalidation): s/removeFromFilterCache/removeFromFilterCacheAndInvalidateDependencies/. + * rendering/svg/RenderSVGResource.h: Removed removeFromFilterCache, it got inlined. + * svg/SVGDocumentExtensions.cpp: Add a new HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > > used for dependency tracking. + (WebCore::SVGDocumentExtensions::setOfElementsReferencingTarget): Returns all elements the passed in element depends on. + (WebCore::SVGDocumentExtensions::addElementReferencingTarget): Register element 'a' referencing target 'b'. + (WebCore::SVGDocumentExtensions::removeAllTargetReferencesForElement): Called by element 'a' on destruction or any target change. + (WebCore::SVGDocumentExtensions::removeAllElementReferencesForTarget): Called by element 'b' on destruction. + * svg/SVGDocumentExtensions.h: Expose new methods. + * svg/SVGElement.cpp: + (WebCore::SVGElement::~SVGElement): Call remove removeAllElementReferencesForTarget on destruction. + * svg/SVGFEImageElement.cpp: + (WebCore::SVGFEImageElement::clearResourceReferences): + (WebCore::SVGFEImageElement::buildPendingResource): + +2012-02-08 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Using string method instead of char* operation in the platformLanguage(). + https://bugs.webkit.org/show_bug.cgi?id=78077 + + Reviewed by Andreas Kling. + + No new tests. Just fix a bug of platformLanguage function. + + * platform/efl/LanguageEfl.cpp: + (WebCore::platformLanguage): + Change char* operation to string operation. + +2012-02-08 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Touch event emulation fails for iframes + https://bugs.webkit.org/show_bug.cgi?id=77987 + + Reviewed by Pavel Feldman. + + Test: fast/events/touch/emulated-touch-iframe.html + + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMouseReleaseEvent): + +2012-02-08 Andreas Kling <awesomekling@apple.com> + + StyledElement: Manully setNeedsStyleRecalc() after adding CSSProperties directly. + <http://webkit.org/b/78068> + + Rubber-stamped by Ryosuke Niwa. + + Turns out that setProperty() with a CSSProperty has quite different behavior from + the other setProperty() methods. We should probably clean that up (separately.) + For now, simply call setNeedsStyleRecalc() manually in the addCSS* functions that + use setProperty(CSSProperty). + + * dom/StyledElement.cpp: + (WebCore::StyledElement::addCSSProperty): + (WebCore::StyledElement::addCSSImageProperty): + +2012-02-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r107050. + http://trac.webkit.org/changeset/107050 + https://bugs.webkit.org/show_bug.cgi?id=78094 + + May crash editing tests (Requested by morrita on #webkit). + + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::createShadowSubtree): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::createShadowSubtree): + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::createShadowSubtree): + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::createShadowSubtree): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::createShadowSubtree): + +2012-02-08 Nikolas Zimmermann <nzimmermann@rim.com> + + [Qt] REGRESSION(r106918): It made svg/zoom/page/zoom-foreignObject.svg crash with Qt5-WK1 + https://bugs.webkit.org/show_bug.cgi?id=77995 + + Reviewed by Csaba Osztrogonác. + + From the stack traces it's obvious that SVGImageChromeClient tried to invalidate the root view, + while its SVGImage was being destructed, due to an updateStyleIfNeeded() call, coming + from frameDetached(). There's no point in redrawing there, so we should just stop it. + + Covered by existing tests on the Qt but, unfortunately I couldn't reproduce it on Mac. + + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImageChromeClient::invalidateContentsAndRootView): Stop invalidating if m_page is 0. + (WebCore::SVGImage::~SVGImage): Clear m_page, so that SVGImageChromeClient knows we're destructing. + * svg/graphics/SVGImage.h: + +2012-02-08 Pablo Flouret <pablof@motorola.com> + + Add state attribute to history's dom interface. + https://bugs.webkit.org/show_bug.cgi?id=76035 + + Reviewed by Kentaro Hara. + + Tests: fast/loader/stateobjects/state-attribute-object-types.html + fast/loader/stateobjects/state-attribute-only-one-deserialization.html + + * bindings/js/JSHistoryCustom.cpp: + (WebCore::JSHistory::state): + (WebCore): + (WebCore::JSHistory::pushState): + (WebCore::JSHistory::replaceState): + * bindings/v8/custom/V8HistoryCustom.cpp: + (WebCore::V8History::stateAccessorGetter): + (WebCore): + (WebCore::V8History::pushStateCallback): + (WebCore::V8History::replaceStateCallback): + * page/History.cpp: + (WebCore::History::History): + (WebCore::History::state): + (WebCore): + (WebCore::History::stateInternal): + (WebCore::History::stateChanged): + * page/History.h: + (History): + * page/History.idl: + +2012-02-08 Nikolas Zimmermann <nzimmermann@rim.com> + + SVGLoad event fires too early + https://bugs.webkit.org/show_bug.cgi?id=78084 + + Reviewed by Hajime Morita. + + SVGLoad event fires too early, making it impossible to use the vanilla repaint.js harness (runRepaintTest). + + We're using a hack called runSVGRepaintTest() at the moment in trunk, which runs runRepaintTest() from a 0ms timer, + which is not reliable. The main difference between HTML onload and SVG onload is that HTMLs event is a "window event", + thus dispatched through DOMWindow (eg. <body onload="alert(event.target)" will yield Document, + <svg onload="alert(evt.target)"> will say SVGSVGElement). + + Consider: + <svg onload="alert('1')> + <g onload="alert('2)"> + <rect onload="alert('3')"/> + </svg> + + As soon as the <rect> finishes parsing (SVGElement::finishedParsingChildren), it's SVGLoad event is fired. + So first you'll see '3', then '2', then '1'. + + Using: + <svg onload="alert('1')> + <g onload="alert('2)"> + <image xlink:href="someExternal.jpg" onload="alert('3')"/> + </svg> + + will yield the same SVGLoad order. When using <image externalREsourcesRequired="true", first the '1' will fire, + then '3', then '2', all as expected and specified in SVG. + + http://www.w3.org/TR/SVG/interact.html#LoadEvent says: + "The event is triggered at the point at which the user agent has fully parsed the element and its descendants and is + ready to act appropriately upon that element, such as being ready to render the element to the target device. Referenced + external resources that are required must be loaded, parsed and ready to render before the event is triggered. Optional + external resources are not required to be ready for the event to be triggered." + + What we don't implement correctly is the second part of the first sentence: "and is ready to act appropriately upon that + element, such as being ready to render the element to the target device". We currently fire the SVGLoad event, right after + </svg> is seen, if no externalResourceRequired="true" attributes are set anywhere. This is not wrong, but not correct for + WebKit, as we're not yet "ready to render". + + HTML fires its window onload event from Document::implicitClose(), where it calls Document::dispatchWindowLoadEvent. + At this point we're ready to render. So I'm now aligning the timing of the outermost <svg> elements SVGLoad event, to be + equal to HTML. This lets use use the repaint.js harness w/o any special SVG tricks. + + Covered by existing tests. + + * dom/Document.cpp: + (WebCore::Document::implicitClose): Dispatch SVGLoad event for outermost <svg> elements from here, as HTML does for its window onload event. + * svg/SVGDocumentExtensions.cpp: + (WebCore::SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements): Sends a SVGLoad event to all outermost <svg> elements in a document, if possible. + There can be multiple ones, if using <svg><foreignObject><svg>... - the <svg> in the <fO> also acts as outermost <svg> element. + * svg/SVGDocumentExtensions.h: Add new dispatchSVGLoadEventToOutermostSVGElements() helper. + * svg/SVGElement.cpp: + (WebCore::SVGElement::isOutermostSVGSVGElement): Moved from SVGSVGElement into SVGElement, and renamed from isOutermostSVG(). + (WebCore::SVGElement::sendSVGLoadEventIfPossible): Don't dispatch load events to outermost <svg> elements, if Document::implicitClose() wasn't called yet. + (WebCore::SVGElement::finishParsingChildren): Stop using the default SVGLoad dispatching logic for outermost <svg> elements. + * svg/SVGElement.h: Add isOutermostSVGSVGElement(). + * svg/SVGSVGElement.cpp: Rename isOutermostSVG to isOutermostSVGSVGElement. + (WebCore::SVGSVGElement::currentScale): + (WebCore::SVGSVGElement::setCurrentScale): + (WebCore::SVGSVGElement::localCoordinateSpaceTransform): + (WebCore::SVGSVGElement::createRenderer): + * svg/SVGSVGElement.h: Move isOutermostSVG() to SVGElement. + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::title): Rename isOutermostSVG to isOutermostSVGSVGElement. + +2012-02-08 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: [CRASH] InspectorDOMAgent::updateTouchEventEmulationInPage() + https://bugs.webkit.org/show_bug.cgi?id=78090 + + Reviewed by Vsevolod Vlasov. + + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::updateTouchEventEmulationInPage): + +2012-02-07 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Closed computed style sidebar pane rebuilds, resulting in slowness + https://bugs.webkit.org/show_bug.cgi?id=77865 + + Reviewed by Pavel Feldman. + + Test: inspector/styles/lazy-computed-style.html + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane): + (WebInspector.StylesSidebarPane.prototype._executeRebuildUpdate): + (WebInspector.StylesSidebarPane.prototype._refreshComputedStyleSection): + (WebInspector.ComputedStyleSidebarPane.prototype.expand): + (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate): + +2012-02-08 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Adding the onstatechange callback to PeerConnection + https://bugs.webkit.org/show_bug.cgi?id=77954 + + When readyState changes a callback should be triggered. + + Reviewed by Adam Barth. + + Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code. + + * dom/EventNames.h: + (WebCore): + * mediastream/PeerConnection.cpp: + (WebCore::PeerConnection::changeReadyState): + * mediastream/PeerConnection.h: + (PeerConnection): + (WebCore::PeerConnection::didChangeState): + * mediastream/PeerConnection.idl: + * platform/mediastream/PeerConnectionHandlerClient.h: + (PeerConnectionHandlerClient): + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Rename [DelegatingPutFunction] IDL to [CustomNamedSetter] IDL + https://bugs.webkit.org/show_bug.cgi?id=77963 + + Reviewed by Adam Barth. + + This patch renames [DelegatingPutFunction] IDL to [CustomNamedSetter] IDL, + for clarification and for naming consistency with [NamedGetter] and [CustomIndexedSetter]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeaderNamedAndIndexedPropertyAccessors): + (GenerateImplementationIndexer): + (GenerateImplementationNamedPropertyGetter): + * bindings/scripts/test/TestInterface.idl: + * css/CSSStyleDeclaration.idl: + * dom/DOMStringMap.idl: + * html/HTMLAppletElement.idl: + * html/HTMLEmbedElement.idl: + * html/HTMLObjectElement.idl: + * page/History.idl: + * page/Location.idl: + * storage/Storage.idl: + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Replace [CheckNodeSecurity] with [CheckAccessToNode] + https://bugs.webkit.org/show_bug.cgi?id=77971 + + Reviewed by Adam Barth. + + [CheckNodeSecurity] is not implemented by code generators. + This patch replaces [CheckNodeSecurity] with [CheckAccessToNode]. + + Test: http/tests/security/cross-frame-access-frameelement.html + + * page/DOMWindow.idl: + +2012-02-08 Kentaro Hara <haraken@chromium.org> + + Rename [CustomPushEventHandlerScope] to [JSCustomPushEventHandlerScope] + https://bugs.webkit.org/show_bug.cgi?id=78081 + + Reviewed by Adam Barth. + + [CustomPushEventHandlerScope] is a JSC-specific IDL attribute. + This patch renames it to [JSCustomPushEventHandlerScope] + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + * dom/Node.idl: + * html/HTMLElement.idl: + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + Add "JS" prefix to JSC-specific IDLs + https://bugs.webkit.org/show_bug.cgi?id=77846 + + Reviewed by Darin Adler. + + In bug 77693, we have added "JS" prefix to several JSC specific IDLs. + This patch adds "JS" prefix to the remaining JSC specific IDLs. + Specifically, this patch renames IDLs as follows: + + [CustomDefineOwnProperty] => [JSCustomDefineOwnProperty] + [CustomPrototypeDefineOwnProperty] => [JSCustomPrototypeDefineOwnProperty] + [GenerateNativeConverter] => [JSGenerateToNativeObject] (Note: For naming consistency + with [JSGenerateToJS] and [JSCustomToNativeObject]) + [DelegatingGetOwnPropertySlot] => [JSCustomGetOwnPropertySlotDelegate] (Note: Should be prefixed "JS", + should be prefixed with "Custom", and for naming consistency with [CustomGetOwnPropertySlot]) + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateGetOwnPropertyDescriptorBody): + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/test/TestTypedArray.idl: + * dom/Attr.idl: + * dom/DataTransferItemList.idl: + * dom/Document.idl: + * dom/DocumentType.idl: + * dom/Element.idl: + * dom/Node.idl: + * fileapi/DirectoryEntry.idl: + * fileapi/DirectoryEntrySync.idl: + * fileapi/File.idl: + * fileapi/FileEntry.idl: + * fileapi/FileEntrySync.idl: + * fileapi/WebKitBlobBuilder.idl: + * html/DOMFormData.idl: + * html/DOMURL.idl: + * html/HTMLAppletElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLElement.idl: + * html/HTMLEmbedElement.idl: + * html/HTMLImageElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOptionElement.idl: + * html/HTMLOptionsCollection.idl: + * html/HTMLTableCaptionElement.idl: + * html/HTMLTableSectionElement.idl: + * html/HTMLVideoElement.idl: + * html/TextTrackCue.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * mediastream/LocalMediaStream.idl: + * page/DOMWindow.idl: + * page/History.idl: + * page/Location.idl: + * storage/StorageInfo.idl: + * svg/SVGElement.idl: + * svg/SVGElementInstance.idl: + * workers/DedicatedWorkerContext.idl: + * workers/SharedWorker.idl: + * workers/SharedWorkerContext.idl: + * workers/Worker.idl: + * workers/WorkerContext.idl: + +2012-02-07 Kentaro Hara <haraken@chromium.org> + + Rename [HasOverridingNameGetter] attribute to [CustomNamedGetter] attribute + https://bugs.webkit.org/show_bug.cgi?id=78076 + + Reviewed by Adam Barth. + + This patch renames the [HasOverridingNameGetter] attribute to the + [CustomNamedGetter] attribute, for naming consistency with [CustomNamedSetter]. + + Test: bindings/scripts/test/TestCustomNamedGetter.idl + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateGetOwnPropertyDescriptorBody): + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeaderNamedAndIndexedPropertyAccessors): + (GenerateImplementationNamedPropertyGetter): + + * html/HTMLDocument.idl: + * html/HTMLFormElement.idl: + * html/HTMLFrameSetElement.idl: + + * bindings/scripts/test/TestCustomNamedGetter.idl: Renamed from Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl. + + * bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.cpp: Updated run-bindings-tests results. + (WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetterPrivate::WebDOMTestCustomNamedGetterPrivate): + (WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetterPrivate): + (WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetter): + (WebDOMTestCustomNamedGetter::operator=): + (WebDOMTestCustomNamedGetter::impl): + (WebDOMTestCustomNamedGetter::~WebDOMTestCustomNamedGetter): + (WebDOMTestCustomNamedGetter::anotherFunction): + (toWebCore): + (toWebKit): + * bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.h: Ditto. + (WebCore): + (WebDOMTestCustomNamedGetter): + * bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.cpp: Ditto. + (WebKit): + (WebKit::kit): + (webkit_dom_test_custom_named_getter_another_function): + (WebKit::core): + (webkit_dom_test_custom_named_getter_finalize): + (webkit_dom_test_custom_named_getter_set_property): + (webkit_dom_test_custom_named_getter_get_property): + (webkit_dom_test_custom_named_getter_constructed): + (webkit_dom_test_custom_named_getter_class_init): + (webkit_dom_test_custom_named_getter_init): + (WebKit::wrapTestCustomNamedGetter): + * bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.h: Ditto. + (_WebKitDOMTestCustomNamedGetter): + (_WebKitDOMTestCustomNamedGetterClass): + * bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetterPrivate.h: Ditto. + (WebKit): + * bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h: Ditto. + * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: Ditto. + (WebCore): + (WebCore::JSTestCustomNamedGetterConstructor::JSTestCustomNamedGetterConstructor): + (WebCore::JSTestCustomNamedGetterConstructor::finishCreation): + (WebCore::JSTestCustomNamedGetterConstructor::getOwnPropertySlot): + (WebCore::JSTestCustomNamedGetterConstructor::getOwnPropertyDescriptor): + (WebCore::JSTestCustomNamedGetterPrototype::self): + (WebCore::JSTestCustomNamedGetterPrototype::getOwnPropertySlot): + (WebCore::JSTestCustomNamedGetterPrototype::getOwnPropertyDescriptor): + (WebCore::JSTestCustomNamedGetter::JSTestCustomNamedGetter): + (WebCore::JSTestCustomNamedGetter::finishCreation): + (WebCore::JSTestCustomNamedGetter::createPrototype): + (WebCore::JSTestCustomNamedGetter::destroy): + (WebCore::JSTestCustomNamedGetter::getOwnPropertySlot): + (WebCore::JSTestCustomNamedGetter::getOwnPropertyDescriptor): + (WebCore::jsTestCustomNamedGetterConstructor): + (WebCore::JSTestCustomNamedGetter::getConstructor): + (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): + (WebCore::isObservable): + (WebCore::JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots): + (WebCore::JSTestCustomNamedGetterOwner::finalize): + (WebCore::toJS): + (WebCore::toTestCustomNamedGetter): + * bindings/scripts/test/JS/JSTestCustomNamedGetter.h: Ditto. + (WebCore): + (JSTestCustomNamedGetter): + (WebCore::JSTestCustomNamedGetter::create): + (WebCore::JSTestCustomNamedGetter::createStructure): + (WebCore::JSTestCustomNamedGetter::impl): + (WebCore::JSTestCustomNamedGetter::releaseImpl): + (WebCore::JSTestCustomNamedGetter::releaseImplIfNotNull): + (JSTestCustomNamedGetterOwner): + (WebCore::wrapperOwner): + (WebCore::wrapperContext): + (JSTestCustomNamedGetterPrototype): + (WebCore::JSTestCustomNamedGetterPrototype::create): + (WebCore::JSTestCustomNamedGetterPrototype::createStructure): + (WebCore::JSTestCustomNamedGetterPrototype::JSTestCustomNamedGetterPrototype): + (JSTestCustomNamedGetterConstructor): + (WebCore::JSTestCustomNamedGetterConstructor::create): + (WebCore::JSTestCustomNamedGetterConstructor::createStructure): + * bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp: + * bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.h: Ditto. + * bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.mm: Ditto. + (-[DOMTestCustomNamedGetter dealloc]): + (-[DOMTestCustomNamedGetter finalize]): + (-[DOMTestCustomNamedGetter anotherFunction:]): + (core): + (kit): + * bindings/scripts/test/ObjC/DOMTestCustomNamedGetterInternal.h: Ditto. + (WebCore): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp: Ditto. + (WebCore): + (TestCustomNamedGetterInternal): + (WebCore::TestCustomNamedGetterInternal::V8_USE): + (WebCore::TestCustomNamedGetterInternal::anotherFunctionCallback): + (WebCore::ConfigureV8TestCustomNamedGetterTemplate): + (WebCore::V8TestCustomNamedGetter::GetRawTemplate): + (WebCore::V8TestCustomNamedGetter::GetTemplate): + (WebCore::V8TestCustomNamedGetter::HasInstance): + (WebCore::V8TestCustomNamedGetter::wrapSlow): + (WebCore::V8TestCustomNamedGetter::derefObject): + * bindings/scripts/test/V8/V8TestCustomNamedGetter.h: Ditto. + (WebCore): + (V8TestCustomNamedGetter): + (WebCore::V8TestCustomNamedGetter::toNative): + (WebCore::V8TestCustomNamedGetter::existingWrapper): + (WebCore::V8TestCustomNamedGetter::wrap): + (WebCore::toV8): + +2012-02-07 Emil A Eklund <eae@chromium.org> + + Revert TableSection cell and border calculations to integers + https://bugs.webkit.org/show_bug.cgi?id=77918 + + Reviewed by Eric Seidel. + + Change RenderTableSection cell width, row height and border calculations + back to use integers. Table layout is done on integer bounds to comply + with the specification and to ensure that columns given the same width, + including percentage widths, are rendered with identical widths. The same + applies to heights. + + No new tests. + + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::setCellLogicalWidths): + (WebCore::RenderTableSection::calcRowLogicalHeight): + (WebCore::RenderTableSection::layoutRows): + (WebCore::RenderTableSection::calcOuterBorderBefore): + (WebCore::RenderTableSection::calcOuterBorderAfter): + (WebCore::RenderTableSection::calcOuterBorderStart): + (WebCore::RenderTableSection::calcOuterBorderEnd): + (WebCore::RenderTableSection::paintObject): + (WebCore::RenderTableSection::nodeAtPoint): + * rendering/RenderTableSection.h: + (RenderTableSection): + (WebCore::RenderTableSection::RowStruct::RowStruct): + (WebCore::RenderTableSection::outerBorderBefore): + (WebCore::RenderTableSection::outerBorderAfter): + (WebCore::RenderTableSection::outerBorderStart): + (WebCore::RenderTableSection::outerBorderEnd): + +2012-02-07 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Remove the no longer necessary Chromium gesture recognizer. + https://bugs.webkit.org/show_bug.cgi?id=77492 + + Reviewed by Adam Barth. + + * WebCore.gypi: + * platform/PlatformGestureRecognizer.h: Removed. + * platform/chromium/FramelessScrollView.h: + (WebCore): + (FramelessScrollView): + * platform/chromium/GestureRecognizerChromium.cpp: Removed. + * platform/chromium/GestureRecognizerChromium.h: Removed. + * platform/chromium/PopupContainer.cpp: + (WebCore): + * platform/chromium/PopupContainer.h: + * platform/chromium/PopupListBox.cpp: + (WebCore): + * platform/chromium/PopupListBox.h: + (PopupListBox): + +2012-02-07 Erik Arvidsson <arv@chromium.org> + + [V8] Allow bindings for attributes on DOM nodes to also set a named hidden reference + https://bugs.webkit.org/show_bug.cgi?id=78052 + + Reviewed by Nate Chapin. + + Before this patch the code generator did not add the named hidden reference when the data node + was a DOM Node. This lead to us having to create custom toV8 bindings in a few places. + + Covered by existing tests + + * Target.pri: + * UseV8.cmake: + * WebCore.gypi: + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (HasCustomToV8Implementation): + * bindings/v8/custom/V8DOMStringMapCustom.cpp: + * bindings/v8/custom/V8DOMTokenListCustom.cpp: Removed. + * bindings/v8/custom/V8NamedNodeMapCustom.cpp: + +2012-02-07 Kentaro Hara <haraken@chromium.org> + + [GTK] Ignore [Custom] attributes in CodeGeneratorGObject.pm + https://bugs.webkit.org/show_bug.cgi?id=78059 + + Reviewed by Adam Barth. + + CodeGeneratorGObject.pm does not support custom attributes. + We can skip generating code for attributes with [Custom]. + The change would make sense, since CodeGeneratorGObject.pm already + skips attributes with [CustomGetter] or [CustomSetter]. + + Test: bindings/scripts/test/TestObj.idl + + * bindings/scripts/CodeGeneratorGObject.pm: + (SkipAttribute): + * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: + +2012-02-07 Emil A Eklund <eae@chromium.org> + + Add pixelSnappedX/Y/Width/Height methods + https://bugs.webkit.org/show_bug.cgi?id=78040 + + Reviewed by Eric Seidel. + + Add pixel snapped versions of x/y/width/height methods. These return the + same value as the x/w/width/height methods for now but once we move over + to sub pixel layout they will snap the subpixel value to a device pixel + and return an integer value. + + When snapping the left and top edge is simply rounded to the nearest + device pixel. + The right and bottom edges are computed by subtracting the rounded left/ + top edge from the precise location and size. This ensures that the edges + all line up with device pixels and that the total size of an object, + including borders, is at most one pixel off. + + In summary, the values are computed as follows: + x: round(x) + y: round(y) + maxX: round(x + width) + maxY: round(y + height) + width: round(x + width) - round(x) + height: round(y + height) - round(y) + + We use the term pixel snapped to indicate that the numbers are not merely + rounded. This also matches the naming used by the line box tree. + + No new tests, no functionality changes. + + * page/PrintContext.cpp: + (WebCore::PrintContext::pageNumberForElement): + * rendering/RenderBlock.cpp: + (WebCore::::collectIfNeeded): + * rendering/RenderBlock.h: + (RenderBlock): + (WebCore::RenderBlock::pixelSnappedLogicalRightOffsetForLine): + (WebCore::RenderBlock::pixelSnappedLogicalLeftOffsetForLine): + (WebCore::RenderBlock::FloatingObject::pixelSnappedX): + (WebCore::RenderBlock::FloatingObject::pixelSnappedMaxX): + (WebCore::RenderBlock::FloatingObject::pixelSnappedY): + (WebCore::RenderBlock::FloatingObject::pixelSnappedMaxY): + (WebCore::RenderBlock::FloatingObject::pixelSnappedWidth): + (WebCore::RenderBlock::FloatingObject::pixelSnappedHeight): + (FloatingObject): + (WebCore::RenderBlock::pixelSnappedLogicalTopForFloat): + (WebCore::RenderBlock::pixelSnappedLogicalBottomForFloat): + (WebCore::RenderBlock::pixelSnappedLogicalLeftForFloat): + (WebCore::RenderBlock::pixelSnappedLogicalRightForFloat): + * rendering/RenderBlockLineLayout.cpp: + (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): + * rendering/RenderBox.cpp: + (WebCore::RenderBox::pixelSnappedClientWidth): + (WebCore): + (WebCore::RenderBox::pixelSnappedClientHeight): + (WebCore::RenderBox::scrollHeight): + * rendering/RenderBox.h: + (WebCore::RenderBox::pixelSnappedWidth): + (WebCore::RenderBox::pixelSnappedHeight): + (RenderBox): + (WebCore::RenderBox::pixelSnappedOffsetWidth): + (WebCore::RenderBox::pixelSnappedOffsetHeight): + (WebCore::RenderBox::clientLogicalWidth): + (WebCore::RenderBox::clientLogicalHeight): + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::pixelSnappedOffsetWidth): + (WebCore): + (WebCore::RenderBoxModelObject::pixelSnappedOffsetHeight): + * rendering/RenderBoxModelObject.h: + (WebCore::RenderBoxModelObject::pixelSnappedOffsetLeft): + (WebCore::RenderBoxModelObject::pixelSnappedOffsetTop): + (RenderBoxModelObject): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::pixelSnappedScrollWidth): + (WebCore): + (WebCore::RenderLayer::pixelSnappedScrollHeight): + (WebCore::RenderLayer::computeScrollDimensions): + (WebCore::RenderLayer::updateScrollInfoAfterLayout): + * rendering/RenderLayer.h: + (RenderLayer): + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::scrollHeight): + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::volumeSliderOffsetFromMuteButton): + * rendering/RenderTreeAsText.cpp: + (WebCore::write): + +2012-02-07 Mike Lawther <mikelawther@chromium.org> + + CSS3 calc() - simple parse time evaluation + https://bugs.webkit.org/show_bug.cgi?id=77960 + + Adds simple number/percent expression evaluation. rgb() and hsl() functions now + allow simple calc() expressions. + + Reviewed by Ojan Vafai. + + * css/CSSCalculationValue.cpp: + (WebCore): + (WebCore::CSSCalcValue::doubleValue): + (WebCore::CSSCalcPrimitiveValue::doubleValue): + (WebCore::CSSCalcBinaryOperation::doubleValue): + (CSSCalcBinaryOperation): + (WebCore::CSSCalcBinaryOperation::evaluate): + * css/CSSCalculationValue.h: + (CSSCalcExpressionNode): + (WebCore::CSSCalcValue::isInt): + (CSSCalcValue): + * css/CSSParser.cpp: + (WebCore::CSSParser::parsedDouble): + +2012-02-07 Andreas Kling <awesomekling@apple.com> + + REGRESSION(r106668-r106889): Chromium page cycler tests (Intl2) performance regressions. + <http://webkit.org/b/78068> + + Reviewed by Ryosuke Niwa. + + Create CSS_IDENT values for attribute styles in the document's CSSValuePool. + This regressed in r106756 and I suspect it'll fix up the cycler regression. + + * dom/StyledElement.cpp: + (WebCore::StyledElement::addCSSProperty): + +2012-02-07 Noel Gordon <noel.gordon@gmail.com> + + Remove TextureMapperQt from the gyp projects + https://bugs.webkit.org/show_bug.cgi?id=78055 + + Reviewed by Noam Rosenthal. + + TextureMapperQt.{cpp,h} were removed in r106659, remove references to + these files from the gyp projects. + + * WebCore.gypi: + +2012-02-07 Tony Chang <tony@chromium.org> + + merge DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in + https://bugs.webkit.org/show_bug.cgi?id=78036 + + Reviewed by Darin Adler. + + In r89362, we started running the preprocessor through CSSPropertyNames.in. + Now we can move DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in + and wrap it in an #if. + + No new tests, build refactoring. + + * Configurations/FeatureDefines.xcconfig: Add ENABLE_DASHBOARD_SUPPORT to FEATURE_DEFINES. + * DerivedSources.make: Remove DashboardSupportCSSPropertyNames.in. + * DerivedSources.pri: Remove DashboardSupportCSSPropertyNames.in. + * WebCore.xcodeproj/project.pbxproj: Remove DashboardSupportCSSPropertyNames.in. + * css/CSSPropertyNames.in: Wrap -webkit-dashboard-region in an #if. + * css/DashboardSupportCSSPropertyNames.in: Removed. + +2012-02-07 Xingnan Wang <xingnan.wang@intel.com> + + Enable IPP for FFTFrame + https://bugs.webkit.org/show_bug.cgi?id=75522 + + Reviewed by Tony Chang. + + Add the FFTFrame implementation using Intel IPP's DFT algorithm. + + * WebCore.gyp/WebCore.gyp: + * WebCore.gypi: + * platform/audio/FFTFrame.h: + (FFTFrame): + * platform/audio/FFTFrameStub.cpp: + * platform/audio/ipp/FFTFrameIPP.cpp: Added. + (WebCore): + (WebCore::FFTFrame::FFTFrame): + (WebCore::FFTFrame::initialize): + (WebCore::FFTFrame::cleanup): + (WebCore::FFTFrame::~FFTFrame): + (WebCore::FFTFrame::multiply): + (WebCore::FFTFrame::doFFT): + (WebCore::FFTFrame::doInverseFFT): + (WebCore::FFTFrame::realData): + (WebCore::FFTFrame::imagData): + (WebCore::FFTFrame::getUpToDateComplexData): + +2012-02-07 Adrienne Walker <enne@google.com> + + Properly detect top level frames when propogating compositing + https://bugs.webkit.org/show_bug.cgi?id=78033 + + Reviewed by James Robinson. + + There's no need to enumerate all tag names when searching for a + top-level frame. If a render view's document has a frame, then that + frame is not the top-level one. + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame): + * rendering/RenderLayerCompositor.h: + (RenderLayerCompositor): + +2012-02-07 Chris Palmer <palmer@google.com> + + Resolve crash in FrameLoader::checkTimerFired. + https://bugs.webkit.org/show_bug.cgi?id=77907 + + Reviewed by Eric Seidel. + + Test is LayoutTests/http/tests/appcache/deferred-events-delete-while-raising-timer.html. + + * loader/FrameLoader.cpp: + (WebCore::FrameLoader::checkTimerFired): + +2012-02-07 Yong Li <yoli@rim.com> + + [BlackBerry] NetworkJob should stop redirecting when the request is cleared by client + https://bugs.webkit.org/show_bug.cgi?id=78029 + + Reviewed by Rob Buis. + + When a redirect is rejected by security origin check, the ResourceRequest + will be cleared (see DocumentThreadableLoader::redirectReceived()). In this + case, we should stop handling the request. + + No new tests because existing tests (like http:/tests/xmlhttprequest/redirect-cross + -origin-tripmine.html) can cover this. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::startNewJobWithRequest): + +2012-02-07 David Barton <dbarton@mathscribe.com> + + Remove extraneous MathML code before bug 52444 fix + https://bugs.webkit.org/show_bug.cgi?id=78034 + + Reviewed by Eric Seidel. + + Per Darin Adler, I am breaking up the patch fixing bug 52444 into smaller pieces. + This patch removes a couple unused functions, some extra blank lines, unused #include + directives, etc., and adds a very few WebKit-standard changes to these files. + + No new tests. + + * rendering/mathml/RenderMathMLBlock.cpp: + (WebCore): + * rendering/mathml/RenderMathMLBlock.h: + (WebCore::RenderMathMLBlock::getBoxModelObjectHeight): + - changed to a static member function since 'this' is unused; + removed redundant non-const version + (WebCore::RenderMathMLBlock::getBoxModelObjectWidth): + - changed to a static member function since 'this' is unused; + removed redundant non-const version + (WebCore): + * rendering/mathml/RenderMathMLFraction.cpp: + * rendering/mathml/RenderMathMLMath.cpp: + * rendering/mathml/RenderMathMLMath.h: + * rendering/mathml/RenderMathMLOperator.h: + (WebCore): + * rendering/mathml/RenderMathMLRoot.cpp: + * rendering/mathml/RenderMathMLRow.cpp: + * rendering/mathml/RenderMathMLRow.h: + * rendering/mathml/RenderMathMLSquareRoot.cpp: + * rendering/mathml/RenderMathMLSquareRoot.h: + * rendering/mathml/RenderMathMLSubSup.cpp: + * rendering/mathml/RenderMathMLSubSup.h: + * rendering/mathml/RenderMathMLUnderOver.cpp: + * rendering/mathml/RenderMathMLUnderOver.h: + +2012-02-07 David Reveman <reveman@chromium.org> + + [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting. + https://bugs.webkit.org/show_bug.cgi?id=78020 + + Reviewed by James Robinson. + + Revert r101854. + + This patch is tested by the following unit test: + - TextureManagerTest.requestTextureExceedingPreferredLimit + + * platform/graphics/chromium/ManagedTexture.cpp: + (WebCore::ManagedTexture::reserve): + * platform/graphics/chromium/TextureManager.cpp: + (WebCore::TextureManager::requestTexture): + * platform/graphics/chromium/TextureManager.h: + (TextureManager): + +2012-02-07 Anders Carlsson <andersca@apple.com> + + Use the non-fast-scrollable region to detect when we can't do fast scrolling + https://bugs.webkit.org/show_bug.cgi?id=78056 + <rdar://problem/10247932> + + Reviewed by Sam Weinig. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::frameViewLayoutUpdated): + Actually set the non-fast scrollable region on the scrolling tree state. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::tryToHandleWheelEvent): + Check if the wheel event's position is inside the non-fast-scrollable region + and return false if it is. + + (WebCore::ScrollingTree::updateMainFrameScrollPosition): + Store the cached main frame scroll position so we can use it in tryToHandleWheelEvent. + + * platform/graphics/Region.cpp: + * platform/graphics/Region.h: + Add a simple contains(const IntPoint&) member function. + +2012-02-07 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10475450> Synthetic bold is illegible under some scaling transforms + https://bugs.webkit.org/show_bug.cgi?id=78044 + + Reviewed by Beth Dakin. + + Tests: fast/text/synthetic-bold-transformed-expected.html + fast/text/synthetic-bold-transformed.html + + * platform/graphics/mac/FontMac.mm: + (WebCore::Font::drawGlyphs): Changed to interpret syntheticBoldOffset as a length in device pixels. + +2012-02-07 Levi Weintraub <leviw@chromium.org> + + Update LayoutUnit usage in ColumnInfo and RenderFrameSet + https://bugs.webkit.org/show_bug.cgi?id=77914 + + Reviewed by Eric Seidel. + + Updating ColumnInfo and RenderFrameSet to use LayoutUnits + instead of directly referencing integers for locations and + distances. + + No new tests. No changed behavior. + + * rendering/ColumnInfo.h: + (WebCore::ColumnInfo::forcedBreakOffset): + (WebCore::ColumnInfo::maximumDistanceBetweenForcedBreaks): + (ColumnInfo): + * rendering/RenderFrameSet.cpp: + (WebCore::RenderFrameSet::paintColumnBorder): + (WebCore::RenderFrameSet::paintRowBorder): + * rendering/RenderFrameSet.h: + (RenderFrameSet): + +2012-02-07 Adam Klein <adamk@chromium.org> + + Add JSC support for delivering mutations when the outermost script context exits + https://bugs.webkit.org/show_bug.cgi?id=70289 + + Reviewed by Eric Seidel. + + The meat of this change is in JSMainThreadExecState, where a counter + is incremented every time WebCore calls into JSC and decremented every + time it returns. When the counter reaches zero, any pending mutations + are delivered (this mirrors very similar code in V8Proxy and V8RecursionScope). + + The rest of the changes are of two sorts: compilation/logic fixes for + JSC code when ENABLE(MUTATION_OBSERVERS) is true, and additional + usages of JSMainThreadExecState so as to trigger the above + increment/decrements at the appropriate times. + + * bindings/js/JSCustomXPathNSResolver.cpp: + (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI): + Use JSMainThreadExecState instead of JSC::call. + * bindings/js/JSDictionary.cpp: + (WebCore::JSDictionary::convertValue): Add support + for tryGetProperty with a HashMap<AtomicString>. + * bindings/js/JSDictionary.h: + * bindings/js/JSErrorHandler.cpp: + (WebCore::JSErrorHandler::handleEvent): + Use JSMainThreadExecState instead of JSC::call. + * bindings/js/JSHTMLDocumentCustom.cpp: + (WebCore::JSHTMLDocument::open): + Use JSMainThreadExecState instead of JSC::call. + * bindings/js/JSMainThreadExecState.cpp: + (WebCore::JSMainThreadExecState::didLeaveScriptContext): + * bindings/js/JSMainThreadExecState.h: + (WebCore::JSMainThreadExecState::JSMainThreadExecState): + Increment a static recursion level counter. + (WebCore::JSMainThreadExecState::~JSMainThreadExecState): + Decrement a static recursion level counter and, if we are + at zero (the outermost script invocation), deliver any + outstanding mutation records. + * bindings/js/JSNodeFilterCondition.cpp: + (WebCore::JSNodeFilterCondition::acceptNode): + Use JSMainThreadExecState instead of JSC::call. + * bindings/js/JSWebKitMutationObserverCustom.cpp: + (WebCore::JSWebKitMutationObserver::observe): + Fix JSDictionary logic, add support for attributeFilter. + +2012-02-07 Anders Carlsson <andersca@apple.com> + + Fix build. + + * platform/ScrollableArea.h: + (WebCore::ScrollableArea::scrollableAreaBoundingBox): + +2012-02-07 Levi Weintraub <leviw@chromium.org> + + [SVG] Use element disappears after scripted change + https://bugs.webkit.org/show_bug.cgi?id=74392 + + Reviewed by Eric Seidel. + + Solution uncovered by Nikolas Zimmermann. Removing an early return that caused + SVGUseElements to not update the shadow root's style, and therefor not render + correctly. + + Test: svg/custom/use-disappears-after-style-update.svg + + * svg/SVGUseElement.cpp: + (WebCore::SVGUseElement::didRecalcStyle): + +2012-02-07 Kentaro Hara <haraken@chromium.org> + + Rename [v8OnProto] IDL attribute to [V8OnProto] IDL attribute + https://bugs.webkit.org/show_bug.cgi?id=77973 + + Reviewed by Adam Barth. + + This patch renames [v8OnProto] to [V8OnProto], since V8 specific IDL + attributes should be prefixed by "V8". + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + +2011-10-10 Jer Noble <jer.noble@apple.com> + + media/audio-data-url.html test broken on Lion + https://bugs.webkit.org/show_bug.cgi?id=69779 + + Reviewed by Eric Carlson. + + Do not use "OpenForPlayback" attribute on data:// urls, as CoreMedia/QuickTime X cannot + handle those URLs. + + * platform/graphics/mac/MediaPlayerPrivateQTKit.mm: + (WebCore::MediaPlayerPrivateQTKit::createQTMovie): + +2012-02-07 Anders Carlsson <andersca@apple.com> + + Scrolling tree should keep track of region we can't do fast scrolling for + https://bugs.webkit.org/show_bug.cgi?id=78050 + + Reviewed by Dan Bernstein. + + We currently won't do fast scrolling for subframes and other types of scrollable areas. + Because of this, we'll have the scrolling tree keep a region of the page for which we can't + do fast scrolling. This region will be updated after layout. + + * page/FrameView.cpp: + (WebCore::FrameView::scrollableAreaBoundingBox): + Return the bounding box. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::frameViewLayoutUpdated): + Go through all the scrollable areas in this frame view and compute the region which we can't do + fast scrolling for. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::commitNewTreeState): + Update the non-fast-scrollable region. + + * page/scrolling/ScrollingTreeState.cpp: + (WebCore::ScrollingTreeState::setNonFastScrollableRegion): + Set the non-fast-scrollable region if it's changed. + + * platform/ScrollableArea.h: + Add scrollableAreaBoundingBox member function. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollableAreaBoundingBox): + Return the bounding box. + + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::scrollableAreaBoundingBox): + Return the bounding box. + +2012-02-07 Levi Weintraub <leviw@chromium.org> + + unicode-bidi:plaintext is supposed to be effective on display:inline elements too + https://bugs.webkit.org/show_bug.cgi?id=73310 + + Reviewed by Eric Seidel. + + Adding support for unicode-bidi: plaintext as a property on inlines. These are treated + like unicode-bidi: isolate with the addition of their directionality being determined + by the UBA. + + Tests: fast/text/international/inline-plaintext-is-isolated-expected.html + fast/text/international/inline-plaintext-is-isolated.html + fast/text/international/inline-plaintext-relayout-with-leading-neutrals-expected.html + fast/text/international/inline-plaintext-relayout-with-leading-neutrals.html + fast/text/international/inline-plaintext-with-generated-content-expected.html + fast/text/international/inline-plaintext-with-generated-content.html + + * platform/text/UnicodeBidi.h: + (WebCore::isIsolated): Added this convenience function as Plaintext and Isolate Unicode-Bidi values + are both treated as isolated content. + * rendering/InlineIterator.h: + (WebCore::notifyObserverEnteredObject): Inline now supports Unicode-Bidi Plaintext. + (WebCore::notifyObserverWillExitObject): Ditto. + (WebCore::bidiFirstSkippingEmptyInlines): Changed to support being called without a resolver. + (WebCore::isIsolatedInline): Inline now supports Unicode-Bidi: Plaintext. + * rendering/RenderBlockLineLayout.cpp: + (WebCore::determineDirectionality): Generalized for inlines. + (WebCore::constructBidiRuns): Added support for Unicode-Bidi: Plaintext as an isolated inline. + (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Fixed comment. + (WebCore::RenderBlock::determineStartPosition): Fixed comment and switched to updated + bidiFirstSkippingEmptyInlines. + +2012-02-07 Kentaro Hara <haraken@chromium.org> + + [Refactoring] Use the [IsWorkerContext] IDL in CodeGeneratorV8.pm + https://bugs.webkit.org/show_bug.cgi?id=77957 + + Reviewed by Adam Barth. + + This patch replaces IsSubType("WorkerContext") and something equivalent that + with the [IsWorkerContext] IDL. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorV8.pm: + (GetInternalFields): + (GenerateConstructorGetter): + (GenerateImplementation): + +2012-02-07 David Reveman <reveman@chromium.org> + + [Chromium] Crash when using per-tile painting on Windows. + https://bugs.webkit.org/show_bug.cgi?id=75715 + + Reviewed by James Robinson. + + PlatformCanvas constructor on win32 expects forth argument to be a + shared section handle. Passing a pointer to a system memory causes + it to crash. Fix this by not using the PlatformCanvas API for + SkCanvas construction in per-tile texture uploader. + + Tested with manual tests. + + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp: + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect): + (WebCore::BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect): + * platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h: + (Texture): + +2012-02-07 Jer Noble <jer.noble@apple.com> + + Unreviewed build fix; make OSStatus the explicit return type for CMTimebase functions. + + * platform/mac/PlatformClockCM.mm: + +2012-02-07 James Robinson <jamesr@chromium.org> + + [chromium] Allow retaining texture across frames in composited video playback and correctly handle lost context + https://bugs.webkit.org/show_bug.cgi?id=77923 + + Reviewed by Kenneth Russell. + + Thanks to r106840, we can improve the video playback mode a bit. Instead of creating a new texture on every + frame, this attempts to reuse the texture from the previous frame unless the context is lost. Also improves + error checking in case the TextureManager cannot successfully reserve memory for the texture. + + Tested manually by killing the GPU process with an html5 video playing and verifying that the video playback + continues and that we don't create a new set of textures for each plane on each frame. + + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::draw): + (WebCore::CCVideoLayerImpl::reserveTextures): + +2012-02-07 Matthew Delaney <mdelaney@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77912 + Removing old CG shadow code. + + A CG-specific shadow offset hack was added in http://trac.webkit.org/changeset/34317 + for this particular setShadow method. However, this shadow offset adjustment for CG + has since moved down into platform specific code. Thus, this offset adjustment here + is now redundant. + + The CG-only shadow setting code block in this setShadow method is now redundant. + Since it sets the shadow values to the CGContext directly - and not to the State object - + it will be overwritten later by any subsequent calls to setting shadow values such as + blur, offset, or shadow color. + + Reviewed by Simon Fraser. + + No new tests. Current canvas tests cover this path. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setShadow): + +2012-02-07 James Robinson <jamesr@chromium.org> + + [chromium] Gracefully handle compositor initialization failure in single-threaded proxy + https://bugs.webkit.org/show_bug.cgi?id=78013 + + Reviewed by Kenneth Russell. + + If compositor initialization fails it's not safe to proceed through the rest of the frame process. This adds + some early outs. + + Tested manually by forcing the first makeContextCurrent() call fail. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeHost): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::compositeAndReadback): + (WebCore::CCSingleThreadProxy::compositeImmediately): + (WebCore::CCSingleThreadProxy::commitIfNeeded): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + (CCSingleThreadProxy): + +2012-02-07 Brady Eidson <beidson@apple.com> + + <rdar://problem/9567286> and https://bugs.webkit.org/show_bug.cgi?id=78003 + WebKit associates credentials with the wrong site if the authentication challenge takes place after a redirect chain + + Reviewed by Alexey Proskuryakov. + + Test: http/tests/loading/authentication-after-redirect-stores-wrong-credentials/authentication-after-redirect-stores-wrong-credentials.html + + Associate the credential with the URL of the challenge itself, not the original request: + * platform/network/cf/ResourceHandleCFNet.cpp: + (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): + (WebCore::ResourceHandle::receivedCredential): + * platform/network/mac/ResourceHandleMac.mm: + (WebCore::ResourceHandle::didReceiveAuthenticationChallenge): + (WebCore::ResourceHandle::receivedCredential): + +2012-02-07 Tony Chang <tony@chromium.org> + + move warning about css values and render style constants closer to where it applies + https://bugs.webkit.org/show_bug.cgi?id=78017 + + Reviewed by Darin Adler. + + Move the warning about keeping RenderStyleConstnats.h enums and + CSSValueKeywords.in values in the same order closer to the properties + that the warning applies to. The warning was easy to miss and was + confusing since it doesn't apply to most values. + + Also refactor 2 conversion functions to + enumerate the possible values so the order doesn't matter. + + No new tests, just refactoring and comment cleanup. + + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::operator EListStylePosition): Name all possible values and add a NOT_REACHED(). + (WebCore::CSSPrimitiveValue::operator EUserModify): Name all possible values and add a NOT_REACHED(). + * css/CSSValueKeywords.in: + * css/SVGCSSPropertyNames.in: + * css/SVGCSSValueKeywords.in: + * rendering/style/RenderStyleConstants.h: + +2012-02-06 Jer Noble <jer.noble@apple.com> + + Use CMClock as a timing source for PlatformClock where available. + https://bugs.webkit.org/show_bug.cgi?id=77885 + + Reviewed by Eric Carlson. + + No new tests; performance improvement covered by existing test cases. + + * WebCore.xcodeproj/project.pbxproj: + * platform/Clock.cpp: + (Clock::create): Use PlatformClockCM if available. + * platform/mac/PlatformClockCM.h: Added. + (WebCore::PlatformClockCM::playRate): + (WebCore::PlatformClockCM::isRunning): + * platform/mac/PlatformClockCM.mm: Added. + (PlatformClockCM::PlatformClockCM): + (PlatformClockCM::initializeWithTimingSource): + (PlatformClockCM::setCurrentTime): + (PlatformClockCM::currentTime): + (PlatformClockCM::setPlayRate): + (PlatformClockCM::start): + (PlatformClockCM::stop): + +2012-02-06 Anders Carlsson <andersca@apple.com> + + ScrollableAreaSet should be moved from Page to FrameView + https://bugs.webkit.org/show_bug.cgi?id=62762 + + Reviewed by Beth Dakin. + + It makes more sense for the set of scrollable areas to be per frame view instead of per page; + scrollable areas are associated with a containing frame view and their lifecycle follows the lifecycle of the + frame view much more closely. This could even fix a bunch of crashes where a scrollable area outlived its containing page. + + * WebCore.exp.in: + Replace the Page member functions with FrameView member functions instead. + + * page/EventHandler.cpp: + (WebCore::EventHandler::mouseMoved): + Check if the frame view contains the given layer. + + (WebCore::EventHandler::updateMouseEventTargetNode): + Ditto. + + * page/FocusController.cpp: + (WebCore::contentAreaDidShowOrHide): + Add helper function. + + (WebCore::FocusController::setContainingWindowIsVisible): + Call contentAreaDidShowOrHide for the main frame view, and for all scrollable areas + inside all subframe views. + + * page/FrameView.cpp: + (WebCore::FrameView::FrameView): + Use early returns to make the code more clear. Also, don't add the scrollable area to the set here. + + (WebCore::FrameView::~FrameView): + Don't remove the scrollable area here. + + (WebCore::FrameView::zoomAnimatorTransformChanged): + m_page is gone so use m_frame->page() instead. + + (WebCore::FrameView::setAnimatorsAreActive): + Call ScrollAnimator::setIsActive for all the scrollable areas in this frame view. Previously we used to do + this for all scrollable areas on the page, but since setAnimatorsAreActive will be called for each document, + this will be done implicitly. + + (WebCore::FrameView::notifyPageThatContentAreaWillPaint): + Call ScrollableArea::contentDidPaint for this frame view and all its immediate scrollable areas. Previously, we used + to do this for all scrollable areas on the page, but we only need to do it for this frame view. + + (WebCore::FrameView::scrollAnimatorEnabled): + Get the page from m_frame since m_page is gone. + + (WebCore::FrameView::addScrollableArea): + (WebCore::FrameView::removeScrollableArea): + (WebCore::FrameView::containsScrollableArea): + Move these member functions here from Page. + + (WebCore::FrameView::addChild): + If we are adding a frame view, add it to the scrollable area set. + + (WebCore::FrameView::removeChild): + If we are removing a frame view, remove it from the scrollable area set. + + * page/FrameView.h: + Move the member function declarations and the scrollable area set member variable here from Page. + + * page/Page.cpp: + (WebCore::Page::~Page): + Don't call disconnectPage on the scrollable areas anymore. + + * platform/ScrollView.h: + (ScrollView): + Make addChild and removeChild virtual. + + * platform/ScrollableArea.h: + Remove disconnectFromPage. + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::RenderLayer): + (WebCore::RenderLayer::~RenderLayer): + (WebCore::RenderLayer::styleChanged): + The frame view now keeps track of the scrollable areas. + + * rendering/RenderLayer.h: + Remove the page member variable and disconnectFromPage. + + * rendering/RenderListBox.cpp: + (WebCore::RenderListBox::RenderListBox): + (WebCore::RenderListBox::~RenderListBox): + The frame view now keeps track of the scrollable areas. + + * rendering/RenderListBox.h: + Remove the page member variable and disconnectFromPage. + +2012-02-07 Matthew Delaney <mdelaney@apple.com> + + Remove redundant checks in CanvasRenderingContext2D.cpp + https://bugs.webkit.org/show_bug.cgi?id=78000 + + Reviewed by Dan Bernstein. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setShadowColor): + (WebCore::CanvasRenderingContext2D::setShadow): + (WebCore::CanvasRenderingContext2D::drawImage): + +2012-02-07 Abhishek Arya <inferno@chromium.org> + + Crash in ContainerNode functions due to mutation events. + https://bugs.webkit.org/show_bug.cgi?id=77999 + + Reviewed by Ryosuke Niwa. + + Add RefPtr to protect premature deletion of this due to mutation events. + + Tests: fast/dom/remove-body-during-body-replacement.html + fast/dom/remove-body-during-body-replacement2.html + + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::insertBefore): + (WebCore::ContainerNode::replaceChild): + (WebCore::ContainerNode::removeChild): + (WebCore::ContainerNode::appendChild): + +2012-02-07 Dana Jansens <danakj@chromium.org> + + [Chromium] Memory bug during occlusion tracking if Vector::append() needs to reallocate the buffer + https://bugs.webkit.org/show_bug.cgi?id=77996 + + Reviewed by James Robinson. + + We're holding onto the last element in the Vector and then calling + append(). If append() reallocates the Vector's buffer, the pointer + is no longer valid. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::enterTargetRenderSurface): + +2012-02-07 Abhishek Arya <inferno@chromium.org> + + Crash due to column style not updated on post block + in splitInlines. + https://bugs.webkit.org/show_bug.cgi?id=77939 + + Reviewed by Julien Chaffraix. + + Test: fast/multicol/span/split-inline-wrong-post-block-crash.html + + * rendering/RenderInline.cpp: + (WebCore::RenderInline::splitFlow): + +2012-02-07 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: CodeGeneratorInspector.py: extend Array validator functionality + https://bugs.webkit.org/show_bug.cgi?id=77919 + + Patch by Peter Rybin <peter.rybin@gmail.com> on 2012-02-07 + Reviewed by Yury Semikhatsky. + + Array validator method runtimeCast is added, internal backing method + is moved from .cpp to .h (it's template anyway), boolean validator is + supported. + + * inspector/CodeGeneratorInspector.py: + (RawTypes.Bool.get_validate_method_params.ValidateMethodParams): + (RawTypes.Bool.get_validate_method_params): + (TypeBuilder): + +2012-02-07 Dean Jackson <dino@apple.com> + + Apple/Safari: Enable WebGL multisampling on ATI cards + for OS X 10.7.2 and above. + https://bugs.webkit.org/show_bug.cgi?id=77922 + + Address review comments by Alexey Proskuryakov and Mark Rowe. + + * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: + (WebCore::systemAllowsMultisamplingOnATICards): + +2012-02-07 Dean Jackson <dino@apple.com> + + Apple/Safari: Enable WebGL multisampling on ATI cards + for OS X 10.7.2 and above. + https://bugs.webkit.org/show_bug.cgi?id=77922 + + Reviewed by Chris Marrin. + + Follow Chrome's lead to allow WebGL antialiasing + on ATI cards as long as we're on 10.7.2 and above. + + No new tests. Covered by existing tests. + + * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: + (WebCore::systemAllowsMultisamplingOnATICards): + (WebCore): + (WebCore::GraphicsContext3D::validateAttributes): + +2012-02-07 Pavel Feldman <pfeldman@google.com> + + Web Inspector: add generic support for undo-ing DOM edits. + https://bugs.webkit.org/show_bug.cgi?id=77875 + + Reviewed by Yury Semikhatsky. + + This change introduces InspectorHistory::Action that encapsulates all DOM modifications + initiated by the inspector. There is a way to undo these actions up until the undoable + state marker. + + Tests: inspector/elements/undo-dom-edits-2.html + inspector/elements/undo-dom-edits.html + inspector/styles/undo-add-property.html + inspector/styles/undo-change-property.html + inspector/styles/undo-property-toggle.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/Inspector.json: + * inspector/InspectorAllInOne.cpp: + * inspector/InspectorCSSAgent.cpp: + (InspectorCSSAgent::StyleSheetAction): + (WebCore::InspectorCSSAgent::StyleSheetAction::StyleSheetAction): + (WebCore::InspectorCSSAgent::StyleSheetAction::perform): + (WebCore::InspectorCSSAgent::StyleSheetAction::undo): + (WebCore): + (InspectorCSSAgent::SetStyleSheetTextAction): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::SetStyleSheetTextAction): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::perform): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::undo): + (InspectorCSSAgent::SetPropertyTextAction): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::SetPropertyTextAction): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::toString): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::perform): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::undo): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::mergeId): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::merge): + (InspectorCSSAgent::TogglePropertyAction): + (WebCore::InspectorCSSAgent::TogglePropertyAction::TogglePropertyAction): + (WebCore::InspectorCSSAgent::TogglePropertyAction::perform): + (WebCore::InspectorCSSAgent::TogglePropertyAction::undo): + (WebCore::InspectorCSSAgent::getStyleSheetText): + (WebCore::InspectorCSSAgent::setStyleSheetText): + (WebCore::InspectorCSSAgent::setPropertyText): + (WebCore::InspectorCSSAgent::toggleProperty): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorDOMAgent.cpp: + (InspectorDOMAgent::DOMAction): + (WebCore::InspectorDOMAgent::DOMAction::DOMAction): + (WebCore::InspectorDOMAgent::DOMAction::perform): + (WebCore::InspectorDOMAgent::DOMAction::undo): + (WebCore): + (InspectorDOMAgent::RemoveChildAction): + (WebCore::InspectorDOMAgent::RemoveChildAction::RemoveChildAction): + (WebCore::InspectorDOMAgent::RemoveChildAction::perform): + (WebCore::InspectorDOMAgent::RemoveChildAction::undo): + (InspectorDOMAgent::InsertBeforeAction): + (WebCore::InspectorDOMAgent::InsertBeforeAction::InsertBeforeAction): + (WebCore::InspectorDOMAgent::InsertBeforeAction::perform): + (WebCore::InspectorDOMAgent::InsertBeforeAction::undo): + (InspectorDOMAgent::RemoveAttributeAction): + (WebCore::InspectorDOMAgent::RemoveAttributeAction::RemoveAttributeAction): + (WebCore::InspectorDOMAgent::RemoveAttributeAction::perform): + (WebCore::InspectorDOMAgent::RemoveAttributeAction::undo): + (InspectorDOMAgent::SetAttributeAction): + (WebCore::InspectorDOMAgent::SetAttributeAction::SetAttributeAction): + (WebCore::InspectorDOMAgent::SetAttributeAction::perform): + (WebCore::InspectorDOMAgent::SetAttributeAction::undo): + (InspectorDOMAgent::SetOuterHTMLAction): + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::SetOuterHTMLAction): + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::perform): + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::undo): + (WebCore::InspectorDOMAgent::SetOuterHTMLAction::newNode): + (InspectorDOMAgent::ReplaceWholeTextAction): + (WebCore::InspectorDOMAgent::ReplaceWholeTextAction::ReplaceWholeTextAction): + (WebCore::InspectorDOMAgent::ReplaceWholeTextAction::perform): + (WebCore::InspectorDOMAgent::ReplaceWholeTextAction::undo): + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::reset): + (WebCore::InspectorDOMAgent::setAttributeValue): + (WebCore::InspectorDOMAgent::setAttributesAsText): + (WebCore::InspectorDOMAgent::removeAttribute): + (WebCore::InspectorDOMAgent::removeNode): + (WebCore::InspectorDOMAgent::setNodeName): + (WebCore::InspectorDOMAgent::setOuterHTML): + (WebCore::InspectorDOMAgent::setNodeValue): + (WebCore::InspectorDOMAgent::moveTo): + (WebCore::InspectorDOMAgent::undo): + (WebCore::InspectorDOMAgent::markUndoableState): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + (WebCore::InspectorDOMAgent::history): + * inspector/InspectorHistory.cpp: Added. + (WebCore::InspectorHistory::Action::Action): + (WebCore): + (WebCore::InspectorHistory::Action::~Action): + (WebCore::InspectorHistory::Action::toString): + (WebCore::InspectorHistory::Action::isUndoableStateMark): + (WebCore::InspectorHistory::Action::mergeId): + (WebCore::InspectorHistory::Action::merge): + (WebCore::InspectorHistory::InspectorHistory): + (WebCore::InspectorHistory::~InspectorHistory): + (WebCore::InspectorHistory::perform): + (WebCore::InspectorHistory::markUndoableState): + (WebCore::InspectorHistory::undo): + (WebCore::InspectorHistory::reset): + * inspector/InspectorHistory.h: Added. + (WebCore): + (InspectorHistory): + (Action): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::setPropertyText): + (WebCore::InspectorStyle::styleText): + (WebCore::InspectorStyleSheet::addRule): + (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): + (WebCore::InspectorStyleSheet::buildObjectForStyle): + (WebCore::InspectorStyleSheet::setPropertyText): + (WebCore::InspectorStyleSheet::getText): + (WebCore::InspectorStyleSheetForInlineStyle::getText): + * inspector/InspectorStyleSheet.h: + (InspectorStyle): + (InspectorStyleSheet): + (InspectorStyleSheetForInlineStyle): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSProperty.prototype.setText): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._selectedNodeChanged): + (WebInspector.ElementsPanel.prototype._updateSidebars): + (WebInspector.ElementsPanel.prototype.handleShortcut): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertiesSection.prototype.addNewBlankProperty): + (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertyTreeElement): + (WebInspector.StylePropertyTreeElement.prototype): + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106935. + http://trac.webkit.org/changeset/106935 + https://bugs.webkit.org/show_bug.cgi?id=77994 + + "Crashes runMultiThread webkit_unit_test" (Requested by tonyg- + cr on #webkit). + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::setNeedsRedraw): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::setNeedsRedraw): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::setNeedsRedraw): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106932. + http://trac.webkit.org/changeset/106932 + https://bugs.webkit.org/show_bug.cgi?id=77988 + + Breaks Mac bots (Requested by pfeldman on #webkit). + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/Inspector.json: + * inspector/InspectorAllInOne.cpp: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getStyleSheetText): + (WebCore::InspectorCSSAgent::setStyleSheetText): + (WebCore::InspectorCSSAgent::setPropertyText): + (WebCore::InspectorCSSAgent::toggleProperty): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::reset): + (WebCore::InspectorDOMAgent::setAttributeValue): + (WebCore::InspectorDOMAgent::setAttributesAsText): + (WebCore::InspectorDOMAgent::removeAttribute): + (WebCore::InspectorDOMAgent::removeNode): + (WebCore::InspectorDOMAgent::setNodeName): + (WebCore::InspectorDOMAgent::setOuterHTML): + (WebCore::InspectorDOMAgent::setNodeValue): + (WebCore::InspectorDOMAgent::moveTo): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/InspectorHistory.cpp: Removed. + * inspector/InspectorHistory.h: Removed. + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::setPropertyText): + (WebCore::InspectorStyle::styleText): + (WebCore::InspectorStyleSheet::addRule): + (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): + (WebCore::InspectorStyleSheet::buildObjectForStyle): + (WebCore::InspectorStyleSheet::setPropertyText): + (WebCore::InspectorStyleSheet::text): + (WebCore::InspectorStyleSheetForInlineStyle::text): + * inspector/InspectorStyleSheet.h: + (InspectorStyle): + (InspectorStyleSheet): + (InspectorStyleSheetForInlineStyle): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSProperty.prototype.setText): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._selectedNodeChanged): + (WebInspector.ElementsPanel.prototype.handleShortcut): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertiesSection.prototype.addNewBlankProperty): + (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertyTreeElement): + (WebInspector.StylePropertyTreeElement.prototype): + +2012-02-07 Priit Laes <plaes@plaes.org> + + [GTK] Build failure with --enable-web-audio + https://bugs.webkit.org/show_bug.cgi?id=77978 + + Reviewed by Gustavo Noronha Silva. + + * GNUmakefile.list.am: Include AudioSourceProviderClient.h + +2012-02-07 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: fix objects duplication when switching filter in heap profiler. + https://bugs.webkit.org/show_bug.cgi?id=77974 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DetailedHeapshotView.js: + (WebInspector.HeapSnapshotConstructorsDataGrid.prototype.populateChildren): + +2012-02-07 Jonathan Backer <backer@chromium.org> + + [chromium] Add setNeedsRedraw to WebWidget + https://bugs.webkit.org/show_bug.cgi?id=77555 + + Reviewed by James Robinson. + + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::setNeedsRedraw): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::setNeedsRedraw): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::setNeedsRedraw): + (WebCore::CCThreadProxy::resetDamageTrackerOnImplThread): + (WebCore): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-02-07 Michael Brüning <michael.bruning@nokia.com> + + [Qt][WK2] Compute and set cache capacities using the current CacheModel + https://bugs.webkit.org/show_bug.cgi?id=73918 + + Reviewed by Kenneth Rohde Christiansen. + + No new tests. (build fix) + + * platform/qt/FileSystemQt.cpp: + (WebCore::getVolumeFreeSizeForPath): + +2012-02-07 Pavel Feldman <pfeldman@google.com> + + Web Inspector: add generic support for undo-ing DOM edits. + https://bugs.webkit.org/show_bug.cgi?id=77875 + + Reviewed by Yury Semikhatsky. + + This change introduces InspectorHistory::Action that encapsulates all DOM modifications + initiated by the inspector. There is a way to undo these actions up until the undoable + state marker. + + Tests: inspector/elements/undo-dom-edits-2.html + inspector/elements/undo-dom-edits.html + inspector/styles/undo-add-property.html + inspector/styles/undo-change-property.html + inspector/styles/undo-property-toggle.html + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * inspector/Inspector.json: + * inspector/InspectorAllInOne.cpp: + * inspector/InspectorCSSAgent.cpp: + (InspectorCSSAgent::StyleSheetAction): + (WebCore::InspectorCSSAgent::StyleSheetAction::StyleSheetAction): + (WebCore::InspectorCSSAgent::StyleSheetAction::perform): + (WebCore::InspectorCSSAgent::StyleSheetAction::undo): + (WebCore): + (InspectorCSSAgent::SetStyleSheetTextAction): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::SetStyleSheetTextAction): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::perform): + (WebCore::InspectorCSSAgent::SetStyleSheetTextAction::undo): + (InspectorCSSAgent::SetPropertyTextAction): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::SetPropertyTextAction): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::toString): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::perform): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::undo): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::mergeId): + (WebCore::InspectorCSSAgent::SetPropertyTextAction::merge): + (InspectorCSSAgent::TogglePropertyAction): + (WebCore::InspectorCSSAgent::TogglePropertyAction::TogglePropertyAction): + (WebCore::InspectorCSSAgent::TogglePropertyAction::perform): + (WebCore::InspectorCSSAgent::TogglePropertyAction::undo): + (WebCore::InspectorCSSAgent::getStyleSheetText): + (WebCore::InspectorCSSAgent::setStyleSheetText): + (WebCore::InspectorCSSAgent::setPropertyText): + (WebCore::InspectorCSSAgent::toggleProperty): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::InspectorDOMAgent): + (WebCore::InspectorDOMAgent::reset): + (WebCore::InspectorDOMAgent::setAttributeValue): + (WebCore::InspectorDOMAgent::setAttributesAsText): + (WebCore::InspectorDOMAgent::removeAttribute): + (WebCore::InspectorDOMAgent::removeNode): + (WebCore::InspectorDOMAgent::setNodeName): + (WebCore::InspectorDOMAgent::setOuterHTML): + (WebCore::InspectorDOMAgent::setNodeValue): + (WebCore::InspectorDOMAgent::moveTo): + (WebCore::InspectorDOMAgent::undo): + (WebCore): + (WebCore::InspectorDOMAgent::markUndoableState): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + (WebCore::InspectorDOMAgent::history): + * inspector/InspectorHistory.cpp: Added. + (WebCore::InspectorHistory::Action::Action): + (WebCore): + (WebCore::InspectorHistory::Action::~Action): + (WebCore::InspectorHistory::Action::toString): + (WebCore::InspectorHistory::Action::isUndoableStateMark): + (WebCore::InspectorHistory::Action::mergeId): + (WebCore::InspectorHistory::Action::merge): + (WebCore::InspectorHistory::InspectorHistory): + (WebCore::InspectorHistory::~InspectorHistory): + (WebCore::InspectorHistory::perform): + (WebCore::InspectorHistory::markUndoableState): + (WebCore::InspectorHistory::undo): + (WebCore::InspectorHistory::reset): + * inspector/InspectorHistory.h: Added. + (WebCore): + (InspectorHistory): + (Action): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::setPropertyText): + (WebCore::InspectorStyle::styleText): + (WebCore::InspectorStyleSheet::addRule): + (WebCore::InspectorStyleSheet::buildObjectForStyleSheet): + (WebCore::InspectorStyleSheet::buildObjectForStyle): + (WebCore::InspectorStyleSheet::setPropertyText): + (WebCore::InspectorStyleSheet::getText): + (WebCore::InspectorStyleSheetForInlineStyle::getText): + * inspector/InspectorStyleSheet.h: + (InspectorStyle): + (InspectorStyleSheet): + (InspectorStyleSheetForInlineStyle): + * inspector/front-end/CSSStyleModel.js: + (WebInspector.CSSProperty.prototype.setText): + * inspector/front-end/ElementsPanel.js: + (WebInspector.ElementsPanel.prototype._selectedNodeChanged): + (WebInspector.ElementsPanel.prototype._updateSidebars): + (WebInspector.ElementsPanel.prototype.handleShortcut): + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertiesSection.prototype.addNewBlankProperty): + (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate): + (WebInspector.StylePropertyTreeElement): + (WebInspector.StylePropertyTreeElement.prototype): + +2012-02-07 Chris Guan <chris.guan@torchmobile.com.cn> + + [Blackberry] Clean up Networkjob and Networkmanger: remove unused variables in release build and change some public functions into be private ones + https://bugs.webkit.org/show_bug.cgi?id=77926 + + Reviewed by Rob Buis. + + 1. rename clientIsOk to isClientAvailable. + 2. m_isRunning is only for an ASSERT in NetWorkManager, So move out from + release build but keep available in debug build. + + No changes in behavior, so no new tests. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::NetworkJob): + (WebCore::NetworkJob::handleNotifyDataReceived): + (WebCore::NetworkJob::handleNotifyDataSent): + (WebCore::NetworkJob::handleNotifyClose): + (WebCore::NetworkJob::startNewJobWithRequest): + (WebCore::NetworkJob::sendResponseIfNeeded): + (WebCore::NetworkJob::sendMultipartResponseIfNeeded): + * platform/network/blackberry/NetworkJob.h: + (NetworkJob): + (WebCore::NetworkJob::isClientAvailable): + +2012-02-06 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: don't mark object is queriable if it is only reachable by internal reference + https://bugs.webkit.org/show_bug.cgi?id=77877 + + Reviewed by Pavel Feldman. + + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshot.prototype._markQueriableHeapObjects): + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106909. + http://trac.webkit.org/changeset/106909 + https://bugs.webkit.org/show_bug.cgi?id=77965 + + ~20 tests are crashing on chromium win release bot. (Requested + by loislo on #webkit). + + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::createShadowSubtree): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::createShadowSubtree): + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::createShadowSubtree): + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::createShadowSubtree): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::createShadowSubtree): + +2012-02-07 Andreas Kling <awesomekling@apple.com> + + REGRESSION(r106819): ~28% or so performance regression on the ManInBlue HTML benchmark + <http://webkit.org/b/77952> + + Reviewed by Andreas Kling. + Patch by Ryosuke Niwa. + + The performance regression was caused by using ensureAttributeData() which forces the + regeneration of invalidated attributes ("style" and SVG animatable attributes.) + Added an ensureAttributeDataWithoutUpdate() helper that only ensures the presence + of ElementAttributeData, not the validity of its contents. Use that when grabbing + at an element's inline and attribute styles. + + * dom/Element.h: + (Element): + (WebCore::Element::ensureAttributeDataWithoutUpdate): + * dom/StyledElement.h: + (WebCore::StyledElement::ensureInlineStyleDecl): + (WebCore::StyledElement::ensureAttributeStyle): + +2012-02-07 Michael Brüning <michael.bruning@nokia.com> + + [Qt][WK2] Compute and set cache capacities using the current CacheModel + https://bugs.webkit.org/show_bug.cgi?id=73918 + + Reviewed by Csaba Osztrogonác. + + No new tests. (build fix). + + * platform/qt/FileSystemQt.cpp: + +2012-02-07 Michael Brüning <michael.bruning@nokia.com> + + [Qt][WK2] Compute and set cache capacities using the current CacheModel + https://bugs.webkit.org/show_bug.cgi?id=73918 + + Reviewed by Kenneth Rohde Christiansen. + + No new tests. (Not applicable) + + Added OS-specific implementation for retrieving the free disk space. + + * platform/FileSystem.h: + (WebCore): + * platform/qt/FileSystemQt.cpp: + (WebCore::getVolumeFreeSizeForPath): + (WebCore): + +2012-02-07 Kenneth Rohde Christiansen <kenneth@webkit.org> + + [Inspector] Add the Nokia N9 user agent + https://bugs.webkit.org/show_bug.cgi?id=77949 + + Reviewed by Simon Hausmann. + + * inspector/front-end/SettingsScreen.js: + (WebInspector.SettingsScreen.prototype._createUserAgentSelectRowElement.get const): + +2012-02-07 Alexander Pavlov <apavlov@chromium.org> + + [CRASH] bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent& event) references a NULL pointer + https://bugs.webkit.org/show_bug.cgi?id=77953 + + Reviewed by Andreas Kling. + + * page/EventHandler.cpp: + (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled): + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106912. + http://trac.webkit.org/changeset/106912 + https://bugs.webkit.org/show_bug.cgi?id=77947 + + "AppleWebKit build is broken" (Requested by haraken on + #webkit). + + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore): + * dom/ScriptExecutionContext.h: + (WebCore): + (ScriptExecutionContext): + * html/DOMURL.cpp: + (WebCore::DOMURL::DOMURL): + (WebCore): + (WebCore::DOMURL::~DOMURL): + (WebCore::DOMURL::contextDestroyed): + (WebCore::DOMURL::createObjectURL): + (WebCore::DOMURL::revokeObjectURL): + * html/DOMURL.h: + (WebCore::DOMURL::create): + (DOMURL): + * html/DOMURL.idl: + * html/PublicURLManager.h: Removed. + * page/DOMWindow.cpp: + (WebCore): + (WebCore::DOMWindow::webkitURL): + * page/DOMWindow.h: + (DOMWindow): + * page/DOMWindow.idl: + * workers/WorkerContext.cpp: + (WebCore): + (WebCore::WorkerContext::webkitURL): + * workers/WorkerContext.h: + (WorkerContext): + * workers/WorkerContext.idl: + +2012-02-07 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r106862. + http://trac.webkit.org/changeset/106862 + https://bugs.webkit.org/show_bug.cgi?id=77510 + + Mac build fails if we manually remove generated code + + * DerivedSources.make: + * bindings/scripts/generate-bindings.pl: + (generateEmptyHeaderAndCpp): + * bindings/scripts/resolve-supplemental.pl: + * bindings/scripts/update-idl-needs-rebuild.pl: Removed. + +2012-02-07 Kaustubh Atrawalkar <kaustubh@motorola.com> + + Migrate createObjectURL & revokeObjectURL to static (Class) methods. + https://bugs.webkit.org/show_bug.cgi?id=74386 + + Reviewed by David Levin. + + Test: fast/dom/DOMURL/check-instanceof-domurl-functions.html + Already Existing: + fast/files/revoke-blob-url.html + fast/dom/window-domurl-crash.html + fast/files/apply-blob-url-to-img.html + fast/files/create-blob-url-crash.html + fast/files/workers/inline-worker-via-blob-url.html + + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::fileThread): + (WebCore): + (WebCore::ScriptExecutionContext::publicURLManager): + * dom/ScriptExecutionContext.h: + (WebCore): + (ScriptExecutionContext): + * html/DOMURL.cpp: + (WebCore): + (WebCore::DOMURL::createObjectURL): Changed to static. + (WebCore::DOMURL::revokeObjectURL): ditto. + * html/DOMURL.h: + (DOMURL): + (WebCore::DOMURL::create): + * html/DOMURL.idl: + * html/PublicURLManager.h: Added. + (WebCore): + (PublicURLManager): + (WebCore::PublicURLManager::create): + (WebCore::PublicURLManager::contextDestroyed): + (WebCore::PublicURLManager::blobURLs): + (WebCore::PublicURLManager::streamURLs): + * page/DOMWindow.cpp: Removed object initialization for DOMURL. + (WebCore): + * page/DOMWindow.h: ditto. + (DOMWindow): + * page/DOMWindow.idl: + * workers/WorkerContext.cpp: + (WebCore): + * workers/WorkerContext.h: + (WorkerContext): + * workers/WorkerContext.idl: + +2012-02-03 Vsevolod Vlasov <vsevik@chromium.org> + + http/tests/inspector/indexeddb/database-structure.html failing on chromium win/linux + https://bugs.webkit.org/show_bug.cgi?id=77661 + + Reviewed by Yury Semikhatsky. + + * inspector/InspectorIndexedDBAgent.cpp: + (WebCore): + +2012-02-07 Hayato Ito <hayato@chromium.org> + + Fix build on Mac with '--shadow-dom'. + https://bugs.webkit.org/show_bug.cgi?id=77940 + + Reviewed by Hajime Morita. + + * WebCore.xcodeproj/project.pbxproj: + +2012-02-06 Shinya Kawanaka <shinyak@google.com> + + Stop calling Element::ensureShadowRoot() if it is used in construction phase. + https://bugs.webkit.org/show_bug.cgi?id=77929 + + Reviewed by Hajime Morita. + + ShadowRoot's life cycle can be consufing If Element::ensureShadowRoot() is used. + So we want to remove Element::ensureShadowRoot(). + This patch replaces Element::ensureShadowRoot() if it is used in object construction phase. + + No new tests, no change in behavior. + + * html/HTMLDetailsElement.cpp: + (WebCore::HTMLDetailsElement::createShadowSubtree): + * html/HTMLKeygenElement.cpp: + (WebCore::HTMLKeygenElement::HTMLKeygenElement): + * html/HTMLMeterElement.cpp: + (WebCore::HTMLMeterElement::createShadowSubtree): + * html/HTMLProgressElement.cpp: + (WebCore::HTMLProgressElement::createShadowSubtree): + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::createShadowSubtree): + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::createShadowSubtree): + +2012-02-06 Shinya Kawanaka <shinyak@google.com> + + Remove Element::ensureShadowRoot export. + https://bugs.webkit.org/show_bug.cgi?id=77932 + + Reviewed by Hajime Morita. + + Removes Element::ensureShadowRoot export. + + No new tests, no change in behavior. + + * WebCore.exp.in: + +2012-02-06 Ilya Tikhonovsky <loislo@chromium.org> + + Unreviewed. Web Inspector: rename Artificial to Synthetic according to v8 patch r10614. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshotNode.prototype.get isSynthetic): + (WebInspector.HeapSnapshot.prototype._init): + +2012-02-06 Hayato Ito <hayato@chromium.org> + + Implement querySelector on ShadowRoot. + https://bugs.webkit.org/show_bug.cgi?id=77714 + + Reviewed by Dimitri Glazkov. + + * dom/SelectorQuery.cpp: + (WebCore::nodeIsRootNodeOfTreeScope): + (WebCore): + (WebCore::SelectorDataList::execute): + +2012-02-06 Martin Robinson <mrobinson@igalia.com> and Nayan Kumar K <nayankk@motorola.com> + + [GTK] Add TextureMapperGL implementation + https://bugs.webkit.org/show_bug.cgi?id=75308 + + Reviewed by Alejandro G. Castro. + + No new tests. This will be covered by accelerated compositing and + 3D CSS transform tests eventually. + + * GNUmakefile.list.am: Added some files necessary to build TextureMapperGL. + * platform/graphics/cairo/TextureMapperGLCairo.cpp: Added implementations. + * platform/graphics/cairo/TextureMapperGLCairo.h: Updated member list. + * platform/graphics/gtk/WindowGLContext.h: Added. + * platform/graphics/gtk/WindowGLContextGLX.cpp: Added. + * platform/graphics/opengl/TextureMapperGL.cpp: Use the GL shims on GTK. + +2012-02-06 Emil A Eklund <eae@chromium.org> + + Change baselinePosition and lineHeight to LayoutUnit + https://bugs.webkit.org/show_bug.cgi?id=77905 + + Reviewed by Eric Seidel. + + Change the virtual baselinePosition and lineHeight methods to return + LayoutUnits as they are both computed from the height and top/bottom + margins (or width and left/right margins for vertical text), all of + which are LayoutUnits. + + No new tests. + + * platform/efl/RenderThemeEfl.cpp: + (WebCore::RenderThemeEfl::baselinePosition): + * platform/efl/RenderThemeEfl.h: + (RenderThemeEfl): + * platform/gtk/RenderThemeGtk.cpp: + (WebCore::RenderThemeGtk::baselinePosition): + * platform/gtk/RenderThemeGtk.h: + (RenderThemeGtk): + * platform/qt/RenderThemeQt.cpp: + (WebCore::RenderThemeQt::baselinePosition): + * platform/qt/RenderThemeQt.h: + (RenderThemeQt): + * rendering/RenderListMarker.cpp: + (WebCore::RenderListMarker::lineHeight): + (WebCore::RenderListMarker::baselinePosition): + * rendering/RenderListMarker.h: + (RenderListMarker): + * rendering/RenderSlider.cpp: + (WebCore::RenderSlider::baselinePosition): + * rendering/RenderSlider.h: + (RenderSlider): + * rendering/RootInlineBox.h: + (WebCore::RootInlineBox::baselinePosition): + (WebCore::RootInlineBox::lineHeight): + * rendering/mathml/RenderMathMLFraction.cpp: + (WebCore::RenderMathMLFraction::baselinePosition): + * rendering/mathml/RenderMathMLFraction.h: + (RenderMathMLFraction): + * rendering/mathml/RenderMathMLOperator.cpp: + (WebCore::RenderMathMLOperator::baselinePosition): + * rendering/mathml/RenderMathMLOperator.h: + (RenderMathMLOperator): + * rendering/mathml/RenderMathMLRow.cpp: + (WebCore::RenderMathMLRow::baselinePosition): + * rendering/mathml/RenderMathMLRow.h: + (RenderMathMLRow): + * rendering/mathml/RenderMathMLSubSup.cpp: + (WebCore::RenderMathMLSubSup::baselinePosition): + * rendering/mathml/RenderMathMLSubSup.h: + (RenderMathMLSubSup): + * rendering/mathml/RenderMathMLUnderOver.cpp: + (WebCore::RenderMathMLUnderOver::baselinePosition): + * rendering/mathml/RenderMathMLUnderOver.h: + (RenderMathMLUnderOver): + +2012-02-06 Xianzhu Wang <wangxianzhu@chromium.org> + + Avoid Page::updateViewportArguments() if the causing frame is not the main frame + https://bugs.webkit.org/show_bug.cgi?id=77387 + + Reviewed by Kenneth Rohde Christiansen. + + * dom/Document.cpp: + (WebCore::Document::processViewport): + (WebCore::Document::updateViewportArguments): + (WebCore::Document::setInPageCache): + * dom/Document.h: + (Document): + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::insertedIntoDocument): + * page/Frame.cpp: + (WebCore::Frame::setDocument): + * page/Page.cpp: + (WebCore::Page::viewportArguments): + (WebCore): + * page/Page.h: + (Page): + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + Fix some miscellaneous 'make dist' error for WebKitGTK+. + + * GNUmakefile.list.am: Add some missing Shadow DOM files to the + source list. + +2012-02-06 Dana Jansens <danakj@chromium.org> + + Add contains() test to Region + https://bugs.webkit.org/show_bug.cgi?id=72294 + + Reviewed by Anders Carlsson. + + * platform/graphics/Region.cpp: + (WebCore::Region::contains): + (WebCore): + * platform/graphics/Region.h: + (Region): + (Shape): + (WebCore::operator==): + (WebCore): + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + Rename [DontCheckEnums], [ReturnsNew], [DoNotCheckDomainSecurityOnGet], + [DoNotCheckDomainSecurityOnSet] and [ImplementationFunction] IDLs + https://bugs.webkit.org/show_bug.cgi?id=77852 + + Reviewed by Adam Barth. + + This patch renames [DontCheckEnums], [ReturnsNew], [DoNotCheckDomainSecurityOnGet], + [DoNotCheckDomainSecurityOnSet] and [ImplementationFunction] IDLs for clarification. + + [DontCheckEnums] => [DoNotCheckConstants] (This IDL inserts assertions to check if a + constant value is equal to the expected constant value) + [ReturnsNew] => [ReturnNewObject] (For clarification) + [DoNotCheckDomainSecurityOnGet] => [DoNotCheckDomainSecurityOnGetter] (For naming consistency + with other [*Getter] IDLs) + [DoNotCheckDomainSecurityOnSet] => [DoNotCheckDomainSecurityOnSetter] (For naming consistency + with other [*Setter] IDLs) + [ImplementationFunction=] => [ImplementedAs=] (For clarification. This IDL specifies a method + name in implementation) + + No tests. No change in behavior. + + * bindings/scripts/CodeGenerator.pm: + (ShouldCheckEnums): + (GenerateCompileTimeCheckForEnumsIfNeeded): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateSingleBatchedAttribute): + (GenerateFunctionCallString): + (NativeToJSValue): + + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestTypedArray.idl: + + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestInterface.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore): + + * css/WebKitCSSFilterValue.idl: + * css/WebKitCSSTransformValue.idl: + * dom/DOMCoreException.idl: + * dom/Document.idl: + * dom/EventException.idl: + * dom/RangeException.idl: + * fileapi/FileException.idl: + * fileapi/OperationNotAllowedException.idl: + * html/HTMLFormElement.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESStandardDerivatives.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/canvas/WebGLCompressedTextures.idl: + * html/canvas/WebGLDebugRendererInfo.idl: + * html/canvas/WebGLRenderingContext.idl: + * inspector/JavaScriptCallFrame.idl: + * loader/appcache/DOMApplicationCache.idl: + * page/Console.idl: + * page/DOMWindow.idl: + * page/Location.idl: + * storage/IDBCursor.idl: + * storage/IDBDatabaseException.idl: + * storage/IDBObjectStore.idl: + * storage/SQLException.idl: + * svg/SVGComponentTransferFunctionElement.idl: + * svg/SVGException.idl: + * svg/SVGFEBlendElement.idl: + * svg/SVGFEColorMatrixElement.idl: + * svg/SVGFECompositeElement.idl: + * svg/SVGFEConvolveMatrixElement.idl: + * svg/SVGFEDisplacementMapElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFETurbulenceElement.idl: + * svg/SVGGradientElement.idl: + * xml/XMLHttpRequestException.idl: + * xml/XPathException.idl: + +2012-02-06 James Robinson <jamesr@chromium.org> + + [chromium] canvas demo is slow due to unnecessary resource cleanups + https://bugs.webkit.org/show_bug.cgi?id=77135 + + Reviewed by Kenneth Russell. + + This defers dropping a ManagedTexture until it is evicted by the manager, the layer is destroyed, the + TextureManager is destroyed, or the layer is added to a CCLayerTreeHost that has a different texture manager. In + particular, removing a layer from a CCLayerTreeHost and then adding it back to the same host does not drop any + ManagedTextures unless the manager has to evict it for other reasons. This provides a big speedup on sites that + rebuild the compositing tree frequently. + + New unit test added for ManagedTexture / TextureManager interaction. + + * platform/graphics/chromium/Canvas2DLayerChromium.cpp: + (WebCore::Canvas2DLayerChromium::setLayerTreeHost): + (WebCore::Canvas2DLayerChromium::setTextureManager): + * platform/graphics/chromium/Canvas2DLayerChromium.h: + (Canvas2DLayerChromium): + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::setLayerTreeHost): + * platform/graphics/chromium/LayerChromium.h: + (LayerChromium): + * platform/graphics/chromium/ManagedTexture.cpp: + (WebCore::ManagedTexture::setTextureManager): + (WebCore): + (WebCore::ManagedTexture::steal): + (WebCore::ManagedTexture::clear): + * platform/graphics/chromium/ManagedTexture.h: + (ManagedTexture): + * platform/graphics/chromium/RenderSurfaceChromium.h: + (RenderSurfaceChromium): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::setLayerTreeHost): + (WebCore): + (WebCore::TiledLayerChromium::prepareToUpdateTiles): + * platform/graphics/chromium/TiledLayerChromium.h: + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + Unreviewed, rolling out r106883. + http://trac.webkit.org/changeset/106883 + https://bugs.webkit.org/show_bug.cgi?id=77852 + + build failure around Chromium V8 bindings + + * bindings/scripts/CodeGenerator.pm: + (ShouldCheckEnums): + (GenerateCompileTimeCheckForEnumsIfNeeded): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateSingleBatchedAttribute): + (GenerateFunctionCallString): + (NativeToJSValue): + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore): + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestTypedArray.idl: + * bindings/scripts/test/V8/V8TestInterface.cpp: + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore): + * css/WebKitCSSFilterValue.idl: + * css/WebKitCSSTransformValue.idl: + * dom/DOMCoreException.idl: + * dom/Document.idl: + * dom/EventException.idl: + * dom/RangeException.idl: + * fileapi/FileException.idl: + * fileapi/OperationNotAllowedException.idl: + * html/HTMLFormElement.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESStandardDerivatives.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/canvas/WebGLCompressedTextures.idl: + * html/canvas/WebGLDebugRendererInfo.idl: + * html/canvas/WebGLRenderingContext.idl: + * inspector/JavaScriptCallFrame.idl: + * loader/appcache/DOMApplicationCache.idl: + * page/Console.idl: + * page/DOMWindow.idl: + * page/Location.idl: + * storage/IDBCursor.idl: + * storage/IDBDatabaseException.idl: + * storage/IDBObjectStore.idl: + * storage/SQLException.idl: + * svg/SVGComponentTransferFunctionElement.idl: + * svg/SVGException.idl: + * svg/SVGFEBlendElement.idl: + * svg/SVGFEColorMatrixElement.idl: + * svg/SVGFECompositeElement.idl: + * svg/SVGFEConvolveMatrixElement.idl: + * svg/SVGFEDisplacementMapElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFETurbulenceElement.idl: + * svg/SVGGradientElement.idl: + * xml/XMLHttpRequestException.idl: + * xml/XPathException.idl: + +2012-02-06 Yongsheng Zhu <yongsheng.zhu@intel.com> + + WebGL must allocate smaller drawing buffer when the allocation fails. + https://bugs.webkit.org/show_bug.cgi?id=76654 + + Reviewed by Kenneth Russell. + + Test: fast/canvas/webgl/drawingbuffer-test.html + + * platform/graphics/gpu/DrawingBuffer.cpp: + (WebCore): + (WebCore::DrawingBuffer::create): + (WebCore::DrawingBuffer::reset): + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + Unreviewed. Rebaselined run-bindings-tests results. + + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::optionsObjectCallback): + +2012-02-06 Levi Weintraub <leviw@chromium.org> + + Correct usage of LayoutUnits in dom, editing, page, accessibility, inspector, and loader + https://bugs.webkit.org/show_bug.cgi?id=77891 + + Reviewed by Darin Adler. + + Updating the usage of LayoutUnits in the dom, editing, page, accessibility, inspector, and loader + directories to properly use LayoutUnits vs ints. + + No new tests. No new behavior. + + * accessibility/AccessibilityObject.h: + (WebCore::AccessibilityObject::boundsForVisiblePositionRange): + (WebCore::AccessibilityObject::doAXBoundsForRange): + * accessibility/AccessibilityRenderObject.cpp: + (WebCore::AccessibilityRenderObject::isOffScreen): + (WebCore::AccessibilityRenderObject::clickPoint): + (WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange): + (WebCore::AccessibilityRenderObject::doAXBoundsForRange): + (WebCore::AccessibilityRenderObject::accessibilityImageMapHitTest): + * accessibility/AccessibilityRenderObject.h: + (AccessibilityRenderObject): + * accessibility/AccessibilitySlider.cpp: + (WebCore::AccessibilitySlider::elementAccessibilityHitTest): + * accessibility/AccessibilitySlider.h: + (AccessibilitySlider): + * accessibility/mac/WebAccessibilityObjectWrapper.mm: + (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]): + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::computedTransform): + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * dom/Clipboard.h: + (WebCore::Clipboard::dragLocation): + (Clipboard): + * dom/DocumentMarkerController.cpp: + (WebCore::DocumentMarkerController::renderedRectsForMarkers): + * dom/DocumentMarkerController.h: + * dom/Element.cpp: + (WebCore::Element::screenRect): + * dom/Element.h: + (Element): + * editing/Editor.cpp: + (WebCore::Editor::rangeForPoint): + (WebCore::Editor::firstRectForRange): + * editing/RenderedPosition.cpp: + (WebCore::RenderedPosition::absoluteRect): + * editing/RenderedPosition.h: + (WebCore::RenderedPosition::absoluteRect): + (RenderedPosition): + * editing/VisiblePosition.h: + (VisiblePosition): + * inspector/DOMNodeHighlighter.cpp: + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::createJavaAppletWidget): + * loader/SubframeLoader.h: + (SubframeLoader): + * page/EventHandler.cpp: + (WebCore::EventHandler::handleMousePressEvent): + * page/Frame.cpp: + (WebCore::Frame::nodeImage): + * page/win/FrameCGWin.cpp: + (WebCore::Frame::nodeImage): + +2012-02-05 Kentaro Hara <haraken@chromium.org> + + Rename [DontCheckEnums], [ReturnsNew], [DoNotCheckDomainSecurityOnGet], + [DoNotCheckDomainSecurityOnSet] and [ImplementationFunction] IDLs + https://bugs.webkit.org/show_bug.cgi?id=77852 + + Reviewed by Adam Barth. + + This patch renames [DontCheckEnums], [ReturnsNew], [DoNotCheckDomainSecurityOnGet], + [DoNotCheckDomainSecurityOnSet] and [ImplementationFunction] IDLs for clarification. + + [DontCheckEnums] => [DoNotCheckConstants] (This IDL inserts assertions to check if a + constant value is equal to the expected constant value) + [ReturnsNew] => [ReturnNewObject] (For clarification) + [DoNotCheckDomainSecurityOnGet] => [DoNotCheckDomainSecurityOnGetter] (For naming consistency + with other [*Getter] IDLs) + [DoNotCheckDomainSecurityOnSet] => [DoNotCheckDomainSecurityOnSetter] (For naming consistency + with other [*Setter] IDLs) + [ImplementationFunction=] => [ImplementedAs=] (For clarification. This IDL specifies a method + name in implementation) + + No tests. No change in behavior. + + * bindings/scripts/CodeGenerator.pm: + (ShouldCheckEnums): + (GenerateCompileTimeCheckForEnumsIfNeeded): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + (NativeToJSValue): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateSingleBatchedAttribute): + (GenerateFunctionCallString): + (NativeToJSValue): + + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestTypedArray.idl: + + * bindings/scripts/test/JS/JSTestInterface.cpp: Updated run-bindings-tests results. + (WebCore): + * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. + (WebCore): + * bindings/scripts/test/V8/V8TestInterface.cpp: Ditto. + (WebCore): + * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. + (WebCore): + + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/TestTypedArray.idl: + * css/WebKitCSSFilterValue.idl: + * css/WebKitCSSTransformValue.idl: + * dom/DOMCoreException.idl: + * dom/Document.idl: + * dom/EventException.idl: + * dom/RangeException.idl: + * fileapi/FileException.idl: + * fileapi/OperationNotAllowedException.idl: + * html/HTMLFormElement.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESStandardDerivatives.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/canvas/WebGLCompressedTextures.idl: + * html/canvas/WebGLDebugRendererInfo.idl: + * html/canvas/WebGLRenderingContext.idl: + * inspector/JavaScriptCallFrame.idl: + * loader/appcache/DOMApplicationCache.idl: + * page/Console.idl: + * page/DOMWindow.idl: + * page/Location.idl: + * storage/IDBCursor.idl: + * storage/IDBDatabaseException.idl: + * storage/IDBObjectStore.idl: + * storage/SQLException.idl: + * svg/SVGComponentTransferFunctionElement.idl: + * svg/SVGException.idl: + * svg/SVGFEBlendElement.idl: + * svg/SVGFEColorMatrixElement.idl: + * svg/SVGFECompositeElement.idl: + * svg/SVGFEConvolveMatrixElement.idl: + * svg/SVGFEDisplacementMapElement.idl: + * svg/SVGFEMorphologyElement.idl: + * svg/SVGFETurbulenceElement.idl: + * svg/SVGGradientElement.idl: + * xml/XMLHttpRequestException.idl: + +2012-02-06 Stephen Chenney <schenney@chromium.org> + + RenderSVGShape::strokeContains will fail for some strokes + https://bugs.webkit.org/show_bug.cgi?id=76931 + + Reviewed by Darin Adler. + + Adding support for rounded zero-length endcaps for SVG path hit + testing. + + Tests: svg/hittest/zero-length-butt-cap-path.xhtml + svg/hittest/zero-length-round-cap-path.xhtml + svg/hittest/zero-length-square-cap-path.xhtml + + * rendering/svg/RenderSVGShape.cpp: + (WebCore::RenderSVGShape::strokeContains): + +2012-02-06 Gregg Tavares <gman@google.com> + + Add webGLErrorsToConsoleEnabled Settings flag + https://bugs.webkit.org/show_bug.cgi?id=77696 + + Reviewed by Kenneth Russell. + + No new tests as there is no change in behavior. + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::setupFlags): + * page/Settings.cpp: + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + (WebCore::Settings::webGLErrorsToConsoleEnabled): + +2012-02-06 Emil A Eklund <eae@chromium.org> + + Convert PopupMenuClient::clientPadding over to new layout abstraction + https://bugs.webkit.org/show_bug.cgi?id=77798 + + Reviewed by Eric Seidel. + + Change PopupMenuClient and all classes inheriting from it to use the new + layout types for padding. + + No new tests. + + * platform/PopupMenuClient.h: + (PopupMenuClient): + * rendering/RenderMenuList.h: + * rendering/RenderTextControlSingleLine.cpp: + (WebCore::RenderTextControlSingleLine::clientPaddingLeft): + (WebCore::RenderTextControlSingleLine::clientPaddingRight): + * rendering/RenderTextControlSingleLine.h: + +2012-02-06 Philip Rogers <pdr@google.com> + + Fix color animations by value + https://bugs.webkit.org/show_bug.cgi?id=77812 + + Reviewed by Darin Adler. + + Test: svg/animations/animate-color-fill-from-by.html + + * svg/SVGAnimatedColor.cpp: + (WebCore::SVGAnimatedColorAnimator::calculateFromAndByValues): + +2012-02-03 Jer Noble <jer.noble@apple.com> + + REGRESSION (r104303): Clicking inline video controls gives the video a focus ring + https://bugs.webkit.org/show_bug.cgi?id=77288 + + Reviewed by Darin Adler. + + Test: media/video-mouse-focus.html + + Do not allow media elements to be focused by mouse click by overriding isMouseFocusable + and returning false. + + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::isMouseFocusable): + * html/HTMLMediaElement.h: + +2012-02-06 Anders Carlsson <andersca@apple.com> + + Overlay scrollbars flash when window is simply activated + https://bugs.webkit.org/show_bug.cgi?id=77911 + <rdar://problem/10211995> + + Reviewed by Kenneth Russell. + + Add a new member function, FocusController::setContainingWindowIsVisible, and move the code + that calls ScrollableArea::contentAreaDidShow/ScrollableArea::contentAreaDidHide there, since + we only want to flash scrollers when the window becomes visible. + + * WebCore.exp.in: + * page/FocusController.cpp: + (WebCore::FocusController::FocusController): + (WebCore::FocusController::setActive): + (WebCore::FocusController::setContainingWindowIsVisible): + (WebCore): + * page/FocusController.h: + (FocusController): + (WebCore::FocusController::containingWindowIsVisible): + + * platform/mac/ScrollAnimatorMac.mm: + (-[WebScrollbarPainterControllerDelegate scrollerImpPair:setContentAreaNeedsDisplayInRect:]): + Call ScrollAnimatorMac::contentAreaWillPaint here, since that will trigger AppKit to flash the scrollers. + +2012-02-06 Greg Simon <gregsimon@chromium.org> + + postMessage leaks MemoryEvent object + https://bugs.webkit.org/show_bug.cgi?id=77893 + + Reviewed by Adam Barth. + + Changed from PassRefPtr().leakRef() to RefPtr.get() when + calling into FrameLoaderClient to stop +1 extra ref. + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::postMessageTimerFired): + +2012-02-06 Ehsan Akhgari <ehsan.akhgari@gmail.com> + + WebGL conformance test misc/functions-returning-strings.html fails + https://bugs.webkit.org/show_bug.cgi?id=77149 + + Make sure that WebGL methods returning strings don't return null when + they run successfully. + + Reviewed by Kenneth Russell. + + Test: fast/canvas/webgl/functions-returning-strings.html + + * html/canvas/WebGLRenderingContext.cpp: + (WebCore): + (WebCore::WebGLRenderingContext::getProgramInfoLog): + (WebCore::WebGLRenderingContext::getShaderInfoLog): + (WebCore::WebGLRenderingContext::getShaderSource): + (WebCore::WebGLRenderingContext::ensureNotNull): + * html/canvas/WebGLRenderingContext.h: + (WebGLRenderingContext): + +2012-02-06 Enrica Casucci <enrica@apple.com> + + Refactor Mac platform implementation of the Pasteboard class. + https://bugs.webkit.org/show_bug.cgi?id=77567 + + The goal of this change is to remove the majority of the methods in + the class interface that are Mac specific. + writeSelectionForTypes has been left to support OS X services. + Some of the methods have been turned into static functions. + The method asURL was being used only by the DragData class and its + implementation has been moved there. + This is a first step in the direction of removing NSPasteboard access from + the WebProcess for WebKit2 (https://bugs.webkit.org/show_bug.cgi?id=77259) + leaving the WebKit1 behavior unchanged. + + Reviewed by Alexey Proskuryakov. + + No new tests. No changes in behavior. + + * platform/Pasteboard.h: Removed most of the Mac specific methods. + * platform/mac/ClipboardMac.mm: + (WebCore::ClipboardMac::writeRange): + (WebCore::ClipboardMac::writeURL): + * platform/mac/DragDataMac.mm: + (WebCore::DragData::asURL): Moved code from PasteboardMac.mm. Removed FIXME + because we only want to handle the case of single file, otherwise the user + doesn't know which of the files has been chosen. + * platform/mac/PasteboardMac.mm: + (WebCore::writeURLForTypes): + (WebCore::Pasteboard::writeURL): + (WebCore::writeFileWrapperAsRTFDAttachment): Now a static function. + (WebCore::Pasteboard::writeImage): + (WebCore::documentFragmentWithImageResource): Ditto. + (WebCore::documentFragmentWithRTF): Ditto. + (WebCore::Pasteboard::documentFragment): + +2012-02-06 James Robinson <jamesr@chromium.org> + + [chromium] Drop tiles completely outside of layer bounds when resizing to a smaller size + https://bugs.webkit.org/show_bug.cgi?id=77910 + + Reviewed by Kenneth Russell. + + When resizing a tiled layer to a smaller size, drop all tiles that lie completely outside the new layer bounds. + This avoids attempting to access out-of-bounds tiles when iterating over all tiles in the tiler, which triggers + ASSERT()s, as well as saves some memory. + + New unit test added to TiledLayerChromiumTest. + + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::invalidateRect): + * platform/graphics/chromium/cc/CCLayerTilingData.cpp: + (WebCore::CCLayerTilingData::setBounds): + +2012-02-06 Chris Rogers <crogers@google.com> + + zvmul incorrectly multiplies complex arrays on Windows. + https://bugs.webkit.org/show_bug.cgi?id=77900 + + Reviewed by Kenneth Russell. + + * platform/audio/VectorMath.cpp: + (WebCore::VectorMath::zvmul): + +2012-02-06 Andreas Kling <awesomekling@apple.com> + + REGRESSION(r106756): 10% performance hit on DOM/Template. + <http://webkit.org/b/77831> + + Reviewed by Ryosuke Niwa. + + Let the StylePropertySet used for element attribute style have the element as its parent. + This is accomplished by adding an m_parentIsElement bit to StylePropertySet and sharing + some of the internal logic with inline styles. + + In the end, this means that CSSParser will now pick up the document's CSSValuePool when + parsing properties for attribute styles, which fixes the perf regression from r106756. + + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::contextStyleSheet): + + Find contextStyleSheet via the parentElement() when there is one. + + (WebCore::StylePropertySet::setNeedsStyleRecalc): + + Always set FullStyleChange for attribute style mutations. We can probably use the + same lighter invalidation as inline styles, but that's a topic for another patch. + + * css/StylePropertySet.h: + (WebCore::StylePropertySet::createInline): + (WebCore::StylePropertySet::createAttributeStyle): + (WebCore::StylePropertySet::parentRuleInternal): + (WebCore::StylePropertySet::clearParentRule): + (StylePropertySet): + (WebCore::StylePropertySet::parentElement): + (WebCore::StylePropertySet::clearParentElement): + + Added m_parentIsElement bit and update assertions as appropriate to not just + cover the inline style case. Added a createAttributeStyle() helper to create + a StylePropertySet for use as Element::attributeStyle(). + + * dom/StyledElement.h: + * dom/ElementAttributeData.h: + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::ensureAttributeStyle): + + Use StylePropertySet::createAttributeStyle(). + + * dom/StyledElement.cpp: + (WebCore::StyledElement::removeCSSProperties): + (WebCore::StyledElement::addCSSProperty): + (WebCore::StyledElement::addCSSImageProperty): + + Remove setNeedsStyleRecalc() calls since that is now handled automatically by + StylePropertySet's mutation methods. + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + In AppleWebKit, stop rebuilding IDLs that need not to be rebuilt + https://bugs.webkit.org/show_bug.cgi?id=77510 + + Reviewed by Adam Barth. + + Currently, if any IDL file is updated, all IDL files are rebuilt. + This patch stops rebuilding IDL files which are not modified nor + whose supplemental dependencies are not changed. + + The new build flow is as follows: + + supplemental.dep : $(ALL_IDLS) + perl resolve-supplemental.pl ... + + %.idl-needs-rebuild : %.idl supplemental.dep + perl update-idl-needs-rebuild.pl ... + + JS%.cpp : %.idl-needs-rebuild + perl generate-bindings.pl ... + + resolve-supplemental.pl generates the following supplemental.dep. + The number in () is the last access timestamp of the file. + + A.idl(1200) + B.idl(1000) B-supplemental1.idl(800) B-supplemental2.idl(1200) + C.idl(1000) + + update-idl-needs-rebuild.pl for X.idl touches X.idl-needs-rebuild, + if X.idl-needs-rebuild is older than X.idl or the IDL files which are + supplementing X.idl. For example, if the timestamps of A.idl-needs-rebuild, + B.idl-needs-rebuild and C.idl-needs-rebuild are all 1000, then A.idl-needs-rebuild + and B.idl-needs-rebuild will be touched. + + Even if no IDL files are modified, update-idl-needs-rebuild.pl can run for all IDL files, + but generate-bindings.pl won't run. If any IDL file is updated, resolve-supplemental.pl + will run once, update-idl-needs-rebuild.pl will run for all IDL files, and + generate-bindings.pl will run for the IDL files which are modified or whose + dependencies are changed. + + No tests. I manually confirmed the followings: + - Touch Element.idl, then only Element.idl is rebuilt + - Touch DOMWindow.idl, then only DOMWindow.idl is rebuilt + - Touch DOMWindowWebAudio.idl, then only DOMWindow.idl and DOMWindowWebAudio.idl are rebuilt + + * DerivedSources.make: Modified the build flow as described above. + * bindings/scripts/generate-bindings.pl: Modified to read an IDL file path from .idl-needs-rebuild. + * bindings/scripts/update-idl-needs-rebuild.pl: Added. Touches X.idl-needs-rebuild if + the X.idl-needs-rebuild is older than X.idl or the IDL files which are supplementing X.idl. + (touch): + +2012-02-06 Wei James <james.wei@intel.com> + + AudioBus need to support stereo->mono down mix in copyFrom sumFrom etc. + https://bugs.webkit.org/show_bug.cgi?id=77609 + + Reviewed by Kenneth Russell. + + Test: webaudio/stereo2mono-down-mixing.html + + * platform/audio/AudioBus.cpp: + (WebCore): + (WebCore::AudioBus::copyFrom): + (WebCore::AudioBus::sumFrom): + +2012-02-06 Cris Neckar <cdn@chromium.org> + + Add RefPtrs for parent and sibling counter nodes + https://bugs.webkit.org/show_bug.cgi?id=75212 + + Reviewed by Adam Barth. + + Test: fast/css/counters/reparent-table-children-with-counters-crash.html + + * rendering/RenderCounter.cpp: + (WebCore::findPlaceForCounter): + (WebCore::makeCounterNode): + (WebCore::updateCounters): + +2012-02-06 Kalev Lember <kalevlember@gmail.com> + + [GTK] Add missing pango include dir to fix build + https://bugs.webkit.org/show_bug.cgi?id=77832 + + Reviewed by Martin Robinson. + + * GNUmakefile.am: Added $(PANGO_CFLAGS) to libWebCore_la_CPPFLAGS. + +2012-02-06 Jochen Eisinger <jochen@chromium.org> + + Before accessing a frame's script controller in V8 bindings, first check that the frame actually exists + https://bugs.webkit.org/show_bug.cgi?id=77370 + + Reviewed by Adam Barth. + + I don't have a working reproduction of the crash yet. As soon as I have + one, I will add new layout tests. + + * bindings/v8/PageScriptDebugServer.cpp: + (WebCore::PageScriptDebugServer::addListener): + * bindings/v8/ScheduledAction.cpp: + (WebCore::ScheduledAction::execute): + * bindings/v8/ScriptCachedFrameData.cpp: + (WebCore::ScriptCachedFrameData::restore): + * page/DOMTimer.cpp: + (WebCore::DOMTimer::DOMTimer): remove temporary debug code + +2012-02-06 James Robinson <jamesr@chromium.org> + + Support detaching TextureManager from ManagedTexture + https://bugs.webkit.org/show_bug.cgi?id=77655 + + Reviewed by Kenneth Russell. + Initial patch by Alok Priyadarshi. + + TextureManager now holds references to the textures it manages. + This allows TextureManager to inform managed textures when it gets deleted + so that the texture that outlive the TextureManager can handle the situation gracefully. + + Unit test in TextureManagerTest.cpp + + * platform/graphics/chromium/ManagedTexture.cpp: + (WebCore::ManagedTexture::ManagedTexture): + (WebCore::ManagedTexture::~ManagedTexture): + (WebCore): + (WebCore::ManagedTexture::managerWillDie): + (WebCore::ManagedTexture::isValid): + (WebCore::ManagedTexture::reserve): + (WebCore::ManagedTexture::unreserve): + (WebCore::ManagedTexture::steal): + (WebCore::ManagedTexture::reset): + * platform/graphics/chromium/ManagedTexture.h: + (WebCore::ManagedTexture::manager): + (ManagedTexture): + (WebCore::ManagedTexture::isReserved): + * platform/graphics/chromium/TextureManager.cpp: + (WebCore::TextureManager::~TextureManager): + (WebCore): + (WebCore::TextureManager::setPreferredMemoryLimitBytes): + (WebCore::TextureManager::registerTexture): + (WebCore::TextureManager::unregisterTexture): + * platform/graphics/chromium/TextureManager.h: + (WebCore): + (TextureManager): + +2012-02-06 Anders Carlsson <andersca@apple.com> + + Wheel event handler count not updated when adding handlers to the window + https://bugs.webkit.org/show_bug.cgi?id=77895 + + Reviewed by Dan Bernstein. + + Test: fast/events/wheelevent-handler-count.html + + * page/DOMWindow.cpp: + (WebCore::DOMWindow::addEventListener): + (WebCore::DOMWindow::removeEventListener): + Update the wheel event count. + + * testing/Internals.cpp: + (WebCore::Internals::wheelEventHandlerCount): + * testing/Internals.h: + * testing/Internals.idl: + Add wheelEventHandlerCount to window.internals. + +2012-02-06 Matthew Delaney <mdelaney@apple.com> + + toDataURL() uses stale data after putImageData() + https://bugs.webkit.org/show_bug.cgi?id=65767 + + This patch fixes the issue we've encountered of getting back + stale copies of the CGContext of accelerated ImageBuffers who have seen + putImageData calls but have not been drawn into via the CG API. + This issue is fixed by modifying the way we implement putImageData + in ImageBufferCG to draw the bits wrapped in a CGImage while the CGContext + is in a state where the data will effectively be copied (as is needed for + implementing putImageData) instead of directly modifying the bits of the IOSurface. + + Reviewed by Chris Marrin. + + Test: fast/canvas/check-stale-putImageData, pixel test to check that the canvas is in fact painted. + + * platform/graphics/cg/ImageBufferCG.cpp: Implement new way of putting image data. + * platform/graphics/ImageBuffer.h: Merged two previously separate put data calls + into a single and more sensibly named 'putByteArray', since that's what it does! + + * WebCore.exp.in: Added new WKSI call for use in ImageBufferCG.cpp + * platform/mac/WebCoreSystemInterface.h: + * platform/mac/WebCoreSystemInterface.mm: + + Using new method name. + * html/canvas/CanvasRenderingContext2D.cpp: + * platform/graphics/ImageBuffer.cpp: + * platform/graphics/ShadowBlur.cpp: + * platform/graphics/filters/FEColorMatrix.cpp: + * platform/graphics/filters/FEDropShadow.cpp: + * platform/graphics/filters/FilterEffect.cpp: + + Updated other ports' ImageBuffers to use new method. + * platform/graphics/cairo/ImageBufferCairo.cpp: + * platform/graphics/qt/ImageBufferQt.cpp: + * platform/graphics/skia/ImageBufferSkia.cpp: + * platform/graphics/wince/ImageBufferWinCE.cpp: + * platform/graphics/wx/ImageBufferWx.cpp: + +2012-02-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Provide more attribute methods in Element + https://bugs.webkit.org/show_bug.cgi?id=77800 + + Reviewed by Ryosuke Niwa. + + Reduce the clients of NamedNodeMap. This will make easier to change the + implementation of our attribute storage. The clients now use Element methods + that expose Attribute* accessors. + + Instead of checking the existence of NamedNodeMap, clients can call + hasAttributes() or hasAttributesWithoutUpdate() (that skips updating invalid + style or animation svg attributes). + + If there are attributes, they can be accessed by index via attributeCount() / + attributeItem(), as well as by QualifiedName. Those accessors assume there are an + attribute storage. + + * css/SelectorChecker.cpp: + (WebCore::anyAttributeMatches): + (WebCore::SelectorChecker::checkOneSelector): + * css/SelectorChecker.h: + (WebCore::SelectorChecker::checkExactAttribute): + * dom/DatasetDOMStringMap.cpp: + (WebCore::DatasetDOMStringMap::getNames): + (WebCore::DatasetDOMStringMap::item): + (WebCore::DatasetDOMStringMap::contains): + * dom/Document.cpp: + (WebCore::Document::importNode): use setAttributesFromElement() instead of manually copying. + * dom/Element.h: + (Element): + (WebCore::Element::hasAttributesWithoutUpdate): + (WebCore): + (WebCore::Element::attributeCount): + (WebCore::Element::attributeItem): + (WebCore::Element::getAttributeItem): + (WebCore::Element::removeAttribute): + * dom/Node.cpp: + (WebCore::Node::isDefaultNamespace): + (WebCore::Node::lookupNamespaceURI): + (WebCore::Node::lookupNamespacePrefix): + (WebCore::Node::compareDocumentPosition): + * editing/ApplyStyleCommand.cpp: + (WebCore::hasNoAttributeOrOnlyStyleAttribute): + (WebCore::isEmptyFontTag): + * editing/EditingStyle.cpp: + (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent): + * editing/InsertParagraphSeparatorCommand.cpp: + (WebCore::highestVisuallyEquivalentDivBelowRoot): + * editing/MarkupAccumulator.cpp: + (WebCore::MarkupAccumulator::appendElement): + * editing/markup.cpp: + (WebCore::completeURLs): + (WebCore::StyledMarkupAccumulator::appendElement): + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::parametersForPlugin): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateType): + * html/HTMLObjectElement.cpp: + (WebCore::HTMLObjectElement::parametersForPlugin): + * html/HTMLParamElement.cpp: + (WebCore::HTMLParamElement::isURLAttribute): + * html/parser/HTMLFormattingElementList.cpp: + (WebCore::attributeCountWithoutUpdate): + (WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly): + (WebCore::HTMLFormattingElementList::ensureNoahsArkCondition): Store Attribute* + to avoid looking up the right element again by name. + * inspector/DOMEditor.cpp: + (WebCore::DOMEditor::innerPatchNode): + (WebCore::DOMEditor::createDigest): + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::setAttributesAsText): + (WebCore::InspectorDOMAgent::performSearch): + (WebCore::InspectorDOMAgent::buildArrayForElementAttributes): + * page/PageSerializer.cpp: + (WebCore::isCharsetSpecifyingNode): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::getPresentationAttribute): + * xml/XPathFunctions.cpp: + (WebCore::XPath::FunLang::evaluate): + * xml/XPathNodeSet.cpp: + (WebCore::XPath::NodeSet::traversalSort): + * xml/XPathStep.cpp: + (WebCore::XPath::Step::nodesInAxis): + * xml/parser/XMLDocumentParserLibxml2.cpp: + (WebCore::XMLDocumentParser::XMLDocumentParser): + * xml/parser/XMLTreeBuilder.cpp: + (WebCore::XMLTreeBuilder::XMLTreeBuilder): + +2012-02-06 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Raise exception during add/put call if autoIncrement key insertion will fail + https://bugs.webkit.org/show_bug.cgi?id=77374 + + If a put request will use a key generator, try inserting a dummy key during the sync + put() call to check if the key insertion will succeed so an exception can be raised + early, rather than deferring to the asynchronous task. + + Reviewed by Tony Chang. + + Test: storage/indexeddb/keypath-edges.html + + * storage/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::put): + +2012-02-06 Gustavo Noronha Silva <gns@gnome.org> + + Add a null check for the gdkwindow, that will happen if the window + is not mapped. + + Reviewed by Martin Robinson. + + * platform/gtk/GtkUtilities.cpp: + (WebCore::convertWidgetPointToScreenPoint): + +2012-02-06 Eugene Girard <girard@chromium.org> + + IndexedDB createObjectStore should throw if options arg is invalid + Added logic to OptionsObject to determine if an invalid object was created. + Javascript bindings now detect invalid OptionsObject's and throw TypeError when found. + https://bugs.webkit.org/show_bug.cgi?id=58471 + + Reviewed by Adam Barth. + + Test: storage/indexeddb/createObjectStore-bad-options.html + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateParametersCheck): + * bindings/v8/OptionsObject.cpp: + (WebCore::OptionsObject::isObject): + * bindings/v8/OptionsObject.h: + +2012-02-06 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106797 and r106806. + http://trac.webkit.org/changeset/106797 + http://trac.webkit.org/changeset/106806 + https://bugs.webkit.org/show_bug.cgi?id=77888 + + The change is still causing some crashes in webaudio/ on the + Chromium bots (Requested by jchaffraix on #webkit). + + * Modules/intents/IntentRequest.cpp: + (WebCore::IntentRequest::create): + * bindings/generic/ActiveDOMCallback.cpp: + (WebCore::ActiveDOMCallback::ActiveDOMCallback): + * dom/ActiveDOMObject.cpp: + (WebCore::ActiveDOMObject::ActiveDOMObject): + (WebCore::ActiveDOMObject::~ActiveDOMObject): + * dom/ActiveDOMObject.h: + (ActiveDOMObject): + * dom/DocumentEventQueue.cpp: + (WebCore::DocumentEventQueue::DocumentEventQueue): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::ScriptExecutionContext): + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): + (WebCore::ScriptExecutionContext::stopActiveDOMObjects): + * dom/ScriptExecutionContext.h: + (ScriptExecutionContext): + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::create): + * fileapi/FileReader.cpp: + (WebCore): + * fileapi/FileReader.h: + (WebCore::FileReader::create): + * fileapi/FileWriter.cpp: + (WebCore): + * fileapi/FileWriter.h: + (WebCore::FileWriter::create): + * history/CachedFrame.cpp: + (WebCore::CachedFrame::CachedFrame): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::create): + (WebCore::HTMLAudioElement::createForJSConstructor): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::create): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::create): + * mediastream/PeerConnection.cpp: + (WebCore::PeerConnection::create): + * notifications/Notification.cpp: + (WebCore::Notification::create): + * notifications/NotificationCenter.cpp: + * notifications/NotificationCenter.h: + (WebCore::NotificationCenter::create): + * page/DOMTimer.cpp: + (WebCore::DOMTimer::install): + (WebCore::DOMTimer::fired): + * page/EventSource.cpp: + (WebCore::EventSource::create): + * page/SuspendableTimer.cpp: + (WebCore::SuspendableTimer::SuspendableTimer): + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::create): + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::create): + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::create): + * storage/IDBVersionChangeRequest.cpp: + (WebCore::IDBVersionChangeRequest::create): + * webaudio/AudioContext.cpp: + (WebCore::AudioContext::create): + * websockets/WebSocket.cpp: + * websockets/WebSocket.h: + (WebCore::WebSocket::create): + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::create): + +2012-02-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Move style related functions from NamedNodeMap to ElementAttributeData + https://bugs.webkit.org/show_bug.cgi?id=77879 + + Reviewed by Ryosuke Niwa. + + This commit also removes the NamedNodeMap::mappedAttributeCount(), + which is a leftover from removal of mapped attributes. + + * dom/ElementAttributeData.cpp: + (WebCore::ElementAttributeData::ensureInlineStyleDecl): + (WebCore): + (WebCore::ElementAttributeData::destroyInlineStyleDecl): + (WebCore::ElementAttributeData::ensureAttributeStyle): + * dom/ElementAttributeData.h: + (WebCore::ElementAttributeData::inlineStyleDecl): + (ElementAttributeData): + (WebCore::ElementAttributeData::attributeStyle): + * dom/NamedNodeMap.cpp: + * dom/NamedNodeMap.h: + * dom/StyledElement.h: + (StyledElement): + (WebCore::StyledElement::inlineStyleDecl): + (WebCore::StyledElement::ensureInlineStyleDecl): + (WebCore::StyledElement::attributeStyle): + (WebCore::StyledElement::ensureAttributeStyle): + (WebCore::StyledElement::destroyInlineStyleDecl): + +2012-02-06 Abhishek Arya <inferno@chromium.org> + + Crash in SubframeLoader::loadSubframe. + https://bugs.webkit.org/show_bug.cgi?id=77345 + + Reviewed by Nate Chapin. + + Mutation event when loading subframe can blow away the + main frame. Add a RefPtr to protect against that. + + Test: fast/frames/subframe-load-crash-main.html + + * loader/SubframeLoader.cpp: + (WebCore::SubframeLoader::loadSubframe): + +2012-02-06 ChangSeok Oh <shivamidow@gmail.com> + + Initial implementation of GraphicsContext3DOpenGLES.cpp + https://bugs.webkit.org/show_bug.cgi?id=76248 + + Reviewed by Martin Robinson. + + Implemented APIs in GraphicsContext3DOpenGLES.cpp according to the GLES spec. roughly. + But no way to run these codes right now, because they need an extra port + specific implementation to work. I plan to add these extra codes for the GTK port + in the next patch. And also this patch doesn't support anti-aliasing yet. Another bug + will deal with it. + Moved some APIs in GraphicsContext3DOpenGLES.cpp to GraphicsContext3DCommon.cpp. + It looks it could be shared between gl and gles. + Two helper functions are added to avoid code duplication in GraphicsContext3D. + Added a missing period at the end of comment lines. + + No new tests required. + We'll be able to verify this patch by using the existing webgl test cases. + + * platform/graphics/GraphicsContext3D.h: Add build flag to access stencilBuffer & depthBuffer for gles. + (WebCore): + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + (WebCore::GraphicsContext3D::reshapeFBOs): Helper function extracted from GC3D::reshape to resize regular & multisampled FBOs. + (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): Helper function to resolve multisampling. + * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: + (WebCore::GraphicsContext3D::validateAttributes): Add condition to disable antialiasing & packedDepthStencilExtension for GLES. + (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): + (WebCore::GraphicsContext3D::paintRenderingResultsToImageData): + + Following APIs looked shareable so that moved into GC3DOpenGLCommon.cpp. + (WebCore::GraphicsContext3D::prepareTexture): + (WebCore): + (WebCore::GraphicsContext3D::readRenderingResults): + (WebCore::GraphicsContext3D::reshape): + (WebCore::GraphicsContext3D::bindFramebuffer): + (WebCore::GraphicsContext3D::copyTexImage2D): + (WebCore::GraphicsContext3D::copyTexSubImage2D): + (WebCore::GraphicsContext3D::getActiveUniform): + (WebCore::GraphicsContext3D::readPixels): + + Added a missing period at the end of comment line. + (WebCore::GraphicsContext3D::compileShader): + (WebCore::GraphicsContext3D::getActiveAttrib): + (WebCore::GraphicsContext3D::uniform2fv): + (WebCore::GraphicsContext3D::uniform3fv): + (WebCore::GraphicsContext3D::uniform4fv): + (WebCore::GraphicsContext3D::uniform2iv): + (WebCore::GraphicsContext3D::uniform3iv): + (WebCore::GraphicsContext3D::uniform4iv): + (WebCore::GraphicsContext3D::uniformMatrix2fv): + (WebCore::GraphicsContext3D::uniformMatrix3fv): + (WebCore::GraphicsContext3D::uniformMatrix4fv): + (WebCore::GraphicsContext3D::texSubImage2D): + + * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp: + (WebCore::GraphicsContext3D::reshapeFBOs): Same with the above. + (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary): Same with the above. + + Brief explanation about what the differences are between gl and gles. + (WebCore::GraphicsContext3D::renderbufferStorage): Removed codes for converting GLES parameter to GL parameter. + (WebCore::GraphicsContext3D::getIntegerv): Removed codes that emulate GLES. + (WebCore::GraphicsContext3D::texImage2D): Removed codes for converting GLES parameter to GL parameter. + +2012-02-06 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: [Meta] Allow emulation of touch events + https://bugs.webkit.org/show_bug.cgi?id=77096 + + Reviewed by Pavel Feldman. + + This is the inspector part of the change, core part implementation tracked in bug 77105. + + * English.lproj/localizedStrings.js: + * inspector/Inspector.json: + * inspector/InspectorDOMAgent.cpp: + (DOMAgentState): + (WebCore::InspectorDOMAgent::clearFrontend): + (WebCore::InspectorDOMAgent::restore): + (WebCore): + (WebCore::InspectorDOMAgent::updateTouchEventEmulationInDocuments): + (WebCore::InspectorDOMAgent::setTouchEmulationEnabled): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent.prototype._captureDOM): + (WebInspector.DOMAgent.prototype._emulateTouchEventsChanged): + * inspector/front-end/Settings.js: + (WebInspector.Settings): + * inspector/front-end/SettingsScreen.js: + (WebInspector.SettingsScreen): + +2012-02-06 Chris Guan <chris.guan@torchmobile.com.cn> + + [Blackberry] Non-supported about: operations never stops loading + https://bugs.webkit.org/show_bug.cgi?id=76366 + + Reviewed by Rob Buis. + + If user typed a non-supported "about:" scheme such as "about:nonsupport", + the loadAboutURL() function in NetworkManger should recognize and handle it as + an error of invalid url. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::loadAboutURL): + (WebCore::NetworkJob::handleAbout): + * platform/network/blackberry/NetworkJob.h: + (NetworkJob): + * platform/network/blackberry/NetworkManager.cpp: + (WebCore::NetworkManager::startJob): + +2012-02-06 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Remove unused disabledComputedProperties from methods in StylesSidebarPane + https://bugs.webkit.org/show_bug.cgi?id=77876 + + Reviewed by Pavel Feldman. + + * inspector/front-end/StylesSidebarPane.js: + (WebInspector.StylesSidebarPane.prototype._refreshUpdate): + (WebInspector.StylesSidebarPane.prototype._rebuildUpdate): + (WebInspector.StylesSidebarPane.prototype._markUsedProperties): + (WebInspector.StylesSidebarPane.prototype._refreshSectionsForStyleRules): + (WebInspector.StylesSidebarPane.prototype._rebuildSectionsForStyleRules): + (WebInspector.StylePropertiesSection.prototype.onpopulate): + (WebInspector.ComputedStylePropertiesSection): + (WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited): + +2012-02-06 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Redesign summary view / retaining tree contents + https://bugs.webkit.org/show_bug.cgi?id=77870 + + Reviewed by Pavel Feldman. + + 1. Make object IDs less contrast. + 2. Put array indices in []. + 3. Do not write type if it's just "Object". + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotGenericObjectNode.prototype._createObjectCell): + (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data): + (WebInspector.HeapSnapshotObjectNode.prototype._emptyData): + (WebInspector.HeapSnapshotObjectNode.prototype._enhanceData): + (WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell): + (WebInspector.HeapSnapshotConstructorNode.prototype.get data): + * inspector/front-end/heapProfiler.css: + (.detailed-heapshot-view .console-formatted-id): + (.detailed-heapshot-view td.object-column span.grayed): + +2012-02-06 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Texmap][Qt] Avoid an image copy when uploading textures in WebKit1 + https://bugs.webkit.org/show_bug.cgi?id=77748 + + Reviewed by Kenneth Rohde Christiansen. + + Use QPixmap::buffer() API to get access to the QPixmap's pixels without implicit copies. + + Instrumentation shows that the deep image copies created from TextureMapperGL are + eliminated. + + * platform/graphics/opengl/TextureMapperGL.cpp: + (WebCore::BitmapTextureGL::updateContents): + +2012-02-06 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + LayoutTest failures on r106797 + https://bugs.webkit.org/show_bug.cgi?id=77868 + + Call suspendIfNeeded from subclass of IDBRequest, IDBVersionChangeRequest. + + Reviewed by Simon Hausmann. + + * storage/IDBVersionChangeRequest.cpp: + (WebCore::IDBVersionChangeRequest::create): + +2012-02-06 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt] Implement ImageBuffer::copyImage(ImageBuffer::DontCopyBackingStore) + https://bugs.webkit.org/show_bug.cgi?id=77689 + + Reviewed by Kenneth Rohde Christiansen. + + Use StillImageQt::createForRendering when using DontCopyBackingStore. + Enable DontCopyBackingStore in TextureMapperNode. + This removes deep copies resulting from the use of ImageBuffer. + + Instrumentation shows that deep image copies resulted from ImageBuffer are eliminated. + + * platform/graphics/qt/ImageBufferQt.cpp: + (WebCore::ImageBuffer::copyImage): + * platform/graphics/texmap/TextureMapperNode.cpp: + (WebCore::TextureMapperNode::renderContent): + +2012-02-06 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + WebGestureEvent can not encode delta and area. + https://bugs.webkit.org/show_bug.cgi?id=77728 + + Add area field to PlatformGestureEvent. + + Reviewed by Kenneth Rohde Christiansen. + + * platform/PlatformGestureEvent.h: + (WebCore::PlatformGestureEvent::PlatformGestureEvent): + (WebCore::PlatformGestureEvent::area): + +2012-02-06 Charles Wei <charles.wei@torchmobile.com.cn> + + [BlackBerry]Use extension for a mimetype as the suggested extension + if the url file doesn't have an extension. + https://bugs.webkit.org/show_bug.cgi?id=76779 + + Reviewed by Antonio Gomes. + + No new tests. + + * platform/network/blackberry/NetworkJob.cpp: + (WebCore::NetworkJob::sendResponseIfNeeded): + +2012-02-06 Kentaro Hara <haraken@chromium.org> + + Rename [HasIndexGetter], [HasNameGetter] and [HasCustomIndexSetter] IDLs + https://bugs.webkit.org/show_bug.cgi?id=77848 + + Reviewed by Adam Barth. + + For naming consistency with [CustomGetter] and [CustomSetter], + this patch renames the following IDLs: + + [HasIndexGetter] => [IndexedGetter] (Remove "Has". This IDL is for "indexed" properties + in the Web IDL: http://dev.w3.org/2006/webapi/WebIDL/#idl-indexed-properties) + [HasCustomIndexSetter] => [CustomIndexedSetter] (Ditto.) + [HasNameGetter] => [NamedGetter] (Remove "Has". This IDL is for "named" properties + in the Web IDL: http://dev.w3.org/2006/webapi/WebIDL/#idl-named-properties) + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateGetOwnPropertyDescriptorBody): + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeaderNamedAndIndexedPropertyAccessors): + (GenerateImplementationIndexer): + (GenerateImplementationNamedPropertyGetter): + + * bindings/scripts/test/TestEventTarget.idl: No change in run-bindings-tests results. + * bindings/scripts/test/TestTypedArray.idl: Ditto. + + * Modules/gamepad/GamepadList.idl: + * css/CSSRuleList.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSValueList.idl: + * css/MediaList.idl: + * css/StyleSheetList.idl: + * css/WebKitCSSFilterValue.idl: + * css/WebKitCSSKeyframesRule.idl: + * css/WebKitCSSTransformValue.idl: + * dom/ClientRectList.idl: + * dom/DOMStringList.idl: + * dom/DOMStringMap.idl: + * dom/DataTransferItemList.idl: + * dom/NamedNodeMap.idl: + * dom/NodeList.idl: + * dom/TouchList.idl: + * fileapi/EntryArray.idl: + * fileapi/EntryArraySync.idl: + * fileapi/FileList.idl: + * html/DOMSettableTokenList.idl: + * html/DOMTokenList.idl: + * html/HTMLAllCollection.idl: + * html/HTMLCollection.idl: + * html/HTMLFormElement.idl: + * html/HTMLOptionsCollection.idl: + * html/HTMLPropertiesCollection.idl: + * html/HTMLSelectElement.idl: + * html/TextTrackCueList.idl: + * html/canvas/CanvasPixelArray.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/track/TextTrackList.idl: + * mediastream/MediaStreamList.idl: + * mediastream/MediaStreamTrackList.idl: + * page/SpeechInputResultList.idl: + * page/WebKitAnimationList.idl: + * plugins/DOMMimeTypeArray.idl: + * plugins/DOMPlugin.idl: + * plugins/DOMPluginArray.idl: + * storage/Storage.idl: + +2012-02-06 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Ensure timers and other active DOM objects do not fire in suspended documents. + https://bugs.webkit.org/show_bug.cgi?id=53733 + + ScriptExecutionContext now remembers it has suspended active DOM objects + and suspends all newly installed active DOM objects as well. + + All create-calls active DOM objects now calls the post constructor method + suspendIfNeeded that updates the suspend state. It is post constructor + because the suspend/resume functions are virtual and thus can not be called + from constructors. + + Reviewed by Mihai Parparita. + + Test: fast/events/suspend-timers.html + + * Modules/intents/IntentRequest.cpp: + (WebCore::IntentRequest::create): + * bindings/generic/ActiveDOMCallback.cpp: + (WebCore::ActiveDOMCallback::ActiveDOMCallback): + * dom/ActiveDOMObject.cpp: + (WebCore::ActiveDOMObject::ActiveDOMObject): + (WebCore::ActiveDOMObject::~ActiveDOMObject): + (WebCore::ActiveDOMObject::suspendIfNeeded): + * dom/ActiveDOMObject.h: + (WebCore::ActiveDOMObject::suspendIfNeededCalled): + * dom/DocumentEventQueue.cpp: + (WebCore::DocumentEventQueue::DocumentEventQueue): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::ScriptExecutionContext): + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): + (WebCore::ScriptExecutionContext::stopActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded): + * dom/ScriptExecutionContext.h: + (WebCore::ScriptExecutionContext::activeDOMObjectsAreSuspended): + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::create): + * fileapi/FileReader.cpp: + (WebCore::FileReader::create): + * fileapi/FileReader.h: + * fileapi/FileWriter.cpp: + (WebCore::FileWriter::create): + * fileapi/FileWriter.h: + * history/CachedFrame.cpp: + (WebCore::CachedFrame::CachedFrame): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::create): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::create): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::create): + * mediastream/PeerConnection.cpp: + (WebCore::PeerConnection::create): + * notifications/Notification.cpp: + (WebCore::Notification::create): + * notifications/NotificationCenter.cpp: + (WebCore::NotificationCenter::create): + * notifications/NotificationCenter.h: + * page/DOMTimer.cpp: + (WebCore::DOMTimer::install): + (WebCore::DOMTimer::fired): + * page/EventSource.cpp: + (WebCore::EventSource::create): + * page/SuspendableTimer.cpp: + (WebCore::SuspendableTimer::SuspendableTimer): + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::create): + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::create): + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::create): + * webaudio/AudioContext.cpp: + (WebCore::AudioContext::create): + * websockets/WebSocket.cpp: + (WebCore::WebSocket::create): + * websockets/WebSocket.h: + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::create): + +2012-02-06 Philippe Normand <pnormand@igalia.com> + + Adding FFTFrameGStreamer.cpp that I forgot to commit + in r106537. That new file was reviewed in https://bugs.webkit.org/show_bug.cgi?id=73545. + + * platform/audio/gstreamer/FFTFrameGStreamer.cpp: Added. + +2012-02-06 Hayato Ito <hayato@chromium.org> + + Add <shadow> element, which is guarded by SHADOW_DOM flag. + https://bugs.webkit.org/show_bug.cgi?id=76435 + + Reviewed by Dimitri Glazkov. + + Test: fast/dom/shadow/shadow-element.html + + * CMakeLists.txt: + * DerivedSources.cpp: + * DerivedSources.make: + * DerivedSources.pri: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * html/HTMLElementsAllInOne.cpp: + * html/HTMLTagNames.in: + * html/shadow/HTMLShadowElement.cpp: Added. + (WebCore): + (WebCore::HTMLShadowElement::HTMLShadowElement): + (WebCore::HTMLShadowElement::create): + (WebCore::HTMLShadowElement::~HTMLShadowElement): + * html/shadow/HTMLShadowElement.h: Added. + (WebCore): + (HTMLShadowElement): + * html/shadow/HTMLShadowElement.idl: Added. + +2012-02-06 Joe Thomas <joethomas@motorola.com> + + https://bugs.webkit.org/show_bug.cgi?id=76995. + WebKit fails IETC :indeterminate and input type=radio test. + + All input types should respect indeterminate property(getter and setter). This is true with other browsers. + Indeterminate appearance for radio input type is supported by IOS platform. Webkit need not support indeterminate appearance + for radio input type on other platforms. + + Reviewed by Kent Tamura. + + Test: fast/forms/indeterminate-input-types.html + + * html/CheckboxInputType.cpp: + (WebCore::CheckboxInputType::supportsIndeterminateAppearance): Checks indeterminate appearance is supported. + (WebCore): + * html/CheckboxInputType.h: + (CheckboxInputType): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::setIndeterminate): Removed the check isCheckable(). + (WebCore::HTMLInputElement::isIndeterminate): Checks indeterminate appearance is supported. + (WebCore): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/InputType.cpp: + (WebCore::InputType::supportsIndeterminateAppearance): Checks indeterminate appearance is supported. + (WebCore): + * html/InputType.h: + (InputType): + * html/RadioInputType.cpp: + (WebCore::RadioInputType::willDispatchClick): Indeterminate related code is moved to IOS specific. + (WebCore::RadioInputType::didDispatchClick): Ditto. + (WebCore::RadioInputType::supportsIndeterminateAppearance): Checks indeterminate appearance is supported. + (WebCore): + * html/RadioInputType.h: + (RadioInputType): + +2012-02-06 Robin Cao <robin.cao@torchmobile.com.cn> + + [BlackBerry] Remove unused variable in PluginViewBlackBerry + https://bugs.webkit.org/show_bug.cgi?id=77847 + + Reviewed by Kentaro Hara. + + No changes in behavior, so no new tests. + + * plugins/blackberry/PluginViewBlackBerry.cpp: + (WebCore::PluginView::updatePluginWidget): + +2012-02-06 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: Fix CallArgument type in Inspector.json + https://bugs.webkit.org/show_bug.cgi?id=77839 + + Reviewed by Yury Semikhatsky. + + Protocol description is fixed: field type is changed. No changes to + program code are necessary. + + * inspector/Inspector-0.1.json: + * inspector/Inspector-1.0.json: + * inspector/Inspector.json: + +2012-02-05 Gavin Barraclough <barraclough@apple.com> + + Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter + https://bugs.webkit.org/show_bug.cgi?id=77451 + + Reviewed by Sam Weinig. + + These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. + Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. + + * bindings/js/JSDOMWindowCustom.cpp: + (WebCore): + (WebCore::JSDOMWindow::defineOwnProperty): + * bindings/js/JSDOMWindowShell.cpp: + (WebCore): + * bindings/js/JSDOMWindowShell.h: + (JSDOMWindowShell): + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::defineOwnProperty): + (WebCore::JSLocationPrototype::defineOwnProperty): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + * page/DOMWindow.idl: + * page/Location.idl: + +2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> + + Unreviewed. Fix make distrcheck. + + * GNUmakefile.am: Fix typo in inspector json file. + * GNUmakefile.list.am: Remove non existent file. + +2012-02-06 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Qt minimal compilation fix after r106777. + + * inspector/InspectorDatabaseAgent.h: added missing #if ENABLED guards. + +2012-02-05 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: REGRESSION detached dom nodes aren't highlighted + https://bugs.webkit.org/show_bug.cgi?id=77829 + + This functionality was lost when I replaced (Native roots) with (Detached DOM trees) on v8 side. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshotNode.prototype.get isDetachedDOMTreesRoot): + (WebInspector.HeapSnapshot.prototype._markDetachedDOMTreeNodes): + +2012-02-05 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: get rid of artificial heap snapshot nodes from the retaining tree. + https://bugs.webkit.org/show_bug.cgi?id=77850 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotObjectNode): + (WebInspector.HeapSnapshotObjectNode.prototype.updateHasChildren): + (WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell): + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshotNode.prototype.get isArtificial): + (WebInspector.HeapSnapshot.prototype._init): + +2012-02-05 Peter Rybin <peter.rybin@gmail.com> + + Web Inspector: CodeGeneratorInspector.py: switch domain agents to formal interfaces in BackendDispatcher + https://bugs.webkit.org/show_bug.cgi?id=77444 + + Reviewed by Yury Semikhatsky. + + All agent code is switched to formal interfaces. Actual agent class + names and includes are dropped from InspectorBackendDispatcher.h. + + * inspector/CodeGeneratorInspector.py: + (DomainNameFixes.get_fixed_data): + (Generator.go): + * inspector/InspectorAgent.h: + * inspector/InspectorApplicationCacheAgent.h: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::getMatchedStylesForNode): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorConsoleAgent.h: + * inspector/InspectorDOMAgent.cpp: + (WebCore::InspectorDOMAgent::highlightNode): + * inspector/InspectorDOMAgent.h: + (InspectorDOMAgent): + * inspector/InspectorDOMDebuggerAgent.h: + * inspector/InspectorDOMStorageAgent.h: + * inspector/InspectorDatabaseAgent.h: + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::setBreakpoint): + (WebCore::InspectorDebuggerAgent::continueToLocation): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/InspectorFileSystemAgent.h: + * inspector/InspectorIndexedDBAgent.h: + * inspector/InspectorMemoryAgent.h: + * inspector/InspectorPageAgent.h: + * inspector/InspectorProfilerAgent.cpp: + (WebCore::InspectorProfilerAgent::getProfile): + (WebCore::InspectorProfilerAgent::removeProfile): + * inspector/InspectorProfilerAgent.h: + (InspectorProfilerAgent): + * inspector/InspectorResourceAgent.cpp: + (WebCore::InspectorResourceAgent::setExtraHTTPHeaders): + * inspector/InspectorResourceAgent.h: + (InspectorResourceAgent): + * inspector/InspectorRuntimeAgent.h: + * inspector/InspectorTimelineAgent.cpp: + (WebCore::InspectorTimelineAgent::start): + * inspector/InspectorTimelineAgent.h: + (InspectorTimelineAgent): + * inspector/InspectorWorkerAgent.cpp: + (WebCore::InspectorWorkerAgent::sendMessageToWorker): + * inspector/InspectorWorkerAgent.h: + (InspectorWorkerAgent): + +2012-02-05 Kentaro Hara <haraken@chromium.org> + + Rename [TreatNullAs=EmptyString] to [TreatNullAs=NullString], + [TreatUndefinedAs=EmptyString] to [TreatUndefinedAs=NullString] + https://bugs.webkit.org/show_bug.cgi?id=77611 + + Reviewed by Adam Barth. + + While the Web IDL spec requires [TreatNullAs=EmptyString] and [TreatUndefinedAs=EmptyString], + the current WebKit treats them as (not an empty string but) a null string. + To avoid confusion, this patch renames [TreatNullAs=EmptyString] to [TreatNullAs=NullString], + and [TreatUndefinedAs=EmptyString] to [TreatUndefinedAs=NullString]. + (Eventually we should fix WebKit so that it uses an empty string and then + rename them to [TreatNullAs=EmptyString] and [TreatUndefinedAs=EmptyString].) + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: Added FIXME. + (JSValueToNative): + * bindings/scripts/CodeGeneratorV8.pm: Ditto. + (GetNativeTypeFromSignature): + + * bindings/scripts/test/TestObj.idl: + * css/CSSCharsetRule.idl: + * css/CSSPageRule.idl: + * css/CSSRule.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleRule.idl: + * css/CSSValue.idl: + * css/MediaList.idl: + * css/WebKitCSSKeyframesRule.idl: + * dom/Attr.idl: + * dom/CharacterData.idl: + * dom/DOMImplementation.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/ProcessingInstruction.idl: + * dom/ShadowRoot.idl: + * fileapi/Blob.idl: + * fileapi/DirectoryEntry.idl: + * fileapi/DirectoryEntrySync.idl: + * fileapi/Entry.idl: + * fileapi/EntrySync.idl: + * fileapi/WebKitBlobBuilder.idl: + * html/HTMLAnchorElement.idl: + * html/HTMLButtonElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLDocument.idl: + * html/HTMLElement.idl: + * html/HTMLFieldSetElement.idl: + * html/HTMLFormElement.idl: + * html/HTMLFrameElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLKeygenElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOutputElement.idl: + * html/HTMLScriptElement.idl: + * html/HTMLSelectElement.idl: + * html/HTMLTextAreaElement.idl: + * html/HTMLTitleElement.idl: + * html/canvas/CanvasRenderingContext2D.idl: + * page/Console.idl: + * page/DOMWindow.idl: + * storage/StorageEvent.idl: + * svg/SVGAngle.idl: + * svg/SVGElement.idl: + * svg/SVGLength.idl: + * svg/SVGScriptElement.idl: + +2012-02-05 Kentaro Hara <haraken@chromium.org> + + Rename [JSCCustom*] IDL to [JSCustom*] IDL + https://bugs.webkit.org/show_bug.cgi?id=77844 + + Reviewed by Adam Barth. + + Most existing JSC-specific IDLs have "JS" prefix. We can rename [JSCCustom] to + [JSCustom], [JSCCustomGetter] to [JSCustomGetter], and [JSCCustomSetter] to + [JSCustomSetter]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateHeader): + (GenerateImplementation): + * css/CSSStyleDeclaration.idl: + * html/HTMLDocument.idl: + * html/canvas/DataView.idl: + * page/DOMWindow.idl: + * page/MemoryInfo.idl: + * webaudio/ConvolverNode.idl: + * webaudio/DOMWindowWebAudio.idl: + * webaudio/WaveShaperNode.idl: + * websockets/DOMWindowWebSocket.idl: + * workers/WorkerContext.idl: + +2012-02-05 ChangSeok Oh <shivamidow@gmail.com> + + [EFL] Enable WebGL with glx backend + https://bugs.webkit.org/show_bug.cgi?id=77308 + + Reviewed by Martin Robinson. + + Implemented WebGL feature for EFL port. The way is very similar to the one of GTK port. + + No new tests required. We can verify this feature with the existing test cases. + + * CMakeLists.txt: Revised common files required for WebGL. + * PlatformEfl.cmake: Added EFL specific files. + * html/HTMLCanvasElement.cpp: + (WebCore::HTMLCanvasElement::getContext): + * platform/graphics/ANGLEWebKitBridge.h: + * platform/graphics/GraphicsContext3D.h: + (WebCore): + (WebCore::GraphicsContext3D::platformTexture): + (GraphicsContext3D): + (WebCore::GraphicsContext3D::paintsIntoCanvasBuffer): + * platform/graphics/efl/DrawingBufferEfl.cpp: Copied from GTK port. + (WebCore): + (WebCore::DrawingBuffer::DrawingBuffer): + (WebCore::DrawingBuffer::~DrawingBuffer): + (WebCore::DrawingBuffer::platformColorBuffer): + (WebCore::DrawingBuffer::paintCompositedResultsToCanvas): + * platform/graphics/efl/GraphicsContext3DEfl.cpp: Almost same with GraphicsContext3DGtk.cpp. + (WebCore::GraphicsContext3D::create): + (WebCore::GraphicsContext3D::GraphicsContext3D): + (WebCore::GraphicsContext3D::~GraphicsContext3D): + (WebCore::GraphicsContext3D::makeContextCurrent): + (WebCore::GraphicsContext3D::platformGraphicsContext3D): + (WebCore::GraphicsContext3D::isGLES2Compliant): + * platform/graphics/opengl/Extensions3DOpenGL.cpp: + (WebCore::Extensions3DOpenGL::createVertexArrayOES): + (WebCore::Extensions3DOpenGL::deleteVertexArrayOES): + (WebCore::Extensions3DOpenGL::isVertexArrayOES): + (WebCore::Extensions3DOpenGL::bindVertexArrayOES): + * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: + * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: + +2012-02-05 Abhishek Arya <inferno@chromium.org> + + Crash in FormSubmission::create. + https://bugs.webkit.org/show_bug.cgi?id=77813 + + Reviewed by Kent Tamura. + + Test: fast/forms/form-submission-create-crash.xhtml + + * loader/FormSubmission.cpp: + (WebCore::FormSubmission::create): + +2012-02-05 Andreas Kling <awesomekling@apple.com> + + Remove unused file MappedAttributeEntry.h. + <http://webkit.org/b/77841> + + Reviewed by Anders Carlsson. + + * GNUmakefile.list.am: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/MappedAttributeEntry.h: Removed. + * dom/StyledElement.h: + +2012-02-05 Andreas Kling <awesomekling@apple.com> + + StyledElement: Rename parseMappedAttribute() to parseAttribute(). + <http://webkit.org/b/77830> + + Reviewed by Anders Carlsson. + + Rename across the board and decorate subclasses with OVERRIDE. + +2012-02-05 Gustavo Noronha Silva <gns@gnome.org> + + Unreviewed syntax fix. + + * English.lproj/localizedStrings.js: + +2012-02-05 Andreas Kling <awesomekling@apple.com> + + Swedish buildfix. + + * dom/Document.cpp: + (WebCore::wheelEventHandlerCountChanged): + +2012-02-05 Anders Carlsson <andersca@apple.com> + + The scrolling tree should be aware of any wheel event handlers on the page + https://bugs.webkit.org/show_bug.cgi?id=77840 + + Reviewed by Andreas Kling. + + If there are wheel event handlers on the page, any wheel events must be redispatched + to the main thread so they can go through the DOM event handling. + + * dom/Document.cpp: + (WebCore::wheelEventHandlerCountChanged): + Inform the scrolling coordinator that the wheel event count changed. + + (WebCore::Document::didAddWheelEventHandler): + (WebCore::Document::didRemoveWheelEventHandler): + Call wheelEventHandlerCountChanged. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::frameViewWheelEventHandlerCountChanged): + Call recomputeWheelEventHandlerCount. + + (WebCore::ScrollingCoordinator::recomputeWheelEventHandlerCount): + Update the scrolling tree state. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::ScrollingTree): + Initialize m_hasWheelEventHandlers to false. + + (WebCore::ScrollingTree::tryToHandleWheelEvent): + If m_hasWheelEventHandlers is true, bail. + + (WebCore::ScrollingTree::commitNewTreeState): + Update m_hasWheelEventHandlers. + + * page/scrolling/ScrollingTreeState.cpp: + (WebCore::ScrollingTreeState::ScrollingTreeState): + (WebCore::ScrollingTreeState::setWheelEventHandlerCount): + Add getter and setter for the wheel event handler count. + +2012-02-05 Andreas Kling <awesomekling@apple.com> + + Remove mapped vs non-mapped attribute distinction. + <http://webkit.org/b/77827> + + Reviewed by Antti Koivisto. + + Removed the isMappedAttribute flag from Attribute as it no longer serves + a practical purpose. Previously, StyledElement would generate mapped + attributes and plain Element would generate non-mapped ones. + + The distinction is now made much more clearly by dividing the work between + Element's and StyledElement's attributeChanged() methods. The only thing + that StyledElement wants to do in addition to what Element does is + calling parseMappedAttribute() (which we'll rename in a later patch.) + + * dom/Attribute.cpp: + (WebCore::Attribute::clone): + * dom/Attribute.h: + (WebCore::Attribute::create): + (WebCore::Attribute::Attribute): + (Attribute): + * dom/Document.cpp: + (WebCore::Document::createAttributeNS): + * dom/Element.cpp: + (WebCore::Element::attributeChanged): + * dom/Element.h: + (Element): + * dom/Node.cpp: + (WebCore::Node::dumpStatistics): + * dom/StyledElement.cpp: + (WebCore::StyledElement::attributeChanged): + (WebCore::StyledElement::parseMappedAttribute): + * dom/StyledElement.h: + (StyledElement): + * html/parser/HTMLConstructionSite.cpp: + (WebCore): + * html/parser/HTMLTreeBuilder.cpp: + (WebCore::HTMLTreeBuilder::attributesForIsindexInput): + * html/parser/TextDocumentParser.cpp: + (WebCore::TextDocumentParser::insertFakePreElement): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::getPresentationAttribute): + * xml/parser/MarkupTokenBase.h: + (WebCore::::initializeAttributes): + +2012-02-05 Andreas Kling <awesomekling@apple.com> + + Kill CSSMappedAttributeDeclaration. + <http://webkit.org/b/77820> + + Reviewed by Antti Koivisto. + + Replace all use of CSSMappedAttributeDeclaration by StylePropertySet. + Moved the setNeedsStyleRecalc() calls from CSSMappedAttributeDeclaration + to the add/remove-CSS-property helpers in StyledElement. + + This removes one step of indirection for attribute styles and reduces + the size of elements that have presentational attributes by one pointer. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.order: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * dom/CSSMappedAttributeDeclaration.cpp: Removed. + * dom/CSSMappedAttributeDeclaration.h: Removed. + * dom/DOMAllInOne.cpp: + + Remove CSSMappedAttributeDeclaration.{cpp,h} + + * css/CSSParser.h: + * css/CSSParser.cpp: + (WebCore::parseSimpleLengthValue): + + Remove CSSParser::parseMappedAttributeValue(), we now use parseValue() + directly instead. We lose the benefit of caching new CSSValues in the + document's CSSValuePool but this optimization can be added back later. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchAllRules): + * dom/ElementAttributeData.h: + (ElementAttributeData): + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::ensureAttributeStyle): + * dom/NamedNodeMap.h: + (WebCore::NamedNodeMap::attributeStyle): + (NamedNodeMap): + * dom/StyledElement.cpp: + (WebCore::StyledElement::removeCSSProperties): + (WebCore::StyledElement::addCSSProperty): + (WebCore::StyledElement::addCSSImageProperty): + (WebCore::StyledElement::addCSSLength): + (WebCore::StyledElement::addCSSColor): + * dom/StyledElement.h: + (WebCore): + (WebCore::StyledElement::attributeStyle): + (WebCore::StyledElement::ensureAttributeStyle): + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): + +2012-02-05 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: beautify retaining tree items view. + https://bugs.webkit.org/show_bug.cgi?id=77810 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotGenericObjectNode.prototype._createObjectCell): + (WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell): + * inspector/front-end/heapProfiler.css: + (.cycled-ancessor-node): + * inspector/front-end/profilesPanel.css: + +2012-02-04 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Add support to force full damage in CCDamageTracker + https://bugs.webkit.org/show_bug.cgi?id=76805 + + Reviewed by James Robinson. + + Unit test added to CCDamageTrackerTest.cpp. + + This feature is needed for events that should cause the entire + surface to be damaged, even if layers themselves had only partial + damage or no damage at all. For example, tab-switching is one such + event. + + * platform/graphics/chromium/cc/CCDamageTracker.cpp: + (WebCore::CCDamageTracker::CCDamageTracker): + (WebCore::CCDamageTracker::updateDamageRectForNextFrame): + * platform/graphics/chromium/cc/CCDamageTracker.h: + (WebCore::CCDamageTracker::forceFullDamageNextUpdate): + (CCDamageTracker): + +2012-02-04 Anders Carlsson <andersca@apple.com> + + Remove dead code from ScrollingCoordinator + https://bugs.webkit.org/show_bug.cgi?id=77821 + + Reviewed by Sam Weinig. + + * WebCore.exp.in: + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::ScrollingCoordinator): + * page/scrolling/ScrollingCoordinator.h: + (ScrollingCoordinator): + * page/scrolling/mac/ScrollingCoordinatorMac.mm: + (WebCore::ScrollingCoordinator::frameViewScrollLayerDidChange): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::frameViewDidChangeSize): + (WebCore::RenderLayerCompositor::updateRootLayerPosition): + +2012-02-04 Anders Carlsson <andersca@apple.com> + + The scrolling tree should inform the main scrolling coordinator when the scroll position changes + https://bugs.webkit.org/show_bug.cgi?id=77818 + + Reviewed by Sam Weinig. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::updateMainFrameScrollPosition): + Set the main frame scroll position. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::updateMainFrameScrollPosition): + Call ScrollingCoordinator::updateMainFrameScrollPosition on the main thread. + + * page/scrolling/mac/ScrollingTreeNodeMac.mm: + (WebCore::ScrollingTreeNodeMac::scrollBy): + Call ScrollingTree::updateMainFrameScrollPosition. + +2012-02-04 Andreas Kling <awesomekling@apple.com> + + Element: Remove unnecessary attributeChanged() argument. + <http://webkit.org/b/77814> + + Reviewed by Ryosuke Niwa. + + Remove the 'preserveDecls' argument to Element::attributeChanged() as that is no + longer needed after the removal of per-attribute style declarations. + Decorated subclass overrides with OVERRIDE since we're touching the lines. + + Also removed an old inaccurate comment in NamedNodeMap::setAttributes() - calling + attributeChanged() is absolutely necessary to initialize element-specific state. + + * dom/Element.cpp: + (WebCore::Element::attributeChanged): + * dom/Element.h: + (Element): + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::setAttributes): + * dom/StyledElement.cpp: + (WebCore::StyledElement::attributeChanged): + * dom/StyledElement.h: + (StyledElement): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::updateType): + * html/HTMLMediaElement.cpp: + (WebCore::HTMLMediaElement::attributeChanged): + * html/HTMLMediaElement.h: + (HTMLMediaElement): + * html/HTMLScriptElement.cpp: + (WebCore::HTMLScriptElement::attributeChanged): + * html/HTMLScriptElement.h: + (HTMLScriptElement): + * html/HTMLTrackElement.cpp: + (WebCore::HTMLTrackElement::attributeChanged): + * html/HTMLTrackElement.h: + (HTMLTrackElement): + * svg/SVGAnimationElement.cpp: + (WebCore::SVGAnimationElement::attributeChanged): + * svg/SVGAnimationElement.h: + * svg/SVGElement.cpp: + (WebCore::SVGElement::attributeChanged): + * svg/SVGElement.h: + (SVGElement): + * svg/animation/SVGSMILElement.cpp: + (WebCore::SVGSMILElement::attributeChanged): + * svg/animation/SVGSMILElement.h: + (SVGSMILElement): + +2012-02-04 Ken Buchanan <kenrb@chromium.org> + + Crash when reparenting children of flexible boxes + https://bugs.webkit.org/show_bug.cgi?id=77458 + + Reviewed by Ojan Vafai. + + This fixes some regressions I introduced in r106150. RenderBlock:: + removeChild needs to be careful about not collapsing anonymous + blocks underneath flexible boxes, and also about node ordering + when there is an after block. + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::removeChild): + (WebCore::RenderBlock::collapseAnonymousBoxChild): + +2012-02-04 Ryosuke Niwa <rniwa@webkit.org> + + Debug build fix after r106715. + + * html/HTMLDetailsElement.cpp: + (WebCore::DetailsSummaryElement::create): + +2012-02-04 Andreas Kling <awesomekling@apple.com> + + Unreviewed test fix after r106740. + <http://webkit.org/b/77204> + + Disable matched declaration caching for elements with attribute style until we can + figure out how it's supposed to work. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchAllRules): + +2012-02-03 Andreas Kling <awesomekling@apple.com> + + Kill per-Attribute style declarations. + <http://webkit.org/b/77204> + + Reviewed by Antti Koivisto. + + TL;DR summary: Remove the per-Attribute style declarations and replace them by a single + style declaration on StyledElement that acts as a secondary inline style. + + The previous design was conceived in the Age of the Old Web(tm) where the majority of + element styling was accomplished via attributes. Nowadays, CSS is a much better tool for + this and we should optimize around that instead. + + StyledElements now have an attributeStyle() which contains all the styling from attributes. + parseMappedAttribute() is responsible for adding/removing properties to the attributeStyle + as the corresponding attributes come in/out of the element. + + Each Attribute instance shrinks by one pointer, each element that has attributes grows by + one pointer. The styles from individual attributes are no longer shared, so content that + uses a lot of repeating styling attributes will see a slight memory regression from this. + Future improvements to this could enable sharing the attributeStyle between elements that + have the same exact attributes to mitigate some of the damage. + + There should be no web-facing behavior change from this, but it does break two things: + + - The Inspector feature for displaying per-attribute styles. To keep things manageable, + this patch simply files all the attribute styles together under an anonymous attribute + in the Inspector. + + - The Obj-C DOM binding for Attr::style() has to be kept for compatibility reasons, + though it's already deprecated. It will now always return nil, since there's no way to + retrieve a live style declaration that's specific to a certain Attr. + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::matchAllRules): + (WebCore::CSSStyleSelector::canShareStyleWithElement): + * dom/Attr.h: + (WebCore): + (Attr): + (WebCore::Attr::style): + * dom/Attribute.cpp: + (WebCore::Attribute::clone): + * dom/Attribute.h: + (WebCore): + (WebCore::Attribute::create): + (WebCore::Attribute::createMapped): + (Attribute): + (WebCore::Attribute::Attribute): + * dom/CSSMappedAttributeDeclaration.cpp: + (WebCore::CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration): + (WebCore::CSSMappedAttributeDeclaration::setMappedProperty): + * dom/CSSMappedAttributeDeclaration.h: + (CSSMappedAttributeDeclaration): + (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): + * dom/Element.h: + (Element): + * dom/ElementAttributeData.h: + (ElementAttributeData): + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::ensureAttributeStyle): + (WebCore): + * dom/NamedNodeMap.h: + (WebCore::NamedNodeMap::attributeStyle): + (NamedNodeMap): + * dom/StyledElement.cpp: + (WebCore): + (WebCore::StyledElement::attributeChanged): + (WebCore::StyledElement::removeCSSProperties): + (WebCore::StyledElement::addCSSProperty): + (WebCore::StyledElement::addCSSImageProperty): + (WebCore::StyledElement::addCSSLength): + (WebCore::StyledElement::addCSSColor): + * dom/StyledElement.h: + (StyledElement): + (WebCore::StyledElement::removeCSSProperty): + (WebCore::StyledElement::attributeStyle): + (WebCore::StyledElement::ensureAttributeStyle): + * html/HTMLBRElement.cpp: + (WebCore::HTMLBRElement::parseMappedAttribute): + * html/HTMLBRElement.h: + (HTMLBRElement): + * html/HTMLBodyElement.cpp: + (WebCore::HTMLBodyElement::parseMappedAttribute): + * html/HTMLBodyElement.h: + (HTMLBodyElement): + * html/HTMLDivElement.cpp: + (WebCore::HTMLDivElement::parseMappedAttribute): + * html/HTMLDivElement.h: + (HTMLDivElement): + * html/HTMLElement.cpp: + (WebCore::HTMLElement::applyBorderAttribute): + (WebCore::HTMLElement::mapLanguageAttributeToLocale): + (WebCore::HTMLElement::parseMappedAttribute): + (WebCore::HTMLElement::removeHTMLAlignment): + (WebCore): + (WebCore::HTMLElement::addHTMLAlignmentToStyledElement): + (WebCore::HTMLElement::setContentEditable): + * html/HTMLElement.h: + (HTMLElement): + * html/HTMLEmbedElement.cpp: + (WebCore::HTMLEmbedElement::parseMappedAttribute): + * html/HTMLEmbedElement.h: + (HTMLEmbedElement): + * html/HTMLFontElement.cpp: + (WebCore::HTMLFontElement::parseMappedAttribute): + * html/HTMLFontElement.h: + (HTMLFontElement): + * html/HTMLFrameSetElement.cpp: + (WebCore::HTMLFrameSetElement::parseMappedAttribute): + * html/HTMLFrameSetElement.h: + (HTMLFrameSetElement): + * html/HTMLHRElement.cpp: + (WebCore::HTMLHRElement::parseMappedAttribute): + * html/HTMLHRElement.h: + (HTMLHRElement): + * html/HTMLIFrameElement.cpp: + (WebCore::HTMLIFrameElement::parseMappedAttribute): + * html/HTMLIFrameElement.h: + (HTMLIFrameElement): + * html/HTMLImageElement.cpp: + (WebCore::HTMLImageElement::parseMappedAttribute): + * html/HTMLImageElement.h: + (HTMLImageElement): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::parseMappedAttribute): + * html/HTMLInputElement.h: + (HTMLInputElement): + * html/HTMLLIElement.cpp: + (WebCore::HTMLLIElement::parseMappedAttribute): + * html/HTMLLIElement.h: + (HTMLLIElement): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::parseMappedAttribute): + * html/HTMLMarqueeElement.h: + (HTMLMarqueeElement): + * html/HTMLOListElement.cpp: + (WebCore::HTMLOListElement::parseMappedAttribute): + * html/HTMLOListElement.h: + (HTMLOListElement): + * html/HTMLOutputElement.cpp: + * html/HTMLOutputElement.h: + (HTMLOutputElement): + * html/HTMLParagraphElement.cpp: + (WebCore::HTMLParagraphElement::parseMappedAttribute): + * html/HTMLParagraphElement.h: + (HTMLParagraphElement): + * html/HTMLPlugInElement.cpp: + (WebCore::HTMLPlugInElement::parseMappedAttribute): + * html/HTMLPlugInElement.h: + (HTMLPlugInElement): + * html/HTMLPreElement.cpp: + (WebCore::HTMLPreElement::parseMappedAttribute): + * html/HTMLPreElement.h: + (HTMLPreElement): + * html/HTMLTableCaptionElement.cpp: + (WebCore::HTMLTableCaptionElement::parseMappedAttribute): + * html/HTMLTableCaptionElement.h: + (HTMLTableCaptionElement): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::parseMappedAttribute): + * html/HTMLTableCellElement.h: + (HTMLTableCellElement): + * html/HTMLTableColElement.cpp: + (WebCore::HTMLTableColElement::parseMappedAttribute): + * html/HTMLTableColElement.h: + (HTMLTableColElement): + * html/HTMLTableElement.cpp: + (WebCore::HTMLTableElement::parseMappedAttribute): + * html/HTMLTableElement.h: + (HTMLTableElement): + * html/HTMLTablePartElement.cpp: + (WebCore): + (WebCore::HTMLTablePartElement::parseMappedAttribute): + * html/HTMLTablePartElement.h: + * html/HTMLTextAreaElement.cpp: + (WebCore::HTMLTextAreaElement::parseMappedAttribute): + * html/HTMLUListElement.cpp: + (WebCore::HTMLUListElement::parseMappedAttribute): + * html/HTMLUListElement.h: + (HTMLUListElement): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::parseMappedAttribute): + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): + * mathml/MathMLElement.cpp: + (WebCore::MathMLElement::parseMappedAttribute): + * mathml/MathMLElement.h: + * svg/SVGImageElement.cpp: + (WebCore::SVGImageElement::parseMappedAttribute): + * svg/SVGStyledElement.cpp: + (WebCore::SVGStyledElement::parseMappedAttribute): + (WebCore::SVGStyledElement::getPresentationAttribute): + * svg/SVGStyledElement.h: + (SVGStyledElement): + * svg/SVGTextContentElement.cpp: + (WebCore::SVGTextContentElement::parseMappedAttribute): + +2012-02-03 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: get rid of cycles in retaining tree + https://bugs.webkit.org/show_bug.cgi?id=77801 + + Drive by fix: 'retained by' prefix was removed. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotObjectNode): + (WebInspector.HeapSnapshotObjectNode.prototype._updateHasChildren): + (WebInspector.HeapSnapshotObjectNode.prototype._createChildNode): + (WebInspector.HeapSnapshotObjectNode.prototype._prefixObjectCell): + * inspector/front-end/profilesPanel.css: + (.cycled-ancessor-node): + +2012-02-04 Kentaro Hara <haraken@chromium.org> + + Add the "JS" prefix to JSC specific IDL attributes + https://bugs.webkit.org/show_bug.cgi?id=77693 + + Reviewed by Darin Adler. + + Some JSC specific IDLs do not have "JS" prefix, e.g. [CustomIsReachable]. + It might be OK since JSC is the main JavaScript engine in WebKit, but + distinguishing IDLs widely used in WebKit and IDLs used in JSC only would help + people understand the role of IDLs. + + This patch renames the following JSC specific IDLs: + + CustomFinalize => JSCustomFinalize + CustomIsReachable => JSCustomIsReachable + CustomMarkFunction => JSCustomMarkFunction + CustomToJS => JSCustomToJS + CustomNativeConverter => JSCustomToNativeObject (Note: For naming consistency with [JSCustomToJS]) + GenerateIsReachable => JSGenerateIsReachable + GenerateToJS => JSGenerateToJS + NoStaticTables => JSNoStaticTables + WindowEventListener => JSWindowEventListener + InlineGetOwnPropertySlot => JSInlineGetOwnPropertySlot + DelegatingPrototypePutFunction => JSCustomPrototypePutDelegate + + No tests. No changes in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertySlotBody): + (GenerateGetOwnPropertyDescriptorBody): + (GenerateHeader): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (HasCustomToV8Implementation): + + * bindings/scripts/test/TestTypedArray.idl: No change in run-bindings-tests results. + + * css/CSSRule.idl: + * css/CSSRuleList.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSValue.idl: + * css/MediaList.idl: + * css/MediaQueryListListener.idl: + * css/StyleMedia.idl: + * css/StyleSheet.idl: + * css/StyleSheetList.idl: + * dom/Attr.idl: + * dom/DOMCoreException.idl: + * dom/DOMImplementation.idl: + * dom/DOMStringMap.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/ErrorEvent.idl: + * dom/Event.idl: + * dom/EventException.idl: + * dom/EventListener.idl: + * dom/MessageChannel.idl: + * dom/MessageEvent.idl: + * dom/MessagePort.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/NodeFilter.idl: + * dom/NodeIterator.idl: + * dom/NodeList.idl: + * dom/TreeWalker.idl: + * dom/WebKitNamedFlow.idl: + * fileapi/Blob.idl: + * fileapi/DOMFileSystem.idl: + * fileapi/DOMFileSystemSync.idl: + * fileapi/DirectoryEntry.idl: + * fileapi/DirectoryEntrySync.idl: + * fileapi/DirectoryReader.idl: + * fileapi/DirectoryReaderSync.idl: + * fileapi/Entry.idl: + * fileapi/EntryArray.idl: + * fileapi/EntryArraySync.idl: + * fileapi/EntrySync.idl: + * fileapi/File.idl: + * fileapi/FileEntry.idl: + * fileapi/FileEntrySync.idl: + * fileapi/FileError.idl: + * fileapi/FileException.idl: + * fileapi/FileList.idl: + * fileapi/FileReader.idl: + * fileapi/FileReaderSync.idl: + * fileapi/FileWriter.idl: + * fileapi/Metadata.idl: + * fileapi/OperationNotAllowedException.idl: + * fileapi/WebKitBlobBuilder.idl: + * html/DOMFormData.idl: + * html/DOMSettableTokenList.idl: + * html/DOMTokenList.idl: + * html/DOMURL.idl: + * html/HTMLAllCollection.idl: + * html/HTMLBodyElement.idl: + * html/HTMLCollection.idl: + * html/HTMLFrameSetElement.idl: + * html/ImageData.idl: + * html/MediaController.idl: + * html/TextTrack.idl: + * html/TextTrackCue.idl: + * html/VoidCallback.idl: + * html/canvas/ArrayBuffer.idl: + * html/canvas/ArrayBufferView.idl: + * html/canvas/CanvasRenderingContext.idl: + * html/canvas/DataView.idl: + * html/canvas/Float32Array.idl: + * html/canvas/Float64Array.idl: + * html/canvas/Int16Array.idl: + * html/canvas/Int32Array.idl: + * html/canvas/Int8Array.idl: + * html/canvas/OESStandardDerivatives.idl: + * html/canvas/OESTextureFloat.idl: + * html/canvas/OESVertexArrayObject.idl: + * html/canvas/Uint16Array.idl: + * html/canvas/Uint32Array.idl: + * html/canvas/Uint8Array.idl: + * html/canvas/Uint8ClampedArray.idl: + * html/canvas/WebGLCompressedTextures.idl: + * html/canvas/WebGLDebugRendererInfo.idl: + * html/canvas/WebGLDebugShaders.idl: + * html/canvas/WebGLLoseContext.idl: + * html/canvas/WebGLRenderingContext.idl: + * html/track/TextTrackList.idl: + * loader/appcache/DOMApplicationCache.idl: + * mediastream/LocalMediaStream.idl: + * page/BarInfo.idl: + * page/Console.idl: + * page/DOMSelection.idl: + * page/DOMWindow.idl: + * page/EventSource.idl: + * page/Geolocation.idl: + * page/History.idl: + * page/Location.idl: + * page/Navigator.idl: + * page/Screen.idl: + * page/WorkerNavigator.idl: + * plugins/DOMMimeTypeArray.idl: + * plugins/DOMPluginArray.idl: + * storage/Database.idl: + * storage/DatabaseSync.idl: + * storage/IDBAny.idl: + * storage/IDBKey.idl: + * storage/SQLError.idl: + * storage/SQLException.idl: + * storage/SQLResultSet.idl: + * storage/SQLResultSetRowList.idl: + * storage/SQLTransaction.idl: + * storage/SQLTransactionSync.idl: + * storage/Storage.idl: + * svg/SVGElementInstance.idl: + * svg/SVGPathSeg.idl: + * webaudio/AudioBufferCallback.idl: + * webaudio/AudioBufferSourceNode.idl: + * webaudio/AudioContext.idl: + * webaudio/AudioDestinationNode.idl: + * webaudio/AudioGain.idl: + * webaudio/AudioGainNode.idl: + * webaudio/AudioPannerNode.idl: + * webaudio/AudioProcessingEvent.idl: + * webaudio/BiquadFilterNode.idl: + * webaudio/ConvolverNode.idl: + * webaudio/DelayNode.idl: + * webaudio/DynamicsCompressorNode.idl: + * webaudio/HighPass2FilterNode.idl: + * webaudio/JavaScriptAudioNode.idl: + * webaudio/LowPass2FilterNode.idl: + * webaudio/MediaElementAudioSourceNode.idl: + * webaudio/OfflineAudioCompletionEvent.idl: + * webaudio/RealtimeAnalyserNode.idl: + * webaudio/WaveShaperNode.idl: + * websockets/CloseEvent.idl: + * websockets/WebSocket.idl: + * workers/AbstractWorker.idl: + * workers/DedicatedWorkerContext.idl: + * workers/SharedWorker.idl: + * workers/SharedWorkerContext.idl: + * workers/Worker.idl: + * workers/WorkerContext.idl: + * workers/WorkerLocation.idl: + * xml/XMLHttpRequest.idl: + * xml/XMLHttpRequestException.idl: + * xml/XMLHttpRequestProgressEvent.idl: + * xml/XMLHttpRequestUpload.idl: + * xml/XPathResult.idl: + +2012-02-04 Emil A Eklund <eae@chromium.org> + + Convert RenderTheme over to new layout abstraction + https://bugs.webkit.org/show_bug.cgi?id=77783 + + Reviewed by Eric Seidel. + + Change the RenderTheme classes to use the new layout abstraction as a + part of the ongoing conversion work. + + No new tests. + + * rendering/RenderTheme.cpp: + (WebCore::RenderTheme::paint): + (WebCore::RenderTheme::volumeSliderOffsetFromMuteButton): + (WebCore::RenderTheme::baselinePosition): + (WebCore::RenderTheme::adjustRepaintRect): + (WebCore::RenderTheme::meterSizeForBounds): + * rendering/RenderTheme.h: + (RenderTheme): + (WebCore::RenderTheme::paintCapsLockIndicator): + * rendering/RenderThemeChromiumMac.h: + (RenderThemeChromiumMac): + * rendering/RenderThemeChromiumMac.mm: + (WebCore::RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton): + * rendering/RenderThemeChromiumSkia.cpp: + (WebCore::RenderThemeChromiumSkia::convertToPaintingRect): + (WebCore::RenderThemeChromiumSkia::paintSearchFieldCancelButton): + (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeChromiumSkia::paintSearchFieldResultsButton): + * rendering/RenderThemeChromiumSkia.h: + * rendering/RenderThemeMac.h: + (RenderThemeMac): + * rendering/RenderThemeMac.mm: + (WebCore::RenderThemeMac::adjustRepaintRect): + (WebCore::RenderThemeMac::inflateRect): + (WebCore::RenderThemeMac::setControlSize): + (WebCore::RenderThemeMac::paintCapsLockIndicator): + (WebCore::RenderThemeMac::paintMenuList): + (WebCore::RenderThemeMac::meterSizeForBounds): + (WebCore::RenderThemeMac::paintMenuListButtonGradients): + (WebCore::RenderThemeMac::setPopupButtonCellState): + (WebCore::RenderThemeMac::paintSearchFieldCancelButton): + (WebCore::RenderThemeMac::volumeSliderOffsetFromMuteButton): + * rendering/RenderThemeSafari.cpp: + (WebCore::RenderThemeSafari::baselinePosition): + * rendering/RenderThemeSafari.h: + (RenderThemeSafari): + * rendering/RenderThemeWin.cpp: + (WebCore::RenderThemeWin::paintSearchFieldCancelButton): + (WebCore::RenderThemeWin::paintSearchFieldResultsDecoration): + (WebCore::RenderThemeWin::paintSearchFieldResultsButton): + (WebCore::RenderThemeWin::volumeSliderOffsetFromMuteButton): + * rendering/RenderThemeWin.h: + (RenderThemeWin): + +2012-02-04 Stephen White <senorblanco@chromium.org> + + [chromium] Fix multi-second hangs in compositor invalidating large layers + https://bugs.webkit.org/show_bug.cgi?id=77774 + + Reviewed by James Robinson. + + Correctness covered by existing tests. + + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::TiledLayerChromium::pushPropertiesTo): + Remove tiles from the tiler when they are invalid (ie., no longer have + texture backing). + (WebCore::TiledLayerChromium::invalidateRect): + Instead of iterating over the tile indices (which may be very large), + iterate over the tile hash map instead. + +2012-02-04 Swapna P <spottabathini@innominds.com> + + Reviewed by Antonio Gomes. + + Bug: iframe with scrolling=no incorrectly autoscrollable + https://bugs.webkit.org/show_bug.cgi?id=61558 + + Added check for frame scrolling mode just before applying scroll on frame content in function RenderLayer::scrollRect + + Testcase: LayoutTests/fast/events/autoscroll-with-non-scrollable-parent.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::scrollRectToVisible): + +2012-02-03 Tim Horton <timothy_horton@apple.com> + + Canvas-into-canvas drawing should respect backing store scale ratio + https://bugs.webkit.org/show_bug.cgi?id=77784 + <rdar://problem/10549729> + + Reviewed by Dan Bernstein. + + Respect the backing store scale ratio when drawing a canvas into another + canvas via ctx.drawImage(canvas, x, y). Previous behavior caused canvas + drawing to differ based on the size of the backing store, which is ideally + an implementation detail to authors. + + Also, rename the source canvas arguments to CanvasRenderingContext2D::drawImage + to be more clear. + + No new tests. + + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::drawImage): + +2012-02-03 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77782 + WebPageProxy::didNewFirstVisuallyNonEmptyLayout should is called more than + once on some pages with frames + -and corresponding- + <rdar://problem/10798474> + + Reviewed by Sam Weinig. + + startCountingRelevantRepaintedObjects() should only be called for the main + frame. Otherwise, the counter will be re-set inappropriately, and + didNewFirstVisuallyNonEmptyLayout may even end up firing more than once. + * page/FrameView.cpp: + (WebCore::FrameView::performPostLayoutTasks): + +2012-02-03 Benjamin Poulain <bpoulain@apple.com> + + Reduce the memory allocations of WebCore's cssPropertyName() + https://bugs.webkit.org/show_bug.cgi?id=74782 + + Reviewed by Geoffrey Garen. + + Add a fast path to avoid the use of the StringBuilder. + + The string builder is needed for two cases: + -CSS prefix (the character after the prefix must be uppercase) + -JavaScript CamelCase name for CSS properties + + We can skip all memory allocations if the property is not in those + two cases. We start by testing the string for uppercase characters, + and just return the an identical string. + + This patch create a "fast case" 2.7 times faster than previously. + The "slow case" is 2-3% slower due to the additional check at the beginning. + + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + (WebCore): + (WebCore::containsASCIIUpperChar): + (WebCore::cssPropertyName): + (WebCore::isCSSPropertyName): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + WebKit2 should dispatch wheel events to the new ScrollingTree class + https://bugs.webkit.org/show_bug.cgi?id=77795 + + Reviewed by Andreas Kling. + + * WebCore.exp.in: + Add new symbols needed by WebKit2. + + * WebCore.xcodeproj/project.pbxproj: + Make ScrollingTree.h private so it can be included by WebKit2. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::scrollingTree): + * page/scrolling/ScrollingCoordinator.h: + Add a scrolling tree getter. + +2012-02-03 Dmitry Lomov <dslomov@google.com> + + [Chromium] WebCore::toV8Context crashes if DomWindow::frame() returns null. + https://bugs.webkit.org/show_bug.cgi?id=77686. + + Reviewed by Adam Barth. + + * bindings/v8/V8Helpers.cpp: + (WebCore::toV8Context): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + The scrolling tree should be able to handle wheel events + https://bugs.webkit.org/show_bug.cgi?id=77794 + + Reviewed by Andreas Kling. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::tryToHandleWheelEvent): + New function. Currently this always returns that it was able to handle the wheel event, + but this will change in the future. + + (WebCore::ScrollingTree::handleWheelEvent): + Ask the root node to handle the wheel event. + + * page/scrolling/ScrollingTreeNode.h: + Add a handleWheelEvent pure virtual member function. + + * page/scrolling/mac/ScrollingTreeNodeMac.mm: + (WebCore::ScrollingTreeNodeMac::handleWheelEvent): + Call scrollBy for now. Eventually this should use a scroll elasticity controller to handle + things like rubber-banding. + + (WebCore::ScrollingTreeNodeMac::scrollPosition): + (WebCore::ScrollingTreeNodeMac::setScrollPosition): + Add getters and setters for the scroll position. + + (WebCore::ScrollingTreeNodeMac::scrollBy): + Update the scroll position given the offset. + +2012-02-03 Ryosuke Niwa <rniwa@webkit.org> + + Crash in Node::dispatchSubtreeModifiedEvent + https://bugs.webkit.org/show_bug.cgi?id=77449 + + Reviewed by Alexey Proskuryakov. + + The bug was caused by appendChild not retaining this pointer. + This is normally okay because there's another owner within JSC/V8 binding code that + holds onto the node but this isn't the case when nodes are created as a part + of setting document.title. Fixed the crash by retaining the pointer as needed. + + Test: fast/dom/remove-body-during-title-creation.html + + * dom/ContainerNode.cpp: + (WebCore::ContainerNode::appendChild): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + Apply changed properties from the updated scrolling tree state + https://bugs.webkit.org/show_bug.cgi?id=77792 + + Reviewed by Andreas Kling. + + * page/scrolling/ScrollingTreeNode.cpp: + (WebCore::ScrollingTreeNode::update): + Update the tree node properties from the scrolling tree state. + + * page/scrolling/ScrollingTreeNode.h: + (WebCore::ScrollingTreeNode::scrollingTree): + (WebCore::ScrollingTreeNode::viewportRect): + (WebCore::ScrollingTreeNode::contentsSize): + Add getters. + + * page/scrolling/ScrollingTreeState.h: + (WebCore::ScrollingTreeState::changedProperties): + New function for accessing the changed properties of the scrolling tree state. + + * page/scrolling/mac/ScrollingTreeNodeMac.h: + * page/scrolling/mac/ScrollingTreeNodeMac.mm: + (WebCore::ScrollingTreeNodeMac::update): + Update the scroll layer from the scrolling tree if necessary. + +2012-02-03 Brady Eidson <beidson@apple.com> + + <rdar://problem/10742441> and https://bugs.webkit.org/show_bug.cgi?id=77766 + Need a WK2 API to filter which subframes go into WebArchives as they are created. + + Reviewed by Darin Adler. + + This adds a filter callback object that allows clients to get called back for each + subframe that might be added to a WebArchive. + + API only, No new layout tests. + + * WebCore.exp.in: + * loader/archive/cf/LegacyWebArchive.cpp: + (WebCore::LegacyWebArchive::create): + (WebCore::LegacyWebArchive::createFromSelection): + * loader/archive/cf/LegacyWebArchive.h: + (FrameFilter): + (WebCore:: FrameFilter::~ FrameFilter): + (LegacyWebArchive): + +2012-02-03 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Key generators not rolled back if insertion fails or is aborted + https://bugs.webkit.org/show_bug.cgi?id=77060 + + Reviewed by Tony Chang. + + Test: storage/indexeddb/key-generator.html + + * storage/IDBObjectStoreBackendImpl.cpp: + (WebCore::IDBObjectStoreBackendImpl::put): Add abort task to reset cache. + (WebCore::IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache): + (WebCore): + (WebCore::IDBObjectStoreBackendImpl::putInternal): Reset cache on error. + * storage/IDBObjectStoreBackendImpl.h: + (IDBObjectStoreBackendImpl): + +2012-02-03 Tony Chang <tony@chromium.org> + + positive and negative flex values are not being cleared on style changes + https://bugs.webkit.org/show_bug.cgi?id=77771 + + Reviewed by Ojan Vafai. + + If the width or height was a flex() value, but is no longer a flex + value, we weren't clearing the positive and negative flex values in + RenderStyle. + + Test: css3/flexbox/flex-no-flex.html + + * css/CSSStyleApplyProperty.cpp: + (WebCore::ApplyPropertyLength::applyValue): + +2012-02-03 James Robinson <jamesr@chromium.org> + + [chromium] Defer makeContextCurrent in compositor until first frame + https://bugs.webkit.org/show_bug.cgi?id=77269 + + Reviewed by Kenneth Russell. + + There are situations where we need to instantiate a compositor, but can't call makeContextCurrent() until some + initialization work completes on another thread that we cannot block for. This defers the first + makeContextCurrent() call until we need to produce the first frame at which point we know the call can succeed, + assuming that the scheduler does the right thing. + + This is accomplished by splitting up proxy initialization into two pieces: + *) initializeContext() which attempts to instantiate a GraphicsContext3D. This can fail if we can't make a + context at all, in which case we abort completely and return NULL from CCLayerTreeHost::create(). + + *) initializeLayerRenderer() which uses the previously-created context to instantiate our compositor objects and + grab our renderer capabilities. This can fail if the context is not usable for compositing, which we report + to the client as a lost context event. + + Internally this introduces a new state to the CCLayerTreeHostImpl where it has a context but does not yet have a + LayerRendererChromium, which has fairly minimal impact. One other change is that we don't instantiate the + TextureManagers until we have the renderer capabilities, but this isn't necessary until we want to start + painting so it doesn't have any impact outside of some overly intrustive unit tests. + + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerChromium::paintContentsIfDirty): + (WebCore::ContentLayerChromium::createTextureUpdater): + * platform/graphics/chromium/ContentLayerChromium.h: + (ContentLayerChromium): + * platform/graphics/chromium/ImageLayerChromium.cpp: + (WebCore::ImageLayerChromium::paintContentsIfDirty): + * platform/graphics/chromium/ImageLayerChromium.h: + (ImageLayerChromium): + * platform/graphics/chromium/TiledLayerChromium.cpp: + * platform/graphics/chromium/TiledLayerChromium.h: + (WebCore::TiledLayerChromium::setSampledTexelFormat): + (TiledLayerChromium): + * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: + (WebCore::CCLayerTreeHost::CCLayerTreeHost): + (WebCore::CCLayerTreeHost::initialize): + (WebCore::CCLayerTreeHost::initializeLayerRenderer): + (WebCore): + (WebCore::CCLayerTreeHost::beginCommitOnImplThread): + (WebCore::CCLayerTreeHost::compositeAndReadback): + (WebCore::CCLayerTreeHost::finishAllRendering): + (WebCore::CCLayerTreeHost::setViewportSize): + (WebCore::CCLayerTreeHost::setVisible): + (WebCore::CCLayerTreeHost::updateLayers): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeHost): + (): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::isContextLost): + * platform/graphics/chromium/cc/CCProxy.h: + (CCProxy): + * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: + (WebCore::CCSingleThreadProxy::CCSingleThreadProxy): + (WebCore::CCSingleThreadProxy::compositeAndReadback): + (WebCore::CCSingleThreadProxy::initializeContext): + (WebCore::CCSingleThreadProxy::initializeLayerRenderer): + (WebCore::CCSingleThreadProxy::layerRendererCapabilities): + * platform/graphics/chromium/cc/CCSingleThreadProxy.h: + (CCSingleThreadProxy): + * platform/graphics/chromium/cc/CCThreadProxy.cpp: + (WebCore::CCThreadProxy::CCThreadProxy): + (WebCore::CCThreadProxy::compositeAndReadback): + (WebCore::CCThreadProxy::initializeContext): + (WebCore): + (WebCore::CCThreadProxy::initializeLayerRenderer): + (WebCore::CCThreadProxy::layerRendererCapabilities): + (WebCore::CCThreadProxy::initializeImplOnImplThread): + (WebCore::CCThreadProxy::initializeContextOnImplThread): + (WebCore::CCThreadProxy::initializeLayerRendererOnImplThread): + * platform/graphics/chromium/cc/CCThreadProxy.h: + (CCThreadProxy): + +2012-02-03 James Robinson <jamesr@chromium.org> + + Unreviewed compile fix for chromium - add commas after entries in list in WebCore.gypi + + * WebCore.gypi: + +2012-02-03 Andreas Kling <awesomekling@apple.com> + + Unreviewed build fix attempt after r106695. + + CSSMutableStyleDeclaration was renamed to StylePropertySet. + + * bindings/scripts/CodeGeneratorCPP.pm: + (AddIncludesForType): + * bindings/scripts/CodeGeneratorV8.pm: + (AddIncludesForType): + * bindings/v8/V8DOMWindowShell.cpp: + * bindings/v8/V8DOMWrapper.cpp: + * bindings/v8/V8Proxy.cpp: + +2012-02-03 Yong Li <yoli@rim.com> + + [BlackBerry] Let userIdleTime() return maximum number instead of 0 as + most of other ports do. + https://bugs.webkit.org/show_bug.cgi?id=77769 + + Reviewed by Rob Buis. + + userIdleTime() should return a big number so it won't block page cache + from releasing cached pages. See PageCache::releaseAutoreleasedPagesNowOrReschedule(). + + No new tests as no visible functional changes. + + * platform/blackberry/SystemTimeBlackBerry.cpp: + (WebCore::userIdleTime): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + Commit scrolling tree state changes to the scrolling tree + https://bugs.webkit.org/show_bug.cgi?id=77780 + + Reviewed by Darin Adler. + + * WebCore.xcodeproj/project.pbxproj: + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::commitTreeState): + Send the new scrolling tree state over to the ScrollingTree on the scrolling thread. + + * page/scrolling/ScrollingTree.cpp: + (WebCore::ScrollingTree::ScrollingTree): + Create a root node. + + (WebCore::ScrollingTree::commitNewTreeState): + Update the root node. + + * page/scrolling/ScrollingTreeNode.cpp: Copied from Source/WebCore/page/scrolling/ScrollingTree.cpp. + * page/scrolling/ScrollingTreeNode.h: Copied from Source/WebCore/page/scrolling/ScrollingTree.cpp. + Stub out an abstract ScrollingTreeNode class. + + * page/scrolling/mac/ScrollingCoordinatorMac.mm: + (WebCore::ScrollingCoordinator::frameViewScrollLayerDidChange): + Update the scroll layer on the tree state. + + * page/scrolling/mac/ScrollingTreeNodeMac.h: Copied from Source/WebCore/page/scrolling/ScrollingTree.cpp. + * page/scrolling/mac/ScrollingTreeNodeMac.mm: Copied from Source/WebCore/page/scrolling/ScrollingTree.cpp. + Stub out the concrete ScrollingTreeNodeMac subclass. + +2012-02-03 Antti Koivisto <antti@apple.com> + + Rename CSSMutableStyleDeclaration.h/.cpp to StylePropertySet.h/.cpp + https://bugs.webkit.org/show_bug.cgi?id=77779 + + Reviewed by Darin Adler. + + Match the new class name. + + * CMakeLists.txt: + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + * bindings/js/JSDOMBinding.h: + * bindings/scripts/CodeGeneratorJS.pm: + (NativeToJSValue): + * bindings/scripts/CodeGeneratorObjC.pm: + (AddIncludesForType): + * css/CSSAllInOne.cpp: + * css/CSSComputedStyleDeclaration.cpp: + * css/CSSFontFaceRule.cpp: + * css/CSSFontFaceRule.h: + * css/CSSFontSelector.cpp: + * css/CSSMutableStyleDeclaration.cpp: Removed. + * css/CSSMutableStyleDeclaration.h: Removed. + * css/CSSPageRule.cpp: + * css/CSSParser.cpp: + * css/CSSStyleRule.cpp: + * css/CSSStyleRule.h: + * css/StylePropertySet.cpp: Copied from Source/WebCore/css/CSSMutableStyleDeclaration.cpp. + * css/StylePropertySet.h: Copied from Source/WebCore/css/CSSMutableStyleDeclaration.h. + * css/WebKitCSSKeyframeRule.cpp: + * css/WebKitCSSKeyframeRule.h: + * css/WebKitCSSKeyframesRule.cpp: + * css/WebKitCSSMatrix.cpp: + * dom/CSSMappedAttributeDeclaration.h: + * dom/ElementAttributeData.h: + * dom/StyledElement.cpp: + * dom/StyledElement.h: + * editing/ApplyStyleCommand.cpp: + * editing/DeleteButtonController.cpp: + * editing/EditingStyle.cpp: + * editing/Editor.cpp: + * editing/EditorCommand.cpp: + * editing/RemoveCSSPropertyCommand.cpp: + * editing/ReplaceSelectionCommand.cpp: + * editing/markup.cpp: + * html/canvas/CanvasRenderingContext2D.cpp: + * html/shadow/MeterShadowElement.cpp: + * inspector/InspectorCSSAgent.cpp: + * inspector/InspectorDOMAgent.cpp: + * page/DragController.cpp: + * page/Frame.cpp: + * rendering/RenderLayer.cpp: + * rendering/RenderTreeAsText.cpp: + * svg/SVGFontFaceElement.h: + (WebCore): + +2012-02-03 Mihnea Ovidenie <mihnea@adobe.com> + + Crash in RenderFlowThread::setRegionBoxesRegionStyle + https://bugs.webkit.org/show_bug.cgi?id=77474 + + Reviewed by David Hyatt. + + Flexbox and deprecated flexible box should also compute their region range + when they are part of a named flow. Until now, only RenderBlock elements + were doing that. Flexbox and deprecated flexible box, while implementing + their own layoutBlock method, were not doing that. + + Tests: fast/regions/flexbox-in-region-crash.html + fast/regions/select-in-region-crash.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::computeInitialRegionRangeForBlock): + (WebCore): + (WebCore::RenderBlock::computeRegionRangeForBlock): + (WebCore::RenderBlock::layoutBlock): + * rendering/RenderBlock.h: + (RenderBlock): + * rendering/RenderDeprecatedFlexibleBox.cpp: + (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::layoutBlock): + * rendering/RenderFlowThread.cpp: + (WebCore::RenderFlowThread::removeRegionFromThread): + (WebCore::RenderFlowThread::removeRenderBoxRegionInfo): + * rendering/RenderRegion.cpp: + (WebCore::RenderRegion::RenderRegion): + (WebCore::RenderRegion::paintReplaced): + * rendering/RenderRegion.h: + (RenderRegion): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + Update the tree state after layout and add a way to commit it + https://bugs.webkit.org/show_bug.cgi?id=77767 + + Reviewed by Andreas Kling. + + * page/FrameView.cpp: + (WebCore::FrameView::performPostLayoutTasks): + Call ScrollingCoordinator::frameViewLayoutUpdated if we have a scrolling coordinator. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::ScrollingCoordinator): + Initialize m_scrollingTreeStateCommitterTimer. + + (WebCore::ScrollingCoordinator::frameViewLayoutUpdated): + Update the viewport rect and contents size of the frame view. + + (WebCore::ScrollingCoordinator::scheduleTreeStateCommit): + Schedule a tree state commit unless we've already scheduled one or there are no changed properties. + + (WebCore::ScrollingCoordinator::scrollingTreeStateCommitterTimerFired): + Call commitTreeState(). + + (WebCore::ScrollingCoordinator::commitTreeStateIfNeeded): + Commit the tree state unless there are no changed properties. + + (WebCore::ScrollingCoordinator::commitTreeState): + Commit the tree state. We currently don't do anything with the committed state yet. + + * page/scrolling/ScrollingCoordinator.h: + Add new member functions and the timer member variable. + + * page/scrolling/ScrollingTreeState.cpp: + (WebCore::ScrollingTreeState::commit): + Copy the current tree state and restore the changed properties on the original. + + * page/scrolling/ScrollingTreeState.h: + (WebCore::ScrollingTreeState::hasChangedProperties): + Return whether there are any changed properties in the tree state. + +2012-02-03 Andreas Kling <awesomekling@apple.com> + + HTMLElement: Clean up tabindex attribute parsing. + <http://webkit.org/b/77763> + + Reviewed by Antti Koivisto. + + Remove an unnecessary getAttribute() call when parsing tabindexAttr. + + * html/HTMLElement.cpp: + (WebCore::HTMLElement::parseMappedAttribute): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + ScrollingTreeState should keep track of the scroll layer + https://bugs.webkit.org/show_bug.cgi?id=77762 + + Reviewed by Andreas Kling. + + * WebCore.xcodeproj/project.pbxproj: + * page/scrolling/ScrollingTreeState.h: + (ScrollingTreeState): + * page/scrolling/mac/ScrollingTreeStateMac.mm: Copied from Source/WebCore/page/scrolling/ScrollingTreeState.h. + (WebCore): + (WebCore::ScrollingTreeState::platformScrollLayer): + (WebCore::ScrollingTreeState::setScrollLayer): + +2012-02-03 Antti Koivisto <antti@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77740 + Split CSSMutableStyleDeclaration into separate internal and CSSOM types + + Reviewed by Andreas Kling and Darin Adler. + + Split the CSSMutableStyleDeclaration into an internal type (StylePropertySet) and a CSSOM implementation type (PropertySetCSSStyleDeclaration). + + To keep things somewhat manageable, this patch does NOT + + - rename or add any files (so files names won't match types) + - rename fields, methods or variables to match new type names (like CSSStyleRule::declaration() -> CSSStyleRule::propertySet()) + - try to realize any memory or performance gains (StylePropertySet loses the vptr but gains PropertySetCSSStyleDeclaration*) + + * WebCore.exp.in: + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::copy): + (WebCore::CSSComputedStyleDeclaration::makeMutable): + (WebCore::CSSComputedStyleDeclaration::copyPropertiesInSet): + * css/CSSComputedStyleDeclaration.h: + (WebCore): + (CSSComputedStyleDeclaration): + * css/CSSFontFaceRule.h: + (WebCore::CSSFontFaceRule::style): + (WebCore::CSSFontFaceRule::declaration): + (WebCore::CSSFontFaceRule::setDeclaration): + (CSSFontFaceRule): + * css/CSSFontSelector.cpp: + (WebCore::CSSFontSelector::addFontFaceRule): + * css/CSSMutableStyleDeclaration.cpp: + (PropertySetCSSStyleDeclaration): + (WebCore::PropertySetCSSStyleDeclaration::create): + (WebCore::PropertySetCSSStyleDeclaration::PropertySetCSSStyleDeclaration): + (WebCore): + (WebCore::StylePropertySet::StylePropertySet): + (WebCore::StylePropertySet::~StylePropertySet): + (WebCore::StylePropertySet::deref): + (WebCore::StylePropertySet::contextStyleSheet): + (WebCore::StylePropertySet::copyPropertiesFrom): + (WebCore::StylePropertySet::getPropertyValue): + (WebCore::StylePropertySet::borderSpacingValue): + (WebCore::StylePropertySet::appendFontLonghandValueIfExplicit): + (WebCore::StylePropertySet::fontValue): + (WebCore::StylePropertySet::get4Values): + (WebCore::StylePropertySet::getLayeredShorthandValue): + (WebCore::StylePropertySet::getShorthandValue): + (WebCore::StylePropertySet::getCommonValue): + (WebCore::StylePropertySet::getPropertyCSSValue): + (WebCore::StylePropertySet::removeShorthandProperty): + (WebCore::StylePropertySet::removeProperty): + (WebCore::StylePropertySet::setNeedsStyleRecalc): + (WebCore::StylePropertySet::propertyIsImportant): + (WebCore::StylePropertySet::getPropertyShorthand): + (WebCore::StylePropertySet::isPropertyImplicit): + (WebCore::StylePropertySet::setProperty): + (WebCore::StylePropertySet::parseDeclaration): + (WebCore::StylePropertySet::addParsedProperties): + (WebCore::StylePropertySet::addParsedProperty): + (WebCore::StylePropertySet::asText): + (WebCore::StylePropertySet::merge): + (WebCore::StylePropertySet::addSubresourceStyleURLs): + (WebCore::StylePropertySet::copyBlockProperties): + (WebCore::StylePropertySet::removeBlockProperties): + (WebCore::StylePropertySet::removePropertiesInSet): + (WebCore::StylePropertySet::findPropertyWithId): + (WebCore::StylePropertySet::propertyMatches): + (WebCore::StylePropertySet::removeEquivalentProperties): + (WebCore::StylePropertySet::copy): + (WebCore::StylePropertySet::copyPropertiesInSet): + (WebCore::StylePropertySet::ensureCSSStyleDeclaration): + (WebCore::PropertySetCSSStyleDeclaration::length): + (WebCore::PropertySetCSSStyleDeclaration::item): + (WebCore::PropertySetCSSStyleDeclaration::parentRule): + (WebCore::PropertySetCSSStyleDeclaration::cssText): + (WebCore::PropertySetCSSStyleDeclaration::setCssText): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValue): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyValue): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyPriority): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyShorthand): + (WebCore::PropertySetCSSStyleDeclaration::isPropertyImplicit): + (WebCore::PropertySetCSSStyleDeclaration::setProperty): + (WebCore::PropertySetCSSStyleDeclaration::removeProperty): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal): + (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal): + (WebCore::PropertySetCSSStyleDeclaration::setPropertyInternal): + (WebCore::PropertySetCSSStyleDeclaration::parentStyleSheet): + (WebCore::PropertySetCSSStyleDeclaration::copy): + (WebCore::PropertySetCSSStyleDeclaration::makeMutable): + (WebCore::PropertySetCSSStyleDeclaration::cssPropertyMatches): + * css/CSSMutableStyleDeclaration.h: + (WebCore): + (StylePropertySet): + (WebCore::StylePropertySet::create): + (WebCore::StylePropertySet::createInline): + * css/CSSPageRule.h: + (WebCore): + * css/CSSParser.cpp: + (WebCore::parseColorValue): + (WebCore::parseSimpleLengthValue): + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parseDeclaration): + (WebCore::CSSParser::createStyleRule): + (WebCore::CSSParser::createFontFaceRule): + (WebCore::CSSParser::createPageRule): + (WebCore::CSSParser::createKeyframeRule): + * css/CSSParser.h: + (WebCore): + (CSSParser): + * css/CSSStyleDeclaration.h: + (WebCore): + (CSSStyleDeclaration): + * css/CSSStyleRule.h: + (WebCore::CSSStyleRule::style): + (WebCore::CSSStyleRule::setDeclaration): + (WebCore::CSSStyleRule::declaration): + (CSSStyleRule): + * css/CSSStyleSelector.cpp: + (WebCore::leftToRightDeclaration): + (WebCore::rightToLeftDeclaration): + (WebCore::CSSStyleSelector::addMatchedDeclaration): + (WebCore::CSSStyleSelector::collectMatchingRulesForList): + (WebCore::CSSStyleSelector::matchAllRules): + (WebCore::CSSStyleSelector::styleForKeyframe): + (WebCore::isInsideRegionRule): + (WebCore::CSSStyleSelector::applyDeclaration): + (WebCore::CSSStyleSelector::applyDeclarations): + (WebCore::CSSStyleSelector::matchPageRulesForList): + * css/CSSStyleSelector.h: + (CSSStyleSelector): + (MatchedStyleDeclaration): + * css/WebKitCSSKeyframeRule.cpp: + (WebCore::WebKitCSSKeyframeRule::setDeclaration): + * css/WebKitCSSKeyframeRule.h: + (WebCore::WebKitCSSKeyframeRule::style): + (WebCore::WebKitCSSKeyframeRule::declaration): + (WebKitCSSKeyframeRule): + * css/WebKitCSSMatrix.cpp: + (WebCore::WebKitCSSMatrix::setMatrixValue): + * dom/Attr.h: + (WebCore::Attr::style): + * dom/Attribute.h: + (WebCore::Attribute::decl): + * dom/CSSMappedAttributeDeclaration.h: + (WebCore::CSSMappedAttributeDeclaration::declaration): + (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration): + (CSSMappedAttributeDeclaration): + * dom/Document.cpp: + (WebCore::Document::createCSSStyleDeclaration): + * dom/ElementAttributeData.h: + (ElementAttributeData): + * dom/NamedNodeMap.cpp: + (WebCore::NamedNodeMap::ensureInlineStyleDecl): + * dom/NamedNodeMap.h: + (WebCore::NamedNodeMap::inlineStyleDecl): + (NamedNodeMap): + * dom/StyledElement.cpp: + (WebCore::StyledElement::updateStyleAttribute): + (WebCore::StyledElement::copyNonAttributeProperties): + (WebCore::StyledElement::addSubresourceAttributeURLs): + * dom/StyledElement.h: + (WebCore::StyledElement::additionalAttributeStyle): + (WebCore::StyledElement::inlineStyleDecl): + (WebCore::StyledElement::ensureInlineStyleDecl): + * editing/ApplyStyleCommand.cpp: + (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange): + (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock): + (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange): + (WebCore::ApplyStyleCommand::removeCSSStyle): + (WebCore::ApplyStyleCommand::addBlockStyle): + (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded): + * editing/DeleteButtonController.cpp: + (WebCore::DeleteButtonController::createDeletionUI): + * editing/EditingStyle.cpp: + (WebCore::copyEditingProperties): + (WebCore::editingStyleFromComputedStyle): + (WebCore): + (WebCore::HTMLElementEquivalent::propertyExistsInStyle): + (HTMLElementEquivalent): + (WebCore::HTMLElementEquivalent::valueIsPresentInStyle): + (HTMLTextDecorationEquivalent): + (WebCore::HTMLTextDecorationEquivalent::propertyExistsInStyle): + (WebCore::HTMLTextDecorationEquivalent::valueIsPresentInStyle): + (HTMLAttributeEquivalent): + (WebCore::HTMLAttributeEquivalent::valueIsPresentInStyle): + (WebCore::HTMLAttributeEquivalent::attributeValueAsCSSValue): + (WebCore::EditingStyle::EditingStyle): + (WebCore::getRGBAFontColor): + (WebCore::EditingStyle::setProperty): + (WebCore::EditingStyle::setStyle): + (WebCore::EditingStyle::overrideWithStyle): + (WebCore::EditingStyle::extractAndRemoveTextDirection): + (WebCore::EditingStyle::removeStyleAddedByNode): + (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode): + (WebCore::EditingStyle::triStateOfStyle): + (WebCore::EditingStyle::conflictsWithInlineStyleOfElement): + (WebCore::EditingStyle::elementIsStyledSpanOrHTMLEquivalent): + (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl): + (WebCore::EditingStyle::mergeStyle): + (WebCore::styleFromMatchedRulesForElement): + (WebCore::EditingStyle::mergeStyleFromRules): + (WebCore::EditingStyle::mergeStyleFromRulesForSerialization): + (WebCore::removePropertiesInStyle): + (WebCore::EditingStyle::removeStyleFromRulesAndContext): + (WebCore::EditingStyle::removePropertiesInElementDefaultStyle): + (WebCore::EditingStyle::forceInline): + (WebCore::reconcileTextDecorationProperties): + (WebCore::StyleChange::StyleChange): + (WebCore::setTextDecorationProperty): + (WebCore::StyleChange::extractTextStyles): + (WebCore::diffTextDecorations): + (WebCore::fontWeightIsBold): + (WebCore::getTextAlignment): + (WebCore::getPropertiesNotIn): + (WebCore::getIdentifierValue): + (WebCore::isTransparentColorValue): + (WebCore::hasTransparentBackgroundColor): + * editing/EditingStyle.h: + (WebCore): + (WebCore::EditingStyle::create): + (EditingStyle): + (WebCore::EditingStyle::style): + (StyleChange): + * editing/Editor.cpp: + (WebCore::Editor::setBaseWritingDirection): + (WebCore::Editor::applyEditingStyleToElement): + * editing/EditorCommand.cpp: + (WebCore::applyCommandToFrame): + (WebCore::executeApplyStyle): + (WebCore::executeToggleStyleInList): + (WebCore::executeApplyParagraphStyle): + (WebCore::executeMakeTextWritingDirectionLeftToRight): + (WebCore::executeMakeTextWritingDirectionNatural): + (WebCore::executeMakeTextWritingDirectionRightToLeft): + * editing/FrameSelection.cpp: + (WebCore::FrameSelection::copyTypingStyle): + * editing/FrameSelection.h: + (WebCore): + * editing/RemoveCSSPropertyCommand.cpp: + (WebCore::RemoveCSSPropertyCommand::doApply): + (WebCore::RemoveCSSPropertyCommand::doUnapply): + * editing/ReplaceSelectionCommand.cpp: + (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline): + * editing/ReplaceSelectionCommand.h: + (WebCore): + * editing/markup.cpp: + (WebCore): + (StyledMarkupAccumulator): + (WebCore::StyledMarkupAccumulator::wrapWithStyleNode): + (WebCore::StyledMarkupAccumulator::appendStyleNodeOpenTag): + (WebCore::propertyMissingOrEqualToNone): + * html/HTMLTableCellElement.cpp: + (WebCore::HTMLTableCellElement::additionalAttributeStyle): + * html/HTMLTableCellElement.h: + (HTMLTableCellElement): + * html/HTMLTableColElement.cpp: + (WebCore::HTMLTableColElement::additionalAttributeStyle): + * html/HTMLTableColElement.h: + (HTMLTableColElement): + * html/HTMLTableElement.cpp: + (WebCore::leakBorderStyle): + (WebCore::HTMLTableElement::additionalAttributeStyle): + (WebCore::HTMLTableElement::createSharedCellStyle): + (WebCore::HTMLTableElement::additionalCellStyle): + (WebCore::leakGroupBorderStyle): + (WebCore::HTMLTableElement::additionalGroupStyle): + * html/HTMLTableElement.h: + (HTMLTableElement): + * html/HTMLTableSectionElement.cpp: + (WebCore::HTMLTableSectionElement::additionalAttributeStyle): + * html/HTMLTableSectionElement.h: + (HTMLTableSectionElement): + * html/ValidationMessage.cpp: + (WebCore::adjustBubblePosition): + * html/canvas/CanvasRenderingContext2D.cpp: + (WebCore::CanvasRenderingContext2D::setFont): + * html/shadow/MediaControlElements.cpp: + (WebCore::MediaControlPanelElement::setPosition): + (WebCore::MediaControlPanelElement::resetPosition): + (WebCore::MediaControlPanelElement::makeOpaque): + (WebCore::MediaControlPanelElement::makeTransparent): + * html/shadow/SliderThumbElement.cpp: + (WebCore::TrackLimiterElement::create): + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::buildArrayForAttributeStyles): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::setPropertyText): + (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): + * page/DragController.cpp: + (WebCore::DragController::concludeEditDrag): + * page/PageSerializer.cpp: + (WebCore::PageSerializer::retrieveResourcesForCSSDeclaration): + * page/PageSerializer.h: + (WebCore): + (PageSerializer): + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::resize): + * rendering/RenderTreeAsText.cpp: + (WebCore::isEmptyOrUnstyledAppleStyleSpan): + * svg/SVGFontFaceElement.cpp: + (WebCore::SVGFontFaceElement::SVGFontFaceElement): + +2012-02-03 Jochen Eisinger <jochen@chromium.org> + + Remove unneccesary canExecuteScripts check from v8 bindings, and correctly indeicate when we're about to execute a script + https://bugs.webkit.org/show_bug.cgi?id=76704 + + Reviewed by Adam Barth. + + Test: http/tests/security/isolatedWorld/sandboxed-iframe.html + + * bindings/v8/ScheduledAction.cpp: + (WebCore::ScheduledAction::execute): + * bindings/v8/V8EventListener.cpp: + (WebCore::V8EventListener::callListenerFunction): + * bindings/v8/V8LazyEventListener.cpp: + (WebCore::V8LazyEventListener::callListenerFunction): + * bindings/v8/V8Proxy.cpp: + (WebCore::V8Proxy::handleOutOfMemory): + (WebCore::toV8Context): + +2012-02-03 Anders Carlsson <andersca@apple.com> + + Add ScrollingTreeState class + https://bugs.webkit.org/show_bug.cgi?id=77756 + + Reviewed by Andreas Kling. + + Add a new ScrollingTreeState whose intent is to be a data container for the current + scrolling tree state. the ScrollingCoordinator class will update it and periodically + send over the new state to the ScrollingTree object on the scrolling thread. + + * WebCore.xcodeproj/project.pbxproj: + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::ScrollingCoordinator): + * page/scrolling/ScrollingCoordinator.h: + (WebCore): + (ScrollingCoordinator): + * page/scrolling/ScrollingTreeState.cpp: Added. + (WebCore): + (WebCore::ScrollingTreeState::create): + (WebCore::ScrollingTreeState::ScrollingTreeState): + (WebCore::ScrollingTreeState::~ScrollingTreeState): + (WebCore::ScrollingTreeState::setViewportRect): + (WebCore::ScrollingTreeState::setContentsSize): + * page/scrolling/ScrollingTreeState.h: Added. + (WebCore): + (ScrollingTreeState): + (WebCore::ScrollingTreeState::viewportRect): + (WebCore::ScrollingTreeState::contentsSize): + +2012-02-03 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77691 + Fix PlatformScreen layering violation and PlatformScreenMac's incorrect use + of device scale + + Reviewed by Andy Estes. + + Make screenAvailableRect() and screenRect() take a Widget again instead of a + FrameView since taking a FrameView is a layering violation. + * WebCore.exp.in: + * platform/PlatformScreen.h: + (WebCore): + * platform/blackberry/PlatformScreenBlackBerry.cpp: + (WebCore::screenAvailableRect): + (WebCore::screenRect): + * platform/chromium/PlatformScreenChromium.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/chromium/PlatformSupport.h: + (WebCore): + (PlatformSupport): + * platform/efl/PlatformScreenEfl.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/gtk/PlatformScreenGtk.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/qt/PlatformScreenQt.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/win/PlatformScreenWin.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + * platform/wx/ScreenWx.cpp: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + + It's wrong for the deviceScaleFactor to be taken into consideration here at + all. + * platform/mac/PlatformScreenMac.mm: + (WebCore::screenRect): + (WebCore::screenAvailableRect): + (WebCore::toUserSpace): + (WebCore::toDeviceSpace): + +2012-02-03 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10352073> Floating image leaves hole in previous column when wrapped to next column + https://bugs.webkit.org/show_bug.cgi?id=77694 + + Reviewed by Darin Adler. + + Tests: fast/dynamic/float-moved-downwards-for-pagination-expected.html + fast/dynamic/float-moved-downwards-for-pagination.html + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::clearFloats): When determining which lines to dirty, + also check for changes to the top edge of the float, which can happen when + float gets pushed down by a pagination strut. + +2012-02-03 Alexis Menard <alexis.menard@openbossa.org> + + REGRESSION (r105401-105403): Blue flash on css border transition + https://bugs.webkit.org/show_bug.cgi?id=77491 + + Reviewed by Simon Fraser. + + The new blend function added with r105403 takes unsigned as parameters therefore + we have to be careful to not overflow in case the to is less than from (animating + from 400 to 0 for example). + + Test: animations/animation-border-overflow.html + + * platform/animation/AnimationUtilities.h: + (WebCore::blend): + +2012-02-03 Justin Novosad <junov@chromium.org> + + [Chromium] ImageBufferSkia: remove unnecessary overload of flush in + AcceleratedDeviceContext + https://bugs.webkit.org/show_bug.cgi?id=77741 + + Reviewed by Stephen White. + + Removing dead code. + + * platform/graphics/skia/ImageBufferSkia.cpp: + (AcceleratedDeviceContext): + +2012-02-03 Balazs Kelemen <kbalazs@webkit.org> + + Speculative unreviewed build fix for Qt-Windows + after http://trac.webkit.org/changeset/106659. + + * platform/graphics/texmap/TextureMapper.h: + (WebCore::TextureMapper::platformCreateAccelerated): + +2012-02-03 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106654. + http://trac.webkit.org/changeset/106654 + https://bugs.webkit.org/show_bug.cgi?id=77742 + + triggers asserts on mac, win, gtk, qt debug bots (Requested by + philn-tp on #webkit). + + * Modules/intents/IntentRequest.cpp: + (WebCore::IntentRequest::create): + * bindings/generic/ActiveDOMCallback.cpp: + (WebCore::ActiveDOMCallback::ActiveDOMCallback): + * dom/ActiveDOMObject.cpp: + (WebCore::ActiveDOMObject::ActiveDOMObject): + (WebCore::ActiveDOMObject::~ActiveDOMObject): + * dom/ActiveDOMObject.h: + (ActiveDOMObject): + * dom/DocumentEventQueue.cpp: + (WebCore::DocumentEventQueue::DocumentEventQueue): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::ScriptExecutionContext): + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): + (WebCore::ScriptExecutionContext::stopActiveDOMObjects): + * dom/ScriptExecutionContext.h: + (ScriptExecutionContext): + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::create): + * fileapi/FileReader.cpp: + (WebCore): + * fileapi/FileReader.h: + (WebCore::FileReader::create): + * fileapi/FileWriter.cpp: + (WebCore): + * fileapi/FileWriter.h: + (WebCore::FileWriter::create): + * history/CachedFrame.cpp: + (WebCore::CachedFrame::CachedFrame): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::create): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::create): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::create): + * mediastream/PeerConnection.cpp: + (WebCore::PeerConnection::create): + * notifications/Notification.cpp: + (WebCore::Notification::create): + * notifications/NotificationCenter.cpp: + * notifications/NotificationCenter.h: + (WebCore::NotificationCenter::create): + * page/DOMTimer.cpp: + (WebCore::DOMTimer::install): + (WebCore::DOMTimer::fired): + * page/EventSource.cpp: + (WebCore::EventSource::create): + * page/SuspendableTimer.cpp: + (WebCore::SuspendableTimer::SuspendableTimer): + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::create): + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::create): + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::create): + * webaudio/AudioContext.cpp: + (WebCore::AudioContext::create): + * websockets/WebSocket.cpp: + * websockets/WebSocket.h: + (WebCore::WebSocket::create): + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::create): + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Add the "V8" prefix to V8 specific IDL attributes + https://bugs.webkit.org/show_bug.cgi?id=77713 + + Reviewed by Adam Barth. + + This patch adds the "V8" prefix to a V8 specific IDL attribute: + [EnabledAtRuntime] => [V8EnabledAtRuntime] + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateHeader): + (GenerateImplementation): + (GetRuntimeEnableFunctionName): + + * bindings/scripts/test/TestObj.idl: + * bindings/scripts/test/V8/V8TestObj.cpp: Updated the run-bindings-tests results. + (WebCore::ConfigureV8TestObjTemplate): + + * Modules/gamepad/NavigatorGamepad.idl: + * dom/Clipboard.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/MouseEvent.idl: + * dom/ShadowRoot.idl: + * html/HTMLInputElement.idl: + * html/HTMLMediaElement.idl: + * html/HTMLTrackElement.idl: + * html/TextTrack.idl: + * html/TextTrackCue.idl: + * html/TextTrackCueList.idl: + * html/shadow/HTMLContentElement.idl: + * html/track/TextTrackList.idl: + * html/track/TrackEvent.idl: + * page/DOMWindow.idl: + * page/History.idl: + * page/Navigator.idl: + * storage/DOMWindowSQLDatabase.idl: + * webaudio/DOMWindowWebAudio.idl: + * websockets/DOMWindowWebSocket.idl: + * workers/WorkerContext.idl: + * xml/XMLHttpRequest.idl: + +2012-02-03 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Retained size for classes is too conservative in heap profiler + https://bugs.webkit.org/show_bug.cgi?id=77726 + + Reviewed by Yury Semikhatsky. + + Makes retained size of all objects of particular class show correct value + in Summary view of heap profiler. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotConstructorNode.prototype.get data): + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshot.prototype._buildAggregates): + (WebInspector.HeapSnapshot.prototype._buildAggregates.forDominatedNodes): + +2012-02-02 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Introduce "Copy XPath" popup menu item for DOM elements + https://bugs.webkit.org/show_bug.cgi?id=77619 + + Reviewed by Vsevolod Vlasov. + + XPath is optimized whenever an element has the "id" attribute. + + Test: inspector/elements/node-xpath.xhtml + + * English.lproj/localizedStrings.js: + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMNode.XPathStep): + (WebInspector.DOMNode.XPathStep.prototype.toString): + (WebInspector.DOMNode.prototype.copyXPath): + (WebInspector.DOMNode.prototype.isXMLNode): + (WebInspector.DOMNode.prototype.xPath): + (WebInspector.DOMNode.prototype._xPathValue): + (WebInspector.DOMNode.prototype._xPathIndex): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeElement.prototype._populateNodeContextMenu): + +2012-02-03 Dana Jansens <danakj@chromium.org> + + [Chromium] Use the current clip when marking paints as opaque + https://bugs.webkit.org/show_bug.cgi?id=77582 + + Reviewed by Stephen White. + + New unit test in PlatformContextSkiaTest.cpp + + * platform/graphics/skia/OpaqueRegionSkia.cpp: + (WebCore::OpaqueRegionSkia::markRectAsOpaque): + * platform/graphics/skia/PlatformContextSkia.h: + (WebCore::PlatformContextSkia::canvas): + +2012-02-03 Yury Semikhatsky <yurys@chromium.org> + + inspector/debugger/pause-in-inline-script.html asserts in chromium debug + https://bugs.webkit.org/show_bug.cgi?id=77663 + + Make ASSERT in MainResourceLoader not fail if debugger hits breakpoint + in the main resource inline script. + + Reviewed by Pavel Feldman. + + Test: inspector/debugger/pause-in-inline-script.html + + * bindings/js/ScriptDebugServer.h: + (WebCore::ScriptDebugServer::isPaused): + (ScriptDebugServer): + * bindings/v8/ScriptDebugServer.h: + (ScriptDebugServer): + * inspector/InspectorDebuggerAgent.cpp: + (WebCore::InspectorDebuggerAgent::didClearMainFrameWindowObject): + (WebCore): + (WebCore::InspectorDebuggerAgent::isPaused): + * inspector/InspectorDebuggerAgent.h: + (InspectorDebuggerAgent): + * inspector/InspectorInstrumentation.cpp: + (WebCore::InspectorInstrumentation::isDebuggerPausedImpl): + (WebCore): + * inspector/InspectorInstrumentation.h: + (InspectorInstrumentation): + (WebCore::InspectorInstrumentation::isDebuggerPaused): + (WebCore): + * loader/MainResourceLoader.cpp: + (WebCore::MainResourceLoader::didFinishLoading): + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Fix typo + https://bugs.webkit.org/show_bug.cgi?id=77708 + + Reviewed by Adam Roben. + + This patch fixes typos: [ObjCLegacyUnamedParameters] => [ObjCLegacyUnnamedParameters] + + No tests. No change in behavior. + + * css/CSSMediaRule.idl: + * css/CSSPrimitiveValue.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleSheet.idl: + * dom/CharacterData.idl: + * dom/DOMImplementation.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/Event.idl: + * dom/EventTarget.idl: + * dom/MouseEvent.idl: + * dom/MutationEvent.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/Range.idl: + * dom/UIEvent.idl: + * html/HTMLSelectElement.idl: + * xml/XPathExpression.idl: + +2012-02-03 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Removed TextureMapperQt, and instead created a TextureMapperImageBuffer class, + which responds to an "Software" mode of TextureMapper, instead of creating subclasses + of TextureMapper directly. This allows using the software fallback of TextureMapper by any + sort. + + To make the ImageBuffer backend easier, content updates to BitmapTexture can now use either + an image, or a raw data pointer. The raw data pointer is provided for performance reasons, + as converting data to/from Image references in Qt generates unnecessary deep copies of the + image data. + + Also, functions that use TransformationMatrix were added to GraphicsContext, to allow for + 3D transforms in cross platform code. + After this patch everything renders the same. An additional bug report was created to allow + ImageBuffer shallow image copies: https://bugs.webkit.org/show_bug.cgi?id=77689 + + Covered extensively by existing tests, no behavioral changes. + + * Target.pri: + * platform/graphics/GraphicsContext.cpp: + * platform/graphics/GraphicsContext.h: + (WebCore): + (GraphicsContext): + * platform/graphics/cairo/TextureMapperCairo.cpp: + * platform/graphics/opengl/TextureMapperGL.cpp: + (TextureMapperGLData): + (BitmapTextureGL): + (WebCore::BitmapTextureGL::BitmapTextureGL): + (WebCore::TextureMapperGL::beginPainting): + (WebCore::BitmapTextureGL::reset): + (WebCore): + (WebCore::swizzleBGRAToRGBA): + (WebCore::BitmapTextureGL::updateContents): + (WebCore::BitmapTextureGL::destroy): + (WebCore::TextureMapperGL::bindSurface): + (WebCore::TextureMapper::platformCreateAccelerated): + * platform/graphics/opengl/TextureMapperGL.h: + (TextureMapperGL): + (WebCore::TextureMapperGL::accelerationMode): + (WebCore): + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore): + (WebCore::GraphicsContext::get3DTransform): + (WebCore::GraphicsContext::concat3DTransform): + (WebCore::GraphicsContext::set3DTransform): + * platform/graphics/qt/TextureMapperQt.cpp: Removed. + * platform/graphics/qt/TextureMapperQt.h: Removed. + * platform/graphics/texmap/TextureMapper.cpp: + (WebCore): + (BitmapTextureImageBuffer): + (TextureMapperImageBuffer): + * platform/graphics/texmap/TextureMapper.h: + (WebCore::BitmapTexture::BitmapTexture): + (BitmapTexture): + (WebCore::BitmapTexture::bpp): + (WebCore::BitmapTexture::isOpaque): + (WebCore::TextureMapper::setGraphicsContext): + (WebCore::TextureMapper::graphicsContext): + (TextureMapper): + (WebCore::TextureMapper::TextureMapper): + (WebCore::TextureMapper::platformCreateAccelerated): + * platform/graphics/texmap/TextureMapperNode.cpp: + (WebCore::TextureMapperNode::renderContent): + (WebCore::TextureMapperNode::setContentsTileBackBuffer): + * platform/graphics/texmap/TextureMapperNode.h: + (TextureMapperNode): + +2012-01-27 Yury Semikhatsky <yurys@chromium.org> + + Web Inspector: console evaluation doesn't work on breakpoint in pages with CSP + https://bugs.webkit.org/show_bug.cgi?id=77203 + + Inspector console evaluation now works when debugger is paused in a page with + content-security-policy prohibiting evals. + + Reviewed by Pavel Feldman. + + Test: inspector/debugger/eval-on-pause-blocked.html + + * bindings/js/JSInjectedScriptHostCustom.cpp: + * bindings/js/ScriptState.cpp: + (WebCore::evalEnabled): + (WebCore): + (WebCore::setEvalEnabled): + * bindings/js/ScriptState.h: + (WebCore): + * bindings/v8/ScriptObject.h: + (WebCore::ScriptObject::ScriptObject): + * bindings/v8/ScriptState.cpp: + (WebCore::evalEnabled): + (WebCore): + (WebCore::setEvalEnabled): + * bindings/v8/ScriptState.h: + (WebCore): + * bindings/v8/custom/V8InjectedScriptHostCustom.cpp: + * inspector/InjectedScript.cpp: + (WebCore::InjectedScript::makeCall): + * inspector/InjectedScriptHost.idl: + * inspector/InjectedScriptSource.js: + (.): + +2012-02-03 Rob Buis <rbuis@rim.com> + + Upstream targetType usage on ResourceRequest for BlackBerry port + https://bugs.webkit.org/show_bug.cgi?id=77649 + + Reviewed by Antonio Gomes. + + Upstream bits that make use of targetType enum. + + * loader/PingLoader.cpp: + (WebCore::PingLoader::loadImage): + (WebCore::PingLoader::sendPing): + (WebCore::PingLoader::reportContentSecurityPolicyViolation): + * platform/network/blackberry/ResourceRequest.h: + (ResourceRequest): + (WebCore::ResourceRequest::targetType): + (WebCore::ResourceRequest::setTargetType): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::createRequest): + +2012-02-03 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Ensure timers and other active DOM objects do not fire in suspended documents. + https://bugs.webkit.org/show_bug.cgi?id=53733 + + ScriptExecutionContext now remembers it has suspended active DOM objects + and suspends all newly installed active DOM objects as well. + + All create-calls active DOM objects now calls the post constructor method + suspendIfNeeded that updates the suspend state. It is post constructor + because the suspend/resume functions are virtual and thus can not be called + from constructors. + + Reviewed by Mihai Parparita. + + Test: fast/events/suspend-timers.html + + * Modules/intents/IntentRequest.cpp: + (WebCore::IntentRequest::create): + * bindings/generic/ActiveDOMCallback.cpp: + (WebCore::ActiveDOMCallback::ActiveDOMCallback): + * dom/ActiveDOMObject.cpp: + (WebCore::ActiveDOMObject::ActiveDOMObject): + (WebCore::ActiveDOMObject::~ActiveDOMObject): + (WebCore::ActiveDOMObject::suspendIfNeeded): + * dom/ActiveDOMObject.h: + (WebCore::ActiveDOMObject::suspendIfNeededCalled): + * dom/DocumentEventQueue.cpp: + (WebCore::DocumentEventQueue::DocumentEventQueue): + * dom/ScriptExecutionContext.cpp: + (WebCore::ScriptExecutionContext::ScriptExecutionContext): + (WebCore::ScriptExecutionContext::~ScriptExecutionContext): + (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjects): + (WebCore::ScriptExecutionContext::resumeActiveDOMObjects): + (WebCore::ScriptExecutionContext::stopActiveDOMObjects): + (WebCore::ScriptExecutionContext::suspendActiveDOMObjectIfNeeded): + * dom/ScriptExecutionContext.h: + (WebCore::ScriptExecutionContext::activeDOMObjectsAreSuspended): + * fileapi/DOMFileSystem.cpp: + (WebCore::DOMFileSystem::create): + * fileapi/FileReader.cpp: + (WebCore::FileReader::create): + * fileapi/FileReader.h: + * fileapi/FileWriter.cpp: + (WebCore::FileWriter::create): + * fileapi/FileWriter.h: + * history/CachedFrame.cpp: + (WebCore::CachedFrame::CachedFrame): + * html/HTMLAudioElement.cpp: + (WebCore::HTMLAudioElement::create): + * html/HTMLMarqueeElement.cpp: + (WebCore::HTMLMarqueeElement::create): + * html/HTMLVideoElement.cpp: + (WebCore::HTMLVideoElement::create): + * mediastream/PeerConnection.cpp: + (WebCore::PeerConnection::create): + * notifications/Notification.cpp: + (WebCore::Notification::create): + * notifications/NotificationCenter.cpp: + (WebCore::NotificationCenter::create): + * notifications/NotificationCenter.h: + * page/DOMTimer.cpp: + (WebCore::DOMTimer::install): + (WebCore::DOMTimer::fired): + * page/EventSource.cpp: + (WebCore::EventSource::create): + * page/SuspendableTimer.cpp: + (WebCore::SuspendableTimer::SuspendableTimer): + * storage/IDBDatabase.cpp: + (WebCore::IDBDatabase::create): + * storage/IDBRequest.cpp: + (WebCore::IDBRequest::create): + * storage/IDBTransaction.cpp: + (WebCore::IDBTransaction::create): + * webaudio/AudioContext.cpp: + (WebCore::AudioContext::create): + * websockets/WebSocket.cpp: + (WebCore::WebSocket::create): + * websockets/WebSocket.h: + * workers/SharedWorker.cpp: + (WebCore::SharedWorker::create): + * workers/Worker.cpp: + (WebCore::Worker::create): + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::create): + +2012-02-03 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Do not ASSERT on TouchStationary TouchPoint state. + https://bugs.webkit.org/show_bug.cgi?id=77620 + + Reviewed by Kenneth Rohde Christiansen. + + * page/EventHandler.cpp: + (WebCore::eventNameForTouchPointState): Explicitly show that TouchStationary is asserted. + (WebCore::EventHandler::handleTouchEvent): + Remove TouchStationary from ASSERT. The value of HitTestRequest is restored to the + value it should have if hittested, but is not used. + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Add the "ObjC" prefix to ObjC specific IDL attributes + https://bugs.webkit.org/show_bug.cgi?id=77708 + + Reviewed by Adam Barth. + + This patch adds the "ObjC" prefix to ObjC specific IDL attributes, as follows: + + [Polymorphic] => [ObjCPolymorphic] + [OldStyleObjC] => [ObjCLegacyUnamedParameters] + [UsesView] => [ObjCUseDefaultView] (Note: Renamed for clarification) + + No tests. No changes in behavior. + + * bindings/scripts/CodeGeneratorObjC.pm: + (GenerateHeader): + (GenerateImplementation): + * css/CSSMediaRule.idl: + * css/CSSPrimitiveValue.idl: + * css/CSSRule.idl: + * css/CSSStyleDeclaration.idl: + * css/CSSStyleSheet.idl: + * css/CSSValue.idl: + * css/StyleSheet.idl: + * dom/CharacterData.idl: + * dom/DOMImplementation.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/Event.idl: + * dom/EventTarget.idl: + * dom/MouseEvent.idl: + * dom/MutationEvent.idl: + * dom/NamedNodeMap.idl: + * dom/Node.idl: + * dom/Range.idl: + * dom/UIEvent.idl: + * html/HTMLCollection.idl: + * html/HTMLSelectElement.idl: + * svg/SVGPathSeg.idl: + * xml/XPathExpression.idl: + +2012-02-03 MORITA Hajime <morrita@google.com> + + TypingCommand should be prepared against detached document. + https://bugs.webkit.org/show_bug.cgi?id=77216 + + Reviewed by Ryosuke Niwa. + + Added null checks for document()->frame(). + + No new tests. Just tighten guards for possible codepaths. + + * editing/TypingCommand.cpp: + (WebCore::TypingCommand::markMisspellingsAfterTyping): + (WebCore::TypingCommand::typingAddedToOpenCommand): + (WebCore::TypingCommand::deleteKeyPressed): + (WebCore::TypingCommand::forwardDeleteKeyPressed): + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Rename [DontEnum] IDL to [NotEnumerable] IDL + https://bugs.webkit.org/show_bug.cgi?id=77710 + + Reviewed by Adam Barth. + + [DontEnum] is a negation of [[Enumerable]] in the ECMAScript spec + (8.6.1 of http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf). + This patch renames [DontEnum] to [NotEnumerable]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateAttributesHashTable): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + + * css/WebKitCSSMatrix.idl: + * dom/DOMCoreException.idl: + * dom/Document.idl: + * dom/Element.idl: + * dom/EventException.idl: + * dom/RangeException.idl: + * fileapi/FileException.idl: + * fileapi/OperationNotAllowedException.idl: + * html/DOMTokenList.idl: + * html/HTMLAnchorElement.idl: + * html/HTMLBodyElement.idl: + * html/HTMLFrameSetElement.idl: + * html/HTMLInputElement.idl: + * page/DOMSelection.idl: + * page/DOMWindow.idl: + * page/Location.idl: + * storage/IDBDatabaseException.idl: + * storage/Storage.idl: + * svg/SVGElementInstance.idl: + * svg/SVGException.idl: + * workers/WorkerLocation.idl: + * xml/XMLHttpRequestException.idl: + * xml/XPathException.idl: + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Rename [InitializedByConstructor] IDL to [InitializedByEventConstructor] IDL + https://bugs.webkit.org/show_bug.cgi?id=77711 + + Reviewed by Adam Barth. + + [InitializedByConstructor] can be used only when [ConstructorTemplate=Event] + is specified on the interface. This patch renames [InitializedByConstructor] to + [InitializedByEventConstructor] for clarification. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateConstructorDefinition): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateEventConstructorCallback): + + * bindings/scripts/test/TestEventConstructor.idl: + * bindings/scripts/test/V8/V8TestEventConstructor.cpp: Updated the run-bindings-tests results. + (WebCore): + + * dom/BeforeLoadEvent.idl: + * dom/CustomEvent.idl: + * dom/ErrorEvent.idl: + * dom/Event.idl: + * dom/HashChangeEvent.idl: + * dom/MessageEvent.idl: + * dom/OverflowEvent.idl: + * dom/PageTransitionEvent.idl: + * dom/PopStateEvent.idl: + * dom/ProgressEvent.idl: + * dom/WebKitAnimationEvent.idl: + * dom/WebKitTransitionEvent.idl: + * html/canvas/WebGLContextEvent.idl: + * html/track/TrackEvent.idl: + * storage/StorageEvent.idl: + * websockets/CloseEvent.idl: + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Add the "CPP" prefix to CPP specific IDL attributes + https://bugs.webkit.org/show_bug.cgi?id=77707 + + Reviewed by Adam Barth. + + This patch adds the "CPP" prefix to a CPP specific IDL attribute. + Specifically, this patch renames [PureInterface] to [CPPPureInterface] + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorCPP.pm: + (GenerateHeader): + (GenerateImplementation): + * css/MediaQueryListListener.idl: + * dom/EventListener.idl: + * dom/EventTarget.idl: + * dom/NodeFilter.idl: + +2012-01-27 Alexander Pavlov <apavlov@chromium.org> + + Implement touch event emulation in the WebCore layer + https://bugs.webkit.org/show_bug.cgi?id=77105 + + Reviewed by Ryosuke Niwa. + + This change essentially maps mouse events into single-touch events in the following way: + - mousedown -> touchstart + - mouseup -> touchend + - mousemove -> touchmove (between mousedown and mouseup). + + Test: fast/events/touch/emulate-touch-events.html + + * page/EventHandler.cpp: + (SyntheticTouchPoint): A synthetic touch point built from PlatformMouseEvent. + (WebCore::SyntheticTouchPoint::SyntheticTouchPoint): + (SyntheticSingleTouchEvent): A synthetic touch point event built from PlatformMouseEvent. + (WebCore::SyntheticSingleTouchEvent::SyntheticSingleTouchEvent): + (WebCore::EventHandler::handleMouseReleaseEvent): Invoke maybeDispatchSyntheticTouchEvent() and bail out if necessary. + (WebCore::EventHandler::handleMousePressEvent): Invoke maybeDispatchSyntheticTouchEvent() and bail out if necessary. + (WebCore::EventHandler::mouseMoved): Invoke maybeDispatchSyntheticTouchEvent() and bail out if necessary. + (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled): Dispatch a synthetic touch event if necessary. + * page/EventHandler.h: Added new method. + * page/Settings.cpp: + (WebCore::Settings::Settings): Added m_touchEventEmulationEnabled initializer. + * page/Settings.h: Added m_touchEventEmulationEnabled, getter, and setter. + (WebCore::Settings::setTouchEventEmulationEnabled): Added. + (WebCore::Settings::isTouchEventEmulationEnabled): Added. + * platform/PlatformTouchPoint.h: + (WebCore::PlatformTouchPoint::PlatformTouchPoint): Unconditionally compile the parameterless ctor. + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::setTouchEventEmulationEnabled): Added for testing. + * testing/InternalSettings.h: Added setTouchEventEmulationEnabled() for testing. + * testing/InternalSettings.idl: Added setTouchEventEmulationEnabled() for testing. + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Remove [NoCPPCustom] IDL + https://bugs.webkit.org/show_bug.cgi?id=77704 + + Reviewed by Adam Barth. + + This patch removes [NoCPPCustom], by replacing [Custom, NoCPPCustom] + in HTMLDocument.idl with [JSCCustom, V8Custom]. + + No tests. No change in behavior. + + * bindings/scripts/CodeGeneratorCPP.pm: + (ShouldSkipType): + * html/HTMLDocument.idl: + +2012-02-03 Kentaro Hara <haraken@chromium.org> + + Remove [LegacyParent] from CodeGeneratorGObject.pm, and rename it to [JSLegacyParent] + https://bugs.webkit.org/show_bug.cgi?id=77706 + + Reviewed by Adam Barth. + + This patch removes dead code about [LegacyParent] from CodeGeneratorGObject.pm, + and renames [LegacyParent] to [JSLegacyParent]. + + No tests. No changes in behavior. + + * bindings/scripts/CodeGeneratorGObject.pm: + (Generate): + * bindings/scripts/CodeGeneratorJS.pm: + (GetParentClassName): + (GenerateHeader): + (GenerateImplementation): + * page/DOMWindow.idl: + * workers/WorkerContext.idl: + +2012-02-03 Pavel Feldman <pfeldman@google.com> + + Web Inspector: preserve elements panel selection upon node drag'n'drop + https://bugs.webkit.org/show_bug.cgi?id=77722 + + Reviewed by Vsevolod Vlasov. + + Test: inspector/elements/move-node.html + + * inspector/front-end/DOMAgent.js: + (WebInspector.DOMAgent.prototype._markRevision): + * inspector/front-end/ElementsTreeOutline.js: + (WebInspector.ElementsTreeOutline.prototype._ondrop): + (WebInspector.ElementsTreeOutline.prototype._doMove.callback): + (WebInspector.ElementsTreeOutline.prototype._doMove): + +2012-02-03 Shinya Kawanaka <shinyak@google.com> + + Reimplement DETAILS and SUMMARY using selector query. + https://bugs.webkit.org/show_bug.cgi?id=75930 + + Reviewed by Hajime Morita. + + DETAILS is reimplemented using content element and its fallback feature. + We don't need to recreate DOM even if SUMMARY is removed from or added into DETAILS. + + No new tests, should be covered by existing tests. + + * html/HTMLDetailsElement.cpp: + (WebCore::DetailsSummaryElement::fallbackSummary): + Takes fallback element of content summary. + (DetailsSummaryElement): + (WebCore::DetailsSummaryElement::create): + Creates a fallback element also. + (WebCore): + (WebCore::HTMLDetailsElement::create): + (WebCore::HTMLDetailsElement::HTMLDetailsElement): + (WebCore::HTMLDetailsElement::createShadowSubtree): + (WebCore::HTMLDetailsElement::findMainSummary): + (WebCore::HTMLDetailsElement::parseMappedAttribute): + (WebCore::HTMLDetailsElement::childShouldCreateRenderer): + (WebCore::HTMLDetailsElement::toggleOpen): + * html/HTMLDetailsElement.h: + (HTMLDetailsElement): + * html/HTMLSummaryElement.cpp: + (WebCore::HTMLSummaryElement::isMainSummary): + +2012-02-03 Jochen Eisinger <jochen@chromium.org> + + Crash when trying to add a timer to a detached document. + https://bugs.webkit.org/show_bug.cgi?id=77692 + + Reviewed by Alexey Proskuryakov. + + In http://webkit.org/b/77370, a timer is fired on a detached document. + Since a document clears all timers when it is detached, and it + shouldn't be possible to add a timer to a detached document, we crash + if this should happen anyway. This will hopefully result in an easier + to debug crash dump. + + * page/DOMTimer.cpp: + (WebCore::DOMTimer::DOMTimer): + +2012-02-03 Shinya Kawanaka <shinyak@google.com> + + Stop calling Element::ensureShadowRoot in Internals. + https://bugs.webkit.org/show_bug.cgi?id=77612 + + Reviewed by Hajime Morita. + + We want to check a shadow root is built-in or created by users to support multiple shadow subtrees. + But Element::ensureShadowRoot() makes it difficult, because it doesn't care about the returning shadow element + is built-in or user generated, so let's remove Element::ensureShadowRoot(). + + As a first step, this patch removes ensureShadowRoot() in Internals. + + No new tests, because no changes in behavior. + + * WebCore.exp.in: + * testing/Internals.cpp: + (WebCore::Internals::ensureShadowRoot): + +2012-02-02 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Always show percents together with counters in heap inspector. + https://bugs.webkit.org/show_bug.cgi?id=77434 + + Reviewed by Pavel Feldman. + + * inspector/front-end/DetailedHeapshotGridNodes.js: + (WebInspector.HeapSnapshotGridNode.prototype._toPercentString): + (WebInspector.HeapSnapshotGridNode.prototype._createValueCell): + (WebInspector.HeapSnapshotGenericObjectNode.prototype.createCell): + (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data): + (WebInspector.HeapSnapshotConstructorNode.prototype.createCell): + (WebInspector.HeapSnapshotConstructorNode.prototype.get data): + (WebInspector.HeapSnapshotDiffNode.prototype.get data): + * inspector/front-end/DetailedHeapshotView.js: + (WebInspector.HeapSnapshotContainmentDataGrid): + (WebInspector.HeapSnapshotConstructorsDataGrid): + (WebInspector.HeapSnapshotDiffDataGrid): + (WebInspector.HeapSnapshotDominatorsDataGrid): + (WebInspector.DetailedHeapshotView.prototype._mouseDownInContentsGrid): + (WebInspector.DetailedHeapshotView.prototype.get _isShowingAsPercent): + (WebInspector.DetailedHeapshotView.prototype._percentClicked): + * inspector/front-end/heapProfiler.css: + (.detailed-heapshot-view .data-grid span.percent-column): + +2012-02-02 Matt Falkenhagen <falken@chromium.org> + + Use content-language from http-equiv to set document locale and font + https://bugs.webkit.org/show_bug.cgi?id=76701 + + Reviewed by Darin Adler. + + So far, only content-language set through http-equiv is used; the HTTP Content-Language + header is not yet supported. + + Tests: fast/text/content-language-case-insensitivity.html + fast/text/content-language-mapped-to-webkit-locale.html + fast/text/international/content-language-font-selection-expected.html + fast/text/international/content-language-font-selection.html + fast/text/international/content-language-with-subtags-expected.html + fast/text/international/content-language-with-subtags.html + + * css/CSSStyleSelector.cpp: + (WebCore::CSSStyleSelector::styleForDocument): Use content language when selecting initial font. + * dom/Document.cpp: + (WebCore::Document::setContentLanguage): Recalculate style so language is taken into account. + (WebCore): + * dom/Document.h: + (Document): + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106620. + http://trac.webkit.org/changeset/106620 + https://bugs.webkit.org/show_bug.cgi?id=77716 + + It broke non ENABLE(3D_RENDERING) builds (Requested by + Ossy_morning on #webkit). + + * GNUmakefile.list.am: + * Target.pri: + * WebCore.gypi: + * platform/graphics/GraphicsContext.h: + (WebCore): + (GraphicsContext): + * platform/graphics/cairo/TextureMapperCairo.cpp: + (WebCore::TextureMapper::create): + (WebCore): + * platform/graphics/opengl/TextureMapperGL.cpp: + (Entry): + (DirectlyCompositedImageRepository): + (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::findOrCreate): + (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::deref): + (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::DirectlyCompositedImageRepository): + (WebCore::TextureMapperGLData::DirectlyCompositedImageRepository::~DirectlyCompositedImageRepository): + (TextureMapperGLData): + (BitmapTextureGL): + (WebCore::BitmapTextureGL::isOpaque): + (WebCore::BitmapTextureGL::pack): + (WebCore::BitmapTextureGL::unpack): + (WebCore::BitmapTextureGL::isPacked): + (WebCore::BitmapTextureGL::BitmapTextureGL): + (WebCore::TextureMapperGL::beginPainting): + (WebCore::BitmapTextureGL::reset): + (WebCore::BitmapTextureGL::beginPaint): + (WebCore::BitmapTextureGL::endPaint): + (WebCore): + (WebCore::BitmapTextureGL::updateContents): + (WebCore::BitmapTextureGL::updateRawContents): + (WebCore::BitmapTextureGL::setContentsToImage): + (WebCore::BitmapTextureGL::destroy): + (WebCore::TextureMapperGL::bindSurface): + * platform/graphics/opengl/TextureMapperGL.h: + (TextureMapperGL): + (WebCore::TextureMapperGL::allowSurfaceForRoot): + (BGRA32PremultimpliedBuffer): + (WebCore::BGRA32PremultimpliedBuffer::~BGRA32PremultimpliedBuffer): + (WebCore): + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): + * platform/graphics/qt/GraphicsContextQt.cpp: + * platform/graphics/qt/TextureMapperQt.cpp: Added. + (WebCore): + (WebCore::BitmapTextureQt::destroy): + (WebCore::BitmapTextureQt::reset): + (WebCore::BitmapTextureQt::beginPaint): + (WebCore::BitmapTextureQt::endPaint): + (WebCore::BitmapTextureQt::updateContents): + (WebCore::BitmapTextureQt::save): + (WebCore::BitmapTextureQt::setContentsToImage): + (WebCore::BitmapTextureQt::pack): + (WebCore::BitmapTextureQt::unpack): + (WebCore::TextureMapperQt::beginClip): + (WebCore::TextureMapperQt::endClip): + (WebCore::TextureMapperQt::viewportSize): + (WebCore::TextureMapperQt::TextureMapperQt): + (WebCore::TextureMapperQt::setGraphicsContext): + (WebCore::TextureMapperQt::graphicsContext): + (WebCore::TextureMapperQt::bindSurface): + (WebCore::TextureMapperQt::drawTexture): + (WebCore::TextureMapper::create): + (WebCore::TextureMapperQt::createTexture): + (WebCore::BitmapTextureQt::BitmapTextureQt): + (WebCore::TextureMapperQt::beginPainting): + (WebCore::TextureMapperQt::endPainting): + (BGRA32PremultimpliedBufferQt): + (WebCore::BGRA32PremultimpliedBufferQt::beginPaint): + (WebCore::BGRA32PremultimpliedBufferQt::endPaint): + (WebCore::BGRA32PremultimpliedBufferQt::data): + (WebCore::BGRA32PremultimpliedBuffer::create): + (WebCore::uidForImage): + * platform/graphics/qt/TextureMapperQt.h: Added. + (WebCore): + (BitmapTextureQt): + (WebCore::BitmapTextureQt::~BitmapTextureQt): + (WebCore::BitmapTextureQt::size): + (WebCore::BitmapTextureQt::isValid): + (WebCore::BitmapTextureQt::sourceRect): + (WebCore::BitmapTextureQt::isPacked): + (WebCore::BitmapTextureQt::painter): + (TextureMapperQt): + (WebCore::TextureMapperQt::allowSurfaceForRoot): + (WebCore::TextureMapperQt::initialize): + (WebCore::TextureMapperQt::create): + (WebCore::TextureMapperQt::currentPainter): + * platform/graphics/texmap/TextureMapper.cpp: + * platform/graphics/texmap/TextureMapper.h: + (WebCore::BitmapTexture::BitmapTexture): + (WebCore::BitmapTexture::allowOfflineTextureUpload): + (BitmapTexture): + (WebCore::BitmapTexture::pack): + (WebCore::BitmapTexture::unpack): + (WebCore::BitmapTexture::isPacked): + (WebCore::BitmapTexture::updateRawContents): + (WebCore::BitmapTexture::beginPaintMedia): + (WebCore::BitmapTexture::save): + (WebCore::BitmapTexture::lock): + (WebCore::BitmapTexture::unlock): + (WebCore::BitmapTexture::isLocked): + (TextureMapper): + (WebCore::TextureMapper::viewportSize): + (WebCore::TextureMapper::setViewportSize): + (WebCore::TextureMapper::allowPartialUpdates): + (WebCore::TextureMapper::isOpenGLBacked): + (WebCore::TextureMapper::setTransform): + (WebCore::TextureMapper::transform): + * platform/graphics/texmap/TextureMapperImageBuffer.cpp: Removed. + * platform/graphics/texmap/TextureMapperImageBuffer.h: Removed. + * platform/graphics/texmap/TextureMapperNode.cpp: + (WebCore::TextureMapperNode::renderContent): + (WebCore::TextureMapperNode::setContentsTileBackBuffer): + * platform/graphics/texmap/TextureMapperNode.h: + (TextureMapperNode): + +2012-02-02 Keishi Hattori <keishi@webkit.org> + + ColorInputType needs to use ensureInlineStyleDecl + https://bugs.webkit.org/show_bug.cgi?id=77699 + + Reviewed by Kent Tamura. + + Because WebCore internally should use the more specific CSSMutableStyleDeclaration + http://trac.webkit.org/changeset/105739 + + * html/ColorInputType.cpp: + (WebCore::ColorInputType::updateColorSwatch): + +2012-02-02 Roland Steiner <rolandsteiner@chromium.org> + + Simplify SelectorChecker::checkSelector and checkOneSelector + https://bugs.webkit.org/show_bug.cgi?id=77697 + + Make use of Element::previous/nextElementSibling. + Made those methods inline. + Simplify code in checkSelector and checkOneSelector, esp. for first/nth/nth-last/last/only-child implementations. + + Reviewed by Andreas Kling. + + No new tests. (refactoring) + + * css/SelectorChecker.cpp: + (WebCore::SelectorChecker::checkSelector): + (WebCore::SelectorChecker::checkOneSelector): + * dom/Element.cpp: + * dom/Element.h: + (WebCore::Element::previousElementSibling): + (WebCore): + (WebCore::Element::nextElementSibling): + +2012-02-02 Keishi Hattori <keishi@webkit.org> + + ColorChooserClient is missing a virtual destructor + https://bugs.webkit.org/show_bug.cgi?id=77698 + + Reviewed by Kent Tamura. + + * platform/ColorChooserClient.h: + (WebCore::ColorChooserClient::~ColorChooserClient): Added. + +2012-02-02 Keishi Hattori <keishi@webkit.org> + + Remove OVERRIDE from ColorInputType::valueAsColor + https://bugs.webkit.org/show_bug.cgi?id=77701 + + Reviewed by Kent Tamura. + + * html/ColorInputType.h: + (WebCore::ColorInputType::valueAsColor): + +2012-02-02 Bear Travis <betravis@adobe.com> + + Support 'disabled' attribute on SVGStyleElement + https://bugs.webkit.org/show_bug.cgi?id=52130 + + Adding disabled property to SVGStyleElement, which + mirrors the functionality added to HTMLStyleElement + for DOM1. The disabled property reflects and sets + the disabled state of its style sheet. + + Based off of patch for bug 25287 + + Reviewed by Dirk Schulze. + + Test: svg/dom/SVGStyleElement/disable-svg-style-element.html + + * svg/SVGStyleElement.cpp: + (WebCore::SVGStyleElement::disabled): + (WebCore): + (WebCore::SVGStyleElement::setDisabled): + * svg/SVGStyleElement.h: + (SVGStyleElement): + * svg/SVGStyleElement.idl: + +2012-02-02 Hayato Ito <hayato@chromium.org> + + Make ShadowRoot interface inherit DocumentFragment interface in IDL. + https://bugs.webkit.org/show_bug.cgi?id=77511 + + Reviewed by Kentaro Hara. + + This patch contains only the change of IDL to isolate issues. + Other changes, such as tests for querySelector of ShadowRoot, will be added in follow-up patches. + + No tests. No change in behavior. + + * dom/ShadowRoot.idl: + +2012-02-02 Raymond Toy <rtoy@google.com> + + Check parameters to biquad filters + https://bugs.webkit.org/show_bug.cgi?id=71413 + + Reviewed by Kenneth Russell. + + Tests added for each filter type and for the limiting cases for + each filter type. + + * platform/audio/Biquad.cpp: + (WebCore::Biquad::setLowpassParams): + (WebCore::Biquad::setHighpassParams): + (WebCore::Biquad::setLowShelfParams): + (WebCore::Biquad::setHighShelfParams): + (WebCore::Biquad::setPeakingParams): + (WebCore::Biquad::setAllpassParams): + (WebCore::Biquad::setNotchParams): + (WebCore::Biquad::setBandpassParams): + Check for invalid parameters and clip them to something sensible. + Also check for the limiting cases and try to use the limiting form + of the z-transform for the biquad. Some issues cannot be + consistently handled because the z-transform is not continuous as + the parameters approach the limit. + +2012-02-02 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Removed TextureMapperQt, and instead created a TextureMapperImageBuffer class, + which responds to an "Software" mode of TextureMapper, instead of creating subclasses + of TextureMapper directly. This allows using the software fallback of TextureMapper by any + sort. + + To make the ImageBuffer backend easier, content updates to BitmapTexture can now use either + an image, or a raw data pointer. The raw data pointer is provided for performance reasons, + as converting data to/from Image references in Qt generates unnecessary deep copies of the + image data. + + Also, functions that use TransformationMatrix were added to GraphicsContext, to allow for + 3D transforms in cross platform code. + After this patch everything renders the same. An additional bug report was created to allow + ImageBuffer shallow image copies: https://bugs.webkit.org/show_bug.cgi?id=77689 + + Covered extensively by existing tests, no behavioral changes. + + * Target.pri: + * platform/graphics/GraphicsContext.cpp: + * platform/graphics/GraphicsContext.h: + (WebCore): + (GraphicsContext): + * platform/graphics/cairo/TextureMapperCairo.cpp: + * platform/graphics/opengl/TextureMapperGL.cpp: + (TextureMapperGLData): + (BitmapTextureGL): + (WebCore::BitmapTextureGL::BitmapTextureGL): + (WebCore::TextureMapperGL::beginPainting): + (WebCore::BitmapTextureGL::reset): + (WebCore): + (WebCore::swizzleBGRAToRGBA): + (WebCore::BitmapTextureGL::updateContents): + (WebCore::BitmapTextureGL::destroy): + (WebCore::TextureMapperGL::bindSurface): + (WebCore::TextureMapper::platformCreateAccelerated): + * platform/graphics/opengl/TextureMapperGL.h: + (TextureMapperGL): + (WebCore::TextureMapperGL::accelerationMode): + (WebCore): + * platform/graphics/qt/GraphicsContext3DQt.cpp: + (WebCore::GraphicsContext3DPrivate::paintToTextureMapper): + * platform/graphics/qt/GraphicsContextQt.cpp: + (WebCore): + (WebCore::GraphicsContext::get3DTransform): + (WebCore::GraphicsContext::concat3DTransform): + (WebCore::GraphicsContext::set3DTransform): + * platform/graphics/qt/TextureMapperQt.cpp: Removed. + * platform/graphics/qt/TextureMapperQt.h: Removed. + * platform/graphics/texmap/TextureMapper.cpp: + (WebCore): + (BitmapTextureImageBuffer): + (TextureMapperImageBuffer): + * platform/graphics/texmap/TextureMapper.h: + (WebCore::BitmapTexture::BitmapTexture): + (BitmapTexture): + (WebCore::BitmapTexture::bpp): + (WebCore::BitmapTexture::isOpaque): + (WebCore::TextureMapper::setGraphicsContext): + (WebCore::TextureMapper::graphicsContext): + (TextureMapper): + (WebCore::TextureMapper::TextureMapper): + (WebCore::TextureMapper::platformCreateAccelerated): + * platform/graphics/texmap/TextureMapperNode.cpp: + (WebCore::TextureMapperNode::renderContent): + (WebCore::TextureMapperNode::setContentsTileBackBuffer): + * platform/graphics/texmap/TextureMapperNode.h: + (TextureMapperNode): + +2012-02-02 Adam Barth <abarth@webkit.org> + + Rename checkNodeSecurity and allowsAccessFromFrame to have sensible names + https://bugs.webkit.org/show_bug.cgi?id=75796 + + Reviewed by Eric Seidel. + + As requested by Darin Adler, this patch renames these functions be + clear that we're asking whether the access should be allowed rather + than explicitly allowing the access. + + * bindings/generic/BindingSecurity.h: + (BindingSecurity): + (WebCore::::shouldAllowAccessToNode): + (WebCore::::allowSettingFrameSrcToJavascriptUrl): + * bindings/js/JSDOMBinding.cpp: + (WebCore::shouldAllowAccessToNode): + (WebCore::shouldAllowAccessToFrame): + * bindings/js/JSDOMBinding.h: + (WebCore): + * bindings/js/JSHTMLFrameElementCustom.cpp: + (WebCore::allowSettingJavascriptURL): + * bindings/js/JSHistoryCustom.cpp: + (WebCore::JSHistory::getOwnPropertySlotDelegate): + (WebCore::JSHistory::getOwnPropertyDescriptorDelegate): + (WebCore::JSHistory::putDelegate): + (WebCore::JSHistory::deleteProperty): + (WebCore::JSHistory::getOwnPropertyNames): + * bindings/js/JSLocationCustom.cpp: + (WebCore::JSLocation::getOwnPropertySlotDelegate): + (WebCore::JSLocation::getOwnPropertyDescriptorDelegate): + (WebCore::JSLocation::putDelegate): + (WebCore::JSLocation::deleteProperty): + (WebCore::JSLocation::getOwnPropertyNames): + (WebCore::JSLocation::toStringFunction): + * bindings/js/ScriptController.cpp: + (WebCore::ScriptController::canAccessFromCurrentOrigin): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateGetOwnPropertyDescriptorBody): + (GenerateImplementation): + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateFunctionCallback): + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: + (WebCore::JSTestActiveDOMObject::getOwnPropertyDescriptor): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::jsTestObjContentDocument): + (WebCore::jsTestObjPrototypeFunctionGetSVGDocument): + * bindings/scripts/test/V8/V8TestObj.cpp: + (WebCore::TestObjInternal::contentDocumentAttrGetter): + (WebCore::TestObjInternal::getSVGDocumentCallback): + +2012-02-02 Kalev Lember <kalevlember@gmail.com> + + [GTK] Make gtk+ symbols available to WidgetBackingStoreCairo.cpp + https://bugs.webkit.org/show_bug.cgi?id=77679 + + WidgetBackingStoreCairo.cpp uses GTK+ symbols, so we need it in + webcoregtk_sources instead of webcore_sources. + + Reviewed by Martin Robinson. + + * GNUmakefile.list.am: Move WidgetBackingStoreCairo.cpp to webcoregtk. + +2012-02-02 Shinya Kawanaka <shinyak@google.com> + + StyleRecalc should occur when shadow root exists and light children are changed. + https://bugs.webkit.org/show_bug.cgi?id=76262 + + Reviewed by Hajime Morita. + + When light children is changed, the element included in HTMLContentElement may also be changed. + So we have to recalculate inclusion of content element again. + + Test: fast/dom/shadow/shadow-contents-fallback-dynamic.html + + * dom/Element.cpp: + (WebCore::Element::childrenChanged): + +2012-02-02 Ami Fischman <fischman@chromium.org> + + Avoid crashing renderer when GPU process dies by not caching textures between video frames. + https://bugs.webkit.org/show_bug.cgi?id=77654 + + Reviewed by James Robinson. + + * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: + (WebCore::CCVideoLayerImpl::draw): + +2012-02-02 Anders Carlsson <andersca@apple.com> + + Add ScrollingTree class + https://bugs.webkit.org/show_bug.cgi?id=77695 + + Reviewed by Andreas Kling. + + * WebCore.xcodeproj/project.pbxproj: + Add new files. + + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::ScrollingCoordinator): + Create a scrolling tree. + + (WebCore::ScrollingCoordinator::~ScrollingCoordinator): + Assert that the scrolling tree is null. + + (WebCore::ScrollingCoordinator::pageDestroyed): + Null out the scrolling tree member variable and tell it to invalidate itself. + + * page/scrolling/ScrollingTree.cpp: Added. + + (WebCore::ScrollingTree::invalidate): + Null out the scrolling coordinator, breaking the reference cycle between the scrolling + coordinator and the scrolling tree. + + * page/scrolling/ScrollingTree.h: Added. + +2012-02-02 Tim Dresser <tdresser@chromium.org> + + Refactor plugin drawing to be more data driven + https://bugs.webkit.org/show_bug.cgi?id=76715 + + Reviewed by James Robinson. + + CCPluginLayerImpl no longer handles drawing itself, but produces a list of CCPluginDrawQuads. + These quads are then drawn by LayerRendererChromium. + + CCLayerImpl::willDraw(LayerRendererChromium*) is called directly before appendQuads. + This allows for CCLayerImpl objects to allocate textures before appendQuads is called. + + This is a refactor, so no new tests were added. + Flash was tested manually on Linux and Mac. + + * platform/graphics/chromium/LayerRendererChromium.cpp: + (WebCore::PluginProgramBinding::set): + (PluginProgramBinding): + (WebCore): + (WebCore::TexStretchPluginProgramBinding::set): + (TexStretchPluginProgramBinding): + (WebCore::TexTransformPluginProgramBinding::set): + (TexTransformPluginProgramBinding): + (WebCore::LayerRendererChromium::drawPluginQuad): + * platform/graphics/chromium/cc/CCLayerImpl.h: + (WebCore::CCLayerImpl::willDraw): + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: + (WebCore::CCLayerTreeHostImpl::calculateRenderPasses): + * platform/graphics/chromium/cc/CCPluginDrawQuad.cpp: + (WebCore::CCPluginDrawQuad::create): + (WebCore::CCPluginDrawQuad::CCPluginDrawQuad): + * platform/graphics/chromium/cc/CCPluginDrawQuad.h: + (CCPluginDrawQuad): + (WebCore::CCPluginDrawQuad::uvRect): + (WebCore::CCPluginDrawQuad::textureId): + (WebCore::CCPluginDrawQuad::flipped): + (WebCore::CCPluginDrawQuad::ioSurfaceWidth): + (WebCore::CCPluginDrawQuad::ioSurfaceHeight): + (WebCore::CCPluginDrawQuad::ioSurfaceTextureId): + * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp: + (WebCore::CCPluginLayerImpl::willDraw): + (WebCore::CCPluginLayerImpl::appendQuads): + * platform/graphics/chromium/cc/CCPluginLayerImpl.h: + (CCPluginLayerImpl): + +2012-01-29 Pablo Flouret <pablof@motorola.com> + + V8 idl code generator doesn't handle SerializedScriptValue attributes properly. + https://bugs.webkit.org/show_bug.cgi?id=77295 + + Reviewed by Kentaro Hara. + + Only the case of one (and only one) SerializedScriptValue attribute was + handled, and it was deserialized eagerly in the constructor instead of + generating getters/setters. This patch gets rid of that behavior and + generates the getters and setters instead (similar to what the JSC + generator does). + Also handle the case of SSV attributes with [CachedAttribute] + declaration, caching the deserialized value in a hidden attribute on the + object. + + * bindings/scripts/CodeGeneratorV8.pm: + (GenerateNormalAttrGetter): + (GenerateNormalAttrSetter): + (GenerateConstructorCallback): + (GenerateNamedConstructorCallback): + (GenerateSingleBatchedAttribute): + (GenerateImplementation): + (GenerateToV8Converters): + (JSValueToNative): + (NativeToJSValue): + * bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp: + (WebDOMTestSerializedScriptValueInterface::setValue): + (WebDOMTestSerializedScriptValueInterface::readonlyValue): + (WebDOMTestSerializedScriptValueInterface::cachedValue): + (WebDOMTestSerializedScriptValueInterface::setCachedValue): + (WebDOMTestSerializedScriptValueInterface::cachedReadonlyValue): + * bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h: + (WebDOMTestSerializedScriptValueInterface): + * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp: + (webkit_dom_test_serialized_script_value_interface_set_value): + (webkit_dom_test_serialized_script_value_interface_get_readonly_value): + (webkit_dom_test_serialized_script_value_interface_get_cached_value): + (webkit_dom_test_serialized_script_value_interface_set_cached_value): + (webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value): + (webkit_dom_test_serialized_script_value_interface_get_property): + (webkit_dom_test_serialized_script_value_interface_class_init): + * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h: + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: + (): + (WebCore::jsTestSerializedScriptValueInterfaceReadonlyValue): + (WebCore): + (WebCore::jsTestSerializedScriptValueInterfaceCachedValue): + (WebCore::jsTestSerializedScriptValueInterfaceCachedReadonlyValue): + (WebCore::JSTestSerializedScriptValueInterface::put): + (WebCore::setJSTestSerializedScriptValueInterfaceValue): + (WebCore::setJSTestSerializedScriptValueInterfaceCachedValue): + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h: + (JSTestSerializedScriptValueInterface): + (JSTestSerializedScriptValueInterfacePrototype): + (WebCore): + * bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h: + * bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm: + (-[DOMTestSerializedScriptValueInterface setValue:]): + (-[DOMTestSerializedScriptValueInterface readonlyValue]): + (-[DOMTestSerializedScriptValueInterface cachedValue]): + (-[DOMTestSerializedScriptValueInterface setCachedValue:]): + (-[DOMTestSerializedScriptValueInterface cachedReadonlyValue]): + * bindings/scripts/test/TestSerializedScriptValueInterface.idl: + * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp: + (WebCore::TestSerializedScriptValueInterfaceInternal::valueAttrGetter): + (TestSerializedScriptValueInterfaceInternal): + (WebCore::TestSerializedScriptValueInterfaceInternal::valueAttrSetter): + (WebCore::TestSerializedScriptValueInterfaceInternal::readonlyValueAttrGetter): + (WebCore::TestSerializedScriptValueInterfaceInternal::cachedValueAttrGetter): + (WebCore::TestSerializedScriptValueInterfaceInternal::cachedValueAttrSetter): + (WebCore::TestSerializedScriptValueInterfaceInternal::cachedReadonlyValueAttrGetter): + (): + (WebCore::V8TestSerializedScriptValueInterface::constructorCallback): + (WebCore::ConfigureV8TestSerializedScriptValueInterfaceTemplate): + (WebCore::V8TestSerializedScriptValueInterface::wrapSlow): + +2012-02-02 Adam Barth <abarth@webkit.org> + + BMW Car Configuration Page doesn't work (Only manifests in Chromium) + https://bugs.webkit.org/show_bug.cgi?id=77312 + + Reviewed by Dimitri Glazkov. + + When we autogenerated the event factory, we missed the check for + whether touch events were enabled at runtime: + http://trac.webkit.org/changeset/97933/trunk/Source/WebCore/dom/Document.cpp + + This patch adds the check back. + + Unfortunately, there isn't a testing frame work for + RuntimeEnabledFeatures. The main difficulty is that these static bools + need to be set when WebKit is initialized and can't be changed (which + is why they're not part of WebCore::Settings). To test them properly, + we'd need a testing framework that booted up WebKit for each test. + + We could test this particular change (which doesn't need the bool to be + constant through the runtime of WebKit), but that would create a + sandtrap for future patches who might thing that this testing framework + can really be used to test RuntimeEnabledFeatures. + + The net result is that Chromium is going to end up living with the + non-default codepath for these settings being untested, which will lead + to regressions like this one. If we ened up with a bunch of these + regressions, we'll likely end up with a testing framework similar to + Chromium's browsers_tests, which create a fresh subprocess for each + test. + + * dom/EventFactory.in: + * dom/make_event_factory.pl: + (defaultItemFactory): + (generateImplementation): + +2012-02-02 Justin Novosad <junov@chromium.org> + + [Chromium] Use SkCanvas::flush in skia port + https://bugs.webkit.org/show_bug.cgi?id=77463 + + Reviewed by Stephen White. + + Code cleanup in skia port. Using SkCanvas::flush to remove + unnecessary dependency on GrContext. Removed unnecessary inclusions + and forward declarations of GrContext in several source files. + + * platform/graphics/chromium/Canvas2DLayerChromium.cpp: + (WebCore::Canvas2DLayerChromium::paintContentsIfDirty): + * platform/graphics/chromium/LayerRendererChromium.cpp: + * platform/graphics/chromium/LayerRendererChromium.h: + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: + * platform/graphics/chromium/cc/CCProxy.h: + * platform/graphics/skia/PlatformContextSkia.cpp: + +2012-02-02 Chris Marrin <cmarrin@apple.com> + + Turn on CSS Filters on Windows + https://bugs.webkit.org/show_bug.cgi?id=76667 + + Turning on CSS_FILTERS flag for Windows and fixed a couple of resultant build errors + + Reviewed by Adele Peterson. + + * WebCore.vcproj/copyForwardingHeaders.cmd: + * platform/graphics/ca/win/PlatformCALayerWin.cpp: + (PlatformCALayer::setFilters): + (PlatformCALayer::filtersCanBeComposited): + +2012-02-02 Jon Lee <jonlee@apple.com> + + Clear shown notifications when context is no longer active + https://bugs.webkit.org/show_bug.cgi?id=77363 + <rdar://problem/10568907> + + Reviewed by Darin Adler. + + * notifications/NotificationPresenter.h: Add new virtual function to clear notifications + associated with a given execution context. By default the notifications are left alone, as + before. Individual implementations can override to allow notifications to clear them. + + * notifications/NotificationCenter.cpp: + (WebCore::NotificationCenter::disconnectFrame): When disconnecting the page from the frame, we + call clearNotifications(). + * page/Frame.cpp: + (WebCore::Frame::pageDestroyed): When the page is destroyed, tell the DOM window to reset notifications. + +2012-02-02 Anders Carlsson <andersca@apple.com> + + The overhang area layer should have a linen background + https://bugs.webkit.org/show_bug.cgi?id=77670 + <rdar://problem/10797727> + + Reviewed by Andreas Kling. + + * page/scrolling/mac/ScrollingCoordinatorMac.mm: + (WebCore::ScrollingCoordinator::scrollByOnScrollingThread): + Add an #ifdef so that scroll position clamping can be disabled. This will be + removed once rubber-banding works properly. + + * platform/ScrollbarTheme.h: + (WebCore::ScrollbarTheme::setUpOverhangAreasLayerContents): + Add new empty function. + + * platform/mac/ScrollbarThemeMac.h: + (ScrollbarThemeMac): + * platform/mac/ScrollbarThemeMac.mm: + (WebCore::linenBackgroundColor): + Helper function for getting the CGColorRef that represents the linen background color. + + (WebCore::ScrollbarThemeMac::setUpOverhangAreasLayerContents): + Set the linen background color as the overhang areas layer background color. + + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateOverflowControlsLayers): + Call ScrollbarTheme::setUpOverhangAreasLayerContents. + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106566. + http://trac.webkit.org/changeset/106566 + https://bugs.webkit.org/show_bug.cgi?id=77673 + + Broke the Windows build (Requested by jessieberlin on + #webkit). + + * WebCore.vcproj/copyForwardingHeaders.cmd: + * platform/graphics/ca/win/PlatformCALayerWin.cpp: + +2012-02-02 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter + https://bugs.webkit.org/show_bug.cgi?id=73130 + + Reviewed by Darin Fisher. + + Tests for the Media Stream API will be provided by the bug 56587, pending enough landed code. + + * mediastream/UserMediaClient.h: + (UserMediaClient): + * mediastream/UserMediaRequest.cpp: + (WebCore::UserMediaRequest::didCompleteQuery): + * mediastream/UserMediaRequest.h: + (UserMediaRequest): + (WebCore::UserMediaRequest::audio): + (WebCore::UserMediaRequest::video): + (WebCore::UserMediaRequest::cameraPreferenceUser): + (WebCore::UserMediaRequest::cameraPreferenceEnvironment): + * platform/mediastream/MediaStreamCenter.cpp: + (WebCore): + (WebCore::MediaStreamCenter::queryMediaStreamSources): + * platform/mediastream/MediaStreamCenter.h: + (WebCore): + (MediaStreamSourcesQueryClient): + (MediaStreamCenter): + +2012-02-02 Raymond Toy <rtoy@google.com> + + Constant values to set "distanceModel" are undefined + https://bugs.webkit.org/show_bug.cgi?id=74273 + + Reviewed by Kenneth Russell. + + Tests: webaudio/distance-exponential.html + webaudio/distance-inverse.html + webaudio/distance-linear.html + + * webaudio/AudioPannerNode.h: Define enum for the new constants + for the distance models. + * webaudio/AudioPannerNode.idl: Define matching constants for the + distance models. + +2012-02-02 Raymond Toy <rtoy@google.com> + + Illegal panner model values should throw an exception + https://bugs.webkit.org/show_bug.cgi?id=77235 + + Reviewed by Kenneth Russell. + + Modified existing panner-set-model test to catch exceptions. + Debug build should not crash anymore. + + * webaudio/AudioPannerNode.cpp: + (WebCore::AudioPannerNode::setPanningModel): Throw exception for + invalid model values. + * webaudio/AudioPannerNode.h: + (AudioPannerNode): Update declaration + * webaudio/AudioPannerNode.idl: Setting panner model can throw + exception. + +2012-02-02 Kentaro Hara <haraken@chromium.org> + + Rename [ConvertUndefinedOrNullToNullString] to + [TreatNullAs=EmptyString, TreatUndefinedAs=EmptyString] + https://bugs.webkit.org/show_bug.cgi?id=77611 + + Reviewed by Adam Barth. + + This patch renames [ConvertUndefinedOrNullToNullString] to + [TreatNullAs=EmptyString, TreatUndefinedAs=EmptyString], according to the spec + (http://dev.w3.org/2006/webapi/WebIDL/#TreatNullAs, + http://dev.w3.org/2006/webapi/WebIDL/#TreatUndefinedAs). + + No tests. No changes in behavior. + + * bindings/scripts/CodeGeneratorJS.pm: + (JSValueToNative): + * bindings/scripts/CodeGeneratorV8.pm: + (GetNativeTypeFromSignature): + * dom/DOMImplementation.idl: + * dom/Document.idl: + * fileapi/Blob.idl: + * fileapi/DirectoryEntry.idl: + * fileapi/DirectoryEntrySync.idl: + * fileapi/Entry.idl: + * fileapi/EntrySync.idl: + * fileapi/WebKitBlobBuilder.idl: + * html/HTMLButtonElement.idl: + * html/HTMLCanvasElement.idl: + * html/HTMLFieldSetElement.idl: + * html/HTMLInputElement.idl: + * html/HTMLKeygenElement.idl: + * html/HTMLObjectElement.idl: + * html/HTMLOutputElement.idl: + * html/HTMLSelectElement.idl: + * html/HTMLTextAreaElement.idl: + * page/Console.idl: + * page/DOMWindow.idl: + + * bindings/scripts/test/TestObj.idl: No changes in run-bindings-tests results. + +2012-02-02 Anders Carlsson <andersca@apple.com> + + NPAPI will not send mouse up events when mouse is outside plugin area + https://bugs.webkit.org/show_bug.cgi?id=77657 + <rdar://problem/10160674> + + Reviewed by Andreas Kling. + + Export EventHandler::setCapturingMouseEventsNode. + + * WebCore.exp.in: + +2012-02-02 Antti Koivisto <antti@apple.com> + + Move remaining implementation from CSSStyleDeclaration to subclasses + https://bugs.webkit.org/show_bug.cgi?id=77621 + + Reviewed by Andreas Kling. + + This leaves CSSStyleDeclaration a near-pure CSSOM interface. + + * bindings/js/JSCSSStyleDeclarationCustom.cpp: + (WebCore::isCSSPropertyName): + (WebCore::JSCSSStyleDeclaration::putDelegate): + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::parentRule): + (WebCore): + * css/CSSComputedStyleDeclaration.h: + (CSSComputedStyleDeclaration): + * css/CSSMutableStyleDeclaration.cpp: + (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration): + (WebCore::CSSMutableStyleDeclaration::contextStyleSheet): + (WebCore): + (WebCore::CSSMutableStyleDeclaration::parentRule): + * css/CSSMutableStyleDeclaration.h: + (WebCore::CSSMutableStyleDeclaration::isInlineStyleDeclaration): + (WebCore::CSSMutableStyleDeclaration::parentRuleInternal): + (WebCore::CSSMutableStyleDeclaration::clearParentRule): + (CSSMutableStyleDeclaration): + (WebCore::CSSMutableStyleDeclaration::parentElement): + (WebCore::CSSMutableStyleDeclaration::clearParentElement): + (WebCore::CSSMutableStyleDeclaration::parentStyleSheet): + * css/CSSParser.cpp: + (WebCore::parseColorValue): + (WebCore::parseSimpleLengthValue): + (WebCore::CSSParser::parseValue): + (WebCore::CSSParser::parseDeclaration): + * css/CSSStyleDeclaration.cpp: + (WebCore): + * css/CSSStyleDeclaration.h: + (CSSStyleDeclaration): + (WebCore::CSSStyleDeclaration::parentStyleSheet): + (WebCore::CSSStyleDeclaration::CSSStyleDeclaration): + * css/CSSStyleRule.cpp: + (WebCore::CSSStyleRule::setSelectorText): + + Eliminate unnecessary call to CSSMutableStyleDeclaration::parentStyleSheet() + + * css/CSSStyleRule.h: + (WebCore::CSSStyleRule::setDeclaration): + * css/CSSStyleSelector.cpp: + (WebCore::isInsideRegionRule): + (WebCore::CSSStyleSelector::applyDeclaration): + * css/WebKitCSSKeyframeRule.cpp: + (WebCore::WebKitCSSKeyframeRule::setDeclaration): + * page/PageSerializer.cpp: + (WebCore::PageSerializer::serializeFrame): + (WebCore::PageSerializer::serializeCSSStyleSheet): + (WebCore::PageSerializer::retrieveResourcesForCSSRule): + (WebCore::PageSerializer::retrieveResourcesForCSSDeclaration): + * page/PageSerializer.h: + + Eliminate unnecessary call to CSSMutableStyleDeclaration::parentStyleSheet() + + (WebCore): + (PageSerializer): + +2012-02-02 Chris Marrin <cmarrin@apple.com> + + Turn on CSS Filters on Windows + https://bugs.webkit.org/show_bug.cgi?id=76667 + + Turning on CSS_FILTERS flag for Windows and fixed a couple of resultant build errors + + Reviewed by Adele Peterson. + + * WebCore.vcproj/copyForwardingHeaders.cmd: + * platform/graphics/ca/win/PlatformCALayerWin.cpp: + (PlatformCALayer::setFilters): + (PlatformCALayer::filtersCanBeComposited): + +2012-02-02 Anders Carlsson <andersca@apple.com> + + Move ScrollingThread to its own file + https://bugs.webkit.org/show_bug.cgi?id=77652 + + Reviewed by Sam Weinig. + + This just shuffles some classes around and makes ScrollingCoordinator call into ScrollingThread. + Hopefully we'll be able to make ScrollingThread use the new WebCore::RunLoop class eventually. + + * WebCore.xcodeproj/project.pbxproj: + * page/scrolling/ScrollingCoordinator.cpp: + (WebCore::ScrollingCoordinator::handleWheelEvent): + * page/scrolling/ScrollingCoordinator.h: + (ScrollingCoordinator): + * page/scrolling/ScrollingThread.cpp: Added. + (WebCore): + (WebCore::ScrollingThread::ScrollingThread): + (WebCore::ScrollingThread::isCurrentThread): + (WebCore::ScrollingThread::dispatch): + (WebCore::ScrollingThread::shared): + (WebCore::ScrollingThread::createThreadIfNeeded): + (WebCore::ScrollingThread::threadCallback): + (WebCore::ScrollingThread::threadBody): + (WebCore::ScrollingThread::dispatchFunctionsFromScrollingThread): + * page/scrolling/ScrollingThread.h: Added. + (WebCore): + (ScrollingThread): + * page/scrolling/mac/ScrollingCoordinatorMac.mm: + (WebCore::ScrollingCoordinator::scrollByOnScrollingThread): + (WebCore::ScrollingCoordinator::updateMainFrameScrollLayerPositionOnScrollingThread): + * page/scrolling/mac/ScrollingThreadMac.mm: Added. + (WebCore): + (WebCore::ScrollingThread::initializeRunLoop): + (WebCore::ScrollingThread::wakeUpRunLoop): + (WebCore::ScrollingThread::threadRunLoopSourceCallback): + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106551. + http://trac.webkit.org/changeset/106551 + https://bugs.webkit.org/show_bug.cgi?id=77648 + + Breaking mac and gtk tests due to font differences. (Requested + by _pdr_ on #webkit). + + * platform/graphics/SVGGlyph.cpp: + (WebCore::charactersWithArabicForm): + * svg/SVGFontData.cpp: + (WebCore::SVGFontData::applySVGGlyphSelection): + * svg/SVGFontData.h: + (SVGFontData): + 2012-02-02 Alexander Pavlov <apavlov@chromium.org> Web Inspector: [REGRESSION] Slow continuous DOM traversal with Up/Down keys diff --git a/Source/WebCore/Configurations/FeatureDefines.xcconfig b/Source/WebCore/Configurations/FeatureDefines.xcconfig index 9be349394..f5bc9cf39 100644 --- a/Source/WebCore/Configurations/FeatureDefines.xcconfig +++ b/Source/WebCore/Configurations/FeatureDefines.xcconfig @@ -37,6 +37,8 @@ ENABLE_BLOB_macosx = ENABLE_BLOB; ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; +ENABLE_DASHBOARD_SUPPORT = ENABLE_DASHBOARD_SUPPORT; + ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); ENABLE_DATALIST_macosx = ENABLE_DATALIST; @@ -123,4 +125,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebCore/Configurations/Version.xcconfig b/Source/WebCore/Configurations/Version.xcconfig index fe120b7ff..01f343c7a 100644 --- a/Source/WebCore/Configurations/Version.xcconfig +++ b/Source/WebCore/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 19; +MINOR_VERSION = 20; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebCore/DerivedSources.cpp b/Source/WebCore/DerivedSources.cpp index 2b0236186..478127848 100644 --- a/Source/WebCore/DerivedSources.cpp +++ b/Source/WebCore/DerivedSources.cpp @@ -193,6 +193,9 @@ #include "JSHTMLQuoteElement.cpp" #include "JSHTMLScriptElement.cpp" #include "JSHTMLSelectElement.cpp" +#if ENABLE(SHADOW_DOM) +#include "JSHTMLShadowElement.cpp" +#endif #include "JSHTMLSourceElement.cpp" #include "JSHTMLSpanElement.cpp" #include "JSHTMLStyleElement.cpp" diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make index fa595bf86..70fc74489 100644 --- a/Source/WebCore/DerivedSources.make +++ b/Source/WebCore/DerivedSources.make @@ -286,7 +286,7 @@ BINDING_IDLS = \ $(WebCore)/html/canvas/Uint8ClampedArray.idl \ $(WebCore)/html/canvas/WebGLActiveInfo.idl \ $(WebCore)/html/canvas/WebGLBuffer.idl \ - $(WebCore)/html/canvas/WebGLCompressedTextures.idl \ + $(WebCore)/html/canvas/WebGLCompressedTextureS3TC.idl \ $(WebCore)/html/canvas/WebGLContextAttributes.idl \ $(WebCore)/html/canvas/WebGLContextEvent.idl \ $(WebCore)/html/canvas/WebGLFramebuffer.idl \ @@ -299,6 +299,7 @@ BINDING_IDLS = \ $(WebCore)/html/canvas/WebGLUniformLocation.idl \ $(WebCore)/html/canvas/WebGLVertexArrayObjectOES.idl \ $(WebCore)/html/shadow/HTMLContentElement.idl \ + $(WebCore)/html/shadow/HTMLShadowElement.idl \ $(WebCore)/html/track/TextTrackList.idl \ $(WebCore)/html/track/TrackEvent.idl \ $(WebCore)/inspector/InjectedScriptHost.idl \ @@ -667,10 +668,6 @@ ifeq ($(findstring ENABLE_SVG,$(FEATURE_DEFINES)), ENABLE_SVG) WEBCORE_CSS_VALUE_KEYWORDS := $(WEBCORE_CSS_VALUE_KEYWORDS) $(WebCore)/css/SVGCSSValueKeywords.in endif -ifeq ($(ENABLE_DASHBOARD_SUPPORT), 1) - WEBCORE_CSS_PROPERTY_NAMES := $(WEBCORE_CSS_PROPERTY_NAMES) $(WebCore)/css/DashboardSupportCSSPropertyNames.in -endif - CSSPropertyNames.h : $(WEBCORE_CSS_PROPERTY_NAMES) css/makeprop.pl cat $(WEBCORE_CSS_PROPERTY_NAMES) > CSSPropertyNames.in perl -I$(WebCore)/bindings/scripts "$(WebCore)/css/makeprop.pl" --defines "$(FEATURE_DEFINES)" diff --git a/Source/WebCore/DerivedSources.pri b/Source/WebCore/DerivedSources.pri index 56c189457..610cff199 100644 --- a/Source/WebCore/DerivedSources.pri +++ b/Source/WebCore/DerivedSources.pri @@ -65,8 +65,6 @@ DEBUGGER_SCRIPT_SOURCE = $$PWD/bindings/v8/DebuggerScript.js ARRAY_BUFFER_VIEW_CUSTOM_SCRIPT_SOURCE = $$PWD/bindings/v8/custom/V8ArrayBufferViewCustomScript.js -contains(DEFINES, ENABLE_DASHBOARD_SUPPORT=1): DASHBOARDSUPPORTCSSPROPERTIES = $$PWD/css/DashboardSupportCSSPropertyNames.in - XPATHBISON = $$PWD/xml/XPathGrammar.y contains(DEFINES, ENABLE_SVG=1) { @@ -224,6 +222,7 @@ IDL_BINDINGS += \ $$PWD/html/canvas/OESVertexArrayObject.idl \ $$PWD/html/canvas/WebGLActiveInfo.idl \ $$PWD/html/canvas/WebGLBuffer.idl \ + $$PWD/html/canvas/WebGLCompressedTextureS3TC.idl \ $$PWD/html/canvas/WebGLContextAttributes.idl \ $$PWD/html/canvas/WebGLContextEvent.idl \ $$PWD/html/canvas/WebGLDebugRendererInfo.idl \ @@ -327,6 +326,7 @@ IDL_BINDINGS += \ $$PWD/html/ValidityState.idl \ $$PWD/html/VoidCallback.idl \ $$PWD/html/shadow/HTMLContentElement.idl \ + $$PWD/html/shadow/HTMLShadowElement.idl \ $$PWD/inspector/InjectedScriptHost.idl \ $$PWD/inspector/InspectorFrontendHost.idl \ $$PWD/inspector/JavaScriptCallFrame.idl \ @@ -642,8 +642,8 @@ GENERATORS += xlinknames cssprops.script = $$PWD/css/makeprop.pl cssprops.output = CSSPropertyNames.cpp cssprops.input = WALDOCSSPROPS -cssprops.commands = perl -ne \"print $1\" ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} > ${QMAKE_FUNC_FILE_OUT_PATH}/${QMAKE_FILE_BASE}.in && cd ${QMAKE_FUNC_FILE_OUT_PATH} && perl -I$$PWD/bindings/scripts $$cssprops.script --defines \"$${FEATURE_DEFINES_JAVASCRIPT}\" --preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME} && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf -cssprops.depends = ${QMAKE_FILE_NAME} $${DASHBOARDSUPPORTCSSPROPERTIES} $${EXTRACSSPROPERTIES} $$cssprops.script +cssprops.commands = perl -ne \"print $1\" ${QMAKE_FILE_NAME} $${EXTRACSSPROPERTIES} > ${QMAKE_FUNC_FILE_OUT_PATH}/${QMAKE_FILE_BASE}.in && cd ${QMAKE_FUNC_FILE_OUT_PATH} && perl -I$$PWD/bindings/scripts $$cssprops.script --defines \"$${FEATURE_DEFINES_JAVASCRIPT}\" --preprocessor \"$${QMAKE_MOC} -E\" ${QMAKE_FILE_NAME} && $(DEL_FILE) ${QMAKE_FILE_BASE}.in ${QMAKE_FILE_BASE}.gperf +cssprops.depends = ${QMAKE_FILE_NAME} $${EXTRACSSPROPERTIES} $$cssprops.script GENERATORS += cssprops # GENERATOR 6-B: diff --git a/Source/WebCore/English.lproj/localizedStrings.js b/Source/WebCore/English.lproj/localizedStrings.js Binary files differindex d8498d9ac..a2ddf6763 100644 --- a/Source/WebCore/English.lproj/localizedStrings.js +++ b/Source/WebCore/English.lproj/localizedStrings.js diff --git a/Source/WebCore/GNUmakefile.am b/Source/WebCore/GNUmakefile.am index efdef6926..fe5ccb94f 100644 --- a/Source/WebCore/GNUmakefile.am +++ b/Source/WebCore/GNUmakefile.am @@ -835,6 +835,7 @@ libWebCore_la_CPPFLAGS = \ $(LIBSOUP_CFLAGS) \ $(LIBXML_CFLAGS) \ $(LIBXSLT_CFLAGS) \ + $(PANGO_CFLAGS) \ $(SQLITE3_CFLAGS) \ $(UNICODE_CFLAGS) \ $(XRENDER_CFLAGS) \ @@ -952,7 +953,7 @@ EXTRA_DIST += \ Source/WebCore/inspector/CodeGeneratorInspector.py \ Source/WebCore/inspector/InjectedScriptSource.js \ Source/WebCore/inspector/Inspector.json \ - Source/WebCore/inspector/Inspector-0.1.json \ + Source/WebCore/inspector/Inspector-1.0.json \ Source/WebCore/inspector/generate-inspector-protocol-version \ Source/WebCore/inspector/xxd.pl \ Source/WebCore/LICENSE-APPLE \ diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index cfedff268..c08cb25a8 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -543,6 +543,8 @@ webcore_built_sources += \ DerivedSources/WebCore/JSWebGLActiveInfo.h \ DerivedSources/WebCore/JSWebGLBuffer.cpp \ DerivedSources/WebCore/JSWebGLBuffer.h \ + DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp \ + DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h \ DerivedSources/WebCore/JSWebGLContextAttributes.cpp \ DerivedSources/WebCore/JSWebGLContextAttributes.h \ DerivedSources/WebCore/JSWebGLContextEvent.cpp \ @@ -847,6 +849,7 @@ dom_binding_idls += \ $(WebCore)/html/canvas/Uint8ClampedArray.idl \ $(WebCore)/html/canvas/WebGLActiveInfo.idl \ $(WebCore)/html/canvas/WebGLBuffer.idl \ + $(WebCore)/html/canvas/WebGLCompressedTextureS3TC.idl \ $(WebCore)/html/canvas/WebGLContextAttributes.idl \ $(WebCore)/html/canvas/WebGLContextEvent.idl \ $(WebCore)/html/canvas/WebGLFramebuffer.idl \ @@ -1324,8 +1327,6 @@ webcore_sources += \ Source/WebCore/css/CSSLineBoxContainValue.h \ Source/WebCore/css/CSSMediaRule.cpp \ Source/WebCore/css/CSSMediaRule.h \ - Source/WebCore/css/CSSMutableStyleDeclaration.cpp \ - Source/WebCore/css/CSSMutableStyleDeclaration.h \ Source/WebCore/css/CSSNamespace.h \ Source/WebCore/css/CSSOMUtils.cpp \ Source/WebCore/css/CSSOMUtils.h \ @@ -1413,6 +1414,8 @@ webcore_sources += \ Source/WebCore/css/ShadowValue.h \ Source/WebCore/css/StyleMedia.cpp \ Source/WebCore/css/StyleMedia.h \ + Source/WebCore/css/StylePropertySet.cpp \ + Source/WebCore/css/StylePropertySet.h \ Source/WebCore/css/StyleSheet.cpp \ Source/WebCore/css/StyleSheet.h \ Source/WebCore/css/StyleSheetList.cpp \ @@ -1474,8 +1477,6 @@ webcore_sources += \ Source/WebCore/dom/ContainerNode.cpp \ Source/WebCore/dom/ContainerNode.h \ Source/WebCore/dom/CrossThreadTask.h \ - Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp \ - Source/WebCore/dom/CSSMappedAttributeDeclaration.h \ Source/WebCore/dom/CustomEvent.cpp \ Source/WebCore/dom/CustomEvent.h \ Source/WebCore/dom/DatasetDOMStringMap.cpp \ @@ -1572,7 +1573,6 @@ webcore_sources += \ Source/WebCore/dom/HashChangeEvent.h \ Source/WebCore/dom/KeyboardEvent.cpp \ Source/WebCore/dom/KeyboardEvent.h \ - Source/WebCore/dom/MappedAttributeEntry.h \ Source/WebCore/dom/MessageChannel.cpp \ Source/WebCore/dom/MessageChannel.h \ Source/WebCore/dom/MessageEvent.cpp \ @@ -2168,8 +2168,6 @@ webcore_sources += \ Source/WebCore/html/ImageInputType.h \ Source/WebCore/html/InputType.cpp \ Source/WebCore/html/InputType.h \ - Source/WebCore/html/IsIndexInputType.cpp \ - Source/WebCore/html/IsIndexInputType.h \ Source/WebCore/html/LabelsNodeList.cpp \ Source/WebCore/html/LabelsNodeList.h \ Source/WebCore/html/LinkRelAttribute.cpp \ @@ -2259,6 +2257,7 @@ webcore_sources += \ Source/WebCore/html/PasswordInputType.h \ Source/WebCore/html/PluginDocument.cpp \ Source/WebCore/html/PluginDocument.h \ + Source/WebCore/html/PublicURLManager.h \ Source/WebCore/html/RadioInputType.cpp \ Source/WebCore/html/RadioInputType.h \ Source/WebCore/html/RangeInputType.cpp \ @@ -2393,6 +2392,8 @@ webcore_sources += \ Source/WebCore/inspector/InspectorFrontendClientLocal.h \ Source/WebCore/inspector/InspectorFrontendHost.cpp \ Source/WebCore/inspector/InspectorFrontendHost.h \ + Source/WebCore/inspector/InspectorHistory.cpp \ + Source/WebCore/inspector/InspectorHistory.h \ Source/WebCore/inspector/InspectorIndexedDBAgent.h \ Source/WebCore/inspector/InspectorIndexedDBAgent.cpp \ Source/WebCore/inspector/InspectorInstrumentation.cpp \ @@ -4568,12 +4569,13 @@ if TARGET_WIN32 webcore_sources += \ Source/WebCore/platform/ScrollAnimatorWin.cpp \ Source/WebCore/platform/ScrollAnimatorWin.h \ - Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp \ Source/WebCore/platform/win/SystemInfo.cpp \ Source/WebCore/platform/win/SystemInfo.h \ Source/WebCore/plugins/win/PluginDatabaseWin.cpp \ Source/WebCore/plugins/win/PluginMessageThrottlerWin.cpp \ Source/WebCore/plugins/win/PluginMessageThrottlerWin.h +webcoregtk_sources += \ + Source/WebCore/platform/cairo/WidgetBackingStoreCairo.cpp endif # ---- @@ -5362,6 +5364,7 @@ webcore_sources += \ Source/WebCore/platform/audio/AudioResamplerKernel.cpp \ Source/WebCore/platform/audio/AudioResamplerKernel.h \ Source/WebCore/platform/audio/AudioSourceProvider.h \ + Source/WebCore/platform/audio/AudioSourceProviderClient.h \ Source/WebCore/platform/audio/AudioUtilities.cpp \ Source/WebCore/platform/audio/AudioUtilities.h \ Source/WebCore/platform/audio/Biquad.cpp \ @@ -5612,8 +5615,8 @@ webcore_sources += \ Source/WebCore/html/canvas/WebGLActiveInfo.h \ Source/WebCore/html/canvas/WebGLBuffer.cpp \ Source/WebCore/html/canvas/WebGLBuffer.h \ - Source/WebCore/html/canvas/WebGLCompressedTextures.cpp \ - Source/WebCore/html/canvas/WebGLCompressedTextures.h \ + Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp \ + Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h \ Source/WebCore/html/canvas/WebGLContextAttributes.cpp \ Source/WebCore/html/canvas/WebGLContextAttributes.h \ Source/WebCore/html/canvas/WebGLContextEvent.cpp \ @@ -5732,9 +5735,11 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapper.h \ Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ - Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ - Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h + Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \ + Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \ + Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ + Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ + Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h webcoregtk_sources += \ Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp \ Source/WebCore/platform/graphics/cairo/TextureMapperCairo.h @@ -5752,11 +5757,28 @@ webcore_sources += \ Source/WebCore/platform/graphics/texmap/TextureMapper.h \ Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h \ + Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp \ + Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp \ Source/WebCore/platform/graphics/texmap/TextureMapperNode.h \ Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayer.h webcoregtk_sources += \ - Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp \ - Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h + Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp \ + Source/WebCore/platform/graphics/gtk/WindowGLContext.h endif # END USE_TEXTURE_MAPPER_GL endif # USE_ACCELERATED_COMPOSITING + +# --- +# Shadow DOM support +# --- +if ENABLE_SHADOW_DOM +webcore_sources += \ + Source/WebCore/html/shadow/HTMLShadowElement.cpp \ + Source/WebCore/html/shadow/HTMLShadowElement.h +webcore_built_sources += \ + DerivedSources/WebCore/JSHTMLShadowElement.cpp \ + DerivedSources/WebCore/JSHTMLShadowElement.h +dom_binding_idls += \ + $(WebCore)/html/shadow/HTMLShadowElement.idl + +endif # END ENABLE_SHADOW_DOM diff --git a/Source/WebCore/Modules/gamepad/GamepadList.idl b/Source/WebCore/Modules/gamepad/GamepadList.idl index 6444f1ff0..6189ddc37 100644 --- a/Source/WebCore/Modules/gamepad/GamepadList.idl +++ b/Source/WebCore/Modules/gamepad/GamepadList.idl @@ -27,7 +27,7 @@ module dom { interface [ Conditional=GAMEPAD, - HasIndexGetter + IndexedGetter ] GamepadList { readonly attribute unsigned long length; Gamepad item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl b/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl index bc9e930e6..e8a945db6 100644 --- a/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl +++ b/Source/WebCore/Modules/gamepad/NavigatorGamepad.idl @@ -23,7 +23,7 @@ module window { Conditional=GAMEPAD, Supplemental=Navigator ] NavigatorGamepad { - readonly attribute [EnabledAtRuntime] GamepadList webkitGamepads; + readonly attribute [V8EnabledAtRuntime] GamepadList webkitGamepads; }; } diff --git a/Source/WebCore/PlatformEfl.cmake b/Source/WebCore/PlatformEfl.cmake index 1b2e1e406..4c877ae0e 100644 --- a/Source/WebCore/PlatformEfl.cmake +++ b/Source/WebCore/PlatformEfl.cmake @@ -281,7 +281,6 @@ IF (ENABLE_VIDEO) ) ENDIF () - IF (ENABLE_GLIB_SUPPORT) LIST(APPEND WebCore_LIBRARIES ${Glib_LIBRARIES} @@ -294,10 +293,23 @@ ENDIF () IF (ENABLE_WEBGL) LIST(APPEND WebCore_INCLUDE_DIRECTORIES ${OPENGL_INCLUDE_DIR} + "${WEBCORE_DIR}/platform/graphics/cairo" + "${WEBCORE_DIR}/platform/graphics/glx" + "${WEBCORE_DIR}/platform/graphics/opengl" ) LIST(APPEND WebCore_LIBRARIES ${OPENGL_gl_LIBRARY} ) + LIST(APPEND WebCore_SOURCES + platform/graphics/cairo/GraphicsContext3DCairo.cpp + platform/graphics/cairo/OpenGLShims.cpp + platform/graphics/efl/DrawingBufferEfl.cpp + platform/graphics/efl/GraphicsContext3DEfl.cpp + platform/graphics/glx/GraphicsContext3DPrivate.cpp + platform/graphics/opengl/Extensions3DOpenGL.cpp + platform/graphics/opengl/GraphicsContext3DOpenGL.cpp + platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp + ) ENDIF () IF (WTF_USE_SOUP) diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index fc6f6e64f..758dd4bd2 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -158,8 +158,7 @@ v8 { bindings/v8/custom/V8InjectedScriptHostCustom.cpp \ bindings/v8/custom/V8InjectedScriptManager.cpp \ bindings/v8/custom/V8InspectorFrontendHostCustom.cpp \ - bindings/v8/custom/V8DOMStringMapCustom.cpp \ - bindings/v8/custom/V8DOMTokenListCustom.cpp + bindings/v8/custom/V8DOMStringMapCustom.cpp SOURCES += \ bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp \ @@ -416,7 +415,6 @@ SOURCES += \ css/CSSInitialValue.cpp \ css/CSSLineBoxContainValue.cpp \ css/CSSMediaRule.cpp \ - css/CSSMutableStyleDeclaration.cpp \ css/CSSOMUtils.cpp \ css/CSSPageRule.cpp \ css/CSSParser.cpp \ @@ -457,6 +455,7 @@ SOURCES += \ css/SelectorChecker.cpp \ css/ShadowValue.cpp \ css/StyleMedia.cpp \ + css/StylePropertySet.cpp \ css/StyleSheet.cpp \ css/StyleSheetList.cpp \ css/WebKitCSSFilterValue.cpp \ @@ -484,7 +483,6 @@ SOURCES += \ dom/Comment.cpp \ dom/CompositionEvent.cpp \ dom/ContainerNode.cpp \ - dom/CSSMappedAttributeDeclaration.cpp \ dom/CustomEvent.cpp \ dom/DecodedDataDocumentParser.cpp \ dom/DeviceMotionController.cpp \ @@ -793,7 +791,6 @@ SOURCES += \ html/ImageDocument.cpp \ html/ImageInputType.cpp \ html/InputType.cpp \ - html/IsIndexInputType.cpp \ html/LabelsNodeList.cpp \ html/LinkRelAttribute.cpp \ html/MediaDocument.cpp \ @@ -847,6 +844,7 @@ SOURCES += \ html/shadow/ContentInclusionSelector.cpp \ html/shadow/DetailsMarkerControl.cpp \ html/shadow/HTMLContentElement.cpp \ + html/shadow/HTMLShadowElement.cpp \ html/shadow/MediaControls.cpp \ html/shadow/MediaControlRootElement.cpp \ html/shadow/MeterShadowElement.cpp \ @@ -877,6 +875,7 @@ SOURCES += \ inspector/InspectorDOMStorageResource.cpp \ inspector/InspectorFrontendClientLocal.cpp \ inspector/InspectorFrontendHost.cpp \ + inspector/InspectorHistory.cpp \ inspector/InspectorInstrumentation.cpp \ inspector/InspectorMemoryAgent.cpp \ inspector/InspectorPageAgent.cpp \ @@ -1530,7 +1529,6 @@ HEADERS += \ css/CSSInheritedValue.h \ css/CSSInitialValue.h \ css/CSSMediaRule.h \ - css/CSSMutableStyleDeclaration.h \ css/CSSOMUtils.h \ css/CSSPageRule.h \ css/CSSParser.h \ @@ -1571,6 +1569,7 @@ HEADERS += \ css/SelectorChecker.h \ css/ShadowValue.h \ css/StyleMedia.h \ + css/StylePropertySet.h \ css/StyleSheet.h \ css/StyleSheetList.h \ css/WebKitCSSFilterValue.h \ @@ -1596,7 +1595,6 @@ HEADERS += \ dom/Clipboard.h \ dom/Comment.h \ dom/ContainerNode.h \ - dom/CSSMappedAttributeDeclaration.h \ dom/CustomEvent.h \ dom/default/PlatformMessagePortChannel.h \ dom/DeviceMotionClient.h \ @@ -1881,6 +1879,7 @@ HEADERS += \ html/MediaFragmentURIParser.h \ html/MicroDataItemValue.h \ html/PluginDocument.h \ + html/PublicURLManager.h \ html/StepRange.h \ html/TextDocument.h \ html/TextTrack.h \ @@ -1908,6 +1907,7 @@ HEADERS += \ html/shadow/ContentSelectorQuery.h \ html/shadow/ContentInclusionSelector.h \ html/shadow/HTMLContentElement.h \ + html/shadow/HTMLShadowElement.h \ html/shadow/MediaControlElements.h \ html/shadow/DetailsMarkerControl.h \ html/track/TextTrackList.h \ @@ -1943,6 +1943,7 @@ HEADERS += \ inspector/InspectorFrontendClient.h \ inspector/InspectorFrontendClientLocal.h \ inspector/InspectorFrontendHost.h \ + inspector/InspectorHistory.h \ inspector/InspectorInstrumentation.h \ inspector/InspectorMemoryAgent.h \ inspector/InspectorPageAgent.h \ @@ -3691,7 +3692,7 @@ contains(DEFINES, ENABLE_WEBGL=1) { html/canvas/WebGLObject.h \ html/canvas/WebGLActiveInfo.h \ html/canvas/WebGLBuffer.h \ - html/canvas/WebGLCompressedTextures.h \ + html/canvas/WebGLCompressedTextureS3TC.h \ html/canvas/WebGLContextAttributes.h \ html/canvas/WebGLContextEvent.h \ html/canvas/WebGLContextGroup.h \ @@ -3731,7 +3732,7 @@ contains(DEFINES, ENABLE_WEBGL=1) { html/canvas/CanvasContextAttributes.cpp \ html/canvas/WebGLObject.cpp \ html/canvas/WebGLBuffer.cpp \ - html/canvas/WebGLCompressedTextures.cpp \ + html/canvas/WebGLCompressedTextureS3TC.cpp \ html/canvas/WebGLContextAttributes.cpp \ html/canvas/WebGLContextEvent.cpp \ html/canvas/WebGLContextGroup.cpp \ @@ -3939,19 +3940,19 @@ win32:!win32-g++*:contains(QMAKE_HOST.arch, x86_64):{ contains(CONFIG, texmap) { HEADERS += \ - platform/graphics/qt/TextureMapperQt.h \ platform/graphics/texmap/GraphicsLayerTextureMapper.h \ platform/graphics/texmap/LayerTransform.h \ platform/graphics/texmap/TextureMapper.h \ platform/graphics/texmap/TextureMapperAnimation.h \ + platform/graphics/texmap/TextureMapperImageBuffer.h \ platform/graphics/texmap/TextureMapperNode.h \ platform/graphics/texmap/TextureMapperPlatformLayer.h SOURCES += \ - platform/graphics/qt/TextureMapperQt.cpp \ platform/graphics/texmap/LayerTransform.cpp \ platform/graphics/texmap/TextureMapper.cpp \ platform/graphics/texmap/TextureMapperAnimation.cpp \ + platform/graphics/texmap/TextureMapperImageBuffer.cpp \ platform/graphics/texmap/TextureMapperNode.cpp \ platform/graphics/texmap/GraphicsLayerTextureMapper.cpp @@ -3959,6 +3960,7 @@ contains(CONFIG, texmap) { HEADERS += platform/graphics/opengl/TextureMapperGL.h SOURCES += platform/graphics/opengl/TextureMapperGL.cpp CONFIG += opengl-shims + DEFINES += WTF_USE_TEXTURE_MAPPER_GL } } else { HEADERS += platform/graphics/qt/GraphicsLayerQt.h diff --git a/Source/WebCore/UseV8.cmake b/Source/WebCore/UseV8.cmake index 1085dbbe2..9b0a039b9 100755 --- a/Source/WebCore/UseV8.cmake +++ b/Source/WebCore/UseV8.cmake @@ -81,7 +81,6 @@ LIST(APPEND WebCore_SOURCES bindings/v8/custom/V8CustomXPathNSResolver.cpp bindings/v8/custom/V8DOMFormDataCustom.cpp bindings/v8/custom/V8DOMStringMapCustom.cpp - bindings/v8/custom/V8DOMTokenListCustom.cpp bindings/v8/custom/V8DOMWindowCustom.cpp bindings/v8/custom/V8DataViewCustom.cpp bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in index 7f084a388..d839c53d9 100644 --- a/Source/WebCore/WebCore.exp.in +++ b/Source/WebCore/WebCore.exp.in @@ -149,6 +149,7 @@ __ZN7WebCore10ScrollView20setCanHaveScrollbarsEb __ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb __ZN7WebCore10ScrollView24windowResizerRectChangedEv __ZN7WebCore10ScrollView8addChildEN3WTF10PassRefPtrINS_6WidgetEEE +__ZN7WebCore10ShadowRoot6createEPNS_7ElementERi __ZN7WebCore10deleteFileERKN3WTF6StringE __ZN7WebCore10handCursorEv __ZN7WebCore10setCookiesEPNS_8DocumentERKNS_4KURLERKN3WTF6StringE @@ -219,7 +220,7 @@ __ZN7WebCore11RenderLayer19scrollRectToVisibleERKNS_7IntRectERKNS_15ScrollAlignm __ZN7WebCore11globalPointERK8_NSPointP8NSWindow __ZN7WebCore11memoryCacheEv __ZN7WebCore11startOfWordERKNS_15VisiblePositionENS_9EWordSideE -__ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindowf +__ZN7WebCore11toUserSpaceERK7_NSRectP8NSWindow __ZN7WebCore11writeToFileEiPKci __ZN7WebCore12ChromeClient23paintCustomOverhangAreaEPNS_15GraphicsContextERKNS_7IntRectES5_S5_ __ZN7WebCore12EditingStyleD1Ev @@ -236,6 +237,7 @@ __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEbbNS_17HitTestSc __ZN7WebCore12EventHandler21handleMousePressEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler23handleMouseReleaseEventERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler24logicalScrollRecursivelyENS_22ScrollLogicalDirectionENS_17ScrollGranularityEPNS_4NodeE +__ZN7WebCore12EventHandler27setCapturingMouseEventsNodeEN3WTF10PassRefPtrINS_4NodeEEE __ZN7WebCore12EventHandler31passMouseMovedEventToScrollbarsEP7NSEvent __ZN7WebCore12EventHandler31passMouseMovedEventToScrollbarsERKNS_18PlatformMouseEventE __ZN7WebCore12EventHandler7mouseUpEP7NSEvent @@ -327,7 +329,7 @@ __ZN7WebCore13ResourceErrorC1EP9__CFError __ZN7WebCore13TypingCommand39insertParagraphSeparatorInQuotedContentEPNS_8DocumentE __ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE __ZN7WebCore13directoryNameERKN3WTF6StringE -__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindowf +__ZN7WebCore13toDeviceSpaceERKNS_9FloatRectEP8NSWindow __ZN7WebCore13toHTMLElementEPNS_21FormAssociatedElementE __ZN7WebCore13toJSDOMWindowEN3JSC7JSValueE __ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE @@ -432,6 +434,7 @@ __ZN7WebCore15FocusController10setFocusedEb __ZN7WebCore15FocusController14setFocusedNodeEPNS_4NodeEN3WTF10PassRefPtrINS_5FrameEEE __ZN7WebCore15FocusController15setFocusedFrameEN3WTF10PassRefPtrINS_5FrameEEE __ZN7WebCore15FocusController15setInitialFocusENS_14FocusDirectionEPNS_13KeyboardEventE +__ZN7WebCore15FocusController28setContainingWindowIsVisibleEb __ZN7WebCore15FocusController9setActiveEb __ZN7WebCore15GraphicsContext11clearShadowEv __ZN7WebCore15GraphicsContext12setFillColorERKNS_5ColorENS_10ColorSpaceE @@ -492,7 +495,7 @@ __ZN7WebCore16LegacyWebArchive19createFromSelectionEPNS_5FrameE __ZN7WebCore16LegacyWebArchive21rawDataRepresentationEv __ZN7WebCore16LegacyWebArchive6createEN3WTF10PassRefPtrINS_15ArchiveResourceEEERNS1_6VectorIS4_Lm0EEERNS5_INS2_IS0_EELm0EEE __ZN7WebCore16LegacyWebArchive6createEPNS_12SharedBufferE -__ZN7WebCore16LegacyWebArchive6createEPNS_4NodeE +__ZN7WebCore16LegacyWebArchive6createEPNS_4NodeEPNS_11FrameFilterE __ZN7WebCore16LegacyWebArchive6createEPNS_5FrameE __ZN7WebCore16LegacyWebArchive6createEPNS_5RangeE __ZN7WebCore16LegacyWebArchive6createEv @@ -516,6 +519,7 @@ __ZN7WebCore16ScriptController18windowScriptObjectEv __ZN7WebCore16ScriptController20executeScriptInWorldEPNS_15DOMWrapperWorldERKN3WTF6StringEb __ZN7WebCore16ScriptController21processingUserGestureEv __ZN7WebCore16ScriptController24jsObjectForPluginElementEPNS_17HTMLPlugInElementE +__ZN7WebCore16StylePropertySet5derefEv __ZN7WebCore16ThreadGlobalData10staticDataE __ZN7WebCore16ThreadGlobalDataC1Ev __ZN7WebCore16ThreadGlobalDataD1Ev @@ -671,7 +675,6 @@ __ZN7WebCore25addLanguageChangeObserverEPvPFvS0_E __ZN7WebCore25computeViewportAttributesENS_17ViewportArgumentsEiiiiNS_7IntSizeE __ZN7WebCore25contextMenuItemTagOutlineEv __ZN7WebCore25windowsKeyCodeForKeyEventEP7NSEvent -__ZN7WebCore26CSSMutableStyleDeclarationC1Ev __ZN7WebCore26UserTypingGestureIndicator27processingUserTypingGestureEv __ZN7WebCore26UserTypingGestureIndicator28focusedElementAtGestureStartEv __ZN7WebCore26contextMenuItemTagFontMenuEv @@ -761,12 +764,10 @@ __ZN7WebCore4Page15addSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE __ZN7WebCore4Page15didMoveOnscreenEv __ZN7WebCore4Page16setCanStartMediaEb __ZN7WebCore4Page16setDefersLoadingEb -__ZN7WebCore4Page17addScrollableAreaEPNS_14ScrollableAreaE __ZN7WebCore4Page17willMoveOffscreenEv __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE __ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy -__ZN7WebCore4Page20removeScrollableAreaEPNS_14ScrollableAreaE __ZN7WebCore4Page20setDeviceScaleFactorEf __ZN7WebCore4Page20unmarkAllTextMatchesEv __ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringEjbj @@ -897,7 +898,6 @@ __ZN7WebCore6WidgetD2Ev __ZN7WebCore6toNodeEN3JSC7JSValueE __ZN7WebCore7Console21shouldPrintExceptionsEv __ZN7WebCore7Console24setShouldPrintExceptionsEb -__ZN7WebCore7Element16ensureShadowRootEv __ZN7WebCore7Element16removeShadowRootEv __ZN7WebCore7Element21boundsInRootViewSpaceEv __ZN7WebCore7Element9innerTextEv @@ -1044,12 +1044,14 @@ __ZN7WebCore9FrameView14setNeedsLayoutEv __ZN7WebCore9FrameView14setTransparentEb __ZN7WebCore9FrameView15setMarginHeightEi __ZN7WebCore9FrameView16setPaintBehaviorEj +__ZN7WebCore9FrameView17addScrollableAreaEPNS_14ScrollableAreaE __ZN7WebCore9FrameView17paintControlTintsEv __ZN7WebCore9FrameView17setScrollPositionERKNS_8IntPointE __ZN7WebCore9FrameView17setTracksRepaintsEb __ZN7WebCore9FrameView18updateControlTintsEv __ZN7WebCore9FrameView19scrollElementToRectEPNS_7ElementERKNS_7IntRectE __ZN7WebCore9FrameView20enterCompositingModeEv +__ZN7WebCore9FrameView20removeScrollableAreaEPNS_14ScrollableAreaE __ZN7WebCore9FrameView21flushDeferredRepaintsEv __ZN7WebCore9FrameView22setBaseBackgroundColorERKNS_5ColorE __ZN7WebCore9FrameView23updateCanHaveScrollbarsEv @@ -1244,6 +1246,7 @@ __ZNK7WebCore14DocumentLoader19originalRequestCopyEv __ZNK7WebCore14DocumentLoader21isLoadingMainResourceEv __ZNK7WebCore14DocumentLoader28urlForHistoryReflectsFailureEv __ZNK7WebCore14DocumentLoader3urlEv +__ZNK7WebCore14DocumentMarker11descriptionEv __ZNK7WebCore14FrameSelection11currentFormEv __ZNK7WebCore14FrameSelection15copyTypingStyleEv __ZNK7WebCore14FrameSelection17isInPasswordFieldEv @@ -1294,6 +1297,7 @@ __ZNK7WebCore16HTMLInputElement15isPasswordFieldEv __ZNK7WebCore16HTMLInputElement18shouldAutocompleteEv __ZNK7WebCore16IconDatabaseBase12databasePathEv __ZNK7WebCore16ResourceResponse13nsURLResponseEv +__ZNK7WebCore16StylePropertySet25ensureCSSStyleDeclarationEv __ZNK7WebCore16VisibleSelection17isContentEditableEv __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv __ZNK7WebCore16VisibleSelection19rootEditableElementEv @@ -1484,6 +1488,7 @@ _stringIsCaseInsensitiveEqualToString _suggestedFilenameWithMIMEType _wkAdvanceDefaultButtonPulseAnimation _wkCGContextGetShouldSmoothFonts +_wkCGContextResetClip _wkCGPatternCreateWithImageAndTransform _wkCopyCFLocalizationPreferredName _wkCopyCFURLResponseSuggestedFilename @@ -2063,14 +2068,10 @@ __ZN7WebCore12Notification18dispatchCloseEventEv #endif #if ENABLE(THREADED_SCROLLING) -__ZN7WebCore20ScrollingCoordinator16handleWheelEventERKNS_18PlatformWheelEventE -__ZN7WebCore20ScrollingCoordinatorD1Ev +__ZN7WebCore13ScrollingTree21tryToHandleWheelEventERKNS_18PlatformWheelEventE +__ZN7WebCore13ScrollingTreeD1Ev __ZN7WebCore4Page20scrollingCoordinatorEv - -#if ENABLE(GESTURE_EVENTS) -__ZN7WebCore20ScrollingCoordinator18handleGestureEventERKNS_20PlatformGestureEventE -#endif - +__ZNK7WebCore20ScrollingCoordinator13scrollingTreeEv #endif #if ENABLE(STYLE_SCOPED) diff --git a/Source/WebCore/WebCore.gyp/WebCore.gyp b/Source/WebCore/WebCore.gyp/WebCore.gyp index f3d7d23b5..517f9b1be 100644 --- a/Source/WebCore/WebCore.gyp/WebCore.gyp +++ b/Source/WebCore/WebCore.gyp/WebCore.gyp @@ -1145,6 +1145,11 @@ 'include_dirs+++': ['../dom'], }, }], + ['OS=="linux" and "WTF_USE_WEBAUDIO_IPP=1" in feature_defines', { + 'cflags': [ + '<!@(pkg-config --cflags-only-I ipp)', + ], + }], ], }, { @@ -1347,6 +1352,13 @@ 'include_dirs++': ['../dom'], }, }], + ['OS=="linux" and "WTF_USE_WEBAUDIO_IPP=1" in feature_defines', { + 'direct_dependent_settings': { + 'cflags': [ + '<!@(pkg-config --cflags-only-I ipp)', + ], + }, + }], ['OS != "android" and "WTF_USE_WEBAUDIO_FFMPEG=1" in feature_defines', { # This directory needs to be on the include path for multiple sub-targets of webcore. 'direct_dependent_settings': { @@ -1985,6 +1997,16 @@ 'include_dirs+++': ['../dom'], }, }], + ['OS=="linux" and "WTF_USE_WEBAUDIO_IPP=1" in feature_defines', { + 'link_settings': { + 'ldflags': [ + '<!@(pkg-config --libs-only-L ipp)', + ], + 'libraries': [ + '-lipps -lippcore', + ], + }, + }], ['enable_svg!=0', { 'dependencies': [ 'webcore_svg', diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 101c87f69..e4a52271b 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -69,7 +69,6 @@ 'css/CSSImageGeneratorValue.h', 'css/CSSImageValue.h', 'css/CSSLineBoxContainValue.h', - 'css/CSSMutableStyleDeclaration.h', 'css/CSSParserValues.h', 'css/CSSPrimitiveValue.h', 'css/CSSProperty.h', @@ -277,7 +276,6 @@ 'platform/PlatformEvent.cpp', 'platform/PlatformEvent.h', 'platform/PlatformGestureEvent.h', - 'platform/PlatformGestureRecognizer.h', 'platform/PlatformKeyboardEvent.h', 'platform/PlatformMenuDescription.h', 'platform/PlatformMouseEvent.h', @@ -576,7 +574,6 @@ 'dom/ActiveDOMObject.h', 'dom/Attr.h', 'dom/Attribute.h', - 'dom/CSSMappedAttributeDeclaration.h', 'dom/CharacterData.h', 'dom/CheckedRadioButtons.h', 'dom/Clipboard.h', @@ -605,7 +602,6 @@ 'dom/ExceptionCodePlaceholder.h', 'dom/FragmentScriptingPermission.h', 'dom/KeyboardEvent.h', - 'dom/MappedAttributeEntry.h', 'dom/MessagePort.h', 'dom/MessagePortChannel.h', 'dom/MouseEvent.h', @@ -964,7 +960,7 @@ 'html/canvas/Uint8ClampedArray.idl', 'html/canvas/WebGLActiveInfo.idl', 'html/canvas/WebGLBuffer.idl', - 'html/canvas/WebGLCompressedTextures.idl', + 'html/canvas/WebGLCompressedTextureS3TC.idl', 'html/canvas/WebGLContextAttributes.idl', 'html/canvas/WebGLContextEvent.idl', 'html/canvas/WebGLDebugRendererInfo.idl', @@ -979,6 +975,7 @@ 'html/canvas/WebGLUniformLocation.idl', 'html/canvas/WebGLVertexArrayObjectOES.idl', 'html/shadow/HTMLContentElement.idl', + 'html/shadow/HTMLShadowElement.idl', 'html/track/TextTrackList.idl', 'html/track/TrackEvent.idl', 'inspector/InjectedScriptHost.idl', @@ -1818,7 +1815,6 @@ 'bindings/v8/custom/V8CustomXPathNSResolver.h', 'bindings/v8/custom/V8DOMFormDataCustom.cpp', 'bindings/v8/custom/V8DOMStringMapCustom.cpp', - 'bindings/v8/custom/V8DOMTokenListCustom.cpp', 'bindings/v8/custom/V8DOMWindowCustom.cpp', 'bindings/v8/custom/V8DataViewCustom.cpp', 'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp', @@ -2019,7 +2015,6 @@ 'css/CSSLineBoxContainValue.cpp', 'css/CSSMediaRule.cpp', 'css/CSSMediaRule.h', - 'css/CSSMutableStyleDeclaration.cpp', 'css/CSSNamespace.h', 'css/CSSOMUtils.cpp', 'css/CSSOMUtils.h', @@ -2099,6 +2094,8 @@ 'css/ShadowValue.h', 'css/StyleMedia.cpp', 'css/StyleMedia.h', + 'css/StylePropertySet.cpp', + 'css/StylePropertySet.h', 'css/StyleSheet.cpp', 'css/StyleSheet.h', 'css/StyleSheetList.cpp', @@ -2387,6 +2384,8 @@ 'inspector/InspectorFrontendClientLocal.cpp', 'inspector/InspectorFrontendHost.cpp', 'inspector/InspectorFrontendHost.h', + 'inspector/InspectorHistory.cpp', + 'inspector/InspectorHistory.h', 'inspector/InspectorIndexedDBAgent.cpp', 'inspector/InspectorIndexedDBAgent.h', 'inspector/InspectorInstrumentation.cpp', @@ -2871,6 +2870,7 @@ 'platform/audio/ffmpeg/FFTFrameFFMPEG.cpp', 'platform/audio/mac/FFTFrameMac.cpp', 'platform/audio/mkl/FFTFrameMKL.cpp', + 'platform/audio/ipp/FFTFrameIPP.cpp', 'platform/cf/BinaryPropertyList.cpp', 'platform/cf/FileSystemCF.cpp', 'platform/cf/KURLCFNet.cpp', @@ -2907,8 +2907,6 @@ 'platform/chromium/FramelessScrollView.h', 'platform/chromium/FramelessScrollViewClient.h', 'platform/chromium/GamepadsChromium.cpp', - 'platform/chromium/GestureRecognizerChromium.cpp', - 'platform/chromium/GestureRecognizerChromium.h', 'platform/chromium/HistogramSupportChromium.cpp', 'platform/chromium/KeyCodeConversion.h', 'platform/chromium/KeyCodeConversionAndroid.cpp', @@ -3537,8 +3535,6 @@ 'platform/graphics/qt/SimpleFontDataQt.cpp', 'platform/graphics/qt/StillImageQt.cpp', 'platform/graphics/qt/StillImageQt.h', - 'platform/graphics/qt/TextureMapperQt.cpp', - 'platform/graphics/qt/TextureMapperQt.h', 'platform/graphics/qt/TileQt.cpp', 'platform/graphics/qt/TransformationMatrixQt.cpp', 'platform/graphics/qt/TransparencyLayer.h', @@ -3580,6 +3576,8 @@ 'platform/graphics/texmap/TextureMapper.h', 'platform/graphics/texmap/TextureMapperAnimation.cpp', 'platform/graphics/texmap/TextureMapperAnimation.h', + 'platform/graphics/texmap/TextureMapperImageBuffer.cpp', + 'platform/graphics/texmap/TextureMapperImageBuffer.h', 'platform/graphics/texmap/TextureMapperNode.cpp', 'platform/graphics/texmap/TextureMapperNode.h', 'platform/graphics/texmap/TextureMapperPlatformLayer.h', @@ -4926,7 +4924,6 @@ 'dom/BeforeUnloadEvent.h', 'dom/CDATASection.cpp', 'dom/CDATASection.h', - 'dom/CSSMappedAttributeDeclaration.cpp', 'dom/CharacterData.cpp', 'dom/CheckedRadioButtons.cpp', 'dom/ChildListMutationScope.cpp', @@ -5353,8 +5350,6 @@ 'html/ImageInputType.cpp', 'html/ImageInputType.h', 'html/InputType.cpp', - 'html/IsIndexInputType.cpp', - 'html/IsIndexInputType.h', 'html/LabelsNodeList.cpp', 'html/LabelsNodeList.h', 'html/LinkRelAttribute.cpp', @@ -5378,6 +5373,7 @@ 'html/PasswordInputType.h', 'html/PluginDocument.cpp', 'html/PluginDocument.h', + 'html/PublicURLManager.h', 'html/RadioInputType.cpp', 'html/RadioInputType.h', 'html/RangeInputType.cpp', @@ -5443,8 +5439,8 @@ 'html/canvas/WebGLActiveInfo.h', 'html/canvas/WebGLBuffer.cpp', 'html/canvas/WebGLBuffer.h', - 'html/canvas/WebGLCompressedTextures.cpp', - 'html/canvas/WebGLCompressedTextures.h', + 'html/canvas/WebGLCompressedTextureS3TC.cpp', + 'html/canvas/WebGLCompressedTextureS3TC.h', 'html/canvas/WebGLContextAttributes.cpp', 'html/canvas/WebGLContextAttributes.h', 'html/canvas/WebGLContextEvent.cpp', @@ -5533,6 +5529,8 @@ 'html/shadow/DetailsMarkerControl.h', 'html/shadow/HTMLContentElement.cpp', 'html/shadow/HTMLContentElement.h', + 'html/shadow/HTMLShadowElement.cpp', + 'html/shadow/HTMLShadowElement.h', 'html/shadow/MediaControls.cpp', 'html/shadow/MediaControls.h', 'html/shadow/MediaControlElements.cpp', @@ -7854,6 +7852,8 @@ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLActiveInfo.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLBuffer.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLBuffer.h', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp', + '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLContextAttributes.cpp', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLContextAttributes.h', '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLFramebuffer.cpp', diff --git a/Source/WebCore/WebCore.order b/Source/WebCore/WebCore.order index 0804753a1..99ac4d2d9 100644 --- a/Source/WebCore/WebCore.order +++ b/Source/WebCore/WebCore.order @@ -4915,7 +4915,6 @@ __ZN7WebCore16HTMLTableElement29additionalAttributeStyleDeclsERN3WTF6VectorIPNS_ __ZN7WebCore13StyledElement22getMappedAttributeDeclENS_20MappedAttributeEntryERKNS_13QualifiedNameERKN3WTF12AtomicStringE __ZN7WebCore26CSSMutableStyleDeclaration11setPropertyEiibb __ZN7WebCore26CSSMutableStyleDeclaration19setPropertyInternalERKNS_11CSSPropertyEPS1_ -__ZN7WebCore13StyledElement22setMappedAttributeDeclENS_20MappedAttributeEntryERKNS_13QualifiedNameERKN3WTF12AtomicStringEPNS_29CSSMappedAttributeDeclarationE __ZN3WTF6VectorIPN7WebCore26CSSMutableStyleDeclarationELm0EE14expandCapacityEm __ZN7WebCore11RenderStyle26setHorizontalBorderSpacingEs __ZN7WebCore11RenderStyle24setVerticalBorderSpacingEs @@ -5366,7 +5365,6 @@ __ZNK7WebCore25AccessibilityRenderObject16linkedUIElementsERN3WTF6VectorINS1_6Re __ZNK7WebCore25AccessibilityRenderObject18ariaFlowToElementsERN3WTF6VectorINS1_6RefPtrINS_19AccessibilityObjectEEELm0EEE __ZN3WTF6VectorINS_6RefPtrIN7WebCore19AccessibilityObjectEEELm0EED1Ev __ZN7WebCore16HTMLTableElementD0Ev -__ZN7WebCore29CSSMappedAttributeDeclarationD0Ev __ZN7WebCore13StyledElement25removeMappedAttributeDeclENS_20MappedAttributeEntryERKNS_13QualifiedNameERKN3WTF12AtomicStringE __ZN7WebCore26CSSMutableStyleDeclarationD2Ev __ZN7WebCore17HTMLSelectElementD0Ev @@ -7918,10 +7916,6 @@ __ZNK7WebCore17CSSPrimitiveValue14getDoubleValueEt __ZNK7WebCore17CSSPrimitiveValue22getDoubleValueInternalENS0_9UnitTypesEPd __ZN7WebCore23HTMLTableCaptionElementD0Ev __ZN7WebCore13StyledElement11addCSSColorEPNS_9AttributeEiRKN3WTF6StringE -__ZN3WTF9HashTableIN7WebCore18MappedAttributeKeyESt4pairIS2_PNS1_29CSSMappedAttributeDeclarationEENS_18PairFirstExtractorIS6_EENS1_19MappedAttributeHashENS_14PairHashTraitsINS1_24MappedAttributeKeyTraitsENS_10HashTraitsIS5_EEEESB_E16lookupForWritingIS2_NS_22IdentityHashTranslatorIS2_S6_S9_EEEES3_IPS6_bERKT_ -__ZN3WTF9HashTableIN7WebCore18MappedAttributeKeyESt4pairIS2_PNS1_29CSSMappedAttributeDeclarationEENS_18PairFirstExtractorIS6_EENS1_19MappedAttributeHashENS_14PairHashTraitsINS1_24MappedAttributeKeyTraitsENS_10HashTraitsIS5_EEEESB_E3addIS2_S5_NS_17HashMapTranslatorIS6_SE_S9_EEEES3_INS_17HashTableIteratorIS2_S6_S8_S9_SE_SB_EEbERKT_RKT0_ -__ZN3WTF9HashTableIN7WebCore18MappedAttributeKeyESt4pairIS2_PNS1_29CSSMappedAttributeDeclarationEENS_18PairFirstExtractorIS6_EENS1_19MappedAttributeHashENS_14PairHashTraitsINS1_24MappedAttributeKeyTraitsENS_10HashTraitsIS5_EEEESB_E6lookupIS2_NS_22IdentityHashTranslatorIS2_S6_S9_EEEEPS6_RKT_ -__ZN3WTF9HashTableIN7WebCore18MappedAttributeKeyESt4pairIS2_PNS1_29CSSMappedAttributeDeclarationEENS_18PairFirstExtractorIS6_EENS1_19MappedAttributeHashENS_14PairHashTraitsINS1_24MappedAttributeKeyTraitsENS_10HashTraitsIS5_EEEESB_E6rehashEi __ZN7WebCore16HTMLStyleElement20parseMappedAttributeEPNS_9AttributeE __ZN7WebCore15FontFamilyValueC1ERKN3WTF6StringE __ZN7WebCore15FontFamilyValueC2ERKN3WTF6StringE diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index 1693441ac..59c667e92 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -8830,6 +8830,62 @@ > </File> <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLShadowElement.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLShadowElement.h" + > + </File> + <File RelativePath="$(ConfigurationBuildDir)\obj\$(ProjectName)\DerivedSources\JSHTMLSourceElement.cpp" > <FileConfiguration @@ -33886,7 +33942,7 @@ > </File> <File - RelativePath="..\css\CSSMutableStyleDeclaration.cpp" + RelativePath="..\css\StylePropertySet.cpp" > <FileConfiguration Name="Debug|Win32" @@ -33938,7 +33994,7 @@ </FileConfiguration> </File> <File - RelativePath="..\css\CSSMutableStyleDeclaration.h" + RelativePath="..\css\StylePropertySet.h" > </File> <File @@ -46642,62 +46698,6 @@ > </File> <File - RelativePath="..\dom\CSSMappedAttributeDeclaration.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Release_Cairo_CFLite|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Debug_All|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - <FileConfiguration - Name="Production|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="..\dom\CSSMappedAttributeDeclaration.h" - > - </File> - <File RelativePath="..\dom\CustomEvent.cpp" > <FileConfiguration @@ -48982,10 +48982,6 @@ > </File> <File - RelativePath="..\dom\MappedAttributeEntry.h" - > - </File> - <File RelativePath="..\dom\MessageChannel.cpp" > <FileConfiguration @@ -60378,14 +60374,6 @@ > </File> <File - RelativePath="..\html\IsIndexInputType.cpp" - > - </File> - <File - RelativePath="..\html\IsIndexInputType.h" - > - </File> - <File RelativePath="..\html\LabelsNodeList.cpp" > </File> @@ -60498,6 +60486,10 @@ > </File> <File + RelativePath="..\html\PublicURLManager.h" + > + </File> + <File RelativePath="..\html\RadioInputType.cpp" > </File> @@ -60893,6 +60885,62 @@ > </File> <File + RelativePath="..\html\shadow\HTMLShadowElement.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\html\shadow\HTMLShadowElement.h" + > + </File> + <File RelativePath="..\html\shadow\MediaControlElements.cpp" > </File> @@ -71606,6 +71654,30 @@ > </File> <File + RelativePath="..\inspector\InspectorHistory.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + <FileConfiguration + Name="Production|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="..\inspector\InspectorHistory.h" + > + </File> + <File RelativePath="..\inspector\InspectorIndexedDBAgent.cpp" > <FileConfiguration diff --git a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd index eea72c305..249347394 100755 --- a/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd +++ b/Source/WebCore/WebCore.vcproj/copyForwardingHeaders.cmd @@ -40,6 +40,7 @@ xcopy /y /d "%ProjectDir%..\platform\cf\*.h" "%CONFIGURATIONBUILDDIR%\include\We xcopy /y /d "%ProjectDir%..\platform\cf\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\%1\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" +xcopy /y /d "%ProjectDir%..\platform\graphics\filters\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\transforms\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\ca\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" xcopy /y /d "%ProjectDir%..\platform\graphics\ca\win\*.h" "%CONFIGURATIONBUILDDIR%\include\WebCore" diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index 51672dce4..0d1c49408 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -279,6 +279,7 @@ 0FF5026A102BA9430066F39A /* JSStyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50268102BA9430066F39A /* JSStyleMedia.h */; }; 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; }; 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; }; + 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; }; 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; }; 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 1403B99509EB13AF00797C7F /* DOMWindow.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1403B99609EB13AF00797C7F /* DOMWindow.cpp */; }; @@ -488,6 +489,15 @@ 1AA84F04143BA7BD0051D153 /* ScrollElasticityController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AA84F02143BA7BD0051D153 /* ScrollElasticityController.mm */; }; 1AA84F05143BA7BD0051D153 /* ScrollElasticityController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA84F03143BA7BD0051D153 /* ScrollElasticityController.h */; }; 1AA8799011CBE846003C664F /* PluginStrategy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA8798F11CBE846003C664F /* PluginStrategy.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1AAADDA314DB409F00AF64B3 /* ScrollingTree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */; }; + 1AAADDA414DB409F00AF64B3 /* ScrollingTree.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1AAADDBE14DC640700AF64B3 /* ScrollingTreeState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDBC14DC640600AF64B3 /* ScrollingTreeState.cpp */; }; + 1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */; }; + 1AAADDDA14DC74EC00AF64B3 /* ScrollingTreeStateMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDD814DC74EC00AF64B3 /* ScrollingTreeStateMac.mm */; }; + 1AAADDE314DC8C8F00AF64B3 /* ScrollingTreeNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDE114DC8C8F00AF64B3 /* ScrollingTreeNode.cpp */; }; + 1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDE214DC8C8F00AF64B3 /* ScrollingTreeNode.h */; }; + 1AAADDE814DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AAADDE614DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm */; }; + 1AAADDE914DC8DF800AF64B3 /* ScrollingTreeNodeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AAADDE714DC8DF800AF64B3 /* ScrollingTreeNodeMac.h */; }; 1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */; }; 1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */ = {isa = PBXBuildFile; fileRef = 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */; }; 1AB33DA512551E320024457A /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AB33DA412551E320024457A /* IOKit.framework */; }; @@ -587,6 +597,9 @@ 1AF62EE614DA22A70041556C /* ScrollingCoordinatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */; }; 1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */; }; 1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 1AF62F2414DAFE910041556C /* ScrollingThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62F2314DAFE910041556C /* ScrollingThreadMac.mm */; }; + 1AF62F2514DAFE9E0041556C /* ScrollingThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF62F2014DAFE790041556C /* ScrollingThread.cpp */; }; + 1AF62F2614DAFEA10041556C /* ScrollingThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF62F2114DAFE790041556C /* ScrollingThread.h */; }; 1AF8E11A1256592600230FF7 /* ProxyServer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF8E1191256592600230FF7 /* ProxyServer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1AF8E13312565A4400230FF7 /* ProxyServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF8E13212565A4400230FF7 /* ProxyServer.cpp */; }; 1AF8E1C3125673E000230FF7 /* ProxyServerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */; }; @@ -1342,11 +1355,19 @@ 49FFBF4011C93EE3006A7118 /* WebGLLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */; }; 4A0DA2FE129B241900AB61E1 /* FormAssociatedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */; }; 4A0DA2FF129B241900AB61E1 /* FormAssociatedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 4A1E719014E101E400626F9D /* JSHTMLContentElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E718E14E101E400626F9D /* JSHTMLContentElement.cpp */; }; + 4A1E719114E101E400626F9D /* JSHTMLContentElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A1E718F14E101E400626F9D /* JSHTMLContentElement.h */; }; + 4A1E719514E101F900626F9D /* JSHTMLShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E719314E101F900626F9D /* JSHTMLShadowElement.cpp */; }; + 4A1E719614E101F900626F9D /* JSHTMLShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A1E719414E101F900626F9D /* JSHTMLShadowElement.h */; }; + 4A1E71A514E106AC00626F9D /* JSShadowRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A1E71A314E106AC00626F9D /* JSShadowRoot.cpp */; }; + 4A1E71A614E106AC00626F9D /* JSShadowRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A1E71A414E106AC00626F9D /* JSShadowRoot.h */; }; 4A6E9FC313C17D1D0046A7F8 /* FontFeatureValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6E9FC113C17D1D0046A7F8 /* FontFeatureValue.cpp */; }; 4A6E9FC413C17D1D0046A7F8 /* FontFeatureValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A6E9FC213C17D1D0046A7F8 /* FontFeatureValue.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4A6E9FC713C17D570046A7F8 /* FontFeatureSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A6E9FC513C17D570046A7F8 /* FontFeatureSettings.cpp */; }; 4A6E9FC813C17D570046A7F8 /* FontFeatureSettings.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A6E9FC613C17D570046A7F8 /* FontFeatureSettings.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4A8C96EB0BE69032004EEFF0 /* FrameSelectionMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */; }; + 4ABDFF0B14DBE385004D117D /* HTMLShadowElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ABDFF0714DBE312004D117D /* HTMLShadowElement.cpp */; }; + 4ABDFF0C14DBE385004D117D /* HTMLShadowElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ABDFF0814DBE312004D117D /* HTMLShadowElement.h */; }; 4ACBC0BE12713CBD0094F9B2 /* ClassList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0BC12713CBD0094F9B2 /* ClassList.cpp */; }; 4ACBC0BF12713CBD0094F9B2 /* ClassList.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ACBC0BD12713CBD0094F9B2 /* ClassList.h */; }; 4ACBC0C312713CCA0094F9B2 /* DOMSettableTokenList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4ACBC0C012713CCA0094F9B2 /* DOMSettableTokenList.cpp */; }; @@ -1761,10 +1782,10 @@ 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; }; 6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */; }; 6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; }; - 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */; }; - 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextures.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */; }; - 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */; }; - 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextures.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */; }; + 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */; }; + 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */; }; + 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */; }; + 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; }; 6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; }; 6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; }; 6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; }; @@ -1867,6 +1888,8 @@ 7A1F2B52126C61B20006A7E6 /* InspectorClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */; }; 7A24587B1021EAF4000A00AA /* InspectorDOMAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */; }; 7A24587C1021EAF4000A00AA /* InspectorDOMAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 7A54857F14E02D51006AE05A /* InspectorHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A54857D14E02D51006AE05A /* InspectorHistory.cpp */; }; + 7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A54857E14E02D51006AE05A /* InspectorHistory.h */; }; 7A674BDB0F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */; }; 7A674BDC0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A674BDA0F9EBF4E006CF099 /* PageGroupLoadDeferrer.h */; }; 7A74ECBA101839A600BF939E /* InspectorDOMStorageAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECB8101839A500BF939E /* InspectorDOMStorageAgent.cpp */; }; @@ -3621,8 +3644,8 @@ A80E6D0B0A1989CA007FB8C5 /* DashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */; }; A80E6D0C0A1989CA007FB8C5 /* CSSStyleRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */; }; A80E6D0D0A1989CA007FB8C5 /* CSSRule.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6CE30A1989CA007FB8C5 /* CSSRule.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A80E6DFB0A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6DF90A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp */; }; - A80E6DFC0A199067007FB8C5 /* CSSMutableStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6DFA0A199067007FB8C5 /* CSSMutableStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; }; + A80E6DFB0A199067007FB8C5 /* StylePropertySet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6DF90A199067007FB8C5 /* StylePropertySet.cpp */; }; + A80E6DFC0A199067007FB8C5 /* StylePropertySet.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6DFA0A199067007FB8C5 /* StylePropertySet.h */; settings = {ATTRIBUTES = (Private, ); }; }; A80E6E0F0A19911C007FB8C5 /* CSSStyleDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E6E0D0A19911C007FB8C5 /* CSSStyleDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; }; A80E6E100A19911C007FB8C5 /* CSSStyleDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A80E6E0E0A19911C007FB8C5 /* CSSStyleDeclaration.cpp */; }; A80E734E0A199C77007FB8C5 /* CSSNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = A80E73470A199C77007FB8C5 /* CSSNamespace.h */; }; @@ -3960,13 +3983,10 @@ A8C4A80009D563270003AC8D /* Node.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7EE09D563270003AC8D /* Node.cpp */; }; A8C4A80709D563270003AC8D /* Element.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F509D563270003AC8D /* Element.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8C4A80809D563270003AC8D /* Element.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F609D563270003AC8D /* Element.cpp */; }; - A8C4A80909D563270003AC8D /* CSSMappedAttributeDeclaration.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */; settings = {ATTRIBUTES = (Private, ); }; }; - A8C4A80A09D563270003AC8D /* CSSMappedAttributeDeclaration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */; }; A8C4A80B09D563270003AC8D /* Attribute.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7F909D563270003AC8D /* Attribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8C4A80C09D563270003AC8D /* Attribute.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7FA09D563270003AC8D /* Attribute.cpp */; }; A8C4A80D09D563270003AC8D /* Attr.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A7FB09D563270003AC8D /* Attr.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8C4A80E09D563270003AC8D /* Attr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8C4A7FC09D563270003AC8D /* Attr.cpp */; }; - A8C4A84C09D5649D0003AC8D /* MappedAttributeEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8CB413E0E8633FD0032C4F0 /* DashArray.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CB41020E85B8A50032C4F0 /* DashArray.h */; settings = {ATTRIBUTES = (Private, ); }; }; A8CFF04D0A154F09000A4234 /* FixedTableLayout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */; }; A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = A8CFF0490A154F09000A4234 /* AutoTableLayout.h */; }; @@ -5579,6 +5599,7 @@ CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */; }; CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */; }; CD8203111395ACE700F956C6 /* WebWindowAnimation.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */; }; + CDAA8D0A14D71B2E0061EA60 /* PlatformClockCM.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDAA8D0814D385600061EA60 /* PlatformClockCM.mm */; }; CDD525D7145B6DD0008D204D /* JSHTMLMediaElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDF65CCC145B6AFE00C4C7AA /* JSHTMLMediaElementCustom.cpp */; }; CDEA763014608A53008B31F1 /* PlatformClockCA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */; }; CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDEA76321460AE29008B31F1 /* ClockGeneric.cpp */; }; @@ -5917,8 +5938,6 @@ F55B3DC01251F12D003EF269 /* HiddenInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D8C1251F12D003EF269 /* HiddenInputType.h */; }; F55B3DC11251F12D003EF269 /* ImageInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */; }; F55B3DC21251F12D003EF269 /* ImageInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D8E1251F12D003EF269 /* ImageInputType.h */; }; - F55B3DC31251F12D003EF269 /* IsIndexInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */; }; - F55B3DC41251F12D003EF269 /* IsIndexInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D901251F12D003EF269 /* IsIndexInputType.h */; }; F55B3DC51251F12D003EF269 /* MonthInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D911251F12D003EF269 /* MonthInputType.cpp */; }; F55B3DC61251F12D003EF269 /* MonthInputType.h in Headers */ = {isa = PBXBuildFile; fileRef = F55B3D921251F12D003EF269 /* MonthInputType.h */; }; F55B3DC71251F12D003EF269 /* NumberInputType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55B3D931251F12D003EF269 /* NumberInputType.cpp */; }; @@ -6960,6 +6979,7 @@ 0FF5026E102BA9660066F39A /* StyleMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleMedia.cpp; sourceTree = "<group>"; }; 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; }; 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; }; + 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; }; 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; }; 1403B90C09EB124500797C7F /* DOMWindow.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindow.idl; sourceTree = "<group>"; }; 1403B99509EB13AF00797C7F /* DOMWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindow.h; sourceTree = "<group>"; }; @@ -7201,6 +7221,15 @@ 1AA84F02143BA7BD0051D153 /* ScrollElasticityController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollElasticityController.mm; sourceTree = "<group>"; }; 1AA84F03143BA7BD0051D153 /* ScrollElasticityController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollElasticityController.h; sourceTree = "<group>"; }; 1AA8798F11CBE846003C664F /* PluginStrategy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginStrategy.h; sourceTree = "<group>"; }; + 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTree.cpp; sourceTree = "<group>"; }; + 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTree.h; sourceTree = "<group>"; }; + 1AAADDBC14DC640600AF64B3 /* ScrollingTreeState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreeState.cpp; sourceTree = "<group>"; }; + 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeState.h; sourceTree = "<group>"; }; + 1AAADDD814DC74EC00AF64B3 /* ScrollingTreeStateMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreeStateMac.mm; sourceTree = "<group>"; }; + 1AAADDE114DC8C8F00AF64B3 /* ScrollingTreeNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreeNode.cpp; sourceTree = "<group>"; }; + 1AAADDE214DC8C8F00AF64B3 /* ScrollingTreeNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeNode.h; sourceTree = "<group>"; }; + 1AAADDE614DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreeNodeMac.mm; sourceTree = "<group>"; }; + 1AAADDE714DC8DF800AF64B3 /* ScrollingTreeNodeMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreeNodeMac.h; sourceTree = "<group>"; }; 1AB1AE780C051FDE00139F4F /* zoomInCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomInCursor.png; sourceTree = "<group>"; }; 1AB1AE790C051FDE00139F4F /* zoomOutCursor.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = zoomOutCursor.png; sourceTree = "<group>"; }; 1AB33DA412551E320024457A /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; }; @@ -7323,6 +7352,9 @@ 1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingCoordinatorMac.mm; sourceTree = "<group>"; }; 1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingCoordinator.cpp; sourceTree = "<group>"; }; 1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingCoordinator.h; sourceTree = "<group>"; }; + 1AF62F2014DAFE790041556C /* ScrollingThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingThread.cpp; sourceTree = "<group>"; }; + 1AF62F2114DAFE790041556C /* ScrollingThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingThread.h; sourceTree = "<group>"; }; + 1AF62F2314DAFE910041556C /* ScrollingThreadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingThreadMac.mm; sourceTree = "<group>"; }; 1AF8E1191256592600230FF7 /* ProxyServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProxyServer.h; sourceTree = "<group>"; }; 1AF8E13212565A4400230FF7 /* ProxyServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyServer.cpp; sourceTree = "<group>"; }; 1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyServerCFNet.cpp; sourceTree = "<group>"; }; @@ -8159,11 +8191,20 @@ 49FFBF3E11C93EE3006A7118 /* WebGLLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLLayer.mm; sourceTree = "<group>"; }; 4A0DA2FC129B241900AB61E1 /* FormAssociatedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FormAssociatedElement.cpp; sourceTree = "<group>"; }; 4A0DA2FD129B241900AB61E1 /* FormAssociatedElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FormAssociatedElement.h; sourceTree = "<group>"; }; + 4A1E718E14E101E400626F9D /* JSHTMLContentElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLContentElement.cpp; sourceTree = "<group>"; }; + 4A1E718F14E101E400626F9D /* JSHTMLContentElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLContentElement.h; sourceTree = "<group>"; }; + 4A1E719314E101F900626F9D /* JSHTMLShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLShadowElement.cpp; sourceTree = "<group>"; }; + 4A1E719414E101F900626F9D /* JSHTMLShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHTMLShadowElement.h; sourceTree = "<group>"; }; + 4A1E71A314E106AC00626F9D /* JSShadowRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSShadowRoot.cpp; sourceTree = "<group>"; }; + 4A1E71A414E106AC00626F9D /* JSShadowRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSShadowRoot.h; sourceTree = "<group>"; }; 4A6E9FC113C17D1D0046A7F8 /* FontFeatureValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFeatureValue.cpp; sourceTree = "<group>"; }; 4A6E9FC213C17D1D0046A7F8 /* FontFeatureValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontFeatureValue.h; sourceTree = "<group>"; }; 4A6E9FC513C17D570046A7F8 /* FontFeatureSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFeatureSettings.cpp; sourceTree = "<group>"; }; 4A6E9FC613C17D570046A7F8 /* FontFeatureSettings.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.h; fileEncoding = 4; path = FontFeatureSettings.h; sourceTree = "<group>"; }; 4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = FrameSelectionMac.mm; path = mac/FrameSelectionMac.mm; sourceTree = "<group>"; }; + 4ABDFF0714DBE312004D117D /* HTMLShadowElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLShadowElement.cpp; sourceTree = "<group>"; }; + 4ABDFF0814DBE312004D117D /* HTMLShadowElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLShadowElement.h; sourceTree = "<group>"; }; + 4ABDFF0914DBE312004D117D /* HTMLShadowElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLShadowElement.idl; sourceTree = "<group>"; }; 4ACBC0BC12713CBD0094F9B2 /* ClassList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClassList.cpp; sourceTree = "<group>"; }; 4ACBC0BD12713CBD0094F9B2 /* ClassList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassList.h; sourceTree = "<group>"; }; 4ACBC0C012713CCA0094F9B2 /* DOMSettableTokenList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMSettableTokenList.cpp; sourceTree = "<group>"; }; @@ -8607,11 +8648,11 @@ 65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; }; 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3D.cpp; sourceTree = "<group>"; }; 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = "<group>"; }; - 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextures.cpp; sourceTree = "<group>"; }; - 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextures.h; sourceTree = "<group>"; }; - 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextures.cpp; path = canvas/WebGLCompressedTextures.cpp; sourceTree = "<group>"; }; - 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextures.h; path = canvas/WebGLCompressedTextures.h; sourceTree = "<group>"; }; - 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextures.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextures.idl; path = canvas/WebGLCompressedTextures.idl; sourceTree = "<group>"; }; + 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; }; + 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureS3TC.h; sourceTree = "<group>"; }; + 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureS3TC.cpp; path = canvas/WebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; }; + 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextureS3TC.h; path = canvas/WebGLCompressedTextureS3TC.h; sourceTree = "<group>"; }; + 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureS3TC.idl; path = canvas/WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; }; 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; }; 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; }; 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLUnknownElement.cpp; sourceTree = "<group>"; }; @@ -8730,6 +8771,8 @@ 7A1F2B51126C61B20006A7E6 /* InspectorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorClient.cpp; sourceTree = "<group>"; }; 7A2458791021EAF4000A00AA /* InspectorDOMAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorDOMAgent.cpp; sourceTree = "<group>"; }; 7A24587A1021EAF4000A00AA /* InspectorDOMAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorDOMAgent.h; sourceTree = "<group>"; }; + 7A54857D14E02D51006AE05A /* InspectorHistory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorHistory.cpp; sourceTree = "<group>"; }; + 7A54857E14E02D51006AE05A /* InspectorHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorHistory.h; sourceTree = "<group>"; }; 7A563E5412DE32B000F4536D /* InjectedScriptSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScriptSource.h; sourceTree = "<group>"; }; 7A563F9512DF5C9100F4536D /* InjectedScriptSource.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = InjectedScriptSource.js; sourceTree = "<group>"; }; 7A674BD90F9EBF4E006CF099 /* PageGroupLoadDeferrer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroupLoadDeferrer.cpp; sourceTree = "<group>"; }; @@ -10460,8 +10503,8 @@ A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DashboardRegion.h; sourceTree = "<group>"; }; A80E6CE20A1989CA007FB8C5 /* CSSStyleRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSStyleRule.h; sourceTree = "<group>"; }; A80E6CE30A1989CA007FB8C5 /* CSSRule.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSRule.h; sourceTree = "<group>"; }; - A80E6DF90A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSMutableStyleDeclaration.cpp; sourceTree = "<group>"; }; - A80E6DFA0A199067007FB8C5 /* CSSMutableStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSMutableStyleDeclaration.h; sourceTree = "<group>"; }; + A80E6DF90A199067007FB8C5 /* StylePropertySet.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertySet.cpp; sourceTree = "<group>"; }; + A80E6DFA0A199067007FB8C5 /* StylePropertySet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = StylePropertySet.h; sourceTree = "<group>"; }; A80E6E0D0A19911C007FB8C5 /* CSSStyleDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSStyleDeclaration.h; sourceTree = "<group>"; }; A80E6E0E0A19911C007FB8C5 /* CSSStyleDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSStyleDeclaration.cpp; sourceTree = "<group>"; }; A80E73470A199C77007FB8C5 /* CSSNamespace.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSNamespace.h; sourceTree = "<group>"; }; @@ -10669,13 +10712,10 @@ A8C4A7EE09D563270003AC8D /* Node.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Node.cpp; sourceTree = "<group>"; }; A8C4A7F509D563270003AC8D /* Element.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Element.h; sourceTree = "<group>"; }; A8C4A7F609D563270003AC8D /* Element.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Element.cpp; sourceTree = "<group>"; }; - A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSMappedAttributeDeclaration.h; sourceTree = "<group>"; }; - A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CSSMappedAttributeDeclaration.cpp; sourceTree = "<group>"; }; A8C4A7F909D563270003AC8D /* Attribute.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Attribute.h; sourceTree = "<group>"; }; A8C4A7FA09D563270003AC8D /* Attribute.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Attribute.cpp; sourceTree = "<group>"; }; A8C4A7FB09D563270003AC8D /* Attr.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Attr.h; sourceTree = "<group>"; }; A8C4A7FC09D563270003AC8D /* Attr.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Attr.cpp; sourceTree = "<group>"; }; - A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MappedAttributeEntry.h; sourceTree = "<group>"; }; A8CB41020E85B8A50032C4F0 /* DashArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DashArray.h; sourceTree = "<group>"; }; A8CFF0480A154F09000A4234 /* FixedTableLayout.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FixedTableLayout.cpp; sourceTree = "<group>"; }; A8CFF0490A154F09000A4234 /* AutoTableLayout.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AutoTableLayout.h; sourceTree = "<group>"; }; @@ -12511,6 +12551,8 @@ CD8203091395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenHUDWindowController.mm; sourceTree = "<group>"; }; CD82030E1395ACE700F956C6 /* WebWindowAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindowAnimation.h; sourceTree = "<group>"; }; CD82030F1395ACE700F956C6 /* WebWindowAnimation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebWindowAnimation.mm; sourceTree = "<group>"; }; + CDAA8D0714D385600061EA60 /* PlatformClockCM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformClockCM.h; sourceTree = "<group>"; }; + CDAA8D0814D385600061EA60 /* PlatformClockCM.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformClockCM.mm; sourceTree = "<group>"; }; CDBD93BA1333BD4B002570E3 /* fullscreenQuickTime.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.css; path = fullscreenQuickTime.css; sourceTree = "<group>"; }; CDCE5CD014633BC900D47CCA /* EventTargetFactory.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EventTargetFactory.in; sourceTree = "<group>"; }; CDEA762C14608224008B31F1 /* Clock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clock.h; sourceTree = "<group>"; }; @@ -12881,8 +12923,6 @@ F55B3D8C1251F12D003EF269 /* HiddenInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HiddenInputType.h; sourceTree = "<group>"; }; F55B3D8D1251F12D003EF269 /* ImageInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageInputType.cpp; sourceTree = "<group>"; }; F55B3D8E1251F12D003EF269 /* ImageInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageInputType.h; sourceTree = "<group>"; }; - F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IsIndexInputType.cpp; sourceTree = "<group>"; }; - F55B3D901251F12D003EF269 /* IsIndexInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IsIndexInputType.h; sourceTree = "<group>"; }; F55B3D911251F12D003EF269 /* MonthInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MonthInputType.cpp; sourceTree = "<group>"; }; F55B3D921251F12D003EF269 /* MonthInputType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonthInputType.h; sourceTree = "<group>"; }; F55B3D931251F12D003EF269 /* NumberInputType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NumberInputType.cpp; sourceTree = "<group>"; }; @@ -13191,7 +13231,6 @@ FDF6BAF7134A4C9800822920 /* JSOfflineAudioCompletionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOfflineAudioCompletionEvent.h; sourceTree = "<group>"; }; FDF7E9C113AC21DB00A51EAC /* JSAudioBufferCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAudioBufferCallback.cpp; sourceTree = "<group>"; }; FDF7E9C213AC21DB00A51EAC /* JSAudioBufferCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAudioBufferCallback.h; sourceTree = "<group>"; }; - FE49EF970DC51462004266E1 /* DashboardSupportCSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DashboardSupportCSSPropertyNames.in; sourceTree = "<group>"; }; FE6FD4850F676E5700092873 /* Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coordinates.h; sourceTree = "<group>"; }; FE6FD4860F676E5700092873 /* Coordinates.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Coordinates.idl; sourceTree = "<group>"; }; FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = "<group>"; }; @@ -13911,6 +13950,14 @@ 1AF62EE214DA22A70041556C /* mac */, 1AF62EE414DA22A70041556C /* ScrollingCoordinator.cpp */, 1AF62EE514DA22A70041556C /* ScrollingCoordinator.h */, + 1AF62F2014DAFE790041556C /* ScrollingThread.cpp */, + 1AF62F2114DAFE790041556C /* ScrollingThread.h */, + 1AAADDA114DB409F00AF64B3 /* ScrollingTree.cpp */, + 1AAADDA214DB409F00AF64B3 /* ScrollingTree.h */, + 1AAADDE114DC8C8F00AF64B3 /* ScrollingTreeNode.cpp */, + 1AAADDE214DC8C8F00AF64B3 /* ScrollingTreeNode.h */, + 1AAADDBC14DC640600AF64B3 /* ScrollingTreeState.cpp */, + 1AAADDBD14DC640600AF64B3 /* ScrollingTreeState.h */, ); path = scrolling; sourceTree = "<group>"; @@ -13919,6 +13966,10 @@ isa = PBXGroup; children = ( 1AF62EE314DA22A70041556C /* ScrollingCoordinatorMac.mm */, + 1AF62F2314DAFE910041556C /* ScrollingThreadMac.mm */, + 1AAADDE714DC8DF800AF64B3 /* ScrollingTreeNodeMac.h */, + 1AAADDE614DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm */, + 1AAADDD814DC74EC00AF64B3 /* ScrollingTreeStateMac.mm */, ); path = mac; sourceTree = "<group>"; @@ -14010,6 +14061,8 @@ 7A0E770B10C00A8800A0276E /* InspectorFrontendHost.cpp */, 7A0E770C10C00A8800A0276E /* InspectorFrontendHost.h */, 7A0E770D10C00A8800A0276E /* InspectorFrontendHost.idl */, + 7A54857D14E02D51006AE05A /* InspectorHistory.cpp */, + 7A54857E14E02D51006AE05A /* InspectorHistory.h */, 7ACD88D114C08BD60084EDD2 /* InspectorIndexedDBAgent.cpp */, 7ACD88D214C08BD60084EDD2 /* InspectorIndexedDBAgent.h */, 20D629241253690B00081543 /* InspectorInstrumentation.cpp */, @@ -14281,6 +14334,9 @@ 57B791A714C6A63300F202D1 /* HTMLContentElement.cpp */, 57B791A814C6A63300F202D1 /* HTMLContentElement.h */, A7B7749614CF6353004044BB /* HTMLContentElement.idl */, + 4ABDFF0714DBE312004D117D /* HTMLShadowElement.cpp */, + 4ABDFF0814DBE312004D117D /* HTMLShadowElement.h */, + 4ABDFF0914DBE312004D117D /* HTMLShadowElement.idl */, 417253A81354BBBC00360F2A /* MediaControlElements.cpp */, 417253A91354BBBC00360F2A /* MediaControlElements.h */, 4157AF7F12F1FB0400A8C6F5 /* MediaControlRootElement.cpp */, @@ -14421,9 +14477,9 @@ 49C7B9A81042D32E0009D447 /* WebGLBuffer.cpp */, 49C7B9A91042D32E0009D447 /* WebGLBuffer.h */, 49C7B9AA1042D32E0009D447 /* WebGLBuffer.idl */, - 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */, - 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */, - 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextures.idl */, + 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */, + 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */, + 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */, 6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */, 6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */, 6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */, @@ -14979,6 +15035,8 @@ 4B2709810AF2E5E00065127F /* PasteboardMac.mm */, CDEA762E146084DE008B31F1 /* PlatformClockCA.cpp */, CDEA762F146084EE008B31F1 /* PlatformClockCA.h */, + CDAA8D0714D385600061EA60 /* PlatformClockCM.h */, + CDAA8D0814D385600061EA60 /* PlatformClockCM.mm */, BCAA486E14A052530088FAC4 /* PlatformEventFactoryMac.h */, BCAA486D14A052530088FAC4 /* PlatformEventFactoryMac.mm */, BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */, @@ -16853,8 +16911,6 @@ F55B3D8E1251F12D003EF269 /* ImageInputType.h */, 37E3524A12450C5200BAF5D9 /* InputType.cpp */, 37E3524C12450C6600BAF5D9 /* InputType.h */, - F55B3D8F1251F12D003EF269 /* IsIndexInputType.cpp */, - F55B3D901251F12D003EF269 /* IsIndexInputType.h */, A456FA2411AD4A830020B420 /* LabelsNodeList.cpp */, A456FA2511AD4A830020B420 /* LabelsNodeList.h */, 985BB96B13A94058007A0B69 /* LinkRelAttribute.cpp */, @@ -16881,6 +16937,7 @@ F55B3D961251F12D003EF269 /* PasswordInputType.h */, 97205AB91239292700B17380 /* PluginDocument.cpp */, 97205ABA1239292700B17380 /* PluginDocument.h */, + 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */, F55B3D971251F12D003EF269 /* RadioInputType.cpp */, F55B3D981251F12D003EF269 /* RadioInputType.h */, F55B3D991251F12D003EF269 /* RangeInputType.cpp */, @@ -17229,6 +17286,8 @@ 938E666109F09B87008A48EC /* JSHTMLCanvasElement.h */, BCCBAD3E0C18C14200CE890F /* JSHTMLCollection.cpp */, BCCBAD3F0C18C14200CE890F /* JSHTMLCollection.h */, + 4A1E718E14E101E400626F9D /* JSHTMLContentElement.cpp */, + 4A1E718F14E101E400626F9D /* JSHTMLContentElement.h */, F5C041E10FFCA96D00839D4A /* JSHTMLDataListElement.cpp */, F5C041E20FFCA96D00839D4A /* JSHTMLDataListElement.h */, D359D8BC129CA55C0006E5D2 /* JSHTMLDetailsElement.cpp */, @@ -17321,6 +17380,8 @@ 1AE2ABA50A1CE90500B42B25 /* JSHTMLScriptElement.h */, E1E6EEA30B628DA8005F2F70 /* JSHTMLSelectElement.cpp */, E1E6EEA70B628DB3005F2F70 /* JSHTMLSelectElement.h */, + 4A1E719314E101F900626F9D /* JSHTMLShadowElement.cpp */, + 4A1E719414E101F900626F9D /* JSHTMLShadowElement.h */, E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */, E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */, 9752D38B1413104B003305BD /* JSHTMLSpanElement.cpp */, @@ -17397,8 +17458,8 @@ A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */, 49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */, 49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */, - 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */, - 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */, + 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */, + 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */, 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */, 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */, BC2CBF7A140F1D58003879BE /* JSWebGLContextEvent.cpp */, @@ -17867,6 +17928,8 @@ E4B423860CBFB73C00AF2ECE /* JSProgressEvent.h */, 4998AECB13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp */, 4998AECC13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h */, + 4A1E71A314E106AC00626F9D /* JSShadowRoot.cpp */, + 4A1E71A414E106AC00626F9D /* JSShadowRoot.h */, 75415D4F129AB2D2003AD669 /* JSSpeechInputEvent.cpp */, 75415D50129AB2D2003AD669 /* JSSpeechInputEvent.h */, 75415D51129AB2D2003AD669 /* JSSpeechInputResult.cpp */, @@ -19949,8 +20012,8 @@ A80E6CD20A1989CA007FB8C5 /* CSSMediaRule.cpp */, A80E6CD90A1989CA007FB8C5 /* CSSMediaRule.h */, 85C56CA20AA89C1000D95755 /* CSSMediaRule.idl */, - A80E6DF90A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp */, - A80E6DFA0A199067007FB8C5 /* CSSMutableStyleDeclaration.h */, + A80E6DF90A199067007FB8C5 /* StylePropertySet.cpp */, + A80E6DFA0A199067007FB8C5 /* StylePropertySet.h */, A80E73470A199C77007FB8C5 /* CSSNamespace.h */, F98FFF4211A2676200F548E8 /* CSSOMUtils.cpp */, F98FFF4311A2676200F548E8 /* CSSOMUtils.h */, @@ -20018,7 +20081,6 @@ 501BAAB11395114B00F7ACEB /* CSSWrapShapes.cpp */, 501BA9E11393CEA000F7ACEB /* CSSWrapShapes.h */, A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */, - FE49EF970DC51462004266E1 /* DashboardSupportCSSPropertyNames.in */, A80E6CC20A1989CA007FB8C5 /* FontFamilyValue.cpp */, A80E6CC90A1989CA007FB8C5 /* FontFamilyValue.h */, 4A6E9FC113C17D1D0046A7F8 /* FontFeatureValue.cpp */, @@ -20370,8 +20432,6 @@ A81872110977D3C0005826D9 /* ContainerNode.h */, E1A1470711102B1500EEC0F3 /* ContainerNodeAlgorithms.h */, 2E3FAA0811A36BF100576624 /* CrossThreadTask.h */, - A8C4A7F809D563270003AC8D /* CSSMappedAttributeDeclaration.cpp */, - A8C4A7F709D563270003AC8D /* CSSMappedAttributeDeclaration.h */, 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */, 62CD32571157E57C0063B0A7 /* CustomEvent.h */, 62CD32581157E57C0063B0A7 /* CustomEvent.idl */, @@ -20496,7 +20556,6 @@ BC9A6144146859D9006057FD /* make_dom_exceptions.pl */, BC9A6145146859D9006057FD /* make_event_factory.pl */, BC9A6146146859D9006057FD /* make_names.pl */, - A8C4A84B09D5649D0003AC8D /* MappedAttributeEntry.h */, E1ADECCD0E76AD8B004A1A5E /* MessageChannel.cpp */, E1ADECCC0E76AD8B004A1A5E /* MessageChannel.h */, E1ADECD00E76ADAB004A1A5E /* MessageChannel.idl */, @@ -21254,9 +21313,8 @@ A80E6D010A1989CA007FB8C5 /* CSSInheritedValue.h in Headers */, A80E6D080A1989CA007FB8C5 /* CSSInitialValue.h in Headers */, BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */, - A8C4A80909D563270003AC8D /* CSSMappedAttributeDeclaration.h in Headers */, A80E6D030A1989CA007FB8C5 /* CSSMediaRule.h in Headers */, - A80E6DFC0A199067007FB8C5 /* CSSMutableStyleDeclaration.h in Headers */, + A80E6DFC0A199067007FB8C5 /* StylePropertySet.h in Headers */, A80E734E0A199C77007FB8C5 /* CSSNamespace.h in Headers */, F98FFF4511A2676200F548E8 /* CSSOMUtils.h in Headers */, A80E6D000A1989CA007FB8C5 /* CSSPageRule.h in Headers */, @@ -22295,6 +22353,7 @@ 977B3875122883E900B81FF8 /* HTMLScriptRunner.h in Headers */, 977B3876122883E900B81FF8 /* HTMLScriptRunnerHost.h in Headers */, A81369D8097374F600D74463 /* HTMLSelectElement.h in Headers */, + 4ABDFF0C14DBE385004D117D /* HTMLShadowElement.h in Headers */, E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */, 977E2DCE12F0E28300C13379 /* HTMLSourceTracker.h in Headers */, 978AD67514130A8D00C7CAE3 /* HTMLSpanElement.h in Headers */, @@ -22433,7 +22492,6 @@ E134F5AB12EE343F004EC58D /* IntRectHash.h in Headers */, B27535750B053814002CE64F /* IntSize.h in Headers */, B27535760B053814002CE64F /* IntSizeHash.h in Headers */, - F55B3DC41251F12D003EF269 /* IsIndexInputType.h in Headers */, 598D77DF132541FA00761B22 /* JavaArrayJSC.h in Headers */, 59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */, 598D77E31325420E00761B22 /* JavaFieldJSC.h in Headers */, @@ -22596,6 +22654,7 @@ A80E7E9F0A1A83E3007FB8C5 /* JSHTMLButtonElement.h in Headers */, 938E666209F09B87008A48EC /* JSHTMLCanvasElement.h in Headers */, BCCBAD410C18C14200CE890F /* JSHTMLCollection.h in Headers */, + 4A1E719114E101E400626F9D /* JSHTMLContentElement.h in Headers */, F5C041E70FFCA96D00839D4A /* JSHTMLDataListElement.h in Headers */, D359D8BF129CA55C0006E5D2 /* JSHTMLDetailsElement.h in Headers */, 1A85B1E70A1B240500D8C87C /* JSHTMLDirectoryElement.h in Headers */, @@ -22647,6 +22706,7 @@ 1AE2ABAD0A1CE90500B42B25 /* JSHTMLScriptElement.h in Headers */, E1E6EEA80B628DB3005F2F70 /* JSHTMLSelectElement.h in Headers */, AB4CB4EB0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h in Headers */, + 4A1E719614E101F900626F9D /* JSHTMLShadowElement.h in Headers */, E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */, 9752D38E1413104B003305BD /* JSHTMLSpanElement.h in Headers */, A80E7B0E0A19D606007FB8C5 /* JSHTMLStyleElement.h in Headers */, @@ -22738,6 +22798,7 @@ BCEC01C30C274DDD009F4EC9 /* JSScreen.h in Headers */, 9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */, 9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */, + 4A1E71A614E106AC00626F9D /* JSShadowRoot.h in Headers */, 41D07A7F0FF935CA0095EDCE /* JSSharedWorker.h in Headers */, 41D1690610238B66009BC827 /* JSSharedWorkerContext.h in Headers */, 75415D56129AB2D2003AD669 /* JSSpeechInputEvent.h in Headers */, @@ -22923,7 +22984,7 @@ FD82D7F813D4C8BD004E4372 /* JSWaveShaperNode.h in Headers */, A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */, 49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */, - 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextures.h in Headers */, + 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */, 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */, BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */, 49C7B9981042D2D30009D447 /* JSWebGLFramebuffer.h in Headers */, @@ -23016,7 +23077,6 @@ FD31603912B0267600C1A359 /* LowPass2FilterNode.h in Headers */, 656D37410ADBA5DE00A4554D /* MainResourceLoader.h in Headers */, 1A8F6BC60DB55CDC001DB794 /* ManifestParser.h in Headers */, - A8C4A84C09D5649D0003AC8D /* MappedAttributeEntry.h in Headers */, 93309DF8099E64920056E581 /* markup.h in Headers */, 9728C3141268E4390041E89B /* MarkupAccumulator.h in Headers */, 00A629C113D0BEC70050AC52 /* MarkupTokenBase.h in Headers */, @@ -23951,7 +24011,7 @@ BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */, A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */, 49C7B9C91042D32F0009D447 /* WebGLBuffer.h in Headers */, - 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextures.h in Headers */, + 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */, 6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */, 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */, 01D3CF8314BD0A3000FE9970 /* WebGLContextGroup.h in Headers */, @@ -24088,6 +24148,13 @@ 0720B0A114D3323500642955 /* GenericEventQueue.h in Headers */, 2CF6878A14D32EFF00340F39 /* ElementAttributeData.h in Headers */, 1AF62EE814DA22A70041556C /* ScrollingCoordinator.h in Headers */, + 1AF62F2614DAFEA10041556C /* ScrollingThread.h in Headers */, + 1AAADDA414DB409F00AF64B3 /* ScrollingTree.h in Headers */, + 1AAADDBF14DC640700AF64B3 /* ScrollingTreeState.h in Headers */, + 1AAADDE414DC8C8F00AF64B3 /* ScrollingTreeNode.h in Headers */, + 1AAADDE914DC8DF800AF64B3 /* ScrollingTreeNodeMac.h in Headers */, + 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */, + 7A54858014E02D51006AE05A /* InspectorHistory.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -24654,9 +24721,8 @@ A80E6CF00A1989CA007FB8C5 /* CSSInheritedValue.cpp in Sources */, A80E6D020A1989CA007FB8C5 /* CSSInitialValue.cpp in Sources */, BC772E16133162C2001EC9CE /* CSSLineBoxContainValue.cpp in Sources */, - A8C4A80A09D563270003AC8D /* CSSMappedAttributeDeclaration.cpp in Sources */, A80E6CFC0A1989CA007FB8C5 /* CSSMediaRule.cpp in Sources */, - A80E6DFB0A199067007FB8C5 /* CSSMutableStyleDeclaration.cpp in Sources */, + A80E6DFB0A199067007FB8C5 /* StylePropertySet.cpp in Sources */, F98FFF4411A2676200F548E8 /* CSSOMUtils.cpp in Sources */, A80E6CF50A1989CA007FB8C5 /* CSSPageRule.cpp in Sources */, BC772B3D0C4EA91E0083285F /* CSSParser.cpp in Sources */, @@ -25336,6 +25402,7 @@ A871DC220A15205700B12A68 /* HTMLScriptElement.cpp in Sources */, 977B3874122883E900B81FF8 /* HTMLScriptRunner.cpp in Sources */, A81369D9097374F600D74463 /* HTMLSelectElement.cpp in Sources */, + 4ABDFF0B14DBE385004D117D /* HTMLShadowElement.cpp in Sources */, E44613A70CD6331000FADA75 /* HTMLSourceElement.cpp in Sources */, 977E2DCD12F0E28300C13379 /* HTMLSourceTracker.cpp in Sources */, 978AD67414130A8D00C7CAE3 /* HTMLSpanElement.cpp in Sources */, @@ -25458,7 +25525,6 @@ B275357D0B053814002CE64F /* IntRectMac.mm in Sources */, B27535620B053814002CE64F /* IntSizeCG.cpp in Sources */, B275357E0B053814002CE64F /* IntSizeMac.mm in Sources */, - F55B3DC31251F12D003EF269 /* IsIndexInputType.cpp in Sources */, 598D77DD132541EE00761B22 /* JavaArrayJSC.cpp in Sources */, 59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */, 598D77E11325420400761B22 /* JavaFieldJSC.cpp in Sources */, @@ -25671,6 +25737,7 @@ 9392262D1032107B006E7D5D /* JSHTMLCanvasElementCustom.cpp in Sources */, BCCBAD400C18C14200CE890F /* JSHTMLCollection.cpp in Sources */, BCCBAD3B0C18BFF800CE890F /* JSHTMLCollectionCustom.cpp in Sources */, + 4A1E719014E101E400626F9D /* JSHTMLContentElement.cpp in Sources */, F5C041E60FFCA96D00839D4A /* JSHTMLDataListElement.cpp in Sources */, D359D8BE129CA55C0006E5D2 /* JSHTMLDetailsElement.cpp in Sources */, 1A85B1E60A1B240500D8C87C /* JSHTMLDirectoryElement.cpp in Sources */, @@ -25731,6 +25798,7 @@ 1AE2ABAC0A1CE90500B42B25 /* JSHTMLScriptElement.cpp in Sources */, E1E6EEA40B628DA8005F2F70 /* JSHTMLSelectElement.cpp in Sources */, BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */, + 4A1E719514E101F900626F9D /* JSHTMLShadowElement.cpp in Sources */, E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */, 9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */, A80E7B0F0A19D606007FB8C5 /* JSHTMLStyleElement.cpp in Sources */, @@ -25851,6 +25919,7 @@ 9FA37EFA1172FDA600C4CD55 /* JSScriptProfile.cpp in Sources */, 9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */, 9FA37EE71172FCF000C4CD55 /* JSScriptProfileNodeCustom.cpp in Sources */, + 4A1E71A514E106AC00626F9D /* JSShadowRoot.cpp in Sources */, 41D07A7E0FF935CA0095EDCE /* JSSharedWorker.cpp in Sources */, 41D1690510238B66009BC827 /* JSSharedWorkerContext.cpp in Sources */, 14CD8D82106B529000A46D23 /* JSSharedWorkerCustom.cpp in Sources */, @@ -26058,7 +26127,7 @@ FD8E9BDF13D4CD2B0050DC72 /* JSWaveShaperNodeCustom.cpp in Sources */, A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */, 49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */, - 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */, + 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */, 6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */, BC2CBF7B140F1D58003879BE /* JSWebGLContextEvent.cpp in Sources */, 49C7B9971042D2D30009D447 /* JSWebGLFramebuffer.cpp in Sources */, @@ -26891,7 +26960,7 @@ 93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */, BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */, 49C7B9C81042D32F0009D447 /* WebGLBuffer.cpp in Sources */, - 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextures.cpp in Sources */, + 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */, 6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */, 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */, 01D3CF8214BD0A3000FE9970 /* WebGLContextGroup.cpp in Sources */, @@ -27014,6 +27083,15 @@ 2CF6878814D32EB500340F39 /* ElementAttributeData.cpp in Sources */, 1AF62EE614DA22A70041556C /* ScrollingCoordinatorMac.mm in Sources */, 1AF62EE714DA22A70041556C /* ScrollingCoordinator.cpp in Sources */, + 1AF62F2414DAFE910041556C /* ScrollingThreadMac.mm in Sources */, + 1AF62F2514DAFE9E0041556C /* ScrollingThread.cpp in Sources */, + 1AAADDA314DB409F00AF64B3 /* ScrollingTree.cpp in Sources */, + 1AAADDBE14DC640700AF64B3 /* ScrollingTreeState.cpp in Sources */, + 1AAADDDA14DC74EC00AF64B3 /* ScrollingTreeStateMac.mm in Sources */, + 1AAADDE314DC8C8F00AF64B3 /* ScrollingTreeNode.cpp in Sources */, + 1AAADDE814DC8DF800AF64B3 /* ScrollingTreeNodeMac.mm in Sources */, + 7A54857F14E02D51006AE05A /* InspectorHistory.cpp in Sources */, + CDAA8D0A14D71B2E0061EA60 /* PlatformClockCM.mm in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/accessibility/AccessibilityObject.h b/Source/WebCore/accessibility/AccessibilityObject.h index c417cc958..249fa2940 100644 --- a/Source/WebCore/accessibility/AccessibilityObject.h +++ b/Source/WebCore/accessibility/AccessibilityObject.h @@ -584,7 +584,7 @@ public: VisiblePositionRange visiblePositionRangeForRange(const PlainTextRange&) const; String stringForVisiblePositionRange(const VisiblePositionRange&) const; - virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return LayoutRect(); } + virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const { return IntRect(); } int lengthForVisiblePositionRange(const VisiblePositionRange&) const; virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const { } @@ -615,7 +615,7 @@ public: PlainTextRange doAXStyleRangeForIndex(unsigned) const; virtual String doAXStringForRange(const PlainTextRange&) const { return String(); } - virtual LayoutRect doAXBoundsForRange(const PlainTextRange&) const { return LayoutRect(); } + virtual IntRect doAXBoundsForRange(const PlainTextRange&) const { return IntRect(); } String listMarkerTextForNodeAndPosition(Node*, const VisiblePosition&) const; unsigned doAXLineForIndex(unsigned); diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp index dc0d33b93..44ced9db9 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.cpp +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.cpp @@ -709,7 +709,7 @@ bool AccessibilityRenderObject::isOffScreen() const ASSERT(m_renderer); LayoutRect contentRect = m_renderer->absoluteClippedOverflowRect(); FrameView* view = m_renderer->frame()->view(); - FloatRect viewRect = view->visibleContentRect(); + IntRect viewRect = view->visibleContentRect(); viewRect.intersect(contentRect); return viewRect.isEmpty(); } @@ -1499,7 +1499,7 @@ LayoutSize AccessibilityRenderObject::size() const return rect.size(); } -LayoutPoint AccessibilityRenderObject::clickPoint() +IntPoint AccessibilityRenderObject::clickPoint() { // Headings are usually much wider than their textual content. If the mid point is used, often it can be wrong. if (isHeading() && children().size() == 1) @@ -1511,11 +1511,11 @@ LayoutPoint AccessibilityRenderObject::clickPoint() VisibleSelection visSelection = selection(); VisiblePositionRange range = VisiblePositionRange(visSelection.visibleStart(), visSelection.visibleEnd()); - LayoutRect bounds = boundsForVisiblePositionRange(range); + IntRect bounds = boundsForVisiblePositionRange(range); #if PLATFORM(MAC) bounds.setLocation(m_renderer->document()->view()->screenToContents(bounds.location())); #endif - return LayoutPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.height() / 2)); + return IntPoint(bounds.x() + (bounds.width() / 2), bounds.y() - (bounds.height() / 2)); } AccessibilityObject* AccessibilityRenderObject::internalLinkElement() const @@ -2594,10 +2594,10 @@ bool AccessibilityRenderObject::nodeIsTextControl(const Node* node) const return axObjectForNode->isTextControl(); } -LayoutRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const +IntRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePositionRange& visiblePositionRange) const { if (visiblePositionRange.isNull()) - return LayoutRect(); + return IntRect(); // Create a mutable VisiblePositionRange. VisiblePositionRange range(visiblePositionRange); @@ -2811,14 +2811,14 @@ String AccessibilityRenderObject::doAXStringForRange(const PlainTextRange& range // The bounding rectangle of the text associated with this accessibility object that is // specified by the given range. This is the bounding rectangle a sighted user would see // on the display screen, in pixels. -LayoutRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const +IntRect AccessibilityRenderObject::doAXBoundsForRange(const PlainTextRange& range) const { if (allowsTextRanges()) return boundsForVisiblePositionRange(visiblePositionRangeForRange(range)); - return LayoutRect(); + return IntRect(); } -AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const IntPoint& point) const +AccessibilityObject* AccessibilityRenderObject::accessibilityImageMapHitTest(HTMLAreaElement* area, const LayoutPoint& point) const { if (!area) return 0; diff --git a/Source/WebCore/accessibility/AccessibilityRenderObject.h b/Source/WebCore/accessibility/AccessibilityRenderObject.h index 3ea580925..9056dc842 100644 --- a/Source/WebCore/accessibility/AccessibilityRenderObject.h +++ b/Source/WebCore/accessibility/AccessibilityRenderObject.h @@ -154,7 +154,7 @@ public: void updateAccessibilityRole(); // Should be called on the root accessibility object to kick off a hit test. - virtual AccessibilityObject* accessibilityHitTest(const IntPoint&) const; + virtual AccessibilityObject* accessibilityHitTest(const LayoutPoint&) const; virtual Element* actionElement() const; Element* mouseButtonListener() const; @@ -166,7 +166,7 @@ public: virtual LayoutRect boundingBoxRect() const; virtual LayoutRect elementRect() const; virtual LayoutSize size() const; - virtual LayoutPoint clickPoint(); + virtual IntPoint clickPoint(); void setRenderer(RenderObject* renderer) { m_renderer = renderer; } virtual RenderObject* renderer() const { return m_renderer; } @@ -228,7 +228,7 @@ public: virtual VisiblePositionRange visiblePositionRange() const; virtual VisiblePositionRange visiblePositionRangeForLine(unsigned) const; - virtual LayoutRect boundsForVisiblePositionRange(const VisiblePositionRange&) const; + virtual IntRect boundsForVisiblePositionRange(const VisiblePositionRange&) const; virtual void setSelectedVisiblePositionRange(const VisiblePositionRange&) const; virtual bool supportsARIAFlowTo() const; virtual void ariaFlowToElements(AccessibilityChildrenVector&) const; @@ -250,7 +250,7 @@ public: virtual PlainTextRange doAXRangeForIndex(unsigned) const; virtual String doAXStringForRange(const PlainTextRange&) const; - virtual LayoutRect doAXBoundsForRange(const PlainTextRange&) const; + virtual IntRect doAXBoundsForRange(const PlainTextRange&) const; virtual String stringValueForMSAA() const; virtual String stringRoleForMSAA() const; diff --git a/Source/WebCore/accessibility/AccessibilitySlider.cpp b/Source/WebCore/accessibility/AccessibilitySlider.cpp index 8bdb35c4c..e53ee20a7 100644 --- a/Source/WebCore/accessibility/AccessibilitySlider.cpp +++ b/Source/WebCore/accessibility/AccessibilitySlider.cpp @@ -101,7 +101,7 @@ const AtomicString& AccessibilitySlider::getAttribute(const QualifiedName& attri return element()->getAttribute(attribute); } -AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const IntPoint& point) const +AccessibilityObject* AccessibilitySlider::elementAccessibilityHitTest(const LayoutPoint& point) const { if (m_children.size()) { ASSERT(m_children.size() == 1); diff --git a/Source/WebCore/accessibility/AccessibilitySlider.h b/Source/WebCore/accessibility/AccessibilitySlider.h index 4b2d54b76..2b831032d 100644 --- a/Source/WebCore/accessibility/AccessibilitySlider.h +++ b/Source/WebCore/accessibility/AccessibilitySlider.h @@ -48,7 +48,7 @@ protected: private: HTMLInputElement* element() const; virtual bool accessibilityIsIgnored() const; - virtual AccessibilityObject* elementAccessibilityHitTest(const IntPoint&) const; + virtual AccessibilityObject* elementAccessibilityHitTest(const LayoutPoint&) const; virtual AccessibilityRole roleValue() const { return SliderRole; } virtual bool isSlider() const { return true; } diff --git a/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp b/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp index 207be0ce4..f7bbc30ef 100644 --- a/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp +++ b/Source/WebCore/accessibility/gtk/WebKitAccessibleInterfaceText.cpp @@ -77,7 +77,9 @@ static gchar* textForRenderer(RenderObject* renderer) if (object->isText()) renderText = toRenderText(object); else { - if (object->isReplaced()) + // List item's markers will be treated in an special way + // later on this function, so ignore them here. + if (object->isReplaced() && !renderer->isListItem()) g_string_append_unichar(resultText, objectReplacementCharacter); // We need to check children, if any, to consider when diff --git a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm index 13c3e61c8..ea91c7745 100644 --- a/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm +++ b/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm @@ -2605,7 +2605,7 @@ static NSString* roleValueToNSString(AccessibilityRole value) return; // Simulate a click in the middle of the object. - LayoutPoint clickPoint = m_object->clickPoint(); + IntPoint clickPoint = m_object->clickPoint(); PlatformMouseEvent mouseEvent(clickPoint, clickPoint, RightButton, PlatformEvent::MousePressed, 1, false, false, false, false, currentTime()); bool handled = frame->eventHandler()->sendContextMenuEvent(mouseEvent); diff --git a/Source/WebCore/bindings/generic/BindingSecurity.h b/Source/WebCore/bindings/generic/BindingSecurity.h index 57862e13a..02b97ea70 100644 --- a/Source/WebCore/bindings/generic/BindingSecurity.h +++ b/Source/WebCore/bindings/generic/BindingSecurity.h @@ -55,7 +55,7 @@ public: // Check if it is safe to access the given node from the // current security context. - static bool allowAccessToNode(State<Binding>*, Node* target); + static bool shouldAllowAccessToNode(State<Binding>*, Node* target); static bool allowPopUp(State<Binding>*); static bool allowSettingFrameSrcToJavascriptUrl(State<Binding>*, HTMLFrameElementBase*, const String& value); @@ -101,7 +101,7 @@ bool BindingSecurity<Binding>::canAccessFrame(State<Binding>* state, } template <class Binding> -bool BindingSecurity<Binding>::allowAccessToNode(State<Binding>* state, Node* node) +bool BindingSecurity<Binding>::shouldAllowAccessToNode(State<Binding>* state, Node* node) { if (!node) return false; @@ -131,7 +131,7 @@ bool BindingSecurity<Binding>::allowSettingFrameSrcToJavascriptUrl(State<Binding { if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) { Node* contentDoc = frame->contentDocument(); - if (contentDoc && !allowAccessToNode(state, contentDoc)) + if (contentDoc && !shouldAllowAccessToNode(state, contentDoc)) return false; } return true; diff --git a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp index 23fda48d6..66936ed34 100644 --- a/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp +++ b/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp @@ -26,13 +26,14 @@ #include "config.h" #include "JSCSSStyleDeclarationCustom.h" -#include "CSSMutableStyleDeclaration.h" +#include "CSSParser.h" #include "CSSPrimitiveValue.h" #include "CSSPropertyNames.h" #include "CSSValue.h" #include "JSCSSValue.h" #include "JSNode.h" #include "PlatformString.h" +#include "StylePropertySet.h" #include <runtime/StringPrototype.h> #include <wtf/ASCIICType.h> #include <wtf/text/AtomicString.h> @@ -137,6 +138,23 @@ static PropertyNamePrefix getCSSPropertyNamePrefix(const StringImpl& propertyNam return PropertyNamePrefixNone; } +template<typename CharacterType> +static inline bool containsASCIIUpperChar(const CharacterType* string, size_t length) +{ + for (unsigned i = 0; i < length; ++i) { + if (isASCIIUpper(string[i])) + return true; + } + return false; +} + +static inline bool containsASCIIUpperChar(const StringImpl& string) +{ + if (string.is8Bit()) + return containsASCIIUpperChar(string.characters8(), string.length()); + return containsASCIIUpperChar(string.characters16(), string.length()); +} + static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPosPrefix = 0) { if (hadPixelOrPosPrefix) @@ -146,10 +164,15 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo if (!length) return String(); + StringImpl* propertyNameString = propertyName.impl(); + // If there is no uppercase character in the propertyName, there can + // be no prefix, nor extension and we can return the same string. + if (!containsASCIIUpperChar(*propertyNameString)) + return String(propertyNameString); + StringBuilder builder; builder.reserveCapacity(length); - const StringImpl* propertyNameString = propertyName.impl(); unsigned i = 0; switch (getCSSPropertyNamePrefix(*propertyNameString)) { case PropertyNamePrefixNone: @@ -176,10 +199,10 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo builder.append('-'); } - builder.append(toASCIILower(propertyName.characters()[i++])); + builder.append(toASCIILower((*propertyNameString)[i++])); for (; i < length; ++i) { - UChar c = propertyName.characters()[i]; + UChar c = (*propertyNameString)[i]; if (!isASCIIUpper(c)) builder.append(c); else @@ -191,9 +214,7 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo static bool isCSSPropertyName(const Identifier& propertyIdentifier) { - // FIXME: This mallocs a string for the property name and then throws it - // away. This shows up on peacekeeper's domDynamicCreationCreateElement. - return CSSStyleDeclaration::isPropertyName(cssPropertyName(propertyIdentifier)); + return cssPropertyID(cssPropertyName(propertyIdentifier)); } bool JSCSSStyleDeclaration::canGetItemsForName(ExecState*, CSSStyleDeclaration*, const Identifier& propertyName) @@ -229,7 +250,7 @@ bool JSCSSStyleDeclaration::putDelegate(ExecState* exec, const Identifier& prope { bool pixelOrPos; String prop = cssPropertyName(propertyName, &pixelOrPos); - if (!CSSStyleDeclaration::isPropertyName(prop)) + if (!cssPropertyID(prop)) return false; String propValue = valueToStringWithNullCheck(exec, value); diff --git a/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp b/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp index 14f51f4bf..bdaf0d553 100644 --- a/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp +++ b/Source/WebCore/bindings/js/JSCustomXPathNSResolver.cpp @@ -31,6 +31,7 @@ #include "ExceptionCode.h" #include "Frame.h" #include "JSDOMWindowCustom.h" +#include "JSMainThreadExecState.h" #include "SecurityOrigin.h" #include <runtime/JSLock.h> @@ -89,7 +90,7 @@ String JSCustomXPathNSResolver::lookupNamespaceURI(const String& prefix) args.append(jsString(exec, prefix)); m_globalObject->globalData().timeoutChecker.start(); - JSValue retval = JSC::call(exec, function, callType, callData, m_customResolver, args); + JSValue retval = JSMainThreadExecState::call(exec, function, callType, callData, m_customResolver, args); m_globalObject->globalData().timeoutChecker.stop(); String result; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.cpp b/Source/WebCore/bindings/js/JSDOMBinding.cpp index ef3efe91a..69cc1b84a 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.cpp +++ b/Source/WebCore/bindings/js/JSDOMBinding.cpp @@ -216,12 +216,12 @@ DOMWindow* firstDOMWindow(ExecState* exec) return asJSDOMWindow(exec->dynamicGlobalObject())->impl(); } -bool allowAccessToNode(ExecState* exec, Node* node) +bool shouldAllowAccessToNode(ExecState* exec, Node* node) { - return node && allowAccessToFrame(exec, node->document()->frame()); + return node && shouldAllowAccessToFrame(exec, node->document()->frame()); } -bool allowAccessToFrame(ExecState* exec, Frame* frame) +bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame) { if (!frame) return false; @@ -229,7 +229,7 @@ bool allowAccessToFrame(ExecState* exec, Frame* frame) return window && window->allowsAccessFrom(exec); } -bool allowAccessToFrame(ExecState* exec, Frame* frame, String& message) +bool shouldAllowAccessToFrame(ExecState* exec, Frame* frame, String& message) { if (!frame) return false; diff --git a/Source/WebCore/bindings/js/JSDOMBinding.h b/Source/WebCore/bindings/js/JSDOMBinding.h index af147e814..7e1af20fc 100644 --- a/Source/WebCore/bindings/js/JSDOMBinding.h +++ b/Source/WebCore/bindings/js/JSDOMBinding.h @@ -23,7 +23,6 @@ #define JSDOMBinding_h #include "CSSImportRule.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSStyleSheet.h" #include "JSDOMGlobalObject.h" #include "JSDOMWrapper.h" @@ -31,6 +30,7 @@ #include "Document.h" #include "Element.h" #include "MediaList.h" +#include "StylePropertySet.h" #include "StyledElement.h" #include <heap/Weak.h> #include <runtime/FunctionPrototype.h> @@ -281,9 +281,9 @@ enum ParameterMissingPolicy { JSC::JSObject* toJSSequence(JSC::ExecState*, JSC::JSValue, unsigned&); // FIXME: Implement allowAccessToContext(JSC::ExecState*, ScriptExecutionContext*); - bool allowAccessToNode(JSC::ExecState*, Node*); - bool allowAccessToFrame(JSC::ExecState*, Frame*); - bool allowAccessToFrame(JSC::ExecState*, Frame*, String& message); + bool shouldAllowAccessToNode(JSC::ExecState*, Node*); + bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*); + bool shouldAllowAccessToFrame(JSC::ExecState*, Frame*, String& message); // FIXME: Implement allowAccessToDOMWindow(JSC::ExecState*, DOMWindow*); // FIXME: Remove these functions in favor of activeContext and diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp index 40d896476..baf80d360 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp @@ -388,35 +388,17 @@ void JSDOMWindow::getOwnPropertyNames(JSObject* object, ExecState* exec, Propert Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -void JSDOMWindow::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) -{ - JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); - // Only allow defining getters by frames in the same origin. - if (!thisObject->allowsAccessFrom(exec)) - return; - - // Don't allow shadowing location using defineGetter. - if (propertyName == "location") - return; - - Base::defineGetter(thisObject, exec, propertyName, getterFunction, attributes); -} - -void JSDOMWindow::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) -{ - JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); - // Only allow defining setters by frames in the same origin. - if (!thisObject->allowsAccessFrom(exec)) - return; - Base::defineSetter(thisObject, exec, propertyName, setterFunction, attributes); -} - bool JSDOMWindow::defineOwnProperty(JSC::JSObject* object, JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertyDescriptor& descriptor, bool shouldThrow) { JSDOMWindow* thisObject = jsCast<JSDOMWindow*>(object); // Only allow defining properties in this way by frames in the same origin, as it allows setters to be introduced. if (!thisObject->allowsAccessFrom(exec)) return false; + + // Don't allow shadowing location using accessor properties. + if (descriptor.isAccessorDescriptor() && propertyName == "location") + return false; + return Base::defineOwnProperty(thisObject, exec, propertyName, descriptor, shouldThrow); } diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp index 03bcd4292..45506e6e4 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp @@ -139,18 +139,6 @@ void JSDOMWindowShell::getOwnPropertyNames(JSObject* object, ExecState* exec, Pr thisObject->window()->methodTable()->getOwnPropertyNames(thisObject->window(), exec, propertyNames, mode); } -void JSDOMWindowShell::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) -{ - JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); - thisObject->window()->methodTable()->defineGetter(thisObject->window(), exec, propertyName, getterFunction, attributes); -} - -void JSDOMWindowShell::defineSetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes) -{ - JSDOMWindowShell* thisObject = jsCast<JSDOMWindowShell*>(object); - thisObject->window()->methodTable()->defineSetter(thisObject->window(), exec, propertyName, setterFunction, attributes); -} - // ---- // JSDOMWindow methods diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.h b/Source/WebCore/bindings/js/JSDOMWindowShell.h index 1e179edf4..e111cb84d 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowShell.h +++ b/Source/WebCore/bindings/js/JSDOMWindowShell.h @@ -86,8 +86,6 @@ namespace WebCore { static bool deleteProperty(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName); static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode); static void getPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode); - static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes); - static void defineSetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes); static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow); RefPtr<DOMWrapperWorld> m_world; diff --git a/Source/WebCore/bindings/js/JSDictionary.cpp b/Source/WebCore/bindings/js/JSDictionary.cpp index da24d82fe..bd06216cf 100644 --- a/Source/WebCore/bindings/js/JSDictionary.cpp +++ b/Source/WebCore/bindings/js/JSDictionary.cpp @@ -34,7 +34,9 @@ #include "JSTrackCustom.h" #include "SerializedScriptValue.h" #include "ScriptValue.h" +#include <wtf/HashMap.h> #include <wtf/MathExtras.h> +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -136,4 +138,26 @@ void JSDictionary::convertValue(ExecState*, JSValue value, RefPtr<TrackBase>& re } #endif +#if ENABLE(MUTATION_OBSERVERS) +void JSDictionary::convertValue(ExecState* exec, JSValue value, HashSet<AtomicString>& result) +{ + result.clear(); + + if (value.isUndefinedOrNull()) + return; + + unsigned length; + JSObject* object = toJSSequence(exec, value, length); + if (exec->hadException()) + return; + + for (unsigned i = 0 ; i < length; ++i) { + JSValue itemValue = object->get(exec, i); + if (exec->hadException()) + return; + result.add(ustringToAtomicString(itemValue.toString(exec)->value(exec))); + } +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSDictionary.h b/Source/WebCore/bindings/js/JSDictionary.h index c5a48a259..fb8ea003a 100644 --- a/Source/WebCore/bindings/js/JSDictionary.h +++ b/Source/WebCore/bindings/js/JSDictionary.h @@ -87,6 +87,9 @@ private: #if ENABLE(VIDEO_TRACK) static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr<TrackBase>& result); #endif +#if ENABLE(MUTATION_OBSERVERS) + static void convertValue(JSC::ExecState*, JSC::JSValue, HashSet<AtomicString>& result); +#endif JSC::ExecState* m_exec; JSC::JSObject* m_initializerObject; diff --git a/Source/WebCore/bindings/js/JSEntryCustom.cpp b/Source/WebCore/bindings/js/JSEntryCustom.cpp index 59d7e3c1a..2552e05db 100644 --- a/Source/WebCore/bindings/js/JSEntryCustom.cpp +++ b/Source/WebCore/bindings/js/JSEntryCustom.cpp @@ -50,10 +50,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, Entry* entry) return jsNull(); if (entry->isFile()) - return getDOMObjectWrapper<JSFileEntry>(exec, globalObject, static_cast<FileEntry*>(entry)); + return wrap<JSFileEntry>(exec, globalObject, static_cast<FileEntry*>(entry)); ASSERT(entry->isDirectory()); - return getDOMObjectWrapper<JSDirectoryEntry>(exec, globalObject, static_cast<DirectoryEntry*>(entry)); + return wrap<JSDirectoryEntry>(exec, globalObject, static_cast<DirectoryEntry*>(entry)); } } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSEntrySyncCustom.cpp b/Source/WebCore/bindings/js/JSEntrySyncCustom.cpp index 22f96ad87..7ad57c4e6 100644 --- a/Source/WebCore/bindings/js/JSEntrySyncCustom.cpp +++ b/Source/WebCore/bindings/js/JSEntrySyncCustom.cpp @@ -50,10 +50,10 @@ JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, EntrySync* entry) return jsNull(); if (entry->isFile()) - return getDOMObjectWrapper<JSFileEntrySync>(exec, globalObject, static_cast<FileEntrySync*>(entry)); + return wrap<JSFileEntrySync>(exec, globalObject, static_cast<FileEntrySync*>(entry)); ASSERT(entry->isDirectory()); - return getDOMObjectWrapper<JSDirectoryEntrySync>(exec, globalObject, static_cast<DirectoryEntrySync*>(entry)); + return wrap<JSDirectoryEntrySync>(exec, globalObject, static_cast<DirectoryEntrySync*>(entry)); } } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSErrorHandler.cpp b/Source/WebCore/bindings/js/JSErrorHandler.cpp index 59b3ff37c..e292d2930 100644 --- a/Source/WebCore/bindings/js/JSErrorHandler.cpp +++ b/Source/WebCore/bindings/js/JSErrorHandler.cpp @@ -36,6 +36,7 @@ #include "Event.h" #include "EventNames.h" #include "JSEvent.h" +#include "JSMainThreadExecState.h" #include <runtime/JSLock.h> using namespace JSC; @@ -94,7 +95,9 @@ void JSErrorHandler::handleEvent(ScriptExecutionContext* scriptExecutionContext, JSValue thisValue = globalObject->methodTable()->toThisObject(globalObject, exec); globalData.timeoutChecker.start(); - JSValue returnValue = JSC::call(exec, jsFunction, callType, callData, thisValue, args); + JSValue returnValue = scriptExecutionContext->isDocument() + ? JSMainThreadExecState::call(exec, jsFunction, callType, callData, thisValue, args) + : JSC::call(exec, jsFunction, callType, callData, thisValue, args); globalData.timeoutChecker.stop(); globalObject->setCurrentEvent(savedEvent); diff --git a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp index 623973a7f..e64e24381 100644 --- a/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLDocumentCustom.cpp @@ -38,6 +38,7 @@ #include "JSDOMWindowCustom.h" #include "JSDOMWindowShell.h" #include "JSHTMLCollection.h" +#include "JSMainThreadExecState.h" #include "SegmentedString.h" #include "DocumentParser.h" #include <runtime/Error.h> @@ -113,7 +114,7 @@ JSValue JSHTMLDocument::open(ExecState* exec) CallType callType = ::getCallData(function, callData); if (callType == CallTypeNone) return throwTypeError(exec); - return JSC::call(exec, function, callType, callData, wrapper, ArgList(exec)); + return JSMainThreadExecState::call(exec, function, callType, callData, wrapper, ArgList(exec)); } } return jsUndefined(); diff --git a/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp b/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp index c6cc2488b..7f00ebcde 100644 --- a/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp +++ b/Source/WebCore/bindings/js/JSHTMLFrameElementCustom.cpp @@ -45,7 +45,7 @@ static inline bool allowSettingJavascriptURL(ExecState* exec, HTMLFrameElement* { if (protocolIsJavaScript(stripLeadingAndTrailingHTMLSpaces(value))) { Document* contentDocument = imp->contentDocument(); - if (contentDocument && !allowAccessToNode(exec, contentDocument)) + if (contentDocument && !shouldAllowAccessToNode(exec, contentDocument)) return false; } return true; diff --git a/Source/WebCore/bindings/js/JSHistoryCustom.cpp b/Source/WebCore/bindings/js/JSHistoryCustom.cpp index 72ea5424c..480658b51 100644 --- a/Source/WebCore/bindings/js/JSHistoryCustom.cpp +++ b/Source/WebCore/bindings/js/JSHistoryCustom.cpp @@ -61,7 +61,7 @@ bool JSHistory::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& pr // Our custom code is only needed to implement the Window cross-domain scheme, so if access is // allowed, return false so the normal lookup will take place. String message; - if (allowAccessToFrame(exec, impl()->frame(), message)) + if (shouldAllowAccessToFrame(exec, impl()->frame(), message)) return false; // Check for the few functions that we allow, even when called cross-domain. @@ -101,7 +101,7 @@ bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifi } // Throw out all cross domain access - if (!allowAccessToFrame(exec, impl()->frame())) + if (!shouldAllowAccessToFrame(exec, impl()->frame())) return true; // Check for the few functions that we allow, even when called cross-domain. @@ -141,7 +141,7 @@ bool JSHistory::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identifi bool JSHistory::putDelegate(ExecState* exec, const Identifier&, JSValue, PutPropertySlot&) { // Only allow putting by frames in the same origin. - if (!allowAccessToFrame(exec, impl()->frame())) + if (!shouldAllowAccessToFrame(exec, impl()->frame())) return true; return false; } @@ -150,7 +150,7 @@ bool JSHistory::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& { JSHistory* thisObject = jsCast<JSHistory*>(cell); // Only allow deleting by frames in the same origin. - if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return false; return Base::deleteProperty(thisObject, exec, propertyName); } @@ -159,11 +159,25 @@ void JSHistory::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyN { JSHistory* thisObject = jsCast<JSHistory*>(object); // Only allow the history object to enumerated by frames in the same origin. - if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return; Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } +JSValue JSHistory::state(ExecState *exec) const +{ + History* history = static_cast<History*>(impl()); + + JSValue cachedValue = m_state.get(); + if (!cachedValue.isEmpty() && !history->stateChanged()) + return cachedValue; + + SerializedScriptValue* serialized = history->state(); + JSValue result = serialized ? serialized->deserialize(exec, globalObject(), 0) : jsNull(); + const_cast<JSHistory*>(this)->m_state.set(exec->globalData(), this, result); + return result; +} + JSValue JSHistory::pushState(ExecState* exec) { RefPtr<SerializedScriptValue> historyState = SerializedScriptValue::create(exec, exec->argument(0), 0); @@ -185,6 +199,8 @@ JSValue JSHistory::pushState(ExecState* exec) impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec); setDOMException(exec, ec); + m_state.clear(); + return jsUndefined(); } @@ -209,6 +225,8 @@ JSValue JSHistory::replaceState(ExecState* exec) impl()->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec); setDOMException(exec, ec); + m_state.clear(); + return jsUndefined(); } diff --git a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp index 0320c1834..73cb2fa7e 100644 --- a/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/js/JSInjectedScriptHostCustom.cpp @@ -76,28 +76,6 @@ ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node return ScriptValue(state->globalData(), toJS(state, deprecatedGlobalObjectForPrototype(state), node)); } -JSValue JSInjectedScriptHost::evaluate(ExecState* exec) -{ - JSValue expression = exec->argument(0); - if (!expression.isString()) - return throwError(exec, createError(exec, "String argument expected.")); - JSGlobalObject* globalObject = exec->lexicalGlobalObject(); - JSFunction* evalFunction = globalObject->evalFunction(); - CallData callData; - CallType callType = evalFunction->methodTable()->getCallData(evalFunction, callData); - if (callType == CallTypeNone) - return jsUndefined(); - MarkedArgumentBuffer args; - args.append(expression); - - bool wasEvalEnabled = globalObject->evalEnabled(); - globalObject->setEvalEnabled(true); - JSValue result = JSC::call(exec, evalFunction, callType, callData, exec->globalThisValue(), args); - globalObject->setEvalEnabled(wasEvalEnabled); - - return result; -} - JSValue JSInjectedScriptHost::inspectedNode(ExecState* exec) { if (exec->argumentCount() < 1) diff --git a/Source/WebCore/bindings/js/JSLocationCustom.cpp b/Source/WebCore/bindings/js/JSLocationCustom.cpp index 4bbd56e1a..7786a988d 100644 --- a/Source/WebCore/bindings/js/JSLocationCustom.cpp +++ b/Source/WebCore/bindings/js/JSLocationCustom.cpp @@ -59,7 +59,7 @@ bool JSLocation::getOwnPropertySlotDelegate(ExecState* exec, const Identifier& p // Our custom code is only needed to implement the Window cross-domain scheme, so if access is // allowed, return false so the normal lookup will take place. String message; - if (allowAccessToFrame(exec, frame, message)) + if (shouldAllowAccessToFrame(exec, frame, message)) return false; // Check for the few functions that we allow, even when called cross-domain. @@ -95,7 +95,7 @@ bool JSLocation::getOwnPropertyDescriptorDelegate(ExecState* exec, const Identif } // throw out all cross domain access - if (!allowAccessToFrame(exec, frame)) + if (!shouldAllowAccessToFrame(exec, frame)) return true; // Check for the few functions that we allow, even when called cross-domain. @@ -134,7 +134,7 @@ bool JSLocation::putDelegate(ExecState* exec, const Identifier& propertyName, JS if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) return true; - bool sameDomainAccess = allowAccessToFrame(exec, frame); + bool sameDomainAccess = shouldAllowAccessToFrame(exec, frame); const HashEntry* entry = JSLocation::s_info.propHashTable(exec)->entry(exec, propertyName); if (!entry) { @@ -156,7 +156,7 @@ bool JSLocation::deleteProperty(JSCell* cell, ExecState* exec, const Identifier& { JSLocation* thisObject = jsCast<JSLocation*>(cell); // Only allow deleting by frames in the same origin. - if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return false; return Base::deleteProperty(thisObject, exec, propertyName); } @@ -165,16 +165,16 @@ void JSLocation::getOwnPropertyNames(JSObject* object, ExecState* exec, Property { JSLocation* thisObject = jsCast<JSLocation*>(object); // Only allow the location object to enumerated by frames in the same origin. - if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return; Base::getOwnPropertyNames(thisObject, exec, propertyNames, mode); } -void JSLocation::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) +bool JSLocation::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) { - if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) - return; - Base::defineGetter(object, exec, propertyName, getterFunction, attributes); + if (descriptor.isAccessorDescriptor() && (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)) + return false; + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); } void JSLocation::setHref(ExecState* exec, JSValue value) @@ -270,7 +270,7 @@ JSValue JSLocation::assign(ExecState* exec) JSValue JSLocation::toStringFunction(ExecState* exec) { Frame* frame = impl()->frame(); - if (!frame || !allowAccessToFrame(exec, frame)) + if (!frame || !shouldAllowAccessToFrame(exec, frame)) return jsUndefined(); return jsString(exec, impl()->toString()); @@ -281,11 +281,11 @@ bool JSLocationPrototype::putDelegate(ExecState* exec, const Identifier& propert return (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf); } -void JSLocationPrototype::defineGetter(JSObject* object, ExecState* exec, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes) +bool JSLocationPrototype::defineOwnProperty(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException) { - if (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf) - return; - Base::defineGetter(object, exec, propertyName, getterFunction, attributes); + if (descriptor.isAccessorDescriptor() && (propertyName == exec->propertyNames().toString || propertyName == exec->propertyNames().valueOf)) + return false; + return Base::defineOwnProperty(object, exec, propertyName, descriptor, throwException); } } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.cpp b/Source/WebCore/bindings/js/JSMainThreadExecState.cpp index d679a5899..9177a4b10 100644 --- a/Source/WebCore/bindings/js/JSMainThreadExecState.cpp +++ b/Source/WebCore/bindings/js/JSMainThreadExecState.cpp @@ -25,9 +25,17 @@ #include "config.h" #include "JSMainThreadExecState.h" +#include "WebKitMutationObserver.h" namespace WebCore { JSC::ExecState* JSMainThreadExecState::s_mainThreadState = 0; +#if ENABLE(MUTATION_OBSERVERS) +void JSMainThreadExecState::didLeaveScriptContext() +{ + WebKitMutationObserver::deliverAllMutations(); +} +#endif + } // namespace WebCore diff --git a/Source/WebCore/bindings/js/JSMainThreadExecState.h b/Source/WebCore/bindings/js/JSMainThreadExecState.h index 55b820324..5e4c4e2dc 100644 --- a/Source/WebCore/bindings/js/JSMainThreadExecState.h +++ b/Source/WebCore/bindings/js/JSMainThreadExecState.h @@ -92,19 +92,34 @@ protected: ASSERT(isMainThread()); s_mainThreadState = exec; }; - + ~JSMainThreadExecState() { ASSERT(isMainThread()); + +#if ENABLE(MUTATION_OBSERVERS) + bool didExitJavaScript = s_mainThreadState && !m_previousState; +#endif + s_mainThreadState = m_previousState; + +#if ENABLE(MUTATION_OBSERVERS) + if (didExitJavaScript) + didLeaveScriptContext(); +#endif } private: static JSC::ExecState* s_mainThreadState; JSC::ExecState* m_previousState; + +#if ENABLE(MUTATION_OBSERVERS) + static void didLeaveScriptContext(); +#endif }; // Null state prevents origin security checks. +// Used by non-JavaScript bindings (ObjC, GObject). class JSMainThreadNullState : private JSMainThreadExecState { public: explicit JSMainThreadNullState() : JSMainThreadExecState(0) {}; diff --git a/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp b/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp index 9d5df0421..91b9156a4 100644 --- a/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp +++ b/Source/WebCore/bindings/js/JSNodeFilterCondition.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "JSNodeFilterCondition.h" +#include "JSMainThreadExecState.h" #include "JSNode.h" #include "JSNodeFilter.h" #include "NodeFilter.h" @@ -72,7 +73,7 @@ short JSNodeFilterCondition::acceptNode(JSC::ExecState* exec, Node* filterNode) if (exec->hadException()) return NodeFilter::FILTER_REJECT; - JSValue result = JSC::call(exec, function, callType, callData, m_filter.get(), args); + JSValue result = JSMainThreadExecState::call(exec, function, callType, callData, m_filter.get(), args); if (exec->hadException()) return NodeFilter::FILTER_REJECT; diff --git a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp index b4f566239..0bfa63afb 100644 --- a/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp @@ -40,8 +40,10 @@ #include "JSOESStandardDerivatives.h" #include "JSOESTextureFloat.h" #include "JSOESVertexArrayObject.h" +#include "JSUint32Array.h" #include "JSUint8Array.h" #include "JSWebGLBuffer.h" +#include "JSWebGLCompressedTextureS3TC.h" #include "JSWebGLFramebuffer.h" #include "JSWebGLLoseContext.h" #include "JSWebGLProgram.h" @@ -56,7 +58,7 @@ #include "OESTextureFloat.h" #include "OESVertexArrayObject.h" #include "WebGLBuffer.h" -#include "WebGLCompressedTextures.h" +#include "WebGLCompressedTextureS3TC.h" #include "WebGLDebugRendererInfo.h" #include "WebGLDebugShaders.h" #include "WebGLExtension.h" @@ -71,6 +73,7 @@ #include <wtf/FastMalloc.h> #include <wtf/Float32Array.h> #include <wtf/Int32Array.h> +#include <wtf/Uint32Array.h> #if ENABLE(VIDEO) #include "HTMLVideoElement.h" @@ -121,6 +124,8 @@ static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, const WebG return toJS(exec, globalObject, info.getWebGLTexture()); case WebGLGetInfo::kTypeWebGLUnsignedByteArray: return toJS(exec, globalObject, info.getWebGLUnsignedByteArray()); + case WebGLGetInfo::kTypeWebGLUnsignedIntArray: + return toJS(exec, globalObject, info.getWebGLUnsignedIntArray()); case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: return toJS(exec, globalObject, info.getWebGLVertexArrayObjectOES()); default: @@ -193,8 +198,8 @@ static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExten return toJS(exec, globalObject, static_cast<WebGLDebugRendererInfo*>(extension)); case WebGLExtension::WebGLDebugShadersName: return toJS(exec, globalObject, static_cast<WebGLDebugShaders*>(extension)); - case WebGLExtension::WebKitWebGLCompressedTexturesName: - return toJS(exec, globalObject, static_cast<WebGLCompressedTextures*>(extension)); + case WebGLExtension::WebKitWebGLCompressedTextureS3TCName: + return toJS(exec, globalObject, static_cast<WebGLCompressedTextureS3TC*>(extension)); } ASSERT_NOT_REACHED(); return jsNull(); diff --git a/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp b/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp index 38c39e422..455f4d4e0 100644 --- a/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp +++ b/Source/WebCore/bindings/js/JSWebKitMutationObserverCustom.cpp @@ -41,6 +41,8 @@ #include "Node.h" #include "WebKitMutationObserver.h" #include <runtime/Error.h> +#include <wtf/HashSet.h> +#include <wtf/text/AtomicString.h> using namespace JSC; @@ -62,6 +64,22 @@ EncodedJSValue JSC_HOST_CALL JSWebKitMutationObserverConstructor::constructJSWeb return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), WebKitMutationObserver::create(callback.release())))); } +struct BooleanOption { + const char* name; + MutationObserverOptions value; +}; + +static const BooleanOption booleanOptions[] = { + { "childList", WebKitMutationObserver::ChildList }, + { "attributes", WebKitMutationObserver::Attributes }, + { "characterData", WebKitMutationObserver::CharacterData }, + { "subtree", WebKitMutationObserver::Subtree }, + { "attributeOldValue", WebKitMutationObserver::AttributeOldValue }, + { "characterDataOldValue", WebKitMutationObserver::CharacterDataOldValue } +}; + +static const size_t numBooleanOptions = sizeof(booleanOptions) / sizeof(BooleanOption); + JSValue JSWebKitMutationObserver::observe(ExecState* exec) { if (exec->argumentCount() < 2) @@ -78,24 +96,22 @@ JSValue JSWebKitMutationObserver::observe(ExecState* exec) JSDictionary dictionary(exec, optionsObject); MutationObserverOptions options = 0; - // FIXME: Add support for parsing of the attributeFilter option. - bool option; - if (dictionary.tryGetProperty("childList", option) && option) - options |= WebKitMutationObserver::ChildList; - if (dictionary.tryGetProperty("attributes", option) && option) - options |= WebKitMutationObserver::Attributes; - if (dictionary.tryGetProperty("subtree", option) && option) - options |= WebKitMutationObserver::Subtree; - if (dictionary.tryGetProperty("attributeOldValue", option) && option) - options |= WebKitMutationObserver::AttributeOldValue; - if (dictionary.tryGetProperty("characterDataOldValue", option) && option) - options |= WebKitMutationObserver::CharacterDataOldValue; + for (unsigned i = 0; i < numBooleanOptions; ++i) { + bool option = false; + if (!dictionary.tryGetProperty(booleanOptions[i].name, option)) + return jsUndefined(); + if (option) + options |= booleanOptions[i].value; + } - if (exec->hadException()) + HashSet<AtomicString> attributeFilter; + if (!dictionary.tryGetProperty("attributeFilter", attributeFilter)) return jsUndefined(); + if (!attributeFilter.isEmpty()) + options |= WebKitMutationObserver::AttributeFilter; ExceptionCode ec = 0; - impl()->observe(target, options, ec); + impl()->observe(target, options, attributeFilter, ec); if (ec) setDOMException(exec, ec); return jsUndefined(); diff --git a/Source/WebCore/bindings/js/ScriptController.cpp b/Source/WebCore/bindings/js/ScriptController.cpp index c1072f861..4143f44b5 100644 --- a/Source/WebCore/bindings/js/ScriptController.cpp +++ b/Source/WebCore/bindings/js/ScriptController.cpp @@ -247,7 +247,7 @@ bool ScriptController::canAccessFromCurrentOrigin(Frame *frame) { ExecState* exec = JSMainThreadExecState::currentState(); if (exec) - return allowAccessToFrame(exec, frame); + return shouldAllowAccessToFrame(exec, frame); // If the current state is 0 we're in a call path where the DOM security // check doesn't apply (eg. parser). return true; diff --git a/Source/WebCore/bindings/js/ScriptDebugServer.h b/Source/WebCore/bindings/js/ScriptDebugServer.h index 2494c2075..3f7bd4f64 100644 --- a/Source/WebCore/bindings/js/ScriptDebugServer.h +++ b/Source/WebCore/bindings/js/ScriptDebugServer.h @@ -90,6 +90,8 @@ public: void recompileAllJSFunctionsSoon(); virtual void recompileAllJSFunctions(Timer<ScriptDebugServer>* = 0) = 0; + bool isPaused() { return m_paused; } + protected: typedef HashSet<ScriptDebugListener*> ListenerSet; typedef void (ScriptDebugServer::*JavaScriptExecutionCallback)(ScriptDebugListener*); diff --git a/Source/WebCore/bindings/js/ScriptProfiler.cpp b/Source/WebCore/bindings/js/ScriptProfiler.cpp index 4c84fb971..a63fe4d9e 100644 --- a/Source/WebCore/bindings/js/ScriptProfiler.cpp +++ b/Source/WebCore/bindings/js/ScriptProfiler.cpp @@ -31,8 +31,8 @@ #include "ScriptProfiler.h" #include "GCController.h" -#include "InspectorValues.h" #include "JSDOMBinding.h" +#include "ScriptObject.h" #include <profiler/Profiler.h> namespace WebCore { @@ -42,9 +42,9 @@ void ScriptProfiler::collectGarbage() gcController().garbageCollectNow(); } -PassRefPtr<InspectorValue> ScriptProfiler::objectByHeapObjectId(unsigned, InjectedScriptManager*) +ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned) { - return InspectorValue::null(); + return ScriptObject(); } void ScriptProfiler::start(ScriptState* state, const String& title) diff --git a/Source/WebCore/bindings/js/ScriptProfiler.h b/Source/WebCore/bindings/js/ScriptProfiler.h index 2211971a8..a21eada4c 100644 --- a/Source/WebCore/bindings/js/ScriptProfiler.h +++ b/Source/WebCore/bindings/js/ScriptProfiler.h @@ -28,7 +28,6 @@ #define ScriptProfiler_h #if ENABLE(JAVASCRIPT_DEBUGGER) -#include "InspectorValues.h" #include "ScriptHeapSnapshot.h" #include "ScriptProfile.h" #include "ScriptState.h" @@ -38,7 +37,7 @@ namespace WebCore { class DOMWrapperVisitor; -class InjectedScriptManager; +class ScriptObject; class ScriptProfiler { WTF_MAKE_NONCOPYABLE(ScriptProfiler); @@ -53,7 +52,7 @@ public: }; static void collectGarbage(); - static PassRefPtr<InspectorValue> objectByHeapObjectId(unsigned id, InjectedScriptManager*); + static ScriptObject objectByHeapObjectId(unsigned id); static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String&, HeapSnapshotProgress*) { return 0; } diff --git a/Source/WebCore/bindings/js/ScriptState.cpp b/Source/WebCore/bindings/js/ScriptState.cpp index c7cd9299a..e823c6e3a 100644 --- a/Source/WebCore/bindings/js/ScriptState.cpp +++ b/Source/WebCore/bindings/js/ScriptState.cpp @@ -71,6 +71,18 @@ DOMWindow* domWindowFromScriptState(ScriptState* scriptState) return static_cast<JSDOMWindowBase*>(globalObject)->impl(); } +bool evalEnabled(ScriptState* scriptState) +{ + JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); + return globalObject->evalEnabled(); +} + +void setEvalEnabled(ScriptState* scriptState, bool enabled) +{ + JSC::JSGlobalObject* globalObject = scriptState->lexicalGlobalObject(); + return globalObject->setEvalEnabled(enabled); +} + ScriptState* mainWorldScriptState(Frame* frame) { JSDOMWindowShell* shell = frame->script()->windowShell(mainThreadNormalWorld()); diff --git a/Source/WebCore/bindings/js/ScriptState.h b/Source/WebCore/bindings/js/ScriptState.h index 4311c7460..58f36f599 100644 --- a/Source/WebCore/bindings/js/ScriptState.h +++ b/Source/WebCore/bindings/js/ScriptState.h @@ -66,6 +66,9 @@ private: DOMWindow* domWindowFromScriptState(ScriptState*); +bool evalEnabled(ScriptState*); +void setEvalEnabled(ScriptState*, bool); + ScriptState* mainWorldScriptState(Frame*); ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*); diff --git a/Source/WebCore/bindings/scripts/CodeGenerator.pm b/Source/WebCore/bindings/scripts/CodeGenerator.pm index 86a0cc55f..d5b6bdf19 100644 --- a/Source/WebCore/bindings/scripts/CodeGenerator.pm +++ b/Source/WebCore/bindings/scripts/CodeGenerator.pm @@ -589,7 +589,7 @@ sub SetterExpression sub ShouldCheckEnums { my $dataNode = shift; - return not $dataNode->extendedAttributes->{"DontCheckEnums"}; + return not $dataNode->extendedAttributes->{"DoNotCheckConstants"}; } sub GenerateConditionalStringFromAttributeValue @@ -627,7 +627,7 @@ sub GenerateCompileTimeCheckForEnumsIfNeeded push(@checks, "#if ${conditionalString}\n"); } - push(@checks, "COMPILE_ASSERT($value == ${interfaceName}::$name, ${interfaceName}Enum${name}IsWrongUseDontCheckEnums);\n"); + push(@checks, "COMPILE_ASSERT($value == ${interfaceName}::$name, ${interfaceName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); if ($conditional) { push(@checks, "#endif\n"); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm index b57c69f2b..a909a57d0 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm @@ -191,8 +191,7 @@ sub ShouldSkipType { my $typeInfo = shift; - return 1 if $typeInfo->signature->extendedAttributes->{"Custom"} - and !$typeInfo->signature->extendedAttributes->{"NoCPPCustom"}; + return 1 if $typeInfo->signature->extendedAttributes->{"Custom"}; return 1 if $typeInfo->signature->extendedAttributes->{"CustomArgumentHandling"} or $typeInfo->signature->extendedAttributes->{"CustomGetter"} @@ -297,7 +296,7 @@ sub AddIncludesForType } $implIncludes{"Node.h"} = 1 if $type eq "NodeList"; - $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; + $implIncludes{"StylePropertySet.h"} = 1 if $type eq "CSSStyleDeclaration"; # Default, include the same named file (the implementation) and the same name prefixed with "WebDOM". $implIncludes{"$type.h"} = 1 unless $type eq "DOMObject"; @@ -482,7 +481,7 @@ sub GenerateHeader $parameterIndex++; } $functionSig .= ")"; - if ($dataNode->extendedAttributes->{"PureInterface"}) { + if ($dataNode->extendedAttributes->{"CPPPureInterface"}) { push(@interfaceFunctions, " virtual " . $functionSig . " = 0;\n"); } my $functionDeclaration = $functionSig; @@ -514,9 +513,9 @@ sub GenerateHeader push(@headerContent, "};\n\n"); - # for PureInterface classes also add the interface that the client code needs to + # for CPPPureInterface classes also add the interface that the client code needs to # implement - if ($dataNode->extendedAttributes->{"PureInterface"}) { + if ($dataNode->extendedAttributes->{"CPPPureInterface"}) { push(@headerContent, "class WebUser$interfaceName {\n"); push(@headerContent, "public:\n"); push(@headerContent, " virtual void ref() = 0;\n"); @@ -530,7 +529,7 @@ sub GenerateHeader my $namespace = GetNamespaceForClass($implClassName); push(@headerContent, "$namespace" . "::$implClassName* toWebCore(const $className&);\n"); push(@headerContent, "$className toWebKit($namespace" . "::$implClassName*);\n"); - if ($dataNode->extendedAttributes->{"PureInterface"}) { + if ($dataNode->extendedAttributes->{"CPPPureInterface"}) { push(@headerContent, "$className toWebKit(WebUser$interfaceName*);\n"); } push(@headerContent, "\n#endif\n"); @@ -749,11 +748,6 @@ sub GenerateImplementation my $argName = "new" . ucfirst($attributeName); my $arg = GetCPPTypeGetter($argName, $idlType); - # The definition of ConvertToString is flipped for the setter - if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { - $arg = "WTF::String($arg).toInt()"; - } - my $attributeType = GetCPPType($attribute->signature->type, 1); push(@implContent, "void $className\:\:$setterName($attributeType $argName)\n"); push(@implContent, "{\n"); @@ -784,8 +778,8 @@ sub GenerateImplementation # - Functions if ($numFunctions > 0) { foreach my $function (@{$dataNode->functions}) { - # Treat PureInterface as Custom as well, since the WebCore versions will take a script context as well - next if ShouldSkipType($function) || $dataNode->extendedAttributes->{"PureInterface"}; + # Treat CPPPureInterface as Custom as well, since the WebCore versions will take a script context as well + next if ShouldSkipType($function) || $dataNode->extendedAttributes->{"CPPPureInterface"}; AddIncludesForType($function->signature->type); my $functionName = $function->signature->name; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm index 358b3a963..6edfd0c80 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm @@ -152,9 +152,10 @@ sub GetCoreObject { sub SkipAttribute { my $attribute = shift; - - if ($attribute->signature->extendedAttributes->{"CustomGetter"} || - $attribute->signature->extendedAttributes->{"CustomSetter"}) { + + if ($attribute->signature->extendedAttributes->{"Custom"} + || $attribute->signature->extendedAttributes->{"CustomGetter"} + || $attribute->signature->extendedAttributes->{"CustomSetter"}) { return 1; } @@ -1231,9 +1232,6 @@ EOF sub Generate { my ($object, $dataNode) = @_; - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; - my $hasRealParent = @{$dataNode->parents} > 0; - my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); my $parentGObjType = GetParentGObjType($dataNode); my $interfaceName = $dataNode->name; diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index b184e6d84..2e914262f 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -184,7 +184,7 @@ sub GetParentClassName { my $dataNode = shift; - return $dataNode->extendedAttributes->{"LegacyParent"} if $dataNode->extendedAttributes->{"LegacyParent"}; + return $dataNode->extendedAttributes->{"JSLegacyParent"} if $dataNode->extendedAttributes->{"JSLegacyParent"}; return "JSDOMWrapper" if (@{$dataNode->parents} eq 0); return "JS" . $codeGenerator->StripModule($dataNode->parents(0)); } @@ -419,7 +419,7 @@ sub GenerateGetOwnPropertySlotBody } my $manualLookupGetterGeneration = sub { - my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"}; + my $requiresManualLookup = $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NamedGetter"}; if ($requiresManualLookup) { push(@getOwnPropertySlotImpl, " const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n"); push(@getOwnPropertySlotImpl, " if (entry) {\n"); @@ -429,11 +429,11 @@ sub GenerateGetOwnPropertySlotBody } }; - if (!$dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + if (!$dataNode->extendedAttributes->{"CustomNamedGetter"}) { &$manualLookupGetterGeneration(); } - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@getOwnPropertySlotImpl, " bool ok;\n"); push(@getOwnPropertySlotImpl, " unsigned index = propertyName.toUInt32(ok);\n"); @@ -444,7 +444,7 @@ sub GenerateGetOwnPropertySlotBody } else { push(@getOwnPropertySlotImpl, " if (ok && index < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); } - if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@getOwnPropertySlotImpl, " slot.setValue(thisObject->getByIndex(exec, index));\n"); } else { push(@getOwnPropertySlotImpl, " slot.setCustomIndex(thisObject, index, indexGetter);\n"); @@ -453,7 +453,7 @@ sub GenerateGetOwnPropertySlotBody push(@getOwnPropertySlotImpl, " }\n"); } - if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + if ($dataNode->extendedAttributes->{"NamedGetter"} || $dataNode->extendedAttributes->{"CustomNamedGetter"}) { push(@getOwnPropertySlotImpl, " if (canGetItemsForName(exec, static_cast<$implClassName*>(thisObject->impl()), propertyName)) {\n"); push(@getOwnPropertySlotImpl, " slot.setCustom(thisObject, thisObject->nameGetter);\n"); push(@getOwnPropertySlotImpl, " return true;\n"); @@ -465,21 +465,21 @@ sub GenerateGetOwnPropertySlotBody } } - if ($dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + if ($dataNode->extendedAttributes->{"CustomNamedGetter"}) { &$manualLookupGetterGeneration(); } - if ($dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}) { + if ($dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"}) { push(@getOwnPropertySlotImpl, " if (thisObject->getOwnPropertySlotDelegate(exec, propertyName, slot))\n"); push(@getOwnPropertySlotImpl, " return true;\n"); } if ($hasAttributes) { if ($inlined) { - die "Cannot inline if NoStaticTables is set." if ($dataNode->extendedAttributes->{"NoStaticTables"}); + die "Cannot inline if NoStaticTables is set." if ($dataNode->extendedAttributes->{"JSNoStaticTables"}); push(@getOwnPropertySlotImpl, " return ${namespaceMaybe}getStaticValueSlot<$className, Base>(exec, s_info.staticPropHashTable, thisObject, propertyName, slot);\n"); } else { - push(@getOwnPropertySlotImpl, " return ${namespaceMaybe}getStaticValueSlot<$className, Base>(exec, " . hashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); + push(@getOwnPropertySlotImpl, " return ${namespaceMaybe}getStaticValueSlot<$className, Base>(exec, " . hashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); } } else { push(@getOwnPropertySlotImpl, " return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);\n"); @@ -499,7 +499,7 @@ sub GenerateGetOwnPropertyDescriptorBody if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!thisObject->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowAccessToFrame(exec, thisObject->impl()->frame()))\n"); + push(@implContent, " if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame()))\n"); } push(@implContent, " return false;\n"); } @@ -511,7 +511,7 @@ sub GenerateGetOwnPropertyDescriptorBody } my $manualLookupGetterGeneration = sub { - my $requiresManualLookup = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNameGetter"}; + my $requiresManualLookup = $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NamedGetter"}; if ($requiresManualLookup) { push(@getOwnPropertyDescriptorImpl, " const ${namespaceMaybe}HashEntry* entry = ${className}Table.entry(exec, propertyName);\n"); push(@getOwnPropertyDescriptorImpl, " if (entry) {\n"); @@ -522,18 +522,18 @@ sub GenerateGetOwnPropertyDescriptorBody push(@getOwnPropertyDescriptorImpl, " }\n"); } }; - - if (!$dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + + if (!$dataNode->extendedAttributes->{"CustomNamedGetter"}) { &$manualLookupGetterGeneration(); } - - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + + if ($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@getOwnPropertyDescriptorImpl, " bool ok;\n"); push(@getOwnPropertyDescriptorImpl, " unsigned index = propertyName.toUInt32(ok);\n"); push(@getOwnPropertyDescriptorImpl, " if (ok && index < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); - if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"NumericIndexedGetter"}) { # Assume that if there's a setter, the index will be writable - if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(thisObject->getByIndex(exec, index), ${namespaceMaybe}DontDelete);\n"); } else { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(thisObject->getByIndex(exec, index), ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly);\n"); @@ -542,7 +542,7 @@ sub GenerateGetOwnPropertyDescriptorBody push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}PropertySlot slot;\n"); push(@getOwnPropertyDescriptorImpl, " slot.setCustomIndex(thisObject, index, indexGetter);\n"); # Assume that if there's a setter, the index will be writable - if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(slot.getValue(exec, propertyName), ${namespaceMaybe}DontDelete);\n"); } else { push(@getOwnPropertyDescriptorImpl, " descriptor.setDescriptor(slot.getValue(exec, propertyName), ${namespaceMaybe}DontDelete | ${namespaceMaybe}ReadOnly);\n"); @@ -551,8 +551,8 @@ sub GenerateGetOwnPropertyDescriptorBody push(@getOwnPropertyDescriptorImpl, " return true;\n"); push(@getOwnPropertyDescriptorImpl, " }\n"); } - - if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + + if ($dataNode->extendedAttributes->{"NamedGetter"} || $dataNode->extendedAttributes->{"CustomNamedGetter"}) { push(@getOwnPropertyDescriptorImpl, " if (canGetItemsForName(exec, static_cast<$implClassName*>(thisObject->impl()), propertyName)) {\n"); push(@getOwnPropertyDescriptorImpl, " ${namespaceMaybe}PropertySlot slot;\n"); push(@getOwnPropertyDescriptorImpl, " slot.setCustom(thisObject, nameGetter);\n"); @@ -565,22 +565,22 @@ sub GenerateGetOwnPropertyDescriptorBody $implIncludes{"wtf/text/AtomicString.h"} = 1; } } - - if ($dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + + if ($dataNode->extendedAttributes->{"CustomNamedGetter"}) { &$manualLookupGetterGeneration(); } - - if ($dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}) { + + if ($dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"}) { push(@getOwnPropertyDescriptorImpl, " if (thisObject->getOwnPropertyDescriptorDelegate(exec, propertyName, descriptor))\n"); push(@getOwnPropertyDescriptorImpl, " return true;\n"); } - + if ($hasAttributes) { if ($inlined) { - die "Cannot inline if NoStaticTables is set." if ($dataNode->extendedAttributes->{"NoStaticTables"}); + die "Cannot inline if NoStaticTables is set." if ($dataNode->extendedAttributes->{"JSNoStaticTables"}); push(@getOwnPropertyDescriptorImpl, " return ${namespaceMaybe}getStaticValueDescriptor<$className, Base>(exec, s_info.staticPropHashTable, thisObject, propertyName, descriptor);\n"); } else { - push(@getOwnPropertyDescriptorImpl, " return ${namespaceMaybe}getStaticValueDescriptor<$className, Base>(exec, " . hashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); + push(@getOwnPropertyDescriptorImpl, " return ${namespaceMaybe}getStaticValueDescriptor<$className, Base>(exec, " . hashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); } } else { push(@getOwnPropertyDescriptorImpl, " return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);\n"); @@ -652,13 +652,13 @@ sub GenerateHeader $codeGenerator->AddMethodsConstantsAndAttributesFromParentClasses($dataNode, \@ancestorInterfaceNames); } - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; + my $hasLegacyParent = $dataNode->extendedAttributes->{"JSLegacyParent"}; my $hasRealParent = @{$dataNode->parents} > 0; my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; - my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; - + my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; + # - Add default header template and header protection push(@headerContentHeader, GenerateHeaderContentHeader($dataNode)); @@ -674,12 +674,12 @@ sub GenerateHeader $headerIncludes{"<runtime/CallData.h>"} = 1; } - if ($dataNode->extendedAttributes->{"InlineGetOwnPropertySlot"}) { + if ($dataNode->extendedAttributes->{"JSInlineGetOwnPropertySlot"}) { $headerIncludes{"<runtime/Lookup.h>"} = 1; $headerIncludes{"<wtf/AlwaysInline.h>"} = 1; } - if ($hasParent && $dataNode->extendedAttributes->{"GenerateNativeConverter"}) { + if ($hasParent && $dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) { if (IsTypedArrayType($implClassName)) { $headerIncludes{"<wtf/$implClassName.h>"} = 1; } else { @@ -749,26 +749,26 @@ sub GenerateHeader # Prototype push(@headerContent, " static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless ($dataNode->extendedAttributes->{"ExtendsDOMGlobalObject"}); - $headerTrailingIncludes{"${className}Custom.h"} = 1 if $dataNode->extendedAttributes->{"CustomHeader"}; + $headerTrailingIncludes{"${className}Custom.h"} = 1 if $dataNode->extendedAttributes->{"JSCustomHeader"}; - $implIncludes{"${className}Custom.h"} = 1 if !$dataNode->extendedAttributes->{"CustomHeader"} && ($dataNode->extendedAttributes->{"CustomPutFunction"} || $dataNode->extendedAttributes->{"DelegatingPutFunction"}); + $implIncludes{"${className}Custom.h"} = 1 if !$dataNode->extendedAttributes->{"JSCustomHeader"} && ($dataNode->extendedAttributes->{"CustomPutFunction"} || $dataNode->extendedAttributes->{"CustomNamedSetter"}); - my $hasGetter = $numAttributes > 0 + my $hasGetter = $numAttributes > 0 || !$dataNode->extendedAttributes->{"OmitConstructor"} - || $dataNode->extendedAttributes->{"HasIndexGetter"} - || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} + || $dataNode->extendedAttributes->{"IndexedGetter"} + || $dataNode->extendedAttributes->{"NumericIndexedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"} - || $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"} - || $dataNode->extendedAttributes->{"HasNameGetter"} - || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}; + || $dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"} + || $dataNode->extendedAttributes->{"NamedGetter"} + || $dataNode->extendedAttributes->{"CustomNamedGetter"}; # Getters if ($hasGetter) { push(@headerContent, " static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&);\n"); push(@headerContent, " static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&);\n"); - push(@headerContent, " static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n") if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"HasOverridingNameGetter"}; - push(@headerContent, " bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}; - push(@headerContent, " bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"}; + push(@headerContent, " static bool getOwnPropertySlotByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::PropertySlot&);\n") if ($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) && !$dataNode->extendedAttributes->{"CustomNamedGetter"}; + push(@headerContent, " bool getOwnPropertySlotDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);\n") if $dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"}; + push(@headerContent, " bool getOwnPropertyDescriptorDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n") if $dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"}; $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1; } @@ -782,14 +782,14 @@ sub GenerateHeader my $hasSetter = $hasReadWriteProperties || $dataNode->extendedAttributes->{"CustomPutFunction"} - || $dataNode->extendedAttributes->{"DelegatingPutFunction"} - || $dataNode->extendedAttributes->{"HasCustomIndexSetter"}; + || $dataNode->extendedAttributes->{"CustomNamedSetter"} + || $dataNode->extendedAttributes->{"CustomIndexedSetter"}; # Getters if ($hasSetter) { push(@headerContent, " static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); - push(@headerContent, " static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue);\n") if $dataNode->extendedAttributes->{"HasCustomIndexSetter"}; - push(@headerContent, " bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&);\n") if $dataNode->extendedAttributes->{"DelegatingPutFunction"}; + push(@headerContent, " static void putByIndex(JSC::JSCell*, JSC::ExecState*, unsigned propertyName, JSC::JSValue);\n") if $dataNode->extendedAttributes->{"CustomIndexedSetter"}; + push(@headerContent, " bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&);\n") if $dataNode->extendedAttributes->{"CustomNamedSetter"}; } if (!$hasParent) { @@ -813,7 +813,7 @@ sub GenerateHeader push(@headerContent, " }\n\n"); # Custom pushEventHandlerScope function - push(@headerContent, " JSC::ScopeChainNode* pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChainNode*) const;\n\n") if $dataNode->extendedAttributes->{"CustomPushEventHandlerScope"}; + push(@headerContent, " JSC::ScopeChainNode* pushEventHandlerScope(JSC::ExecState*, JSC::ScopeChainNode*) const;\n\n") if $dataNode->extendedAttributes->{"JSCustomPushEventHandlerScope"}; # Custom call functions push(@headerContent, " static JSC::CallType getCallData(JSC::JSCell*, JSC::CallData&);\n\n") if $dataNode->extendedAttributes->{"CustomCall"}; @@ -827,20 +827,14 @@ sub GenerateHeader $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; } - # Custom defineProperty function exists on DOMWindow - push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $interfaceName eq "DOMWindow"; - # Custom getOwnPropertyNames function - if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"CustomGetPropertyNames"} || $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@headerContent, " static void getOwnPropertyNames(JSC::JSObject*, JSC::ExecState*, JSC::PropertyNameArray&, JSC::EnumerationMode mode = JSC::ExcludeDontEnumProperties);\n"); $structureFlags{"JSC::OverridesGetPropertyNames"} = 1; } - # Custom defineGetter function - push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineGetter"}; - - # Custom defineSetter function - push(@headerContent, " static void defineSetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* setterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomDefineSetter"}; + # Custom defineOwnProperty function + push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $dataNode->extendedAttributes->{"JSCustomDefineOwnProperty"}; # Override toBoolean to return false for objects that want to 'MasqueradesAsUndefined'. if ($dataNode->extendedAttributes->{"MasqueradesAsUndefined"}) { @@ -857,9 +851,9 @@ sub GenerateHeader if ($numAttributes > 0) { foreach (@{$dataNode->attributes}) { my $attribute = $_; - $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"}; - $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}); - $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}); + $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"}; + $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"}); + $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}); if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { push(@headerContent, " JSC::WriteBarrier<JSC::Unknown> m_" . $attribute->signature->name . ";\n"); $numCachedAttributes++; @@ -878,26 +872,26 @@ sub GenerateHeader push(@headerContent, "\n // Custom attributes\n"); foreach my $attribute (@{$dataNode->attributes}) { - if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { + if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"}) { my $methodName = $codeGenerator->WK_lcfirst($attribute->signature->name); push(@headerContent, " JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n"); } - if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) && $attribute->type !~ /^readonly/) { + if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) && $attribute->type !~ /^readonly/) { push(@headerContent, " void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n"); } } } foreach my $function (@{$dataNode->functions}) { - $numCustomFunctions++ if $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}; + $numCustomFunctions++ if $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCustom"}; } if ($numCustomFunctions > 0) { push(@headerContent, "\n // Custom functions\n"); foreach my $function (@{$dataNode->functions}) { - next unless $function->signature->extendedAttributes->{"Custom"} or $function->signature->extendedAttributes->{"JSCCustom"}; + next unless $function->signature->extendedAttributes->{"Custom"} or $function->signature->extendedAttributes->{"JSCustom"}; next if $function->{overloads} && $function->{overloadIndex} != 1; - my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); + my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementedAs"} || $codeGenerator->WK_lcfirst($function->signature->name); push(@headerContent, " JSC::JSValue " . $functionImplementationName . "(JSC::ExecState*);\n"); } } @@ -908,7 +902,7 @@ sub GenerateHeader push(@headerContent, " void releaseImplIfNotNull() { if (m_impl) { m_impl->deref(); m_impl = 0; } }\n\n"); push(@headerContent, "private:\n"); push(@headerContent, " $implType* m_impl;\n"); - } elsif ($dataNode->extendedAttributes->{"GenerateNativeConverter"}) { + } elsif ($dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) { push(@headerContent, " $implClassName* impl() const\n"); push(@headerContent, " {\n"); push(@headerContent, " return static_cast<$implClassName*>(Base::impl());\n"); @@ -950,20 +944,19 @@ sub GenerateHeader push(@headerContent, "Base::StructureFlags;\n"); # Index getter - if ($dataNode->extendedAttributes->{"HasIndexGetter"}) { + if ($dataNode->extendedAttributes->{"IndexedGetter"}) { push(@headerContent, " static JSC::JSValue indexGetter(JSC::ExecState*, JSC::JSValue, unsigned);\n"); } - if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@headerContent, " JSC::JSValue getByIndex(JSC::ExecState*, unsigned index);\n"); - } - + # Index setter - if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { push(@headerContent, " void indexSetter(JSC::ExecState*, unsigned index, JSC::JSValue);\n"); } # Name getter - if ($dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + if ($dataNode->extendedAttributes->{"NamedGetter"} || $dataNode->extendedAttributes->{"CustomNamedGetter"}) { push(@headerContent, "private:\n"); push(@headerContent, " static bool canGetItemsForName(JSC::ExecState*, $implClassName*, const JSC::Identifier&);\n"); push(@headerContent, " static JSC::JSValue nameGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);\n"); @@ -971,7 +964,7 @@ sub GenerateHeader push(@headerContent, "};\n\n"); - if ($dataNode->extendedAttributes->{"InlineGetOwnPropertySlot"} && !$dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { + if ($dataNode->extendedAttributes->{"JSInlineGetOwnPropertySlot"} && !$dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { push(@headerContent, "ALWAYS_INLINE bool ${className}::getOwnPropertySlot(JSC::JSCell* cell, JSC::ExecState* exec, const JSC::Identifier& propertyName, JSC::PropertySlot& slot)\n"); push(@headerContent, "{\n"); push(@headerContent, " ${className}* thisObject = JSC::jsCast<${className}*>(cell);\n"); @@ -987,9 +980,9 @@ sub GenerateHeader } if (!$hasParent || - $dataNode->extendedAttributes->{"GenerateIsReachable"} || - $dataNode->extendedAttributes->{"CustomIsReachable"} || - $dataNode->extendedAttributes->{"CustomFinalize"} || + $dataNode->extendedAttributes->{"JSGenerateIsReachable"} || + $dataNode->extendedAttributes->{"JSCustomIsReachable"} || + $dataNode->extendedAttributes->{"JSCustomFinalize"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}) { push(@headerContent, "class JS${implClassName}Owner : public JSC::WeakHandleOwner {\n"); push(@headerContent, " virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);\n"); @@ -1009,10 +1002,10 @@ sub GenerateHeader push(@headerContent, "\n"); } - if (!$hasParent || $dataNode->extendedAttributes->{"GenerateToJS"} || $dataNode->extendedAttributes->{"CustomToJS"}) { + if (!$hasParent || $dataNode->extendedAttributes->{"JSGenerateToJS"} || $dataNode->extendedAttributes->{"JSCustomToJS"}) { push(@headerContent, "JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n"); } - if (!$hasParent || $dataNode->extendedAttributes->{"GenerateNativeConverter"}) { + if (!$hasParent || $dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) { if ($interfaceName eq "NodeFilter") { push(@headerContent, "PassRefPtr<NodeFilter> toNodeFilter(JSC::JSGlobalData&, JSC::JSValue);\n"); } else { @@ -1047,7 +1040,7 @@ sub GenerateHeader push(@headerContent, " static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);\n"); $structureFlags{"JSC::OverridesGetOwnPropertySlot"} = 1; } - if ($dataNode->extendedAttributes->{"CustomMarkFunction"} or $needsMarkChildren) { + if ($dataNode->extendedAttributes->{"JSCustomMarkFunction"} or $needsMarkChildren) { $structureFlags{"JSC::OverridesVisitChildren"} = 1; } push(@headerContent, @@ -1055,13 +1048,13 @@ sub GenerateHeader " {\n" . " return JSC::Structure::create(globalData, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);\n" . " }\n"); - if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) { + if ($dataNode->extendedAttributes->{"JSCustomPrototypePutDelegate"}) { push(@headerContent, " static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&);\n"); push(@headerContent, " bool putDelegate(JSC::ExecState*, const JSC::Identifier&, JSC::JSValue, JSC::PutPropertySlot&);\n"); } - # Custom defineGetter function - push(@headerContent, " static void defineGetter(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSObject* getterFunction, unsigned attributes);\n") if $dataNode->extendedAttributes->{"CustomPrototypeDefineGetter"}; + # Custom defineOwnProperty function + push(@headerContent, " static bool defineOwnProperty(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&, bool shouldThrow);\n") if $dataNode->extendedAttributes->{"JSCustomPrototypeDefineOwnProperty"}; push(@headerContent, "\nprivate:\n"); push(@headerContent, " ${className}Prototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { }\n"); @@ -1169,7 +1162,7 @@ sub GenerateAttributesHashTable($$) my @specials = (); push(@specials, "DontDelete") unless $attribute->signature->extendedAttributes->{"Deletable"}; - push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"DontEnum"}; + push(@specials, "DontEnum") if $attribute->signature->extendedAttributes->{"NotEnumerable"}; push(@specials, "ReadOnly") if $attribute->type =~ /readonly/; my $special = (@specials > 0) ? join(" | ", @specials) : "0"; push(@hashSpecials, $special); @@ -1323,13 +1316,13 @@ sub GenerateImplementation my $className = "JS$interfaceName"; my $implClassName = $interfaceName; - my $hasLegacyParent = $dataNode->extendedAttributes->{"LegacyParent"}; + my $hasLegacyParent = $dataNode->extendedAttributes->{"JSLegacyParent"}; my $hasRealParent = @{$dataNode->parents} > 0; my $hasParent = $hasLegacyParent || $hasRealParent; my $parentClassName = GetParentClassName($dataNode); my $visibleClassName = GetVisibleClassName($interfaceName); my $eventTarget = $dataNode->extendedAttributes->{"EventTarget"}; - my $needsMarkChildren = $dataNode->extendedAttributes->{"CustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; + my $needsMarkChildren = $dataNode->extendedAttributes->{"JSCustomMarkFunction"} || $dataNode->extendedAttributes->{"EventTarget"}; # - Add default header template push(@implContentHeader, GenerateImplementationContentHeader($dataNode)); @@ -1337,7 +1330,7 @@ sub GenerateImplementation AddIncludesForSVGAnimatedType($interfaceName) if $className =~ /^JSSVGAnimated/; $implIncludes{"<wtf/GetPtr.h>"} = 1; - $implIncludes{"<runtime/PropertyNameArray.h>"} = 1 if $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}; + $implIncludes{"<runtime/PropertyNameArray.h>"} = 1 if $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}; AddIncludesForTypeInImpl($interfaceName); @@ -1396,7 +1389,7 @@ sub GenerateImplementation my @specials = (); push(@specials, "DontDelete") unless $function->signature->extendedAttributes->{"Deletable"}; - push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"DontEnum"}; + push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"NotEnumerable"}; push(@specials, "JSC::Function"); my $special = (@specials > 0) ? join(" | ", @specials) : "0"; push(@hashSpecials, $special); @@ -1460,7 +1453,7 @@ sub GenerateImplementation my @specials = (); push(@specials, "DontDelete") unless $function->signature->extendedAttributes->{"Deletable"}; - push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"DontEnum"}; + push(@specials, "DontEnum") if $function->signature->extendedAttributes->{"NotEnumerable"}; push(@specials, "JSC::Function"); my $special = (@specials > 0) ? join(" | ", @specials) : "0"; push(@hashSpecials, $special); @@ -1476,7 +1469,7 @@ sub GenerateImplementation \@hashValue1, \@hashValue2, \%conditionals); - if ($dataNode->extendedAttributes->{"NoStaticTables"}) { + if ($dataNode->extendedAttributes->{"JSNoStaticTables"}) { push(@implContent, "static const HashTable* get${className}PrototypeTable(ExecState* exec)\n"); push(@implContent, "{\n"); push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}PrototypeTable);\n"); @@ -1500,11 +1493,11 @@ sub GenerateImplementation if ($numConstants eq 0 && $numFunctions eq 0) { push(@implContent, " return Base::getOwnPropertySlot(thisObject, exec, propertyName, slot);\n"); } elsif ($numConstants eq 0) { - push(@implContent, " return getStaticFunctionSlot<JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); + push(@implContent, " return getStaticFunctionSlot<JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); } elsif ($numFunctions eq 0) { - push(@implContent, " return getStaticValueSlot<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); + push(@implContent, " return getStaticValueSlot<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); } else { - push(@implContent, " return getStaticPropertySlot<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); + push(@implContent, " return getStaticPropertySlot<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, slot);\n"); } push(@implContent, "}\n\n"); @@ -1515,16 +1508,16 @@ sub GenerateImplementation if ($numConstants eq 0 && $numFunctions eq 0) { push(@implContent, " return Base::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);\n"); } elsif ($numConstants eq 0) { - push(@implContent, " return getStaticFunctionDescriptor<JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); + push(@implContent, " return getStaticFunctionDescriptor<JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); } elsif ($numFunctions eq 0) { - push(@implContent, " return getStaticValueDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); + push(@implContent, " return getStaticValueDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); } else { - push(@implContent, " return getStaticPropertyDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); + push(@implContent, " return getStaticPropertyDescriptor<${className}Prototype, JSObject>(exec, " . prototypeHashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, propertyName, descriptor);\n"); } push(@implContent, "}\n\n"); } - if ($dataNode->extendedAttributes->{"DelegatingPrototypePutFunction"}) { + if ($dataNode->extendedAttributes->{"JSCustomPrototypePutDelegate"}) { push(@implContent, "void ${className}Prototype::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}Prototype* thisObject = jsCast<${className}Prototype*>(cell);\n"); @@ -1535,7 +1528,7 @@ sub GenerateImplementation } # - Initialize static ClassInfo object - if ($numAttributes > 0 && $dataNode->extendedAttributes->{"NoStaticTables"}) { + if ($numAttributes > 0 && $dataNode->extendedAttributes->{"JSNoStaticTables"}) { push(@implContent, "static const HashTable* get${className}Table(ExecState* exec)\n"); push(@implContent, "{\n"); push(@implContent, " return getHashTableForGlobalData(exec->globalData(), &${className}Table);\n"); @@ -1544,12 +1537,12 @@ sub GenerateImplementation push(@implContent, "const ClassInfo $className" . "::s_info = { \"${visibleClassName}\", &Base::s_info, "); - if ($numAttributes > 0 && !$dataNode->extendedAttributes->{"NoStaticTables"}) { + if ($numAttributes > 0 && !$dataNode->extendedAttributes->{"JSNoStaticTables"}) { push(@implContent, "&${className}Table"); } else { push(@implContent, "0"); } - if ($numAttributes > 0 && $dataNode->extendedAttributes->{"NoStaticTables"}) { + if ($numAttributes > 0 && $dataNode->extendedAttributes->{"JSNoStaticTables"}) { push(@implContent, ", get${className}Table "); } else { push(@implContent, ", 0 "); @@ -1626,18 +1619,18 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - my $hasGetter = $numAttributes > 0 + my $hasGetter = $numAttributes > 0 || !$dataNode->extendedAttributes->{"OmitConstructor"} - || $dataNode->extendedAttributes->{"HasIndexGetter"} - || $dataNode->extendedAttributes->{"HasNumericIndexGetter"} - || $dataNode->extendedAttributes->{"DelegatingGetOwnPropertySlot"} + || $dataNode->extendedAttributes->{"IndexedGetter"} + || $dataNode->extendedAttributes->{"NumericIndexedGetter"} + || $dataNode->extendedAttributes->{"JSCustomGetOwnPropertySlotDelegate"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"} - || $dataNode->extendedAttributes->{"HasNameGetter"} - || $dataNode->extendedAttributes->{"HasOverridingNameGetter"}; + || $dataNode->extendedAttributes->{"NamedGetter"} + || $dataNode->extendedAttributes->{"CustomNamedGetter"}; # Attributes if ($hasGetter) { - if (!$dataNode->extendedAttributes->{"InlineGetOwnPropertySlot"} && !$dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { + if (!$dataNode->extendedAttributes->{"JSInlineGetOwnPropertySlot"} && !$dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}) { push(@implContent, "bool ${className}::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); @@ -1652,14 +1645,14 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) - && !$dataNode->extendedAttributes->{"HasOverridingNameGetter"}) { + if (($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) + && !$dataNode->extendedAttributes->{"CustomNamedGetter"}) { push(@implContent, "bool ${className}::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, PropertySlot& slot)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\n"); push(@implContent, " if (propertyName < static_cast<$implClassName*>(thisObject->impl())->length()) {\n"); - if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@implContent, " slot.setValue(thisObject->getByIndex(exec, propertyName));\n"); } else { push(@implContent, " slot.setCustomIndex(thisObject, propertyName, thisObject->indexGetter);\n"); @@ -1669,7 +1662,7 @@ sub GenerateImplementation push(@implContent, " return thisObject->methodTable()->getOwnPropertySlot(thisObject, exec, Identifier::from(exec, propertyName), slot);\n"); push(@implContent, "}\n\n"); } - + if ($numAttributes > 0) { foreach my $attribute (@{$dataNode->attributes}) { my $name = $attribute->signature->name; @@ -1690,17 +1683,17 @@ sub GenerateImplementation if ($dataNode->extendedAttributes->{"CheckDomainSecurity"} && !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurity"} && - !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurityOnGet"}) { + !$attribute->signature->extendedAttributes->{"DoNotCheckDomainSecurityOnGetter"}) { push(@implContent, " if (!castedThis->allowsAccessFrom(exec))\n"); push(@implContent, " return jsUndefined();\n"); } - if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCCustomGetter"}) { + if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"}) { push(@implContent, " return castedThis->$implGetterFunctionName(exec);\n"); } elsif ($attribute->signature->extendedAttributes->{"CheckAccessToNode"}) { $implIncludes{"JSDOMBinding.h"} = 1; push(@implContent, " $implClassName* impl = static_cast<$implClassName*>(castedThis->impl());\n"); - push(@implContent, " return allowAccessToNode(exec, impl->" . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); + push(@implContent, " return shouldAllowAccessToNode(exec, impl->" . $attribute->signature->name . "()) ? " . NativeToJSValue($attribute->signature, 0, $implClassName, "impl->$implGetterFunctionName()", "castedThis") . " : jsUndefined();\n"); } elsif ($type eq "EventListener") { $implIncludes{"EventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); @@ -1831,8 +1824,8 @@ sub GenerateImplementation } my $hasSetter = $hasReadWriteProperties - || $dataNode->extendedAttributes->{"DelegatingPutFunction"} - || $dataNode->extendedAttributes->{"HasCustomIndexSetter"}; + || $dataNode->extendedAttributes->{"CustomNamedSetter"} + || $dataNode->extendedAttributes->{"CustomIndexedSetter"}; if ($hasSetter) { if (!$dataNode->extendedAttributes->{"CustomPutFunction"}) { @@ -1840,7 +1833,7 @@ sub GenerateImplementation push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\n"); - if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { push(@implContent, " bool ok;\n"); push(@implContent, " unsigned index = propertyName.toUInt32(ok);\n"); push(@implContent, " if (ok) {\n"); @@ -1848,20 +1841,20 @@ sub GenerateImplementation push(@implContent, " return;\n"); push(@implContent, " }\n"); } - if ($dataNode->extendedAttributes->{"DelegatingPutFunction"}) { + if ($dataNode->extendedAttributes->{"CustomNamedSetter"}) { push(@implContent, " if (thisObject->putDelegate(exec, propertyName, value, slot))\n"); push(@implContent, " return;\n"); } if ($hasReadWriteProperties) { - push(@implContent, " lookupPut<$className, Base>(exec, propertyName, value, " . hashTableAccessor($dataNode->extendedAttributes->{"NoStaticTables"}, $className) . ", thisObject, slot);\n"); + push(@implContent, " lookupPut<$className, Base>(exec, propertyName, value, " . hashTableAccessor($dataNode->extendedAttributes->{"JSNoStaticTables"}, $className) . ", thisObject, slot);\n"); } else { push(@implContent, " Base::put(thisObject, exec, propertyName, value, slot);\n"); } push(@implContent, "}\n\n"); } - if ($dataNode->extendedAttributes->{"HasCustomIndexSetter"}) { + if ($dataNode->extendedAttributes->{"CustomIndexedSetter"}) { push(@implContent, "void ${className}::putByIndex(JSCell* cell, ExecState* exec, unsigned propertyName, JSValue value)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); @@ -1889,18 +1882,18 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); + push(@implContent, " if (!shouldAllowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); } push(@implContent, " return;\n"); } - if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCCustomSetter"}) { + if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) { push(@implContent, " static_cast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n"); } elsif ($type eq "EventListener") { $implIncludes{"JSEventListener.h"} = 1; push(@implContent, " UNUSED_PARAM(exec);\n"); push(@implContent, " ${className}* castedThis = static_cast<${className}*>(thisObject);\n"); - my $windowEventListener = $attribute->signature->extendedAttributes->{"WindowEventListener"}; + my $windowEventListener = $attribute->signature->extendedAttributes->{"JSWindowEventListener"}; if ($windowEventListener) { push(@implContent, " JSDOMGlobalObject* globalObject = castedThis->globalObject();\n"); } @@ -2017,7 +2010,7 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow") { push(@implContent, " if (!static_cast<$className*>(thisObject)->allowsAccessFrom(exec))\n"); } else { - push(@implContent, " if (!allowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); + push(@implContent, " if (!shouldAllowAccessToFrame(exec, static_cast<$className*>(thisObject)->impl()->frame()))\n"); } push(@implContent, " return;\n"); } @@ -2034,12 +2027,12 @@ sub GenerateImplementation } } - if (($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { + if (($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) && !$dataNode->extendedAttributes->{"CustomGetPropertyNames"}) { push(@implContent, "void ${className}::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(object);\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);\n"); - if ($dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + if ($dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@implContent, " for (unsigned i = 0; i < static_cast<${implClassName}*>(thisObject->impl())->length(); ++i)\n"); push(@implContent, " propertyNames.add(Identifier::from(exec, i));\n"); } @@ -2058,7 +2051,7 @@ sub GenerateImplementation foreach my $function (@{$dataNode->functions}) { AddIncludesForTypeInImpl($function->signature->type); - my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCCustom"}; + my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCustom"}; my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1; next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1; @@ -2080,7 +2073,7 @@ sub GenerateImplementation push(@implContent, "static "); } - my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementationFunction"} || $codeGenerator->WK_lcfirst($function->signature->name); + my $functionImplementationName = $function->signature->extendedAttributes->{"ImplementedAs"} || $codeGenerator->WK_lcfirst($function->signature->name); push(@implContent, "EncodedJSValue JSC_HOST_CALL ${functionName}(ExecState* exec)\n"); push(@implContent, "{\n"); @@ -2131,7 +2124,7 @@ sub GenerateImplementation } if ($function->signature->extendedAttributes->{"CheckAccessToNode"} and !$function->isStatic) { - push(@implContent, " if (!allowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); + push(@implContent, " if (!shouldAllowAccessToNode(exec, impl->" . $function->signature->name . "(" . (@{$function->raisesExceptions} ? "ec" : "") .")))\n"); push(@implContent, " return JSValue::encode(jsUndefined());\n"); $implIncludes{"JSDOMBinding.h"} = 1; } @@ -2157,7 +2150,7 @@ sub GenerateImplementation push(@implContent, "#endif\n\n") if $conditional; } - if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) { + if ($needsMarkChildren && !$dataNode->extendedAttributes->{"JSCustomMarkFunction"}) { push(@implContent, "void ${className}::visitChildren(JSCell* cell, SlotVisitor& visitor)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); @@ -2182,7 +2175,7 @@ sub GenerateImplementation # Cached attributes are indeed allowed when there is a custom mark/visitChildren function. # The custom function must make sure to account for the cached attribute. # Uncomment the below line to temporarily enforce generated mark functions when cached attributes are present. - # die "Can't generate binding for class with cached attribute and custom mark." if (($numCachedAttributes > 0) and ($dataNode->extendedAttributes->{"CustomMarkFunction"})); + # die "Can't generate binding for class with cached attribute and custom mark." if (($numCachedAttributes > 0) and ($dataNode->extendedAttributes->{"JSCustomMarkFunction"})); } if ($numConstants > 0) { @@ -2211,7 +2204,7 @@ sub GenerateImplementation } } - if ($dataNode->extendedAttributes->{"HasIndexGetter"}) { + if ($dataNode->extendedAttributes->{"IndexedGetter"}) { push(@implContent, "\nJSValue ${className}::indexGetter(ExecState* exec, JSValue slotBase, unsigned index)\n"); push(@implContent, "{\n"); push(@implContent, " ${className}* thisObj = static_cast<$className*>(asObject(slotBase));\n"); @@ -2228,8 +2221,8 @@ sub GenerateImplementation $implIncludes{"Node.h"} = 1; } } - - if ($dataNode->extendedAttributes->{"HasNumericIndexGetter"}) { + + if ($dataNode->extendedAttributes->{"NumericIndexedGetter"}) { push(@implContent, "\nJSValue ${className}::getByIndex(ExecState*, unsigned index)\n"); push(@implContent, "{\n"); push(@implContent, " ASSERT_GC_OBJECT_INHERITS(this, &s_info);\n"); @@ -2245,7 +2238,7 @@ sub GenerateImplementation } } - if ((!$hasParent && !$dataNode->extendedAttributes->{"CustomIsReachable"})|| $dataNode->extendedAttributes->{"GenerateIsReachable"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}) { + if ((!$hasParent && !$dataNode->extendedAttributes->{"JSCustomIsReachable"})|| $dataNode->extendedAttributes->{"JSGenerateIsReachable"} || $dataNode->extendedAttributes->{"ActiveDOMObject"}) { push(@implContent, "static inline bool isObservable(JS${implClassName}* js${implClassName})\n"); push(@implContent, "{\n"); push(@implContent, " if (js${implClassName}->hasCustomProperties())\n"); @@ -2273,21 +2266,21 @@ sub GenerateImplementation } push(@implContent, " if (!isObservable(js${implClassName}))\n"); push(@implContent, " return false;\n"); - if ($dataNode->extendedAttributes->{"GenerateIsReachable"}) { + if ($dataNode->extendedAttributes->{"JSGenerateIsReachable"}) { my $rootString; - if ($dataNode->extendedAttributes->{"GenerateIsReachable"} eq "Impl") { + if ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "Impl") { $rootString = " ${implType}* root = js${implClassName}->impl();\n"; - } elsif ($dataNode->extendedAttributes->{"GenerateIsReachable"} eq "ImplContext") { + } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplContext") { $rootString = " WebGLRenderingContext* root = js${implClassName}->impl()->context();\n"; - } elsif ($dataNode->extendedAttributes->{"GenerateIsReachable"} eq "ImplFrame") { + } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplFrame") { $rootString = " Frame* root = js${implClassName}->impl()->frame();\n"; $rootString .= " if (!root)\n"; $rootString .= " return false;\n"; - } elsif ($dataNode->extendedAttributes->{"GenerateIsReachable"} eq "ImplDocument") { + } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplDocument") { $rootString = " Document* root = js${implClassName}->impl()->document();\n"; $rootString .= " if (!root)\n"; $rootString .= " return false;\n"; - } elsif ($dataNode->extendedAttributes->{"GenerateIsReachable"} eq "ImplElementRoot") { + } elsif ($dataNode->extendedAttributes->{"JSGenerateIsReachable"} eq "ImplElementRoot") { $rootString = " Element* element = js${implClassName}->impl()->element();\n"; $rootString .= " if (!element)\n"; $rootString .= " return false;\n"; @@ -2309,10 +2302,10 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if (!$dataNode->extendedAttributes->{"CustomFinalize"} && - (!$hasParent || - $dataNode->extendedAttributes->{"GenerateIsReachable"} || - $dataNode->extendedAttributes->{"CustomIsReachable"} || + if (!$dataNode->extendedAttributes->{"JSCustomFinalize"} && + (!$hasParent || + $dataNode->extendedAttributes->{"JSGenerateIsReachable"} || + $dataNode->extendedAttributes->{"JSCustomIsReachable"} || $dataNode->extendedAttributes->{"ActiveDOMObject"})) { push(@implContent, "void JS${implClassName}Owner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)\n"); push(@implContent, "{\n"); @@ -2323,7 +2316,7 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateToJS"}) and !$dataNode->extendedAttributes->{"CustomToJS"}) { + if ((!$hasParent or $dataNode->extendedAttributes->{"JSGenerateToJS"}) and !$dataNode->extendedAttributes->{"JSCustomToJS"}) { push(@implContent, "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, $implType* impl)\n"); push(@implContent, "{\n"); if ($svgPropertyType) { @@ -2334,7 +2327,7 @@ sub GenerateImplementation push(@implContent, "}\n\n"); } - if ((!$hasParent or $dataNode->extendedAttributes->{"GenerateNativeConverter"}) and !$dataNode->extendedAttributes->{"CustomNativeConverter"}) { + if ((!$hasParent or $dataNode->extendedAttributes->{"JSGenerateToNativeObject"}) and !$dataNode->extendedAttributes->{"JSCustomToNativeObject"}) { push(@implContent, "$implType* to${interfaceName}(JSC::JSValue value)\n"); push(@implContent, "{\n"); push(@implContent, " return value.inherits(&${className}::s_info) ? static_cast<$className*>(asObject(value))->impl() : 0"); @@ -2868,8 +2861,15 @@ sub JSValueToNative return "static_cast<Range::CompareHow>($value.toInt32(exec))" if $type eq "CompareHow"; if ($type eq "DOMString") { - return "valueToStringWithNullCheck(exec, $value)" if ($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString") or $signature->extendedAttributes->{"Reflect"}; - return "valueToStringWithUndefinedOrNullCheck(exec, $value)" if $signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}; + # FIXME: This implements [TreatNullAs=NullString] and [TreatUndefinedAs=NullString], + # but the Web IDL spec requires [TreatNullAs=EmptyString] and [TreatUndefinedAs=EmptyString]. + if (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "NullString") and ($signature->extendedAttributes->{"TreatUndefinedAs"} and $signature->extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) { + return "valueToStringWithUndefinedOrNullCheck(exec, $value)" + } + if (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "NullString") or $signature->extendedAttributes->{"Reflect"}) { + return "valueToStringWithNullCheck(exec, $value)" + } + # FIXME: Add the case for 'if ($signature->extendedAttributes->{"TreatUndefinedAs"} and $signature->extendedAttributes->{"TreatUndefinedAs"} eq "NullString"))'. return "ustringToString($value.isEmpty() ? UString() : $value.toString(exec)->value(exec))"; } @@ -2958,7 +2958,7 @@ sub NativeToJSValue my $globalObject = "$thisValue->globalObject()"; if ($type eq "CSSStyleDeclaration") { - AddToImplIncludes("CSSMutableStyleDeclaration.h", $conditional); + AddToImplIncludes("StylePropertySet.h", $conditional); } if ($type eq "NodeList") { @@ -2991,7 +2991,7 @@ sub NativeToJSValue return $value if $codeGenerator->IsSVGAnimatedType($type); - if ($signature->extendedAttributes->{"ReturnsNew"}) { + if ($signature->extendedAttributes->{"ReturnNewObject"}) { return "toJSNewlyCreated(exec, $globalObject, WTF::getPtr($value))"; } @@ -3488,7 +3488,7 @@ END for (my $index = 0; $index < @{$dataNode->attributes}; $index++) { my $attribute = @{$dataNode->attributes}[$index]; - if ($attribute->signature->extendedAttributes->{"InitializedByConstructor"}) { + if ($attribute->signature->extendedAttributes->{"InitializedByEventConstructor"}) { my $attributeName = $attribute->signature->name; push(@implContent, <<END); if (!dictionary.tryGetProperty("${attributeName}", eventInit.${attributeName})) diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm index a31f77a02..5a63fc33b 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm @@ -617,7 +617,7 @@ sub AddIncludesForType } # FIXME: won't compile without these - $implIncludes{"CSSMutableStyleDeclaration.h"} = 1 if $type eq "CSSStyleDeclaration"; + $implIncludes{"StylePropertySet.h"} = 1 if $type eq "CSSStyleDeclaration"; $implIncludes{"NameNodeList.h"} = 1 if $type eq "NodeList"; # Default, include the same named file (the implementation) and the same name prefixed with "DOM". @@ -863,7 +863,7 @@ sub GenerateHeader my $functionName = $function->signature->name; my $returnType = GetObjCType($function->signature->type); - my $needsDeprecatedVersion = (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"OldStyleObjC"}); + my $needsDeprecatedVersion = (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"ObjCLegacyUnnamedParameters"}); my $numberOfParameters = @{$function->parameters}; my %typesToForwardDeclare = ($function->signature->type => 1); @@ -942,7 +942,7 @@ sub GenerateHeader push(@deprecatedHeaderFunctions, $functionDeclaration); unless (defined $publicInterfaces{$publicInterfaceKey}) { - warn "Deprecated method $publicInterfaceKey is not in PublicDOMInterfaces.h. All deprecated methods need to be public, or should have the OldStyleObjC IDL attribute removed"; + warn "Deprecated method $publicInterfaceKey is not in PublicDOMInterfaces.h. All deprecated methods need to be public, or should have the ObjCLegacyUnnamedParameters IDL attribute removed"; $fatalError = 1; } @@ -1036,7 +1036,7 @@ sub GenerateHeader push(@internalHeaderContent, "$implType* core($className *);\n"); push(@internalHeaderContent, "$className *kit($implType*);\n"); - if ($dataNode->extendedAttributes->{Polymorphic}) { + if ($dataNode->extendedAttributes->{"ObjCPolymorphic"}) { push(@internalHeaderContent, "Class kitClass($implType*);\n"); } @@ -1257,7 +1257,7 @@ sub GenerateImplementation } } $implIncludes{"DOMPrivate.h"} = 1; - } elsif ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + } elsif ($attribute->signature->extendedAttributes->{"ObjCImplementedAsUnsignedLong"}) { $getterContentHead = "WTF::String::number(" . $getterContentHead; $getterContentTail .= ")"; } elsif ($idlType eq "Date") { @@ -1384,8 +1384,8 @@ sub GenerateImplementation my $argName = "new" . ucfirst($attributeInterfaceName); my $arg = GetObjCTypeGetter($argName, $idlType); - # The definition of ConvertToString is flipped for the setter - if ($attribute->signature->extendedAttributes->{"ConvertToString"}) { + # The definition of ObjCImplementedAsUnsignedLong is flipped for the setter + if ($attribute->signature->extendedAttributes->{"ObjCImplementedAsUnsignedLong"}) { $arg = "WTF::String($arg).toInt()"; } @@ -1537,7 +1537,7 @@ sub GenerateImplementation $implIncludes{"Node.h"} = 1; } - if ($function->signature->extendedAttributes->{"UsesView"}) { + if ($function->signature->extendedAttributes->{"ObjCUseDefaultView"}) { push(@functionContent, " WebCore::DOMWindow* dv = $caller->defaultView();\n"); push(@functionContent, " if (!dv)\n"); push(@functionContent, " return nil;\n"); @@ -1691,7 +1691,7 @@ sub GenerateImplementation push(@implContent, "#endif\n\n") if $conditionalString; # generate the old style method names with un-named parameters, these methods are deprecated - if (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"OldStyleObjC"}) { + if (@{$function->parameters} > 1 and $function->signature->extendedAttributes->{"ObjCLegacyUnnamedParameters"}) { my $deprecatedFunctionSig = $functionSig; $deprecatedFunctionSig =~ s/\s\w+:/ :/g; # remove parameter names @@ -1724,7 +1724,7 @@ sub GenerateImplementation push(@implContent, " return nil;\n"); push(@implContent, " if ($className *wrapper = getDOMWrapper(value))\n"); push(@implContent, " return [[wrapper retain] autorelease];\n"); - if ($dataNode->extendedAttributes->{Polymorphic}) { + if ($dataNode->extendedAttributes->{"ObjCPolymorphic"}) { push(@implContent, " $className *wrapper = [[kitClass(value) alloc] _init];\n"); push(@implContent, " if (!wrapper)\n"); push(@implContent, " return nil;\n"); diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm index 62909b8d4..10015ad3e 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm @@ -3,7 +3,7 @@ # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> # Copyright (C) 2006 Apple Computer, Inc. -# Copyright (C) 2007, 2008, 2009 Google Inc. +# Copyright (C) 2007-2012 Google Inc. # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> # Copyright (C) Research In Motion Limited 2010. All rights reserved. # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) @@ -172,7 +172,7 @@ sub AddIncludesForType } if ($type eq "CSSStyleDeclaration") { - AddToImplIncludes("CSSMutableStyleDeclaration.h"); + AddToImplIncludes("StylePropertySet.h"); } if ($type eq "Plugin" or $type eq "PluginArray" or $type eq "MimeTypeArray") { @@ -192,26 +192,6 @@ sub GenerateConditionalString } } -sub GenerateEagerDeserialization -{ - my $serializedAttribute = shift; - - # Eagerly deserialize attributes of type SerializedScriptValue while we're - # in the right context. - - die "Attribute of type SerializedScriptValue expected" if $serializedAttribute->signature->type ne "SerializedScriptValue"; - my $attrName = $serializedAttribute->signature->name; - my $attrAttr = "v8::DontDelete"; - if ($serializedAttribute->type =~ /^readonly/) { - $attrAttr .= " | v8::ReadOnly"; - } - $attrAttr = "static_cast<v8::PropertyAttribute>($attrAttr)"; - my $getterFunc = $codeGenerator->WK_lcfirst($attrName); - push(@implContent, <<END); - SerializedScriptValue::deserializeAndSetProperty(wrapper, "${attrName}", ${attrAttr}, impl->${getterFunc}()); -END -} - sub GetSVGPropertyTypes { my $implType = shift; @@ -390,7 +370,7 @@ END END } - if ($attrExt->{"EnabledAtRuntime"}) { + if ($attrExt->{"V8EnabledAtRuntime"}) { push(@enabledAtRuntime, $function); } } @@ -418,7 +398,7 @@ END static void ${name}AccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value>, const v8::AccessorInfo&); END } - if ($attrExt->{"EnabledAtRuntime"}) { + if ($attrExt->{"V8EnabledAtRuntime"}) { push(@enabledAtRuntime, $attribute); } } @@ -525,17 +505,17 @@ sub GetInternalFields { my $dataNode = shift; my $name = $dataNode->name; - + my @customInternalFields = (); - - # We can't ask whether a parent type has a given extendedAttribute, so special-case AbstractWorker and WorkerContext to include all sub-types. + # We can't ask whether a parent type has a given extendedAttribute, + # so special-case AbstractWorker and WorkerContext to include all sub-types. # Event listeners on DOM nodes are explicitly supported in the GC controller. # FIXME: SVGElementInstance should probably have the EventTarget extended attribute, but doesn't. - if (!IsNodeSubType($dataNode) && - ($dataNode->extendedAttributes->{"EventTarget"} || - IsSubType($dataNode, "AbstractWorker") || - IsSubType($dataNode, "WorkerContext") || - $name eq "SVGElementInstance")) { + if (!IsNodeSubType($dataNode) + && ($dataNode->extendedAttributes->{"EventTarget"} + || $dataNode->extendedAttributes->{"IsWorkerContext"} + || IsSubType($dataNode, "AbstractWorker") + || $name eq "SVGElementInstance")) { push(@customInternalFields, "eventListenerCacheIndex"); } @@ -583,10 +563,10 @@ sub GenerateHeaderNamedAndIndexedPropertyAccessors { my $dataNode = shift; my $interfaceName = $dataNode->name; - my $hasCustomIndexedGetter = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; - my $hasCustomIndexedSetter = $dataNode->extendedAttributes->{"HasCustomIndexSetter"} && !$dataNode->extendedAttributes->{"HasNumericIndexGetter"}; - my $hasCustomNamedGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $dataNode->extendedAttributes->{"HasOverridingNameGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; - my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; + my $hasCustomIndexedGetter = $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + my $hasCustomIndexedSetter = $dataNode->extendedAttributes->{"CustomIndexedSetter"} && !$dataNode->extendedAttributes->{"NumericIndexedGetter"}; + my $hasCustomNamedGetter = $dataNode->extendedAttributes->{"NamedGetter"} || $dataNode->extendedAttributes->{"CustomNamedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"}; my $hasCustomDeleters = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; my $hasCustomEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; if ($interfaceName eq "HTMLOptionsCollection") { @@ -755,6 +735,7 @@ END sub GenerateConstructorGetter { + my $dataNode = shift; my $implClassName = shift; push(@implContentDecls, <<END); @@ -773,7 +754,7 @@ END // context of the DOMWindow and not in the context of the caller. return V8DOMWrapper::getConstructor(type, V8DOMWindow::toNative(info.Holder())); END - } elsif ($implClassName eq "DedicatedWorkerContext" or $implClassName eq "WorkerContext" or $implClassName eq "SharedWorkerContext") { + } elsif ($dataNode->extendedAttributes->{"IsWorkerContext"}) { push(@implContentDecls, <<END); return V8DOMWrapper::getConstructor(type, V8WorkerContext::toNative(info.Holder())); END @@ -829,7 +810,7 @@ END END } } - } elsif ($attrExt->{"v8OnProto"} || $attrExt->{"V8Unforgeable"}) { + } elsif ($attrExt->{"V8OnProto"} || $attrExt->{"V8Unforgeable"}) { if ($interfaceName eq "DOMWindow") { push(@implContentDecls, <<END); v8::Handle<v8::Object> holder = info.Holder(); @@ -859,6 +840,14 @@ END return; # Skip the rest of the function! } + if ($attribute->signature->type eq "SerializedScriptValue" && $attrExt->{"CachedAttribute"}) { + push(@implContentDecls, <<END); + v8::Handle<v8::String> propertyName = v8::String::NewSymbol("${attrName}"); + v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName); + if (!value.IsEmpty()) + return value; +END + } push(@implContentDecls, <<END); ${implClassName}* imp = V8${implClassName}::toNative(info.Holder()); END @@ -866,7 +855,7 @@ END # Generate security checks if necessary if ($attribute->signature->extendedAttributes->{"CheckAccessToNode"}) { - push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->" . $attribute->signature->name . "()))\n return v8::Handle<v8::Value>();\n\n"); + push(@implContentDecls, " if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->" . $attribute->signature->name . "()))\n return v8::Handle<v8::Value>();\n\n"); } my $useExceptions = 1 if @{$attribute->getterExceptions}; @@ -933,7 +922,7 @@ END # Special case for readonly or Replaceable attributes (with a few exceptions). This attempts to ensure that JS wrappers don't get # garbage-collected prematurely when their lifetime is strongly tied to their owner. We accomplish this by inserting a reference to # the newly created wrapper into an internal field of the holder object. - if (!IsNodeSubType($dataNode) && $attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"}) + if ($attrName ne "self" && (IsWrapperType($returnType) && ($attribute->type =~ /^readonly/ || $attribute->signature->extendedAttributes->{"Replaceable"}) && $returnType ne "EventTarget" && $returnType ne "SerializedScriptValue" && $returnType ne "DOMWindow" && $returnType !~ /SVG/ && $returnType !~ /HTML/ && !IsDOMNodeType($returnType))) { AddIncludesForType($returnType); @@ -998,7 +987,17 @@ END push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($result)));\n"); } } else { - push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); + if ($attribute->signature->type eq "SerializedScriptValue" && $attrExt->{"CachedAttribute"}) { + my $getterFunc = $codeGenerator->WK_lcfirst($attribute->signature->name); + push(@implContentDecls, <<END); + SerializedScriptValue* serialized = imp->${getterFunc}(); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + info.Holder()->SetHiddenValue(propertyName, value); + return value; +END + } else { + push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); + } } push(@implContentDecls, "}\n\n"); # end of getter @@ -1055,7 +1054,7 @@ END push(@implContentDecls, " $svgWrappedNativeType& impInstance = wrapper->propertyReference();\n"); push(@implContentDecls, " $svgWrappedNativeType* imp = &impInstance;\n"); } - } elsif ($attrExt->{"v8OnProto"}) { + } elsif ($attrExt->{"V8OnProto"}) { if ($interfaceName eq "DOMWindow") { push(@implContentDecls, <<END); v8::Handle<v8::Object> holder = info.Holder(); @@ -1183,6 +1182,12 @@ END } } + if ($attribute->signature->type eq "SerializedScriptValue" && $attribute->signature->extendedAttributes->{"CachedAttribute"}) { + push(@implContentDecls, <<END); + info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("${attrName}")); // Invalidate the cached value. +END + } + push(@implContentDecls, " return;\n"); push(@implContentDecls, "}\n\n"); # end of setter push(@implContentDecls, "#endif // ${conditionalString}\n\n") if $conditionalString; @@ -1434,7 +1439,7 @@ END AddToImplIncludes("ScriptCallStackFactory.h"); } if ($function->signature->extendedAttributes->{"CheckAccessToNode"}) { - push(@implContentDecls, " if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->" . $function->signature->name . "(ec)))\n"); + push(@implContentDecls, " if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->" . $function->signature->name . "(ec)))\n"); push(@implContentDecls, " return v8::Handle<v8::Value>();\n"); END } @@ -1591,6 +1596,13 @@ sub GenerateParametersCheck } $parameterCheckString .= " EXCEPTION_BLOCK($nativeType, $parameterName, " . JSValueToNative($parameter, "MAYBE_MISSING_PARAMETER(args, $paramIndex, $parameterMissingPolicy)") . ");\n"; + if ($nativeType eq 'OptionsObject') { + $parameterCheckString .= " if (args.Length() > $paramIndex && !$parameterName.isUndefinedOrNull() && !$parameterName.isObject()) {\n"; + $parameterCheckString .= " ec = TYPE_MISMATCH_ERR;\n"; + $parameterCheckString .= " V8Proxy::setDOMException(ec);\n"; + $parameterCheckString .= " return throwError(\"Not an object.\", V8Proxy::TypeError);\n"; + $parameterCheckString .= " }\n"; + } } if ($parameter->extendedAttributes->{"IsIndex"}) { @@ -1610,7 +1622,6 @@ sub GenerateConstructorCallback my $function = shift; my $dataNode = shift; my $implClassName = shift; - my $serializedAttribute = shift; my $raisesExceptions = @{$function->raisesExceptions}; if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) { @@ -1686,11 +1697,6 @@ END V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get()); impl->ref(); -END - if ($serializedAttribute) { - GenerateEagerDeserialization($serializedAttribute); - } - push(@implContent, <<END); V8DOMWrapper::setJSWrapperFor${DOMObject}(impl.get(), v8::Persistent<v8::Object>::New(wrapper)); return args.Holder(); END @@ -1753,7 +1759,7 @@ END for (my $index = 0; $index < @{$dataNode->attributes}; $index++) { my $attribute = @{$dataNode->attributes}[$index]; - if ($attribute->signature->extendedAttributes->{"InitializedByConstructor"}) { + if ($attribute->signature->extendedAttributes->{"InitializedByEventConstructor"}) { my $attributeName = $attribute->signature->name; push(@implContent, " options.get(\"$attributeName\", eventInit.$attributeName);\n"); } @@ -1771,7 +1777,6 @@ sub GenerateNamedConstructorCallback my $function = shift; my $dataNode = shift; my $implClassName = shift; - my $serializedAttribute = shift; my $raisesExceptions = @{$function->raisesExceptions}; if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) { @@ -1870,11 +1875,6 @@ END V8DOMWrapper::setDOMWrapper(wrapper, &V8${implClassName}Constructor::info, impl.get()); impl->ref(); -END - if ($serializedAttribute) { - GenerateEagerDeserialization($serializedAttribute); - } - push(@implContent, <<END); V8DOMWrapper::setJSWrapperFor${DOMObject}(impl.get(), v8::Persistent<v8::Object>::New(wrapper)); return args.Holder(); END @@ -1932,14 +1932,10 @@ sub GenerateSingleBatchedAttribute my $attrName = $attribute->signature->name; my $attrExt = $attribute->signature->extendedAttributes; - # Attributes of type SerializedScriptValue are set in the - # constructor and don't require callbacks. - return if ($attribute->signature->type eq "SerializedScriptValue"); - my $accessControl = "v8::DEFAULT"; - if ($attrExt->{"DoNotCheckDomainSecurityOnGet"}) { + if ($attrExt->{"DoNotCheckDomainSecurityOnGetter"}) { $accessControl = "v8::ALL_CAN_READ"; - } elsif ($attrExt->{"DoNotCheckDomainSecurityOnSet"}) { + } elsif ($attrExt->{"DoNotCheckDomainSecurityOnSetter"}) { $accessControl = "v8::ALL_CAN_WRITE"; } elsif ($attrExt->{"DoNotCheckDomainSecurity"}) { $accessControl = "v8::ALL_CAN_READ"; @@ -1971,7 +1967,7 @@ sub GenerateSingleBatchedAttribute my $hasCustomSetter = 0; # Check attributes. - if ($attrExt->{"DontEnum"}) { + if ($attrExt->{"NotEnumerable"}) { $propAttr .= " | v8::DontEnum"; } if ($attrExt->{"V8Unforgeable"}) { @@ -2034,7 +2030,7 @@ sub GenerateSingleBatchedAttribute } # An accessor can be installed on the proto - if ($attrExt->{"v8OnProto"}) { + if ($attrExt->{"V8OnProto"}) { $on_proto = "1 /* on proto */"; } @@ -2051,9 +2047,9 @@ sub GenerateImplementationIndexer my $indexer = shift; my $interfaceName = $dataNode->name; - # FIXME: Figure out what HasNumericIndexGetter is really supposed to do. Right now, it's only set on WebGL-related files. - my $hasCustomSetter = $dataNode->extendedAttributes->{"HasCustomIndexSetter"} && !$dataNode->extendedAttributes->{"HasNumericIndexGetter"}; - my $hasGetter = $dataNode->extendedAttributes->{"HasIndexGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + # FIXME: Figure out what NumericIndexedGetter is really supposed to do. Right now, it's only set on WebGL-related files. + my $hasCustomSetter = $dataNode->extendedAttributes->{"CustomIndexedSetter"} && !$dataNode->extendedAttributes->{"NumericIndexedGetter"}; + my $hasGetter = $dataNode->extendedAttributes->{"IndexedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; # FIXME: Find a way to not have to special-case HTMLOptionsCollection. if ($interfaceName eq "HTMLOptionsCollection") { @@ -2066,7 +2062,7 @@ sub GenerateImplementationIndexer my $isSpecialCase = exists $indexerSpecialCases{$interfaceName}; if ($isSpecialCase) { $hasGetter = 1; - if ($dataNode->extendedAttributes->{"DelegatingPutFunction"}) { + if ($dataNode->extendedAttributes->{"CustomNamedSetter"}) { $hasCustomSetter = 1; } } @@ -2137,24 +2133,24 @@ sub GenerateImplementationNamedPropertyGetter my $dataNode = shift; my $namedPropertyGetter = shift; my $interfaceName = $dataNode->name; - my $hasCustomGetter = $dataNode->extendedAttributes->{"HasOverridingNameGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; + my $hasCustomNamedGetter = $dataNode->extendedAttributes->{"CustomNamedGetter"} || $dataNode->extendedAttributes->{"CustomGetOwnPropertySlot"}; # FIXME: Remove hard-coded HTMLOptionsCollection reference by changing HTMLOptionsCollection to not inherit # from HTMLCollection per W3C spec (http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#HTMLOptionsCollection). if ($interfaceName eq "HTMLOptionsCollection") { $interfaceName = "HTMLCollection"; - $hasCustomGetter = 1; + $hasCustomNamedGetter = 1; } if ($interfaceName eq "HTMLAppletElement" || $interfaceName eq "HTMLEmbedElement" || $interfaceName eq "HTMLObjectElement") { - $hasCustomGetter = 1; + $hasCustomNamedGetter = 1; } if ($interfaceName eq "HTMLDocument") { - $hasCustomGetter = 0; + $hasCustomNamedGetter = 0; } - my $hasGetter = $dataNode->extendedAttributes->{"HasNameGetter"} || $hasCustomGetter; + my $hasGetter = $dataNode->extendedAttributes->{"NamedGetter"} || $hasCustomNamedGetter; if (!$hasGetter) { return; } @@ -2163,7 +2159,7 @@ sub GenerateImplementationNamedPropertyGetter $namedPropertyGetter = $codeGenerator->FindSuperMethod($dataNode, "namedItem"); } - if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"} && !$hasCustomGetter) { + if ($namedPropertyGetter && $namedPropertyGetter->type ne "Node" && !$namedPropertyGetter->extendedAttributes->{"Custom"} && !$hasCustomNamedGetter) { AddToImplIncludes("V8Collection.h"); my $type = $namedPropertyGetter->type; push(@implContent, <<END); @@ -2172,7 +2168,7 @@ END return; } - my $hasSetter = $dataNode->extendedAttributes->{"DelegatingPutFunction"}; + my $hasCustomNamedSetter = $dataNode->extendedAttributes->{"CustomNamedSetter"}; my $hasDeleter = $dataNode->extendedAttributes->{"CustomDeleteProperty"}; my $hasEnumerator = $dataNode->extendedAttributes->{"CustomGetPropertyNames"}; my $setOn = "Instance"; @@ -2188,7 +2184,7 @@ END } push(@implContent, " desc->${setOn}Template()->SetNamedPropertyHandler(V8${interfaceName}::namedPropertyGetter, "); - push(@implContent, $hasSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, "); + push(@implContent, $hasCustomNamedSetter ? "V8${interfaceName}::namedPropertySetter, " : "0, "); # If there is a custom enumerator, there MUST be custom query to properly communicate property attributes. push(@implContent, $hasEnumerator ? "V8${interfaceName}::namedPropertyQuery, " : "0, "); push(@implContent, $hasDeleter ? "V8${interfaceName}::namedPropertyDeleter, " : "0, "); @@ -2270,7 +2266,6 @@ sub GenerateImplementation push(@implContentDecls, "template <typename T> void V8_USE(T) { }\n\n"); my $hasConstructors = 0; - my $serializedAttribute; # Generate property accessors for attributes. for (my $index = 0; $index < @{$dataNode->attributes}; $index++) { my $attribute = @{$dataNode->attributes}[$index]; @@ -2286,16 +2281,11 @@ sub GenerateImplementation } if ($attrType eq "EventListener" && $interfaceName eq "DOMWindow") { - $attribute->signature->extendedAttributes->{"v8OnProto"} = 1; + $attribute->signature->extendedAttributes->{"V8OnProto"} = 1; } - # Attributes of type SerializedScriptValue are set in the - # constructor and don't require callbacks. if ($attrType eq "SerializedScriptValue") { - die "Only one attribute of type SerializedScriptValue supported" if $serializedAttribute; AddToImplIncludes("SerializedScriptValue.h"); - $serializedAttribute = $attribute; - next; } # Do not generate accessor if this is a custom attribute. The @@ -2321,7 +2311,7 @@ sub GenerateImplementation } if ($hasConstructors) { - GenerateConstructorGetter($implClassName); + GenerateConstructorGetter($dataNode, $implClassName); } my $indexer; @@ -2367,7 +2357,7 @@ sub GenerateImplementation if ($interfaceName eq "DOMWindow" && $attribute->signature->extendedAttributes->{"V8Unforgeable"}) { push(@disallowsShadowing, $attribute); - } elsif ($attribute->signature->extendedAttributes->{"EnabledAtRuntime"}) { + } elsif ($attribute->signature->extendedAttributes->{"V8EnabledAtRuntime"}) { push(@enabledAtRuntime, $attribute); } else { push(@normal, $attribute); @@ -2382,7 +2372,7 @@ sub GenerateImplementation } my $has_attributes = 0; - if (@$attributes && (@$attributes > 1 || $$attributes[0]->signature->type ne "SerializedScriptValue")) { + if (@$attributes) { $has_attributes = 1; push(@implContent, "static const BatchedAttribute ${interfaceName}Attrs[] = {\n"); GenerateBatchedAttributeData($dataNode, $attributes); @@ -2404,14 +2394,14 @@ sub GenerateImplementation if ($function->isStatic) { next; } - if ($attrExt->{"EnabledAtRuntime"} || RequiresCustomSignature($function) || $attrExt->{"V8DoNotCheckSignature"}) { + if ($attrExt->{"V8EnabledAtRuntime"} || RequiresCustomSignature($function) || $attrExt->{"V8DoNotCheckSignature"}) { next; } if ($attrExt->{"DoNotCheckDomainSecurity"} && ($dataNode->extendedAttributes->{"CheckDomainSecurity"} || $interfaceName eq "DOMWindow")) { next; } - if ($attrExt->{"DontEnum"} || $attrExt->{"V8ReadOnly"}) { + if ($attrExt->{"NotEnumerable"} || $attrExt->{"V8ReadOnly"}) { next; } if (!$has_callbacks) { @@ -2442,7 +2432,7 @@ END my $value = $constant->value; my $attrExt = $constant->extendedAttributes; my $conditional = $attrExt->{"Conditional"}; - if ($attrExt->{"EnabledAtRuntime"}) { + if ($attrExt->{"V8EnabledAtRuntime"}) { push(@constantsEnabledAtRuntime, $constant); } else { # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl @@ -2466,9 +2456,9 @@ END push(@implContentDecls, "} // namespace ${interfaceName}Internal\n\n"); if ($dataNode->extendedAttributes->{"NamedConstructor"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { - GenerateNamedConstructorCallback($dataNode->constructor, $dataNode, $interfaceName, $serializedAttribute); + GenerateNamedConstructorCallback($dataNode->constructor, $dataNode, $interfaceName); } elsif ($dataNode->extendedAttributes->{"Constructor"} && !($dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CustomConstructor"})) { - GenerateConstructorCallback($dataNode->constructor, $dataNode, $interfaceName, $serializedAttribute); + GenerateConstructorCallback($dataNode->constructor, $dataNode, $interfaceName); } elsif (IsConstructorTemplate($dataNode, "Event")) { GenerateEventConstructorCallback($dataNode, $interfaceName); } @@ -2506,7 +2496,7 @@ static v8::Persistent<v8::FunctionTemplate> Configure${className}Template(v8::Pe v8::Local<v8::Signature> defaultSignature; END - if ($dataNode->extendedAttributes->{"EnabledAtRuntime"}) { + if ($dataNode->extendedAttributes->{"V8EnabledAtRuntime"}) { my $enable_function = GetRuntimeEnableFunctionName($dataNode); push(@implContent, <<END); if (!${enable_function}()) @@ -2607,7 +2597,7 @@ END my $name = $function->signature->name; my $property_attributes = "v8::DontDelete"; - if ($attrExt->{"DontEnum"}) { + if ($attrExt->{"NotEnumerable"}) { $property_attributes .= " | v8::DontEnum"; } if ($attrExt->{"V8ReadOnly"}) { @@ -2625,7 +2615,7 @@ END } my $conditional = ""; - if ($attrExt->{"EnabledAtRuntime"}) { + if ($attrExt->{"V8EnabledAtRuntime"}) { # Only call Set()/SetAccessor() if this method should be enabled my $enable_function = GetRuntimeEnableFunctionName($function->signature); $conditional = "if (${enable_function}())\n "; @@ -2797,7 +2787,7 @@ v8::Persistent<v8::ObjectTemplate> V8DOMWindow::GetShadowObjectTemplate() END } - GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType, $serializedAttribute); + GenerateToV8Converters($dataNode, $interfaceName, $className, $nativeType); push(@implContent, <<END); @@ -3029,7 +3019,6 @@ sub GenerateToV8Converters my $interfaceName = shift; my $className = shift; my $nativeType = shift; - my $serializedAttribute = shift; my $domMapFunction = GetDomMapFunction($dataNode, $interfaceName); my $forceNewObjectInput = IsDOMNodeType($interfaceName) ? ", bool forceNewObject" : ""; @@ -3101,10 +3090,6 @@ END END push(@implContent, "\n impl->ref();\n") if IsRefPtrType($interfaceName); - if ($serializedAttribute) { - GenerateEagerDeserialization($serializedAttribute); - } - push(@implContent, <<END); v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); @@ -3134,14 +3119,11 @@ sub HasCustomToV8Implementation { # We generate a custom converter (but JSC doesn't) for the following: return 1 if $interfaceName eq "CSSStyleSheet"; return 1 if $interfaceName eq "CanvasPixelArray"; - return 1 if $interfaceName eq "DOMStringMap"; return 1 if $interfaceName eq "DOMWindow"; - return 1 if $interfaceName eq "DOMTokenList"; return 1 if $interfaceName eq "Element"; return 1 if $interfaceName eq "HTMLDocument"; return 1 if $interfaceName eq "HTMLElement"; return 1 if $interfaceName eq "Location"; - return 1 if $interfaceName eq "NamedNodeMap"; return 1 if $interfaceName eq "SVGDocument"; return 1 if $interfaceName eq "SVGElement"; return 1 if $interfaceName eq "ScriptProfile"; @@ -3157,12 +3139,10 @@ sub HasCustomToV8Implementation { return 0 if $interfaceName eq "MediaList"; return 0 if $interfaceName eq "StyleSheetList"; return 0 if $interfaceName eq "DOMImplementation"; - return 0 if $interfaceName eq "DOMStringMap"; - return 0 if $interfaceName eq "DOMTokenList"; return 0 if $interfaceName eq "TextTrack"; # For everything else, do what JSC does. - return $dataNode->extendedAttributes->{"CustomToJS"}; + return $dataNode->extendedAttributes->{"JSCustomToJS"}; } sub GetDomMapFunction @@ -3200,8 +3180,8 @@ sub GenerateFunctionCallString() my $isSVGTearOffType = ($codeGenerator->IsSVGTypeNeedingTearOff($returnType) and not $implClassName =~ /List$/); $nativeReturnType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTearOffType; - if ($function->signature->extendedAttributes->{"ImplementationFunction"}) { - $name = $function->signature->extendedAttributes->{"ImplementationFunction"}; + if ($function->signature->extendedAttributes->{"ImplementedAs"}) { + $name = $function->signature->extendedAttributes->{"ImplementedAs"}; } my $index = 0; @@ -3332,12 +3312,15 @@ sub GetNativeTypeFromSignature $type = GetNativeType($type, $parameterIndex >= 0 ? 1 : 0); if ($parameterIndex >= 0 && $type eq "V8Parameter") { + # FIXME: This implements [TreatNullAs=NullString] and [TreatUndefinedAs=NullString], + # but the Web IDL spec requires [TreatNullAs=EmptyString] and [TreatUndefinedAs=EmptyString]. my $mode = ""; - if ($signature->extendedAttributes->{"ConvertUndefinedOrNullToNullString"}) { + if (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "NullString") and ($signature->extendedAttributes->{"TreatUndefinedAs"} and $signature->extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) { $mode = "WithUndefinedOrNullCheck"; - } elsif (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "EmptyString") or $signature->extendedAttributes->{"Reflect"}) { + } elsif (($signature->extendedAttributes->{"TreatNullAs"} and $signature->extendedAttributes->{"TreatNullAs"} eq "NullString") or $signature->extendedAttributes->{"Reflect"}) { $mode = "WithNullCheck"; } + # FIXME: Add the case for 'elsif ($signature->extendedAttributes->{"TreatUndefinedAs"} and $signature->extendedAttributes->{"TreatUndefinedAs"} eq "NullString"))'. $type .= "<$mode>"; } @@ -3490,7 +3473,10 @@ sub JSValueToNative return $value; } - die "Unexpected SerializedScriptValue" if $type eq "SerializedScriptValue"; + if ($type eq "SerializedScriptValue") { + AddToImplIncludes("SerializedScriptValue.h"); + return "SerializedScriptValue::create($value)"; + } if ($type eq "IDBKey") { AddToImplIncludes("IDBBindingUtilities.h"); @@ -3748,7 +3734,7 @@ sub NativeToJSValue # special case for non-DOM node interfaces if (IsDOMNodeType($type)) { - return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnsNew"} ? ", true)" : ")"); + return "toV8(${value}" . ($signature->extendedAttributes->{"ReturnNewObject"} ? ", true)" : ")"); } if ($type eq "EventTarget") { @@ -3762,7 +3748,7 @@ sub NativeToJSValue if ($type eq "SerializedScriptValue") { AddToImplIncludes("$type.h"); - return "$value->deserialize()"; + return "$value ? $value->deserialize() : v8::Handle<v8::Value>(v8::Null())"; } AddToImplIncludes("wtf/RefCounted.h"); @@ -3880,8 +3866,8 @@ sub GetRuntimeEnableFunctionName { my $signature = shift; - # If a parameter is given (e.g. "EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::{FeatureName}Enabled() method. - return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->extendedAttributes->{"EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAttributes->{"EnabledAtRuntime"} && $signature->extendedAttributes->{"EnabledAtRuntime"} ne "1"); + # If a parameter is given (e.g. "V8EnabledAtRuntime=FeatureName") return the RuntimeEnabledFeatures::{FeatureName}Enabled() method. + return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->extendedAttributes->{"V8EnabledAtRuntime"}) . "Enabled" if ($signature->extendedAttributes->{"V8EnabledAtRuntime"} && $signature->extendedAttributes->{"V8EnabledAtRuntime"} ne "1"); # Otherwise return a function named RuntimeEnabledFeatures::{methodName}Enabled(). return "RuntimeEnabledFeatures::" . $codeGenerator->WK_lcfirst($signature->name) . "Enabled"; diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.cpp index 4410331c7..1769cdd6e 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.cpp @@ -19,62 +19,62 @@ */ #include "config.h" -#include "WebDOMTestOverridingNameGetter.h" +#include "WebDOMTestCustomNamedGetter.h" #include "KURL.h" -#include "TestOverridingNameGetter.h" +#include "TestCustomNamedGetter.h" #include "WebDOMString.h" #include "WebExceptionHandler.h" #include "wtf/text/AtomicString.h" #include <wtf/GetPtr.h> #include <wtf/RefPtr.h> -struct WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetterPrivate { - WebDOMTestOverridingNameGetterPrivate(WebCore::TestOverridingNameGetter* object = 0) +struct WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetterPrivate { + WebDOMTestCustomNamedGetterPrivate(WebCore::TestCustomNamedGetter* object = 0) : impl(object) { } - RefPtr<WebCore::TestOverridingNameGetter> impl; + RefPtr<WebCore::TestCustomNamedGetter> impl; }; -WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter() +WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetter() : WebDOMObject() , m_impl(0) { } -WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter(WebCore::TestOverridingNameGetter* impl) +WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetter(WebCore::TestCustomNamedGetter* impl) : WebDOMObject() - , m_impl(new WebDOMTestOverridingNameGetterPrivate(impl)) + , m_impl(new WebDOMTestCustomNamedGetterPrivate(impl)) { } -WebDOMTestOverridingNameGetter::WebDOMTestOverridingNameGetter(const WebDOMTestOverridingNameGetter& copy) +WebDOMTestCustomNamedGetter::WebDOMTestCustomNamedGetter(const WebDOMTestCustomNamedGetter& copy) : WebDOMObject() { - m_impl = copy.impl() ? new WebDOMTestOverridingNameGetterPrivate(copy.impl()) : 0; + m_impl = copy.impl() ? new WebDOMTestCustomNamedGetterPrivate(copy.impl()) : 0; } -WebDOMTestOverridingNameGetter& WebDOMTestOverridingNameGetter::operator=(const WebDOMTestOverridingNameGetter& copy) +WebDOMTestCustomNamedGetter& WebDOMTestCustomNamedGetter::operator=(const WebDOMTestCustomNamedGetter& copy) { delete m_impl; - m_impl = copy.impl() ? new WebDOMTestOverridingNameGetterPrivate(copy.impl()) : 0; + m_impl = copy.impl() ? new WebDOMTestCustomNamedGetterPrivate(copy.impl()) : 0; return *this; } -WebCore::TestOverridingNameGetter* WebDOMTestOverridingNameGetter::impl() const +WebCore::TestCustomNamedGetter* WebDOMTestCustomNamedGetter::impl() const { return m_impl ? WTF::getPtr(m_impl->impl) : 0; } -WebDOMTestOverridingNameGetter::~WebDOMTestOverridingNameGetter() +WebDOMTestCustomNamedGetter::~WebDOMTestCustomNamedGetter() { delete m_impl; m_impl = 0; } -void WebDOMTestOverridingNameGetter::anotherFunction(const WebDOMString& str) +void WebDOMTestCustomNamedGetter::anotherFunction(const WebDOMString& str) { if (!impl()) return; @@ -82,12 +82,12 @@ void WebDOMTestOverridingNameGetter::anotherFunction(const WebDOMString& str) impl()->anotherFunction(str); } -WebCore::TestOverridingNameGetter* toWebCore(const WebDOMTestOverridingNameGetter& wrapper) +WebCore::TestCustomNamedGetter* toWebCore(const WebDOMTestCustomNamedGetter& wrapper) { return wrapper.impl(); } -WebDOMTestOverridingNameGetter toWebKit(WebCore::TestOverridingNameGetter* value) +WebDOMTestCustomNamedGetter toWebKit(WebCore::TestCustomNamedGetter* value) { - return WebDOMTestOverridingNameGetter(value); + return WebDOMTestCustomNamedGetter(value); } diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.h index a6c681ef7..f1a2d68c1 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestOverridingNameGetter.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCustomNamedGetter.h @@ -20,35 +20,35 @@ * Boston, MA 02110-1301, USA. */ -#ifndef WebDOMTestOverridingNameGetter_h -#define WebDOMTestOverridingNameGetter_h +#ifndef WebDOMTestCustomNamedGetter_h +#define WebDOMTestCustomNamedGetter_h #include <WebDOMObject.h> #include <WebDOMString.h> namespace WebCore { -class TestOverridingNameGetter; +class TestCustomNamedGetter; }; -class WebDOMTestOverridingNameGetter : public WebDOMObject { +class WebDOMTestCustomNamedGetter : public WebDOMObject { public: - WebDOMTestOverridingNameGetter(); - explicit WebDOMTestOverridingNameGetter(WebCore::TestOverridingNameGetter*); - WebDOMTestOverridingNameGetter(const WebDOMTestOverridingNameGetter&); - WebDOMTestOverridingNameGetter& operator=(const WebDOMTestOverridingNameGetter&); - virtual ~WebDOMTestOverridingNameGetter(); + WebDOMTestCustomNamedGetter(); + explicit WebDOMTestCustomNamedGetter(WebCore::TestCustomNamedGetter*); + WebDOMTestCustomNamedGetter(const WebDOMTestCustomNamedGetter&); + WebDOMTestCustomNamedGetter& operator=(const WebDOMTestCustomNamedGetter&); + virtual ~WebDOMTestCustomNamedGetter(); void anotherFunction(const WebDOMString& str); - WebCore::TestOverridingNameGetter* impl() const; + WebCore::TestCustomNamedGetter* impl() const; protected: - struct WebDOMTestOverridingNameGetterPrivate; - WebDOMTestOverridingNameGetterPrivate* m_impl; + struct WebDOMTestCustomNamedGetterPrivate; + WebDOMTestCustomNamedGetterPrivate* m_impl; }; -WebCore::TestOverridingNameGetter* toWebCore(const WebDOMTestOverridingNameGetter&); -WebDOMTestOverridingNameGetter toWebKit(WebCore::TestOverridingNameGetter*); +WebCore::TestCustomNamedGetter* toWebCore(const WebDOMTestCustomNamedGetter&); +WebDOMTestCustomNamedGetter toWebKit(WebCore::TestCustomNamedGetter*); #endif diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp index edae8ad3c..541546450 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.cpp @@ -83,6 +83,46 @@ WebDOMString WebDOMTestSerializedScriptValueInterface::value() const return impl()->value()->toString(); } +void WebDOMTestSerializedScriptValueInterface::setValue(const WebDOMString& newValue) +{ + if (!impl()) + return; + + impl()->setValue(WebCore::SerializedScriptValue::create(WTF::String(newValue))); +} + +WebDOMString WebDOMTestSerializedScriptValueInterface::readonlyValue() const +{ + if (!impl()) + return WebDOMString(); + + return impl()->readonlyValue()->toString(); +} + +WebDOMString WebDOMTestSerializedScriptValueInterface::cachedValue() const +{ + if (!impl()) + return WebDOMString(); + + return impl()->cachedValue()->toString(); +} + +void WebDOMTestSerializedScriptValueInterface::setCachedValue(const WebDOMString& newCachedValue) +{ + if (!impl()) + return; + + impl()->setCachedValue(WebCore::SerializedScriptValue::create(WTF::String(newCachedValue))); +} + +WebDOMString WebDOMTestSerializedScriptValueInterface::cachedReadonlyValue() const +{ + if (!impl()) + return WebDOMString(); + + return impl()->cachedReadonlyValue()->toString(); +} + WebCore::TestSerializedScriptValueInterface* toWebCore(const WebDOMTestSerializedScriptValueInterface& wrapper) { return wrapper.impl(); diff --git a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h index f0daf552b..d03b75e6a 100644 --- a/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h +++ b/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestSerializedScriptValueInterface.h @@ -43,6 +43,11 @@ public: virtual ~WebDOMTestSerializedScriptValueInterface(); WebDOMString value() const; + void setValue(const WebDOMString&); + WebDOMString readonlyValue() const; + WebDOMString cachedValue() const; + void setCachedValue(const WebDOMString&); + WebDOMString cachedReadonlyValue() const; WebCore::TestSerializedScriptValueInterface* impl() const; diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.cpp index 2f76ae1bb..ea648f564 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.cpp @@ -26,50 +26,50 @@ #include "DOMObjectCache.h" #include "ExceptionCode.h" #include "JSMainThreadExecState.h" -#include "TestOverridingNameGetter.h" +#include "TestCustomNamedGetter.h" #include "WebKitDOMBinding.h" #include "gobject/ConvertToUTF8String.h" -#include "webkit/WebKitDOMTestOverridingNameGetter.h" -#include "webkit/WebKitDOMTestOverridingNameGetterPrivate.h" +#include "webkit/WebKitDOMTestCustomNamedGetter.h" +#include "webkit/WebKitDOMTestCustomNamedGetterPrivate.h" #include "webkitdefines.h" #include "webkitglobalsprivate.h" #include "webkitmarshal.h" namespace WebKit { -WebKitDOMTestOverridingNameGetter* kit(WebCore::TestOverridingNameGetter* obj) +WebKitDOMTestCustomNamedGetter* kit(WebCore::TestCustomNamedGetter* obj) { g_return_val_if_fail(obj, 0); if (gpointer ret = DOMObjectCache::get(obj)) - return static_cast<WebKitDOMTestOverridingNameGetter*>(ret); + return static_cast<WebKitDOMTestCustomNamedGetter*>(ret); - return static_cast<WebKitDOMTestOverridingNameGetter*>(DOMObjectCache::put(obj, WebKit::wrapTestOverridingNameGetter(obj))); + return static_cast<WebKitDOMTestCustomNamedGetter*>(DOMObjectCache::put(obj, WebKit::wrapTestCustomNamedGetter(obj))); } } // namespace WebKit // void -webkit_dom_test_overriding_name_getter_another_function(WebKitDOMTestOverridingNameGetter* self, const gchar* str) +webkit_dom_test_custom_named_getter_another_function(WebKitDOMTestCustomNamedGetter* self, const gchar* str) { g_return_if_fail(self); WebCore::JSMainThreadNullState state; - WebCore::TestOverridingNameGetter * item = WebKit::core(self); + WebCore::TestCustomNamedGetter * item = WebKit::core(self); g_return_if_fail(str); WTF::String converted_str = WTF::String::fromUTF8(str); item->anotherFunction(converted_str); } -G_DEFINE_TYPE(WebKitDOMTestOverridingNameGetter, webkit_dom_test_overriding_name_getter, WEBKIT_TYPE_DOM_OBJECT) +G_DEFINE_TYPE(WebKitDOMTestCustomNamedGetter, webkit_dom_test_custom_named_getter, WEBKIT_TYPE_DOM_OBJECT) namespace WebKit { -WebCore::TestOverridingNameGetter* core(WebKitDOMTestOverridingNameGetter* request) +WebCore::TestCustomNamedGetter* core(WebKitDOMTestCustomNamedGetter* request) { g_return_val_if_fail(request, 0); - WebCore::TestOverridingNameGetter* coreObject = static_cast<WebCore::TestOverridingNameGetter*>(WEBKIT_DOM_OBJECT(request)->coreObject); + WebCore::TestCustomNamedGetter* coreObject = static_cast<WebCore::TestCustomNamedGetter*>(WEBKIT_DOM_OBJECT(request)->coreObject); g_return_val_if_fail(coreObject, 0); return coreObject; @@ -81,12 +81,12 @@ enum { }; -static void webkit_dom_test_overriding_name_getter_finalize(GObject* object) +static void webkit_dom_test_custom_named_getter_finalize(GObject* object) { WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object); if (dom_object->coreObject) { - WebCore::TestOverridingNameGetter* coreObject = static_cast<WebCore::TestOverridingNameGetter *>(dom_object->coreObject); + WebCore::TestCustomNamedGetter* coreObject = static_cast<WebCore::TestCustomNamedGetter *>(dom_object->coreObject); WebKit::DOMObjectCache::forget(coreObject); coreObject->deref(); @@ -94,10 +94,10 @@ static void webkit_dom_test_overriding_name_getter_finalize(GObject* object) dom_object->coreObject = NULL; } - G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->finalize(object); + G_OBJECT_CLASS(webkit_dom_test_custom_named_getter_parent_class)->finalize(object); } -static void webkit_dom_test_overriding_name_getter_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +static void webkit_dom_test_custom_named_getter_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) { WebCore::JSMainThreadNullState state; switch (prop_id) { @@ -108,7 +108,7 @@ static void webkit_dom_test_overriding_name_getter_set_property(GObject* object, } -static void webkit_dom_test_overriding_name_getter_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +static void webkit_dom_test_custom_named_getter_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { WebCore::JSMainThreadNullState state; switch (prop_id) { @@ -119,31 +119,31 @@ static void webkit_dom_test_overriding_name_getter_get_property(GObject* object, } -static void webkit_dom_test_overriding_name_getter_constructed(GObject* object) +static void webkit_dom_test_custom_named_getter_constructed(GObject* object) { - if (G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->constructed) - G_OBJECT_CLASS(webkit_dom_test_overriding_name_getter_parent_class)->constructed(object); + if (G_OBJECT_CLASS(webkit_dom_test_custom_named_getter_parent_class)->constructed) + G_OBJECT_CLASS(webkit_dom_test_custom_named_getter_parent_class)->constructed(object); } -static void webkit_dom_test_overriding_name_getter_class_init(WebKitDOMTestOverridingNameGetterClass* requestClass) +static void webkit_dom_test_custom_named_getter_class_init(WebKitDOMTestCustomNamedGetterClass* requestClass) { GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass); - gobjectClass->finalize = webkit_dom_test_overriding_name_getter_finalize; - gobjectClass->set_property = webkit_dom_test_overriding_name_getter_set_property; - gobjectClass->get_property = webkit_dom_test_overriding_name_getter_get_property; - gobjectClass->constructed = webkit_dom_test_overriding_name_getter_constructed; + gobjectClass->finalize = webkit_dom_test_custom_named_getter_finalize; + gobjectClass->set_property = webkit_dom_test_custom_named_getter_set_property; + gobjectClass->get_property = webkit_dom_test_custom_named_getter_get_property; + gobjectClass->constructed = webkit_dom_test_custom_named_getter_constructed; } -static void webkit_dom_test_overriding_name_getter_init(WebKitDOMTestOverridingNameGetter* request) +static void webkit_dom_test_custom_named_getter_init(WebKitDOMTestCustomNamedGetter* request) { } namespace WebKit { -WebKitDOMTestOverridingNameGetter* wrapTestOverridingNameGetter(WebCore::TestOverridingNameGetter* coreObject) +WebKitDOMTestCustomNamedGetter* wrapTestCustomNamedGetter(WebCore::TestCustomNamedGetter* coreObject) { g_return_val_if_fail(coreObject, 0); @@ -153,7 +153,7 @@ WebKitDOMTestOverridingNameGetter* wrapTestOverridingNameGetter(WebCore::TestOve */ coreObject->ref(); - return WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER(g_object_new(WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, + return WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER(g_object_new(WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER, "core-object", coreObject, NULL)); } } // namespace WebKit diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.h new file mode 100644 index 000000000..956a254aa --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetter.h @@ -0,0 +1,62 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifndef WebKitDOMTestCustomNamedGetter_h +#define WebKitDOMTestCustomNamedGetter_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> +#include "webkit/WebKitDOMObject.h" + + +G_BEGIN_DECLS +#define WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER (webkit_dom_test_custom_named_getter_get_type()) +#define WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER, WebKitDOMTestCustomNamedGetter)) +#define WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER, WebKitDOMTestCustomNamedGetterClass) +#define WEBKIT_DOM_IS_TEST_CUSTOM_NAMED_GETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER)) +#define WEBKIT_DOM_IS_TEST_CUSTOM_NAMED_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER)) +#define WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_CUSTOM_NAMED_GETTER, WebKitDOMTestCustomNamedGetterClass)) + +struct _WebKitDOMTestCustomNamedGetter { + WebKitDOMObject parent_instance; +}; + +struct _WebKitDOMTestCustomNamedGetterClass { + WebKitDOMObjectClass parent_class; +}; + +WEBKIT_API GType +webkit_dom_test_custom_named_getter_get_type (void); + +/** + * webkit_dom_test_custom_named_getter_another_function: + * @self: A #WebKitDOMTestCustomNamedGetter + * @str: A #gchar + * + * Returns: + * +**/ +WEBKIT_API void +webkit_dom_test_custom_named_getter_another_function(WebKitDOMTestCustomNamedGetter* self, const gchar* str); + +G_END_DECLS + +#endif /* WebKitDOMTestCustomNamedGetter_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetterPrivate.h index 174e3c670..fedd14afc 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetterPrivate.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCustomNamedGetterPrivate.h @@ -18,22 +18,22 @@ Boston, MA 02110-1301, USA. */ -#ifndef WEB_KIT_DOM_TEST_OVERRIDING_NAME_GETTER_PRIVATE_H -#define WEB_KIT_DOM_TEST_OVERRIDING_NAME_GETTER_PRIVATE_H +#ifndef WEB_KIT_DOM_TEST_CUSTOM_NAMED_GETTER_PRIVATE_H +#define WEB_KIT_DOM_TEST_CUSTOM_NAMED_GETTER_PRIVATE_H #include <glib-object.h> #include <webkit/WebKitDOMObject.h> -#include "TestOverridingNameGetter.h" +#include "TestCustomNamedGetter.h" namespace WebKit { - WebKitDOMTestOverridingNameGetter * - wrapTestOverridingNameGetter(WebCore::TestOverridingNameGetter *coreObject); + WebKitDOMTestCustomNamedGetter * + wrapTestCustomNamedGetter(WebCore::TestCustomNamedGetter *coreObject); - WebCore::TestOverridingNameGetter * - core(WebKitDOMTestOverridingNameGetter *request); + WebCore::TestCustomNamedGetter * + core(WebKitDOMTestCustomNamedGetter *request); - WebKitDOMTestOverridingNameGetter* - kit(WebCore::TestOverridingNameGetter* node); + WebKitDOMTestCustomNamedGetter* + kit(WebCore::TestCustomNamedGetter* node); } // namespace WebKit -#endif /* WEB_KIT_DOM_TEST_OVERRIDING_NAME_GETTER_PRIVATE_H */ +#endif /* WEB_KIT_DOM_TEST_CUSTOM_NAMED_GETTER_PRIVATE_H */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp index 63a37b67b..5f9f95f44 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp @@ -1406,7 +1406,6 @@ enum { PROP_ATTR_WITH_SETTER_EXCEPTION, PROP_STRING_ATTR_WITH_GETTER_EXCEPTION, PROP_STRING_ATTR_WITH_SETTER_EXCEPTION, - PROP_CUSTOM_ATTR, PROP_WITH_SCRIPT_STATE_ATTRIBUTE, PROP_WITH_SCRIPT_EXECUTION_CONTEXT_ATTRIBUTE, PROP_WITH_SCRIPT_STATE_ATTRIBUTE_RAISES, diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h deleted file mode 100644 index 743432a5d..000000000 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestOverridingNameGetter.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - This file is part of the WebKit open source project. - This file has been generated by generate-bindings.pl. DO NOT MODIFY! - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef WebKitDOMTestOverridingNameGetter_h -#define WebKitDOMTestOverridingNameGetter_h - -#include "webkit/webkitdomdefines.h" -#include <glib-object.h> -#include <webkit/webkitdefines.h> -#include "webkit/WebKitDOMObject.h" - - -G_BEGIN_DECLS -#define WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER (webkit_dom_test_overriding_name_getter_get_type()) -#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetter)) -#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetterClass) -#define WEBKIT_DOM_IS_TEST_OVERRIDING_NAME_GETTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER)) -#define WEBKIT_DOM_IS_TEST_OVERRIDING_NAME_GETTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER)) -#define WEBKIT_DOM_TEST_OVERRIDING_NAME_GETTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_TEST_OVERRIDING_NAME_GETTER, WebKitDOMTestOverridingNameGetterClass)) - -struct _WebKitDOMTestOverridingNameGetter { - WebKitDOMObject parent_instance; -}; - -struct _WebKitDOMTestOverridingNameGetterClass { - WebKitDOMObjectClass parent_class; -}; - -WEBKIT_API GType -webkit_dom_test_overriding_name_getter_get_type (void); - -/** - * webkit_dom_test_overriding_name_getter_another_function: - * @self: A #WebKitDOMTestOverridingNameGetter - * @str: A #gchar - * - * Returns: - * -**/ -WEBKIT_API void -webkit_dom_test_overriding_name_getter_another_function(WebKitDOMTestOverridingNameGetter* self, const gchar* str); - -G_END_DECLS - -#endif /* WebKitDOMTestOverridingNameGetter_h */ diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp index 7592b0212..961c4b3a5 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp @@ -65,6 +65,69 @@ webkit_dom_test_serialized_script_value_interface_get_value(WebKitDOMTestSeriali return res; } +void +webkit_dom_test_serialized_script_value_interface_set_value(WebKitDOMTestSerializedScriptValueInterface* self, WebKitDOMSerializedScriptValue* value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::SerializedScriptValue * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + item->setValue(converted_value); +} + +WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_readonly_value(WebKitDOMTestSerializedScriptValueInterface* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + PassRefPtr<WebCore::SerializedScriptValue> g_res = WTF::getPtr(item->readonlyValue()); + WebKitDOMSerializedScriptValue* res = WebKit::kit(g_res.get()); + return res; +} + +WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_cached_value(WebKitDOMTestSerializedScriptValueInterface* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + PassRefPtr<WebCore::SerializedScriptValue> g_res = WTF::getPtr(item->cachedValue()); + WebKitDOMSerializedScriptValue* res = WebKit::kit(g_res.get()); + return res; +} + +void +webkit_dom_test_serialized_script_value_interface_set_cached_value(WebKitDOMTestSerializedScriptValueInterface* self, WebKitDOMSerializedScriptValue* value) +{ + g_return_if_fail(self); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + g_return_if_fail(value); + WebCore::SerializedScriptValue * converted_value = NULL; + if (value != NULL) { + converted_value = WebKit::core(value); + g_return_if_fail(converted_value); + } + item->setCachedValue(converted_value); +} + +WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value(WebKitDOMTestSerializedScriptValueInterface* self) +{ + g_return_val_if_fail(self, 0); + WebCore::JSMainThreadNullState state; + WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self); + PassRefPtr<WebCore::SerializedScriptValue> g_res = WTF::getPtr(item->cachedReadonlyValue()); + WebKitDOMSerializedScriptValue* res = WebKit::kit(g_res.get()); + return res; +} + G_DEFINE_TYPE(WebKitDOMTestSerializedScriptValueInterface, webkit_dom_test_serialized_script_value_interface, WEBKIT_TYPE_DOM_OBJECT) @@ -84,6 +147,9 @@ WebCore::TestSerializedScriptValueInterface* core(WebKitDOMTestSerializedScriptV enum { PROP_0, PROP_VALUE, + PROP_READONLY_VALUE, + PROP_CACHED_VALUE, + PROP_CACHED_READONLY_VALUE, }; @@ -126,6 +192,24 @@ static void webkit_dom_test_serialized_script_value_interface_get_property(GObje g_value_set_object(value, WebKit::kit(ptr.get())); break; } + case PROP_READONLY_VALUE: + { + RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->readonlyValue(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_CACHED_VALUE: + { + RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->cachedValue(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } + case PROP_CACHED_READONLY_VALUE: + { + RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->cachedReadonlyValue(); + g_value_set_object(value, WebKit::kit(ptr.get())); + break; + } default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -152,7 +236,28 @@ static void webkit_dom_test_serialized_script_value_interface_class_init(WebKitD PROP_VALUE, g_param_spec_object("value", /* name */ "test_serialized_script_value_interface_value", /* short description */ - "read-only WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.value", /* longer - could do with some extra doc stuff here */ + "read-write WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.value", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_READONLY_VALUE, + g_param_spec_object("readonly-value", /* name */ + "test_serialized_script_value_interface_readonly-value", /* short description */ + "read-only WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.readonly-value", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */ + WEBKIT_PARAM_READABLE)); + g_object_class_install_property(gobjectClass, + PROP_CACHED_VALUE, + g_param_spec_object("cached-value", /* name */ + "test_serialized_script_value_interface_cached-value", /* short description */ + "read-write WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.cached-value", /* longer - could do with some extra doc stuff here */ + WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */ + WEBKIT_PARAM_READWRITE)); + g_object_class_install_property(gobjectClass, + PROP_CACHED_READONLY_VALUE, + g_param_spec_object("cached-readonly-value", /* name */ + "test_serialized_script_value_interface_cached-readonly-value", /* short description */ + "read-only WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.cached-readonly-value", /* longer - could do with some extra doc stuff here */ WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */ WEBKIT_PARAM_READABLE)); diff --git a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h index 7e71262d7..516141859 100644 --- a/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h +++ b/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.h @@ -56,6 +56,58 @@ webkit_dom_test_serialized_script_value_interface_get_type (void); WEBKIT_API WebKitDOMSerializedScriptValue* webkit_dom_test_serialized_script_value_interface_get_value(WebKitDOMTestSerializedScriptValueInterface* self); +/** + * webkit_dom_test_serialized_script_value_interface_set_value: + * @self: A #WebKitDOMTestSerializedScriptValueInterface + * @value: A #WebKitDOMSerializedScriptValue + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_serialized_script_value_interface_set_value(WebKitDOMTestSerializedScriptValueInterface* self, WebKitDOMSerializedScriptValue* value); + +/** + * webkit_dom_test_serialized_script_value_interface_get_readonly_value: + * @self: A #WebKitDOMTestSerializedScriptValueInterface + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_readonly_value(WebKitDOMTestSerializedScriptValueInterface* self); + +/** + * webkit_dom_test_serialized_script_value_interface_get_cached_value: + * @self: A #WebKitDOMTestSerializedScriptValueInterface + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_cached_value(WebKitDOMTestSerializedScriptValueInterface* self); + +/** + * webkit_dom_test_serialized_script_value_interface_set_cached_value: + * @self: A #WebKitDOMTestSerializedScriptValueInterface + * @value: A #WebKitDOMSerializedScriptValue + * + * Returns: (transfer none): + * +**/ +WEBKIT_API void +webkit_dom_test_serialized_script_value_interface_set_cached_value(WebKitDOMTestSerializedScriptValueInterface* self, WebKitDOMSerializedScriptValue* value); + +/** + * webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value: + * @self: A #WebKitDOMTestSerializedScriptValueInterface + * + * Returns: (transfer none): + * +**/ +WEBKIT_API WebKitDOMSerializedScriptValue* +webkit_dom_test_serialized_script_value_interface_get_cached_readonly_value(WebKitDOMTestSerializedScriptValueInterface* self); + G_END_DECLS #endif /* WebKitDOMTestSerializedScriptValueInterface_h */ diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp index 488190ade..f886cdda7 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp @@ -144,7 +144,7 @@ bool JSTestActiveDOMObject::getOwnPropertyDescriptor(JSObject* object, ExecState { JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(object); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); - if (!allowAccessToFrame(exec, thisObject->impl()->frame())) + if (!shouldAllowAccessToFrame(exec, thisObject->impl()->frame())) return false; return getStaticValueDescriptor<JSTestActiveDOMObject, Base>(exec, &JSTestActiveDOMObjectTable, thisObject, propertyName, descriptor); } diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp new file mode 100644 index 000000000..fdf0fa192 --- /dev/null +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp @@ -0,0 +1,220 @@ +/* + This file is part of the WebKit open source project. + This file has been generated by generate-bindings.pl. DO NOT MODIFY! + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include "config.h" +#include "JSTestCustomNamedGetter.h" + +#include "ExceptionCode.h" +#include "JSDOMBinding.h" +#include "TestCustomNamedGetter.h" +#include "wtf/text/AtomicString.h" +#include <runtime/Error.h> +#include <wtf/GetPtr.h> + +using namespace JSC; + +namespace WebCore { + +ASSERT_CLASS_FITS_IN_CELL(JSTestCustomNamedGetter); +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestCustomNamedGetter); + +/* Hash table */ + +static const HashTableValue JSTestCustomNamedGetterTableValues[] = +{ + { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestCustomNamedGetterConstructor), (intptr_t)0, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestCustomNamedGetterTable = { 2, 1, JSTestCustomNamedGetterTableValues, 0 }; +/* Hash table for constructor */ + +static const HashTableValue JSTestCustomNamedGetterConstructorTableValues[] = +{ + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestCustomNamedGetterConstructorTable = { 1, 0, JSTestCustomNamedGetterConstructorTableValues, 0 }; +ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestCustomNamedGetterConstructor); + +const ClassInfo JSTestCustomNamedGetterConstructor::s_info = { "TestCustomNamedGetterConstructor", &Base::s_info, &JSTestCustomNamedGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterConstructor) }; + +JSTestCustomNamedGetterConstructor::JSTestCustomNamedGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject) + : DOMConstructorObject(structure, globalObject) +{ +} + +void JSTestCustomNamedGetterConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) +{ + Base::finishCreation(exec->globalData()); + ASSERT(inherits(&s_info)); + putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestCustomNamedGetterPrototype::self(exec, globalObject), DontDelete | ReadOnly); +} + +bool JSTestCustomNamedGetterConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return getStaticValueSlot<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, &JSTestCustomNamedGetterConstructorTable, static_cast<JSTestCustomNamedGetterConstructor*>(cell), propertyName, slot); +} + +bool JSTestCustomNamedGetterConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + return getStaticValueDescriptor<JSTestCustomNamedGetterConstructor, JSDOMWrapper>(exec, &JSTestCustomNamedGetterConstructorTable, static_cast<JSTestCustomNamedGetterConstructor*>(object), propertyName, descriptor); +} + +/* Hash table for prototype */ + +static const HashTableValue JSTestCustomNamedGetterPrototypeTableValues[] = +{ + { "anotherFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestCustomNamedGetterPrototypeFunctionAnotherFunction), (intptr_t)1, NoIntrinsic }, + { 0, 0, 0, 0, NoIntrinsic } +}; + +static const HashTable JSTestCustomNamedGetterPrototypeTable = { 2, 1, JSTestCustomNamedGetterPrototypeTableValues, 0 }; +const ClassInfo JSTestCustomNamedGetterPrototype::s_info = { "TestCustomNamedGetterPrototype", &Base::s_info, &JSTestCustomNamedGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestCustomNamedGetterPrototype) }; + +JSObject* JSTestCustomNamedGetterPrototype::self(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMPrototype<JSTestCustomNamedGetter>(exec, globalObject); +} + +bool JSTestCustomNamedGetterPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(cell); + return getStaticFunctionSlot<JSObject>(exec, &JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, slot); +} + +bool JSTestCustomNamedGetterPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestCustomNamedGetterPrototype* thisObject = jsCast<JSTestCustomNamedGetterPrototype*>(object); + return getStaticFunctionDescriptor<JSObject>(exec, &JSTestCustomNamedGetterPrototypeTable, thisObject, propertyName, descriptor); +} + +const ClassInfo JSTestCustomNamedGetter::s_info = { "TestCustomNamedGetter", &Base::s_info, &JSTestCustomNamedGetterTable, 0 , CREATE_METHOD_TABLE(JSTestCustomNamedGetter) }; + +JSTestCustomNamedGetter::JSTestCustomNamedGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestCustomNamedGetter> impl) + : JSDOMWrapper(structure, globalObject) + , m_impl(impl.leakRef()) +{ +} + +void JSTestCustomNamedGetter::finishCreation(JSGlobalData& globalData) +{ + Base::finishCreation(globalData); + ASSERT(inherits(&s_info)); +} + +JSObject* JSTestCustomNamedGetter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) +{ + return JSTestCustomNamedGetterPrototype::create(exec->globalData(), globalObject, JSTestCustomNamedGetterPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); +} + +void JSTestCustomNamedGetter::destroy(JSC::JSCell* cell) +{ + JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(cell); + thisObject->releaseImplIfNotNull(); +} + +bool JSTestCustomNamedGetter::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (canGetItemsForName(exec, static_cast<TestCustomNamedGetter*>(thisObject->impl()), propertyName)) { + slot.setCustom(thisObject, thisObject->nameGetter); + return true; + } + return getStaticValueSlot<JSTestCustomNamedGetter, Base>(exec, &JSTestCustomNamedGetterTable, thisObject, propertyName, slot); +} + +bool JSTestCustomNamedGetter::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) +{ + JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(object); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + if (canGetItemsForName(exec, static_cast<TestCustomNamedGetter*>(thisObject->impl()), propertyName)) { + PropertySlot slot; + slot.setCustom(thisObject, nameGetter); + descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); + return true; + } + return getStaticValueDescriptor<JSTestCustomNamedGetter, Base>(exec, &JSTestCustomNamedGetterTable, thisObject, propertyName, descriptor); +} + +JSValue jsTestCustomNamedGetterConstructor(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestCustomNamedGetter* domObject = static_cast<JSTestCustomNamedGetter*>(asObject(slotBase)); + return JSTestCustomNamedGetter::getConstructor(exec, domObject->globalObject()); +} + +JSValue JSTestCustomNamedGetter::getConstructor(ExecState* exec, JSGlobalObject* globalObject) +{ + return getDOMConstructor<JSTestCustomNamedGetterConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); +} + +EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(ExecState* exec) +{ + JSValue thisValue = exec->hostThisValue(); + if (!thisValue.inherits(&JSTestCustomNamedGetter::s_info)) + return throwVMTypeError(exec); + JSTestCustomNamedGetter* castedThis = static_cast<JSTestCustomNamedGetter*>(asObject(thisValue)); + ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestCustomNamedGetter::s_info); + TestCustomNamedGetter* impl = static_cast<TestCustomNamedGetter*>(castedThis->impl()); + if (exec->argumentCount() < 1) + return throwVMError(exec, createTypeError(exec, "Not enough arguments")); + const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); + if (exec->hadException()) + return JSValue::encode(jsUndefined()); + impl->anotherFunction(str); + return JSValue::encode(jsUndefined()); +} + +static inline bool isObservable(JSTestCustomNamedGetter* jsTestCustomNamedGetter) +{ + if (jsTestCustomNamedGetter->hasCustomProperties()) + return true; + return false; +} + +bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) +{ + JSTestCustomNamedGetter* jsTestCustomNamedGetter = static_cast<JSTestCustomNamedGetter*>(handle.get().asCell()); + if (!isObservable(jsTestCustomNamedGetter)) + return false; + UNUSED_PARAM(visitor); + return false; +} + +void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) +{ + JSTestCustomNamedGetter* jsTestCustomNamedGetter = static_cast<JSTestCustomNamedGetter*>(handle.get().asCell()); + DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); + uncacheWrapper(world, jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter); + jsTestCustomNamedGetter->releaseImpl(); +} + +JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestCustomNamedGetter* impl) +{ + return wrap<JSTestCustomNamedGetter>(exec, globalObject, impl); +} + +TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue value) +{ + return value.inherits(&JSTestCustomNamedGetter::s_info) ? static_cast<JSTestCustomNamedGetter*>(asObject(value))->impl() : 0; +} + +} diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h index 220bfd33c..f530c8b5c 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h @@ -18,23 +18,23 @@ Boston, MA 02110-1301, USA. */ -#ifndef JSTestOverridingNameGetter_h -#define JSTestOverridingNameGetter_h +#ifndef JSTestCustomNamedGetter_h +#define JSTestCustomNamedGetter_h #include "JSDOMBinding.h" -#include "TestOverridingNameGetter.h" +#include "TestCustomNamedGetter.h" #include <runtime/JSGlobalObject.h> #include <runtime/JSObject.h> #include <runtime/ObjectPrototype.h> namespace WebCore { -class JSTestOverridingNameGetter : public JSDOMWrapper { +class JSTestCustomNamedGetter : public JSDOMWrapper { public: typedef JSDOMWrapper Base; - static JSTestOverridingNameGetter* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverridingNameGetter> impl) + static JSTestCustomNamedGetter* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestCustomNamedGetter> impl) { - JSTestOverridingNameGetter* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetter>(globalObject->globalData().heap)) JSTestOverridingNameGetter(structure, globalObject, impl); + JSTestCustomNamedGetter* ptr = new (NotNull, JSC::allocateCell<JSTestCustomNamedGetter>(globalObject->globalData().heap)) JSTestCustomNamedGetter(structure, globalObject, impl); ptr->finishCreation(globalObject->globalData()); return ptr; } @@ -51,48 +51,48 @@ public: } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); - TestOverridingNameGetter* impl() const { return m_impl; } + TestCustomNamedGetter* impl() const { return m_impl; } void releaseImpl() { m_impl->deref(); m_impl = 0; } void releaseImplIfNotNull() { if (m_impl) { m_impl->deref(); m_impl = 0; } } private: - TestOverridingNameGetter* m_impl; + TestCustomNamedGetter* m_impl; protected: - JSTestOverridingNameGetter(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestOverridingNameGetter>); + JSTestCustomNamedGetter(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestCustomNamedGetter>); void finishCreation(JSC::JSGlobalData&); static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; private: - static bool canGetItemsForName(JSC::ExecState*, TestOverridingNameGetter*, const JSC::Identifier&); + static bool canGetItemsForName(JSC::ExecState*, TestCustomNamedGetter*, const JSC::Identifier&); static JSC::JSValue nameGetter(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); }; -class JSTestOverridingNameGetterOwner : public JSC::WeakHandleOwner { +class JSTestCustomNamedGetterOwner : public JSC::WeakHandleOwner { virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&); virtual void finalize(JSC::Handle<JSC::Unknown>, void* context); }; -inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, TestOverridingNameGetter*) +inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld*, TestCustomNamedGetter*) { - DEFINE_STATIC_LOCAL(JSTestOverridingNameGetterOwner, jsTestOverridingNameGetterOwner, ()); - return &jsTestOverridingNameGetterOwner; + DEFINE_STATIC_LOCAL(JSTestCustomNamedGetterOwner, jsTestCustomNamedGetterOwner, ()); + return &jsTestCustomNamedGetterOwner; } -inline void* wrapperContext(DOMWrapperWorld* world, TestOverridingNameGetter*) +inline void* wrapperContext(DOMWrapperWorld* world, TestCustomNamedGetter*) { return world; } -JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestOverridingNameGetter*); -TestOverridingNameGetter* toTestOverridingNameGetter(JSC::JSValue); +JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCustomNamedGetter*); +TestCustomNamedGetter* toTestCustomNamedGetter(JSC::JSValue); -class JSTestOverridingNameGetterPrototype : public JSC::JSNonFinalObject { +class JSTestCustomNamedGetterPrototype : public JSC::JSNonFinalObject { public: typedef JSC::JSNonFinalObject Base; static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*); - static JSTestOverridingNameGetterPrototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) + static JSTestCustomNamedGetterPrototype* create(JSC::JSGlobalData& globalData, JSC::JSGlobalObject* globalObject, JSC::Structure* structure) { - JSTestOverridingNameGetterPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetterPrototype>(globalData.heap)) JSTestOverridingNameGetterPrototype(globalData, globalObject, structure); + JSTestCustomNamedGetterPrototype* ptr = new (NotNull, JSC::allocateCell<JSTestCustomNamedGetterPrototype>(globalData.heap)) JSTestCustomNamedGetterPrototype(globalData, globalObject, structure); ptr->finishCreation(globalData); return ptr; } @@ -106,21 +106,21 @@ public: } private: - JSTestOverridingNameGetterPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } + JSTestCustomNamedGetterPrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } protected: static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; }; -class JSTestOverridingNameGetterConstructor : public DOMConstructorObject { +class JSTestCustomNamedGetterConstructor : public DOMConstructorObject { private: - JSTestOverridingNameGetterConstructor(JSC::Structure*, JSDOMGlobalObject*); + JSTestCustomNamedGetterConstructor(JSC::Structure*, JSDOMGlobalObject*); void finishCreation(JSC::ExecState*, JSDOMGlobalObject*); public: typedef DOMConstructorObject Base; - static JSTestOverridingNameGetterConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) + static JSTestCustomNamedGetterConstructor* create(JSC::ExecState* exec, JSC::Structure* structure, JSDOMGlobalObject* globalObject) { - JSTestOverridingNameGetterConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestOverridingNameGetterConstructor>(*exec->heap())) JSTestOverridingNameGetterConstructor(structure, globalObject); + JSTestCustomNamedGetterConstructor* ptr = new (NotNull, JSC::allocateCell<JSTestCustomNamedGetterConstructor>(*exec->heap())) JSTestCustomNamedGetterConstructor(structure, globalObject); ptr->finishCreation(exec, globalObject); return ptr; } @@ -138,10 +138,10 @@ protected: // Functions -JSC::EncodedJSValue JSC_HOST_CALL jsTestOverridingNameGetterPrototypeFunctionAnotherFunction(JSC::ExecState*); +JSC::EncodedJSValue JSC_HOST_CALL jsTestCustomNamedGetterPrototypeFunctionAnotherFunction(JSC::ExecState*); // Attributes -JSC::JSValue jsTestOverridingNameGetterConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestCustomNamedGetterConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 04c937f71..476d7250c 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -80,10 +80,10 @@ static const HashTableValue JSTestInterfaceConstructorTableValues[] = static const HashTable JSTestInterfaceConstructorTable = { 4, 3, JSTestInterfaceConstructorTableValues, 0 }; #if ENABLE(Condition11) || ENABLE(Condition12) -COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums); +COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants); #endif #if ENABLE(Condition11) || ENABLE(Condition12) -COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums); +COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDoNotCheckConstants); #endif ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestInterfaceConstructor); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 183227e2a..98e79b3e0 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -172,20 +172,20 @@ static const HashTableValue JSTestObjConstructorTableValues[] = static const HashTable JSTestObjConstructorTable = { 36, 31, JSTestObjConstructorTableValues, 0 }; #if ENABLE(Condition1) -COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDontCheckEnums); +COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants); #endif -COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums); -COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums); -COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums); -COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDontCheckEnums); -COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDontCheckEnums); -COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDontCheckEnums); -COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums); -COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDontCheckEnums); +COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants); ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestObjConstructor); @@ -762,7 +762,7 @@ JSValue jsTestObjContentDocument(ExecState* exec, JSValue slotBase, const Identi { JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); - return allowAccessToNode(exec, impl->contentDocument()) ? toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->contentDocument())) : jsUndefined(); + return shouldAllowAccessToNode(exec, impl->contentDocument()) ? toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->contentDocument())) : jsUndefined(); } @@ -1939,7 +1939,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionGetSVGDocument(ExecState* ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); ExceptionCode ec = 0; - if (!allowAccessToNode(exec, impl->getSVGDocument(ec))) + if (!shouldAllowAccessToNode(exec, impl->getSVGDocument(ec))) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->getSVGDocument(ec))); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp deleted file mode 100644 index ee8db1b84..000000000 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestOverridingNameGetter.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - This file is part of the WebKit open source project. - This file has been generated by generate-bindings.pl. DO NOT MODIFY! - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#include "config.h" -#include "JSTestOverridingNameGetter.h" - -#include "ExceptionCode.h" -#include "JSDOMBinding.h" -#include "TestOverridingNameGetter.h" -#include "wtf/text/AtomicString.h" -#include <runtime/Error.h> -#include <wtf/GetPtr.h> - -using namespace JSC; - -namespace WebCore { - -ASSERT_CLASS_FITS_IN_CELL(JSTestOverridingNameGetter); -ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestOverridingNameGetter); - -/* Hash table */ - -static const HashTableValue JSTestOverridingNameGetterTableValues[] = -{ - { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestOverridingNameGetterConstructor), (intptr_t)0, NoIntrinsic }, - { 0, 0, 0, 0, NoIntrinsic } -}; - -static const HashTable JSTestOverridingNameGetterTable = { 2, 1, JSTestOverridingNameGetterTableValues, 0 }; -/* Hash table for constructor */ - -static const HashTableValue JSTestOverridingNameGetterConstructorTableValues[] = -{ - { 0, 0, 0, 0, NoIntrinsic } -}; - -static const HashTable JSTestOverridingNameGetterConstructorTable = { 1, 0, JSTestOverridingNameGetterConstructorTableValues, 0 }; -ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestOverridingNameGetterConstructor); - -const ClassInfo JSTestOverridingNameGetterConstructor::s_info = { "TestOverridingNameGetterConstructor", &Base::s_info, &JSTestOverridingNameGetterConstructorTable, 0, CREATE_METHOD_TABLE(JSTestOverridingNameGetterConstructor) }; - -JSTestOverridingNameGetterConstructor::JSTestOverridingNameGetterConstructor(Structure* structure, JSDOMGlobalObject* globalObject) - : DOMConstructorObject(structure, globalObject) -{ -} - -void JSTestOverridingNameGetterConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject) -{ - Base::finishCreation(exec->globalData()); - ASSERT(inherits(&s_info)); - putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestOverridingNameGetterPrototype::self(exec, globalObject), DontDelete | ReadOnly); -} - -bool JSTestOverridingNameGetterConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - return getStaticValueSlot<JSTestOverridingNameGetterConstructor, JSDOMWrapper>(exec, &JSTestOverridingNameGetterConstructorTable, static_cast<JSTestOverridingNameGetterConstructor*>(cell), propertyName, slot); -} - -bool JSTestOverridingNameGetterConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - return getStaticValueDescriptor<JSTestOverridingNameGetterConstructor, JSDOMWrapper>(exec, &JSTestOverridingNameGetterConstructorTable, static_cast<JSTestOverridingNameGetterConstructor*>(object), propertyName, descriptor); -} - -/* Hash table for prototype */ - -static const HashTableValue JSTestOverridingNameGetterPrototypeTableValues[] = -{ - { "anotherFunction", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestOverridingNameGetterPrototypeFunctionAnotherFunction), (intptr_t)1, NoIntrinsic }, - { 0, 0, 0, 0, NoIntrinsic } -}; - -static const HashTable JSTestOverridingNameGetterPrototypeTable = { 2, 1, JSTestOverridingNameGetterPrototypeTableValues, 0 }; -const ClassInfo JSTestOverridingNameGetterPrototype::s_info = { "TestOverridingNameGetterPrototype", &Base::s_info, &JSTestOverridingNameGetterPrototypeTable, 0, CREATE_METHOD_TABLE(JSTestOverridingNameGetterPrototype) }; - -JSObject* JSTestOverridingNameGetterPrototype::self(ExecState* exec, JSGlobalObject* globalObject) -{ - return getDOMPrototype<JSTestOverridingNameGetter>(exec, globalObject); -} - -bool JSTestOverridingNameGetterPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - JSTestOverridingNameGetterPrototype* thisObject = jsCast<JSTestOverridingNameGetterPrototype*>(cell); - return getStaticFunctionSlot<JSObject>(exec, &JSTestOverridingNameGetterPrototypeTable, thisObject, propertyName, slot); -} - -bool JSTestOverridingNameGetterPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - JSTestOverridingNameGetterPrototype* thisObject = jsCast<JSTestOverridingNameGetterPrototype*>(object); - return getStaticFunctionDescriptor<JSObject>(exec, &JSTestOverridingNameGetterPrototypeTable, thisObject, propertyName, descriptor); -} - -const ClassInfo JSTestOverridingNameGetter::s_info = { "TestOverridingNameGetter", &Base::s_info, &JSTestOverridingNameGetterTable, 0 , CREATE_METHOD_TABLE(JSTestOverridingNameGetter) }; - -JSTestOverridingNameGetter::JSTestOverridingNameGetter(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestOverridingNameGetter> impl) - : JSDOMWrapper(structure, globalObject) - , m_impl(impl.leakRef()) -{ -} - -void JSTestOverridingNameGetter::finishCreation(JSGlobalData& globalData) -{ - Base::finishCreation(globalData); - ASSERT(inherits(&s_info)); -} - -JSObject* JSTestOverridingNameGetter::createPrototype(ExecState* exec, JSGlobalObject* globalObject) -{ - return JSTestOverridingNameGetterPrototype::create(exec->globalData(), globalObject, JSTestOverridingNameGetterPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype())); -} - -void JSTestOverridingNameGetter::destroy(JSC::JSCell* cell) -{ - JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(cell); - thisObject->releaseImplIfNotNull(); -} - -bool JSTestOverridingNameGetter::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) -{ - JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(cell); - ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); - if (canGetItemsForName(exec, static_cast<TestOverridingNameGetter*>(thisObject->impl()), propertyName)) { - slot.setCustom(thisObject, thisObject->nameGetter); - return true; - } - return getStaticValueSlot<JSTestOverridingNameGetter, Base>(exec, &JSTestOverridingNameGetterTable, thisObject, propertyName, slot); -} - -bool JSTestOverridingNameGetter::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) -{ - JSTestOverridingNameGetter* thisObject = jsCast<JSTestOverridingNameGetter*>(object); - ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); - if (canGetItemsForName(exec, static_cast<TestOverridingNameGetter*>(thisObject->impl()), propertyName)) { - PropertySlot slot; - slot.setCustom(thisObject, nameGetter); - descriptor.setDescriptor(slot.getValue(exec, propertyName), ReadOnly | DontDelete | DontEnum); - return true; - } - return getStaticValueDescriptor<JSTestOverridingNameGetter, Base>(exec, &JSTestOverridingNameGetterTable, thisObject, propertyName, descriptor); -} - -JSValue jsTestOverridingNameGetterConstructor(ExecState* exec, JSValue slotBase, const Identifier&) -{ - JSTestOverridingNameGetter* domObject = static_cast<JSTestOverridingNameGetter*>(asObject(slotBase)); - return JSTestOverridingNameGetter::getConstructor(exec, domObject->globalObject()); -} - -JSValue JSTestOverridingNameGetter::getConstructor(ExecState* exec, JSGlobalObject* globalObject) -{ - return getDOMConstructor<JSTestOverridingNameGetterConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); -} - -EncodedJSValue JSC_HOST_CALL jsTestOverridingNameGetterPrototypeFunctionAnotherFunction(ExecState* exec) -{ - JSValue thisValue = exec->hostThisValue(); - if (!thisValue.inherits(&JSTestOverridingNameGetter::s_info)) - return throwVMTypeError(exec); - JSTestOverridingNameGetter* castedThis = static_cast<JSTestOverridingNameGetter*>(asObject(thisValue)); - ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestOverridingNameGetter::s_info); - TestOverridingNameGetter* impl = static_cast<TestOverridingNameGetter*>(castedThis->impl()); - if (exec->argumentCount() < 1) - return throwVMError(exec, createTypeError(exec, "Not enough arguments")); - const String& str(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, MissingIsUndefined).toString(exec)->value(exec))); - if (exec->hadException()) - return JSValue::encode(jsUndefined()); - impl->anotherFunction(str); - return JSValue::encode(jsUndefined()); -} - -static inline bool isObservable(JSTestOverridingNameGetter* jsTestOverridingNameGetter) -{ - if (jsTestOverridingNameGetter->hasCustomProperties()) - return true; - return false; -} - -bool JSTestOverridingNameGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor) -{ - JSTestOverridingNameGetter* jsTestOverridingNameGetter = static_cast<JSTestOverridingNameGetter*>(handle.get().asCell()); - if (!isObservable(jsTestOverridingNameGetter)) - return false; - UNUSED_PARAM(visitor); - return false; -} - -void JSTestOverridingNameGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) -{ - JSTestOverridingNameGetter* jsTestOverridingNameGetter = static_cast<JSTestOverridingNameGetter*>(handle.get().asCell()); - DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); - uncacheWrapper(world, jsTestOverridingNameGetter->impl(), jsTestOverridingNameGetter); - jsTestOverridingNameGetter->releaseImpl(); -} - -JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestOverridingNameGetter* impl) -{ - return wrap<JSTestOverridingNameGetter>(exec, globalObject, impl); -} - -TestOverridingNameGetter* toTestOverridingNameGetter(JSC::JSValue value) -{ - return value.inherits(&JSTestOverridingNameGetter::s_info) ? static_cast<JSTestOverridingNameGetter*>(asObject(value))->impl() : 0; -} - -} diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp index fb2f21d71..02deeda6f 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp @@ -42,12 +42,15 @@ ASSERT_HAS_TRIVIAL_DESTRUCTOR(JSTestSerializedScriptValueInterface); static const HashTableValue JSTestSerializedScriptValueInterfaceTableValues[] = { - { "value", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceValue), (intptr_t)0, NoIntrinsic }, + { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceValue), (intptr_t)setJSTestSerializedScriptValueInterfaceValue, NoIntrinsic }, + { "readonlyValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceReadonlyValue), (intptr_t)0, NoIntrinsic }, + { "cachedValue", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedValue), (intptr_t)setJSTestSerializedScriptValueInterfaceCachedValue, NoIntrinsic }, + { "cachedReadonlyValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedReadonlyValue), (intptr_t)0, NoIntrinsic }, { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceConstructor), (intptr_t)0, NoIntrinsic }, { 0, 0, 0, 0, NoIntrinsic } }; -static const HashTable JSTestSerializedScriptValueInterfaceTable = { 4, 3, JSTestSerializedScriptValueInterfaceTableValues, 0 }; +static const HashTable JSTestSerializedScriptValueInterfaceTable = { 17, 15, JSTestSerializedScriptValueInterfaceTableValues, 0 }; /* Hash table for constructor */ static const HashTableValue JSTestSerializedScriptValueInterfaceConstructorTableValues[] = @@ -167,12 +170,71 @@ JSValue jsTestSerializedScriptValueInterfaceValue(ExecState* exec, JSValue slotB } +JSValue jsTestSerializedScriptValueInterfaceReadonlyValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); + UNUSED_PARAM(exec); + TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + JSValue result = impl->readonlyValue() ? impl->readonlyValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); + return result; +} + + +JSValue jsTestSerializedScriptValueInterfaceCachedValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); + UNUSED_PARAM(exec); + if (JSValue cachedValue = castedThis->m_cachedValue.get()) + return cachedValue; + TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + JSValue result = impl->cachedValue() ? impl->cachedValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); + castedThis->m_cachedValue.set(exec->globalData(), castedThis, result); + return result; +} + + +JSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValue(ExecState* exec, JSValue slotBase, const Identifier&) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); + UNUSED_PARAM(exec); + if (JSValue cachedValue = castedThis->m_cachedReadonlyValue.get()) + return cachedValue; + TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + JSValue result = impl->cachedReadonlyValue() ? impl->cachedReadonlyValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull(); + castedThis->m_cachedReadonlyValue.set(exec->globalData(), castedThis, result); + return result; +} + + JSValue jsTestSerializedScriptValueInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestSerializedScriptValueInterface* domObject = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase)); return JSTestSerializedScriptValueInterface::getConstructor(exec, domObject->globalObject()); } +void JSTestSerializedScriptValueInterface::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell); + ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); + lookupPut<JSTestSerializedScriptValueInterface, Base>(exec, propertyName, value, &JSTestSerializedScriptValueInterfaceTable, thisObject, slot); +} + +void setJSTestSerializedScriptValueInterfaceValue(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(thisObject); + TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + impl->setValue(SerializedScriptValue::create(exec, value)); +} + + +void setJSTestSerializedScriptValueInterfaceCachedValue(ExecState* exec, JSObject* thisObject, JSValue value) +{ + JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(thisObject); + TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); + impl->setCachedValue(SerializedScriptValue::create(exec, value)); +} + + JSValue JSTestSerializedScriptValueInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) { return getDOMConstructor<JSTestSerializedScriptValueInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h index e1e255fbb..363fc85e0 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h @@ -44,6 +44,7 @@ public: static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*); static bool getOwnPropertySlot(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertySlot&); static bool getOwnPropertyDescriptor(JSC::JSObject*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::PropertyDescriptor&); + static void put(JSC::JSCell*, JSC::ExecState*, const JSC::Identifier& propertyName, JSC::JSValue, JSC::PutPropertySlot&); static void destroy(JSC::JSCell*); static const JSC::ClassInfo s_info; @@ -53,6 +54,10 @@ public: } static JSC::JSValue getConstructor(JSC::ExecState*, JSC::JSGlobalObject*); + JSC::WriteBarrier<JSC::Unknown> m_cachedValue; + JSC::WriteBarrier<JSC::Unknown> m_cachedReadonlyValue; + static void visitChildren(JSCell*, JSC::SlotVisitor&); + TestSerializedScriptValueInterface* impl() const { return m_impl; } void releaseImpl() { m_impl->deref(); m_impl = 0; } @@ -63,7 +68,7 @@ private: protected: JSTestSerializedScriptValueInterface(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestSerializedScriptValueInterface>); void finishCreation(JSC::JSGlobalData&); - static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | Base::StructureFlags; + static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | Base::StructureFlags; }; class JSTestSerializedScriptValueInterfaceOwner : public JSC::WeakHandleOwner { @@ -105,7 +110,7 @@ public: private: JSTestSerializedScriptValueInterfacePrototype(JSC::JSGlobalData& globalData, JSC::JSGlobalObject*, JSC::Structure* structure) : JSC::JSNonFinalObject(globalData, structure) { } protected: - static const unsigned StructureFlags = Base::StructureFlags; + static const unsigned StructureFlags = JSC::OverridesVisitChildren | Base::StructureFlags; }; class JSTestSerializedScriptValueInterfaceConstructor : public DOMConstructorObject { @@ -138,6 +143,11 @@ protected: // Attributes JSC::JSValue jsTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestSerializedScriptValueInterfaceValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestSerializedScriptValueInterfaceReadonlyValue(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +JSC::JSValue jsTestSerializedScriptValueInterfaceCachedValue(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); +void setJSTestSerializedScriptValueInterfaceCachedValue(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); +JSC::JSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValue(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); JSC::JSValue jsTestSerializedScriptValueInterfaceConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.h index 3d7b44793..ce781fd51 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.h @@ -30,7 +30,7 @@ @class NSString; -@interface DOMTestOverridingNameGetter : DOMObject +@interface DOMTestCustomNamedGetter : DOMObject - (void)anotherFunction:(NSString *)str; @end diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.mm index 3a80097bf..872066edd 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetter.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetter.mm @@ -27,7 +27,7 @@ #import "config.h" #import "DOMInternal.h" -#import "DOMTestOverridingNameGetter.h" +#import "DOMTestCustomNamedGetter.h" #import "DOMBlobInternal.h" #import "DOMCSSRuleInternal.h" @@ -35,23 +35,23 @@ #import "DOMEventInternal.h" #import "DOMNodeInternal.h" #import "DOMStyleSheetInternal.h" -#import "DOMTestOverridingNameGetterInternal.h" +#import "DOMTestCustomNamedGetterInternal.h" #import "ExceptionHandlers.h" #import "JSMainThreadExecState.h" #import "KURL.h" -#import "TestOverridingNameGetter.h" +#import "TestCustomNamedGetter.h" #import "ThreadCheck.h" #import "WebCoreObjCExtras.h" #import "WebScriptObjectPrivate.h" #import <wtf/GetPtr.h> -#define IMPL reinterpret_cast<WebCore::TestOverridingNameGetter*>(_internal) +#define IMPL reinterpret_cast<WebCore::TestCustomNamedGetter*>(_internal) -@implementation DOMTestOverridingNameGetter +@implementation DOMTestCustomNamedGetter - (void)dealloc { - if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestOverridingNameGetter class], self)) + if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestCustomNamedGetter class], self)) return; if (_internal) @@ -74,19 +74,19 @@ @end -WebCore::TestOverridingNameGetter* core(DOMTestOverridingNameGetter *wrapper) +WebCore::TestCustomNamedGetter* core(DOMTestCustomNamedGetter *wrapper) { - return wrapper ? reinterpret_cast<WebCore::TestOverridingNameGetter*>(wrapper->_internal) : 0; + return wrapper ? reinterpret_cast<WebCore::TestCustomNamedGetter*>(wrapper->_internal) : 0; } -DOMTestOverridingNameGetter *kit(WebCore::TestOverridingNameGetter* value) +DOMTestCustomNamedGetter *kit(WebCore::TestCustomNamedGetter* value) { { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); }; if (!value) return nil; - if (DOMTestOverridingNameGetter *wrapper = getDOMWrapper(value)) + if (DOMTestCustomNamedGetter *wrapper = getDOMWrapper(value)) return [[wrapper retain] autorelease]; - DOMTestOverridingNameGetter *wrapper = [[DOMTestOverridingNameGetter alloc] _init]; + DOMTestCustomNamedGetter *wrapper = [[DOMTestCustomNamedGetter alloc] _init]; wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value); value->ref(); addDOMWrapper(wrapper, value); diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetterInternal.h index 573cf6f11..e9b999628 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestOverridingNameGetterInternal.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCustomNamedGetterInternal.h @@ -24,15 +24,15 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#import <WebCore/DOMTestOverridingNameGetter.h> +#import <WebCore/DOMTestCustomNamedGetter.h> #if WEBKIT_VERSION_MAX_ALLOWED >= WEBKIT_VERSION_LATEST namespace WebCore { - class TestOverridingNameGetter; + class TestCustomNamedGetter; } -WebCore::TestOverridingNameGetter* core(DOMTestOverridingNameGetter *); -DOMTestOverridingNameGetter *kit(WebCore::TestOverridingNameGetter*); +WebCore::TestCustomNamedGetter* core(DOMTestCustomNamedGetter *); +DOMTestCustomNamedGetter *kit(WebCore::TestCustomNamedGetter*); #endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h index ff98133db..b5f3a17c9 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.h @@ -32,6 +32,11 @@ @interface DOMTestSerializedScriptValueInterface : DOMObject - (NSString *)value; +- (void)setValue:(NSString *)newValue; +- (NSString *)readonlyValue; +- (NSString *)cachedValue; +- (void)setCachedValue:(NSString *)newCachedValue; +- (NSString *)cachedReadonlyValue; @end #endif diff --git a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm index 1a0fc7b11..388f1c56d 100644 --- a/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm +++ b/Source/WebCore/bindings/scripts/test/ObjC/DOMTestSerializedScriptValueInterface.mm @@ -75,6 +75,40 @@ return IMPL->value()->toString(); } +- (void)setValue:(NSString *)newValue +{ + WebCore::JSMainThreadNullState state; + ASSERT(newValue); + + IMPL->setValue(WebCore::SerializedScriptValue::create(WTF::String(newValue))); +} + +- (NSString *)readonlyValue +{ + WebCore::JSMainThreadNullState state; + return IMPL->readonlyValue()->toString(); +} + +- (NSString *)cachedValue +{ + WebCore::JSMainThreadNullState state; + return IMPL->cachedValue()->toString(); +} + +- (void)setCachedValue:(NSString *)newCachedValue +{ + WebCore::JSMainThreadNullState state; + ASSERT(newCachedValue); + + IMPL->setCachedValue(WebCore::SerializedScriptValue::create(WTF::String(newCachedValue))); +} + +- (NSString *)cachedReadonlyValue +{ + WebCore::JSMainThreadNullState state; + return IMPL->cachedReadonlyValue()->toString(); +} + @end WebCore::TestSerializedScriptValueInterface* core(DOMTestSerializedScriptValueInterface *wrapper) diff --git a/Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl b/Source/WebCore/bindings/scripts/test/TestCustomNamedGetter.idl index a56ea5f2e..329fa5d6a 100644 --- a/Source/WebCore/bindings/scripts/test/TestOverridingNameGetter.idl +++ b/Source/WebCore/bindings/scripts/test/TestCustomNamedGetter.idl @@ -29,8 +29,8 @@ module events { interface [ - HasOverridingNameGetter - ] TestOverridingNameGetter { + CustomNamedGetter + ] TestCustomNamedGetter { void anotherFunction(in DOMString str); }; diff --git a/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl b/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl index 7783826e3..706f1e2fc 100644 --- a/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl +++ b/Source/WebCore/bindings/scripts/test/TestEventConstructor.idl @@ -34,6 +34,6 @@ module test { ] TestEventConstructor { // Attributes readonly attribute DOMString attr1; - readonly attribute [InitializedByConstructor] DOMString attr2; + readonly attribute [InitializedByEventConstructor] DOMString attr2; }; } diff --git a/Source/WebCore/bindings/scripts/test/TestEventTarget.idl b/Source/WebCore/bindings/scripts/test/TestEventTarget.idl index beedb5730..22e5b9646 100644 --- a/Source/WebCore/bindings/scripts/test/TestEventTarget.idl +++ b/Source/WebCore/bindings/scripts/test/TestEventTarget.idl @@ -30,8 +30,8 @@ module events { interface [ EventTarget, - HasIndexGetter, - HasNameGetter, + IndexedGetter, + NamedGetter, MasqueradesAsUndefined ] TestEventTarget { diff --git a/Source/WebCore/bindings/scripts/test/TestInterface.idl b/Source/WebCore/bindings/scripts/test/TestInterface.idl index eb4943ceb..b043061ee 100644 --- a/Source/WebCore/bindings/scripts/test/TestInterface.idl +++ b/Source/WebCore/bindings/scripts/test/TestInterface.idl @@ -31,7 +31,7 @@ module test { interface [ ActiveDOMObject, - DelegatingPutFunction, + CustomNamedSetter, Conditional=Condition1|Condition2, CallWith=ScriptExecutionContext, Constructor(in DOMString str1, in [Optional=CallWithDefaultValue] DOMString str2), diff --git a/Source/WebCore/bindings/scripts/test/TestObj.idl b/Source/WebCore/bindings/scripts/test/TestObj.idl index 0023b2b24..94e89e1a0 100644 --- a/Source/WebCore/bindings/scripts/test/TestObj.idl +++ b/Source/WebCore/bindings/scripts/test/TestObj.idl @@ -171,11 +171,11 @@ module test { static [Conditional=Condition1] void overloadedMethod1(in DOMString type); #if defined(TESTING_V8) - // 'EnabledAtRuntime' methods and attributes. - [EnabledAtRuntime] void enabledAtRuntimeMethod1(in int intArg); - [EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in int intArg); - attribute [EnabledAtRuntime] long enabledAtRuntimeAttr1; - attribute [EnabledAtRuntime=FeatureName] long enabledAtRuntimeAttr2; + // 'V8EnabledAtRuntime' methods and attributes. + [V8EnabledAtRuntime] void enabledAtRuntimeMethod1(in int intArg); + [V8EnabledAtRuntime=FeatureName] void enabledAtRuntimeMethod2(in int intArg); + attribute [V8EnabledAtRuntime] long enabledAtRuntimeAttr1; + attribute [V8EnabledAtRuntime=FeatureName] long enabledAtRuntimeAttr2; #endif @@ -191,15 +191,15 @@ module test { void convert1(in [ConvertNullStringTo=Null] a); void convert2(in [ConvertNullStringTo=Undefined] b); void convert3(in [ConvertNullStringTo=False] c); - void convert4(in [TreatNullAs=EmptyString] d); - void convert5(in [ConvertUndefinedOrNullToNullString] e); + void convert4(in [TreatNullAs=NullString] d); + void convert5(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] e); attribute SVGPoint mutablePoint; attribute [Immutable] SVGPoint immutablePoint; SVGPoint mutablePointFunction(); [Immutable] SVGPoint immutablePointFunction(); - [ImplementationFunction=banana] void orange(); + [ImplementedAs=banana] void orange(); attribute [StrictTypeChecking] float strictFloat; [StrictTypeChecking] bool strictFunction(in DOMString str, in float a, in int b) diff --git a/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl b/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl index ee1787e48..dddee9fae 100644 --- a/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl +++ b/Source/WebCore/bindings/scripts/test/TestSerializedScriptValueInterface.idl @@ -30,8 +30,9 @@ module test { Conditional=Condition1|Condition2, Constructor(in DOMString hello, in SerializedScriptValue value), ] TestSerializedScriptValueInterface { - // The case of a single SerializedScriptValue attribute is a bit of a - // special case. - readonly attribute SerializedScriptValue value; + attribute SerializedScriptValue value; + readonly attribute SerializedScriptValue readonlyValue; + attribute [CachedAttribute] SerializedScriptValue cachedValue; + readonly attribute [CachedAttribute] SerializedScriptValue cachedReadonlyValue; }; } diff --git a/Source/WebCore/bindings/scripts/test/TestTypedArray.idl b/Source/WebCore/bindings/scripts/test/TestTypedArray.idl index 7c87b17b1..4ea69e598 100644 --- a/Source/WebCore/bindings/scripts/test/TestTypedArray.idl +++ b/Source/WebCore/bindings/scripts/test/TestTypedArray.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Float64Array : ArrayBufferView { Int32Array foo(in Float32Array array); }; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp index 1ca6a4de9..bf1bc4a49 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.cpp @@ -19,7 +19,7 @@ */ #include "config.h" -#include "V8TestOverridingNameGetter.h" +#include "V8TestCustomNamedGetter.h" #include "ExceptionCode.h" #include "RuntimeEnabledFeatures.h" @@ -33,51 +33,51 @@ namespace WebCore { -WrapperTypeInfo V8TestOverridingNameGetter::info = { V8TestOverridingNameGetter::GetTemplate, V8TestOverridingNameGetter::derefObject, 0, 0 }; +WrapperTypeInfo V8TestCustomNamedGetter::info = { V8TestCustomNamedGetter::GetTemplate, V8TestCustomNamedGetter::derefObject, 0, 0 }; -namespace TestOverridingNameGetterInternal { +namespace TestCustomNamedGetterInternal { template <typename T> void V8_USE(T) { } static v8::Handle<v8::Value> anotherFunctionCallback(const v8::Arguments& args) { - INC_STATS("DOM.TestOverridingNameGetter.anotherFunction"); + INC_STATS("DOM.TestCustomNamedGetter.anotherFunction"); if (args.Length() < 1) return throwError("Not enough arguments", V8Proxy::TypeError); - TestOverridingNameGetter* imp = V8TestOverridingNameGetter::toNative(args.Holder()); + TestCustomNamedGetter* imp = V8TestCustomNamedGetter::toNative(args.Holder()); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); imp->anotherFunction(str); return v8::Handle<v8::Value>(); } -} // namespace TestOverridingNameGetterInternal +} // namespace TestCustomNamedGetterInternal -static const BatchedCallback TestOverridingNameGetterCallbacks[] = { - {"anotherFunction", TestOverridingNameGetterInternal::anotherFunctionCallback}, +static const BatchedCallback TestCustomNamedGetterCallbacks[] = { + {"anotherFunction", TestCustomNamedGetterInternal::anotherFunctionCallback}, }; -static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestOverridingNameGetterTemplate(v8::Persistent<v8::FunctionTemplate> desc) +static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestCustomNamedGetterTemplate(v8::Persistent<v8::FunctionTemplate> desc) { desc->ReadOnlyPrototype(); v8::Local<v8::Signature> defaultSignature; - defaultSignature = configureTemplate(desc, "TestOverridingNameGetter", v8::Persistent<v8::FunctionTemplate>(), V8TestOverridingNameGetter::internalFieldCount, + defaultSignature = configureTemplate(desc, "TestCustomNamedGetter", v8::Persistent<v8::FunctionTemplate>(), V8TestCustomNamedGetter::internalFieldCount, 0, 0, - TestOverridingNameGetterCallbacks, WTF_ARRAY_LENGTH(TestOverridingNameGetterCallbacks)); + TestCustomNamedGetterCallbacks, WTF_ARRAY_LENGTH(TestCustomNamedGetterCallbacks)); UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); UNUSED_PARAM(instance); // In some cases, it will not be used. UNUSED_PARAM(proto); // In some cases, it will not be used. - desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestOverridingNameGetter::namedPropertyGetter, 0, 0, 0, 0); + desc->InstanceTemplate()->SetNamedPropertyHandler(V8TestCustomNamedGetter::namedPropertyGetter, 0, 0, 0, 0); // Custom toString template desc->Set(getToStringName(), getToStringTemplate()); return desc; } -v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetRawTemplate() +v8::Persistent<v8::FunctionTemplate> V8TestCustomNamedGetter::GetRawTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); @@ -90,7 +90,7 @@ v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetRawTemplate( return templ; } -v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetTemplate() +v8::Persistent<v8::FunctionTemplate> V8TestCustomNamedGetter::GetTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info); @@ -99,18 +99,18 @@ v8::Persistent<v8::FunctionTemplate> V8TestOverridingNameGetter::GetTemplate() v8::HandleScope handleScope; v8::Persistent<v8::FunctionTemplate> templ = - ConfigureV8TestOverridingNameGetterTemplate(GetRawTemplate()); + ConfigureV8TestCustomNamedGetterTemplate(GetRawTemplate()); data->templateMap().add(&info, templ); return templ; } -bool V8TestOverridingNameGetter::HasInstance(v8::Handle<v8::Value> value) +bool V8TestCustomNamedGetter::HasInstance(v8::Handle<v8::Value> value) { return GetRawTemplate()->HasInstance(value); } -v8::Handle<v8::Object> V8TestOverridingNameGetter::wrapSlow(TestOverridingNameGetter* impl) +v8::Handle<v8::Object> V8TestCustomNamedGetter::wrapSlow(TestCustomNamedGetter* impl) { v8::Handle<v8::Object> wrapper; V8Proxy* proxy = 0; @@ -127,9 +127,9 @@ v8::Handle<v8::Object> V8TestOverridingNameGetter::wrapSlow(TestOverridingNameGe return wrapper; } -void V8TestOverridingNameGetter::derefObject(void* object) +void V8TestCustomNamedGetter::derefObject(void* object) { - static_cast<TestOverridingNameGetter*>(object)->deref(); + static_cast<TestCustomNamedGetter*>(object)->deref(); } } // namespace WebCore diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.h b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h index 8c1b8e021..264791d84 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestOverridingNameGetter.h +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestCustomNamedGetter.h @@ -18,10 +18,10 @@ Boston, MA 02111-1307, USA. */ -#ifndef V8TestOverridingNameGetter_h -#define V8TestOverridingNameGetter_h +#ifndef V8TestCustomNamedGetter_h +#define V8TestCustomNamedGetter_h -#include "TestOverridingNameGetter.h" +#include "TestCustomNamedGetter.h" #include "V8DOMWrapper.h" #include "WrapperTypeInfo.h" #include <v8.h> @@ -30,51 +30,51 @@ namespace WebCore { -class V8TestOverridingNameGetter { +class V8TestCustomNamedGetter { public: static const bool hasDependentLifetime = false; static bool HasInstance(v8::Handle<v8::Value>); static v8::Persistent<v8::FunctionTemplate> GetRawTemplate(); static v8::Persistent<v8::FunctionTemplate> GetTemplate(); - static TestOverridingNameGetter* toNative(v8::Handle<v8::Object> object) + static TestCustomNamedGetter* toNative(v8::Handle<v8::Object> object) { - return reinterpret_cast<TestOverridingNameGetter*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); + return reinterpret_cast<TestCustomNamedGetter*>(object->GetPointerFromInternalField(v8DOMWrapperObjectIndex)); } - inline static v8::Handle<v8::Object> wrap(TestOverridingNameGetter*); + inline static v8::Handle<v8::Object> wrap(TestCustomNamedGetter*); static void derefObject(void*); static WrapperTypeInfo info; static v8::Handle<v8::Value> namedPropertyGetter(v8::Local<v8::String>, const v8::AccessorInfo&); static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0; - static v8::Handle<v8::Object> existingWrapper(TestOverridingNameGetter*); + static v8::Handle<v8::Object> existingWrapper(TestCustomNamedGetter*); private: - static v8::Handle<v8::Object> wrapSlow(TestOverridingNameGetter*); + static v8::Handle<v8::Object> wrapSlow(TestCustomNamedGetter*); }; -ALWAYS_INLINE v8::Handle<v8::Object> V8TestOverridingNameGetter::existingWrapper(TestOverridingNameGetter* impl) +ALWAYS_INLINE v8::Handle<v8::Object> V8TestCustomNamedGetter::existingWrapper(TestCustomNamedGetter* impl) { return getDOMObjectMap().get(impl); } -v8::Handle<v8::Object> V8TestOverridingNameGetter::wrap(TestOverridingNameGetter* impl) +v8::Handle<v8::Object> V8TestCustomNamedGetter::wrap(TestCustomNamedGetter* impl) { v8::Handle<v8::Object> wrapper = existingWrapper(impl); if (!wrapper.IsEmpty()) return wrapper; - return V8TestOverridingNameGetter::wrapSlow(impl); + return V8TestCustomNamedGetter::wrapSlow(impl); } -inline v8::Handle<v8::Value> toV8(TestOverridingNameGetter* impl) +inline v8::Handle<v8::Value> toV8(TestCustomNamedGetter* impl) { if (!impl) return v8::Null(); - return V8TestOverridingNameGetter::wrap(impl); + return V8TestCustomNamedGetter::wrap(impl); } -inline v8::Handle<v8::Value> toV8(PassRefPtr< TestOverridingNameGetter > impl) +inline v8::Handle<v8::Value> toV8(PassRefPtr< TestCustomNamedGetter > impl) { return toV8(impl.get()); } } -#endif // V8TestOverridingNameGetter_h +#endif // V8TestCustomNamedGetter_h diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp index dd33aa056..d561eb491 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestEventConstructor.cpp @@ -58,7 +58,7 @@ static v8::Handle<v8::Value> attr2AttrGetter(v8::Local<v8::String> name, const v static const BatchedAttribute TestEventConstructorAttrs[] = { // Attribute 'attr1' (Type: 'readonly attribute' ExtAttr: '') {"attr1", TestEventConstructorInternal::attr1AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, - // Attribute 'attr2' (Type: 'readonly attribute' ExtAttr: 'InitializedByConstructor') + // Attribute 'attr2' (Type: 'readonly attribute' ExtAttr: 'InitializedByEventConstructor') {"attr2", TestEventConstructorInternal::attr2AttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, }; diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp index 76ac34597..0477223f2 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp @@ -157,10 +157,10 @@ static const BatchedConstant TestInterfaceConsts[] = { #if ENABLE(Condition11) || ENABLE(Condition12) -COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDontCheckEnums); +COMPILE_ASSERT(1 == TestInterface::SUPPLEMENTALCONSTANT1, TestInterfaceEnumSUPPLEMENTALCONSTANT1IsWrongUseDoNotCheckConstants); #endif #if ENABLE(Condition11) || ENABLE(Condition12) -COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDontCheckEnums); +COMPILE_ASSERT(2 == TestInterface::CONST_IMPL, TestInterfaceEnumCONST_IMPLIsWrongUseDoNotCheckConstants); #endif v8::Handle<v8::Value> V8TestInterface::constructorCallback(const v8::Arguments& args) diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp index c19297295..2ece58248 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp @@ -769,7 +769,7 @@ static v8::Handle<v8::Value> contentDocumentAttrGetter(v8::Local<v8::String> nam { INC_STATS("DOM.TestObj.contentDocument._get"); TestObj* imp = V8TestObj::toNative(info.Holder()); - if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->contentDocument())) + if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->contentDocument())) return v8::Handle<v8::Value>(); return toV8(imp->contentDocument()); @@ -972,11 +972,21 @@ static v8::Handle<v8::Value> optionsObjectCallback(const v8::Arguments& args) return throwError("Not enough arguments", V8Proxy::TypeError); TestObj* imp = V8TestObj::toNative(args.Holder()); EXCEPTION_BLOCK(OptionsObject, oo, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)); + if (args.Length() > 0 && !oo.isUndefinedOrNull() && !oo.isObject()) { + ec = TYPE_MISMATCH_ERR; + V8Proxy::setDOMException(ec); + return throwError("Not an object.", V8Proxy::TypeError); + } if (args.Length() <= 1) { imp->optionsObject(oo); return v8::Handle<v8::Value>(); } EXCEPTION_BLOCK(OptionsObject, ooo, MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)); + if (args.Length() > 1 && !ooo.isUndefinedOrNull() && !ooo.isObject()) { + ec = TYPE_MISMATCH_ERR; + V8Proxy::setDOMException(ec); + return throwError("Not an object.", V8Proxy::TypeError); + } imp->optionsObject(oo, ooo); return v8::Handle<v8::Value>(); } @@ -1433,7 +1443,7 @@ static v8::Handle<v8::Value> getSVGDocumentCallback(const v8::Arguments& args) TestObj* imp = V8TestObj::toNative(args.Holder()); ExceptionCode ec = 0; { - if (!V8BindingSecurity::allowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) + if (!V8BindingSecurity::shouldAllowAccessToNode(V8BindingState::Only(), imp->getSVGDocument(ec))) return v8::Handle<v8::Value>(); RefPtr<SVGDocument> result = imp->getSVGDocument(ec); if (UNLIKELY(ec)) @@ -1716,20 +1726,20 @@ static const BatchedConstant TestObjConsts[] = { #if ENABLE(Condition1) -COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDontCheckEnums); +COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDoNotCheckConstants); #endif -COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums); -COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums); -COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums); -COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDontCheckEnums); -COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDontCheckEnums); -COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDontCheckEnums); -COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDontCheckEnums); -COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDontCheckEnums); -COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDontCheckEnums); +COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(4 == TestObj::CONST_VALUE_4, TestObjEnumCONST_VALUE_4IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(8 == TestObj::CONST_VALUE_8, TestObjEnumCONST_VALUE_8IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(-1 == TestObj::CONST_VALUE_9, TestObjEnumCONST_VALUE_9IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT("my constant string" == TestObj::CONST_VALUE_10, TestObjEnumCONST_VALUE_10IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0xffffffff == TestObj::CONST_VALUE_11, TestObjEnumCONST_VALUE_11IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0x01 == TestObj::CONST_VALUE_12, TestObjEnumCONST_VALUE_12IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0X20 == TestObj::CONST_VALUE_13, TestObjEnumCONST_VALUE_13IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWrongUseDoNotCheckConstants); +COMPILE_ASSERT(15 == TestObj::CONST_IMPL, TestObjEnumCONST_IMPLIsWrongUseDoNotCheckConstants); v8::Handle<v8::Value> V8TestObj::constructorCallback(const v8::Arguments& args) { @@ -1767,13 +1777,13 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi if (RuntimeEnabledFeatures::enabledAtRuntimeAttr1Enabled()) { static const BatchedAttribute attrData =\ - // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime') + // Attribute 'enabledAtRuntimeAttr1' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime') {"enabledAtRuntimeAttr1", TestObjInternal::enabledAtRuntimeAttr1AttrGetter, TestObjInternal::enabledAtRuntimeAttr1AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; configureAttribute(instance, proto, attrData); } if (RuntimeEnabledFeatures::featureNameEnabled()) { static const BatchedAttribute attrData =\ - // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'EnabledAtRuntime') + // Attribute 'enabledAtRuntimeAttr2' (Type: 'attribute' ExtAttr: 'V8EnabledAtRuntime') {"enabledAtRuntimeAttr2", TestObjInternal::enabledAtRuntimeAttr2AttrGetter, TestObjInternal::enabledAtRuntimeAttr2AttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; configureAttribute(instance, proto, attrData); } diff --git a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp index 3d3581bc6..27e51b230 100644 --- a/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.cpp @@ -42,8 +42,80 @@ namespace TestSerializedScriptValueInterfaceInternal { template <typename T> void V8_USE(T) { } +static v8::Handle<v8::Value> valueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.value._get"); + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + return imp->value() ? imp->value()->deserialize() : v8::Handle<v8::Value>(v8::Null()); +} + +static void valueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.value._set"); + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + RefPtr<SerializedScriptValue> v = SerializedScriptValue::create(value); + imp->setValue(WTF::getPtr(v)); + return; +} + +static v8::Handle<v8::Value> readonlyValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.readonlyValue._get"); + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + return imp->readonlyValue() ? imp->readonlyValue()->deserialize() : v8::Handle<v8::Value>(v8::Null()); +} + +static v8::Handle<v8::Value> cachedValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.cachedValue._get"); + v8::Handle<v8::String> propertyName = v8::String::NewSymbol("cachedValue"); + v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName); + if (!value.IsEmpty()) + return value; + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + SerializedScriptValue* serialized = imp->cachedValue(); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + info.Holder()->SetHiddenValue(propertyName, value); + return value; +} + +static void cachedValueAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.cachedValue._set"); + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + RefPtr<SerializedScriptValue> v = SerializedScriptValue::create(value); + imp->setCachedValue(WTF::getPtr(v)); + info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("cachedValue")); // Invalidate the cached value. + return; +} + +static v8::Handle<v8::Value> cachedReadonlyValueAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.TestSerializedScriptValueInterface.cachedReadonlyValue._get"); + v8::Handle<v8::String> propertyName = v8::String::NewSymbol("cachedReadonlyValue"); + v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName); + if (!value.IsEmpty()) + return value; + TestSerializedScriptValueInterface* imp = V8TestSerializedScriptValueInterface::toNative(info.Holder()); + SerializedScriptValue* serialized = imp->cachedReadonlyValue(); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + info.Holder()->SetHiddenValue(propertyName, value); + return value; +} + } // namespace TestSerializedScriptValueInterfaceInternal +static const BatchedAttribute TestSerializedScriptValueInterfaceAttrs[] = { + // Attribute 'value' (Type: 'attribute' ExtAttr: '') + {"value", TestSerializedScriptValueInterfaceInternal::valueAttrGetter, TestSerializedScriptValueInterfaceInternal::valueAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'readonlyValue' (Type: 'readonly attribute' ExtAttr: '') + {"readonlyValue", TestSerializedScriptValueInterfaceInternal::readonlyValueAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'cachedValue' (Type: 'attribute' ExtAttr: 'CachedAttribute') + {"cachedValue", TestSerializedScriptValueInterfaceInternal::cachedValueAttrGetter, TestSerializedScriptValueInterfaceInternal::cachedValueAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, + // Attribute 'cachedReadonlyValue' (Type: 'readonly attribute' ExtAttr: 'CachedAttribute') + {"cachedReadonlyValue", TestSerializedScriptValueInterfaceInternal::cachedReadonlyValueAttrGetter, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, +}; + v8::Handle<v8::Value> V8TestSerializedScriptValueInterface::constructorCallback(const v8::Arguments& args) { INC_STATS("DOM.TestSerializedScriptValueInterface.Constructor"); @@ -66,7 +138,6 @@ v8::Handle<v8::Value> V8TestSerializedScriptValueInterface::constructorCallback( V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get()); impl->ref(); - SerializedScriptValue::deserializeAndSetProperty(wrapper, "value", static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), impl->value()); V8DOMWrapper::setJSWrapperForDOMObject(impl.get(), v8::Persistent<v8::Object>::New(wrapper)); return args.Holder(); } @@ -77,7 +148,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValue v8::Local<v8::Signature> defaultSignature; defaultSignature = configureTemplate(desc, "TestSerializedScriptValueInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestSerializedScriptValueInterface::internalFieldCount, - 0, 0, + TestSerializedScriptValueInterfaceAttrs, WTF_ARRAY_LENGTH(TestSerializedScriptValueInterfaceAttrs), 0, 0); UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. desc->SetCallHandler(V8TestSerializedScriptValueInterface::constructorCallback); @@ -130,7 +201,6 @@ v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(TestSerial return wrapper; impl->ref(); - SerializedScriptValue::deserializeAndSetProperty(wrapper, "value", static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), impl->value()); v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper); if (!hasDependentLifetime) diff --git a/Source/WebCore/bindings/v8/OptionsObject.cpp b/Source/WebCore/bindings/v8/OptionsObject.cpp index a9e40e4d4..f8db97e5a 100644 --- a/Source/WebCore/bindings/v8/OptionsObject.cpp +++ b/Source/WebCore/bindings/v8/OptionsObject.cpp @@ -64,6 +64,11 @@ OptionsObject& OptionsObject::operator=(const OptionsObject& optionsObject) return *this; } +bool OptionsObject::isObject() const +{ + return !isUndefinedOrNull() && m_options->IsObject(); +} + bool OptionsObject::isUndefinedOrNull() const { if (m_options.IsEmpty()) diff --git a/Source/WebCore/bindings/v8/OptionsObject.h b/Source/WebCore/bindings/v8/OptionsObject.h index cbfd2e332..2c7e80a07 100644 --- a/Source/WebCore/bindings/v8/OptionsObject.h +++ b/Source/WebCore/bindings/v8/OptionsObject.h @@ -49,6 +49,7 @@ public: OptionsObject& operator=(const OptionsObject&); + bool isObject() const; bool isUndefinedOrNull() const; bool get(const String&, bool&) const; diff --git a/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp b/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp index da2926a5f..18f7df7ee 100755 --- a/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp +++ b/Source/WebCore/bindings/v8/PageScriptDebugServer.cpp @@ -76,10 +76,12 @@ PageScriptDebugServer::PageScriptDebugServer() void PageScriptDebugServer::addListener(ScriptDebugListener* listener, Page* page) { + V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame()); + if (!proxy) + return; ScriptController* scriptController = page->mainFrame()->script(); if (!scriptController->canExecuteScripts(NotAboutToExecuteScript)) return; - V8Proxy* proxy = V8Proxy::retrieve(page->mainFrame()); v8::HandleScope scope; v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext(); diff --git a/Source/WebCore/bindings/v8/ScheduledAction.cpp b/Source/WebCore/bindings/v8/ScheduledAction.cpp index ac7ed3ae8..f76b58d1c 100644 --- a/Source/WebCore/bindings/v8/ScheduledAction.cpp +++ b/Source/WebCore/bindings/v8/ScheduledAction.cpp @@ -96,8 +96,10 @@ void ScheduledAction::execute(ScriptExecutionContext* context) { if (context->isDocument()) { Frame* frame = static_cast<Document*>(context)->frame(); + if (!frame) + return; ScriptController* scriptController = frame->script(); - if (!scriptController->canExecuteScripts(NotAboutToExecuteScript)) + if (!scriptController->canExecuteScripts(AboutToExecuteScript)) return; V8Proxy* proxy = V8Proxy::retrieve(frame); execute(proxy); diff --git a/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp b/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp index adca0c804..0a86d612e 100644 --- a/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp +++ b/Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp @@ -59,7 +59,7 @@ void ScriptCachedFrameData::restore(Frame* frame) if (m_context.get().IsEmpty()) return; - if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + if (!frame || !frame->script()->canExecuteScripts(NotAboutToExecuteScript)) return; v8::HandleScope handleScope; diff --git a/Source/WebCore/bindings/v8/ScriptDebugServer.h b/Source/WebCore/bindings/v8/ScriptDebugServer.h index cac050da5..0afaae8b1 100644 --- a/Source/WebCore/bindings/v8/ScriptDebugServer.h +++ b/Source/WebCore/bindings/v8/ScriptDebugServer.h @@ -92,6 +92,8 @@ public: static void interruptAndRun(PassOwnPtr<Task>); void runPendingTasks(); + bool isPaused(); + protected: ScriptDebugServer(); ~ScriptDebugServer() { } @@ -112,8 +114,6 @@ protected: void ensureDebuggerScriptCompiled(); - bool isPaused(); - PauseOnExceptionsState m_pauseOnExceptionsState; OwnHandle<v8::Object> m_debuggerScript; OwnHandle<v8::Object> m_executionState; diff --git a/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp b/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp index a8bda1d77..5c96b564e 100644 --- a/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp +++ b/Source/WebCore/bindings/v8/ScriptFunctionCall.cpp @@ -197,7 +197,7 @@ ScriptValue ScriptCallback::call(bool& hadException) for (size_t i = 0; i < m_arguments.size(); ++i) args[i] = m_arguments[i].v8Value(); - v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, function, object, m_arguments.size(), args.get()); + v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* frame */, function, object, m_arguments.size(), args.get()); if (exceptionCatcher.HasCaught()) { hadException = true; diff --git a/Source/WebCore/bindings/v8/ScriptObject.h b/Source/WebCore/bindings/v8/ScriptObject.h index 6b78cfc69..4541ab088 100644 --- a/Source/WebCore/bindings/v8/ScriptObject.h +++ b/Source/WebCore/bindings/v8/ScriptObject.h @@ -43,7 +43,7 @@ namespace WebCore { class ScriptObject : public ScriptValue { public: ScriptObject(ScriptState*, v8::Handle<v8::Object>); - ScriptObject() {}; + ScriptObject() : m_scriptState(0) { }; virtual ~ScriptObject() {} v8::Local<v8::Object> v8Object() const; diff --git a/Source/WebCore/bindings/v8/ScriptProfiler.cpp b/Source/WebCore/bindings/v8/ScriptProfiler.cpp index 4007a8f2a..a7f65faf2 100644 --- a/Source/WebCore/bindings/v8/ScriptProfiler.cpp +++ b/Source/WebCore/bindings/v8/ScriptProfiler.cpp @@ -32,9 +32,8 @@ #include "ScriptProfiler.h" #include "DOMWrapperVisitor.h" -#include "InjectedScript.h" -#include "InspectorValues.h" #include "RetainedDOMInfo.h" +#include "ScriptObject.h" #include "V8Binding.h" #include "V8DOMMap.h" #include "V8Node.h" @@ -64,7 +63,7 @@ void ScriptProfiler::collectGarbage() v8::V8::LowMemoryNotification(); } -PassRefPtr<InspectorValue> ScriptProfiler::objectByHeapObjectId(unsigned id, InjectedScriptManager* injectedScriptManager) +ScriptObject ScriptProfiler::objectByHeapObjectId(unsigned id) { // As ids are unique, it doesn't matter which HeapSnapshot owns HeapGraphNode. // We need to find first HeapSnapshot containing a node with the specified id. @@ -76,20 +75,16 @@ PassRefPtr<InspectorValue> ScriptProfiler::objectByHeapObjectId(unsigned id, Inj break; } if (!node) - return InspectorValue::null(); + return ScriptObject(); v8::HandleScope scope; v8::Handle<v8::Value> value = node->GetHeapValue(); if (!value->IsObject()) - return InspectorValue::null(); - - v8::Handle<v8::Object> object(value.As<v8::Object>()); - v8::Local<v8::Context> creationContext = object->CreationContext(); - v8::Context::Scope creationScope(creationContext); - ScriptState* scriptState = ScriptState::forContext(creationContext); - InjectedScript injectedScript = injectedScriptManager->injectedScriptFor(scriptState); - return !injectedScript.hasNoValue() ? - RefPtr<InspectorValue>(injectedScript.wrapObject(value, "")).release() : InspectorValue::null(); + return ScriptObject(); + + v8::Handle<v8::Object> object = value.As<v8::Object>(); + ScriptState* scriptState = ScriptState::forContext(object->CreationContext()); + return ScriptObject(scriptState, object); } namespace { diff --git a/Source/WebCore/bindings/v8/ScriptProfiler.h b/Source/WebCore/bindings/v8/ScriptProfiler.h index 9f02f4b57..8e8a16144 100644 --- a/Source/WebCore/bindings/v8/ScriptProfiler.h +++ b/Source/WebCore/bindings/v8/ScriptProfiler.h @@ -31,7 +31,6 @@ #ifndef ScriptProfiler_h #define ScriptProfiler_h -#include "InspectorValues.h" #include "PlatformString.h" #include "ScriptHeapSnapshot.h" #include "ScriptProfile.h" @@ -42,7 +41,7 @@ namespace WebCore { class DOMWrapperVisitor; -class InjectedScriptManager; +class ScriptObject; class ScriptProfiler { WTF_MAKE_NONCOPYABLE(ScriptProfiler); @@ -57,7 +56,7 @@ public: }; static void collectGarbage(); - static PassRefPtr<InspectorValue> objectByHeapObjectId(unsigned id, InjectedScriptManager*); + static ScriptObject objectByHeapObjectId(unsigned id); static void start(ScriptState* state, const String& title); static PassRefPtr<ScriptProfile> stop(ScriptState* state, const String& title); static PassRefPtr<ScriptHeapSnapshot> takeHeapSnapshot(const String& title, HeapSnapshotProgress*); diff --git a/Source/WebCore/bindings/v8/ScriptState.cpp b/Source/WebCore/bindings/v8/ScriptState.cpp index 33b7a27da..b03f160fb 100644 --- a/Source/WebCore/bindings/v8/ScriptState.cpp +++ b/Source/WebCore/bindings/v8/ScriptState.cpp @@ -109,6 +109,18 @@ DOMWindow* domWindowFromScriptState(ScriptState* scriptState) return scriptState->domWindow(); } +bool evalEnabled(ScriptState* scriptState) +{ + v8::HandleScope handleScope; + return scriptState->context()->IsCodeGenerationFromStringsAllowed(); +} + +void setEvalEnabled(ScriptState* scriptState, bool enabled) +{ + v8::HandleScope handleScope; + return scriptState->context()->AllowCodeGenerationFromStrings(enabled); +} + ScriptState* mainWorldScriptState(Frame* frame) { v8::HandleScope handleScope; diff --git a/Source/WebCore/bindings/v8/ScriptState.h b/Source/WebCore/bindings/v8/ScriptState.h index 8e00a7e36..e338c3f65 100644 --- a/Source/WebCore/bindings/v8/ScriptState.h +++ b/Source/WebCore/bindings/v8/ScriptState.h @@ -109,6 +109,9 @@ private: DOMWindow* domWindowFromScriptState(ScriptState*); +bool evalEnabled(ScriptState*); +void setEvalEnabled(ScriptState*, bool); + ScriptState* mainWorldScriptState(Frame*); ScriptState* scriptStateFromNode(DOMWrapperWorld*, Node*); diff --git a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp index df5f61140..a2fceb004 100644 --- a/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp @@ -32,7 +32,6 @@ #include "V8DOMWindowShell.h" #include "PlatformSupport.h" -#include "CSSMutableStyleDeclaration.h" #include "DateExtension.h" #include "DocumentLoader.h" #include "Frame.h" @@ -45,6 +44,7 @@ #include "ScriptProfiler.h" #include "SecurityOrigin.h" #include "StorageNamespace.h" +#include "StylePropertySet.h" #include "V8Binding.h" #include "V8BindingState.h" #include "V8Collection.h" diff --git a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp index 0b757ca08..8a45b71ec 100644 --- a/Source/WebCore/bindings/v8/V8DOMWrapper.cpp +++ b/Source/WebCore/bindings/v8/V8DOMWrapper.cpp @@ -32,12 +32,12 @@ #include "V8DOMWrapper.h" #include "ArrayBufferView.h" -#include "CSSMutableStyleDeclaration.h" #include "DOMDataStore.h" #include "DocumentLoader.h" #include "EventTargetHeaders.h" #include "EventTargetInterfaces.h" #include "FrameLoaderClient.h" +#include "StylePropertySet.h" #include "V8AbstractEventListener.h" #include "V8Binding.h" #include "V8Collection.h" diff --git a/Source/WebCore/bindings/v8/V8EventListener.cpp b/Source/WebCore/bindings/v8/V8EventListener.cpp index a537fe6bd..811013bc0 100644 --- a/Source/WebCore/bindings/v8/V8EventListener.cpp +++ b/Source/WebCore/bindings/v8/V8EventListener.cpp @@ -85,7 +85,7 @@ v8::Local<v8::Value> V8EventListener::callListenerFunction(ScriptExecutionContex if (V8Proxy* proxy = V8Proxy::retrieve(context)) { Frame* frame = static_cast<Document*>(context)->frame(); - if (frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + if (frame->script()->canExecuteScripts(AboutToExecuteScript)) return proxy->callFunction(handlerFunction, receiver, 1, parameters); } diff --git a/Source/WebCore/bindings/v8/V8Helpers.cpp b/Source/WebCore/bindings/v8/V8Helpers.cpp index c84f794b7..755b0b44f 100644 --- a/Source/WebCore/bindings/v8/V8Helpers.cpp +++ b/Source/WebCore/bindings/v8/V8Helpers.cpp @@ -42,7 +42,7 @@ v8::Local<v8::Context> toV8Context(NPP npp, NPObject* npObject) { V8NPObject* object = reinterpret_cast<V8NPObject*>(npObject); DOMWindow* domWindow = object->rootObject; - if (!domWindow || domWindow != domWindow->frame()->domWindow()) + if (!domWindow || !domWindow->frame() || domWindow != domWindow->frame()->domWindow()) return v8::Local<v8::Context>(); return V8Proxy::mainWorldContext(object->rootObject->frame()); } diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp index e6e9320a0..9775d32a2 100644 --- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp @@ -67,7 +67,7 @@ v8::Local<v8::Value> V8LazyEventListener::callListenerFunction(ScriptExecutionCo if (V8Proxy* proxy = V8Proxy::retrieve(context)) { Frame* frame = static_cast<Document*>(context)->frame(); - if (frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + if (frame->script()->canExecuteScripts(AboutToExecuteScript)) return proxy->callFunction(handlerFunction, receiver, 1, parameters); } diff --git a/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp b/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp index 2feaf6815..2a663e855 100644 --- a/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp +++ b/Source/WebCore/bindings/v8/V8NodeFilterCondition.cpp @@ -83,7 +83,7 @@ short V8NodeFilterCondition::acceptNode(ScriptState* state, Node* node) const OwnArrayPtr<v8::Handle<v8::Value> > args = adoptArrayPtr(new v8::Handle<v8::Value>[1]); args[0] = toV8(node); - v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* page */, callback, object, 1, args.get()); + v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(0 /* frame */, callback, object, 1, args.get()); if (exceptionCatcher.HasCaught()) { state->setException(exceptionCatcher.Exception()); diff --git a/Source/WebCore/bindings/v8/V8Proxy.cpp b/Source/WebCore/bindings/v8/V8Proxy.cpp index 47db15c5a..376e12f51 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.cpp +++ b/Source/WebCore/bindings/v8/V8Proxy.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "V8Proxy.h" -#include "CSSMutableStyleDeclaration.h" #include "CachedMetadata.h" #include "DateExtension.h" #include "Document.h" @@ -48,6 +47,7 @@ #include "ScriptSourceCode.h" #include "SecurityOrigin.h" #include "Settings.h" +#include "StylePropertySet.h" #include "V8Binding.h" #include "V8BindingState.h" #include "V8Collection.h" @@ -194,7 +194,7 @@ bool V8Proxy::handleOutOfMemory() Frame* frame = V8Proxy::retrieveFrame(context); V8Proxy* proxy = V8Proxy::retrieve(frame); - if (proxy && frame->script()->canExecuteScripts(NotAboutToExecuteScript)) { + if (proxy) { // Clean m_context, and event handlers. proxy->clearForClose(); @@ -378,7 +378,7 @@ v8::Local<v8::Value> V8Proxy::runScript(v8::Handle<v8::Script> script) v8::TryCatch tryCatch; tryCatch.SetVerbose(true); { - V8RecursionScope recursionScope; + V8RecursionScope recursionScope(frame()->document()); result = script->Run(); } @@ -404,10 +404,10 @@ v8::Local<v8::Value> V8Proxy::callFunction(v8::Handle<v8::Function> function, v8 { // Keep Frame (and therefore ScriptController and V8Proxy) alive. RefPtr<Frame> protect(frame()); - return V8Proxy::instrumentedCallFunction(m_frame->page(), function, receiver, argc, args); + return V8Proxy::instrumentedCallFunction(frame(), function, receiver, argc, args); } -v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) +v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Frame* frame, v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]) { V8GCController::checkMemoryUsage(); @@ -415,7 +415,7 @@ v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8 return handleMaxRecursionDepthExceeded(); InspectorInstrumentationCookie cookie; - if (InspectorInstrumentation::hasFrontends()) { + if (InspectorInstrumentation::hasFrontends() && frame) { String resourceName("undefined"); int lineNumber = 1; v8::ScriptOrigin origin = function->GetScriptOrigin(); @@ -423,12 +423,12 @@ v8::Local<v8::Value> V8Proxy::instrumentedCallFunction(Page* page, v8::Handle<v8 resourceName = toWebCoreString(origin.ResourceName()); lineNumber = function->GetScriptLineNumber() + 1; } - cookie = InspectorInstrumentation::willCallFunction(page, resourceName, lineNumber); + cookie = InspectorInstrumentation::willCallFunction(frame->page(), resourceName, lineNumber); } v8::Local<v8::Value> result; { - V8RecursionScope recursionScope; + V8RecursionScope recursionScope(frame ? frame->document() : 0); result = function->Call(receiver, argc, args); } @@ -718,11 +718,8 @@ int V8Proxy::contextDebugId(v8::Handle<v8::Context> context) v8::Local<v8::Context> toV8Context(ScriptExecutionContext* context, const WorldContextHandle& worldContext) { if (context->isDocument()) { - if (V8Proxy* proxy = V8Proxy::retrieve(context)) { - Frame* frame = static_cast<Document*>(context)->frame(); - if (frame->script()->canExecuteScripts(NotAboutToExecuteScript)) - return worldContext.adjustedContext(proxy); - } + if (V8Proxy* proxy = V8Proxy::retrieve(context)) + return worldContext.adjustedContext(proxy); #if ENABLE(WORKERS) } else if (context->isWorkerContext()) { if (WorkerContextExecutionProxy* proxy = static_cast<WorkerContext*>(context)->script()->proxy()) diff --git a/Source/WebCore/bindings/v8/V8Proxy.h b/Source/WebCore/bindings/v8/V8Proxy.h index 176a84d43..fe49563ca 100644 --- a/Source/WebCore/bindings/v8/V8Proxy.h +++ b/Source/WebCore/bindings/v8/V8Proxy.h @@ -57,7 +57,6 @@ namespace WebCore { class DOMWindow; class Frame; class Node; - class Page; class ScriptExecutionContext; class ScriptSourceCode; class SecurityOrigin; @@ -162,7 +161,7 @@ namespace WebCore { v8::Local<v8::Value> callFunction(v8::Handle<v8::Function>, v8::Handle<v8::Object>, int argc, v8::Handle<v8::Value> argv[]); // call the function with the given receiver and arguments and report times to DevTools. - static v8::Local<v8::Value> instrumentedCallFunction(Page*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]); + static v8::Local<v8::Value> instrumentedCallFunction(Frame*, v8::Handle<v8::Function>, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[]); // Call the function as constructor with the given arguments. v8::Local<v8::Value> newInstance(v8::Handle<v8::Function>, int argc, v8::Handle<v8::Value> argv[]); diff --git a/Source/WebCore/bindings/v8/V8RecursionScope.cpp b/Source/WebCore/bindings/v8/V8RecursionScope.cpp index 3564fccff..cad7498c6 100644 --- a/Source/WebCore/bindings/v8/V8RecursionScope.cpp +++ b/Source/WebCore/bindings/v8/V8RecursionScope.cpp @@ -32,11 +32,12 @@ #include "V8RecursionScope.h" #include "IDBPendingTransactionMonitor.h" +#include "ScriptExecutionContext.h" #include "WebKitMutationObserver.h" namespace WebCore { -void V8RecursionScope::didLeaveScriptContext() +void V8RecursionScope::didLeaveScriptContext(ScriptExecutionContext* context) { // FIXME: Instrument any work that takes place when script exits to c++ (e.g. Mutation Observers). @@ -48,7 +49,8 @@ void V8RecursionScope::didLeaveScriptContext() #endif #if ENABLE(MUTATION_OBSERVERS) - WebKitMutationObserver::deliverAllMutations(); + if (context && context->isDocument()) + WebKitMutationObserver::deliverAllMutations(); #endif } diff --git a/Source/WebCore/bindings/v8/V8RecursionScope.h b/Source/WebCore/bindings/v8/V8RecursionScope.h index 38aae850e..6cfbbab1e 100644 --- a/Source/WebCore/bindings/v8/V8RecursionScope.h +++ b/Source/WebCore/bindings/v8/V8RecursionScope.h @@ -35,20 +35,29 @@ namespace WebCore { +class ScriptExecutionContext; + class V8RecursionScope { WTF_MAKE_NONCOPYABLE(V8RecursionScope); public: - V8RecursionScope() { V8BindingPerIsolateData::current()->incrementRecursionLevel(); } + explicit V8RecursionScope(ScriptExecutionContext* context) + : m_context(context) + { + V8BindingPerIsolateData::current()->incrementRecursionLevel(); + } + ~V8RecursionScope() { if (!V8BindingPerIsolateData::current()->decrementRecursionLevel()) - didLeaveScriptContext(); + didLeaveScriptContext(m_context); } static int recursionLevel() { return V8BindingPerIsolateData::current()->recursionLevel(); } private: - static void didLeaveScriptContext(); + static void didLeaveScriptContext(ScriptExecutionContext*); + + ScriptExecutionContext* m_context; }; } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp b/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp index 797c624e0..2379723c8 100644 --- a/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp +++ b/Source/WebCore/bindings/v8/V8WindowErrorHandler.cpp @@ -58,7 +58,7 @@ v8::Local<v8::Value> V8WindowErrorHandler::callListenerFunction(ScriptExecutionC v8::Handle<v8::Value> parameters[3] = { v8String(errorEvent->message()), v8String(errorEvent->filename()), v8::Integer::New(errorEvent->lineno()) }; v8::TryCatch tryCatch; tryCatch.SetVerbose(true); - returnValue = V8Proxy::instrumentedCallFunction(0 /* page */, callFunction, thisValue, 3, parameters); + returnValue = V8Proxy::instrumentedCallFunction(0 /* frame */, callFunction, thisValue, 3, parameters); } return returnValue; } diff --git a/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp b/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp index e3a2a037d..da4275015 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp @@ -83,8 +83,8 @@ bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8 v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global(); - Page* page = scriptExecutionContext && scriptExecutionContext->isDocument() ? static_cast<Document*>(scriptExecutionContext)->page() : 0; - v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(page, callbackFunction, thisObject, argc, argv); + Frame* frame = scriptExecutionContext && scriptExecutionContext->isDocument() ? static_cast<Document*>(scriptExecutionContext)->frame() : 0; + v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(frame, callbackFunction, thisObject, argc, argv); callbackReturnValue = !result.IsEmpty() && result->BooleanValue(); return exceptionCatcher.HasCaught(); diff --git a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp index a126dd0bf..0b5db9862 100644 --- a/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp +++ b/Source/WebCore/bindings/v8/custom/V8CustomXPathNSResolver.cpp @@ -79,7 +79,7 @@ String V8CustomXPathNSResolver::lookupNamespaceURI(const String& prefix) v8::Handle<v8::Value> argv[argc] = { v8String(prefix) }; v8::Handle<v8::Function> function = lookupNamespaceURIFunc.IsEmpty() ? v8::Handle<v8::Function>::Cast(m_resolver) : lookupNamespaceURIFunc; - v8::Handle<v8::Value> retval = V8Proxy::instrumentedCallFunction(0 /* page */, function, m_resolver, argc, argv); + v8::Handle<v8::Value> retval = V8Proxy::instrumentedCallFunction(0 /* frame */, function, m_resolver, argc, argv); // Eat exceptions from namespace resolver and return an empty string. This will most likely cause NAMESPACE_ERR. if (try_catch.HasCaught()) diff --git a/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp b/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp index 2799ae2c8..8e7f6b053 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8DOMStringMapCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -84,19 +84,4 @@ v8::Handle<v8::Value> V8DOMStringMap::namedPropertySetter(v8::Local<v8::String> return value; } -v8::Handle<v8::Value> toV8(DOMStringMap* impl) -{ - if (!impl) - return v8::Null(); - v8::Handle<v8::Object> wrapper = V8DOMStringMap::wrap(impl); - // Add a hidden reference from the element to the DOMStringMap. - Element* element = impl->element(); - if (!wrapper.IsEmpty() && element) { - v8::Handle<v8::Value> elementValue = toV8(element); - if (!elementValue.IsEmpty() && elementValue->IsObject()) - V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domStringMap", wrapper); - } - return wrapper; -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp index 89561090c..a1bd76b2a 100644 --- a/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8HistoryCustom.cpp @@ -41,6 +41,24 @@ namespace WebCore { +v8::Handle<v8::Value> V8History::stateAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) +{ + INC_STATS("DOM.History.state"); + History* history = V8History::toNative(info.Holder()); + + v8::Handle<v8::String> propertyName = v8::String::NewSymbol("state"); + v8::Handle<v8::Value> value = info.Holder()->GetHiddenValue(propertyName); + + if (!value.IsEmpty() && !history->stateChanged()) + return value; + + SerializedScriptValue* serialized = history->state(); + value = serialized ? serialized->deserialize() : v8::Handle<v8::Value>(v8::Null()); + info.Holder()->SetHiddenValue(propertyName, value); + + return value; +} + v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args) { bool didThrow = false; @@ -62,6 +80,7 @@ v8::Handle<v8::Value> V8History::pushStateCallback(const v8::Arguments& args) ExceptionCode ec = 0; History* history = V8History::toNative(args.Holder()); history->stateObjectAdded(historyState.release(), title, url, History::StateObjectPush, ec); + args.Holder()->DeleteHiddenValue(v8::String::NewSymbol("state")); return throwError(ec); } @@ -86,6 +105,7 @@ v8::Handle<v8::Value> V8History::replaceStateCallback(const v8::Arguments& args) ExceptionCode ec = 0; History* history = V8History::toNative(args.Holder()); history->stateObjectAdded(historyState.release(), title, url, History::StateObjectReplace, ec); + args.Holder()->DeleteHiddenValue(v8::String::NewSymbol("state")); return throwError(ec); } diff --git a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp index 9145de318..3aa444c9d 100644 --- a/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8InjectedScriptHostCustom.cpp @@ -66,22 +66,6 @@ ScriptValue InjectedScriptHost::nodeAsScriptValue(ScriptState* state, Node* node return ScriptValue(toV8(node)); } -v8::Handle<v8::Value> V8InjectedScriptHost::evaluateCallback(const v8::Arguments& args) -{ - INC_STATS("InjectedScriptHost.evaluate()"); - if (args.Length() < 1) - return v8::ThrowException(v8::Exception::Error(v8::String::New("One argument expected."))); - - v8::Handle<v8::String> expression = args[0]->ToString(); - if (expression.IsEmpty()) - return v8::ThrowException(v8::Exception::Error(v8::String::New("The argument must be a string."))); - - v8::Handle<v8::Script> script = v8::Script::Compile(expression); - if (script.IsEmpty()) // Return immediately in case of exception to let the caller handle it. - return v8::Handle<v8::Value>(); - return script->Run(); -} - v8::Handle<v8::Value> V8InjectedScriptHost::inspectedNodeCallback(const v8::Arguments& args) { INC_STATS("InjectedScriptHost.inspectedNode()"); diff --git a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp index 4782dcc32..90e8fd626 100644 --- a/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8NamedNodeMapCustom.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 Google Inc. All rights reserved. + * Copyright (C) 2007-2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -71,16 +71,4 @@ v8::Handle<v8::Value> V8NamedNodeMap::namedPropertyGetter(v8::Local<v8::String> return toV8(result.release()); } -v8::Handle<v8::Value> toV8(NamedNodeMap* impl) -{ - if (!impl) - return v8::Null(); - v8::Handle<v8::Object> wrapper = V8NamedNodeMap::wrap(impl); - // Add a hidden reference from named node map to its owner node. - Element* element = impl->element(); - if (!wrapper.IsEmpty() && element) - V8DOMWrapper::setNamedHiddenReference(wrapper, "ownerNode", toV8(element)); - return wrapper; -} - } // namespace WebCore diff --git a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp index de14d4354..c07868858 100644 --- a/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp +++ b/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp @@ -55,7 +55,7 @@ #include "V8Uint32Array.h" #include "V8Uint8Array.h" #include "V8WebGLBuffer.h" -#include "V8WebGLCompressedTextures.h" +#include "V8WebGLCompressedTextureS3TC.h" #include "V8WebGLDebugRendererInfo.h" #include "V8WebGLDebugShaders.h" #include "V8WebGLFramebuffer.h" @@ -154,6 +154,8 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info) return toV8(info.getWebGLTexture()); case WebGLGetInfo::kTypeWebGLUnsignedByteArray: return toV8(info.getWebGLUnsignedByteArray()); + case WebGLGetInfo::kTypeWebGLUnsignedIntArray: + return toV8(info.getWebGLUnsignedIntArray()); case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: return toV8(info.getWebGLVertexArrayObjectOES()); default: @@ -193,9 +195,9 @@ static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8 extensionObject = toV8(static_cast<WebGLDebugShaders*>(extension)); referenceName = "webGLDebugShadersName"; break; - case WebGLExtension::WebKitWebGLCompressedTexturesName: - extensionObject = toV8(static_cast<WebGLCompressedTextures*>(extension)); - referenceName = "webKitWebGLCompressedTexturesName"; + case WebGLExtension::WebKitWebGLCompressedTextureS3TCName: + extensionObject = toV8(static_cast<WebGLCompressedTextureS3TC*>(extension)); + referenceName = "webKitWebGLCompressedTextureS3TCName"; break; } ASSERT(!extensionObject.IsEmpty()); diff --git a/Source/WebCore/css/CSSAllInOne.cpp b/Source/WebCore/css/CSSAllInOne.cpp index 7d5f250d1..0065a2690 100644 --- a/Source/WebCore/css/CSSAllInOne.cpp +++ b/Source/WebCore/css/CSSAllInOne.cpp @@ -48,7 +48,6 @@ #include "CSSInitialValue.cpp" #include "CSSLineBoxContainValue.cpp" #include "CSSMediaRule.cpp" -#include "CSSMutableStyleDeclaration.cpp" #include "CSSOMUtils.cpp" #include "CSSPageRule.cpp" #include "CSSParser.cpp" @@ -72,3 +71,4 @@ #include "CSSValueList.cpp" #include "CSSValuePool.cpp" #include "CSSWrapShapes.cpp" +#include "StylePropertySet.cpp" diff --git a/Source/WebCore/css/CSSCalculationValue.cpp b/Source/WebCore/css/CSSCalculationValue.cpp index 11907f280..972d62b31 100755 --- a/Source/WebCore/css/CSSCalculationValue.cpp +++ b/Source/WebCore/css/CSSCalculationValue.cpp @@ -76,6 +76,11 @@ String CSSCalcValue::customCssText() const { return ""; } + +double CSSCalcValue::doubleValue() const +{ + return m_expression->doubleValue(); +} CSSCalcExpressionNode::~CSSCalcExpressionNode() { @@ -94,7 +99,21 @@ public: return m_value->cssText(); } - + virtual double doubleValue() const + { + switch (m_category) { + case CalcNumber: + case CalcPercent: + return m_value->getDoubleValue(); + case CalcLength: + case CalcPercentLength: + case CalcPercentNumber: + case CalcOther: + ASSERT_NOT_REACHED(); + break; + } + return 0; + } private: explicit CSSCalcPrimitiveValue(CSSPrimitiveValue* value, bool isInteger) : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value->primitiveType()), isInteger) @@ -152,6 +171,11 @@ public: return adoptRef(new CSSCalcBinaryOperation(leftSide, rightSide, op, newCategory)); } + virtual double doubleValue() const + { + return evaluate(m_leftSide->doubleValue(), m_rightSide->doubleValue()); + } + private: CSSCalcBinaryOperation(PassRefPtr<CSSCalcExpressionNode> leftSide, PassRefPtr<CSSCalcExpressionNode> rightSide, CalcOperator op, CalculationCategory category) : CSSCalcExpressionNode(category, leftSide->isInteger() && rightSide->isInteger()) @@ -161,6 +185,27 @@ private: { } + double evaluate(double leftValue, double rightValue) const + { + switch (m_operator) { + case CalcAdd: + return leftValue + rightValue; + case CalcSubtract: + return leftValue - rightValue; + case CalcMultiply: + return leftValue * rightValue; + case CalcDivide: + if (rightValue) + return leftValue / rightValue; + return std::numeric_limits<double>::quiet_NaN(); + case CalcMod: + // FIXME calc() : mod has been removed from the spec, need to remove + // this enum value + return 0; + } + return 0; + } + const RefPtr<CSSCalcExpressionNode> m_leftSide; const RefPtr<CSSCalcExpressionNode> m_rightSide; const CalcOperator m_operator; diff --git a/Source/WebCore/css/CSSCalculationValue.h b/Source/WebCore/css/CSSCalculationValue.h index 4d4639d11..b33b30f9f 100755 --- a/Source/WebCore/css/CSSCalculationValue.h +++ b/Source/WebCore/css/CSSCalculationValue.h @@ -58,7 +58,8 @@ enum CalculationCategory { class CSSCalcExpressionNode : public RefCounted<CSSCalcExpressionNode> { public: - virtual ~CSSCalcExpressionNode() = 0; + virtual ~CSSCalcExpressionNode() = 0; + virtual double doubleValue() const = 0; CalculationCategory category() const { return m_category; } bool isInteger() const { return m_isInteger; } @@ -80,7 +81,8 @@ public: static PassRefPtr<CSSCalcValue> create(CSSParserString name, CSSParserValueList*); CalculationCategory category() const { return m_expression->category(); } - bool isInt() const { return m_expression->isInteger(); } + bool isInt() const { return m_expression->isInteger(); } + double doubleValue() const; String customCssText() const; diff --git a/Source/WebCore/css/CSSCharsetRule.idl b/Source/WebCore/css/CSSCharsetRule.idl index 87f796aff..be23871d0 100644 --- a/Source/WebCore/css/CSSCharsetRule.idl +++ b/Source/WebCore/css/CSSCharsetRule.idl @@ -25,7 +25,7 @@ module css { #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C readonly attribute [ConvertNullStringTo=Null] DOMString encoding; #else - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString encoding + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString encoding setter raises(DOMException); #endif }; diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 90f98c8d3..d0131eed0 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> * Copyright (C) 2011 Sencha, Inc. All rights reserved. @@ -28,7 +28,6 @@ #include "CSSAspectRatioValue.h" #include "CSSBorderImage.h" #include "CSSLineBoxContainValue.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSPrimitiveValue.h" #include "CSSPrimitiveValueMappings.h" @@ -58,6 +57,7 @@ #include "RenderLayer.h" #include "RenderStyle.h" #include "ShadowValue.h" +#include "StylePropertySet.h" #if ENABLE(CSS_FILTERS) #include "StyleCustomFilterProgram.h" #include "WebKitCSSFilterValue.h" @@ -668,7 +668,7 @@ static PassRefPtr<CSSValue> computedTransform(RenderObject* renderer, const Rend if (!renderer || style->transform().operations().isEmpty()) return cssValuePool->createIdentifierValue(CSSValueNone); - IntRect box = sizingBox(renderer); + LayoutRect box = sizingBox(renderer); TransformationMatrix transform; style->applyTransform(transform, box.size(), RenderStyle::ExcludeTransformOrigin); @@ -2113,7 +2113,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper case CSSPropertyWebkitPerspectiveOrigin: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); if (renderer) { - IntRect box = sizingBox(renderer); + LayoutRect box = sizingBox(renderer); list->append(zoomAdjustedPixelValue(style->perspectiveOriginX().calcMinValue(box.width()), style.get(), cssValuePool)); list->append(zoomAdjustedPixelValue(style->perspectiveOriginY().calcMinValue(box.height()), style.get(), cssValuePool)); } @@ -2514,12 +2514,12 @@ bool CSSComputedStyleDeclaration::cssPropertyMatches(const CSSProperty* property return value && value->cssText() == property->value()->cssText(); } -PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copy() const +PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copy() const { return copyPropertiesInSet(computedProperties, numComputedProperties); } -PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::makeMutable() +PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::makeMutable() { return copy(); } @@ -2562,7 +2562,7 @@ PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::getCSSPropertyValuesForSid return list.release(); } -PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const +PassRefPtr<StylePropertySet> CSSComputedStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const { Vector<CSSProperty> list; list.reserveInitialCapacity(length); @@ -2571,7 +2571,12 @@ PassRefPtr<CSSMutableStyleDeclaration> CSSComputedStyleDeclaration::copyProperti if (value) list.append(CSSProperty(set[i], value.release(), false)); } - return CSSMutableStyleDeclaration::create(list); + return StylePropertySet::create(list); +} + +CSSRule* CSSComputedStyleDeclaration::parentRule() const +{ + return 0; } PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(const String& propertyName) diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.h b/Source/WebCore/css/CSSComputedStyleDeclaration.h index b44a5cff0..2c504acb8 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.h +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Zack Rusin <zack@kde.org> - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,15 +28,15 @@ namespace WebCore { -class Color; -class CSSMutableStyleDeclaration; class CSSPrimitiveValue; class CSSValueList; class CSSValuePool; +class Color; class Node; class RenderStyle; -class ShadowData; class SVGPaint; +class ShadowData; +class StylePropertySet; #if ENABLE(CSS_SHADERS) class CustomFilterNumberParameter; @@ -54,8 +54,8 @@ public: String getPropertyValue(int propertyID) const; bool getPropertyPriority(int propertyID) const; - virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const; - virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable(); + virtual PassRefPtr<StylePropertySet> copy() const; + virtual PassRefPtr<StylePropertySet> makeMutable(); PassRefPtr<CSSValue> getPropertyCSSValue(int propertyID, EUpdateLayout) const; PassRefPtr<CSSValue> getFontSizeCSSValuePreferringKeyword() const; @@ -64,12 +64,13 @@ public: PassRefPtr<CSSValue> getSVGPropertyCSSValue(int propertyID, EUpdateLayout) const; #endif - PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const; + PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const; private: CSSComputedStyleDeclaration(PassRefPtr<Node>, bool allowVisitedStyle, const String&); // CSSOM functions. Don't make these public. + virtual CSSRule* parentRule() const; virtual unsigned length() const; virtual String item(unsigned index) const; virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName); diff --git a/Source/WebCore/css/CSSFontFaceRule.cpp b/Source/WebCore/css/CSSFontFaceRule.cpp index 53d605dbd..8f50c26ac 100644 --- a/Source/WebCore/css/CSSFontFaceRule.cpp +++ b/Source/WebCore/css/CSSFontFaceRule.cpp @@ -22,7 +22,7 @@ #include "config.h" #include "CSSFontFaceRule.h" -#include "CSSMutableStyleDeclaration.h" +#include "StylePropertySet.h" namespace WebCore { diff --git a/Source/WebCore/css/CSSFontFaceRule.h b/Source/WebCore/css/CSSFontFaceRule.h index 545c90a63..2ca0a1069 100644 --- a/Source/WebCore/css/CSSFontFaceRule.h +++ b/Source/WebCore/css/CSSFontFaceRule.h @@ -22,8 +22,8 @@ #ifndef CSSFontFaceRule_h #define CSSFontFaceRule_h -#include "CSSMutableStyleDeclaration.h" #include "CSSRule.h" +#include "StylePropertySet.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -42,19 +42,19 @@ public: ~CSSFontFaceRule(); - CSSStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); } String cssText() const; - CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } - void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style) { m_style = style; } + StylePropertySet* declaration() const { return m_style.get(); } + void setDeclaration(PassRefPtr<StylePropertySet> style) { m_style = style; } void addSubresourceStyleURLs(ListHashSet<KURL>& urls); private: CSSFontFaceRule(CSSStyleSheet* parent); - RefPtr<CSSMutableStyleDeclaration> m_style; + RefPtr<StylePropertySet> m_style; }; } // namespace WebCore diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp index b13fffdda..02977422e 100644 --- a/Source/WebCore/css/CSSFontSelector.cpp +++ b/Source/WebCore/css/CSSFontSelector.cpp @@ -32,7 +32,6 @@ #include "CSSFontFaceRule.h" #include "CSSFontFaceSource.h" #include "CSSFontFaceSrcValue.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSPropertyNames.h" #include "CSSSegmentedFontFace.h" @@ -48,6 +47,7 @@ #include "RenderObject.h" #include "Settings.h" #include "SimpleFontData.h" +#include "StylePropertySet.h" #include "WebKitFontFamilyNames.h" #include <wtf/text/AtomicString.h> @@ -86,7 +86,7 @@ bool CSSFontSelector::isEmpty() const void CSSFontSelector::addFontFaceRule(const CSSFontFaceRule* fontFaceRule) { // Obtain the font-family property and the src property. Both must be defined. - const CSSMutableStyleDeclaration* style = fontFaceRule->declaration(); + const StylePropertySet* style = fontFaceRule->declaration(); RefPtr<CSSValue> fontFamily = style->getPropertyCSSValue(CSSPropertyFontFamily); RefPtr<CSSValue> src = style->getPropertyCSSValue(CSSPropertySrc); RefPtr<CSSValue> unicodeRange = style->getPropertyCSSValue(CSSPropertyUnicodeRange); diff --git a/Source/WebCore/css/CSSMediaRule.idl b/Source/WebCore/css/CSSMediaRule.idl index cf1a488b5..c62ac9b77 100644 --- a/Source/WebCore/css/CSSMediaRule.idl +++ b/Source/WebCore/css/CSSMediaRule.idl @@ -25,7 +25,7 @@ module css { readonly attribute MediaList media; readonly attribute CSSRuleList cssRules; - [OldStyleObjC] unsigned long insertRule(in [Optional=CallWithDefaultValue] DOMString rule, + [ObjCLegacyUnnamedParameters] unsigned long insertRule(in [Optional=CallWithDefaultValue] DOMString rule, in [Optional=CallWithDefaultValue] unsigned long index) raises(DOMException); void deleteRule(in [Optional=CallWithDefaultValue] unsigned long index) diff --git a/Source/WebCore/css/CSSPageRule.cpp b/Source/WebCore/css/CSSPageRule.cpp index 8da1ec448..359d0fbcd 100644 --- a/Source/WebCore/css/CSSPageRule.cpp +++ b/Source/WebCore/css/CSSPageRule.cpp @@ -22,7 +22,7 @@ #include "config.h" #include "CSSPageRule.h" -#include "CSSMutableStyleDeclaration.h" +#include "StylePropertySet.h" #include <wtf/Vector.h> namespace WebCore { diff --git a/Source/WebCore/css/CSSPageRule.h b/Source/WebCore/css/CSSPageRule.h index 59e9dcf65..687114968 100644 --- a/Source/WebCore/css/CSSPageRule.h +++ b/Source/WebCore/css/CSSPageRule.h @@ -28,7 +28,6 @@ namespace WebCore { -class CSSMutableStyleDeclaration; class CSSSelector; class CSSSelectorList; diff --git a/Source/WebCore/css/CSSPageRule.idl b/Source/WebCore/css/CSSPageRule.idl index a71c24ba8..4f3747ea0 100644 --- a/Source/WebCore/css/CSSPageRule.idl +++ b/Source/WebCore/css/CSSPageRule.idl @@ -23,7 +23,7 @@ module css { // Introduced in DOM Level 2: interface CSSPageRule : CSSRule { - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString selectorText; + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString selectorText; readonly attribute CSSStyleDeclaration style; diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index ac8d177e5..8a1075171 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -42,7 +42,6 @@ #include "CSSInitialValue.h" #include "CSSLineBoxContainValue.h" #include "CSSMediaRule.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPageRule.h" #include "CSSPrimitiveValue.h" #include "CSSProperty.h" @@ -75,6 +74,7 @@ #include "RenderTheme.h" #include "Settings.h" #include "ShadowValue.h" +#include "StylePropertySet.h" #if ENABLE(CSS_FILTERS) #include "WebKitCSSFilterValue.h" #endif @@ -326,7 +326,7 @@ static inline bool isColorPropertyID(int propertyId) } } -static bool parseColorValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0) +static bool parseColorValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0) { if (!string.length()) return false; @@ -346,7 +346,7 @@ static bool parseColorValue(CSSMutableStyleDeclaration* declaration, int propert validPrimitive = true; } - CSSStyleSheet* styleSheet = contextStyleSheet ? contextStyleSheet : declaration->parentStyleSheet(); + CSSStyleSheet* styleSheet = contextStyleSheet ? contextStyleSheet : declaration->contextStyleSheet(); if (!styleSheet) return false; Document* document = styleSheet->findDocument(); @@ -409,7 +409,7 @@ static inline bool isSimpleLengthPropertyID(int propertyId, bool& acceptsNegativ } } -static bool parseSimpleLengthValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict, CSSStyleSheet* contextStyleSheet = 0) +static bool parseSimpleLengthValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict) { bool acceptsNegativeNumbers; unsigned length = string.length(); @@ -473,7 +473,7 @@ static bool parseSimpleLengthValue(CSSMutableStyleDeclaration* declaration, int if (number < 0 && !acceptsNegativeNumbers) return false; - CSSStyleSheet* styleSheet = contextStyleSheet ? contextStyleSheet : declaration->parentStyleSheet(); + CSSStyleSheet* styleSheet = declaration->contextStyleSheet(); if (!styleSheet) return false; Document* document = styleSheet->findDocument(); @@ -484,21 +484,7 @@ static bool parseSimpleLengthValue(CSSMutableStyleDeclaration* declaration, int return true; } -bool CSSParser::parseMappedAttributeValue(CSSMappedAttributeDeclaration* mappedAttribute, StyledElement* element, int propertyId, const String& value) -{ - ASSERT(mappedAttribute); - ASSERT(element); - ASSERT(element->document()); - CSSStyleSheet* elementSheet = element->document()->elementSheet(); - if (parseSimpleLengthValue(mappedAttribute->declaration(), propertyId, value, false, false, elementSheet)) - return true; - if (parseColorValue(mappedAttribute->declaration(), propertyId, value, false, false, elementSheet)) - return true; - CSSParser parser(false); - return parser.parseValue(mappedAttribute->declaration(), propertyId, value, false, elementSheet); -} - -bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, bool strict) +bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, bool strict) { if (parseSimpleLengthValue(declaration, propertyId, string, important, strict)) return true; @@ -508,12 +494,12 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int property return parser.parseValue(declaration, propertyId, string, important); } -bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet) +bool CSSParser::parseValue(StylePropertySet* declaration, int propertyId, const String& string, bool important, CSSStyleSheet* contextStyleSheet) { if (contextStyleSheet) setStyleSheet(contextStyleSheet); else - setStyleSheet(declaration->parentStyleSheet()); + setStyleSheet(declaration->contextStyleSheet()); setupParser("@-webkit-value{", string, "} "); @@ -608,7 +594,7 @@ void CSSParser::parseSelector(const String& string, Document* doc, CSSSelectorLi ASSERT(dummyStyleSheet->hasOneRef()); } -bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet) +bool CSSParser::parseDeclaration(StylePropertySet* declaration, const String& string, RefPtr<CSSStyleSourceData>* styleSourceData, CSSStyleSheet* contextStyleSheet) { // Length of the "@-webkit-decls{" prefix. static const unsigned prefixLength = 15; @@ -616,7 +602,7 @@ bool CSSParser::parseDeclaration(CSSMutableStyleDeclaration* declaration, const if (contextStyleSheet) setStyleSheet(contextStyleSheet); else - setStyleSheet(declaration->parentStyleSheet()); + setStyleSheet(declaration->contextStyleSheet()); if (styleSourceData) { m_currentRuleData = CSSRuleSourceData::create(); m_currentRuleData->styleSourceData = CSSStyleSourceData::create(); @@ -3390,7 +3376,7 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationDelay() PassRefPtr<CSSValue> CSSParser::parseAnimationDirection() { CSSParserValue* value = m_valueList->current(); - if (value->id == CSSValueNormal || value->id == CSSValueAlternate) + if (value->id == CSSValueNormal || value->id == CSSValueAlternate || value->id == CSSValueReverse || value->id == CSSValueAlternateReverse) return cssValuePool()->createIdentifierValue(value->id); return 0; } @@ -4963,9 +4949,7 @@ bool CSSParser::fastParseColor(RGBA32& rgb, const String& name, bool strict) inline double CSSParser::parsedDouble(CSSParserValue *v, ReleaseParsedCalcValueCondition releaseCalc) { - // FIXME calc (http://webkit.org/b/16662): evaluate calc here, eg - // const double result = m_parsedCalculation ? m_parsedCalculation->doubleValue() : v->fValue; - const double result = m_parsedCalculation ? 0 : v->fValue; + const double result = m_parsedCalculation ? m_parsedCalculation->doubleValue() : v->fValue; if (releaseCalc == ReleaseParsedCalcValue) m_parsedCalculation.release(); return result; @@ -8847,7 +8831,7 @@ CSSRule* CSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selector rule->adoptSelectorVector(*selectors); if (m_hasFontFaceOnlyValues) deleteFontFaceOnlyValues(); - rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties)); + rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); result = rule.get(); m_parsedRules.append(rule.release()); if (m_ruleRangeMap) { @@ -8886,7 +8870,7 @@ CSSRule* CSSParser::createFontFaceRule() } } RefPtr<CSSFontFaceRule> rule = CSSFontFaceRule::create(m_styleSheet); - rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties)); + rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); clearProperties(); CSSFontFaceRule* result = rule.get(); m_parsedRules.append(rule.release()); @@ -8957,7 +8941,7 @@ CSSRule* CSSParser::createPageRule(PassOwnPtr<CSSParserSelector> pageSelector) Vector<OwnPtr<CSSParserSelector> > selectorVector; selectorVector.append(pageSelector); rule->adoptSelectorVector(selectorVector); - rule->setDeclaration(CSSMutableStyleDeclaration::create(rule.get(), m_parsedProperties, m_numParsedProperties)); + rule->setDeclaration(StylePropertySet::create(rule.get(), m_parsedProperties, m_numParsedProperties)); pageRule = rule.get(); m_parsedRules.append(rule.release()); } @@ -9041,7 +9025,7 @@ WebKitCSSKeyframeRule* CSSParser::createKeyframeRule(CSSParserValueList* keys) RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create(m_styleSheet); keyframe->setKeyText(keyString); - keyframe->setDeclaration(CSSMutableStyleDeclaration::create(keyframe.get(), m_parsedProperties, m_numParsedProperties)); + keyframe->setDeclaration(StylePropertySet::create(keyframe.get(), m_parsedProperties, m_numParsedProperties)); clearProperties(); diff --git a/Source/WebCore/css/CSSParser.h b/Source/WebCore/css/CSSParser.h index b7384eee9..5527d3616 100644 --- a/Source/WebCore/css/CSSParser.h +++ b/Source/WebCore/css/CSSParser.h @@ -43,8 +43,6 @@ namespace WebCore { class CSSBorderImageSliceValue; -class CSSMappedAttributeDeclaration; -class CSSMutableStyleDeclaration; class CSSPrimitiveValue; class CSSValuePool; class CSSProperty; @@ -58,6 +56,7 @@ class CSSWrapShape; class Document; class MediaList; class MediaQueryExp; +class StylePropertySet; class StyledElement; class WebKitCSSKeyframeRule; class WebKitCSSKeyframesRule; @@ -70,15 +69,13 @@ public: void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0); PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&); PassRefPtr<WebKitCSSKeyframeRule> parseKeyframeRule(CSSStyleSheet*, const String&); - static bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict); + static bool parseValue(StylePropertySet*, int propId, const String&, bool important, bool strict); static bool parseColor(RGBA32& color, const String&, bool strict = false); static bool parseSystemColor(RGBA32& color, const String&, Document*); PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*); - bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0); + bool parseDeclaration(StylePropertySet*, const String&, RefPtr<CSSStyleSourceData>* = 0, CSSStyleSheet* contextStyleSheet = 0); bool parseMediaQuery(MediaList*, const String&); - static bool parseMappedAttributeValue(CSSMappedAttributeDeclaration*, StyledElement*, int propertyId, const String&); - Document* findDocument() const; CSSValuePool* cssValuePool() const { return m_cssValuePool.get(); } @@ -358,7 +355,7 @@ private: bool isGeneratedImageValue(CSSParserValue*) const; bool parseGeneratedImage(CSSParserValueList*, RefPtr<CSSValue>&); - bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0); + bool parseValue(StylePropertySet*, int propId, const String&, bool important, CSSStyleSheet* contextStyleSheet = 0); enum SizeParameterType { None, diff --git a/Source/WebCore/css/CSSPrimitiveValue.idl b/Source/WebCore/css/CSSPrimitiveValue.idl index 04f17048c..8d44737e9 100644 --- a/Source/WebCore/css/CSSPrimitiveValue.idl +++ b/Source/WebCore/css/CSSPrimitiveValue.idl @@ -51,12 +51,12 @@ module css { readonly attribute unsigned short primitiveType; - [OldStyleObjC] void setFloatValue(in [Optional=CallWithDefaultValue] unsigned short unitType, + [ObjCLegacyUnnamedParameters] void setFloatValue(in [Optional=CallWithDefaultValue] unsigned short unitType, in [Optional=CallWithDefaultValue] float floatValue) raises(DOMException); float getFloatValue(in [Optional=CallWithDefaultValue] unsigned short unitType) raises(DOMException); - [OldStyleObjC] void setStringValue(in [Optional=CallWithDefaultValue] unsigned short stringType, + [ObjCLegacyUnnamedParameters] void setStringValue(in [Optional=CallWithDefaultValue] unsigned short stringType, in [Optional=CallWithDefaultValue] DOMString stringValue) raises(DOMException); DOMString getStringValue() diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index c5916466c..a2434dde7 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -1396,7 +1396,15 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e) template<> inline CSSPrimitiveValue::operator EListStylePosition() const { - return (EListStylePosition)(m_value.ident - CSSValueOutside); + switch (m_value.ident) { + case CSSValueOutside: + return OUTSIDE; + case CSSValueInside: + return INSIDE; + default: + ASSERT_NOT_REACHED(); + return OUTSIDE; + } } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e) @@ -2285,7 +2293,17 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e) template<> inline CSSPrimitiveValue::operator EUserModify() const { - return static_cast<EUserModify>(m_value.ident - CSSValueReadOnly); + switch (m_value.ident) { + case CSSValueReadOnly: + return READ_ONLY; + case CSSValueReadWrite: + return READ_WRITE; + case CSSValueReadWritePlaintextOnly: + return READ_WRITE_PLAINTEXT_ONLY; + default: + ASSERT_NOT_REACHED(); + return READ_ONLY; + } } template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e) diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index ceb2798ec..92070f69e 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -376,3 +376,6 @@ z-index -webkit-grid-columns -webkit-grid-rows #endif +#if defined(ENABLE_DASHBOARD_SUPPORT) && ENABLE_DASHBOARD_SUPPORT +-webkit-dashboard-region +#endif diff --git a/Source/WebCore/css/CSSRule.idl b/Source/WebCore/css/CSSRule.idl index 69d7a8b45..279752662 100644 --- a/Source/WebCore/css/CSSRule.idl +++ b/Source/WebCore/css/CSSRule.idl @@ -22,10 +22,10 @@ module css { // Introduced in DOM Level 2: interface [ - CustomMarkFunction, - GenerateIsReachable, - CustomToJS, - Polymorphic, + JSCustomMarkFunction, + JSGenerateIsReachable, + JSCustomToJS, + ObjCPolymorphic, V8DependentLifetime ] CSSRule { @@ -43,7 +43,7 @@ module css { readonly attribute unsigned short type; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString cssText + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString cssText setter raises (DOMException); readonly attribute CSSStyleSheet parentStyleSheet; diff --git a/Source/WebCore/css/CSSRuleList.idl b/Source/WebCore/css/CSSRuleList.idl index ed86eaa26..eff029339 100644 --- a/Source/WebCore/css/CSSRuleList.idl +++ b/Source/WebCore/css/CSSRuleList.idl @@ -27,8 +27,8 @@ module css { // Introduced in DOM Level 2: interface [ - CustomIsReachable, - HasIndexGetter, + JSCustomIsReachable, + IndexedGetter, V8DependentLifetime ] CSSRuleList { readonly attribute unsigned long length; diff --git a/Source/WebCore/css/CSSStyleApplyProperty.cpp b/Source/WebCore/css/CSSStyleApplyProperty.cpp index 629470b89..524ed773c 100644 --- a/Source/WebCore/css/CSSStyleApplyProperty.cpp +++ b/Source/WebCore/css/CSSStyleApplyProperty.cpp @@ -349,6 +349,8 @@ public: static void setValue(RenderStyle* style, Length value) { (style->*setterFunction)(value); } static void applyValue(CSSStyleSelector* selector, CSSValue* value) { + float positiveFlex = 0; + float negativeFlex = 0; if (!value->isPrimitiveValue()) { if (!flexDirection || !value->isFlexValue()) return; @@ -356,13 +358,16 @@ public: CSSFlexValue* flexValue = static_cast<CSSFlexValue*>(value); value = flexValue->preferredSize(); - if (flexDirection == FlexWidth) { - selector->style()->setFlexboxWidthPositiveFlex(flexValue->positiveFlex()); - selector->style()->setFlexboxWidthNegativeFlex(flexValue->negativeFlex()); - } else if (flexDirection == FlexHeight) { - selector->style()->setFlexboxHeightPositiveFlex(flexValue->positiveFlex()); - selector->style()->setFlexboxHeightNegativeFlex(flexValue->negativeFlex()); - } + positiveFlex = flexValue->positiveFlex(); + negativeFlex = flexValue->negativeFlex(); + } + + if (flexDirection == FlexWidth) { + selector->style()->setFlexboxWidthPositiveFlex(positiveFlex); + selector->style()->setFlexboxWidthNegativeFlex(negativeFlex); + } else if (flexDirection == FlexHeight) { + selector->style()->setFlexboxHeightPositiveFlex(positiveFlex); + selector->style()->setFlexboxHeightNegativeFlex(negativeFlex); } CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); diff --git a/Source/WebCore/css/CSSStyleDeclaration.cpp b/Source/WebCore/css/CSSStyleDeclaration.cpp index 133fea2b7..a71e00d30 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSStyleDeclaration.cpp @@ -1,6 +1,6 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -21,17 +21,9 @@ #include "config.h" #include "CSSStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" -#include "CSSParser.h" -#include "CSSProperty.h" -#include "CSSPropertyNames.h" -#include "CSSRule.h" -#include "Node.h" -#include "SVGElement.h" -#include "StyledElement.h" +#ifndef NDEBUG #include <wtf/ASCIICType.h> #include <wtf/text/CString.h> -#ifndef NDEBUG #include <stdio.h> #endif @@ -39,34 +31,6 @@ using namespace WTF; namespace WebCore { -CSSStyleDeclaration::CSSStyleDeclaration(CSSRule* parentRule) - : m_strictParsing(!parentRule || parentRule->useStrictParsing()) - , m_isInlineStyleDeclaration(false) - , m_parent(parentRule) -{ -} - -CSSStyleDeclaration::CSSStyleDeclaration(StyledElement* parentElement) - : m_strictParsing(false) - , m_isInlineStyleDeclaration(true) - , m_parent(parentElement) -{ -} - -CSSStyleSheet* CSSStyleDeclaration::parentStyleSheet() const -{ - if (m_isInlineStyleDeclaration) { - Document* document = m_parent.element ? m_parent.element->document() : 0; - return document ? document->elementSheet() : 0; - } - return m_parent.rule ? m_parent.rule->parentStyleSheet() : 0; -} - -bool CSSStyleDeclaration::isPropertyName(const String& propertyName) -{ - return cssPropertyID(propertyName); -} - #ifndef NDEBUG void CSSStyleDeclaration::showStyle() { diff --git a/Source/WebCore/css/CSSStyleDeclaration.h b/Source/WebCore/css/CSSStyleDeclaration.h index 12910da46..e5e7cb957 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.h +++ b/Source/WebCore/css/CSSStyleDeclaration.h @@ -1,6 +1,6 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -27,10 +27,10 @@ namespace WebCore { -class CSSMutableStyleDeclaration; class CSSProperty; class CSSStyleSheet; class CSSValue; +class StylePropertySet; class StyledElement; typedef int ExceptionCode; @@ -40,16 +40,7 @@ class CSSStyleDeclaration : public RefCounted<CSSStyleDeclaration> { public: virtual ~CSSStyleDeclaration() { } - static bool isPropertyName(const String&); - - CSSRule* parentRule() const { return m_isInlineStyleDeclaration ? 0 : m_parent.rule; } - void clearParentRule() { ASSERT(!m_isInlineStyleDeclaration); m_parent.rule = 0; } - - StyledElement* parentElement() const { ASSERT(m_isInlineStyleDeclaration); return m_parent.element; } - void clearParentElement() { ASSERT(m_isInlineStyleDeclaration); m_parent.element = 0; } - - CSSStyleSheet* parentStyleSheet() const; - + virtual CSSRule* parentRule() const = 0; virtual String cssText() const = 0; virtual void setCssText(const String&, ExceptionCode&) = 0; virtual unsigned length() const = 0; @@ -68,35 +59,18 @@ public: virtual String getPropertyValueInternal(CSSPropertyID) = 0; virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) = 0; - virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const = 0; - virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable() = 0; + virtual PassRefPtr<StylePropertySet> copy() const = 0; + virtual PassRefPtr<StylePropertySet> makeMutable() = 0; virtual bool cssPropertyMatches(const CSSProperty*) const = 0; - + virtual CSSStyleSheet* parentStyleSheet() const { return 0; } + #ifndef NDEBUG void showStyle(); #endif - bool isInlineStyleDeclaration() const { return m_isInlineStyleDeclaration; } - protected: - CSSStyleDeclaration(CSSRule* parentRule = 0); - CSSStyleDeclaration(StyledElement* parentElement); - - // The bits in this section are only used by specific subclasses but kept here - // to maximize struct packing. - - // CSSMutableStyleDeclaration bits: - bool m_strictParsing : 1; - bool m_isInlineStyleDeclaration : 1; - -private: - union Parent { - Parent(CSSRule* rule) : rule(rule) { } - Parent(StyledElement* element) : element(element) { } - CSSRule* rule; - StyledElement* element; - } m_parent; + CSSStyleDeclaration() { } }; } // namespace WebCore diff --git a/Source/WebCore/css/CSSStyleDeclaration.idl b/Source/WebCore/css/CSSStyleDeclaration.idl index 976130499..14683d1f1 100644 --- a/Source/WebCore/css/CSSStyleDeclaration.idl +++ b/Source/WebCore/css/CSSStyleDeclaration.idl @@ -22,24 +22,24 @@ module css { // Introduced in DOM Level 2: interface [ - CustomMarkFunction, - GenerateIsReachable=ImplRoot, - DelegatingPutFunction, - HasNameGetter, - HasIndexGetter, + JSCustomMarkFunction, + JSGenerateIsReachable=ImplRoot, + CustomNamedSetter, + NamedGetter, + IndexedGetter, CustomGetPropertyNames, V8DependentLifetime ] CSSStyleDeclaration { - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString cssText + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString cssText setter raises(DOMException); [ConvertNullStringTo=Null] DOMString getPropertyValue(in [Optional=CallWithDefaultValue] DOMString propertyName); - [JSCCustom] CSSValue getPropertyCSSValue(in [Optional=CallWithDefaultValue] DOMString propertyName); + [JSCustom] CSSValue getPropertyCSSValue(in [Optional=CallWithDefaultValue] DOMString propertyName); [ConvertNullStringTo=Null] DOMString removeProperty(in [Optional=CallWithDefaultValue] DOMString propertyName) raises(DOMException); [ConvertNullStringTo=Null] DOMString getPropertyPriority(in [Optional=CallWithDefaultValue] DOMString propertyName); - [OldStyleObjC] void setProperty(in [Optional=CallWithDefaultValue] DOMString propertyName, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString value, + [ObjCLegacyUnnamedParameters] void setProperty(in [Optional=CallWithDefaultValue] DOMString propertyName, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString value, in [Optional=CallWithDefaultValue] DOMString priority) raises(DOMException); diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp index 535e9f15d..ae56df9f9 100644 --- a/Source/WebCore/css/CSSStyleRule.cpp +++ b/Source/WebCore/css/CSSStyleRule.cpp @@ -22,12 +22,12 @@ #include "config.h" #include "CSSStyleRule.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPageRule.h" #include "CSSParser.h" #include "CSSSelector.h" #include "CSSStyleSheet.h" #include "Document.h" +#include "StylePropertySet.h" #include "StyledElement.h" #include "StyleSheet.h" @@ -98,7 +98,7 @@ String CSSStyleRule::selectorText() const void CSSStyleRule::setSelectorText(const String& selectorText) { Document* doc = 0; - if (CSSStyleSheet* styleSheet = m_style->parentStyleSheet()) + if (CSSStyleSheet* styleSheet = parentStyleSheet()) doc = styleSheet->findDocument(); if (!doc) return; diff --git a/Source/WebCore/css/CSSStyleRule.h b/Source/WebCore/css/CSSStyleRule.h index 713e68245..7fd12a162 100644 --- a/Source/WebCore/css/CSSStyleRule.h +++ b/Source/WebCore/css/CSSStyleRule.h @@ -22,9 +22,9 @@ #ifndef CSSStyleRule_h #define CSSStyleRule_h -#include "CSSMutableStyleDeclaration.h" #include "CSSRule.h" #include "CSSSelectorList.h" +#include "StylePropertySet.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -43,15 +43,15 @@ public: String selectorText() const; void setSelectorText(const String&); - CSSStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style->ensureCSSStyleDeclaration(); } String cssText() const; void adoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors) { m_selectorList.adoptSelectorVector(selectors); } - void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style) { ASSERT(style->parentRule() == this); m_style = style; } + void setDeclaration(PassRefPtr<StylePropertySet> style) { ASSERT(style->parentRuleInternal() == this); m_style = style; } const CSSSelectorList& selectorList() const { return m_selectorList; } - CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } + StylePropertySet* declaration() const { return m_style.get(); } void addSubresourceStyleURLs(ListHashSet<KURL>& urls); @@ -64,7 +64,7 @@ private: void cleanup(); String generateSelectorText() const; - RefPtr<CSSMutableStyleDeclaration> m_style; + RefPtr<StylePropertySet> m_style; CSSSelectorList m_selectorList; }; diff --git a/Source/WebCore/css/CSSStyleRule.idl b/Source/WebCore/css/CSSStyleRule.idl index aca408e29..c0a5e6822 100644 --- a/Source/WebCore/css/CSSStyleRule.idl +++ b/Source/WebCore/css/CSSStyleRule.idl @@ -23,7 +23,7 @@ module css { // Introduced in DOM Level 2: interface CSSStyleRule : CSSRule { - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString selectorText; + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString selectorText; readonly attribute CSSStyleDeclaration style; diff --git a/Source/WebCore/css/CSSStyleSelector.cpp b/Source/WebCore/css/CSSStyleSelector.cpp index abac39885..7d84a81a5 100644 --- a/Source/WebCore/css/CSSStyleSelector.cpp +++ b/Source/WebCore/css/CSSStyleSelector.cpp @@ -297,17 +297,17 @@ static const MediaQueryEvaluator& printEval() return staticPrintEval; } -static CSSMutableStyleDeclaration* leftToRightDeclaration() +static StylePropertySet* leftToRightDeclaration() { - DEFINE_STATIC_LOCAL(RefPtr<CSSMutableStyleDeclaration>, leftToRightDecl, (CSSMutableStyleDeclaration::create())); + DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, leftToRightDecl, (StylePropertySet::create())); if (leftToRightDecl->isEmpty()) leftToRightDecl->setProperty(CSSPropertyDirection, CSSValueLtr); return leftToRightDecl.get(); } -static CSSMutableStyleDeclaration* rightToLeftDeclaration() +static StylePropertySet* rightToLeftDeclaration() { - DEFINE_STATIC_LOCAL(RefPtr<CSSMutableStyleDeclaration>, rightToLeftDecl, (CSSMutableStyleDeclaration::create())); + DEFINE_STATIC_LOCAL(RefPtr<StylePropertySet>, rightToLeftDecl, (StylePropertySet::create())); if (rightToLeftDecl->isEmpty()) rightToLeftDecl->setProperty(CSSPropertyDirection, CSSValueRtl); return rightToLeftDecl.get(); @@ -747,7 +747,7 @@ static void ensureDefaultStyleSheetsForElement(Element* element) ASSERT_UNUSED(loadedMathMLUserAgentSheet, loadedMathMLUserAgentSheet || defaultStyle->features().siblingRules.isEmpty()); } -void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType) +void CSSStyleSelector::addMatchedDeclaration(StylePropertySet* styleDeclaration, unsigned linkMatchType) { m_matchedDecls.grow(m_matchedDecls.size() + 1); MatchedStyleDeclaration& newDeclaration = m_matchedDecls.last(); @@ -940,7 +940,7 @@ void CSSStyleSelector::collectMatchingRulesForList(const Vector<RuleData>* rules continue; } // If the rule has no properties to apply, then ignore it in the non-debug mode. - CSSMutableStyleDeclaration* decl = rule->declaration(); + StylePropertySet* decl = rule->declaration(); if (!decl || (decl->isEmpty() && !includeEmptyRules)) { InspectorInstrumentation::didMatchRule(cookie, false); continue; @@ -996,28 +996,24 @@ void CSSStyleSelector::matchAllRules(MatchResult& result) // Now check author rules, beginning first with presentational attributes mapped from HTML. if (m_styledElement) { - if (const NamedNodeMap* map = m_styledElement->attributeMap()) { - // Walk the element's attribute map and add all mapped attribute declarations. - for (unsigned i = 0; i < map->length(); ++i) { - Attribute* attribute = map->attributeItem(i); - if (!attribute->decl()) - continue; - ASSERT(attribute->isMappedAttribute()); - result.ranges.lastAuthorRule = m_matchedDecls.size(); + if (StylePropertySet* attributeStyle = m_styledElement->attributeStyle()) { + if (!attributeStyle->isEmpty()) { + result.ranges.lastAuthorRule = m_matchedRules.size(); if (result.ranges.firstAuthorRule == -1) result.ranges.firstAuthorRule = result.ranges.lastAuthorRule; - addMatchedDeclaration(attribute->decl()); + addMatchedDeclaration(attributeStyle); + result.isCacheable = false; } } // Now we check additional mapped declarations. // Tables and table cells share an additional mapped rule that must be applied // after all attributes, since their mapped style depends on the values of multiple attributes. - if (RefPtr<CSSMutableStyleDeclaration> additionalStyle = m_styledElement->additionalAttributeStyle()) { + if (StylePropertySet* additionalStyle = m_styledElement->additionalAttributeStyle()) { if (result.ranges.firstAuthorRule == -1) result.ranges.firstAuthorRule = m_matchedDecls.size(); result.ranges.lastAuthorRule = m_matchedDecls.size(); - addMatchedDeclaration(additionalStyle.get()); + addMatchedDeclaration(additionalStyle); result.isCacheable = false; } @@ -1035,7 +1031,7 @@ void CSSStyleSelector::matchAllRules(MatchResult& result) // Now check our inline style attribute. if (m_matchAuthorAndUserStyles && m_styledElement) { - CSSMutableStyleDeclaration* inlineDecl = m_styledElement->inlineStyleDecl(); + StylePropertySet* inlineDecl = m_styledElement->inlineStyleDecl(); if (inlineDecl) { result.ranges.lastAuthorRule = m_matchedDecls.size(); if (result.ranges.firstAuthorRule == -1) @@ -1178,37 +1174,46 @@ bool CSSStyleSelector::canShareStyleWithControl(StyledElement* element) const if (element->isDefaultButtonForForm() != m_element->isDefaultButtonForForm()) return false; - if (!m_element->document()->containsValidityStyleRules()) - return false; - - bool willValidate = element->willValidate(); + if (m_element->document()->containsValidityStyleRules()) { + bool willValidate = element->willValidate(); - if (willValidate != m_element->willValidate()) - return false; + if (willValidate != m_element->willValidate()) + return false; - if (willValidate && (element->isValidFormControlElement() != m_element->isValidFormControlElement())) - return false; + if (willValidate && (element->isValidFormControlElement() != m_element->isValidFormControlElement())) + return false; - if (element->isInRange() != m_element->isInRange()) - return false; + if (element->isInRange() != m_element->isInRange()) + return false; - if (element->isOutOfRange() != m_element->isOutOfRange()) - return false; + if (element->isOutOfRange() != m_element->isOutOfRange()) + return false; + } return true; } -static inline bool mappedAttributesEquivalent(NamedNodeMap* a, NamedNodeMap* b) +// This function makes some assumptions that only make sense for attribute styles (we only compare CSSProperty::id() and CSSProperty::value().) +static inline bool attributeStylesEqual(StylePropertySet* a, StylePropertySet* b) { - ASSERT(a->mappedAttributeCount() == b->mappedAttributeCount()); - - for (size_t i = 0; i < a->length(); ++i) { - Attribute* attribute = a->attributeItem(i); - if (!attribute->decl()) - continue; - ASSERT(attribute->isMappedAttribute()); - Attribute* otherAttribute = b->getAttributeItem(attribute->name()); - if (!otherAttribute || attribute->value() != otherAttribute->value() || attribute->decl() != otherAttribute->decl()) + if (a == b) + return true; + if (a->propertyCount() != b->propertyCount()) + return false; + unsigned propertyCount = a->propertyCount(); + for (unsigned i = 0; i < propertyCount; ++i) { + const CSSProperty& aProperty = a->propertyAt(i); + unsigned j; + for (j = 0; j < propertyCount; ++j) { + const CSSProperty& bProperty = b->propertyAt(j); + if (aProperty.id() != bProperty.id()) + continue; + // We could get a few more hits by comparing cssText() here, but that gets expensive quickly. + if (aProperty.value() != bProperty.value()) + return false; + break; + } + if (j == propertyCount) return false; } return true; @@ -1228,8 +1233,11 @@ bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const return false; if (element->inlineStyleDecl()) return false; - size_t mappedAttributeCount = element->mappedAttributeCount(); - if (mappedAttributeCount != m_styledElement->mappedAttributeCount()) + if (!!element->attributeStyle() != !!m_styledElement->attributeStyle()) + return false; + StylePropertySet* additionalAttributeStyleA = element->additionalAttributeStyle(); + StylePropertySet* additionalAttributeStyleB = m_styledElement->additionalAttributeStyle(); + if (!additionalAttributeStyleA != !additionalAttributeStyleB) return false; if (element->isLink() != m_element->isLink()) return false; @@ -1295,7 +1303,10 @@ bool CSSStyleSelector::canShareStyleWithElement(StyledElement* element) const if (element->hasClass() && m_element->getAttribute(classAttr) != element->getAttribute(classAttr)) return false; - if (mappedAttributeCount && !mappedAttributesEquivalent(element->attributeMap(), m_styledElement->attributeMap())) + if (element->attributeStyle() && !attributeStylesEqual(element->attributeStyle(), m_styledElement->attributeStyle())) + return false; + + if (additionalAttributeStyleA && !attributeStylesEqual(additionalAttributeStyleA, additionalAttributeStyleB)) return false; if (element->isLink() && m_elementLinkState != style->insideLink()) @@ -1403,6 +1414,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document, C documentStyle->setZoom(frame ? frame->pageZoomFactor() : 1); documentStyle->setPageScaleTransform(frame ? frame->frameScaleFactor() : 1); documentStyle->setUserModify(document->inDesignMode() ? READ_WRITE : READ_ONLY); + documentStyle->setLocale(document->contentLanguage()); Element* docElement = document->documentElement(); RenderObject* docElementRenderer = docElement ? docElement->renderer() : 0; @@ -1433,12 +1445,13 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document, C FontDescription fontDescription; fontDescription.setUsePrinterFont(document->printing()); + fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale())); if (Settings* settings = document->settings()) { fontDescription.setRenderingMode(settings->fontRenderingMode()); - const AtomicString& stdfont = settings->standardFontFamily(); - if (!stdfont.isEmpty()) { + const AtomicString& standardFont = settings->standardFontFamily(fontDescription.script()); + if (!standardFont.isEmpty()) { fontDescription.setGenericFamily(FontDescription::StandardFamily); - fontDescription.firstFamily().setFamily(stdfont); + fontDescription.firstFamily().setFamily(standardFont); fontDescription.firstFamily().appendFamily(0); } fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1); @@ -1528,7 +1541,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* element, Rend PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeValue& keyframe) { - if (keyframeRule->style()) + if (keyframeRule->declaration()) addMatchedDeclaration(keyframeRule->declaration()); ASSERT(!m_style); @@ -1568,7 +1581,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* el #endif // Add all the animating properties to the keyframe. - if (CSSMutableStyleDeclaration* styleDeclaration = keyframeRule->declaration()) { + if (StylePropertySet* styleDeclaration = keyframeRule->declaration()) { unsigned propertyCount = styleDeclaration->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { int property = styleDeclaration->propertyAt(i).id(); @@ -1746,6 +1759,55 @@ static void addIntrinsicMargins(RenderStyle* style) } } +static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool strictParsing) +{ + switch (display) { + case BLOCK: + case TABLE: + case BOX: + case FLEXBOX: +#if ENABLE(CSS_GRID_LAYOUT) + case GRID: +#endif + return display; + + case LIST_ITEM: + // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, but only in quirks mode. + if (!strictParsing && isFloating) + return BLOCK; + return display; + case INLINE_TABLE: + return TABLE; + case INLINE_BOX: + return BOX; + case INLINE_FLEXBOX: + return FLEXBOX; +#if ENABLE(CSS_GRID_LAYOUT) + case INLINE_GRID: + return GRID; +#endif + + case INLINE: + case RUN_IN: + case COMPACT: + case INLINE_BLOCK: + case TABLE_ROW_GROUP: + case TABLE_HEADER_GROUP: + case TABLE_FOOTER_GROUP: + case TABLE_ROW: + case TABLE_COLUMN_GROUP: + case TABLE_COLUMN: + case TABLE_CELL: + case TABLE_CAPTION: + return BLOCK; + case NONE: + ASSERT_NOT_REACHED(); + return NONE; + } + ASSERT_NOT_REACHED(); + return BLOCK; +} + void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parentStyle, Element *e) { // Cache our original display. @@ -1795,26 +1857,9 @@ void CSSStyleSelector::adjustRenderStyle(RenderStyle* style, RenderStyle* parent if (e && e->hasTagName(legendTag)) style->setDisplay(BLOCK); - // Mutate the display to BLOCK or TABLE for certain cases, e.g., if someone attempts to - // position or float an inline, compact, or run-in. Cache the original display, since it - // may be needed for positioned elements that have to compute their static normal flow - // positions. We also force inline-level roots to be block-level. - if (style->display() != BLOCK && style->display() != TABLE && style->display() != BOX && - (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() || - (e && e->document()->documentElement() == e))) { - if (style->display() == INLINE_TABLE) - style->setDisplay(TABLE); - else if (style->display() == INLINE_BOX) - style->setDisplay(BOX); - else if (style->display() == LIST_ITEM) { - // It is a WinIE bug that floated list items lose their bullets, so we'll emulate the quirk, - // but only in quirks mode. - if (!m_checker.strictParsing() && style->isFloating()) - style->setDisplay(BLOCK); - } - else - style->setDisplay(BLOCK); - } + // Absolute/fixed positioned elements, floating elements and the document element need block-like outside display. + if (style->position() == AbsolutePosition || style->position() == FixedPosition || style->isFloating() || (e && e->document()->documentElement() == e)) + style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloating(), m_checker.strictParsing())); // FIXME: Don't support this mutation for pseudo styles like first-letter or first-line, since it's not completely // clear how that should work. @@ -2047,7 +2092,8 @@ inline bool CSSStyleSelector::checkSelector(const RuleData& ruleData) } // Slow path. - SelectorChecker::SelectorMatch match = m_checker.checkSelector(ruleData.selector(), m_element, m_dynamicPseudo, false, SelectorChecker::VisitedMatchEnabled, style(), m_parentNode ? m_parentNode->renderStyle() : 0); + SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_element, SelectorChecker::VisitedMatchEnabled, style(), m_parentNode ? m_parentNode->renderStyle() : 0); + SelectorChecker::SelectorMatch match = m_checker.checkSelector(context, m_dynamicPseudo); if (match != SelectorChecker::SelectorMatches) return false; if (m_checker.pseudoStyle() != NOPSEUDO && m_checker.pseudoStyle() != m_dynamicPseudo) @@ -2433,11 +2479,11 @@ static Length convertToFloatLength(CSSPrimitiveValue* primitiveValue, RenderStyl return convertToLength(primitiveValue, style, rootStyle, true, multiplier, ok); } -static inline bool isInsideRegionRule(CSSMutableStyleDeclaration* styleDeclaration) +static inline bool isInsideRegionRule(StylePropertySet* styleDeclaration) { ASSERT(styleDeclaration); - CSSRule* parentRule = styleDeclaration->parentRule(); + CSSRule* parentRule = styleDeclaration->parentRuleInternal(); while (parentRule) { if (parentRule->isRegionRule()) return true; @@ -2447,9 +2493,9 @@ static inline bool isInsideRegionRule(CSSMutableStyleDeclaration* styleDeclarati } template <bool applyFirst> -void CSSStyleSelector::applyDeclaration(CSSMutableStyleDeclaration* styleDeclaration, bool isImportant, bool inheritedOnly) +void CSSStyleSelector::applyDeclaration(StylePropertySet* styleDeclaration, bool isImportant, bool inheritedOnly) { - InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), styleDeclaration->parentRule()); + InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), styleDeclaration->parentRuleInternal()); bool styleDeclarationInsideRegionRule = m_regionForStyling ? isInsideRegionRule(styleDeclaration) : false; unsigned propertyCount = styleDeclaration->propertyCount(); @@ -2499,7 +2545,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e if (m_style->insideLink() != NotInsideLink) { for (int i = startIndex; i <= endIndex; ++i) { - CSSMutableStyleDeclaration* styleDeclaration = m_matchedDecls[i].styleDeclaration.get(); + StylePropertySet* styleDeclaration = m_matchedDecls[i].styleDeclaration.get(); unsigned linkMatchType = m_matchedDecls[i].linkMatchType; // FIXME: It would be nicer to pass these as arguments but that requires changes in many places. m_applyPropertyToRegularStyle = linkMatchType & SelectorChecker::MatchLink; @@ -2718,7 +2764,7 @@ void CSSStyleSelector::matchPageRulesForList(const Vector<RuleData>* rules, bool continue; // If the rule has no properties to apply, then ignore it. - CSSMutableStyleDeclaration* decl = rule->declaration(); + StylePropertySet* decl = rule->declaration(); if (!decl || decl->isEmpty()) continue; @@ -4305,7 +4351,20 @@ void CSSStyleSelector::mapAnimationDirection(Animation* layer, CSSValue* value) return; CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); - layer->setDirection(primitiveValue->getIdent() == CSSValueAlternate ? Animation::AnimationDirectionAlternate : Animation::AnimationDirectionNormal); + switch (primitiveValue->getIdent()) { + case CSSValueNormal: + layer->setDirection(Animation::AnimationDirectionNormal); + break; + case CSSValueAlternate: + layer->setDirection(Animation::AnimationDirectionAlternate); + break; + case CSSValueReverse: + layer->setDirection(Animation::AnimationDirectionReverse); + break; + case CSSValueAlternateReverse: + layer->setDirection(Animation::AnimationDirectionAlternateReverse); + break; + } } void CSSStyleSelector::mapAnimationDuration(Animation* animation, CSSValue* value) diff --git a/Source/WebCore/css/CSSStyleSelector.h b/Source/WebCore/css/CSSStyleSelector.h index 633f703a7..844235ae6 100644 --- a/Source/WebCore/css/CSSStyleSelector.h +++ b/Source/WebCore/css/CSSStyleSelector.h @@ -38,7 +38,6 @@ namespace WebCore { enum ESmartMinimumForFontSize { DoNotUseSmartMinimumForFontSize, UseSmartMinimumForFontFize }; class CSSFontSelector; -class CSSMutableStyleDeclaration; class CSSPageRule; class CSSPrimitiveValue; class CSSProperty; @@ -70,6 +69,7 @@ class RuleSet; class Settings; class StyleImage; class StylePendingImage; +class StylePropertySet; class StyleShader; class StyleSheet; class StyleSheetList; @@ -259,7 +259,7 @@ private: void adjustRenderStyle(RenderStyle* styleToAdjust, RenderStyle* parentStyle, Element*); void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); } - void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll); + void addMatchedDeclaration(StylePropertySet*, unsigned linkMatchType = SelectorChecker::MatchAll); struct MatchRanges { MatchRanges() : firstUARule(-1), lastUARule(-1), firstAuthorRule(-1), lastAuthorRule(-1), firstUserRule(-1), lastUserRule(-1) { } @@ -294,7 +294,7 @@ private: template <bool firstPass> void applyDeclarations(bool important, int startIndex, int endIndex, bool inheritedOnly); template <bool firstPass> - void applyDeclaration(CSSMutableStyleDeclaration*, bool isImportant, bool inheritedOnly); + void applyDeclaration(StylePropertySet*, bool isImportant, bool inheritedOnly); static bool isValidRegionStyleProperty(int id); @@ -375,7 +375,7 @@ private: struct MatchedStyleDeclaration { MatchedStyleDeclaration() : possiblyPaddedMember(0) { } - RefPtr<CSSMutableStyleDeclaration> styleDeclaration; + RefPtr<StylePropertySet> styleDeclaration; union { unsigned linkMatchType; // Used to make sure all memory is zero-initialized since we compute the hash over the bytes of this object. diff --git a/Source/WebCore/css/CSSStyleSheet.idl b/Source/WebCore/css/CSSStyleSheet.idl index 34978275e..e2514f027 100644 --- a/Source/WebCore/css/CSSStyleSheet.idl +++ b/Source/WebCore/css/CSSStyleSheet.idl @@ -25,7 +25,7 @@ module css { readonly attribute CSSRule ownerRule; readonly attribute CSSRuleList cssRules; - [OldStyleObjC] unsigned long insertRule(in [Optional=CallWithDefaultValue] DOMString rule, + [ObjCLegacyUnnamedParameters] unsigned long insertRule(in [Optional=CallWithDefaultValue] DOMString rule, in [Optional=CallWithDefaultValue] unsigned long index) raises(DOMException); void deleteRule(in [Optional=CallWithDefaultValue] unsigned long index) diff --git a/Source/WebCore/css/CSSValue.idl b/Source/WebCore/css/CSSValue.idl index 0edc3d7bd..c46267321 100644 --- a/Source/WebCore/css/CSSValue.idl +++ b/Source/WebCore/css/CSSValue.idl @@ -21,10 +21,10 @@ module css { interface [ - CustomToJS, - CustomIsReachable, - CustomFinalize, - Polymorphic, + JSCustomToJS, + JSCustomIsReachable, + JSCustomFinalize, + ObjCPolymorphic, V8DependentLifetime ] CSSValue { @@ -34,7 +34,7 @@ module css { const unsigned short CSS_VALUE_LIST = 2; const unsigned short CSS_CUSTOM = 3; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString cssText + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString cssText setter raises(DOMException); readonly attribute unsigned short cssValueType; diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index fd1052886..dd5c27c83 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -1,13 +1,5 @@ -// These are all values accepted for CSS2. // -// WARNING: -// -------- -// -// The Values are sorted according to the properties they belong to, -// and have to be in the same order as the enums in RenderStyleConstants.h. -// -// If not, the optimizations in the cssparser and style selector will fail, -// and produce incorrect results. +// CSS value names // inherit initial @@ -16,6 +8,7 @@ initial // CSS_PROP_BORDER_TOP_STYLE // CSS_PROP_BORDER_BOTTOM_STYLE // CSS_PROP_BORDER_LEFT_STYLE +// The order here must match the order of the EBorderStyle enum in RenderStyleConstants.h. none hidden inset @@ -215,6 +208,7 @@ bottom -webkit-baseline-middle // // CSS_PROP_TEXT_ALIGN: +// The order here must match the order of the ETextAlign enum in RenderStyleConstants.h. // -webkit-auto left @@ -232,6 +226,7 @@ outside inside // // CSS_PROP_LIST_STYLE_TYPE: +// The order here must match the order of the EListStyleType enum in RenderStyleConstants.h. // disc circle @@ -316,6 +311,7 @@ katakana-iroha //none // // CSS_PROP_DISPLAY: +// The order here must match the order of the EDisplay enum in RenderStyleConstants.h. // inline block @@ -344,6 +340,7 @@ table-caption //none // // CSS_PROP_CURSOR: +// The order here must match the order of the ECursor enum in RenderStyleConstants.h. // auto crosshair @@ -603,7 +600,7 @@ space after-white-space // -webkit-appearance -// The order here should match the order in the ControlPart enum in ThemeTypes.h. +// The order here must match the order in the ControlPart enum in ThemeTypes.h. // All appearance values that should be accepted by the parser should be listed between 'checkbox' and 'textarea': checkbox radio @@ -703,6 +700,8 @@ lines // // alternate +alternate-reverse + // // CSS_PROP__WEBKIT_ANIMATION_FILL_MODE // diff --git a/Source/WebCore/css/CSSValueList.idl b/Source/WebCore/css/CSSValueList.idl index 63c8514de..0a4051b7a 100644 --- a/Source/WebCore/css/CSSValueList.idl +++ b/Source/WebCore/css/CSSValueList.idl @@ -27,7 +27,7 @@ module css { // Introduced in DOM Level 2: interface [ - HasIndexGetter + IndexedGetter ] CSSValueList : CSSValue { readonly attribute unsigned long length; CSSValue item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/css/DashboardSupportCSSPropertyNames.in b/Source/WebCore/css/DashboardSupportCSSPropertyNames.in deleted file mode 100644 index 615bd6cf5..000000000 --- a/Source/WebCore/css/DashboardSupportCSSPropertyNames.in +++ /dev/null @@ -1 +0,0 @@ --webkit-dashboard-region diff --git a/Source/WebCore/css/MediaList.idl b/Source/WebCore/css/MediaList.idl index 73b336c87..ed0d2ba4d 100644 --- a/Source/WebCore/css/MediaList.idl +++ b/Source/WebCore/css/MediaList.idl @@ -27,11 +27,11 @@ module stylesheets { // Introduced in DOM Level 2: interface [ - GenerateIsReachable, - HasIndexGetter + JSGenerateIsReachable, + IndexedGetter ] MediaList { - attribute [TreatNullAs=EmptyString, ConvertNullStringTo=Null] DOMString mediaText + attribute [TreatNullAs=NullString, ConvertNullStringTo=Null] DOMString mediaText setter raises(DOMException); readonly attribute unsigned long length; diff --git a/Source/WebCore/css/MediaQueryListListener.idl b/Source/WebCore/css/MediaQueryListListener.idl index dfe659b0d..cd499eacc 100644 --- a/Source/WebCore/css/MediaQueryListListener.idl +++ b/Source/WebCore/css/MediaQueryListListener.idl @@ -19,9 +19,9 @@ module view { interface [ - NoStaticTables, + JSNoStaticTables, ObjCProtocol, - PureInterface, + CPPPureInterface, OmitConstructor ] MediaQueryListListener { void queryChanged(in [Optional=CallWithDefaultValue] MediaQueryList list); diff --git a/Source/WebCore/css/SVGCSSPropertyNames.in b/Source/WebCore/css/SVGCSSPropertyNames.in index 8c8c1544f..142094e84 100644 --- a/Source/WebCore/css/SVGCSSPropertyNames.in +++ b/Source/WebCore/css/SVGCSSPropertyNames.in @@ -1,5 +1,5 @@ // -// all valid SVG CSS2 properties. +// SVG CSS property names // // SVG style props diff --git a/Source/WebCore/css/SVGCSSValueKeywords.in b/Source/WebCore/css/SVGCSSValueKeywords.in index 4fac4baf8..e11516510 100644 --- a/Source/WebCore/css/SVGCSSValueKeywords.in +++ b/Source/WebCore/css/SVGCSSValueKeywords.in @@ -1,14 +1,5 @@ -// These are all values accepted for CSS2. -// -// WARNING: -// -------- -// -// The Values are sorted according to the properties they belong to, -// and have to be in the same order as the enums in RenderStyle.h. -// -// If not, the optimizations in the cssparser and style selector will fail, -// and produce incorrect results. // +// SVG CSS value names // // CSS_PROP_*_COLOR // diff --git a/Source/WebCore/css/SelectorChecker.cpp b/Source/WebCore/css/SelectorChecker.cpp index 3677fcf79..d4636b710 100644 --- a/Source/WebCore/css/SelectorChecker.cpp +++ b/Source/WebCore/css/SelectorChecker.cpp @@ -268,13 +268,14 @@ EInsideLink SelectorChecker::determineLinkStateSlowCase(Element* element) const bool SelectorChecker::checkSelector(CSSSelector* sel, Element* element, bool isFastCheckableSelector) const { - PseudoId dynamicPseudo = NOPSEUDO; if (isFastCheckableSelector && !element->isSVGElement()) { if (!fastCheckRightmostSelector(sel, element, VisitedMatchDisabled)) return false; return fastCheckSelector(sel, element); } - return checkSelector(sel, element, dynamicPseudo, false, VisitedMatchDisabled) == SelectorMatches; + + PseudoId dynamicPseudo = NOPSEUDO; + return checkSelector(SelectorCheckingContext(sel, element, SelectorChecker::VisitedMatchDisabled), dynamicPseudo) == SelectorMatches; } namespace { @@ -442,108 +443,117 @@ bool SelectorChecker::isFastCheckableSelector(const CSSSelector* selector) // * SelectorFailsLocally - the selector fails for the element e // * SelectorFailsAllSiblings - the selector fails for e and any sibling of e // * SelectorFailsCompletely - the selector fails for e and any sibling or ancestor of e -SelectorChecker::SelectorMatch SelectorChecker::checkSelector(CSSSelector* sel, Element* e, PseudoId& dynamicPseudo, bool isSubSelector, VisitedMatchType visitedMatchType, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const +SelectorChecker::SelectorMatch SelectorChecker::checkSelector(const SelectorCheckingContext& context, PseudoId& dynamicPseudo) const { #if ENABLE(SVG) // Spec: CSS2 selectors cannot be applied to the (conceptually) cloned DOM tree // because its contents are not part of the formal document structure. - if (e->isSVGShadowRoot()) + if (context.element->isSVGShadowRoot()) return SelectorFailsCompletely; #endif // first selector has to match - if (!checkOneSelector(sel, e, dynamicPseudo, isSubSelector, visitedMatchType, elementStyle, elementParentStyle)) + if (!checkOneSelector(context, dynamicPseudo)) return SelectorFailsLocally; // The rest of the selectors has to match - CSSSelector::Relation relation = sel->relation(); + CSSSelector::Relation relation = context.selector->relation(); - // Prepare next sel - sel = sel->tagHistory(); - if (!sel) + // Prepare next selector + CSSSelector* historySelector = context.selector->tagHistory(); + if (!historySelector) return SelectorMatches; + SelectorCheckingContext nextContext(context); + nextContext.selector = historySelector; + if (relation != CSSSelector::SubSelector) { // Bail-out if this selector is irrelevant for the pseudoStyle if (m_pseudoStyle != NOPSEUDO && m_pseudoStyle != dynamicPseudo) return SelectorFailsCompletely; // Disable :visited matching when we see the first link or try to match anything else than an ancestors. - if (!isSubSelector && (e->isLink() || (relation != CSSSelector::Descendant && relation != CSSSelector::Child))) - visitedMatchType = VisitedMatchDisabled; + if (!context.isSubSelector && (context.element->isLink() || (relation != CSSSelector::Descendant && relation != CSSSelector::Child))) + nextContext.visitedMatchType = VisitedMatchDisabled; } switch (relation) { case CSSSelector::Descendant: - while (true) { - ContainerNode* n = e->parentNode(); - if (!n || !n->isElementNode()) - return SelectorFailsCompletely; - e = static_cast<Element*>(n); - SelectorMatch match = checkSelector(sel, e, dynamicPseudo, false, visitedMatchType); + nextContext.element = context.element->parentElement(); + nextContext.isSubSelector = false; + nextContext.elementStyle = 0; + nextContext.elementParentStyle = 0; + for (; nextContext.element; nextContext.element = nextContext.element->parentElement()) { + SelectorMatch match = checkSelector(nextContext, dynamicPseudo); if (match == SelectorMatches || match == SelectorFailsCompletely) return match; } - break; + return SelectorFailsCompletely; + case CSSSelector::Child: - { - ContainerNode* n = e->parentNode(); - if (!n || !n->isElementNode()) - return SelectorFailsCompletely; - e = static_cast<Element*>(n); - return checkSelector(sel, e, dynamicPseudo, false, visitedMatchType); - } + nextContext.element = context.element->parentElement(); + if (!nextContext.element) + return SelectorFailsCompletely; + nextContext.isSubSelector = false; + nextContext.elementStyle = 0; + nextContext.elementParentStyle = 0; + return checkSelector(nextContext, dynamicPseudo); + case CSSSelector::DirectAdjacent: - { - if (!m_isCollectingRulesOnly && e->parentNode() && e->parentNode()->isElementNode()) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : e->parentNode()->renderStyle(); - if (parentStyle) - parentStyle->setChildrenAffectedByDirectAdjacentRules(); - } - Node* n = e->previousSibling(); - while (n && !n->isElementNode()) - n = n->previousSibling(); - if (!n) - return SelectorFailsAllSiblings; - e = static_cast<Element*>(n); - return checkSelector(sel, e, dynamicPseudo, false, visitedMatchType); + if (!m_isCollectingRulesOnly && context.element->parentElement()) { + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : context.element->parentNode()->renderStyle(); + if (parentStyle) + parentStyle->setChildrenAffectedByDirectAdjacentRules(); } + nextContext.element = context.element->previousElementSibling(); + if (!nextContext.element) + return SelectorFailsAllSiblings; + nextContext.isSubSelector = false; + nextContext.elementStyle = 0; + nextContext.elementParentStyle = 0; + return checkSelector(nextContext, dynamicPseudo); + case CSSSelector::IndirectAdjacent: - if (!m_isCollectingRulesOnly && e->parentNode() && e->parentNode()->isElementNode()) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : e->parentNode()->renderStyle(); + if (!m_isCollectingRulesOnly && context.element->parentElement()) { + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : context.element->parentNode()->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByForwardPositionalRules(); } - while (true) { - Node* n = e->previousSibling(); - while (n && !n->isElementNode()) - n = n->previousSibling(); - if (!n) - return SelectorFailsAllSiblings; - e = static_cast<Element*>(n); - SelectorMatch match = checkSelector(sel, e, dynamicPseudo, false, visitedMatchType); + nextContext.element = context.element->previousElementSibling(); + nextContext.isSubSelector = false; + nextContext.elementStyle = 0; + nextContext.elementParentStyle = 0; + for (; nextContext.element; nextContext.element = nextContext.element->previousElementSibling()) { + SelectorMatch match = checkSelector(nextContext, dynamicPseudo); if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely) return match; }; - break; + return SelectorFailsAllSiblings; + case CSSSelector::SubSelector: // a selector is invalid if something follows a pseudo-element // We make an exception for scrollbar pseudo elements and allow a set of pseudo classes (but nothing else) // to follow the pseudo elements. - if ((elementStyle || m_isCollectingRulesOnly) && dynamicPseudo != NOPSEUDO && dynamicPseudo != SELECTION - && !((RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER) && sel->m_match == CSSSelector::PseudoClass)) + if ((context.elementStyle || m_isCollectingRulesOnly) && dynamicPseudo != NOPSEUDO && dynamicPseudo != SELECTION + && !((RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER) && nextContext.selector->m_match == CSSSelector::PseudoClass)) return SelectorFailsCompletely; - return checkSelector(sel, e, dynamicPseudo, true, visitedMatchType, elementStyle, elementParentStyle); + nextContext.isSubSelector = true; + return checkSelector(nextContext, dynamicPseudo); + case CSSSelector::ShadowDescendant: { - Node* shadowHostNode = e->shadowAncestorNode(); - if (shadowHostNode == e || !shadowHostNode->isElementNode()) + Node* shadowHostNode = context.element->shadowAncestorNode(); + if (shadowHostNode == context.element || !shadowHostNode->isElementNode()) return SelectorFailsCompletely; - e = static_cast<Element*>(shadowHostNode); - return checkSelector(sel, e, dynamicPseudo, false, visitedMatchType); + nextContext.element = toElement(shadowHostNode); + nextContext.isSubSelector = false; + nextContext.elementStyle = 0; + nextContext.elementParentStyle = 0; + return checkSelector(nextContext, dynamicPseudo); } } + ASSERT_NOT_REACHED(); return SelectorFailsCompletely; } @@ -677,10 +687,11 @@ static bool attributeValueMatches(Attribute* attributeItem, CSSSelector::Match m return true; } -static bool anyAttributeMatches(NamedNodeMap* attributes, CSSSelector::Match match, const QualifiedName& selectorAttr, const AtomicString& selectorValue, bool caseSensitive) +static bool anyAttributeMatches(Element* element, CSSSelector::Match match, const QualifiedName& selectorAttr, const AtomicString& selectorValue, bool caseSensitive) { - for (size_t i = 0; i < attributes->length(); ++i) { - Attribute* attributeItem = attributes->attributeItem(i); + ASSERT(element->hasAttributesWithoutUpdate()); + for (size_t i = 0; i < element->attributeCount(); ++i) { + Attribute* attributeItem = element->attributeItem(i); if (!SelectorChecker::attributeNameMatches(attributeItem, selectorAttr)) continue; @@ -692,64 +703,69 @@ static bool anyAttributeMatches(NamedNodeMap* attributes, CSSSelector::Match mat return false; } -bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& dynamicPseudo, bool isSubSelector, VisitedMatchType visitedMatchType, RenderStyle* elementStyle, RenderStyle* elementParentStyle) const +bool SelectorChecker::checkOneSelector(const SelectorCheckingContext& context, PseudoId& dynamicPseudo) const { - ASSERT(e); - if (!SelectorChecker::tagMatches(e, sel)) + Element* const & element = context.element; + CSSSelector* const & selector = context.selector; + ASSERT(element); + ASSERT(selector); + + if (!SelectorChecker::tagMatches(element, selector)) return false; - if (sel->m_match == CSSSelector::Class) - return e->hasClass() && static_cast<StyledElement*>(e)->classNames().contains(sel->value()); + if (selector->m_match == CSSSelector::Class) + return element->hasClass() && static_cast<StyledElement*>(element)->classNames().contains(selector->value()); - if (sel->m_match == CSSSelector::Id) - return e->hasID() && e->idForStyleResolution() == sel->value(); + if (selector->m_match == CSSSelector::Id) + return element->hasID() && element->idForStyleResolution() == selector->value(); - if (sel->isAttributeSelector()) { - const QualifiedName& attr = sel->attribute(); + if (selector->isAttributeSelector()) { + const QualifiedName& attr = selector->attribute(); - NamedNodeMap* attributes = e->updatedAttributes(); - if (!attributes) + if (!element->hasAttributes()) return false; bool caseSensitive = !m_documentIsHTML || !htmlAttributeHasCaseInsensitiveValue(attr); - if (!anyAttributeMatches(attributes, static_cast<CSSSelector::Match>(sel->m_match), attr, sel->value(), caseSensitive)) + if (!anyAttributeMatches(element, static_cast<CSSSelector::Match>(selector->m_match), attr, selector->value(), caseSensitive)) return false; } - if (sel->m_match == CSSSelector::PseudoClass) { + if (selector->m_match == CSSSelector::PseudoClass) { // Handle :not up front. - if (sel->pseudoType() == CSSSelector::PseudoNot) { - ASSERT(sel->selectorList()); - for (CSSSelector* subSel = sel->selectorList()->first(); subSel; subSel = subSel->tagHistory()) { + if (selector->pseudoType() == CSSSelector::PseudoNot) { + ASSERT(selector->selectorList()); + SelectorCheckingContext subContext(context); + subContext.isSubSelector = true; + for (subContext.selector = selector->selectorList()->first(); subContext.selector; subContext.selector = subContext.selector->tagHistory()) { // :not cannot nest. I don't really know why this is a // restriction in CSS3, but it is, so let's honor it. // the parser enforces that this never occurs - ASSERT(subSel->pseudoType() != CSSSelector::PseudoNot); + ASSERT(subContext.selector->pseudoType() != CSSSelector::PseudoNot); // We select between :visited and :link when applying. We don't know which one applied (or not) yet. - if (subSel->pseudoType() == CSSSelector::PseudoVisited || (subSel->pseudoType() == CSSSelector::PseudoLink && visitedMatchType == VisitedMatchEnabled)) + if (subContext.selector->pseudoType() == CSSSelector::PseudoVisited || (subContext.selector->pseudoType() == CSSSelector::PseudoLink && subContext.visitedMatchType == VisitedMatchEnabled)) return true; - if (!checkOneSelector(subSel, e, dynamicPseudo, true, visitedMatchType, elementStyle, elementParentStyle)) + if (!checkOneSelector(subContext, dynamicPseudo)) return true; } } else if (dynamicPseudo != NOPSEUDO && (RenderScrollbar::scrollbarForStyleResolve() || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER)) { // CSS scrollbars match a specific subset of pseudo classes, and they have specialized rules for each // (since there are no elements involved). - return checkScrollbarPseudoClass(sel, dynamicPseudo); + return checkScrollbarPseudoClass(selector, dynamicPseudo); } else if (dynamicPseudo == SELECTION) { - if (sel->pseudoType() == CSSSelector::PseudoWindowInactive) + if (selector->pseudoType() == CSSSelector::PseudoWindowInactive) return !m_document->page()->focusController()->isActive(); } // Normal element pseudo class checking. - switch (sel->pseudoType()) { + switch (selector->pseudoType()) { // Pseudo classes: case CSSSelector::PseudoNot: break; // Already handled up above. case CSSSelector::PseudoEmpty: { bool result = true; - for (Node* n = e->firstChild(); n; n = n->nextSibling()) { + for (Node* n = element->firstChild(); n; n = n->nextSibling()) { if (n->isElementNode()) { result = false; break; @@ -763,25 +779,22 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d } } if (!m_isCollectingRulesOnly) { - if (elementStyle) - elementStyle->setEmptyState(result); - else if (e->renderStyle() && (e->document()->usesSiblingRules() || e->renderStyle()->unique())) - e->renderStyle()->setEmptyState(result); + if (context.elementStyle) + context.elementStyle->setEmptyState(result); + else if (element->renderStyle() && (element->document()->usesSiblingRules() || element->renderStyle()->unique())) + element->renderStyle()->setEmptyState(result); } return result; } case CSSSelector::PseudoFirstChild: // first-child matches the first child that is an element - if (e->parentNode() && e->parentNode()->isElementNode()) { + if (element->parentElement()) { bool result = false; - Node* n = e->previousSibling(); - while (n && !n->isElementNode()) - n = n->previousSibling(); - if (!n) + if (!element->previousElementSibling()) result = true; if (!m_isCollectingRulesOnly) { - RenderStyle* childStyle = elementStyle ? elementStyle : e->renderStyle(); - RenderStyle* parentStyle = elementStyle ? elementParentStyle : e->parentNode()->renderStyle(); + RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : element->parentNode()->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByFirstChildRules(); if (result && childStyle) @@ -792,19 +805,17 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d break; case CSSSelector::PseudoFirstOfType: // first-of-type matches the first element of its type - if (e->parentNode() && e->parentNode()->isElementNode()) { - bool result = false; - const QualifiedName& type = e->tagQName(); - Node* n = e->previousSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) + if (element->parentElement()) { + bool result = true; + const QualifiedName& type = element->tagQName(); + for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) { + if (sibling->hasTagName(type)) { + result = false; break; - n = n->previousSibling(); + } } - if (!n) - result = true; if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : e->parentNode()->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : element->parentNode()->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByForwardPositionalRules(); } @@ -813,18 +824,11 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d break; case CSSSelector::PseudoLastChild: // last-child matches the last child that is an element - if (Element* parentElement = e->parentElement()) { - bool result = false; - if (parentElement->isFinishedParsingChildren()) { - Node* n = e->nextSibling(); - while (n && !n->isElementNode()) - n = n->nextSibling(); - if (!n) - result = true; - } + if (Element* parentElement = element->parentElement()) { + bool result = parentElement->isFinishedParsingChildren() && !element->nextElementSibling(); if (!m_isCollectingRulesOnly) { - RenderStyle* childStyle = elementStyle ? elementStyle : e->renderStyle(); - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByLastChildRules(); if (result && childStyle) @@ -835,64 +839,47 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d break; case CSSSelector::PseudoLastOfType: // last-of-type matches the last element of its type - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByBackwardPositionalRules(); } if (!parentElement->isFinishedParsingChildren()) return false; - bool result = false; - const QualifiedName& type = e->tagQName(); - Node* n = e->nextSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) - break; - n = n->nextSibling(); + const QualifiedName& type = element->tagQName(); + for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) { + if (sibling->hasTagName(type)) + return false; } - if (!n) - result = true; - return result; + return true; } break; case CSSSelector::PseudoOnlyChild: - if (Element* parentElement = e->parentElement()) { - bool firstChild = false; - bool lastChild = false; - - Node* n = e->previousSibling(); - while (n && !n->isElementNode()) - n = n->previousSibling(); - if (!n) - firstChild = true; - if (firstChild && parentElement->isFinishedParsingChildren()) { - n = e->nextSibling(); - while (n && !n->isElementNode()) - n = n->nextSibling(); - if (!n) - lastChild = true; - } + if (Element* parentElement = element->parentElement()) { + bool firstChild = !element->previousElementSibling(); + bool onlyChild = firstChild && parentElement->isFinishedParsingChildren() && !element->nextElementSibling(); + if (!m_isCollectingRulesOnly) { - RenderStyle* childStyle = elementStyle ? elementStyle : e->renderStyle(); - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) { parentStyle->setChildrenAffectedByFirstChildRules(); parentStyle->setChildrenAffectedByLastChildRules(); } if (firstChild && childStyle) childStyle->setFirstChildState(); - if (lastChild && childStyle) + if (onlyChild && childStyle) childStyle->setLastChildState(); } - return firstChild && lastChild; + return onlyChild; } break; case CSSSelector::PseudoOnlyOfType: // FIXME: This selector is very slow. - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) { parentStyle->setChildrenAffectedByForwardPositionalRules(); parentStyle->setChildrenAffectedByBackwardPositionalRules(); @@ -900,261 +887,240 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d } if (!parentElement->isFinishedParsingChildren()) return false; - bool firstChild = false; - bool lastChild = false; - const QualifiedName& type = e->tagQName(); - Node* n = e->previousSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) - break; - n = n->previousSibling(); + const QualifiedName& type = element->tagQName(); + for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) { + if (sibling->hasTagName(type)) + return false; } - if (!n) - firstChild = true; - if (firstChild) { - n = e->nextSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) - break; - n = n->nextSibling(); - } - if (!n) - lastChild = true; + for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) { + if (sibling->hasTagName(type)) + return false; } - return firstChild && lastChild; + return true; } break; case CSSSelector::PseudoNthChild: - if (!sel->parseNth()) + if (!selector->parseNth()) break; - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { int count = 1; - Node* n = e->previousSibling(); - while (n) { - if (n->isElementNode()) { - RenderStyle* s = n->renderStyle(); - unsigned index = s ? s->childIndex() : 0; - if (index) { - count += index; - break; - } - count++; + for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) { + RenderStyle* s = sibling->renderStyle(); + unsigned index = s ? s->childIndex() : 0; + if (index) { + count += index; + break; } - n = n->previousSibling(); + count++; } if (!m_isCollectingRulesOnly) { - RenderStyle* childStyle = elementStyle ? elementStyle : e->renderStyle(); - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* childStyle = context.elementStyle ? context.elementStyle : element->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (childStyle) childStyle->setChildIndex(count); if (parentStyle) parentStyle->setChildrenAffectedByForwardPositionalRules(); } - if (sel->matchNth(count)) + if (selector->matchNth(count)) return true; } break; case CSSSelector::PseudoNthOfType: - if (!sel->parseNth()) + if (!selector->parseNth()) break; - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { int count = 1; - const QualifiedName& type = e->tagQName(); - Node* n = e->previousSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) - count++; - n = n->previousSibling(); + const QualifiedName& type = element->tagQName(); + for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) { + if (sibling->hasTagName(type)) + ++count; } - if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByForwardPositionalRules(); } - if (sel->matchNth(count)) + if (selector->matchNth(count)) return true; } break; case CSSSelector::PseudoNthLastChild: - if (!sel->parseNth()) + if (!selector->parseNth()) break; - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByBackwardPositionalRules(); } if (!parentElement->isFinishedParsingChildren()) return false; int count = 1; - Node* n = e->nextSibling(); - while (n) { - if (n->isElementNode()) - count++; - n = n->nextSibling(); - } - if (sel->matchNth(count)) + for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) + ++count; + if (selector->matchNth(count)) return true; } break; case CSSSelector::PseudoNthLastOfType: - if (!sel->parseNth()) + if (!selector->parseNth()) break; - if (Element* parentElement = e->parentElement()) { + if (Element* parentElement = element->parentElement()) { if (!m_isCollectingRulesOnly) { - RenderStyle* parentStyle = elementStyle ? elementParentStyle : parentElement->renderStyle(); + RenderStyle* parentStyle = context.elementStyle ? context.elementParentStyle : parentElement->renderStyle(); if (parentStyle) parentStyle->setChildrenAffectedByBackwardPositionalRules(); } if (!parentElement->isFinishedParsingChildren()) return false; int count = 1; - const QualifiedName& type = e->tagQName(); - Node* n = e->nextSibling(); - while (n) { - if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) - count++; - n = n->nextSibling(); + const QualifiedName& type = element->tagQName(); + for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) { + if (sibling->hasTagName(type)) + ++count; } - if (sel->matchNth(count)) + if (selector->matchNth(count)) return true; } break; case CSSSelector::PseudoTarget: - if (e == e->document()->cssTarget()) + if (element == element->document()->cssTarget()) return true; break; case CSSSelector::PseudoAny: - for (CSSSelector* selector = sel->selectorList()->first(); selector; selector = CSSSelectorList::next(selector)) { - if (checkSelector(selector, e, dynamicPseudo, true, visitedMatchType, elementStyle, elementParentStyle) == SelectorMatches) - return true; + { + SelectorCheckingContext subContext(context); + subContext.isSubSelector = true; + for (subContext.selector = selector->selectorList()->first(); subContext.selector; subContext.selector = CSSSelectorList::next(subContext.selector)) { + if (checkSelector(subContext, dynamicPseudo) == SelectorMatches) + return true; + } } break; case CSSSelector::PseudoAutofill: - if (!e || !e->isFormControlElement()) + if (!element || !element->isFormControlElement()) break; - if (HTMLInputElement* inputElement = e->toInputElement()) + if (HTMLInputElement* inputElement = element->toInputElement()) return inputElement->isAutofilled(); break; case CSSSelector::PseudoAnyLink: case CSSSelector::PseudoLink: // :visited and :link matches are separated later when applying the style. Here both classes match all links... - return e->isLink(); + return element->isLink(); case CSSSelector::PseudoVisited: // ...except if :visited matching is disabled for ancestor/sibling matching. - return e->isLink() && visitedMatchType == VisitedMatchEnabled; + return element->isLink() && context.visitedMatchType == VisitedMatchEnabled; case CSSSelector::PseudoDrag: - if (elementStyle) - elementStyle->setAffectedByDragRules(true); - else if (e->renderStyle()) - e->renderStyle()->setAffectedByDragRules(true); - if (e->renderer() && e->renderer()->isDragging()) + if (context.elementStyle) + context.elementStyle->setAffectedByDragRules(true); + else if (element->renderStyle()) + element->renderStyle()->setAffectedByDragRules(true); + if (element->renderer() && element->renderer()->isDragging()) return true; break; case CSSSelector::PseudoFocus: - return matchesFocusPseudoClass(e); + return matchesFocusPseudoClass(element); case CSSSelector::PseudoHover: // If we're in quirks mode, then hover should never match anchors with no // href and *:hover should not match anything. This is important for sites like wsj.com. - if (m_strictParsing || isSubSelector || (sel->hasTag() && !e->hasTagName(aTag)) || e->isLink()) { - if (elementStyle) - elementStyle->setAffectedByHoverRules(true); - else if (e->renderStyle()) - e->renderStyle()->setAffectedByHoverRules(true); - if (e->hovered() || InspectorInstrumentation::forcePseudoState(e, CSSSelector::PseudoHover)) + if (m_strictParsing || context.isSubSelector || (selector->hasTag() && !element->hasTagName(aTag)) || element->isLink()) { + if (context.elementStyle) + context.elementStyle->setAffectedByHoverRules(true); + else if (element->renderStyle()) + element->renderStyle()->setAffectedByHoverRules(true); + if (element->hovered() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoHover)) return true; } break; case CSSSelector::PseudoActive: // If we're in quirks mode, then :active should never match anchors with no // href and *:active should not match anything. - if (m_strictParsing || isSubSelector || (sel->hasTag() && !e->hasTagName(aTag)) || e->isLink()) { - if (elementStyle) - elementStyle->setAffectedByActiveRules(true); - else if (e->renderStyle()) - e->renderStyle()->setAffectedByActiveRules(true); - if (e->active() || InspectorInstrumentation::forcePseudoState(e, CSSSelector::PseudoActive)) + if (m_strictParsing || context.isSubSelector || (selector->hasTag() && !element->hasTagName(aTag)) || element->isLink()) { + if (context.elementStyle) + context.elementStyle->setAffectedByActiveRules(true); + else if (element->renderStyle()) + element->renderStyle()->setAffectedByActiveRules(true); + if (element->active() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoActive)) return true; } break; case CSSSelector::PseudoEnabled: - if (e && e->isFormControlElement()) - return e->isEnabledFormControl(); + if (element && element->isFormControlElement()) + return element->isEnabledFormControl(); break; case CSSSelector::PseudoFullPageMedia: - return e && e->document() && e->document()->isMediaDocument(); + return element && element->document() && element->document()->isMediaDocument(); break; case CSSSelector::PseudoDefault: - return e && e->isDefaultButtonForForm(); + return element && element->isDefaultButtonForForm(); case CSSSelector::PseudoDisabled: - if (e && e->isFormControlElement()) - return !e->isEnabledFormControl(); + if (element && element->isFormControlElement()) + return !element->isEnabledFormControl(); break; case CSSSelector::PseudoReadOnly: - if (!e || !e->isFormControlElement()) + if (!element || !element->isFormControlElement()) return false; - return e->isTextFormControl() && e->isReadOnlyFormControl(); + return element->isTextFormControl() && element->isReadOnlyFormControl(); case CSSSelector::PseudoReadWrite: - if (!e || !e->isFormControlElement()) + if (!element || !element->isFormControlElement()) return false; - return e->isTextFormControl() && !e->isReadOnlyFormControl(); + return element->isTextFormControl() && !element->isReadOnlyFormControl(); case CSSSelector::PseudoOptional: - return e && e->isOptionalFormControl(); + return element && element->isOptionalFormControl(); case CSSSelector::PseudoRequired: - return e && e->isRequiredFormControl(); + return element && element->isRequiredFormControl(); case CSSSelector::PseudoValid: - if (!e) + if (!element) return false; - e->document()->setContainsValidityStyleRules(); - return e->willValidate() && e->isValidFormControlElement(); + element->document()->setContainsValidityStyleRules(); + return element->willValidate() && element->isValidFormControlElement(); case CSSSelector::PseudoInvalid: - if (!e) + if (!element) return false; - e->document()->setContainsValidityStyleRules(); - return (e->willValidate() && !e->isValidFormControlElement()) || e->hasUnacceptableValue(); + element->document()->setContainsValidityStyleRules(); + return (element->willValidate() && !element->isValidFormControlElement()) || element->hasUnacceptableValue(); case CSSSelector::PseudoChecked: { - if (!e || !e->isFormControlElement()) + if (!element || !element->isFormControlElement()) break; // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that // you can't be both checked and indeterminate. We will behave like WinIE behind the scenes and just // obey the CSS spec here in the test for matching the pseudo. - HTMLInputElement* inputElement = e->toInputElement(); + HTMLInputElement* inputElement = element->toInputElement(); if (inputElement && inputElement->shouldAppearChecked() && !inputElement->isIndeterminate()) return true; - if (e->hasTagName(optionTag) && toHTMLOptionElement(e)->selected()) + if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) return true; break; } case CSSSelector::PseudoIndeterminate: { - if (!e || !e->isFormControlElement()) + if (!element || !element->isFormControlElement()) break; #if ENABLE(PROGRESS_TAG) - if (e->hasTagName(progressTag)) { - HTMLProgressElement* progress = static_cast<HTMLProgressElement*>(e); + if (element->hasTagName(progressTag)) { + HTMLProgressElement* progress = static_cast<HTMLProgressElement*>(element); if (progress && !progress->isDeterminate()) return true; break; } #endif - HTMLInputElement* inputElement = e->toInputElement(); + HTMLInputElement* inputElement = element->toInputElement(); if (inputElement && inputElement->isIndeterminate()) return true; break; } case CSSSelector::PseudoRoot: - if (e == e->document()->documentElement()) + if (element == element->document()->documentElement()) return true; break; case CSSSelector::PseudoLang: { - AtomicString value = e->computeInheritedLanguage(); - const AtomicString& argument = sel->argument(); + AtomicString value = element->computeInheritedLanguage(); + const AtomicString& argument = selector->argument(); if (value.isEmpty() || !value.startsWith(argument, false)) break; if (value.length() != argument.length() && value[argument.length()] != '-') @@ -1167,34 +1133,34 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d // element is an element in the document, the 'full-screen' pseudoclass applies to // that element. Also, an <iframe>, <object> or <embed> element whose child browsing // context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied. - if (e->isFrameElementBase() && static_cast<HTMLFrameElementBase*>(e)->containsFullScreenElement()) + if (element->isFrameElementBase() && static_cast<HTMLFrameElementBase*>(element)->containsFullScreenElement()) return true; - if (!e->document()->webkitIsFullScreen()) + if (!element->document()->webkitIsFullScreen()) return false; - return e == e->document()->webkitCurrentFullScreenElement(); + return element == element->document()->webkitCurrentFullScreenElement(); case CSSSelector::PseudoAnimatingFullScreenTransition: - if (e != e->document()->webkitCurrentFullScreenElement()) + if (element != element->document()->webkitCurrentFullScreenElement()) return false; - return e->document()->isAnimatingFullScreen(); + return element->document()->isAnimatingFullScreen(); case CSSSelector::PseudoFullScreenAncestor: - return e->containsFullScreenElement(); + return element->containsFullScreenElement(); case CSSSelector::PseudoFullScreenDocument: // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies // to all elements of that Document. - if (!e->document()->webkitIsFullScreen()) + if (!element->document()->webkitIsFullScreen()) return false; return true; #endif case CSSSelector::PseudoInRange: - if (!e) + if (!element) return false; - e->document()->setContainsValidityStyleRules(); - return e->isInRange(); + element->document()->setContainsValidityStyleRules(); + return element->isInRange(); case CSSSelector::PseudoOutOfRange: - if (!e) + if (!element) return false; - e->document()->setContainsValidityStyleRules(); - return e->isOutOfRange(); + element->document()->setContainsValidityStyleRules(); + return element->isOutOfRange(); case CSSSelector::PseudoUnknown: case CSSSelector::PseudoNotParsed: default: @@ -1203,18 +1169,18 @@ bool SelectorChecker::checkOneSelector(CSSSelector* sel, Element* e, PseudoId& d } return false; } - if (sel->m_match == CSSSelector::PseudoElement) { - if (!elementStyle && !m_isCollectingRulesOnly) + if (selector->m_match == CSSSelector::PseudoElement) { + if (!context.elementStyle && !m_isCollectingRulesOnly) return false; - if (sel->isUnknownPseudoElement()) { + if (selector->isUnknownPseudoElement()) { m_hasUnknownPseudoElements = true; - return e->shadowPseudoId() == sel->value(); + return element->shadowPseudoId() == selector->value(); } - PseudoId pseudoId = CSSSelector::pseudoId(sel->pseudoType()); + PseudoId pseudoId = CSSSelector::pseudoId(selector->pseudoType()); if (pseudoId == FIRST_LETTER) { - if (Document* document = e->document()) + if (Document* document = element->document()) document->setUsesFirstLetterRules(true); } if (pseudoId != NOPSEUDO) diff --git a/Source/WebCore/css/SelectorChecker.h b/Source/WebCore/css/SelectorChecker.h index 3f9469e5d..06b619d87 100644 --- a/Source/WebCore/css/SelectorChecker.h +++ b/Source/WebCore/css/SelectorChecker.h @@ -51,8 +51,28 @@ public: enum SelectorMatch { SelectorMatches, SelectorFailsLocally, SelectorFailsAllSiblings, SelectorFailsCompletely }; enum VisitedMatchType { VisitedMatchDisabled, VisitedMatchEnabled }; + + struct SelectorCheckingContext { + // Initial selector constructor + SelectorCheckingContext(CSSSelector* selector, Element* element, VisitedMatchType visitedMatchType, RenderStyle* elementStyle = 0, RenderStyle* elementParentStyle = 0) + : selector(selector) + , element(element) + , visitedMatchType(visitedMatchType) + , elementStyle(elementStyle) + , elementParentStyle(elementParentStyle) + , isSubSelector(false) + { } + + CSSSelector* selector; + Element* element; + VisitedMatchType visitedMatchType; + RenderStyle* elementStyle; + RenderStyle* elementParentStyle; + bool isSubSelector; + }; + bool checkSelector(CSSSelector*, Element*, bool isFastCheckableSelector = false) const; - SelectorMatch checkSelector(CSSSelector*, Element*, PseudoId& dynamicPseudo, bool isSubSelector, VisitedMatchType, RenderStyle* = 0, RenderStyle* elementParentStyle = 0) const; + SelectorMatch checkSelector(const SelectorCheckingContext&, PseudoId&) const; static bool isFastCheckableSelector(const CSSSelector*); bool fastCheckSelector(const CSSSelector*, const Element*) const; @@ -96,7 +116,7 @@ public: static bool determineSelectorScopes(const CSSSelectorList&, HashSet<AtomicStringImpl*>& idScopes, HashSet<AtomicStringImpl*>& classScopes); private: - bool checkOneSelector(CSSSelector*, Element*, PseudoId& dynamicPseudo, bool isSubSelector, VisitedMatchType, RenderStyle*, RenderStyle* elementParentStyle) const; + bool checkOneSelector(const SelectorCheckingContext&, PseudoId&) const; bool checkScrollbarPseudoClass(CSSSelector*, PseudoId& dynamicPseudo) const; static bool isFrameFocused(const Element*); @@ -185,12 +205,11 @@ inline bool SelectorChecker::attributeNameMatches(const Attribute* attribute, co inline bool SelectorChecker::checkExactAttribute(const Element* element, const QualifiedName& selectorAttributeName, const AtomicStringImpl* value) { - NamedNodeMap* attributeMap = element->attributeMap(); - if (!attributeMap) + if (!element->hasAttributesWithoutUpdate()) return false; - unsigned size = attributeMap->length(); + unsigned size = element->attributeCount(); for (unsigned i = 0; i < size; ++i) { - Attribute* attribute = attributeMap->attributeItem(i); + Attribute* attribute = element->attributeItem(i); if (attributeNameMatches(attribute, selectorAttributeName) && (!value || attribute->value().impl() == value)) return true; } diff --git a/Source/WebCore/css/StyleMedia.idl b/Source/WebCore/css/StyleMedia.idl index 09f2ae1e5..6ff457803 100644 --- a/Source/WebCore/css/StyleMedia.idl +++ b/Source/WebCore/css/StyleMedia.idl @@ -26,7 +26,7 @@ module view { interface [ - GenerateIsReachable=ImplFrame + JSGenerateIsReachable=ImplFrame ] StyleMedia { readonly attribute DOMString type; boolean matchMedium(in [Optional=CallWithDefaultValue] DOMString mediaquery); diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp b/Source/WebCore/css/StylePropertySet.cpp index c7d5d06f6..11ec77172 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.cpp +++ b/Source/WebCore/css/StylePropertySet.cpp @@ -1,6 +1,6 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All rights reserved. * Copyright (C) 2011 Research In Motion Limited. All rights reserved. * * This library is free software; you can redistribute it and/or @@ -20,7 +20,7 @@ */ #include "config.h" -#include "CSSMutableStyleDeclaration.h" +#include "StylePropertySet.h" #include "CSSImageValue.h" #include "CSSParser.h" @@ -45,12 +45,46 @@ using namespace std; namespace WebCore { +class PropertySetCSSStyleDeclaration : public CSSStyleDeclaration { +public: + static PassRefPtr<PropertySetCSSStyleDeclaration> create(PassRefPtr<StylePropertySet> propertySet) + { + return adoptRef(new PropertySetCSSStyleDeclaration(propertySet)); + } + +private: + PropertySetCSSStyleDeclaration(PassRefPtr<StylePropertySet> propertySet) : m_propertySet(propertySet) { } + + virtual CSSRule* parentRule() const OVERRIDE; + virtual unsigned length() const OVERRIDE; + virtual String item(unsigned index) const; + virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName) OVERRIDE; + virtual String getPropertyValue(const String& propertyName) OVERRIDE; + virtual String getPropertyPriority(const String& propertyName) OVERRIDE; + virtual String getPropertyShorthand(const String& propertyName) OVERRIDE; + virtual bool isPropertyImplicit(const String& propertyName) OVERRIDE; + virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&) OVERRIDE; + virtual String removeProperty(const String& propertyName, ExceptionCode&) OVERRIDE; + virtual String cssText() const OVERRIDE; + virtual void setCssText(const String&, ExceptionCode&); + virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID) OVERRIDE; + virtual String getPropertyValueInternal(CSSPropertyID) OVERRIDE; + virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&) OVERRIDE; + + virtual bool cssPropertyMatches(const CSSProperty*) const OVERRIDE; + virtual CSSStyleSheet* parentStyleSheet() const OVERRIDE; + virtual PassRefPtr<StylePropertySet> copy() const OVERRIDE; + virtual PassRefPtr<StylePropertySet> makeMutable() OVERRIDE; + + RefPtr<StylePropertySet> m_propertySet; +}; + namespace { class StyleAttributeMutationScope { WTF_MAKE_NONCOPYABLE(StyleAttributeMutationScope); public: - StyleAttributeMutationScope(CSSMutableStyleDeclaration* decl) + StyleAttributeMutationScope(StylePropertySet* decl) { ++s_scopeCount; @@ -92,7 +126,7 @@ public: return; } // We have to clear internal state before calling Inspector's code. - CSSMutableStyleDeclaration* localCopyStyleDecl = s_currentDecl; + StylePropertySet* localCopyStyleDecl = s_currentDecl; s_currentDecl = 0; s_shouldNotifyInspector = false; if (localCopyStyleDecl->isInlineStyleDeclaration() && localCopyStyleDecl->parentElement() && localCopyStyleDecl->parentElement()->document()) @@ -114,7 +148,7 @@ public: private: static unsigned s_scopeCount; - static CSSMutableStyleDeclaration* s_currentDecl; + static StylePropertySet* s_currentDecl; static bool s_shouldNotifyInspector; #if ENABLE(MUTATION_OBSERVERS) static bool s_shouldDeliver; @@ -125,7 +159,7 @@ private: }; unsigned StyleAttributeMutationScope::s_scopeCount = 0; -CSSMutableStyleDeclaration* StyleAttributeMutationScope::s_currentDecl = 0; +StylePropertySet* StyleAttributeMutationScope::s_currentDecl = 0; bool StyleAttributeMutationScope::s_shouldNotifyInspector = false; #if ENABLE(MUTATION_OBSERVERS) bool StyleAttributeMutationScope::s_shouldDeliver = false; @@ -133,27 +167,37 @@ bool StyleAttributeMutationScope::s_shouldDeliver = false; } // namespace -CSSMutableStyleDeclaration::CSSMutableStyleDeclaration() +StylePropertySet::StylePropertySet() + : m_strictParsing(false) + , m_parentIsElement(false) + , m_isInlineStyleDeclaration(false) + , m_parent(static_cast<CSSRule*>(0)) { - // This constructor is used for various inline style declarations, so disable strict parsing. - m_strictParsing = false; } -CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent) - : CSSStyleDeclaration(parent) +StylePropertySet::StylePropertySet(CSSRule* parentRule) + : m_strictParsing(!parentRule || parentRule->useStrictParsing()) + , m_parentIsElement(false) + , m_isInlineStyleDeclaration(false) + , m_parent(parentRule) { } -CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Vector<CSSProperty>& properties) - : CSSStyleDeclaration(parent) - , m_properties(properties) +StylePropertySet::StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>& properties) + : m_properties(properties) + , m_strictParsing(!parentRule || parentRule->useStrictParsing()) + , m_parentIsElement(false) + , m_isInlineStyleDeclaration(false) + , m_parent(parentRule) { m_properties.shrinkToFit(); - // FIXME: This allows duplicate properties. } -CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties) - : CSSStyleDeclaration(parent) +StylePropertySet::StylePropertySet(CSSRule* parentRule, const CSSProperty* const * properties, int numProperties) + : m_strictParsing(!parentRule || parentRule->useStrictParsing()) + , m_parentIsElement(false) + , m_isInlineStyleDeclaration(false) + , m_parent(parentRule) { m_properties.reserveInitialCapacity(numProperties); HashMap<int, bool> candidates; @@ -174,21 +218,45 @@ CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CS } } -CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(StyledElement* element) - : CSSStyleDeclaration(element) -{ +StylePropertySet::StylePropertySet(StyledElement* parentElement, bool isInlineStyle) + : m_strictParsing(false) + , m_parentIsElement(true) + , m_isInlineStyleDeclaration(isInlineStyle) + , m_parent(parentElement) +{ +} + +StylePropertySet::~StylePropertySet() +{ +} + +void StylePropertySet::deref() +{ + if (derefBase()) { + delete this; + return; + } + // StylePropertySet and CSSStyleDeclaration ref each other. When we have a declaration and + // our refcount drops to one we know it is the only thing keeping us alive. + if (m_cssStyleDeclaration && hasOneRef()) + m_cssStyleDeclaration.clear(); } -CSSMutableStyleDeclaration::~CSSMutableStyleDeclaration() +CSSStyleSheet* StylePropertySet::contextStyleSheet() const { + if (m_parentIsElement) { + Document* document = m_parent.element ? m_parent.element->document() : 0; + return document ? document->elementSheet() : 0; + } + return m_parent.rule ? m_parent.rule->parentStyleSheet() : 0; } -void CSSMutableStyleDeclaration::copyPropertiesFrom(const CSSMutableStyleDeclaration& other) +void StylePropertySet::copyPropertiesFrom(const StylePropertySet& other) { m_properties = other.m_properties; } -String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const +String StylePropertySet::getPropertyValue(int propertyID) const { RefPtr<CSSValue> value = getPropertyCSSValue(propertyID); if (value) @@ -359,7 +427,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const return String(); } -String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) const +String StylePropertySet::borderSpacingValue(const int properties[2]) const { RefPtr<CSSValue> horizontalValue = getPropertyCSSValue(properties[0]); RefPtr<CSSValue> verticalValue = getPropertyCSSValue(properties[1]); @@ -375,7 +443,7 @@ String CSSMutableStyleDeclaration::borderSpacingValue(const int properties[2]) c return horizontalValueCSSText + ' ' + verticalValueCSSText; } -bool CSSMutableStyleDeclaration::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const +bool StylePropertySet::appendFontLonghandValueIfExplicit(int propertyId, StringBuilder& result) const { const CSSProperty* property = findPropertyWithId(propertyId); if (!property) @@ -406,7 +474,7 @@ bool CSSMutableStyleDeclaration::appendFontLonghandValueIfExplicit(int propertyI return true; } -String CSSMutableStyleDeclaration::fontValue() const +String StylePropertySet::fontValue() const { const CSSProperty* fontSizeProperty = findPropertyWithId(CSSPropertyFontSize); if (!fontSizeProperty || fontSizeProperty->isImplicit()) @@ -431,7 +499,7 @@ String CSSMutableStyleDeclaration::fontValue() const return result.toString(); } -String CSSMutableStyleDeclaration::get4Values(const int* properties) const +String StylePropertySet::get4Values(const int* properties) const { // Assume the properties are in the usual order top, right, bottom, left. RefPtr<CSSValue> topValue = getPropertyCSSValue(properties[0]); @@ -458,7 +526,7 @@ String CSSMutableStyleDeclaration::get4Values(const int* properties) const return res; } -String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* properties, size_t size) const +String StylePropertySet::getLayeredShorthandValue(const int* properties, size_t size) const { String res; @@ -559,7 +627,7 @@ String CSSMutableStyleDeclaration::getLayeredShorthandValue(const int* propertie return res; } -String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size_t size) const +String StylePropertySet::getShorthandValue(const int* properties, size_t size) const { String res; for (size_t i = 0; i < size; ++i) { @@ -577,7 +645,7 @@ String CSSMutableStyleDeclaration::getShorthandValue(const int* properties, size } // only returns a non-null value if all properties have the same, non-null value -String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t size) const +String StylePropertySet::getCommonValue(const int* properties, size_t size) const { String res; for (size_t i = 0; i < size; ++i) { @@ -595,13 +663,13 @@ String CSSMutableStyleDeclaration::getCommonValue(const int* properties, size_t return res; } -PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(int propertyID) const +PassRefPtr<CSSValue> StylePropertySet::getPropertyCSSValue(int propertyID) const { const CSSProperty* property = findPropertyWithId(propertyID); return property ? property->value() : 0; } -bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool notifyChanged) +bool StylePropertySet::removeShorthandProperty(int propertyID, bool notifyChanged) { CSSPropertyLonghand longhand = longhandForProperty(propertyID); if (!longhand.length()) @@ -609,7 +677,7 @@ bool CSSMutableStyleDeclaration::removeShorthandProperty(int propertyID, bool no return removePropertiesInSet(longhand.properties(), longhand.length(), notifyChanged); } -String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyChanged, bool returnText) +String StylePropertySet::removeProperty(int propertyID, bool notifyChanged, bool returnText) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -640,25 +708,31 @@ String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyCha return value; } -void CSSMutableStyleDeclaration::setNeedsStyleRecalc() +void StylePropertySet::setNeedsStyleRecalc() { - if (isInlineStyleDeclaration()) { + if (m_parentIsElement) { StyledElement* element = parentElement(); if (!element) return; + + if (!m_isInlineStyleDeclaration) { + element->setNeedsStyleRecalc(); + return; + } + element->setNeedsStyleRecalc(InlineStyleChange); element->invalidateStyleAttribute(); StyleAttributeMutationScope(this).didInvalidateStyleAttr(); return; } - if (CSSStyleSheet* styleSheet = parentStyleSheet()) { + if (CSSStyleSheet* styleSheet = contextStyleSheet()) { if (Document* document = styleSheet->findDocument()) document->styleSelectorChanged(DeferRecalcStyle); } } -bool CSSMutableStyleDeclaration::propertyIsImportant(int propertyID) const +bool StylePropertySet::propertyIsImportant(int propertyID) const { const CSSProperty* property = findPropertyWithId(propertyID); if (property) @@ -675,19 +749,19 @@ bool CSSMutableStyleDeclaration::propertyIsImportant(int propertyID) const return true; } -int CSSMutableStyleDeclaration::getPropertyShorthand(int propertyID) const +int StylePropertySet::getPropertyShorthand(int propertyID) const { const CSSProperty* property = findPropertyWithId(propertyID); return property ? property->shorthandID() : 0; } -bool CSSMutableStyleDeclaration::isPropertyImplicit(int propertyID) const +bool StylePropertySet::isPropertyImplicit(int propertyID) const { const CSSProperty* property = findPropertyWithId(propertyID); return property ? property->isImplicit() : false; } -bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value, bool important, bool notifyChanged) +bool StylePropertySet::setProperty(int propertyID, const String& value, bool important, bool notifyChanged) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -719,7 +793,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, const String& value return true; } -void CSSMutableStyleDeclaration::setProperty(const CSSProperty& property, CSSProperty* slot) +void StylePropertySet::setProperty(const CSSProperty& property, CSSProperty* slot) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -739,7 +813,7 @@ void CSSMutableStyleDeclaration::setProperty(const CSSProperty& property, CSSPro #endif } -bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool important, bool notifyChanged) +bool StylePropertySet::setProperty(int propertyID, int value, bool important, bool notifyChanged) { CSSProperty property(propertyID, CSSPrimitiveValue::createIdentifier(value), important); setProperty(property); @@ -748,7 +822,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, int value, bool imp return true; } -bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged) +bool StylePropertySet::setProperty(int propertyID, double value, CSSPrimitiveValue::UnitTypes unit, bool important, bool notifyChanged) { CSSProperty property(propertyID, CSSPrimitiveValue::create(value, unit), important); setProperty(property); @@ -757,7 +831,7 @@ bool CSSMutableStyleDeclaration::setProperty(int propertyID, double value, CSSPr return true; } -void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration) +void StylePropertySet::parseDeclaration(const String& styleDeclaration) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -774,7 +848,7 @@ void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration setNeedsStyleRecalc(); } -void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* properties, int numProperties) +void StylePropertySet::addParsedProperties(const CSSProperty* const* properties, int numProperties) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -792,7 +866,7 @@ void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* p // a notifyChanged argument to this function to follow the model of other functions in this class. } -void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property) +void StylePropertySet::addParsedProperty(const CSSProperty& property) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -809,19 +883,7 @@ void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property) #endif } -unsigned CSSMutableStyleDeclaration::length() const -{ - return propertyCount(); -} - -String CSSMutableStyleDeclaration::item(unsigned i) const -{ - if (i >= m_properties.size()) - return ""; - return getPropertyName(static_cast<CSSPropertyID>(m_properties[i].id())); -} - -String CSSMutableStyleDeclaration::asText() const +String StylePropertySet::asText() const { String result = ""; @@ -883,14 +945,7 @@ String CSSMutableStyleDeclaration::asText() const return result; } -void CSSMutableStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) -{ - ec = 0; - // FIXME: Detect syntax errors and set ec. - parseDeclaration(text); -} - -void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, bool argOverridesOnConflict) +void StylePropertySet::merge(const StylePropertySet* other, bool argOverridesOnConflict) { #if ENABLE(MUTATION_OBSERVERS) StyleAttributeMutationScope mutationScope(this); @@ -916,9 +971,9 @@ void CSSMutableStyleDeclaration::merge(const CSSMutableStyleDeclaration* other, // a notifyChanged argument to this function to follow the model of other functions in this class. } -void CSSMutableStyleDeclaration::addSubresourceStyleURLs(ListHashSet<KURL>& urls) +void StylePropertySet::addSubresourceStyleURLs(ListHashSet<KURL>& urls) { - CSSStyleSheet* sheet = parentStyleSheet(); + CSSStyleSheet* sheet = contextStyleSheet(); size_t size = m_properties.size(); for (size_t i = 0; i < size; ++i) m_properties[i].value()->addSubresourceStyleURLs(urls, sheet); @@ -952,17 +1007,17 @@ static const int blockProperties[] = { const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties); -PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyBlockProperties() const +PassRefPtr<StylePropertySet> StylePropertySet::copyBlockProperties() const { return copyPropertiesInSet(blockProperties, numBlockProperties); } -void CSSMutableStyleDeclaration::removeBlockProperties() +void StylePropertySet::removeBlockProperties() { removePropertiesInSet(blockProperties, numBlockProperties); } -bool CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged) +bool StylePropertySet::removePropertiesInSet(const int* set, unsigned length, bool notifyChanged) { if (m_properties.isEmpty()) return false; @@ -1003,17 +1058,7 @@ bool CSSMutableStyleDeclaration::removePropertiesInSet(const int* set, unsigned return changed; } -PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::makeMutable() -{ - return this; -} - -PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copy() const -{ - return adoptRef(new CSSMutableStyleDeclaration(0, m_properties)); -} - -const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) const +const CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) const { for (int n = m_properties.size() - 1 ; n >= 0; --n) { if (propertyID == m_properties[n].m_id) @@ -1022,7 +1067,7 @@ const CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID return 0; } -CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) +CSSProperty* StylePropertySet::findPropertyWithId(int propertyID) { for (int n = m_properties.size() - 1 ; n >= 0; --n) { if (propertyID == m_properties[n].m_id) @@ -1030,120 +1075,193 @@ CSSProperty* CSSMutableStyleDeclaration::findPropertyWithId(int propertyID) } return 0; } + +bool StylePropertySet::propertyMatches(const CSSProperty* property) const +{ + RefPtr<CSSValue> value = getPropertyCSSValue(property->id()); + return value && value->cssText() == property->value()->cssText(); +} + +void StylePropertySet::removeEquivalentProperties(const StylePropertySet* style) +{ + Vector<int> propertiesToRemove; + size_t size = m_properties.size(); + for (size_t i = 0; i < size; ++i) { + const CSSProperty& property = m_properties[i]; + if (style->propertyMatches(&property)) + propertiesToRemove.append(property.id()); + } + // FIXME: This should use mass removal. + for (unsigned i = 0; i < propertiesToRemove.size(); ++i) + removeProperty(propertiesToRemove[i]); +} + +void StylePropertySet::removeEquivalentProperties(const CSSStyleDeclaration* style) +{ + Vector<int> propertiesToRemove; + size_t size = m_properties.size(); + for (size_t i = 0; i < size; ++i) { + const CSSProperty& property = m_properties[i]; + if (style->cssPropertyMatches(&property)) + propertiesToRemove.append(property.id()); + } + // FIXME: This should use mass removal. + for (unsigned i = 0; i < propertiesToRemove.size(); ++i) + removeProperty(propertiesToRemove[i]); +} + +PassRefPtr<StylePropertySet> StylePropertySet::copy() const +{ + return adoptRef(new StylePropertySet(0, m_properties)); +} + +PassRefPtr<StylePropertySet> StylePropertySet::copyPropertiesInSet(const int* set, unsigned length) const +{ + Vector<CSSProperty> list; + list.reserveInitialCapacity(length); + for (unsigned i = 0; i < length; ++i) { + RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); + if (value) + list.append(CSSProperty(set[i], value.release(), false)); + } + return StylePropertySet::create(list); +} + +CSSStyleDeclaration* StylePropertySet::ensureCSSStyleDeclaration() const +{ + if (!m_cssStyleDeclaration) + m_cssStyleDeclaration = PropertySetCSSStyleDeclaration::create(const_cast<StylePropertySet*>(this)); + return m_cssStyleDeclaration.get(); +} + +unsigned PropertySetCSSStyleDeclaration::length() const +{ + return m_propertySet->propertyCount(); +} + +String PropertySetCSSStyleDeclaration::item(unsigned i) const +{ + if (i >= m_propertySet->propertyCount()) + return ""; + return getPropertyName(static_cast<CSSPropertyID>(m_propertySet->propertyAt(i).id())); +} -String CSSMutableStyleDeclaration::cssText() const +CSSRule* PropertySetCSSStyleDeclaration::parentRule() const { - return asText(); + return m_propertySet->parentRuleInternal(); } -PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValue(const String& propertyName) +String PropertySetCSSStyleDeclaration::cssText() const +{ + return m_propertySet->asText(); +} + +void PropertySetCSSStyleDeclaration::setCssText(const String& text, ExceptionCode& ec) +{ + ec = 0; + // FIXME: Detect syntax errors and set ec. + m_propertySet->parseDeclaration(text); +} + +PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValue(const String& propertyName) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return 0; - return getPropertyCSSValue(propertyID); + return m_propertySet->getPropertyCSSValue(propertyID); } -String CSSMutableStyleDeclaration::getPropertyValue(const String &propertyName) +String PropertySetCSSStyleDeclaration::getPropertyValue(const String &propertyName) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); - return getPropertyValue(propertyID); + return m_propertySet->getPropertyValue(propertyID); } -String CSSMutableStyleDeclaration::getPropertyPriority(const String& propertyName) +String PropertySetCSSStyleDeclaration::getPropertyPriority(const String& propertyName) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); - return propertyIsImportant(propertyID) ? "important" : ""; + return m_propertySet->propertyIsImportant(propertyID) ? "important" : ""; } -String CSSMutableStyleDeclaration::getPropertyShorthand(const String& propertyName) +String PropertySetCSSStyleDeclaration::getPropertyShorthand(const String& propertyName) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); - int shorthandID = getPropertyShorthand(propertyID); + int shorthandID = m_propertySet->getPropertyShorthand(propertyID); if (!shorthandID) return String(); return getPropertyName(static_cast<CSSPropertyID>(shorthandID)); } -bool CSSMutableStyleDeclaration::isPropertyImplicit(const String& propertyName) +bool PropertySetCSSStyleDeclaration::isPropertyImplicit(const String& propertyName) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return false; - return isPropertyImplicit(propertyID); + return m_propertySet->isPropertyImplicit(propertyID); } -void CSSMutableStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) +void PropertySetCSSStyleDeclaration::setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode& ec) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return; bool important = priority.find("important", 0, false) != notFound; ec = 0; - setProperty(propertyID, value, important, true); + m_propertySet->setProperty(propertyID, value, important, true); } -String CSSMutableStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec) +String PropertySetCSSStyleDeclaration::removeProperty(const String& propertyName, ExceptionCode& ec) { int propertyID = cssPropertyID(propertyName); if (!propertyID) return String(); ec = 0; - return removeProperty(propertyID, true, true); + return m_propertySet->removeProperty(propertyID, true, true); } -PassRefPtr<CSSValue> CSSMutableStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) +PassRefPtr<CSSValue> PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal(CSSPropertyID propertyID) { - return getPropertyCSSValue(propertyID); + return m_propertySet->getPropertyCSSValue(propertyID); } -String CSSMutableStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID) +String PropertySetCSSStyleDeclaration::getPropertyValueInternal(CSSPropertyID propertyID) { - return getPropertyValue(propertyID); + return m_propertySet->getPropertyValue(propertyID); } -void CSSMutableStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) +void PropertySetCSSStyleDeclaration::setPropertyInternal(CSSPropertyID propertyID, const String& value, bool important, ExceptionCode& ec) { ec = 0; - setProperty(propertyID, value, important, true); + m_propertySet->setProperty(propertyID, value, important, true); } -PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyPropertiesInSet(const int* set, unsigned length) const +CSSStyleSheet* PropertySetCSSStyleDeclaration::parentStyleSheet() const +{ + return m_propertySet->contextStyleSheet(); +} + +PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::copy() const { - Vector<CSSProperty> list; - list.reserveInitialCapacity(length); - for (unsigned i = 0; i < length; ++i) { - RefPtr<CSSValue> value = getPropertyCSSValue(set[i]); - if (value) - list.append(CSSProperty(set[i], value.release(), false)); - } - return CSSMutableStyleDeclaration::create(list); + return m_propertySet->copy(); } -bool CSSMutableStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const +PassRefPtr<StylePropertySet> PropertySetCSSStyleDeclaration::makeMutable() { - RefPtr<CSSValue> value = getPropertyCSSValue(property->id()); - return value && value->cssText() == property->value()->cssText(); + ASSERT(m_propertySet->m_cssStyleDeclaration == this || (!m_propertySet->m_cssStyleDeclaration && m_propertySet->hasOneRef())); + if (!m_propertySet->m_cssStyleDeclaration) + m_propertySet->m_cssStyleDeclaration = this; + return m_propertySet; } -void CSSMutableStyleDeclaration::removeEquivalentProperties(const CSSStyleDeclaration* style) +bool PropertySetCSSStyleDeclaration::cssPropertyMatches(const CSSProperty* property) const { - Vector<int> propertiesToRemove; - size_t size = m_properties.size(); - for (size_t i = 0; i < size; ++i) { - const CSSProperty& property = m_properties[i]; - if (style->cssPropertyMatches(&property)) - propertiesToRemove.append(property.id()); - } - // FIXME: This should use mass removal. - for (unsigned i = 0; i < propertiesToRemove.size(); ++i) - removeProperty(propertiesToRemove[i]); + return m_propertySet->propertyMatches(property); } } // namespace WebCore diff --git a/Source/WebCore/css/CSSMutableStyleDeclaration.h b/Source/WebCore/css/StylePropertySet.h index 73af49f2e..a61b3767d 100644 --- a/Source/WebCore/css/CSSMutableStyleDeclaration.h +++ b/Source/WebCore/css/StylePropertySet.h @@ -1,6 +1,6 @@ /* * (C) 1999-2003 Lars Knoll (knoll@kde.org) - * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2004, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -18,12 +18,12 @@ * Boston, MA 02110-1301, USA. */ -#ifndef CSSMutableStyleDeclaration_h -#define CSSMutableStyleDeclaration_h +#ifndef StylePropertySet_h +#define StylePropertySet_h -#include "CSSStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSProperty.h" +#include "CSSStyleDeclaration.h" #include "KURLHash.h" #include "PlatformString.h" #include <wtf/ListHashSet.h> @@ -31,33 +31,40 @@ namespace WebCore { +class PropertySetCSSStyleDeclaration; class StyledElement; -class CSSMutableStyleDeclaration : public CSSStyleDeclaration { +class StylePropertySet : public WTF::RefCountedBase { public: - virtual ~CSSMutableStyleDeclaration(); + ~StylePropertySet(); - static PassRefPtr<CSSMutableStyleDeclaration> create() + static PassRefPtr<StylePropertySet> create() + { + return adoptRef(new StylePropertySet); + } + static PassRefPtr<StylePropertySet> create(CSSRule* parentRule) { - return adoptRef(new CSSMutableStyleDeclaration); + return adoptRef(new StylePropertySet(parentRule)); } - static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule) + static PassRefPtr<StylePropertySet> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties) { - return adoptRef(new CSSMutableStyleDeclaration(parentRule)); + return adoptRef(new StylePropertySet(parentRule, properties, numProperties)); } - static PassRefPtr<CSSMutableStyleDeclaration> create(CSSRule* parentRule, const CSSProperty* const* properties, int numProperties) + static PassRefPtr<StylePropertySet> create(const Vector<CSSProperty>& properties) { - return adoptRef(new CSSMutableStyleDeclaration(parentRule, properties, numProperties)); + return adoptRef(new StylePropertySet(0, properties)); } - static PassRefPtr<CSSMutableStyleDeclaration> create(const Vector<CSSProperty>& properties) + static PassRefPtr<StylePropertySet> createInline(StyledElement* element) { - return adoptRef(new CSSMutableStyleDeclaration(0, properties)); + return adoptRef(new StylePropertySet(element, /*isInlineStyle*/ true)); } - static PassRefPtr<CSSMutableStyleDeclaration> createInline(StyledElement* element) - { - return adoptRef(new CSSMutableStyleDeclaration(element)); + static PassRefPtr<StylePropertySet> createAttributeStyle(StyledElement* element) + { + return adoptRef(new StylePropertySet(element, /*isInlineStyle*/ false)); } + void deref(); + unsigned propertyCount() const { return m_properties.size(); } bool isEmpty() const { return m_properties.isEmpty(); } const CSSProperty& propertyAt(unsigned index) const { return m_properties[index]; } @@ -68,8 +75,6 @@ public: int getPropertyShorthand(int propertyID) const; bool isPropertyImplicit(int propertyID) const; - virtual PassRefPtr<CSSMutableStyleDeclaration> copy() const; - bool setProperty(int propertyID, int value, bool important = false) { return setProperty(propertyID, value, important, true); } bool setProperty(int propertyId, double value, CSSPrimitiveValue::UnitTypes unit, bool important = false) { return setProperty(propertyId, value, unit, important, true); } bool setProperty(int propertyID, const String& value, bool important = false) { return setProperty(propertyID, value, important, true); } @@ -87,50 +92,45 @@ public: // This does no change notifications since it's only called by createMarkup. void addParsedProperty(const CSSProperty&); - PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const; + PassRefPtr<StylePropertySet> copyBlockProperties() const; void removeBlockProperties(); void removePropertiesInSet(const int* set, unsigned length) { removePropertiesInSet(set, length, true); } - void merge(const CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true); + void merge(const StylePropertySet*, bool argOverridesOnConflict = true); void setStrictParsing(bool b) { m_strictParsing = b; } bool useStrictParsing() const { return m_strictParsing; } + bool isInlineStyleDeclaration() const { return m_isInlineStyleDeclaration; } void addSubresourceStyleURLs(ListHashSet<KURL>&); + PassRefPtr<StylePropertySet> copy() const; // Used by StyledElement::copyNonAttributeProperties(). - void copyPropertiesFrom(const CSSMutableStyleDeclaration&); + void copyPropertiesFrom(const StylePropertySet&); + void removeEquivalentProperties(const StylePropertySet*); void removeEquivalentProperties(const CSSStyleDeclaration*); - PassRefPtr<CSSMutableStyleDeclaration> copyPropertiesInSet(const int* set, unsigned length) const; + PassRefPtr<StylePropertySet> copyPropertiesInSet(const int* set, unsigned length) const; + + CSSRule* parentRuleInternal() const { return m_parentIsElement ? 0 : m_parent.rule; } + void clearParentRule() { ASSERT(!m_parentIsElement); m_parent.rule = 0; } + StyledElement* parentElement() const { ASSERT(m_parentIsElement); return m_parent.element; } + void clearParentElement() { ASSERT(m_parentIsElement); m_parent.element = 0; } + + CSSStyleSheet* contextStyleSheet() const; + String asText() const; + + CSSStyleDeclaration* ensureCSSStyleDeclaration() const; private: - CSSMutableStyleDeclaration(); - CSSMutableStyleDeclaration(CSSRule* parentRule); - CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&); - CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties); - CSSMutableStyleDeclaration(StyledElement*); - - virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable(); - - // CSSOM functions. Don't make these public. - virtual unsigned length() const; - virtual String item(unsigned index) const; - virtual PassRefPtr<CSSValue> getPropertyCSSValue(const String& propertyName); - virtual String getPropertyValue(const String& propertyName); - virtual String getPropertyPriority(const String& propertyName); - virtual String getPropertyShorthand(const String& propertyName); - virtual bool isPropertyImplicit(const String& propertyName); - virtual void setProperty(const String& propertyName, const String& value, const String& priority, ExceptionCode&); - virtual String removeProperty(const String& propertyName, ExceptionCode&); - virtual String cssText() const; - virtual void setCssText(const String&, ExceptionCode&); - virtual PassRefPtr<CSSValue> getPropertyCSSValueInternal(CSSPropertyID); - virtual String getPropertyValueInternal(CSSPropertyID); - virtual void setPropertyInternal(CSSPropertyID, const String& value, bool important, ExceptionCode&); + StylePropertySet(); + StylePropertySet(CSSRule* parentRule); + StylePropertySet(CSSRule* parentRule, const Vector<CSSProperty>&); + StylePropertySet(CSSRule* parentRule, const CSSProperty* const *, int numProperties); + StylePropertySet(StyledElement*, bool isInlineStyle); void setNeedsStyleRecalc(); @@ -151,15 +151,29 @@ private: bool setProperty(int propertyID, const String& value, bool important, bool notifyChanged); bool removeShorthandProperty(int propertyID, bool notifyChanged); bool removePropertiesInSet(const int* set, unsigned length, bool notifyChanged); - - virtual bool cssPropertyMatches(const CSSProperty*) const; + bool propertyMatches(const CSSProperty*) const; const CSSProperty* findPropertyWithId(int propertyId) const; CSSProperty* findPropertyWithId(int propertyId); Vector<CSSProperty, 4> m_properties; + + bool m_strictParsing : 1; + bool m_parentIsElement : 1; + bool m_isInlineStyleDeclaration : 1; + + union Parent { + Parent(CSSRule* rule) : rule(rule) { } + Parent(StyledElement* element) : element(element) { } + CSSRule* rule; + StyledElement* element; + } m_parent; + + mutable RefPtr<PropertySetCSSStyleDeclaration> m_cssStyleDeclaration; + + friend class PropertySetCSSStyleDeclaration; }; } // namespace WebCore -#endif // CSSMutableStyleDeclaration_h +#endif // StylePropertySet_h diff --git a/Source/WebCore/css/StyleSheet.idl b/Source/WebCore/css/StyleSheet.idl index 6d5df8076..cad4da4a1 100644 --- a/Source/WebCore/css/StyleSheet.idl +++ b/Source/WebCore/css/StyleSheet.idl @@ -22,10 +22,10 @@ module stylesheets { // Introduced in DOM Level 2: interface [ - CustomMarkFunction, - GenerateIsReachable, - CustomToJS, - Polymorphic, + JSCustomMarkFunction, + JSGenerateIsReachable, + JSCustomToJS, + ObjCPolymorphic, V8DependentLifetime ] StyleSheet { readonly attribute [ConvertNullStringTo=Null] DOMString type; diff --git a/Source/WebCore/css/StyleSheetList.idl b/Source/WebCore/css/StyleSheetList.idl index a7048d998..67390b2dd 100644 --- a/Source/WebCore/css/StyleSheetList.idl +++ b/Source/WebCore/css/StyleSheetList.idl @@ -22,9 +22,9 @@ module stylesheets { // Introduced in DOM Level 2: interface [ - GenerateIsReachable=ImplDocument, - HasIndexGetter, - HasNameGetter, + JSGenerateIsReachable=ImplDocument, + IndexedGetter, + NamedGetter, V8DependentLifetime ] StyleSheetList { readonly attribute unsigned long length; diff --git a/Source/WebCore/css/WebKitCSSFilterValue.idl b/Source/WebCore/css/WebKitCSSFilterValue.idl index 475a80383..3f219137b 100644 --- a/Source/WebCore/css/WebKitCSSFilterValue.idl +++ b/Source/WebCore/css/WebKitCSSFilterValue.idl @@ -27,8 +27,8 @@ module css { interface [ Conditional=CSS_FILTERS, - HasIndexGetter, - DontCheckEnums + IndexedGetter, + DoNotCheckConstants ] WebKitCSSFilterValue : CSSValueList { // OperationTypes diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp index 674aa5a7b..36742a9b3 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "WebKitCSSKeyframeRule.h" -#include "CSSMutableStyleDeclaration.h" +#include "StylePropertySet.h" namespace WebCore { @@ -52,9 +52,9 @@ String WebKitCSSKeyframeRule::cssText() const return result; } -void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<CSSMutableStyleDeclaration> style) +void WebKitCSSKeyframeRule::setDeclaration(PassRefPtr<StylePropertySet> style) { - ASSERT(style->parentRule() == this); + ASSERT(style->parentRuleInternal() == this); m_style = style; } diff --git a/Source/WebCore/css/WebKitCSSKeyframeRule.h b/Source/WebCore/css/WebKitCSSKeyframeRule.h index 083518756..a3d3a2659 100644 --- a/Source/WebCore/css/WebKitCSSKeyframeRule.h +++ b/Source/WebCore/css/WebKitCSSKeyframeRule.h @@ -26,8 +26,8 @@ #ifndef WebKitCSSKeyframeRule_h #define WebKitCSSKeyframeRule_h -#include "CSSMutableStyleDeclaration.h" #include "CSSRule.h" +#include "StylePropertySet.h" #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> @@ -53,19 +53,19 @@ public: void getKeys(Vector<float>& keys) const { parseKeyString(m_key, keys); } - CSSStyleDeclaration* style() const { return m_style.get(); } + CSSStyleDeclaration* style() const { return m_style ? m_style->ensureCSSStyleDeclaration() : 0; } String cssText() const; - CSSMutableStyleDeclaration* declaration() const { return m_style.get(); } - void setDeclaration(PassRefPtr<CSSMutableStyleDeclaration>); + StylePropertySet* declaration() const { return m_style.get(); } + void setDeclaration(PassRefPtr<StylePropertySet>); private: static void parseKeyString(const String& s, Vector<float>& keys); WebKitCSSKeyframeRule(CSSStyleSheet* parent); - RefPtr<CSSMutableStyleDeclaration> m_style; + RefPtr<StylePropertySet> m_style; String m_key; // comma separated list of keys }; diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp index 486cf1f0d..39492f5e5 100644 --- a/Source/WebCore/css/WebKitCSSKeyframesRule.cpp +++ b/Source/WebCore/css/WebKitCSSKeyframesRule.cpp @@ -26,9 +26,9 @@ #include "config.h" #include "WebKitCSSKeyframesRule.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSRuleList.h" +#include "StylePropertySet.h" #include "StyleSheet.h" #include "WebKitCSSKeyframeRule.h" diff --git a/Source/WebCore/css/WebKitCSSKeyframesRule.idl b/Source/WebCore/css/WebKitCSSKeyframesRule.idl index 87c8dd65e..daf2e7eba 100644 --- a/Source/WebCore/css/WebKitCSSKeyframesRule.idl +++ b/Source/WebCore/css/WebKitCSSKeyframesRule.idl @@ -30,10 +30,10 @@ module css { // Introduced in DOM Level ?: interface [ - HasIndexGetter + IndexedGetter ] WebKitCSSKeyframesRule : CSSRule { - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString name; + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString name; readonly attribute CSSRuleList cssRules; void insertRule(in [Optional=CallWithDefaultValue] DOMString rule); diff --git a/Source/WebCore/css/WebKitCSSMatrix.cpp b/Source/WebCore/css/WebKitCSSMatrix.cpp index f61719e7f..86e88b204 100644 --- a/Source/WebCore/css/WebKitCSSMatrix.cpp +++ b/Source/WebCore/css/WebKitCSSMatrix.cpp @@ -28,10 +28,10 @@ #include "CSSParser.h" #include "CSSStyleSelector.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" #include "ExceptionCode.h" +#include "StylePropertySet.h" #include <wtf/MathExtras.h> namespace WebCore { @@ -52,7 +52,7 @@ WebKitCSSMatrix::~WebKitCSSMatrix() void WebKitCSSMatrix::setMatrixValue(const String& string, ExceptionCode& ec) { - RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(); if (CSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, true)) { // Convert to TransformOperations. This can fail if a property // requires style (i.e., param uses 'ems' or 'exs') diff --git a/Source/WebCore/css/WebKitCSSMatrix.idl b/Source/WebCore/css/WebKitCSSMatrix.idl index f2173bf19..c6adabfa4 100644 --- a/Source/WebCore/css/WebKitCSSMatrix.idl +++ b/Source/WebCore/css/WebKitCSSMatrix.idl @@ -101,7 +101,7 @@ module css { // Passing a NaN will use a value of 0. [Immutable] WebKitCSSMatrix skewY(in [Optional=CallWithDefaultValue] double angle); - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); }; } diff --git a/Source/WebCore/css/WebKitCSSTransformValue.idl b/Source/WebCore/css/WebKitCSSTransformValue.idl index 007097e7c..92fde1d36 100644 --- a/Source/WebCore/css/WebKitCSSTransformValue.idl +++ b/Source/WebCore/css/WebKitCSSTransformValue.idl @@ -29,8 +29,8 @@ module css { interface [ - HasIndexGetter, - DontCheckEnums + IndexedGetter, + DoNotCheckConstants ] WebKitCSSTransformValue : CSSValueList { // OperationTypes diff --git a/Source/WebCore/dom/Attr.h b/Source/WebCore/dom/Attr.h index 7b6e332ee..0209f9041 100644 --- a/Source/WebCore/dom/Attr.h +++ b/Source/WebCore/dom/Attr.h @@ -30,6 +30,8 @@ namespace WebCore { +class CSSStyleDeclaration; + // Attr can have Text and EntityReference children // therefore it has to be a fullblown Node. The plan // is to dynamically allocate a textchild and store the @@ -55,8 +57,9 @@ public: bool isId() const; - // An extension to get presentational information for attributes. - CSSStyleDeclaration* style() { return m_attribute->decl(); } + // A deprecated extension to get presentational information for attributes. + // We have to keep it around because it's exposed in the Obj-C DOM API. + CSSStyleDeclaration* style() { return 0; } void setSpecified(bool specified) { m_specified = specified; } diff --git a/Source/WebCore/dom/Attr.idl b/Source/WebCore/dom/Attr.idl index 992a03b96..e3a802cf2 100644 --- a/Source/WebCore/dom/Attr.idl +++ b/Source/WebCore/dom/Attr.idl @@ -21,8 +21,8 @@ module core { interface [ - CustomMarkFunction, - GenerateNativeConverter + JSCustomMarkFunction, + JSGenerateToNativeObject ] Attr : Node { // DOM Level 1 @@ -31,7 +31,7 @@ module core { readonly attribute boolean specified; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString value + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString value setter raises(DOMException); // DOM Level 2 diff --git a/Source/WebCore/dom/Attribute.cpp b/Source/WebCore/dom/Attribute.cpp index 7ed28d83c..5164560b5 100644 --- a/Source/WebCore/dom/Attribute.cpp +++ b/Source/WebCore/dom/Attribute.cpp @@ -40,7 +40,7 @@ static AttributeAttrMap& attributeAttrMap() PassRefPtr<Attribute> Attribute::clone() const { - return adoptRef(new Attribute(m_name, m_value, m_isMappedAttribute, m_mappedAttributeDeclaration.get())); + return adoptRef(new Attribute(m_name, m_value)); } Attr* Attribute::attr() const diff --git a/Source/WebCore/dom/Attribute.h b/Source/WebCore/dom/Attribute.h index 938e1922d..8658775b8 100644 --- a/Source/WebCore/dom/Attribute.h +++ b/Source/WebCore/dom/Attribute.h @@ -25,13 +25,11 @@ #ifndef Attribute_h #define Attribute_h -#include "CSSMappedAttributeDeclaration.h" #include "QualifiedName.h" namespace WebCore { class Attr; -class CSSStyleDeclaration; class Element; class NamedNodeMap; @@ -43,15 +41,11 @@ class Attribute : public RefCounted<Attribute> { public: static PassRefPtr<Attribute> create(const QualifiedName& name, const AtomicString& value) { - return adoptRef(new Attribute(name, value, false, 0)); + return adoptRef(new Attribute(name, value)); } - static PassRefPtr<Attribute> createMapped(const QualifiedName& name, const AtomicString& value) + static PassRefPtr<Attribute> create(const AtomicString& name, const AtomicString& value) { - return adoptRef(new Attribute(name, value, true, 0)); - } - static PassRefPtr<Attribute> createMapped(const AtomicString& name, const AtomicString& value) - { - return adoptRef(new Attribute(name, value, true, 0)); + return adoptRef(new Attribute(name, value)); } const AtomicString& value() const { return m_value; } @@ -68,51 +62,38 @@ public: bool isEmpty() const { return m_value.isEmpty(); } PassRefPtr<Attribute> clone() const; - - CSSMutableStyleDeclaration* decl() const { return m_mappedAttributeDeclaration ? m_mappedAttributeDeclaration->declaration() : 0; } - - CSSMappedAttributeDeclaration* mappedAttributeDeclaration() const { return m_mappedAttributeDeclaration.get(); } - void setMappedAttributeDeclaration(PassRefPtr<CSSMappedAttributeDeclaration> decl) { m_mappedAttributeDeclaration = decl; } void setValue(const AtomicString& value) { m_value = value; } void setPrefix(const AtomicString& prefix) { m_name.setPrefix(prefix); } // Note: This API is only for HTMLTreeBuilder. It is not safe to change the - // name of an attribute once parseMappedAttribute has been called as DOM + // name of an attribute once parseAttribute has been called as DOM // elements may have placed the Attribute in a hash by name. void parserSetName(const QualifiedName& name) { m_name = name; } - bool isMappedAttribute() { return m_isMappedAttribute; } - private: - Attribute(const QualifiedName& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl) - : m_isMappedAttribute(isMappedAttribute) - , m_hasAttr(false) + Attribute(const QualifiedName& name, const AtomicString& value) + : m_hasAttr(false) , m_name(name) , m_value(value) - , m_mappedAttributeDeclaration(styleDecl) { } - Attribute(const AtomicString& name, const AtomicString& value, bool isMappedAttribute, CSSMappedAttributeDeclaration* styleDecl) - : m_isMappedAttribute(isMappedAttribute) - , m_hasAttr(false) + Attribute(const AtomicString& name, const AtomicString& value) + : m_hasAttr(false) , m_name(nullAtom, name, nullAtom) , m_value(value) - , m_mappedAttributeDeclaration(styleDecl) { } void bindAttr(Attr*); void unbindAttr(Attr*); - // These booleans will go into the spare 32-bits of padding from RefCounted in 64-bit. - bool m_isMappedAttribute; + // This boolean will go into the spare 32-bits of padding from RefCounted in 64-bit. bool m_hasAttr; QualifiedName m_name; AtomicString m_value; - RefPtr<CSSMappedAttributeDeclaration> m_mappedAttributeDeclaration; }; } // namespace WebCore diff --git a/Source/WebCore/dom/BeforeLoadEvent.idl b/Source/WebCore/dom/BeforeLoadEvent.idl index 4600e8574..08dfbbb30 100644 --- a/Source/WebCore/dom/BeforeLoadEvent.idl +++ b/Source/WebCore/dom/BeforeLoadEvent.idl @@ -29,7 +29,7 @@ module events { interface [ ConstructorTemplate=Event ] BeforeLoadEvent : Event { - readonly attribute [InitializedByConstructor] DOMString url; + readonly attribute [InitializedByEventConstructor] DOMString url; }; } diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp b/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp deleted file mode 100644 index 72e256a65..000000000 --- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (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, 2011 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ -#include "config.h" -#include "CSSMappedAttributeDeclaration.h" - -#include "CSSImageValue.h" -#include "CSSParser.h" -#include "CSSValuePool.h" -#include "StyledElement.h" - -namespace WebCore { - -inline void CSSMappedAttributeDeclaration::setNeedsStyleRecalc(StyledElement* element) -{ - ASSERT(element); - element->setNeedsStyleRecalc(FullStyleChange); -} - -CSSMappedAttributeDeclaration::~CSSMappedAttributeDeclaration() -{ - StyledElement::removeMappedAttributeDecl(m_entryType, m_attrName, m_attrValue); -} - -void CSSMappedAttributeDeclaration::setMappedImageProperty(StyledElement* element, int propertyId, const String& url) -{ - m_declaration->setProperty(CSSProperty(propertyId, CSSImageValue::create(url))); - setNeedsStyleRecalc(element); -} - -void CSSMappedAttributeDeclaration::setMappedLengthProperty(StyledElement* element, int propertyId, const String& value) -{ - setMappedProperty(element, propertyId, value); -} - -void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, int value) -{ - ASSERT(element->document()); - m_declaration->setProperty(CSSProperty(propertyId, element->document()->cssValuePool()->createIdentifierValue(value))); - setNeedsStyleRecalc(element); -} - -void CSSMappedAttributeDeclaration::setMappedProperty(StyledElement* element, int propertyId, const String& value) -{ - if (value.isEmpty()) { - removeMappedProperty(element, propertyId); - return; - } - - if (!CSSParser::parseMappedAttributeValue(this, element, propertyId, value)) - return; - - setNeedsStyleRecalc(element); -} - -void CSSMappedAttributeDeclaration::removeMappedProperty(StyledElement* element, int propertyId) -{ - m_declaration->removeProperty(propertyId, false, false); - setNeedsStyleRecalc(element); -} - -} diff --git a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h b/Source/WebCore/dom/CSSMappedAttributeDeclaration.h deleted file mode 100644 index d9544ed5e..000000000 --- a/Source/WebCore/dom/CSSMappedAttributeDeclaration.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (C) 1999 Antti Koivisto (koivisto@kde.org) - * (C) 2001 Peter Kelly (pmk@post.com) - * (C) 2001 Dirk Mueller (mueller@kde.org) - * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2011 Apple Inc. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef CSSMappedAttributeDeclaration_h -#define CSSMappedAttributeDeclaration_h - -#include "CSSMutableStyleDeclaration.h" -#include "MappedAttributeEntry.h" -#include "QualifiedName.h" - -namespace WebCore { - -class StyledElement; - -class CSSMappedAttributeDeclaration : public RefCounted<CSSMappedAttributeDeclaration> { -public: - static PassRefPtr<CSSMappedAttributeDeclaration> create() - { - return adoptRef(new CSSMappedAttributeDeclaration); - } - - ~CSSMappedAttributeDeclaration(); - - void setMappedState(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& val) - { - m_entryType = type; - m_attrName = name; - m_attrValue = val; - } - - void setMappedProperty(StyledElement*, int propertyId, int value); - void setMappedProperty(StyledElement*, int propertyId, const String& value); - void setMappedImageProperty(StyledElement*, int propertyId, const String& url); - - // NOTE: setMappedLengthProperty() treats integers as pixels! (Needed for conversion of HTML attributes.) - void setMappedLengthProperty(StyledElement*, int propertyId, const String& value); - - void removeMappedProperty(StyledElement*, int propertyId); - - CSSMutableStyleDeclaration* declaration() const { return m_declaration.get(); } - -private: - CSSMappedAttributeDeclaration() - : m_declaration(CSSMutableStyleDeclaration::create()) - , m_entryType(eNone) - , m_attrName(anyQName()) - { - } - - void setNeedsStyleRecalc(StyledElement*); - - RefPtr<CSSMutableStyleDeclaration> m_declaration; - MappedAttributeEntry m_entryType; - QualifiedName m_attrName; - AtomicString m_attrValue; -}; - -} //namespace - -#endif diff --git a/Source/WebCore/dom/CharacterData.idl b/Source/WebCore/dom/CharacterData.idl index aeeae2f99..dcf796ae5 100644 --- a/Source/WebCore/dom/CharacterData.idl +++ b/Source/WebCore/dom/CharacterData.idl @@ -21,27 +21,27 @@ module core { interface CharacterData : Node { - attribute [TreatNullAs=EmptyString] DOMString data + attribute [TreatNullAs=NullString] DOMString data setter raises(DOMException); readonly attribute unsigned long length; - [ConvertNullStringTo=Null, OldStyleObjC] DOMString substringData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, + [ConvertNullStringTo=Null, ObjCLegacyUnnamedParameters] DOMString substringData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, in [IsIndex,Optional=CallWithDefaultValue] unsigned long length) raises(DOMException); void appendData(in [Optional=CallWithDefaultValue] DOMString data) raises(DOMException); - [OldStyleObjC] void insertData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, + [ObjCLegacyUnnamedParameters] void insertData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, in [Optional=CallWithDefaultValue] DOMString data) raises(DOMException); - [OldStyleObjC] void deleteData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, + [ObjCLegacyUnnamedParameters] void deleteData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, in [IsIndex,Optional=CallWithDefaultValue] unsigned long length) raises(DOMException); - [OldStyleObjC] void replaceData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, + [ObjCLegacyUnnamedParameters] void replaceData(in [IsIndex,Optional=CallWithDefaultValue] unsigned long offset, in [IsIndex,Optional=CallWithDefaultValue] unsigned long length, in [Optional=CallWithDefaultValue] DOMString data) raises(DOMException); diff --git a/Source/WebCore/dom/ClientRectList.idl b/Source/WebCore/dom/ClientRectList.idl index ee4629c30..45d6f485f 100644 --- a/Source/WebCore/dom/ClientRectList.idl +++ b/Source/WebCore/dom/ClientRectList.idl @@ -27,7 +27,7 @@ module view { interface [ - HasIndexGetter + IndexedGetter ] ClientRectList { readonly attribute unsigned long length; ClientRect item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/dom/Clipboard.h b/Source/WebCore/dom/Clipboard.h index f94727a0e..a07ae9fc5 100644 --- a/Source/WebCore/dom/Clipboard.h +++ b/Source/WebCore/dom/Clipboard.h @@ -69,13 +69,13 @@ namespace WebCore { virtual HashSet<String> types() const = 0; virtual PassRefPtr<FileList> files() const = 0; - LayoutPoint dragLocation() const { return m_dragLoc; } + IntPoint dragLocation() const { return m_dragLoc; } CachedImage* dragImage() const { return m_dragImage.get(); } - virtual void setDragImage(CachedImage*, const LayoutPoint&) = 0; + virtual void setDragImage(CachedImage*, const IntPoint&) = 0; Node* dragImageElement() const { return m_dragImageElement.get(); } - virtual void setDragImageElement(Node*, const LayoutPoint&) = 0; + virtual void setDragImageElement(Node*, const IntPoint&) = 0; - virtual DragImageRef createDragImage(LayoutPoint& dragLocation) const = 0; + virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0; #if ENABLE(DRAG_SUPPORT) virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*) = 0; #endif @@ -117,7 +117,7 @@ namespace WebCore { ClipboardType m_clipboardType; protected: - LayoutPoint m_dragLoc; + IntPoint m_dragLoc; CachedResourceHandle<CachedImage> m_dragImage; RefPtr<Node> m_dragImageElement; }; diff --git a/Source/WebCore/dom/Clipboard.idl b/Source/WebCore/dom/Clipboard.idl index 95456076b..dc453f298 100644 --- a/Source/WebCore/dom/Clipboard.idl +++ b/Source/WebCore/dom/Clipboard.idl @@ -42,7 +42,7 @@ module core { [Custom] void setDragImage(in HTMLImageElement image, in long x, in long y) raises(DOMException); - readonly attribute [Conditional=DATA_TRANSFER_ITEMS, EnabledAtRuntime=DataTransferItems] DataTransferItemList items; + readonly attribute [Conditional=DATA_TRANSFER_ITEMS, V8EnabledAtRuntime=DataTransferItems] DataTransferItemList items; }; } diff --git a/Source/WebCore/dom/ContainerNode.cpp b/Source/WebCore/dom/ContainerNode.cpp index c385636cf..dbd2b7259 100644 --- a/Source/WebCore/dom/ContainerNode.cpp +++ b/Source/WebCore/dom/ContainerNode.cpp @@ -115,6 +115,8 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrHostNode()); + RefPtr<Node> protect(this); + ec = 0; // insertBefore(node, 0) is equivalent to appendChild(node) @@ -260,6 +262,8 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrHostNode()); + RefPtr<Node> protect(this); + ec = 0; if (oldChild == newChild) // nothing to do @@ -426,6 +430,8 @@ bool ContainerNode::removeChild(Node* oldChild, ExceptionCode& ec) // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrHostNode()); + RefPtr<Node> protect(this); + ec = 0; // NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly. @@ -604,6 +610,8 @@ void ContainerNode::removeChildren() bool ContainerNode::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec, bool shouldLazyAttach) { + RefPtr<ContainerNode> protect(this); + // Check that this node is not "floating". // If it is, it can be deleted as a side effect of sending mutation events. ASSERT(refCount() || parentOrHostNode()); diff --git a/Source/WebCore/dom/CustomEvent.idl b/Source/WebCore/dom/CustomEvent.idl index 3be395527..53a1ffca8 100644 --- a/Source/WebCore/dom/CustomEvent.idl +++ b/Source/WebCore/dom/CustomEvent.idl @@ -30,7 +30,7 @@ module events { interface [ ConstructorTemplate=Event ] CustomEvent : Event { - readonly attribute [InitializedByConstructor] DOMObject detail; + readonly attribute [InitializedByEventConstructor] DOMObject detail; void initCustomEvent(in [Optional=CallWithDefaultValue] DOMString typeArg, in [Optional=CallWithDefaultValue] boolean canBubbleArg, diff --git a/Source/WebCore/dom/DOMAllInOne.cpp b/Source/WebCore/dom/DOMAllInOne.cpp index 50422d5ac..8b1ebbb88 100644 --- a/Source/WebCore/dom/DOMAllInOne.cpp +++ b/Source/WebCore/dom/DOMAllInOne.cpp @@ -31,7 +31,6 @@ #include "BeforeTextInsertedEvent.cpp" #include "BeforeUnloadEvent.cpp" #include "CDATASection.cpp" -#include "CSSMappedAttributeDeclaration.cpp" #include "CharacterData.cpp" #include "CheckedRadioButtons.cpp" #include "ChildNodeList.cpp" diff --git a/Source/WebCore/dom/DOMCoreException.idl b/Source/WebCore/dom/DOMCoreException.idl index dc5240bc2..3f25b021a 100644 --- a/Source/WebCore/dom/DOMCoreException.idl +++ b/Source/WebCore/dom/DOMCoreException.idl @@ -29,8 +29,8 @@ module core { interface [ - NoStaticTables, - DontCheckEnums + JSNoStaticTables, + DoNotCheckConstants ] DOMCoreException { readonly attribute unsigned short code; @@ -39,7 +39,7 @@ module core { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // ExceptionCode diff --git a/Source/WebCore/dom/DOMImplementation.idl b/Source/WebCore/dom/DOMImplementation.idl index 57577ecb5..0a2368e52 100644 --- a/Source/WebCore/dom/DOMImplementation.idl +++ b/Source/WebCore/dom/DOMImplementation.idl @@ -21,29 +21,29 @@ module core { interface [ - GenerateIsReachable=ImplDocument, + JSGenerateIsReachable=ImplDocument, V8DependentLifetime ] DOMImplementation { // DOM Level 1 - [OldStyleObjC] boolean hasFeature(in [Optional=CallWithDefaultValue] DOMString feature, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString version); + [ObjCLegacyUnnamedParameters] boolean hasFeature(in [Optional=CallWithDefaultValue] DOMString feature, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString version); // DOM Level 2 - [OldStyleObjC] DocumentType createDocumentType(in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString qualifiedName, - in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString publicId, - in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString systemId) + [ObjCLegacyUnnamedParameters] DocumentType createDocumentType(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName, + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString publicId, + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString systemId) raises(DOMException); - [OldStyleObjC] Document createDocument(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DocumentType doctype) + [ObjCLegacyUnnamedParameters] Document createDocument(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DocumentType doctype) raises(DOMException); // DOMImplementationCSS interface from DOM Level 2 CSS - [OldStyleObjC] CSSStyleSheet createCSSStyleSheet(in [Optional=CallWithDefaultValue] DOMString title, + [ObjCLegacyUnnamedParameters] CSSStyleSheet createCSSStyleSheet(in [Optional=CallWithDefaultValue] DOMString title, in [Optional=CallWithDefaultValue] DOMString media) raises(DOMException); diff --git a/Source/WebCore/dom/DOMStringList.idl b/Source/WebCore/dom/DOMStringList.idl index 8b37aaaeb..8238575c6 100644 --- a/Source/WebCore/dom/DOMStringList.idl +++ b/Source/WebCore/dom/DOMStringList.idl @@ -26,7 +26,7 @@ module core { interface [ - HasIndexGetter + IndexedGetter ] DOMStringList { readonly attribute unsigned long length; [ConvertNullStringTo=Null] DOMString item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/dom/DOMStringMap.idl b/Source/WebCore/dom/DOMStringMap.idl index 3546518a8..dbda74dba 100644 --- a/Source/WebCore/dom/DOMStringMap.idl +++ b/Source/WebCore/dom/DOMStringMap.idl @@ -26,11 +26,11 @@ module core { interface [ - GenerateIsReachable=ImplElementRoot, - HasNameGetter, + JSGenerateIsReachable=ImplElementRoot, + NamedGetter, CustomDeleteProperty, CustomGetPropertyNames, - DelegatingPutFunction, + CustomNamedSetter, ] DOMStringMap { }; diff --git a/Source/WebCore/dom/DataTransferItemList.idl b/Source/WebCore/dom/DataTransferItemList.idl index 4adff1ecf..8fcc47ded 100644 --- a/Source/WebCore/dom/DataTransferItemList.idl +++ b/Source/WebCore/dom/DataTransferItemList.idl @@ -32,8 +32,8 @@ module core { interface [ Conditional=DATA_TRANSFER_ITEMS, - HasIndexGetter, - GenerateNativeConverter, + IndexedGetter, + JSGenerateToNativeObject, #if defined(V8_BINDING) && V8_BINDING CustomDeleteProperty, #endif diff --git a/Source/WebCore/dom/DatasetDOMStringMap.cpp b/Source/WebCore/dom/DatasetDOMStringMap.cpp index dff0ad750..382022ecd 100644 --- a/Source/WebCore/dom/DatasetDOMStringMap.cpp +++ b/Source/WebCore/dom/DatasetDOMStringMap.cpp @@ -29,7 +29,6 @@ #include "Attribute.h" #include "Element.h" #include "ExceptionCode.h" -#include "NamedNodeMap.h" #include <wtf/ASCIICType.h> #include <wtf/text/StringBuilder.h> @@ -142,27 +141,27 @@ void DatasetDOMStringMap::deref() void DatasetDOMStringMap::getNames(Vector<String>& names) { - NamedNodeMap* attributeMap = m_element->updatedAttributes(); - if (attributeMap) { - unsigned length = attributeMap->length(); - for (unsigned i = 0; i < length; i++) { - Attribute* attribute = attributeMap->attributeItem(i); - if (isValidAttributeName(attribute->localName())) - names.append(convertAttributeNameToPropertyName(attribute->localName())); - } + if (!m_element->hasAttributes()) + return; + + unsigned length = m_element->attributeCount(); + for (unsigned i = 0; i < length; i++) { + Attribute* attribute = m_element->attributeItem(i); + if (isValidAttributeName(attribute->localName())) + names.append(convertAttributeNameToPropertyName(attribute->localName())); } } String DatasetDOMStringMap::item(const String& name) { - NamedNodeMap* attributeMap = m_element->updatedAttributes(); - if (attributeMap) { - unsigned length = attributeMap->length(); - for (unsigned i = 0; i < length; i++) { - Attribute* attribute = attributeMap->attributeItem(i); - if (propertyNameMatchesAttributeName(name, attribute->localName())) - return attribute->value(); - } + if (!m_element->hasAttributes()) + return String(); + + unsigned length = m_element->attributeCount(); + for (unsigned i = 0; i < length; i++) { + Attribute* attribute = m_element->attributeItem(i); + if (propertyNameMatchesAttributeName(name, attribute->localName())) + return attribute->value(); } return String(); @@ -170,15 +169,16 @@ String DatasetDOMStringMap::item(const String& name) bool DatasetDOMStringMap::contains(const String& name) { - NamedNodeMap* attributeMap = m_element->updatedAttributes(); - if (attributeMap) { - unsigned length = attributeMap->length(); - for (unsigned i = 0; i < length; i++) { - Attribute* attribute = attributeMap->attributeItem(i); - if (propertyNameMatchesAttributeName(name, attribute->localName())) - return true; - } + if (!m_element->hasAttributes()) + return false; + + unsigned length = m_element->attributeCount(); + for (unsigned i = 0; i < length; i++) { + Attribute* attribute = m_element->attributeItem(i); + if (propertyNameMatchesAttributeName(name, attribute->localName())) + return true; } + return false; } diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 3101e04e1..7e9293672 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -173,6 +173,7 @@ #include "SVGDocumentExtensions.h" #include "SVGElementFactory.h" #include "SVGNames.h" +#include "SVGSVGElement.h" #include "SVGStyleElement.h" #endif @@ -200,6 +201,10 @@ #include "NodeRareData.h" #endif +#if ENABLE(THREADED_SCROLLING) +#include "ScrollingCoordinator.h" +#endif + using namespace std; using namespace WTF; using namespace Unicode; @@ -811,7 +816,7 @@ PassRefPtr<EditingText> Document::createEditingTextNode(const String& text) PassRefPtr<CSSStyleDeclaration> Document::createCSSStyleDeclaration() { - return CSSMutableStyleDeclaration::create(); + return StylePropertySet::create()->ensureCSSStyleDeclaration(); } PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode& ec) @@ -850,15 +855,7 @@ PassRefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCo if (ec) return 0; - NamedNodeMap* attrs = oldElement->updatedAttributes(); - if (attrs) { - unsigned length = attrs->length(); - for (unsigned i = 0; i < length; i++) { - Attribute* attr = attrs->attributeItem(i); - newElement->setAttribute(attr->name(), attr->value().impl()); - } - } - + newElement->setAttributesFromElement(*oldElement); newElement->copyNonAttributeProperties(oldElement); if (deep) { @@ -1102,6 +1099,16 @@ void Document::setCharset(const String& charset) decoder()->setEncoding(charset, TextResourceDecoder::UserChosenEncoding); } +void Document::setContentLanguage(const String& language) +{ + if (m_contentLanguage == language) + return; + m_contentLanguage = language; + + // Recalculate style so language is used when selecting the initial font. + styleSelectorChanged(DeferRecalcStyle); +} + void Document::setXMLVersion(const String& version, ExceptionCode& ec) { if (!implementation()->hasFeature("XML", String())) { @@ -2251,6 +2258,15 @@ void Document::implicitClose() ImageLoader::dispatchPendingBeforeLoadEvents(); ImageLoader::dispatchPendingLoadEvents(); + +#if ENABLE(SVG) + // To align the HTML load event and the SVGLoad event for the outermost <svg> element, fire it from + // here, instead of doing it from SVGElement::finishedParsingChildren (if externalResourcesRequired="false", + // which is the default, for ='true' its fired at a later time, once all external resources finished loading). + if (svgExtensions()) + accessSVGExtensions()->dispatchSVGLoadEventToOutermostSVGElements(); +#endif + dispatchWindowLoadEvent(); enqueuePageshowEvent(PageshowEventNotPersisted); enqueuePopstateEvent(m_pendingStateObject ? m_pendingStateObject.release() : SerializedScriptValue::nullValue()); @@ -2320,9 +2336,6 @@ void Document::implicitClose() #endif #if ENABLE(SVG) - // FIXME: Officially, time 0 is when the outermost <svg> receives its - // SVGLoad event, but we don't implement those yet. This is close enough - // for now. In some cases we should have fired earlier. if (svgExtensions()) accessSVGExtensions()->startAnimations(); #endif @@ -2788,11 +2801,13 @@ void Document::processViewport(const String& features) m_viewportArguments = ViewportArguments(ViewportArguments::ViewportMeta); processArguments(features, (void*)&m_viewportArguments, &setViewportFeature); - Frame* frame = this->frame(); - if (!frame || !frame->page()) - return; + updateViewportArguments(); +} - frame->page()->updateViewportArguments(); +void Document::updateViewportArguments() +{ + if (page() && page()->mainFrame() == frame()) + page()->chrome()->dispatchViewportPropertiesDidChange(m_viewportArguments); } void Document::processReferrerPolicy(const String& policy) @@ -4070,9 +4085,6 @@ void Document::setInPageCache(bool flag) setRenderer(m_savedRenderer); m_savedRenderer = 0; - if (frame() && frame()->page()) - frame()->page()->updateViewportArguments(); - if (childNeedsStyleRecalc()) scheduleStyleRecalc(); } @@ -4113,6 +4125,8 @@ void Document::documentDidResumeFromPageCache() ASSERT(m_frame); m_frame->loader()->client()->dispatchDidBecomeFrameset(isFrameSet()); + + updateViewportArguments(); } void Document::registerForPageCacheSuspensionCallbacks(Element* e) @@ -4325,9 +4339,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S return 0; } - // 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 Attr::create(0, this, Attribute::createMapped(qName, StringImpl::empty())); + return Attr::create(0, this, Attribute::create(qName, StringImpl::empty())); } #if ENABLE(SVG) @@ -5352,12 +5364,35 @@ PassRefPtr<TouchList> Document::createTouchList(ExceptionCode&) const } #endif +static void wheelEventHandlerCountChanged(Document* document) +{ +#if ENABLE(THREADED_SCROLLING) + Page* page = document->page(); + if (!page) + return; + + ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator(); + if (!scrollingCoordinator) + return; + + FrameView* frameView = document->view(); + if (!frameView) + return; + + scrollingCoordinator->frameViewWheelEventHandlerCountChanged(frameView); +#else + UNUSED_PARAM(document); +#endif +} + void Document::didAddWheelEventHandler() { ++m_wheelEventHandlerCount; Frame* mainFrame = page() ? page()->mainFrame() : 0; if (mainFrame) mainFrame->notifyChromeClientWheelEventHandlerCountChanged(); + + wheelEventHandlerCountChanged(this); } void Document::didRemoveWheelEventHandler() @@ -5367,6 +5402,8 @@ void Document::didRemoveWheelEventHandler() Frame* mainFrame = page() ? page()->mainFrame() : 0; if (mainFrame) mainFrame->notifyChromeClientWheelEventHandlerCountChanged(); + + wheelEventHandlerCountChanged(this); } bool Document::visualUpdatesAllowed() const diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h index 2d160f128..a4bdad685 100644 --- a/Source/WebCore/dom/Document.h +++ b/Source/WebCore/dom/Document.h @@ -387,7 +387,7 @@ public: String suggestedMIMEType() const; String contentLanguage() const { return m_contentLanguage; } - void setContentLanguage(const String& lang) { m_contentLanguage = lang; } + void setContentLanguage(const String&); String xmlEncoding() const { return m_xmlEncoding; } String xmlVersion() const { return m_xmlVersion; } @@ -803,6 +803,7 @@ public: */ void processHttpEquiv(const String& equiv, const String& content); void processViewport(const String& features); + void updateViewportArguments(); void processReferrerPolicy(const String& policy); // Returns the owning element in the parent document. diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl index c04f850e1..de7b04df1 100644 --- a/Source/WebCore/dom/Document.idl +++ b/Source/WebCore/dom/Document.idl @@ -21,9 +21,9 @@ module core { interface [ - CustomToJS, - GenerateNativeConverter, - InlineGetOwnPropertySlot + JSCustomToJS, + JSGenerateToNativeObject, + JSInlineGetOwnPropertySlot ] Document : Node { // DOM Level 1 Core @@ -31,34 +31,34 @@ module core { readonly attribute DOMImplementation implementation; readonly attribute Element documentElement; - [ReturnsNew] Element createElement(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString tagName) + [ReturnNewObject] Element createElement(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString tagName) raises (DOMException); DocumentFragment createDocumentFragment(); - [ReturnsNew] Text createTextNode(in [Optional=CallWithDefaultValue] DOMString data); - [ReturnsNew] Comment createComment(in [Optional=CallWithDefaultValue] DOMString data); - [ReturnsNew] CDATASection createCDATASection(in [Optional=CallWithDefaultValue] DOMString data) + [ReturnNewObject] Text createTextNode(in [Optional=CallWithDefaultValue] DOMString data); + [ReturnNewObject] Comment createComment(in [Optional=CallWithDefaultValue] DOMString data); + [ReturnNewObject] CDATASection createCDATASection(in [Optional=CallWithDefaultValue] DOMString data) raises(DOMException); - [OldStyleObjC, ReturnsNew] ProcessingInstruction createProcessingInstruction(in [Optional=CallWithDefaultValue] DOMString target, + [ObjCLegacyUnnamedParameters, ReturnNewObject] ProcessingInstruction createProcessingInstruction(in [Optional=CallWithDefaultValue] DOMString target, in [Optional=CallWithDefaultValue] DOMString data) raises (DOMException); - [ReturnsNew] Attr createAttribute(in [Optional=CallWithDefaultValue] DOMString name) + [ReturnNewObject] Attr createAttribute(in [Optional=CallWithDefaultValue] DOMString name) raises (DOMException); - [ReturnsNew] EntityReference createEntityReference(in [Optional=CallWithDefaultValue] DOMString name) + [ReturnNewObject] EntityReference createEntityReference(in [Optional=CallWithDefaultValue] DOMString name) raises(DOMException); NodeList getElementsByTagName(in [Optional=CallWithDefaultValue] DOMString tagname); // Introduced in DOM Level 2: - [OldStyleObjC, ReturnsNew] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode, + [ObjCLegacyUnnamedParameters, ReturnNewObject] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode, in [Optional] boolean deep) raises (DOMException); - [OldStyleObjC, ReturnsNew] Element createElementNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName) + [ObjCLegacyUnnamedParameters, ReturnNewObject] Element createElementNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName) raises (DOMException); - [OldStyleObjC, ReturnsNew] Attr createAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString qualifiedName) + [ObjCLegacyUnnamedParameters, ReturnNewObject] Attr createAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString qualifiedName) raises (DOMException); - [OldStyleObjC] NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); Element getElementById(in [Optional=CallWithDefaultValue] DOMString elementId); @@ -67,7 +67,7 @@ module core { readonly attribute [ConvertNullStringTo=Null] DOMString inputEncoding; readonly attribute [ConvertNullStringTo=Null] DOMString xmlEncoding; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString xmlVersion + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString xmlVersion setter raises (DOMException); attribute boolean xmlStandalone setter raises (DOMException); @@ -75,7 +75,7 @@ module core { Node adoptNode(in [Optional=CallWithDefaultValue] Node source) raises (DOMException); - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString documentURI; + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString documentURI; // DOM Level 2 Events (DocumentEvents interface) @@ -88,12 +88,12 @@ module core { // DOM Level 2 Tranversal and Range (DocumentTraversal interface) - [OldStyleObjC] NodeIterator createNodeIterator(in [Optional=CallWithDefaultValue] Node root, + [ObjCLegacyUnnamedParameters] NodeIterator createNodeIterator(in [Optional=CallWithDefaultValue] Node root, in [Optional=CallWithDefaultValue] unsigned long whatToShow, in [Optional=CallWithDefaultValue] NodeFilter filter, in [Optional=CallWithDefaultValue] boolean expandEntityReferences) raises(DOMException); - [OldStyleObjC] TreeWalker createTreeWalker(in [Optional=CallWithDefaultValue] Node root, + [ObjCLegacyUnnamedParameters] TreeWalker createTreeWalker(in [Optional=CallWithDefaultValue] Node root, in [Optional=CallWithDefaultValue] unsigned long whatToShow, in [Optional=CallWithDefaultValue] NodeFilter filter, in [Optional=CallWithDefaultValue] boolean expandEntityReferences) @@ -109,15 +109,15 @@ module core { // DOM Level 2 Style (DocumentCSS interface) - [OldStyleObjC] CSSStyleDeclaration getOverrideStyle(in [Optional=CallWithDefaultValue] Element element, + [ObjCLegacyUnnamedParameters] CSSStyleDeclaration getOverrideStyle(in [Optional=CallWithDefaultValue] Element element, in [Optional=CallWithDefaultValue] DOMString pseudoElement); // DOM Level 3 XPath (XPathEvaluator interface) - [OldStyleObjC] XPathExpression createExpression(in [Optional=CallWithDefaultValue] DOMString expression, + [ObjCLegacyUnnamedParameters] XPathExpression createExpression(in [Optional=CallWithDefaultValue] DOMString expression, in [Optional=CallWithDefaultValue] XPathNSResolver resolver) raises(DOMException); XPathNSResolver createNSResolver(in Node nodeResolver); - [OldStyleObjC, V8Custom] XPathResult evaluate(in [Optional=CallWithDefaultValue] DOMString expression, + [ObjCLegacyUnnamedParameters, V8Custom] XPathResult evaluate(in [Optional=CallWithDefaultValue] DOMString expression, in [Optional=CallWithDefaultValue] Node contextNode, in [Optional=CallWithDefaultValue] XPathNSResolver resolver, in [Optional=CallWithDefaultValue] unsigned short type, @@ -128,7 +128,7 @@ module core { boolean execCommand(in [Optional=CallWithDefaultValue] DOMString command, in [Optional=CallWithDefaultValue] boolean userInterface, - in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString value); + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString value); #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // FIXME: remove the these two versions once [Optional] is implemented for Objective-C. @@ -145,17 +145,17 @@ module core { // Moved down from HTMLDocument - attribute [TreatNullAs=EmptyString] DOMString title; + attribute [TreatNullAs=NullString] DOMString title; readonly attribute DOMString referrer; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - attribute [TreatNullAs=EmptyString] DOMString domain + attribute [TreatNullAs=NullString] DOMString domain setter raises (DOMException); #else readonly attribute DOMString domain; #endif readonly attribute DOMString URL; - attribute [TreatNullAs=EmptyString] DOMString cookie + attribute [TreatNullAs=NullString] DOMString cookie setter raises (DOMException), getter raises (DOMException); @@ -175,7 +175,7 @@ module core { NodeList getElementsByName(in [Optional=CallWithDefaultValue] DOMString elementName); #if defined(ENABLE_MICRODATA) && ENABLE_MICRODATA - NodeList getItems(in [ConvertUndefinedOrNullToNullString, Optional=CallWithDefaultValue] DOMString typeNames); + NodeList getItems(in [TreatNullAs=NullString, TreatUndefinedAs=NullString, Optional=CallWithDefaultValue] DOMString typeNames); #endif #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT @@ -184,7 +184,7 @@ module core { // IE extensions - attribute [ConvertNullStringTo=Undefined, TreatNullAs=EmptyString] DOMString charset; + attribute [ConvertNullStringTo=Undefined, TreatNullAs=NullString] DOMString charset; readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset; readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState; @@ -202,7 +202,7 @@ module core { // WebKit extensions readonly attribute [ConvertNullStringTo=Null] DOMString preferredStylesheetSet; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString selectedStylesheetSet; + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString selectedStylesheetSet; #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT CSSStyleDeclaration createCSSStyleDeclaration(); @@ -210,14 +210,14 @@ module core { #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C // DOM Level 2 Style Interface - [OldStyleObjC, UsesView] CSSStyleDeclaration getComputedStyle(in Element element, + [ObjCLegacyUnnamedParameters, ObjCUseDefaultView] CSSStyleDeclaration getComputedStyle(in Element element, in DOMString pseudoElement); // WebKit extension // FIXME: remove the first version once [Optional] is implemented for Objective-C. - [UsesView] CSSRuleList getMatchedCSSRules(in Element element, + [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(in Element element, in DOMString pseudoElement); - [UsesView] CSSRuleList getMatchedCSSRules(in Element element, + [ObjCUseDefaultView] CSSRuleList getMatchedCSSRules(in Element element, in DOMString pseudoElement, in [Optional] boolean authorOnly); @@ -241,91 +241,91 @@ module core { raises(DOMException); #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API - readonly attribute [EnabledAtRuntime] boolean webkitIsFullScreen; - readonly attribute [EnabledAtRuntime] boolean webkitFullScreenKeyboardInputAllowed; - readonly attribute [EnabledAtRuntime] Element webkitCurrentFullScreenElement; - [EnabledAtRuntime] void webkitCancelFullScreen(); + readonly attribute [V8EnabledAtRuntime] boolean webkitIsFullScreen; + readonly attribute [V8EnabledAtRuntime] boolean webkitFullScreenKeyboardInputAllowed; + readonly attribute [V8EnabledAtRuntime] Element webkitCurrentFullScreenElement; + [V8EnabledAtRuntime] void webkitCancelFullScreen(); #endif WebKitNamedFlow webkitGetFlowByName(in DOMString name); #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler DOM attributes - attribute [DontEnum] EventListener onabort; - attribute [DontEnum] EventListener onblur; - attribute [DontEnum] EventListener onchange; - attribute [DontEnum] EventListener onclick; - attribute [DontEnum] EventListener oncontextmenu; - attribute [DontEnum] EventListener ondblclick; - attribute [DontEnum] EventListener ondrag; - attribute [DontEnum] EventListener ondragend; - attribute [DontEnum] EventListener ondragenter; - attribute [DontEnum] EventListener ondragleave; - attribute [DontEnum] EventListener ondragover; - attribute [DontEnum] EventListener ondragstart; - attribute [DontEnum] EventListener ondrop; - attribute [DontEnum] EventListener onerror; - attribute [DontEnum] EventListener onfocus; - attribute [DontEnum] EventListener oninput; - attribute [DontEnum] EventListener oninvalid; - attribute [DontEnum] EventListener onkeydown; - attribute [DontEnum] EventListener onkeypress; - attribute [DontEnum] EventListener onkeyup; - attribute [DontEnum] EventListener onload; - attribute [DontEnum] EventListener onmousedown; - attribute [DontEnum] EventListener onmousemove; - attribute [DontEnum] EventListener onmouseout; - attribute [DontEnum] EventListener onmouseover; - attribute [DontEnum] EventListener onmouseup; - attribute [DontEnum] EventListener onmousewheel; - attribute [DontEnum] EventListener onreadystatechange; - attribute [DontEnum] EventListener onscroll; - attribute [DontEnum] EventListener onselect; - attribute [DontEnum] EventListener onsubmit; - - // attribute [DontEnum] EventListener oncanplay; - // attribute [DontEnum] EventListener oncanplaythrough; - // attribute [DontEnum] EventListener ondurationchange; - // attribute [DontEnum] EventListener onemptied; - // attribute [DontEnum] EventListener onended; - // attribute [DontEnum] EventListener onloadeddata; - // attribute [DontEnum] EventListener onloadedmetadata; - // attribute [DontEnum] EventListener onloadstart; - // attribute [DontEnum] EventListener onpause; - // attribute [DontEnum] EventListener onplay; - // attribute [DontEnum] EventListener onplaying; - // attribute [DontEnum] EventListener onprogress; - // attribute [DontEnum] EventListener onratechange; - // attribute [DontEnum] EventListener onseeked; - // attribute [DontEnum] EventListener onseeking; - // attribute [DontEnum] EventListener onshow; - // attribute [DontEnum] EventListener onstalled; - // attribute [DontEnum] EventListener onsuspend; - // attribute [DontEnum] EventListener ontimeupdate; - // attribute [DontEnum] EventListener onvolumechange; - // attribute [DontEnum] EventListener onwaiting; + attribute [NotEnumerable] EventListener onabort; + attribute [NotEnumerable] EventListener onblur; + attribute [NotEnumerable] EventListener onchange; + attribute [NotEnumerable] EventListener onclick; + attribute [NotEnumerable] EventListener oncontextmenu; + attribute [NotEnumerable] EventListener ondblclick; + attribute [NotEnumerable] EventListener ondrag; + attribute [NotEnumerable] EventListener ondragend; + attribute [NotEnumerable] EventListener ondragenter; + attribute [NotEnumerable] EventListener ondragleave; + attribute [NotEnumerable] EventListener ondragover; + attribute [NotEnumerable] EventListener ondragstart; + attribute [NotEnumerable] EventListener ondrop; + attribute [NotEnumerable] EventListener onerror; + attribute [NotEnumerable] EventListener onfocus; + attribute [NotEnumerable] EventListener oninput; + attribute [NotEnumerable] EventListener oninvalid; + attribute [NotEnumerable] EventListener onkeydown; + attribute [NotEnumerable] EventListener onkeypress; + attribute [NotEnumerable] EventListener onkeyup; + attribute [NotEnumerable] EventListener onload; + attribute [NotEnumerable] EventListener onmousedown; + attribute [NotEnumerable] EventListener onmousemove; + attribute [NotEnumerable] EventListener onmouseout; + attribute [NotEnumerable] EventListener onmouseover; + attribute [NotEnumerable] EventListener onmouseup; + attribute [NotEnumerable] EventListener onmousewheel; + attribute [NotEnumerable] EventListener onreadystatechange; + attribute [NotEnumerable] EventListener onscroll; + attribute [NotEnumerable] EventListener onselect; + attribute [NotEnumerable] EventListener onsubmit; + + // attribute [NotEnumerable] EventListener oncanplay; + // attribute [NotEnumerable] EventListener oncanplaythrough; + // attribute [NotEnumerable] EventListener ondurationchange; + // attribute [NotEnumerable] EventListener onemptied; + // attribute [NotEnumerable] EventListener onended; + // attribute [NotEnumerable] EventListener onloadeddata; + // attribute [NotEnumerable] EventListener onloadedmetadata; + // attribute [NotEnumerable] EventListener onloadstart; + // attribute [NotEnumerable] EventListener onpause; + // attribute [NotEnumerable] EventListener onplay; + // attribute [NotEnumerable] EventListener onplaying; + // attribute [NotEnumerable] EventListener onprogress; + // attribute [NotEnumerable] EventListener onratechange; + // attribute [NotEnumerable] EventListener onseeked; + // attribute [NotEnumerable] EventListener onseeking; + // attribute [NotEnumerable] EventListener onshow; + // attribute [NotEnumerable] EventListener onstalled; + // attribute [NotEnumerable] EventListener onsuspend; + // attribute [NotEnumerable] EventListener ontimeupdate; + // attribute [NotEnumerable] EventListener onvolumechange; + // attribute [NotEnumerable] EventListener onwaiting; // WebKit extensions - attribute [DontEnum] EventListener onbeforecut; - attribute [DontEnum] EventListener oncut; - attribute [DontEnum] EventListener onbeforecopy; - attribute [DontEnum] EventListener oncopy; - attribute [DontEnum] EventListener onbeforepaste; - attribute [DontEnum] EventListener onpaste; - attribute [DontEnum] EventListener onreset; - attribute [DontEnum] EventListener onsearch; - attribute [DontEnum] EventListener onselectstart; - attribute [DontEnum] EventListener onselectionchange; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; - attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange; - attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror; + attribute [NotEnumerable] EventListener onbeforecut; + attribute [NotEnumerable] EventListener oncut; + attribute [NotEnumerable] EventListener onbeforecopy; + attribute [NotEnumerable] EventListener oncopy; + attribute [NotEnumerable] EventListener onbeforepaste; + attribute [NotEnumerable] EventListener onpaste; + attribute [NotEnumerable] EventListener onreset; + attribute [NotEnumerable] EventListener onsearch; + attribute [NotEnumerable] EventListener onselectstart; + attribute [NotEnumerable] EventListener onselectionchange; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel; + attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange; + attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror; #endif #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS - [ReturnsNew, EnabledAtRuntime] Touch createTouch(in [Optional=CallWithDefaultValue] DOMWindow window, + [ReturnNewObject, V8EnabledAtRuntime] Touch createTouch(in [Optional=CallWithDefaultValue] DOMWindow window, in [Optional=CallWithDefaultValue] EventTarget target, in [Optional=CallWithDefaultValue] long identifier, in [Optional=CallWithDefaultValue] long pageX, @@ -337,7 +337,7 @@ module core { in [Optional=CallWithDefaultValue] float webkitRotationAngle, in [Optional=CallWithDefaultValue] float webkitForce) raises (DOMException); - [ReturnsNew, EnabledAtRuntime, Custom] TouchList createTouchList() + [ReturnNewObject, V8EnabledAtRuntime, Custom] TouchList createTouchList() raises (DOMException); #endif diff --git a/Source/WebCore/dom/DocumentMarkerController.cpp b/Source/WebCore/dom/DocumentMarkerController.cpp index b0eb1e162..c25023f2b 100644 --- a/Source/WebCore/dom/DocumentMarkerController.cpp +++ b/Source/WebCore/dom/DocumentMarkerController.cpp @@ -377,9 +377,9 @@ Vector<DocumentMarker*> DocumentMarkerController::markersInRange(Range* range, D return foundMarkers; } -Vector<LayoutRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType) +Vector<IntRect> DocumentMarkerController::renderedRectsForMarkers(DocumentMarker::MarkerType markerType) { - Vector<LayoutRect> result; + Vector<IntRect> result; if (!possiblyHasMarkers(markerType)) return result; diff --git a/Source/WebCore/dom/DocumentMarkerController.h b/Source/WebCore/dom/DocumentMarkerController.h index 36c0d4323..e0672d0d3 100644 --- a/Source/WebCore/dom/DocumentMarkerController.h +++ b/Source/WebCore/dom/DocumentMarkerController.h @@ -72,7 +72,7 @@ public: Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); Vector<DocumentMarker> markersForNode(Node*); - Vector<LayoutRect> renderedRectsForMarkers(DocumentMarker::MarkerType); + Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); void clearDescriptionOnMarkersIntersectingRange(Range*, DocumentMarker::MarkerTypes); #ifndef NDEBUG diff --git a/Source/WebCore/dom/DocumentType.idl b/Source/WebCore/dom/DocumentType.idl index 7992dc500..ed146fa4f 100644 --- a/Source/WebCore/dom/DocumentType.idl +++ b/Source/WebCore/dom/DocumentType.idl @@ -20,7 +20,7 @@ module core { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] DocumentType : Node { // DOM Level 1 diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index 5a2202126..355f38adb 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -566,10 +566,10 @@ PassRefPtr<ClientRect> Element::getBoundingClientRect() return ClientRect::create(result); } -LayoutRect Element::screenRect() const +IntRect Element::screenRect() const { if (!renderer()) - return LayoutRect(); + return IntRect(); // FIXME: this should probably respect transforms return renderer()->view()->frameView()->contentsToScreen(renderer()->absoluteBoundingBoxRectIgnoringTransforms()); } @@ -655,10 +655,13 @@ PassRefPtr<Attribute> Element::createAttribute(const QualifiedName& name, const return Attribute::create(name, value); } -void Element::attributeChanged(Attribute* attr, bool) +void Element::attributeChanged(Attribute* attr) { if (isIdAttributeName(attr->name())) idAttributeChanged(attr); + else if (attr->name() == HTMLNames::nameAttr) + setHasName(!attr->isNull()); + recalcStyleIfNeededAfterAttributeChanged(attr); updateAfterAttributeChanged(attr); } @@ -1196,10 +1199,7 @@ ShadowRoot* Element::ensureShadowRoot() if (ShadowRoot* existingRoot = shadowRoot()) return existingRoot; - ExceptionCode ec = 0; - setShadowRoot(ShadowRoot::create(document()), ec); - ASSERT(!ec); - return shadowRoot(); + return ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot).get(); } void Element::removeShadowRoot() @@ -1359,6 +1359,11 @@ void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af checkForEmptyStyleChange(this, renderStyle()); else checkForSiblingStyleChanges(this, renderStyle(), false, beforeChange, afterChange, childCountDelta); + + if (hasRareData()) { + if (ShadowRoot* root = shadowRoot()) + root->hostChildrenChanged(); + } } void Element::beginParsingChildren() @@ -1735,22 +1740,6 @@ Element* Element::lastElementChild() const return static_cast<Element*>(n); } -Element* Element::previousElementSibling() const -{ - Node* n = previousSibling(); - while (n && !n->isElementNode()) - n = n->previousSibling(); - return static_cast<Element*>(n); -} - -Element* Element::nextElementSibling() const -{ - Node* n = nextSibling(); - while (n && !n->isElementNode()) - n = n->nextSibling(); - return static_cast<Element*>(n); -} - unsigned Element::childElementCount() const { unsigned count = 0; diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h index 1d37eaec0..9381e2f58 100644 --- a/Source/WebCore/dom/Element.h +++ b/Source/WebCore/dom/Element.h @@ -130,6 +130,9 @@ public: #endif bool hasAttributes() const; + // This variant will not update the potentially invalid attributes. To be used when not interested + // in style attribute or one of the SVG animation attributes. + bool hasAttributesWithoutUpdate() const; bool hasAttribute(const String& name) const; bool hasAttributeNS(const String& namespaceURI, const String& localName) const; @@ -149,6 +152,13 @@ public: // so this function is not suitable for non-style uses. const AtomicString& idForStyleResolution() const; + // Internal methods that assume the existence of attribute storage, one should use hasAttributes() + // before calling them. + size_t attributeCount() const; + Attribute* attributeItem(unsigned index) const; + Attribute* getAttributeItem(const QualifiedName&) const; + void removeAttribute(unsigned index); + void scrollIntoView(bool alignToTop = true); void scrollIntoViewIfNeeded(bool centerIfNeeded = true); @@ -177,7 +187,7 @@ public: PassRefPtr<ClientRect> getBoundingClientRect(); // Returns the absolute bounding box translated into screen coordinates: - LayoutRect screenRect() const; + IntRect screenRect() const; void removeAttribute(const String& name); void removeAttributeNS(const String& namespaceURI, const String& localName); @@ -221,7 +231,7 @@ public: NamedNodeMap* updatedAttributes() const; // This method is called whenever an attribute is added, changed or removed. - virtual void attributeChanged(Attribute*, bool preserveDecls = false); + virtual void attributeChanged(Attribute*); // Only called by the parser immediately after element construction. void parserSetAttributeMap(PassOwnPtr<NamedNodeMap>, FragmentScriptingPermission); @@ -232,6 +242,9 @@ public: ElementAttributeData* attributeData() const { return m_attributeMap ? m_attributeMap->attributeData() : 0; } ElementAttributeData* ensureAttributeData() const { return ensureUpdatedAttributes()->attributeData(); } + // FIXME: This method should be removed once AttributeData is moved to Element. + ElementAttributeData* ensureAttributeDataWithoutUpdate() const { return ensureAttributeMap()->attributeData(); } + void setAttributesFromElement(const Element&); virtual void copyNonAttributeProperties(const Element* source); @@ -383,6 +396,8 @@ public: PassRefPtr<RenderStyle> styleForRenderer(); + PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); + protected: Element(const QualifiedName& tagName, Document* document, ConstructionType type) : ContainerNode(document, type) @@ -422,8 +437,7 @@ private: virtual bool childTypeAllowed(NodeType) const; void setAttributeInternal(size_t index, const QualifiedName&, const AtomicString& value); - virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); - + #ifndef NDEBUG virtual void formatForDebugger(char* buffer, unsigned length) const; #endif @@ -506,6 +520,22 @@ inline Element* Node::parentElement() const return parent && parent->isElementNode() ? toElement(parent) : 0; } +inline Element* Element::previousElementSibling() const +{ + Node* n = previousSibling(); + while (n && !n->isElementNode()) + n = n->previousSibling(); + return static_cast<Element*>(n); +} + +inline Element* Element::nextElementSibling() const +{ + Node* n = nextSibling(); + while (n && !n->isElementNode()) + n = n->nextSibling(); + return static_cast<Element*>(n); +} + inline NamedNodeMap* Element::ensureUpdatedAttributes() const { updateInvalidAttributes(); @@ -576,6 +606,11 @@ inline const AtomicString& Element::fastGetAttribute(const QualifiedName& name) return nullAtom; } +inline bool Element::hasAttributesWithoutUpdate() const +{ + return m_attributeMap && !m_attributeMap->isEmpty(); +} + inline const AtomicString& Element::idForStyleResolution() const { ASSERT(hasID()); @@ -601,6 +636,30 @@ inline void Element::setIdAttribute(const AtomicString& value) setAttribute(document()->idAttributeName(), value); } +inline size_t Element::attributeCount() const +{ + ASSERT(m_attributeMap); + return m_attributeMap->length(); +} + +inline Attribute* Element::attributeItem(unsigned index) const +{ + ASSERT(m_attributeMap); + return m_attributeMap->attributeItem(index); +} + +inline Attribute* Element::getAttributeItem(const QualifiedName& name) const +{ + ASSERT(m_attributeMap); + return m_attributeMap->getAttributeItem(name); +} + +inline void Element::removeAttribute(unsigned index) +{ + ASSERT(m_attributeMap); + m_attributeMap->removeAttribute(index); +} + inline NamedNodeMap* Element::ensureAttributeMap() const { if (!m_attributeMap) diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl index eae90b29f..20d4c8e11 100644 --- a/Source/WebCore/dom/Element.idl +++ b/Source/WebCore/dom/Element.idl @@ -21,8 +21,8 @@ module core { interface [ - GenerateNativeConverter, - InlineGetOwnPropertySlot + JSGenerateToNativeObject, + JSInlineGetOwnPropertySlot ] Element : Node { // DOM Level 1 Core @@ -30,7 +30,7 @@ module core { readonly attribute [ConvertNullStringTo=Null] DOMString tagName; [ConvertNullStringTo=Null] DOMString getAttribute(in [Optional=CallWithDefaultValue] DOMString name); - [OldStyleObjC] void setAttribute(in [Optional=CallWithDefaultValue] DOMString name, + [ObjCLegacyUnnamedParameters] void setAttribute(in [Optional=CallWithDefaultValue] DOMString name, in [Optional=CallWithDefaultValue] DOMString value) raises(DOMException); void removeAttribute(in [Optional=CallWithDefaultValue] DOMString name); @@ -43,22 +43,22 @@ module core { // DOM Level 2 Core - [OldStyleObjC] DOMString getAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] DOMString getAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); - [OldStyleObjC] void setAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] void setAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString qualifiedName, in [Optional=CallWithDefaultValue] DOMString value) raises(DOMException); - [OldStyleObjC] void removeAttributeNS(in [TreatNullAs=EmptyString] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] void removeAttributeNS(in [TreatNullAs=NullString] DOMString namespaceURI, in DOMString localName); - [OldStyleObjC] NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); - [OldStyleObjC] Attr getAttributeNodeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] Attr getAttributeNodeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); Attr setAttributeNodeNS(in [Optional=CallWithDefaultValue] Attr newAttr) raises(DOMException); boolean hasAttribute(in DOMString name); - [OldStyleObjC] boolean hasAttributeNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] boolean hasAttributeNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); readonly attribute CSSStyleDeclaration style; @@ -130,81 +130,81 @@ module core { #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API const unsigned short ALLOW_KEYBOARD_INPUT = 1; - [EnabledAtRuntime] void webkitRequestFullScreen(in [Optional=CallWithDefaultValue] unsigned short flags); + [V8EnabledAtRuntime] void webkitRequestFullScreen(in [Optional=CallWithDefaultValue] unsigned short flags); #endif #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler DOM attributes - attribute [DontEnum] EventListener onabort; - attribute [DontEnum] EventListener onblur; - attribute [DontEnum] EventListener onchange; - attribute [DontEnum] EventListener onclick; - attribute [DontEnum] EventListener oncontextmenu; - attribute [DontEnum] EventListener ondblclick; - attribute [DontEnum] EventListener ondrag; - attribute [DontEnum] EventListener ondragend; - attribute [DontEnum] EventListener ondragenter; - attribute [DontEnum] EventListener ondragleave; - attribute [DontEnum] EventListener ondragover; - attribute [DontEnum] EventListener ondragstart; - attribute [DontEnum] EventListener ondrop; - attribute [DontEnum] EventListener onerror; - attribute [DontEnum] EventListener onfocus; - attribute [DontEnum] EventListener oninput; - attribute [DontEnum] EventListener oninvalid; - attribute [DontEnum] EventListener onkeydown; - attribute [DontEnum] EventListener onkeypress; - attribute [DontEnum] EventListener onkeyup; - attribute [DontEnum] EventListener onload; - attribute [DontEnum] EventListener onmousedown; - attribute [DontEnum] EventListener onmousemove; - attribute [DontEnum] EventListener onmouseout; - attribute [DontEnum] EventListener onmouseover; - attribute [DontEnum] EventListener onmouseup; - attribute [DontEnum] EventListener onmousewheel; - attribute [DontEnum] EventListener onscroll; - attribute [DontEnum] EventListener onselect; - attribute [DontEnum] EventListener onsubmit; - - // attribute [DontEnum] EventListener oncanplay; - // attribute [DontEnum] EventListener oncanplaythrough; - // attribute [DontEnum] EventListener ondurationchange; - // attribute [DontEnum] EventListener onemptied; - // attribute [DontEnum] EventListener onended; - // attribute [DontEnum] EventListener onloadeddata; - // attribute [DontEnum] EventListener onloadedmetadata; - // attribute [DontEnum] EventListener onloadstart; - // attribute [DontEnum] EventListener onpause; - // attribute [DontEnum] EventListener onplay; - // attribute [DontEnum] EventListener onplaying; - // attribute [DontEnum] EventListener onprogress; - // attribute [DontEnum] EventListener onratechange; - // attribute [DontEnum] EventListener onreadystatechange; - // attribute [DontEnum] EventListener onseeked; - // attribute [DontEnum] EventListener onseeking; - // attribute [DontEnum] EventListener onshow; - // attribute [DontEnum] EventListener onstalled; - // attribute [DontEnum] EventListener onsuspend; - // attribute [DontEnum] EventListener ontimeupdate; - // attribute [DontEnum] EventListener onvolumechange; - // attribute [DontEnum] EventListener onwaiting; + attribute [NotEnumerable] EventListener onabort; + attribute [NotEnumerable] EventListener onblur; + attribute [NotEnumerable] EventListener onchange; + attribute [NotEnumerable] EventListener onclick; + attribute [NotEnumerable] EventListener oncontextmenu; + attribute [NotEnumerable] EventListener ondblclick; + attribute [NotEnumerable] EventListener ondrag; + attribute [NotEnumerable] EventListener ondragend; + attribute [NotEnumerable] EventListener ondragenter; + attribute [NotEnumerable] EventListener ondragleave; + attribute [NotEnumerable] EventListener ondragover; + attribute [NotEnumerable] EventListener ondragstart; + attribute [NotEnumerable] EventListener ondrop; + attribute [NotEnumerable] EventListener onerror; + attribute [NotEnumerable] EventListener onfocus; + attribute [NotEnumerable] EventListener oninput; + attribute [NotEnumerable] EventListener oninvalid; + attribute [NotEnumerable] EventListener onkeydown; + attribute [NotEnumerable] EventListener onkeypress; + attribute [NotEnumerable] EventListener onkeyup; + attribute [NotEnumerable] EventListener onload; + attribute [NotEnumerable] EventListener onmousedown; + attribute [NotEnumerable] EventListener onmousemove; + attribute [NotEnumerable] EventListener onmouseout; + attribute [NotEnumerable] EventListener onmouseover; + attribute [NotEnumerable] EventListener onmouseup; + attribute [NotEnumerable] EventListener onmousewheel; + attribute [NotEnumerable] EventListener onscroll; + attribute [NotEnumerable] EventListener onselect; + attribute [NotEnumerable] EventListener onsubmit; + + // attribute [NotEnumerable] EventListener oncanplay; + // attribute [NotEnumerable] EventListener oncanplaythrough; + // attribute [NotEnumerable] EventListener ondurationchange; + // attribute [NotEnumerable] EventListener onemptied; + // attribute [NotEnumerable] EventListener onended; + // attribute [NotEnumerable] EventListener onloadeddata; + // attribute [NotEnumerable] EventListener onloadedmetadata; + // attribute [NotEnumerable] EventListener onloadstart; + // attribute [NotEnumerable] EventListener onpause; + // attribute [NotEnumerable] EventListener onplay; + // attribute [NotEnumerable] EventListener onplaying; + // attribute [NotEnumerable] EventListener onprogress; + // attribute [NotEnumerable] EventListener onratechange; + // attribute [NotEnumerable] EventListener onreadystatechange; + // attribute [NotEnumerable] EventListener onseeked; + // attribute [NotEnumerable] EventListener onseeking; + // attribute [NotEnumerable] EventListener onshow; + // attribute [NotEnumerable] EventListener onstalled; + // attribute [NotEnumerable] EventListener onsuspend; + // attribute [NotEnumerable] EventListener ontimeupdate; + // attribute [NotEnumerable] EventListener onvolumechange; + // attribute [NotEnumerable] EventListener onwaiting; // WebKit extensions - attribute [DontEnum] EventListener onbeforecut; - attribute [DontEnum] EventListener oncut; - attribute [DontEnum] EventListener onbeforecopy; - attribute [DontEnum] EventListener oncopy; - attribute [DontEnum] EventListener onbeforepaste; - attribute [DontEnum] EventListener onpaste; - attribute [DontEnum] EventListener onreset; - attribute [DontEnum] EventListener onsearch; - attribute [DontEnum] EventListener onselectstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; - attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; - attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange; - attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror; + attribute [NotEnumerable] EventListener onbeforecut; + attribute [NotEnumerable] EventListener oncut; + attribute [NotEnumerable] EventListener onbeforecopy; + attribute [NotEnumerable] EventListener oncopy; + attribute [NotEnumerable] EventListener onbeforepaste; + attribute [NotEnumerable] EventListener onpaste; + attribute [NotEnumerable] EventListener onreset; + attribute [NotEnumerable] EventListener onsearch; + attribute [NotEnumerable] EventListener onselectstart; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend; + attribute [NotEnumerable,Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel; + attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange; + attribute [NotEnumerable, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenerror; #endif }; diff --git a/Source/WebCore/dom/ElementAttributeData.cpp b/Source/WebCore/dom/ElementAttributeData.cpp index 1283304bd..cea62f3cf 100644 --- a/Source/WebCore/dom/ElementAttributeData.cpp +++ b/Source/WebCore/dom/ElementAttributeData.cpp @@ -26,6 +26,8 @@ #include "config.h" #include "ElementAttributeData.h" +#include "StyledElement.h" + namespace WebCore { void ElementAttributeData::setClass(const String& className, bool shouldFoldCase) @@ -33,4 +35,29 @@ void ElementAttributeData::setClass(const String& className, bool shouldFoldCase m_classNames.set(className, shouldFoldCase); } +StylePropertySet* ElementAttributeData::ensureInlineStyleDecl(Element* element) +{ + if (!m_inlineStyleDecl) { + ASSERT(element->isStyledElement()); + m_inlineStyleDecl = StylePropertySet::createInline(static_cast<StyledElement*>(element)); + m_inlineStyleDecl->setStrictParsing(element->isHTMLElement() && !element->document()->inQuirksMode()); + } + return m_inlineStyleDecl.get(); +} + +void ElementAttributeData::destroyInlineStyleDecl() +{ + if (!m_inlineStyleDecl) + return; + m_inlineStyleDecl->clearParentElement(); + m_inlineStyleDecl = 0; +} + +StylePropertySet* ElementAttributeData::ensureAttributeStyle(StyledElement* element) +{ + if (!m_attributeStyle) + m_attributeStyle = StylePropertySet::createAttributeStyle(element); + return m_attributeStyle.get(); +} + } diff --git a/Source/WebCore/dom/ElementAttributeData.h b/Source/WebCore/dom/ElementAttributeData.h index 20116c62f..408065981 100644 --- a/Source/WebCore/dom/ElementAttributeData.h +++ b/Source/WebCore/dom/ElementAttributeData.h @@ -26,8 +26,8 @@ #ifndef ElementAttributeData_h #define ElementAttributeData_h -#include "CSSMutableStyleDeclaration.h" #include "SpaceSplitString.h" +#include "StylePropertySet.h" namespace WebCore { @@ -42,6 +42,13 @@ public: const AtomicString& idForStyleResolution() const { return m_idForStyleResolution; } void setIdForStyleResolution(const AtomicString& newId) { m_idForStyleResolution = newId; } + StylePropertySet* inlineStyleDecl() { return m_inlineStyleDecl.get(); } + StylePropertySet* ensureInlineStyleDecl(Element*); + void destroyInlineStyleDecl(); + + StylePropertySet* attributeStyle() const { return m_attributeStyle.get(); } + StylePropertySet* ensureAttributeStyle(StyledElement*); + private: friend class NamedNodeMap; @@ -49,7 +56,8 @@ private: { } - RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl; + RefPtr<StylePropertySet> m_inlineStyleDecl; + RefPtr<StylePropertySet> m_attributeStyle; SpaceSplitString m_classNames; AtomicString m_idForStyleResolution; }; diff --git a/Source/WebCore/dom/ErrorEvent.idl b/Source/WebCore/dom/ErrorEvent.idl index 6d3dc6c0c..2a0c2c514 100644 --- a/Source/WebCore/dom/ErrorEvent.idl +++ b/Source/WebCore/dom/ErrorEvent.idl @@ -31,12 +31,12 @@ module events { interface [ - NoStaticTables, + JSNoStaticTables, ConstructorTemplate=Event ] ErrorEvent : Event { - readonly attribute [InitializedByConstructor] DOMString message; - readonly attribute [InitializedByConstructor] DOMString filename; - readonly attribute [InitializedByConstructor] unsigned long lineno; + readonly attribute [InitializedByEventConstructor] DOMString message; + readonly attribute [InitializedByEventConstructor] DOMString filename; + readonly attribute [InitializedByEventConstructor] unsigned long lineno; }; } diff --git a/Source/WebCore/dom/Event.idl b/Source/WebCore/dom/Event.idl index 80b2f33cd..94d45427e 100644 --- a/Source/WebCore/dom/Event.idl +++ b/Source/WebCore/dom/Event.idl @@ -22,10 +22,10 @@ module events { // Introduced in DOM Level 2: interface [ - CustomToJS, + JSCustomToJS, ConstructorTemplate=Event, - NoStaticTables, - Polymorphic + JSNoStaticTables, + ObjCPolymorphic ] Event { // DOM PhaseType @@ -57,13 +57,13 @@ module events { readonly attribute EventTarget target; readonly attribute EventTarget currentTarget; readonly attribute unsigned short eventPhase; - readonly attribute [InitializedByConstructor] boolean bubbles; - readonly attribute [InitializedByConstructor] boolean cancelable; + readonly attribute [InitializedByEventConstructor] boolean bubbles; + readonly attribute [InitializedByEventConstructor] boolean cancelable; readonly attribute DOMTimeStamp timeStamp; void stopPropagation(); void preventDefault(); - [OldStyleObjC] void initEvent(in [Optional=CallWithDefaultValue] DOMString eventTypeArg, + [ObjCLegacyUnnamedParameters] void initEvent(in [Optional=CallWithDefaultValue] DOMString eventTypeArg, in [Optional=CallWithDefaultValue] boolean canBubbleArg, in [Optional=CallWithDefaultValue] boolean cancelableArg); diff --git a/Source/WebCore/dom/EventException.idl b/Source/WebCore/dom/EventException.idl index 3a9929ca9..28bcf9130 100644 --- a/Source/WebCore/dom/EventException.idl +++ b/Source/WebCore/dom/EventException.idl @@ -30,8 +30,8 @@ module events { // Introduced in DOM Level 2: interface [ - NoStaticTables, - DontCheckEnums + JSNoStaticTables, + DoNotCheckConstants ] EventException { readonly attribute unsigned short code; @@ -40,7 +40,7 @@ module events { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // EventExceptionCode diff --git a/Source/WebCore/dom/EventFactory.in b/Source/WebCore/dom/EventFactory.in index 322da888b..1b500cd79 100644 --- a/Source/WebCore/dom/EventFactory.in +++ b/Source/WebCore/dom/EventFactory.in @@ -37,9 +37,8 @@ SVGEvents interfaceName=Event, conditional=SVG SVGZoomEvent conditional=SVG SVGZoomEvents interfaceName=SVGZoomEvent, conditional=SVG IDBVersionChangeEvent conditional=INDEXED_DATABASE -TouchEvent conditional=TOUCH_EVENTS +TouchEvent conditional=TOUCH_EVENTS, runtimeConditional=touchEnabled DeviceMotionEvent conditional=DEVICE_ORIENTATION DeviceOrientationEvent conditional=DEVICE_ORIENTATION OrientationEvent interfaceName=Event, conditional=ORIENTATION_EVENTS TrackEvent conditional=VIDEO_TRACK - diff --git a/Source/WebCore/dom/EventListener.idl b/Source/WebCore/dom/EventListener.idl index 023777bf3..4e83b440c 100644 --- a/Source/WebCore/dom/EventListener.idl +++ b/Source/WebCore/dom/EventListener.idl @@ -22,9 +22,9 @@ module events { // Introduced in DOM Level 2: interface [ - NoStaticTables, + JSNoStaticTables, ObjCProtocol, - PureInterface, + CPPPureInterface, OmitConstructor ] EventListener { void handleEvent(in Event evt); diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h index 6464d8c10..a616f7476 100644 --- a/Source/WebCore/dom/EventNames.h +++ b/Source/WebCore/dom/EventNames.h @@ -194,6 +194,7 @@ namespace WebCore { macro(connecting) \ macro(addstream) \ macro(removestream) \ + macro(statechange) \ \ macro(show) \ \ diff --git a/Source/WebCore/dom/EventTarget.idl b/Source/WebCore/dom/EventTarget.idl index 8c683da1e..f1b0ef023 100644 --- a/Source/WebCore/dom/EventTarget.idl +++ b/Source/WebCore/dom/EventTarget.idl @@ -23,13 +23,13 @@ module events { // Introduced in DOM Level 2: interface [ ObjCProtocol, - PureInterface, + CPPPureInterface, OmitConstructor ] EventTarget { - [OldStyleObjC] void addEventListener(in DOMString type, + [ObjCLegacyUnnamedParameters] void addEventListener(in DOMString type, in EventListener listener, in [Optional] boolean useCapture); - [OldStyleObjC] void removeEventListener(in DOMString type, + [ObjCLegacyUnnamedParameters] void removeEventListener(in DOMString type, in EventListener listener, in [Optional] boolean useCapture); boolean dispatchEvent(in Event event) diff --git a/Source/WebCore/dom/ExceptionCodePlaceholder.cpp b/Source/WebCore/dom/ExceptionCodePlaceholder.cpp index 7728c8b0d..71750254d 100644 --- a/Source/WebCore/dom/ExceptionCodePlaceholder.cpp +++ b/Source/WebCore/dom/ExceptionCodePlaceholder.cpp @@ -36,7 +36,7 @@ namespace WebCore { #if !ASSERT_DISABLED NoExceptionAssertionChecker::NoExceptionAssertionChecker(const char* file, int line) - : ExceptionCodePlaceholder(0) + : ExceptionCodePlaceholder(defaultExceptionCode) , m_file(file) , m_line(line) { @@ -44,7 +44,7 @@ NoExceptionAssertionChecker::NoExceptionAssertionChecker(const char* file, int l NoExceptionAssertionChecker::~NoExceptionAssertionChecker() { - ASSERT_AT(!m_code, m_file, m_line, ""); + ASSERT_AT(!m_code || m_code == defaultExceptionCode, m_file, m_line, ""); } #endif diff --git a/Source/WebCore/dom/ExceptionCodePlaceholder.h b/Source/WebCore/dom/ExceptionCodePlaceholder.h index 17dd7a0b6..cec8b8d52 100644 --- a/Source/WebCore/dom/ExceptionCodePlaceholder.h +++ b/Source/WebCore/dom/ExceptionCodePlaceholder.h @@ -70,6 +70,7 @@ public: ~NoExceptionAssertionChecker(); private: + static const ExceptionCode defaultExceptionCode = 0xaaaaaaaa; const char* m_file; int m_line; }; diff --git a/Source/WebCore/dom/HashChangeEvent.idl b/Source/WebCore/dom/HashChangeEvent.idl index 561b60686..b2b48877b 100644 --- a/Source/WebCore/dom/HashChangeEvent.idl +++ b/Source/WebCore/dom/HashChangeEvent.idl @@ -28,8 +28,8 @@ module events { in [Optional=CallWithDefaultValue] boolean cancelable, in [Optional=CallWithDefaultValue] DOMString oldURL, in [Optional=CallWithDefaultValue] DOMString newURL); - readonly attribute [InitializedByConstructor] DOMString oldURL; - readonly attribute [InitializedByConstructor] DOMString newURL; + readonly attribute [InitializedByEventConstructor] DOMString oldURL; + readonly attribute [InitializedByEventConstructor] DOMString newURL; }; } diff --git a/Source/WebCore/dom/MappedAttributeEntry.h b/Source/WebCore/dom/MappedAttributeEntry.h deleted file mode 100644 index 4de4927a5..000000000 --- a/Source/WebCore/dom/MappedAttributeEntry.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 1999 Lars Knoll (knoll@kde.org) - * (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 Apple Computer, Inc. - * Copyright (C) 2010 Franois Sausset (sausset@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., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#ifndef MappedAttributeEntry_h -#define MappedAttributeEntry_h - -namespace WebCore { - -enum MappedAttributeEntry { - eNone - , eUniversal - , eReplaced - , eBlock - , eHR - , eUnorderedList - , eListItem - , eTable - , eCell - , eCaption - , eBDI - , eBDO - , ePre -#if ENABLE(SVG) - , eSVG -#endif -#if ENABLE(MATHML) - , eMathML -#endif -// When adding new entries, make sure to keep eLastEntry at the end of the list. - , eLastEntry -}; - -} - -#endif diff --git a/Source/WebCore/dom/MessageChannel.idl b/Source/WebCore/dom/MessageChannel.idl index 4fc2bf89c..d21eb1142 100644 --- a/Source/WebCore/dom/MessageChannel.idl +++ b/Source/WebCore/dom/MessageChannel.idl @@ -30,8 +30,8 @@ module events { Constructor, CallWith=ScriptExecutionContext, V8CustomConstructor, - CustomMarkFunction, - NoStaticTables + JSCustomMarkFunction, + JSNoStaticTables ] MessageChannel { readonly attribute MessagePort port1; diff --git a/Source/WebCore/dom/MessageEvent.idl b/Source/WebCore/dom/MessageEvent.idl index 6d324f791..123235929 100644 --- a/Source/WebCore/dom/MessageEvent.idl +++ b/Source/WebCore/dom/MessageEvent.idl @@ -28,15 +28,15 @@ module events { interface [ - NoStaticTables, + JSNoStaticTables, ConstructorTemplate=Event ] MessageEvent : Event { - readonly attribute [InitializedByConstructor] DOMString origin; - readonly attribute [InitializedByConstructor] DOMString lastEventId; - readonly attribute [InitializedByConstructor] DOMWindow source; + readonly attribute [InitializedByEventConstructor] DOMString origin; + readonly attribute [InitializedByEventConstructor] DOMString lastEventId; + readonly attribute [InitializedByEventConstructor] DOMWindow source; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - readonly attribute [InitializedByConstructor, CachedAttribute, CustomGetter] DOMObject data; - readonly attribute [InitializedByConstructor, CustomGetter] Array ports; + readonly attribute [InitializedByEventConstructor, CachedAttribute, CustomGetter] DOMObject data; + readonly attribute [InitializedByEventConstructor, CustomGetter] Array ports; [Custom] void initMessageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg, in [Optional=CallWithDefaultValue] boolean canBubbleArg, diff --git a/Source/WebCore/dom/MessagePort.idl b/Source/WebCore/dom/MessagePort.idl index b26f32097..f318f7987 100644 --- a/Source/WebCore/dom/MessagePort.idl +++ b/Source/WebCore/dom/MessagePort.idl @@ -28,11 +28,11 @@ module events { interface [ - CustomMarkFunction, - GenerateIsReachable=Impl, + JSCustomMarkFunction, + JSGenerateIsReachable=Impl, ActiveDOMObject, EventTarget, - NoStaticTables + JSNoStaticTables ] MessagePort { // We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one, // but we don't want to actually expose the API while it is in flux. diff --git a/Source/WebCore/dom/MouseEvent.idl b/Source/WebCore/dom/MouseEvent.idl index d6b5f3500..3ece01c50 100644 --- a/Source/WebCore/dom/MouseEvent.idl +++ b/Source/WebCore/dom/MouseEvent.idl @@ -25,8 +25,8 @@ module events { readonly attribute long screenY; readonly attribute long clientX; readonly attribute long clientY; - readonly attribute [Conditional=POINTER_LOCK, EnabledAtRuntime] long webkitMovementX; - readonly attribute [Conditional=POINTER_LOCK, EnabledAtRuntime] long webkitMovementY; + readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime] long webkitMovementX; + readonly attribute [Conditional=POINTER_LOCK, V8EnabledAtRuntime] long webkitMovementY; readonly attribute boolean ctrlKey; readonly attribute boolean shiftKey; readonly attribute boolean altKey; @@ -34,7 +34,7 @@ module events { readonly attribute unsigned short button; readonly attribute EventTarget relatedTarget; - [OldStyleObjC] void initMouseEvent(in [Optional=CallWithDefaultValue] DOMString type, + [ObjCLegacyUnnamedParameters] void initMouseEvent(in [Optional=CallWithDefaultValue] DOMString type, in [Optional=CallWithDefaultValue] boolean canBubble, in [Optional=CallWithDefaultValue] boolean cancelable, in [Optional=CallWithDefaultValue] DOMWindow view, diff --git a/Source/WebCore/dom/MutationEvent.idl b/Source/WebCore/dom/MutationEvent.idl index b07cdd785..5aee2e560 100644 --- a/Source/WebCore/dom/MutationEvent.idl +++ b/Source/WebCore/dom/MutationEvent.idl @@ -33,7 +33,7 @@ module events { readonly attribute DOMString attrName; readonly attribute unsigned short attrChange; - [OldStyleObjC] void initMutationEvent(in [Optional=CallWithDefaultValue] DOMString type, + [ObjCLegacyUnnamedParameters] void initMutationEvent(in [Optional=CallWithDefaultValue] DOMString type, in [Optional=CallWithDefaultValue] boolean canBubble, in [Optional=CallWithDefaultValue] boolean cancelable, in [Optional=CallWithDefaultValue] Node relatedNode, diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp index 7f6229775..0a32a66ca 100644 --- a/Source/WebCore/dom/NamedNodeMap.cpp +++ b/Source/WebCore/dom/NamedNodeMap.cpp @@ -30,7 +30,6 @@ #include "Element.h" #include "ExceptionCode.h" #include "HTMLNames.h" -#include "StyledElement.h" namespace WebCore { @@ -239,15 +238,12 @@ void NamedNodeMap::setAttributes(const NamedNodeMap& other) clearAttributes(); unsigned newLength = other.length(); m_attributes.resize(newLength); + + // FIXME: These loops can probably be combined. for (unsigned i = 0; i < newLength; i++) m_attributes[i] = other.m_attributes[i]->clone(); - - // FIXME: This is wasteful. The class list could be preserved on a copy, and we - // wouldn't have to waste time reparsing the attribute. - // The derived class, HTMLNamedNodeMap, which manages a parsed class list for the CLASS attribute, - // will update its member variable when parse attribute is called. for (unsigned i = 0; i < newLength; i++) - m_element->attributeChanged(m_attributes[i].get(), true); + m_element->attributeChanged(m_attributes[i].get()); } void NamedNodeMap::addAttribute(PassRefPtr<Attribute> prpAttribute) @@ -321,22 +317,4 @@ bool NamedNodeMap::mapsEquivalent(const NamedNodeMap* otherMap) const return true; } -CSSMutableStyleDeclaration* NamedNodeMap::ensureInlineStyleDecl() -{ - if (!attributeData()->m_inlineStyleDecl) { - ASSERT(m_element->isStyledElement()); - attributeData()->m_inlineStyleDecl = CSSMutableStyleDeclaration::createInline(static_cast<StyledElement*>(m_element)); - attributeData()->m_inlineStyleDecl->setStrictParsing(m_element->isHTMLElement() && !m_element->document()->inQuirksMode()); - } - return attributeData()->m_inlineStyleDecl.get(); -} - -void NamedNodeMap::destroyInlineStyleDecl() -{ - if (!attributeData()->m_inlineStyleDecl) - return; - attributeData()->m_inlineStyleDecl->clearParentElement(); - attributeData()->m_inlineStyleDecl = 0; -} - } // namespace WebCore diff --git a/Source/WebCore/dom/NamedNodeMap.h b/Source/WebCore/dom/NamedNodeMap.h index f53047c30..6bdde0fb3 100644 --- a/Source/WebCore/dom/NamedNodeMap.h +++ b/Source/WebCore/dom/NamedNodeMap.h @@ -94,15 +94,9 @@ public: Element* element() const { return m_element; } - size_t mappedAttributeCount() const; - ElementAttributeData* attributeData() { return &m_attributeData; } const ElementAttributeData* attributeData() const { return &m_attributeData; } - CSSMutableStyleDeclaration* inlineStyleDecl() { return attributeData()->m_inlineStyleDecl.get(); } - CSSMutableStyleDeclaration* ensureInlineStyleDecl(); - void destroyInlineStyleDecl(); - private: NamedNodeMap(Element* element) : m_element(element) @@ -184,16 +178,6 @@ inline void NamedNodeMap::removeAttribute(const QualifiedName& name) removeAttribute(index); } -inline size_t NamedNodeMap::mappedAttributeCount() const -{ - size_t count = 0; - for (size_t i = 0; i < m_attributes.size(); ++i) { - if (m_attributes[i]->decl()) - ++count; - } - return count; -} - } // namespace WebCore #endif // NamedNodeMap_h diff --git a/Source/WebCore/dom/NamedNodeMap.idl b/Source/WebCore/dom/NamedNodeMap.idl index 016cac743..3c07a1146 100644 --- a/Source/WebCore/dom/NamedNodeMap.idl +++ b/Source/WebCore/dom/NamedNodeMap.idl @@ -21,10 +21,10 @@ module core { interface [ - GenerateIsReachable=ImplElementRoot, - CustomMarkFunction, - HasIndexGetter, - HasNameGetter + JSGenerateIsReachable=ImplElementRoot, + JSCustomMarkFunction, + IndexedGetter, + NamedGetter ] NamedNodeMap { Node getNamedItem(in [Optional=CallWithDefaultValue] DOMString name); @@ -42,7 +42,7 @@ module core { // Introduced in DOM Level 2: - [OldStyleObjC] Node getNamedItemNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] Node getNamedItemNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName) // FIXME: the implementation does take an exceptioncode parameter. /*raises(DOMException)*/; @@ -50,7 +50,7 @@ module core { Node setNamedItemNS(in [Optional=CallWithDefaultValue] Node node) raises(DOMException); - [OldStyleObjC] Node removeNamedItemNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + [ObjCLegacyUnnamedParameters] Node removeNamedItemNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName) raises(DOMException); diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp index 738000fec..39b8fa895 100644 --- a/Source/WebCore/dom/Node.cpp +++ b/Source/WebCore/dom/Node.cpp @@ -159,8 +159,6 @@ void Node::dumpStatistics() HashMap<String, size_t> perTagCount; size_t attributes = 0; - size_t mappedAttributes = 0; - size_t mappedAttributesWithStyleDecl = 0; size_t attributesWithAttr = 0; size_t attrMaps = 0; @@ -188,11 +186,6 @@ void Node::dumpStatistics() Attribute* attr = attrMap->attributeItem(i); if (attr->attr()) ++attributesWithAttr; - if (attr->isMappedAttribute()) { - ++mappedAttributes; - if (attr->style()) - ++mappedAttributesWithStyleDecl; - } } } break; @@ -277,8 +270,6 @@ void Node::dumpStatistics() printf("Attribute Maps:\n"); printf(" Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute)); - printf(" Number of Attributes that are mapped: %zu\n", mappedAttributes); - printf(" Number of Attributes with a StyleDeclaration: %zu\n", mappedAttributesWithStyleDecl); printf(" Number of Attributes with an Attr: %zu\n", attributesWithAttr); printf(" Number of NamedNodeMaps: %zu [%zu]\n", attrMaps, sizeof(NamedNodeMap)); #endif @@ -641,7 +632,7 @@ void Node::normalize() continue; } - Text* text = static_cast<Text*>(node.get()); + RefPtr<Text> text = static_cast<Text*>(node.get()); // Remove empty text nodes. if (!text->length()) { @@ -1831,9 +1822,9 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const if (elem->prefix().isNull()) return elem->namespaceURI() == namespaceURI; - if (NamedNodeMap* attrs = elem->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + if (elem->hasAttributes()) { + for (unsigned i = 0; i < elem->attributeCount(); i++) { + Attribute* attr = elem->attributeItem(i); if (attr->localName() == xmlnsAtom) return attr->value() == namespaceURI; @@ -1917,9 +1908,9 @@ String Node::lookupNamespaceURI(const String &prefix) const if (!elem->namespaceURI().isNull() && elem->prefix() == prefix) return elem->namespaceURI(); - if (NamedNodeMap* attrs = elem->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute *attr = attrs->attributeItem(i); + if (elem->hasAttributes()) { + for (unsigned i = 0; i < elem->attributeCount(); i++) { + Attribute* attr = elem->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) { if (!attr->value().isEmpty()) @@ -1971,9 +1962,11 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem if (originalElement->lookupNamespaceURI(prefix()) == _namespaceURI) return prefix(); - if (NamedNodeMap* attrs = toElement(this)->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + ASSERT(isElementNode()); + const Element* thisElement = toElement(this); + if (thisElement->hasAttributes()) { + for (unsigned i = 0; i < thisElement->attributeCount(); i++) { + Attribute* attr = thisElement->attributeItem(i); if (attr->prefix() == xmlnsAtom && attr->value() == _namespaceURI && originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI) @@ -2114,17 +2107,17 @@ unsigned short Node::compareDocumentPosition(Node* otherNode) chain2.append(attr2); if (attr1 && attr2 && start1 == start2 && start1) { - // We are comparing two attributes on the same node. Crawl our attribute map - // and see which one we hit first. - NamedNodeMap* map = attr1->ownerElement()->updatedAttributes(); - unsigned length = map->length(); + // We are comparing two attributes on the same node. Crawl our attribute map and see which one we hit first. + Element* owner1 = attr1->ownerElement(); + owner1->updatedAttributes(); // Force update invalid attributes. + unsigned length = owner1->attributeCount(); for (unsigned i = 0; i < length; ++i) { // If neither of the two determining nodes is a child node and nodeType is the same for both determining nodes, then an // implementation-dependent order between the determining nodes is returned. This order is stable as long as no nodes of // the same nodeType are inserted into or removed from the direct container. This would be the case, for example, // when comparing two attributes of the same element, and inserting or removing additional attributes might change // the order between existing attributes. - Attribute* attr = map->attributeItem(i); + Attribute* attr = owner1->attributeItem(i); if (attr1->attr() == attr) return DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | DOCUMENT_POSITION_FOLLOWING; if (attr2->attr() == attr) diff --git a/Source/WebCore/dom/Node.idl b/Source/WebCore/dom/Node.idl index 6f3987d9f..b67be68b4 100644 --- a/Source/WebCore/dom/Node.idl +++ b/Source/WebCore/dom/Node.idl @@ -21,16 +21,16 @@ module core { interface [ - CustomHeader, - CustomMarkFunction, - CustomPushEventHandlerScope, - CustomIsReachable, - CustomFinalize, - CustomToJS, + JSCustomHeader, + JSCustomMarkFunction, + JSCustomPushEventHandlerScope, + JSCustomIsReachable, + JSCustomFinalize, + JSCustomToJS, EventTarget, - GenerateNativeConverter, - InlineGetOwnPropertySlot, - Polymorphic, + JSGenerateToNativeObject, + JSInlineGetOwnPropertySlot, + ObjCPolymorphic, V8DependentLifetime ] Node #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C @@ -54,7 +54,7 @@ module core { readonly attribute [ConvertNullStringTo=Null] DOMString nodeName; // FIXME: the spec says this can also raise on retrieval. - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString nodeValue + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString nodeValue setter raises(DOMException); readonly attribute unsigned short nodeType; @@ -67,10 +67,10 @@ module core { readonly attribute NamedNodeMap attributes; readonly attribute Document ownerDocument; - [OldStyleObjC, Custom] Node insertBefore(in [Return] Node newChild, + [ObjCLegacyUnnamedParameters, Custom] Node insertBefore(in [Return] Node newChild, in Node refChild) raises(DOMException); - [OldStyleObjC, Custom] Node replaceChild(in Node newChild, + [ObjCLegacyUnnamedParameters, Custom] Node replaceChild(in Node newChild, in [Return] Node oldChild) raises(DOMExceptionJSC); [Custom] Node removeChild(in [Return] Node oldChild) @@ -84,11 +84,11 @@ module core { // Introduced in DOM Level 2: - [OldStyleObjC] boolean isSupported(in [Optional=CallWithDefaultValue] DOMString feature, - in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString version); + [ObjCLegacyUnnamedParameters] boolean isSupported(in [Optional=CallWithDefaultValue] DOMString feature, + in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString version); readonly attribute [ConvertNullStringTo=Null] DOMString namespaceURI; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString prefix + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString prefix setter raises(DOMException); readonly attribute [ConvertNullStringTo=Null] DOMString localName; @@ -99,14 +99,14 @@ module core { readonly attribute [ConvertNullStringTo=Null] DOMString baseURI; // FIXME: the spec says this can also raise on retrieval. - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString textContent + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString textContent setter raises(DOMException); boolean isSameNode(in [Optional=CallWithDefaultValue] Node other); boolean isEqualNode(in [Optional=CallWithDefaultValue] Node other); - [ConvertNullStringTo=Null] DOMString lookupPrefix(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI); - boolean isDefaultNamespace(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI); - [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString prefix); + [ConvertNullStringTo=Null] DOMString lookupPrefix(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI); + boolean isDefaultNamespace(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI); + [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString prefix); // DocumentPosition const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01; diff --git a/Source/WebCore/dom/NodeFilter.idl b/Source/WebCore/dom/NodeFilter.idl index 38dac10f0..8edef0e03 100644 --- a/Source/WebCore/dom/NodeFilter.idl +++ b/Source/WebCore/dom/NodeFilter.idl @@ -22,10 +22,10 @@ module traversal { // Introduced in DOM Level 2: interface [ - CustomMarkFunction, - CustomNativeConverter, + JSCustomMarkFunction, + JSCustomToNativeObject, ObjCProtocol, - PureInterface + CPPPureInterface ] NodeFilter { // Constants returned by acceptNode const short FILTER_ACCEPT = 1; diff --git a/Source/WebCore/dom/NodeIterator.idl b/Source/WebCore/dom/NodeIterator.idl index 9f59ae1aa..5b3f288fb 100644 --- a/Source/WebCore/dom/NodeIterator.idl +++ b/Source/WebCore/dom/NodeIterator.idl @@ -22,7 +22,7 @@ module traversal { // Introduced in DOM Level 2: interface [ - CustomMarkFunction + JSCustomMarkFunction ] NodeIterator { readonly attribute Node root; readonly attribute unsigned long whatToShow; diff --git a/Source/WebCore/dom/NodeList.idl b/Source/WebCore/dom/NodeList.idl index a3102b128..ebe813f83 100644 --- a/Source/WebCore/dom/NodeList.idl +++ b/Source/WebCore/dom/NodeList.idl @@ -21,9 +21,9 @@ module core { interface [ - CustomIsReachable, - HasIndexGetter, - HasNameGetter + JSCustomIsReachable, + IndexedGetter, + NamedGetter ] NodeList { Node item(in [IsIndex,Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/dom/OverflowEvent.idl b/Source/WebCore/dom/OverflowEvent.idl index b43b52cf6..a1ecc4179 100644 --- a/Source/WebCore/dom/OverflowEvent.idl +++ b/Source/WebCore/dom/OverflowEvent.idl @@ -32,9 +32,9 @@ module events { const unsigned short VERTICAL = 1; const unsigned short BOTH = 2; - readonly attribute [InitializedByConstructor] unsigned short orient; - readonly attribute [InitializedByConstructor] boolean horizontalOverflow; - readonly attribute [InitializedByConstructor] boolean verticalOverflow; + readonly attribute [InitializedByEventConstructor] unsigned short orient; + readonly attribute [InitializedByEventConstructor] boolean horizontalOverflow; + readonly attribute [InitializedByEventConstructor] boolean verticalOverflow; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C void initOverflowEvent(in [Optional=CallWithDefaultValue] unsigned short orient, diff --git a/Source/WebCore/dom/PageTransitionEvent.idl b/Source/WebCore/dom/PageTransitionEvent.idl index 3734dc655..76c8727b7 100644 --- a/Source/WebCore/dom/PageTransitionEvent.idl +++ b/Source/WebCore/dom/PageTransitionEvent.idl @@ -28,7 +28,7 @@ module events { interface [ ConstructorTemplate=Event ] PageTransitionEvent : Event { - readonly attribute [InitializedByConstructor] boolean persisted; + readonly attribute [InitializedByEventConstructor] boolean persisted; }; } diff --git a/Source/WebCore/dom/PopStateEvent.idl b/Source/WebCore/dom/PopStateEvent.idl index 58ad95273..6326a9d7a 100644 --- a/Source/WebCore/dom/PopStateEvent.idl +++ b/Source/WebCore/dom/PopStateEvent.idl @@ -30,7 +30,7 @@ module events { interface [ ConstructorTemplate=Event ] PopStateEvent : Event { - readonly attribute [InitializedByConstructor, CustomGetter] DOMObject state; + readonly attribute [InitializedByEventConstructor, CustomGetter] DOMObject state; }; #endif diff --git a/Source/WebCore/dom/ProcessingInstruction.idl b/Source/WebCore/dom/ProcessingInstruction.idl index 6f9f68dd4..9c673fdcb 100644 --- a/Source/WebCore/dom/ProcessingInstruction.idl +++ b/Source/WebCore/dom/ProcessingInstruction.idl @@ -25,7 +25,7 @@ module core { // DOM Level 1 readonly attribute [ConvertNullStringTo=Null] DOMString target; - attribute [ConvertNullStringTo=Null, TreatNullAs=EmptyString] DOMString data + attribute [ConvertNullStringTo=Null, TreatNullAs=NullString] DOMString data setter raises(DOMException); // interface LinkStyle from DOM Level 2 Style Sheets diff --git a/Source/WebCore/dom/ProgressEvent.idl b/Source/WebCore/dom/ProgressEvent.idl index 3bcdd3d79..f8d0b5baf 100644 --- a/Source/WebCore/dom/ProgressEvent.idl +++ b/Source/WebCore/dom/ProgressEvent.idl @@ -28,9 +28,9 @@ module events { interface [ ConstructorTemplate=Event ] ProgressEvent : Event { - readonly attribute [InitializedByConstructor] boolean lengthComputable; - readonly attribute [InitializedByConstructor] unsigned long long loaded; - readonly attribute [InitializedByConstructor] unsigned long long total; + readonly attribute [InitializedByEventConstructor] boolean lengthComputable; + readonly attribute [InitializedByEventConstructor] unsigned long long loaded; + readonly attribute [InitializedByEventConstructor] unsigned long long total; }; } diff --git a/Source/WebCore/dom/Range.idl b/Source/WebCore/dom/Range.idl index 668fd5f13..eb7168fa6 100644 --- a/Source/WebCore/dom/Range.idl +++ b/Source/WebCore/dom/Range.idl @@ -36,10 +36,10 @@ module ranges { readonly attribute Node commonAncestorContainer getter raises(DOMException); - [OldStyleObjC] void setStart(in [Optional=CallWithDefaultValue] Node refNode, + [ObjCLegacyUnnamedParameters] void setStart(in [Optional=CallWithDefaultValue] Node refNode, in [Optional=CallWithDefaultValue] long offset) raises(RangeException, DOMException); - [OldStyleObjC] void setEnd(in [Optional=CallWithDefaultValue] Node refNode, + [ObjCLegacyUnnamedParameters] void setEnd(in [Optional=CallWithDefaultValue] Node refNode, in [Optional=CallWithDefaultValue] long offset) raises(RangeException, DOMException); void setStartBefore(in [Optional=CallWithDefaultValue] Node refNode) @@ -63,7 +63,7 @@ module ranges { const unsigned short END_TO_END = 2; const unsigned short END_TO_START = 3; - [OldStyleObjC] short compareBoundaryPoints(in [Optional=CallWithDefaultValue] CompareHow how, + [ObjCLegacyUnnamedParameters] short compareBoundaryPoints(in [Optional=CallWithDefaultValue] CompareHow how, in [Optional=CallWithDefaultValue] Range sourceRange) raises(DOMException); diff --git a/Source/WebCore/dom/RangeException.idl b/Source/WebCore/dom/RangeException.idl index be05f961e..b2dfc6c5b 100644 --- a/Source/WebCore/dom/RangeException.idl +++ b/Source/WebCore/dom/RangeException.idl @@ -20,7 +20,7 @@ module ranges { interface [ - DontCheckEnums + DoNotCheckConstants ] RangeException { readonly attribute unsigned short code; @@ -28,7 +28,7 @@ module ranges { readonly attribute DOMString message; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // DOM Level 2 diff --git a/Source/WebCore/dom/ScriptExecutionContext.cpp b/Source/WebCore/dom/ScriptExecutionContext.cpp index ef06c29ec..5670fe8ef 100644 --- a/Source/WebCore/dom/ScriptExecutionContext.cpp +++ b/Source/WebCore/dom/ScriptExecutionContext.cpp @@ -38,6 +38,7 @@ #include "EventTarget.h" #include "FileThread.h" #include "MessagePort.h" +#include "PublicURLManager.h" #include "ScriptCallStack.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -126,6 +127,10 @@ ScriptExecutionContext::~ScriptExecutionContext() m_fileThread = 0; } #endif +#if ENABLE(BLOB) + if (m_publicURLManager) + m_publicURLManager->contextDestroyed(); +#endif } #if ENABLE(SQL_DATABASE) @@ -385,6 +390,15 @@ FileThread* ScriptExecutionContext::fileThread() } #endif +#if ENABLE(BLOB) +PublicURLManager& ScriptExecutionContext::publicURLManager() +{ + if (!m_publicURLManager) + m_publicURLManager = PublicURLManager::create(); + return *m_publicURLManager; +} +#endif + void ScriptExecutionContext::adjustMinimumTimerInterval(double oldMinimumTimerInterval) { if (minimumTimerInterval() != oldMinimumTimerInterval) { diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h index aed3411e0..6cbdd0265 100644 --- a/Source/WebCore/dom/ScriptExecutionContext.h +++ b/Source/WebCore/dom/ScriptExecutionContext.h @@ -53,6 +53,9 @@ class EventQueue; class EventTarget; class MessagePort; +#if ENABLE(BLOB) +class PublicURLManager; +#endif #if ENABLE(SQL_DATABASE) class Database; class DatabaseTaskSynchronizer; @@ -103,6 +106,9 @@ public: virtual void resumeActiveDOMObjects(); virtual void stopActiveDOMObjects(); +#if ENABLE(BLOB) + PublicURLManager& publicURLManager(); +#endif void didCreateActiveDOMObject(ActiveDOMObject*, void* upcastPointer); void willDestroyActiveDOMObject(ActiveDOMObject*); @@ -205,6 +211,9 @@ private: bool m_inDispatchErrorEvent; class PendingException; OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions; +#if ENABLE(BLOB) + OwnPtr<PublicURLManager> m_publicURLManager; +#endif #if ENABLE(SQL_DATABASE) RefPtr<DatabaseThread> m_databaseThread; diff --git a/Source/WebCore/dom/SelectorQuery.cpp b/Source/WebCore/dom/SelectorQuery.cpp index a889f9f2b..ca6e3da21 100644 --- a/Source/WebCore/dom/SelectorQuery.cpp +++ b/Source/WebCore/dom/SelectorQuery.cpp @@ -98,14 +98,20 @@ bool SelectorDataList::canUseIdLookup(Node* rootNode) const return true; } +static inline bool isTreeScopeRoot(Node* node) +{ + ASSERT(node); + return node->isDocumentNode() || node->isShadowRoot(); +} + template <bool firstMatchOnly> void SelectorDataList::execute(const SelectorChecker& selectorChecker, Node* rootNode, Vector<RefPtr<Node> >& matchedElements) const { if (canUseIdLookup(rootNode)) { ASSERT(m_selectors.size() == 1); CSSSelector* selector = m_selectors[0].selector; - Element* element = rootNode->document()->getElementById(selector->value()); - if (!element || !(rootNode->isDocumentNode() || element->isDescendantOf(rootNode))) + Element* element = rootNode->treeScope()->getElementById(selector->value()); + if (!element || !(isTreeScopeRoot(rootNode) || element->isDescendantOf(rootNode))) return; if (selectorChecker.checkSelector(m_selectors[0].selector, element, m_selectors[0].isFastCheckable)) matchedElements.append(element); diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 052c51d3e..290be3f6d 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -31,7 +31,9 @@ #include "Document.h" #include "Element.h" #include "HTMLContentElement.h" +#include "HTMLNames.h" #include "NodeRareData.h" +#include "SVGNames.h" #include "Text.h" namespace WebCore { @@ -59,16 +61,57 @@ ShadowRoot::~ShadowRoot() clearRareData(); } +static bool allowsAuthorShadowRoot(Element* element) +{ + // FIXME: MEDIA recreates shadow root dynamically. + // https://bugs.webkit.org/show_bug.cgi?id=77936 + if (element->hasTagName(HTMLNames::videoTag) || element->hasTagName(HTMLNames::audioTag)) + return false; + + // FIXME: ValidationMessage recreates shadow root dynamically. + // https://bugs.webkit.org/show_bug.cgi?id=77937 + // Especially, INPUT recreates shadow root dynamically. + // https://bugs.webkit.org/show_bug.cgi?id=77930 + if (element->isFormControlElement()) + return false; + + // FIXME: We disable multiple shadow subtrees for SVG for while, because there will be problems to support it. + // https://bugs.webkit.org/show_bug.cgi?id=78205 + // Especially SVG TREF recreates shadow root dynamically. + // https://bugs.webkit.org/show_bug.cgi?id=77938 + if (element->isSVGElement()) + return false; + + return true; +} + PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec) { + return create(element, CreatingAuthorShadowRoot, ec); +} + +PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ShadowRootCreationPurpose purpose, ExceptionCode& ec) +{ if (!element || element->shadowRoot()) { ec = HIERARCHY_REQUEST_ERR; return 0; } + + // Since some elements recreates shadow root dynamically, multiple shadow subtrees won't work well in that element. + // Until they are fixed, we disable adding author shadow root for them. + if (purpose == CreatingAuthorShadowRoot && !allowsAuthorShadowRoot(element)) { + ec = HIERARCHY_REQUEST_ERR; + return 0; + } + + ASSERT(purpose != CreatingUserAgentShadowRoot || !element->shadowRoot()); RefPtr<ShadowRoot> shadowRoot = create(element->document()); + + ec = 0; element->setShadowRoot(shadowRoot, ec); if (ec) return 0; + return shadowRoot.release(); } @@ -142,8 +185,9 @@ void ShadowRoot::hostChildrenChanged() { if (!hasContentElement()) return; + // This results in forced detaching/attaching of the shadow render tree. See ShadowRoot::recalcStyle(). - setNeedsStyleRecalc(); + setNeedsReattachHostChildrenAndShadow(); } bool ShadowRoot::isInclusionSelectorActive() const diff --git a/Source/WebCore/dom/ShadowRoot.h b/Source/WebCore/dom/ShadowRoot.h index d0b189472..401ee5e9d 100644 --- a/Source/WebCore/dom/ShadowRoot.h +++ b/Source/WebCore/dom/ShadowRoot.h @@ -42,6 +42,16 @@ public: static PassRefPtr<ShadowRoot> create(Document*); static PassRefPtr<ShadowRoot> create(Element*, ExceptionCode&); + // FIXME: We will support multiple shadow subtrees, however current implementation does not work well + // if a shadow root is dynamically created. So we prohibit multiple shadow subtrees + // in several elements for a while. + // See https://bugs.webkit.org/show_bug.cgi?id=77503 and related bugs. + enum ShadowRootCreationPurpose { + CreatingUserAgentShadowRoot, + CreatingAuthorShadowRoot, + }; + static PassRefPtr<ShadowRoot> create(Element*, ShadowRootCreationPurpose, ExceptionCode& = ASSERT_NO_EXCEPTION); + void recalcShadowTreeStyle(StyleChange); void setNeedsReattachHostChildrenAndShadow(); diff --git a/Source/WebCore/dom/ShadowRoot.idl b/Source/WebCore/dom/ShadowRoot.idl index ee6cc36c2..011d6795f 100644 --- a/Source/WebCore/dom/ShadowRoot.idl +++ b/Source/WebCore/dom/ShadowRoot.idl @@ -28,15 +28,15 @@ module core { interface [ Conditional=SHADOW_DOM, - EnabledAtRuntime=shadowDOM, + V8EnabledAtRuntime=shadowDOM, Constructor(in Element host), ConstructorRaisesException - ] ShadowRoot : Node { + ] ShadowRoot : DocumentFragment { readonly attribute Element host; Element getElementById(in [Optional=CallWithDefaultValue] DOMString elementId); NodeList getElementsByClassName(in [Optional=CallWithDefaultValue] DOMString className); NodeList getElementsByTagName(in [Optional=CallWithDefaultValue] DOMString tagName); - NodeList getElementsByTagNameNS(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString namespaceURI, + NodeList getElementsByTagNameNS(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString namespaceURI, in [Optional=CallWithDefaultValue] DOMString localName); }; diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index 25f2cd807..526052647 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -25,10 +25,11 @@ #include "StyledElement.h" #include "Attribute.h" -#include "CSSMutableStyleDeclaration.h" +#include "CSSImageValue.h" #include "CSSStyleSelector.h" #include "CSSStyleSheet.h" #include "CSSValueKeywords.h" +#include "CSSValuePool.h" #include "Color.h" #include "ClassList.h" #include "ContentSecurityPolicy.h" @@ -36,6 +37,7 @@ #include "Document.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" +#include "StylePropertySet.h" #include <wtf/HashFunctions.h> using namespace std; @@ -44,75 +46,12 @@ namespace WebCore { using namespace HTMLNames; -struct MappedAttributeKey { - uint16_t type; - StringImpl* name; - StringImpl* value; - MappedAttributeKey(MappedAttributeEntry t = eNone, StringImpl* n = 0, StringImpl* v = 0) - : type(t), name(n), value(v) { } -}; - -static inline bool operator==(const MappedAttributeKey& a, const MappedAttributeKey& b) - { return a.type == b.type && a.name == b.name && a.value == b.value; } - -struct MappedAttributeKeyTraits : WTF::GenericHashTraits<MappedAttributeKey> { - static const bool emptyValueIsZero = true; - static const bool needsDestruction = false; - static void constructDeletedValue(MappedAttributeKey& slot) { slot.type = eLastEntry; } - static bool isDeletedValue(const MappedAttributeKey& value) { return value.type == eLastEntry; } -}; - -struct MappedAttributeHash { - static unsigned hash(const MappedAttributeKey&); - static bool equal(const MappedAttributeKey& a, const MappedAttributeKey& b) { return a == b; } - static const bool safeToCompareToEmptyOrDeleted = true; -}; - -typedef HashMap<MappedAttributeKey, CSSMappedAttributeDeclaration*, MappedAttributeHash, MappedAttributeKeyTraits> MappedAttributeDecls; - -static MappedAttributeDecls* mappedAttributeDecls = 0; - -CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr) -{ - if (!mappedAttributeDecls) - return 0; - return mappedAttributeDecls->get(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl())); -} - -CSSMappedAttributeDeclaration* StyledElement::getMappedAttributeDecl(MappedAttributeEntry type, const QualifiedName& name, const AtomicString& value) -{ - if (!mappedAttributeDecls) - return 0; - return mappedAttributeDecls->get(MappedAttributeKey(type, name.localName().impl(), value.impl())); -} - -void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, Attribute* attr, CSSMappedAttributeDeclaration* decl) -{ - if (!mappedAttributeDecls) - mappedAttributeDecls = new MappedAttributeDecls; - mappedAttributeDecls->set(MappedAttributeKey(entryType, attr->name().localName().impl(), attr->value().impl()), decl); -} - -void StyledElement::setMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration* decl) -{ - if (!mappedAttributeDecls) - mappedAttributeDecls = new MappedAttributeDecls; - mappedAttributeDecls->set(MappedAttributeKey(entryType, name.localName().impl(), value.impl()), decl); -} - -void StyledElement::removeMappedAttributeDecl(MappedAttributeEntry entryType, const QualifiedName& attrName, const AtomicString& attrValue) -{ - if (!mappedAttributeDecls) - return; - mappedAttributeDecls->remove(MappedAttributeKey(entryType, attrName.localName().impl(), attrValue.impl())); -} - void StyledElement::updateStyleAttribute() const { ASSERT(!isStyleAttributeValid()); setIsStyleAttributeValid(); setIsSynchronizingStyleAttribute(); - if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl()) + if (StylePropertySet* inlineStyle = inlineStyleDecl()) const_cast<StyledElement*>(this)->setAttribute(styleAttr, inlineStyle->asText()); clearIsSynchronizingStyleAttribute(); } @@ -122,70 +61,12 @@ StyledElement::~StyledElement() destroyInlineStyleDecl(); } -PassRefPtr<Attribute> StyledElement::createAttribute(const QualifiedName& name, const AtomicString& value) -{ - return Attribute::createMapped(name, value); -} - -void StyledElement::attributeChanged(Attribute* attr, bool preserveDecls) +void StyledElement::attributeChanged(Attribute* attr) { - if (attr->name() == HTMLNames::nameAttr) - setHasName(!attr->isNull()); - - if (!attr->isMappedAttribute()) { - Element::attributeChanged(attr, preserveDecls); - return; - } - - if (attr->mappedAttributeDeclaration() && !preserveDecls) { - attr->setMappedAttributeDeclaration(0); - setNeedsStyleRecalc(); - } + if (!(attr->name() == styleAttr && isSynchronizingStyleAttribute())) + parseAttribute(attr); - bool checkDecl = true; - MappedAttributeEntry entry; - bool needToParse = mapToEntry(attr->name(), entry); - if (preserveDecls) { - if (attr->mappedAttributeDeclaration()) { - setNeedsStyleRecalc(); - checkDecl = false; - } - } else if (!attr->isNull() && entry != eNone) { - CSSMappedAttributeDeclaration* decl = getMappedAttributeDecl(entry, attr); - if (decl) { - attr->setMappedAttributeDeclaration(decl); - setNeedsStyleRecalc(); - checkDecl = false; - } else - needToParse = true; - } - - // parseMappedAttribute() might create a CSSMappedAttributeDeclaration on the attribute. - // Normally we would be concerned about reseting the parent of those declarations in StyledElement::didMoveToNewDocument(). - // But currently we always clear its parent and node below when adding it to the decl table. - // If that changes for some reason moving between documents will be buggy. - // webarchive/adopt-attribute-styled-node-webarchive.html should catch any resulting crashes. - if (needToParse) - parseMappedAttribute(attr); - - if (entry == eNone) - recalcStyleIfNeededAfterAttributeChanged(attr); - - if (checkDecl && attr->mappedAttributeDeclaration()) { - // Add the decl to the table in the appropriate spot. - setMappedAttributeDecl(entry, attr, attr->mappedAttributeDeclaration()); - attr->mappedAttributeDeclaration()->setMappedState(entry, attr->name(), attr->value()); - } - - updateAfterAttributeChanged(attr); -} - -bool StyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - result = eNone; - if (attrName == styleAttr) - return !isSynchronizingStyleAttribute(); - return true; + Element::attributeChanged(attr); } void StyledElement::classAttributeChanged(const AtomicString& newClassString) @@ -210,11 +91,9 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString) dispatchSubtreeModifiedEvent(); } -void StyledElement::parseMappedAttribute(Attribute* attr) +void StyledElement::parseAttribute(Attribute* attr) { - if (isIdAttributeName(attr->name())) - idAttributeChanged(attr); - else if (attr->name() == classAttr) + if (attr->name() == classAttr) classAttributeChanged(attr->value()); else if (attr->name() == styleAttr) { if (attr->isNull()) @@ -226,40 +105,60 @@ void StyledElement::parseMappedAttribute(Attribute* attr) } } -void StyledElement::removeCSSProperty(Attribute* attribute, int id) +void StyledElement::removeCSSProperties(int id1, int id2, int id3, int id4, int id5, int id6, int id7, int id8) { - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); - attribute->mappedAttributeDeclaration()->removeMappedProperty(this, id); + StylePropertySet* style = attributeStyle(); + if (!style) + return; + + ASSERT(id1 != CSSPropertyInvalid); + style->removeProperty(id1); + + if (id2 == CSSPropertyInvalid) + return; + style->removeProperty(id2); + if (id3 == CSSPropertyInvalid) + return; + style->removeProperty(id3); + if (id4 == CSSPropertyInvalid) + return; + style->removeProperty(id4); + if (id5 == CSSPropertyInvalid) + return; + style->removeProperty(id5); + if (id6 == CSSPropertyInvalid) + return; + style->removeProperty(id6); + if (id7 == CSSPropertyInvalid) + return; + style->removeProperty(id7); + if (id8 == CSSPropertyInvalid) + return; + style->removeProperty(id8); } -void StyledElement::addCSSProperty(Attribute* attribute, int id, const String &value) +void StyledElement::addCSSProperty(int id, const String &value) { - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); - attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value); + if (!ensureAttributeStyle()->setProperty(id, value)) + removeCSSProperty(id); } -void StyledElement::addCSSProperty(Attribute* attribute, int id, int value) +void StyledElement::addCSSProperty(int propertyID, int identifier) { - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); - attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, value); + ensureAttributeStyle()->setProperty(CSSProperty(propertyID, document()->cssValuePool()->createIdentifierValue(identifier))); + setNeedsStyleRecalc(); } -void StyledElement::addCSSImageProperty(Attribute* attribute, int id, const String& url) +void StyledElement::addCSSImageProperty(int id, const String& url) { - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); - attribute->mappedAttributeDeclaration()->setMappedImageProperty(this, id, url); + ensureAttributeStyle()->setProperty(CSSProperty(id, CSSImageValue::create(url))); + setNeedsStyleRecalc(); } -void StyledElement::addCSSLength(Attribute* attribute, int id, const String &value) +void StyledElement::addCSSLength(int id, const String &value) { // FIXME: This function should not spin up the CSS parser, but should instead just figure out the correct // length unit and make the appropriate parsed value. - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); // strip attribute garbage.. StringImpl* v = value.impl(); @@ -282,12 +181,12 @@ void StyledElement::addCSSLength(Attribute* attribute, int id, const String &val } if (l != v->length()) { - attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, v->substring(0, l)); + addCSSProperty(id, v->substring(0, l)); return; } } - attribute->mappedAttributeDeclaration()->setMappedLengthProperty(this, id, value); + addCSSProperty(id, value); } static String parseColorStringWithCrazyLegacyRules(const String& colorString) @@ -343,57 +242,30 @@ static String parseColorStringWithCrazyLegacyRules(const String& colorString) } // Color parsing that matches HTML's "rules for parsing a legacy color value" -void StyledElement::addCSSColor(Attribute* attribute, int id, const String& attributeValue) +void StyledElement::addCSSColor(int id, const String& attributeValue) { // An empty string doesn't apply a color. (One containing only whitespace does, which is why this check occurs before stripping.) - if (attributeValue.isEmpty()) + if (attributeValue.isEmpty()) { + removeCSSProperty(id); return; + } String colorString = attributeValue.stripWhiteSpace(); // "transparent" doesn't apply a color either. - if (equalIgnoringCase(colorString, "transparent")) + if (equalIgnoringCase(colorString, "transparent")) { + removeCSSProperty(id); return; - - if (!attribute->mappedAttributeDeclaration()) - createMappedDecl(attribute); + } // If the string is a named CSS color or a 3/6-digit hex color, use that. Color parsedColor(colorString); if (parsedColor.isValid()) { - attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, colorString); + addCSSProperty(id, colorString); return; } - attribute->mappedAttributeDeclaration()->setMappedProperty(this, id, parseColorStringWithCrazyLegacyRules(colorString)); -} - -void StyledElement::createMappedDecl(Attribute* attr) -{ - RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create(); - attr->setMappedAttributeDeclaration(decl); - ASSERT(!decl->declaration()->useStrictParsing()); -} - -unsigned MappedAttributeHash::hash(const MappedAttributeKey& key) -{ - COMPILE_ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8, key_name_size); - COMPILE_ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8, key_value_size); - - StringHasher hasher; - const UChar* data; - - data = reinterpret_cast<const UChar*>(&key.name); - hasher.addCharacters(data[0], data[1]); - if (sizeof(key.name) == 8) - hasher.addCharacters(data[2], data[3]); - - data = reinterpret_cast<const UChar*>(&key.value); - hasher.addCharacters(data[0], data[1]); - if (sizeof(key.value) == 8) - hasher.addCharacters(data[2], data[3]); - - return hasher.hash(); + addCSSProperty(id, parseColorStringWithCrazyLegacyRules(colorString)); } void StyledElement::copyNonAttributeProperties(const Element* sourceElement) @@ -405,7 +277,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement) if (!source->inlineStyleDecl()) return; - CSSMutableStyleDeclaration* inlineStyle = ensureInlineStyleDecl(); + StylePropertySet* inlineStyle = ensureInlineStyleDecl(); inlineStyle->copyPropertiesFrom(*source->inlineStyleDecl()); inlineStyle->setStrictParsing(source->inlineStyleDecl()->useStrictParsing()); @@ -417,7 +289,7 @@ void StyledElement::copyNonAttributeProperties(const Element* sourceElement) void StyledElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const { - if (CSSMutableStyleDeclaration* inlineStyle = inlineStyleDecl()) + if (StylePropertySet* inlineStyle = inlineStyleDecl()) inlineStyle->addSubresourceStyleURLs(urls); } diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index d61f0afaf..2a6d392cf 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -25,48 +25,36 @@ #ifndef StyledElement_h #define StyledElement_h -#include "CSSMutableStyleDeclaration.h" #include "Element.h" -#include "MappedAttributeEntry.h" +#include "StylePropertySet.h" namespace WebCore { class Attribute; -class CSSMappedAttributeDeclaration; class StyledElement : public Element { public: virtual ~StyledElement(); - size_t mappedAttributeCount() const { return attributeMap() ? attributeMap()->mappedAttributeCount() : 0; } - bool isMappedAttribute(const QualifiedName& name) const { MappedAttributeEntry res = eNone; mapToEntry(name, res); return res != eNone; } + void addCSSLength(int id, const String& value); + void addCSSProperty(int id, const String& value); + void addCSSProperty(int id, int value); + void addCSSImageProperty(int propertyID, const String& url); + void addCSSColor(int id, const String& color); + void removeCSSProperties(int id1, int id2 = CSSPropertyInvalid, int id3 = CSSPropertyInvalid, int id4 = CSSPropertyInvalid, int id5 = CSSPropertyInvalid, int id6 = CSSPropertyInvalid, int id7 = CSSPropertyInvalid, int id8 = CSSPropertyInvalid); + void removeCSSProperty(int id) { removeCSSProperties(id); } - void addCSSLength(Attribute*, int id, const String& value); - void addCSSProperty(Attribute*, int id, const String& value); - void addCSSProperty(Attribute*, int id, int value); - void addCSSImageProperty(Attribute*, int propertyID, const String& url); - void addCSSColor(Attribute*, int id, const String& color); - void removeCSSProperty(Attribute*, int id); - - static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); - static void setMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value, CSSMappedAttributeDeclaration*); - static void removeMappedAttributeDecl(MappedAttributeEntry, const QualifiedName& name, const AtomicString& value); - - static CSSMappedAttributeDeclaration* getMappedAttributeDecl(MappedAttributeEntry, Attribute*); - static void setMappedAttributeDecl(MappedAttributeEntry, Attribute*, CSSMappedAttributeDeclaration*); - - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() { return 0; } + virtual StylePropertySet* additionalAttributeStyle() { return 0; } void invalidateStyleAttribute(); - CSSMutableStyleDeclaration* inlineStyleDecl() const { return attributeMap() ? attributeMap()->inlineStyleDecl() : 0; } - CSSMutableStyleDeclaration* ensureInlineStyleDecl() { return ensureAttributeMap()->ensureInlineStyleDecl(); } - virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl(); } + StylePropertySet* inlineStyleDecl() const { return attributeData() ? attributeData()->inlineStyleDecl() : 0; } + StylePropertySet* ensureInlineStyleDecl() { return ensureAttributeDataWithoutUpdate()->ensureInlineStyleDecl(this); } + virtual CSSStyleDeclaration* style() OVERRIDE { return ensureInlineStyleDecl()->ensureCSSStyleDeclaration(); } - const SpaceSplitString& classNames() const; + StylePropertySet* attributeStyle() const { return attributeData() ? attributeData()->attributeStyle() : 0; } + StylePropertySet* ensureAttributeStyle() { return ensureAttributeDataWithoutUpdate()->ensureAttributeStyle(this); } - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - - virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value); + const SpaceSplitString& classNames() const; protected: StyledElement(const QualifiedName& name, Document* document, ConstructionType type) @@ -74,26 +62,24 @@ protected: { } - virtual void attributeChanged(Attribute*, bool preserveDecls = false); - virtual void parseMappedAttribute(Attribute*); + virtual void attributeChanged(Attribute*) OVERRIDE; + virtual void parseAttribute(Attribute*); virtual void copyNonAttributeProperties(const Element*); virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; // classAttributeChanged() exists to share code between - // parseMappedAttribute (called via setAttribute()) and + // parseAttribute (called via setAttribute()) and // svgAttributeChanged (called when element.className.baseValue is set) void classAttributeChanged(const AtomicString& newClassString); private: - void createMappedDecl(Attribute*); - virtual void updateStyleAttribute() const; void destroyInlineStyleDecl() { - if (attributeMap()) - attributeMap()->destroyInlineStyleDecl(); + if (attributeData()) + attributeData()->destroyInlineStyleDecl(); } }; diff --git a/Source/WebCore/dom/TouchList.idl b/Source/WebCore/dom/TouchList.idl index ede7bf2e5..542325c78 100644 --- a/Source/WebCore/dom/TouchList.idl +++ b/Source/WebCore/dom/TouchList.idl @@ -27,7 +27,7 @@ module events { interface [ Conditional=TOUCH_EVENTS, - HasIndexGetter + IndexedGetter ] TouchList { readonly attribute unsigned long length; diff --git a/Source/WebCore/dom/TreeWalker.idl b/Source/WebCore/dom/TreeWalker.idl index 890e3159a..d9ed36eab 100644 --- a/Source/WebCore/dom/TreeWalker.idl +++ b/Source/WebCore/dom/TreeWalker.idl @@ -22,7 +22,7 @@ module traversal { // Introduced in DOM Level 2: interface [ - CustomMarkFunction + JSCustomMarkFunction ] TreeWalker { readonly attribute Node root; readonly attribute unsigned long whatToShow; diff --git a/Source/WebCore/dom/UIEvent.idl b/Source/WebCore/dom/UIEvent.idl index 48b65298d..83dcdc95a 100644 --- a/Source/WebCore/dom/UIEvent.idl +++ b/Source/WebCore/dom/UIEvent.idl @@ -24,7 +24,7 @@ module events { readonly attribute DOMWindow view; readonly attribute long detail; - [OldStyleObjC] void initUIEvent(in [Optional=CallWithDefaultValue] DOMString type, + [ObjCLegacyUnnamedParameters] void initUIEvent(in [Optional=CallWithDefaultValue] DOMString type, in [Optional=CallWithDefaultValue] boolean canBubble, in [Optional=CallWithDefaultValue] boolean cancelable, in [Optional=CallWithDefaultValue] DOMWindow view, diff --git a/Source/WebCore/dom/WebKitAnimationEvent.idl b/Source/WebCore/dom/WebKitAnimationEvent.idl index fab8c095a..5e52250c3 100644 --- a/Source/WebCore/dom/WebKitAnimationEvent.idl +++ b/Source/WebCore/dom/WebKitAnimationEvent.idl @@ -28,8 +28,8 @@ module events { interface [ ConstructorTemplate=Event ] WebKitAnimationEvent : Event { - readonly attribute [InitializedByConstructor] DOMString animationName; - readonly attribute [InitializedByConstructor] double elapsedTime; + readonly attribute [InitializedByEventConstructor] DOMString animationName; + readonly attribute [InitializedByEventConstructor] double elapsedTime; }; } diff --git a/Source/WebCore/dom/WebKitMutationObserver.cpp b/Source/WebCore/dom/WebKitMutationObserver.cpp index a7eb1a174..60153627c 100644 --- a/Source/WebCore/dom/WebKitMutationObserver.cpp +++ b/Source/WebCore/dom/WebKitMutationObserver.cpp @@ -41,6 +41,7 @@ #include "MutationRecord.h" #include "Node.h" #include <wtf/ListHashSet.h> +#include <wtf/MainThread.h> namespace WebCore { @@ -115,6 +116,7 @@ static MutationObserverSet& activeMutationObservers() void WebKitMutationObserver::enqueueMutationRecord(PassRefPtr<MutationRecord> mutation) { + ASSERT(isMainThread()); m_records.append(mutation); activeMutationObservers().add(this); } @@ -132,6 +134,7 @@ void WebKitMutationObserver::deliver() void WebKitMutationObserver::deliverAllMutations() { + ASSERT(isMainThread()); static bool deliveryInProgress = false; if (deliveryInProgress) return; diff --git a/Source/WebCore/dom/WebKitNamedFlow.idl b/Source/WebCore/dom/WebKitNamedFlow.idl index 2eb9e7f26..06d85529e 100644 --- a/Source/WebCore/dom/WebKitNamedFlow.idl +++ b/Source/WebCore/dom/WebKitNamedFlow.idl @@ -29,7 +29,7 @@ module core { interface [ - GenerateToJS + JSGenerateToJS ] WebKitNamedFlow { }; } diff --git a/Source/WebCore/dom/WebKitTransitionEvent.idl b/Source/WebCore/dom/WebKitTransitionEvent.idl index 9f024d645..39903bdf2 100644 --- a/Source/WebCore/dom/WebKitTransitionEvent.idl +++ b/Source/WebCore/dom/WebKitTransitionEvent.idl @@ -28,8 +28,8 @@ module events { interface [ ConstructorTemplate=Event ] WebKitTransitionEvent : Event { - readonly attribute [InitializedByConstructor] DOMString propertyName; - readonly attribute [InitializedByConstructor] double elapsedTime; + readonly attribute [InitializedByEventConstructor] DOMString propertyName; + readonly attribute [InitializedByEventConstructor] double elapsedTime; }; } diff --git a/Source/WebCore/dom/make_event_factory.pl b/Source/WebCore/dom/make_event_factory.pl index db6a9343d..8ca45407d 100644 --- a/Source/WebCore/dom/make_event_factory.pl +++ b/Source/WebCore/dom/make_event_factory.pl @@ -42,7 +42,8 @@ sub defaultItemFactory { return ( 'interfaceName' => 0, - 'conditional' => 0 + 'conditional' => 0, + 'runtimeConditional' => 0 ); } @@ -85,6 +86,9 @@ sub generateImplementation() print F "#include \"${namespace}Factory.h\"\n"; print F "\n"; print F "#include \"${namespace}Headers.h\"\n"; + print F "#if USE(V8)\n"; + print F "#include \"RuntimeEnabledFeatures.h\"\n"; + print F "#endif\n"; print F "\n"; print F "namespace WebCore {\n"; print F "\n"; @@ -93,11 +97,20 @@ sub generateImplementation() for my $eventName (sort keys %parsedEvents) { my $conditional = $parsedEvents{$eventName}{"conditional"}; + my $runtimeConditional = $parsedEvents{$eventName}{"runtimeConditional"}; my $interfaceName = $InCompiler->interfaceForItem($eventName); print F "#if ENABLE($conditional)\n" if $conditional; + if ($runtimeConditional) { + print F " #if USE(V8)\n"; + print F " // FIXME: JSC should support RuntimeEnabledFeatures as well.\n"; + print F " if (type == \"$eventName\" && RuntimeEnabledFeatures::$runtimeConditional())\n"; + print F " return ${interfaceName}::create();\n"; + print F " #else\n"; + } print F " if (type == \"$eventName\")\n"; print F " return ${interfaceName}::create();\n"; + print F "#endif // USE(V8)\n" if $runtimeConditional; print F "#endif\n" if $conditional; } diff --git a/Source/WebCore/editing/ApplyStyleCommand.cpp b/Source/WebCore/editing/ApplyStyleCommand.cpp index 43820c4c2..1adde10cf 100644 --- a/Source/WebCore/editing/ApplyStyleCommand.cpp +++ b/Source/WebCore/editing/ApplyStyleCommand.cpp @@ -27,7 +27,6 @@ #include "ApplyStyleCommand.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" @@ -45,6 +44,7 @@ #include "Range.h" #include "RenderObject.h" #include "RenderText.h" +#include "StylePropertySet.h" #include "Text.h" #include "TextIterator.h" #include "htmlediting.h" @@ -73,8 +73,7 @@ bool isLegacyAppleStyleSpan(const Node *node) enum ShouldStyleAttributeBeEmpty { AllowNonEmptyStyleAttribute, StyleAttributeShouldBeEmpty }; static bool hasNoAttributeOrOnlyStyleAttribute(const StyledElement* element, ShouldStyleAttributeBeEmpty shouldStyleAttributeBeEmpty) { - NamedNodeMap* map = element->updatedAttributes(); - if (!map || map->isEmpty()) + if (!element->hasAttributes()) return true; unsigned matchedAttributes = 0; @@ -84,8 +83,8 @@ static bool hasNoAttributeOrOnlyStyleAttribute(const StyledElement* element, Sho || !element->inlineStyleDecl() || element->inlineStyleDecl()->isEmpty())) matchedAttributes++; - ASSERT(matchedAttributes <= map->length()); - return matchedAttributes == map->length(); + ASSERT(matchedAttributes <= element->attributeCount()); + return matchedAttributes == element->attributeCount(); } bool isStyleSpanOrSpanWithOnlyStyleAttribute(const Element* element) @@ -108,10 +107,9 @@ static bool isEmptyFontTag(const Node *node) return false; const Element *elem = static_cast<const Element *>(node); - NamedNodeMap* map = elem->updatedAttributes(); - if (!map) + if (!elem->hasAttributes()) return true; - return map->isEmpty() || (map->length() == 1 && elem->getAttribute(classAttr) == styleSpanClassString()); + return elem->attributeCount() == 1 && elem->getAttribute(classAttr) == styleSpanClassString(); } static PassRefPtr<Element> createFontElement(Document* document) @@ -384,7 +382,7 @@ void ApplyStyleCommand::applyRelativeFontStyleChange(EditingStyle* style) } lastStyledNode = node; - CSSMutableStyleDeclaration* inlineStyleDecl = element->ensureInlineStyleDecl(); + StylePropertySet* inlineStyleDecl = element->ensureInlineStyleDecl(); float currentFontSize = computedFontSize(node); float desiredFontSize = max(MinimumFontSize, startingFontSizes.get(node) + style->fontSizeDelta()); RefPtr<CSSValue> value = inlineStyleDecl->getPropertyCSSValue(CSSPropertyFontSize); @@ -511,7 +509,7 @@ void ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock(Node* node, Node* unsp // other attributes, like we (should) do with B and I elements. removeNodeAttribute(element, dirAttr); } else { - RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy(); + RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy(); inlineStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); inlineStyle->removeProperty(CSSPropertyDirection); setNodeAttribute(element, styleAttr, inlineStyle->asText()); @@ -725,7 +723,7 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, Node* n break; // Add to this element's inline style and skip over its contents. HTMLElement* element = toHTMLElement(node); - RefPtr<CSSMutableStyleDeclaration> inlineStyle = element->ensureInlineStyleDecl()->copy(); + RefPtr<StylePropertySet> inlineStyle = element->ensureInlineStyleDecl()->copy(); inlineStyle->merge(style->style()); setNodeAttribute(element, styleAttr, inlineStyle->asText()); next = node->traverseNextSibling(); @@ -890,7 +888,7 @@ bool ApplyStyleCommand::removeCSSStyle(EditingStyle* style, HTMLElement* element if (!style->conflictsWithInlineStyleOfElement(element, extractedStyle, properties)) return false; - CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl(); + StylePropertySet* inlineStyle = element->inlineStyleDecl(); ASSERT(inlineStyle); // FIXME: We should use a mass-removal function here but we don't have an undoable one yet. for (size_t i = 0; i < properties.size(); i++) @@ -1310,7 +1308,7 @@ void ApplyStyleCommand::addBlockStyle(const StyleChange& styleChange, HTMLElemen return; String cssText = styleChange.cssStyle(); - if (CSSMutableStyleDeclaration* decl = block->inlineStyleDecl()) + if (StylePropertySet* decl = block->inlineStyleDecl()) cssText += decl->asText(); setNodeAttribute(block, styleAttr, cssText); } @@ -1375,7 +1373,7 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, PassRefPtr<N if (styleChange.cssStyle().length()) { if (styleContainer) { - if (CSSMutableStyleDeclaration* existingStyle = styleContainer->inlineStyleDecl()) + if (StylePropertySet* existingStyle = styleContainer->inlineStyleDecl()) setNodeAttribute(styleContainer, styleAttr, existingStyle->asText() + styleChange.cssStyle()); else setNodeAttribute(styleContainer, styleAttr, styleChange.cssStyle()); diff --git a/Source/WebCore/editing/DeleteButtonController.cpp b/Source/WebCore/editing/DeleteButtonController.cpp index 870a67855..2a3005ea6 100644 --- a/Source/WebCore/editing/DeleteButtonController.cpp +++ b/Source/WebCore/editing/DeleteButtonController.cpp @@ -27,7 +27,6 @@ #include "DeleteButtonController.h" #include "CachedImage.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" @@ -46,6 +45,7 @@ #include "Range.h" #include "RemoveNodeCommand.h" #include "RenderBox.h" +#include "StylePropertySet.h" namespace WebCore { @@ -205,7 +205,7 @@ void DeleteButtonController::createDeletionUI() RefPtr<HTMLDivElement> container = HTMLDivElement::create(m_target->document()); container->setIdAttribute(containerElementIdentifier); - CSSMutableStyleDeclaration* style = container->ensureInlineStyleDecl(); + StylePropertySet* style = container->ensureInlineStyleDecl(); style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone); style->setProperty(CSSPropertyWebkitUserSelect, CSSValueNone); style->setProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly); diff --git a/Source/WebCore/editing/EditingStyle.cpp b/Source/WebCore/editing/EditingStyle.cpp index 7e5441d3b..98224f243 100644 --- a/Source/WebCore/editing/EditingStyle.cpp +++ b/Source/WebCore/editing/EditingStyle.cpp @@ -29,7 +29,6 @@ #include "ApplyStyleCommand.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSStyleRule.h" #include "CSSStyleSelector.h" @@ -44,6 +43,7 @@ #include "Position.h" #include "QualifiedName.h" #include "RenderStyle.h" +#include "StylePropertySet.h" #include "StyledElement.h" #include "htmlediting.h" #include "visible_units.h" @@ -83,7 +83,7 @@ static const int editingProperties[] = { enum EditingPropertiesType { OnlyInheritableEditingProperties, AllEditingProperties }; template <class StyleDeclarationType> -static PassRefPtr<CSSMutableStyleDeclaration> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties) +static PassRefPtr<StylePropertySet> copyEditingProperties(StyleDeclarationType* style, EditingPropertiesType type = OnlyInheritableEditingProperties) { if (type == AllEditingProperties) return style->copyPropertiesInSet(editingProperties, WTF_ARRAY_LENGTH(editingProperties)); @@ -99,17 +99,19 @@ static inline bool isEditingProperty(int id) return false; } -static PassRefPtr<CSSMutableStyleDeclaration> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties) +static PassRefPtr<StylePropertySet> editingStyleFromComputedStyle(PassRefPtr<CSSComputedStyleDeclaration> style, EditingPropertiesType type = OnlyInheritableEditingProperties) { if (!style) - return CSSMutableStyleDeclaration::create(); + return StylePropertySet::create(); return copyEditingProperties(style.get(), type); } -static RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); +static PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelValuesMatch }; static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode); +static bool isTransparentColorValue(CSSValue*); static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); +static bool hasTransparentBackgroundColor(StylePropertySet*); static PassRefPtr<CSSValue> backgroundColorInEffect(Node*); class HTMLElementEquivalent { @@ -122,8 +124,8 @@ public: virtual ~HTMLElementEquivalent() { } virtual bool matches(const Element* element) const { return !m_tagName || element->hasTagName(*m_tagName); } virtual bool hasAttribute() const { return false; } - virtual bool propertyExistsInStyle(CSSMutableStyleDeclaration* style) const { return style && style->getPropertyCSSValue(m_propertyID); } - virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const; + virtual bool propertyExistsInStyle(StylePropertySet* style) const { return style && style->getPropertyCSSValue(m_propertyID); } + virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; virtual void addToStyle(Element*, EditingStyle*) const; protected: @@ -155,7 +157,7 @@ HTMLElementEquivalent::HTMLElementEquivalent(CSSPropertyID id, int primitiveValu ASSERT(primitiveValue != CSSValueInvalid); } -bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const +bool HTMLElementEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const { RefPtr<CSSValue> value = style->getPropertyCSSValue(m_propertyID); return matches(element) && value && value->isPrimitiveValue() && static_cast<CSSPrimitiveValue*>(value.get())->getIdent() == m_primitiveValue->getIdent(); @@ -172,8 +174,8 @@ public: { return adoptPtr(new HTMLTextDecorationEquivalent(primitiveValue, tagName)); } - virtual bool propertyExistsInStyle(CSSMutableStyleDeclaration*) const; - virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const; + virtual bool propertyExistsInStyle(StylePropertySet*) const; + virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; private: HTMLTextDecorationEquivalent(int primitiveValue, const QualifiedName& tagName); @@ -185,12 +187,12 @@ HTMLTextDecorationEquivalent::HTMLTextDecorationEquivalent(int primitiveValue, c { } -bool HTMLTextDecorationEquivalent::propertyExistsInStyle(CSSMutableStyleDeclaration* style) const +bool HTMLTextDecorationEquivalent::propertyExistsInStyle(StylePropertySet* style) const { return style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect) || style->getPropertyCSSValue(CSSPropertyTextDecoration); } -bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const +bool HTMLTextDecorationEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const { RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); if (!styleValue) @@ -211,7 +213,7 @@ public: bool matches(const Element* elem) const { return HTMLElementEquivalent::matches(elem) && elem->hasAttribute(m_attrName); } virtual bool hasAttribute() const { return true; } - virtual bool valueIsPresentInStyle(Element*, CSSMutableStyleDeclaration*) const; + virtual bool valueIsPresentInStyle(Element*, StylePropertySet*) const; virtual void addToStyle(Element*, EditingStyle*) const; virtual PassRefPtr<CSSValue> attributeValueAsCSSValue(Element*) const; inline const QualifiedName& attributeName() const { return m_attrName; } @@ -234,7 +236,7 @@ HTMLAttributeEquivalent::HTMLAttributeEquivalent(CSSPropertyID id, const Qualifi { } -bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, CSSMutableStyleDeclaration* style) const +bool HTMLAttributeEquivalent::valueIsPresentInStyle(Element* element, StylePropertySet* style) const { RefPtr<CSSValue> value = attributeValueAsCSSValue(element); RefPtr<CSSValue> styleValue = style->getPropertyCSSValue(m_propertyID); @@ -256,8 +258,8 @@ PassRefPtr<CSSValue> HTMLAttributeEquivalent::attributeValueAsCSSValue(Element* if (!element->hasAttribute(m_attrName)) return 0; - RefPtr<CSSMutableStyleDeclaration> dummyStyle; - dummyStyle = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> dummyStyle; + dummyStyle = StylePropertySet::create(); dummyStyle->setProperty(m_propertyID, element->getAttribute(m_attrName)); return dummyStyle->getPropertyCSSValue(m_propertyID); } @@ -312,6 +314,14 @@ EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert init(position.deprecatedNode(), propertiesToInclude); } +EditingStyle::EditingStyle(const StylePropertySet* style) + : m_mutableStyle(style ? style->copy() : 0) + , m_shouldUseFixedDefaultFontSize(false) + , m_fontSizeDelta(NoFontDelta) +{ + extractFontSizeDelta(); +} + EditingStyle::EditingStyle(const CSSStyleDeclaration* style) : m_mutableStyle(style ? style->copy() : 0) , m_shouldUseFixedDefaultFontSize(false) @@ -351,6 +361,11 @@ static inline RGBA32 getRGBAFontColor(CSSStyleDeclaration* style) return cssValueToRGBA(style->getPropertyCSSValueInternal(CSSPropertyColor).get()); } +static inline RGBA32 getRGBAFontColor(StylePropertySet* style) +{ + return cssValueToRGBA(style->getPropertyCSSValue(CSSPropertyColor).get()); +} + static inline RGBA32 rgbaBackgroundColorInEffect(Node* node) { return cssValueToRGBA(backgroundColorInEffect(node).get()); @@ -397,7 +412,7 @@ void EditingStyle::removeTextFillAndStrokeColorsIfNeeded(RenderStyle* renderStyl void EditingStyle::setProperty(int propertyID, const String& value, bool important) { if (!m_mutableStyle) - m_mutableStyle = CSSMutableStyleDeclaration::create(); + m_mutableStyle = StylePropertySet::create(); m_mutableStyle->setProperty(propertyID, value, important); } @@ -469,7 +484,7 @@ bool EditingStyle::textDirection(WritingDirection& writingDirection) const return false; } -void EditingStyle::setStyle(PassRefPtr<CSSMutableStyleDeclaration> style) +void EditingStyle::setStyle(PassRefPtr<StylePropertySet> style) { m_mutableStyle = style; // FIXME: We should be able to figure out whether or not font is fixed width for mutable style. @@ -478,12 +493,12 @@ void EditingStyle::setStyle(PassRefPtr<CSSMutableStyleDeclaration> style) extractFontSizeDelta(); } -void EditingStyle::overrideWithStyle(const CSSMutableStyleDeclaration* style) +void EditingStyle::overrideWithStyle(const StylePropertySet* style) { if (!style || style->isEmpty()) return; if (!m_mutableStyle) - m_mutableStyle = CSSMutableStyleDeclaration::create(); + m_mutableStyle = StylePropertySet::create(); m_mutableStyle->merge(style); extractFontSizeDelta(); } @@ -520,7 +535,7 @@ PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveBlockProperties() PassRefPtr<EditingStyle> EditingStyle::extractAndRemoveTextDirection() { RefPtr<EditingStyle> textDirection = EditingStyle::create(); - textDirection->m_mutableStyle = CSSMutableStyleDeclaration::create(); + textDirection->m_mutableStyle = StylePropertySet::create(); textDirection->m_mutableStyle->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed, m_mutableStyle->propertyIsImportant(CSSPropertyUnicodeBidi)); textDirection->m_mutableStyle->setProperty(CSSPropertyDirection, m_mutableStyle->getPropertyValue(CSSPropertyDirection), m_mutableStyle->propertyIsImportant(CSSPropertyDirection)); @@ -543,10 +558,10 @@ void EditingStyle::removeStyleAddedByNode(Node* node) { if (!node || !node->parentNode()) return; - RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); - RefPtr<CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); - nodeStyle->removeEquivalentProperties(parentStyle.get()); - m_mutableStyle->removeEquivalentProperties(nodeStyle.get()); + RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); + RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); + nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration()); + m_mutableStyle->removeEquivalentProperties(nodeStyle->ensureCSSStyleDeclaration()); } void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node) @@ -554,9 +569,9 @@ void EditingStyle::removeStyleConflictingWithStyleOfNode(Node* node) if (!node || !node->parentNode() || !m_mutableStyle) return; - RefPtr<CSSMutableStyleDeclaration> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); - RefPtr<CSSMutableStyleDeclaration> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); - nodeStyle->removeEquivalentProperties(parentStyle.get()); + RefPtr<StylePropertySet> parentStyle = editingStyleFromComputedStyle(computedStyle(node->parentNode()), AllEditingProperties); + RefPtr<StylePropertySet> nodeStyle = editingStyleFromComputedStyle(computedStyle(node), AllEditingProperties); + nodeStyle->removeEquivalentProperties(parentStyle->ensureCSSStyleDeclaration()); unsigned propertyCount = nodeStyle->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) @@ -598,12 +613,12 @@ TriState EditingStyle::triStateOfStyle(EditingStyle* style) const { if (!style || !style->m_mutableStyle) return FalseTriState; - return triStateOfStyle(style->m_mutableStyle.get(), DoNotIgnoreTextOnlyProperties); + return triStateOfStyle(style->m_mutableStyle->ensureCSSStyleDeclaration(), DoNotIgnoreTextOnlyProperties); } TriState EditingStyle::triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties shouldIgnoreTextOnlyProperties) const { - RefPtr<CSSMutableStyleDeclaration> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare); + RefPtr<StylePropertySet> difference = getPropertiesNotIn(m_mutableStyle.get(), styleToCompare); if (shouldIgnoreTextOnlyProperties == IgnoreTextOnlyProperties) difference->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(textOnlyProperties)); @@ -648,7 +663,7 @@ bool EditingStyle::conflictsWithInlineStyleOfElement(StyledElement* element, Edi ASSERT(element); ASSERT(!conflictingProperties || conflictingProperties->isEmpty()); - CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl(); + StylePropertySet* inlineStyle = element->inlineStyleDecl(); if (!m_mutableStyle || !inlineStyle) return false; @@ -817,8 +832,7 @@ bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen } } - const NamedNodeMap* attributeMap = element->attributeMap(); - if (!attributeMap || attributeMap->isEmpty()) + if (!element->hasAttributes()) return elementIsSpanOrElementEquivalent; // span, b, etc... without any attributes unsigned matchedAttributes = 0; @@ -835,7 +849,7 @@ bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen matchedAttributes++; if (element->hasAttribute(HTMLNames::styleAttr)) { - if (CSSMutableStyleDeclaration* style = element->inlineStyleDecl()) { + if (StylePropertySet* style = element->inlineStyleDecl()) { unsigned propertyCount = style->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { if (!isEditingProperty(style->propertyAt(i).id())) @@ -846,8 +860,8 @@ bool EditingStyle::elementIsStyledSpanOrHTMLEquivalent(const HTMLElement* elemen } // font with color attribute, span with style attribute, etc... - ASSERT(matchedAttributes <= attributeMap->length()); - return matchedAttributes >= attributeMap->length(); + ASSERT(matchedAttributes <= element->attributeCount()); + return matchedAttributes >= element->attributeCount(); } void EditingStyle::prepareToApplyAt(const Position& position, ShouldPreserveWritingDirection shouldPreserveWritingDirection) @@ -914,7 +928,7 @@ void EditingStyle::mergeInlineStyleOfElement(StyledElement* element, CSSProperty } static inline bool elementMatchesAndPropertyIsNotInInlineStyleDecl(const HTMLElementEquivalent* equivalent, const StyledElement* element, - EditingStyle::CSSPropertyOverrideMode mode, CSSMutableStyleDeclaration* style) + EditingStyle::CSSPropertyOverrideMode mode, StylePropertySet* style) { return equivalent->matches(element) && !equivalent->propertyExistsInStyle(element->inlineStyleDecl()) && (mode == EditingStyle::OverrideValues || !equivalent->propertyExistsInStyle(style)); @@ -982,7 +996,7 @@ static void mergeTextDecorationValues(CSSValueList* mergedValue, const CSSValueL mergedValue->append(lineThrough.get()); } -void EditingStyle::mergeStyle(CSSMutableStyleDeclaration* style, CSSPropertyOverrideMode mode) +void EditingStyle::mergeStyle(StylePropertySet* style, CSSPropertyOverrideMode mode) { if (!style) return; @@ -1011,14 +1025,14 @@ void EditingStyle::mergeStyle(CSSMutableStyleDeclaration* style, CSSPropertyOver } } -static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude) +static PassRefPtr<StylePropertySet> styleFromMatchedRulesForElement(Element* element, unsigned rulesToInclude) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); RefPtr<CSSRuleList> matchedRules = element->document()->styleSelector()->styleRulesForElement(element, rulesToInclude); if (matchedRules) { for (unsigned i = 0; i < matchedRules->length(); i++) { if (matchedRules->item(i)->type() == CSSRule::STYLE_RULE) { - RefPtr<CSSMutableStyleDeclaration> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration(); + RefPtr<StylePropertySet> s = static_cast<CSSStyleRule*>(matchedRules->item(i))->declaration(); style->merge(s.get(), true); } } @@ -1029,7 +1043,7 @@ static PassRefPtr<CSSMutableStyleDeclaration> styleFromMatchedRulesForElement(El void EditingStyle::mergeStyleFromRules(StyledElement* element) { - RefPtr<CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element, + RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AuthorCSSRules | CSSStyleSelector::CrossOriginCSSRules); // Styles from the inline style declaration, held in the variable "style", take precedence // over those from matched rules. @@ -1048,7 +1062,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element) // For example: style="height: 1%; overflow: visible;" in quirksmode // FIXME: There are others like this, see <rdar://problem/5195123> Slashdot copy/paste fidelity problem RefPtr<CSSComputedStyleDeclaration> computedStyleForElement = computedStyle(element); - RefPtr<CSSMutableStyleDeclaration> fromComputedStyle = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> fromComputedStyle = StylePropertySet::create(); { unsigned propertyCount = m_mutableStyle->propertyCount(); for (unsigned i = 0; i < propertyCount; ++i) { @@ -1065,7 +1079,7 @@ void EditingStyle::mergeStyleFromRulesForSerialization(StyledElement* element) m_mutableStyle->merge(fromComputedStyle.get()); } -static void removePropertiesInStyle(CSSMutableStyleDeclaration* styleToRemovePropertiesFrom, CSSMutableStyleDeclaration* style) +static void removePropertiesInStyle(StylePropertySet* styleToRemovePropertiesFrom, StylePropertySet* style) { unsigned propertyCount = style->propertyCount(); Vector<int> propertiesToRemove(propertyCount); @@ -1082,9 +1096,9 @@ void EditingStyle::removeStyleFromRulesAndContext(StyledElement* element, Node* return; // 1. Remove style from matched rules because style remain without repeating it in inline style declaration - RefPtr<CSSMutableStyleDeclaration> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules); + RefPtr<StylePropertySet> styleFromMatchedRules = styleFromMatchedRulesForElement(element, CSSStyleSelector::AllButEmptyCSSRules); if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) - m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules.get()); + m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), styleFromMatchedRules->ensureCSSStyleDeclaration()); // 2. Remove style present in context and not overriden by matched rules. RefPtr<EditingStyle> computedStyle = EditingStyle::create(context, EditingPropertiesInEffect); @@ -1093,7 +1107,7 @@ void EditingStyle::removeStyleFromRulesAndContext(StyledElement* element, Node* computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColor, CSSValueTransparent); removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMatchedRules.get()); - m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle.get()); + m_mutableStyle = getPropertiesNotIn(m_mutableStyle.get(), computedStyle->m_mutableStyle->ensureCSSStyleDeclaration()); } // 3. If this element is a span and has display: inline or float: none, remove them unless they are overriden by rules. @@ -1111,7 +1125,7 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) if (!m_mutableStyle || m_mutableStyle->isEmpty()) return; - RefPtr<CSSMutableStyleDeclaration> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules); + RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(element, CSSStyleSelector::UAAndUserCSSRules); removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); } @@ -1119,7 +1133,7 @@ void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) void EditingStyle::forceInline() { if (!m_mutableStyle) - m_mutableStyle = CSSMutableStyleDeclaration::create(); + m_mutableStyle = StylePropertySet::create(); const bool propertyIsImportant = true; m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsImportant); } @@ -1168,7 +1182,7 @@ PassRefPtr<EditingStyle> EditingStyle::styleAtSelectionStart(const VisibleSelect return style; } -static void reconcileTextDecorationProperties(CSSMutableStyleDeclaration* style) +static void reconcileTextDecorationProperties(StylePropertySet* style) { RefPtr<CSSValue> textDecorationsInEffect = style->getPropertyCSSValue(CSSPropertyWebkitTextDecorationsInEffect); RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(CSSPropertyTextDecoration); @@ -1199,7 +1213,7 @@ StyleChange::StyleChange(EditingStyle* style, const Position& position) RefPtr<CSSComputedStyleDeclaration> computedStyle = position.computedStyle(); // FIXME: take care of background-color in effect - RefPtr<CSSMutableStyleDeclaration> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get()); + RefPtr<StylePropertySet> mutableStyle = getPropertiesNotIn(style->style(), computedStyle.get()); reconcileTextDecorationProperties(mutableStyle.get()); if (!document->frame()->editor()->shouldStyleWithCSS()) @@ -1218,7 +1232,7 @@ StyleChange::StyleChange(EditingStyle* style, const Position& position) m_cssStyle = mutableStyle->asText().stripWhiteSpace(); } -static void setTextDecorationProperty(CSSMutableStyleDeclaration* style, const CSSValueList* newTextDecoration, int propertyID) +static void setTextDecorationProperty(StylePropertySet* style, const CSSValueList* newTextDecoration, int propertyID) { if (newTextDecoration->length()) style->setProperty(propertyID, newTextDecoration->cssText(), style->propertyIsImportant(propertyID)); @@ -1229,7 +1243,7 @@ static void setTextDecorationProperty(CSSMutableStyleDeclaration* style, const C } } -void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclaration* style, bool shouldUseFixedFontDefaultSize) +void StyleChange::extractTextStyles(Document* document, StylePropertySet* style, bool shouldUseFixedFontDefaultSize) { ASSERT(style); @@ -1292,7 +1306,7 @@ void StyleChange::extractTextStyles(Document* document, CSSMutableStyleDeclarati } } -static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID, CSSValue* refTextDecoration) +static void diffTextDecorations(StylePropertySet* style, int propertID, CSSValue* refTextDecoration) { RefPtr<CSSValue> textDecoration = style->getPropertyCSSValue(propertID); if (!textDecoration || !textDecoration->isValueList() || !refTextDecoration || !refTextDecoration->isValueList()) @@ -1307,11 +1321,8 @@ static void diffTextDecorations(CSSMutableStyleDeclaration* style, int propertID setTextDecorationProperty(style, newTextDecoration.get(), propertID); } -static bool fontWeightIsBold(CSSStyleDeclaration* style) +static bool fontWeightIsBold(CSSValue* fontWeight) { - ASSERT(style); - RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight); - if (!fontWeight) return false; if (!fontWeight->isPrimitiveValue()) @@ -1319,7 +1330,7 @@ static bool fontWeightIsBold(CSSStyleDeclaration* style) // Because b tag can only bold text, there are only two states in plain html: bold and not bold. // Collapse all other values to either one of these two states for editing purposes. - switch (static_cast<CSSPrimitiveValue*>(fontWeight.get())->getIdent()) { + switch (static_cast<CSSPrimitiveValue*>(fontWeight)->getIdent()) { case CSSValue100: case CSSValue200: case CSSValue300: @@ -1336,13 +1347,26 @@ static bool fontWeightIsBold(CSSStyleDeclaration* style) } ASSERT_NOT_REACHED(); // For CSSValueBolder and CSSValueLighter - return false; // Make compiler happy + return false; } -static int getTextAlignment(CSSStyleDeclaration* style) +static bool fontWeightIsBold(CSSStyleDeclaration* style) +{ + ASSERT(style); + RefPtr<CSSValue> fontWeight = style->getPropertyCSSValueInternal(CSSPropertyFontWeight); + return fontWeightIsBold(fontWeight.get()); +} + +static bool fontWeightIsBold(StylePropertySet* style) { - int textAlign = getIdentifierValue(style, CSSPropertyTextAlign); - switch (textAlign) { + ASSERT(style); + RefPtr<CSSValue> fontWeight = style->getPropertyCSSValue(CSSPropertyFontWeight); + return fontWeightIsBold(fontWeight.get()); +} + +static int getTextAlignment(int textAlignIdentifierValue) +{ + switch (textAlignIdentifierValue) { case CSSValueCenter: case CSSValueWebkitCenter: return CSSValueCenter; @@ -1358,11 +1382,21 @@ static int getTextAlignment(CSSStyleDeclaration* style) return CSSValueInvalid; } -RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) +static int getTextAlignment(CSSStyleDeclaration* style) +{ + return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign)); +} + +static int getTextAlignment(StylePropertySet* style) +{ + return getTextAlignment(getIdentifierValue(style, CSSPropertyTextAlign)); +} + +PassRefPtr<StylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle) { ASSERT(styleWithRedundantProperties); ASSERT(baseStyle); - RefPtr<CSSMutableStyleDeclaration> result = styleWithRedundantProperties->copy(); + RefPtr<StylePropertySet> result = styleWithRedundantProperties->copy(); result->removeEquivalentProperties(baseStyle); @@ -1382,15 +1416,23 @@ RefPtr<CSSMutableStyleDeclaration> getPropertiesNotIn(CSSStyleDeclaration* style return result; } -int getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID propertyID) +int getIdentifierValue(StylePropertySet* style, CSSPropertyID propertyID) { if (!style) return 0; + RefPtr<CSSValue> value = style->getPropertyCSSValue(propertyID); + if (!value || !value->isPrimitiveValue()) + return 0; + return static_cast<CSSPrimitiveValue*>(value.get())->getIdent(); +} +int getIdentifierValue(CSSStyleDeclaration* style, CSSPropertyID propertyID) +{ + if (!style) + return 0; RefPtr<CSSValue> value = style->getPropertyCSSValueInternal(propertyID); if (!value || !value->isPrimitiveValue()) return 0; - return static_cast<CSSPrimitiveValue*>(value.get())->getIdent(); } @@ -1418,22 +1460,30 @@ int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, boo return 0; } -bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) +bool isTransparentColorValue(CSSValue* cssValue) { - RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor); if (!cssValue) - return true; - + return true; if (!cssValue->isPrimitiveValue()) return false; - CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue.get()); - + CSSPrimitiveValue* value = static_cast<CSSPrimitiveValue*>(cssValue); if (value->isRGBColor()) - return !alphaChannel(value->getRGBA32Value()); - + return !alphaChannel(value->getRGBA32Value()); return value->getIdent() == CSSValueTransparent; } +bool hasTransparentBackgroundColor(CSSStyleDeclaration* style) +{ + RefPtr<CSSValue> cssValue = style->getPropertyCSSValueInternal(CSSPropertyBackgroundColor); + return isTransparentColorValue(cssValue.get()); +} + +bool hasTransparentBackgroundColor(StylePropertySet* style) +{ + RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(CSSPropertyBackgroundColor); + return isTransparentColorValue(cssValue.get()); +} + PassRefPtr<CSSValue> backgroundColorInEffect(Node* node) { for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { diff --git a/Source/WebCore/editing/EditingStyle.h b/Source/WebCore/editing/EditingStyle.h index b497dc992..6b60920c6 100644 --- a/Source/WebCore/editing/EditingStyle.h +++ b/Source/WebCore/editing/EditingStyle.h @@ -43,7 +43,6 @@ namespace WebCore { class CSSStyleDeclaration; class CSSComputedStyleDeclaration; -class CSSMutableStyleDeclaration; class CSSPrimitiveValue; class CSSValue; class Document; @@ -53,6 +52,7 @@ class Node; class Position; class QualifiedName; class RenderStyle; +class StylePropertySet; class StyledElement; class VisibleSelection; @@ -81,6 +81,11 @@ public: return adoptRef(new EditingStyle(position, propertiesToInclude)); } + static PassRefPtr<EditingStyle> create(const StylePropertySet* style) + { + return adoptRef(new EditingStyle(style)); + } + static PassRefPtr<EditingStyle> create(const CSSStyleDeclaration* style) { return adoptRef(new EditingStyle(style)); @@ -93,11 +98,11 @@ public: ~EditingStyle(); - CSSMutableStyleDeclaration* style() { return m_mutableStyle.get(); } + StylePropertySet* style() { return m_mutableStyle.get(); } bool textDirection(WritingDirection&) const; bool isEmpty() const; - void setStyle(PassRefPtr<CSSMutableStyleDeclaration>); - void overrideWithStyle(const CSSMutableStyleDeclaration*); + void setStyle(PassRefPtr<StylePropertySet>); + void overrideWithStyle(const StylePropertySet*); void clear(); PassRefPtr<EditingStyle> copy() const; PassRefPtr<EditingStyle> extractAndRemoveBlockProperties(); @@ -144,6 +149,7 @@ private: EditingStyle(); EditingStyle(Node*, PropertiesToInclude); EditingStyle(const Position&, PropertiesToInclude); + EditingStyle(const StylePropertySet*); EditingStyle(const CSSStyleDeclaration*); EditingStyle(int propertyID, const String& value); void init(Node*, PropertiesToInclude); @@ -154,9 +160,9 @@ private: TriState triStateOfStyle(CSSStyleDeclaration* styleToCompare, ShouldIgnoreTextOnlyProperties) const; bool conflictsWithInlineStyleOfElement(StyledElement*, EditingStyle* extractedStyle, Vector<CSSPropertyID>* conflictingProperties) const; void mergeInlineAndImplicitStyleOfElement(StyledElement*, CSSPropertyOverrideMode, PropertiesToInclude); - void mergeStyle(CSSMutableStyleDeclaration*, CSSPropertyOverrideMode); + void mergeStyle(StylePropertySet*, CSSPropertyOverrideMode); - RefPtr<CSSMutableStyleDeclaration> m_mutableStyle; + RefPtr<StylePropertySet> m_mutableStyle; bool m_shouldUseFixedDefaultFontSize; float m_fontSizeDelta; @@ -201,7 +207,7 @@ public: return !(*this == other); } private: - void extractTextStyles(Document*, CSSMutableStyleDeclaration*, bool shouldUseFixedFontDefaultSize); + void extractTextStyles(Document*, StylePropertySet*, bool shouldUseFixedFontDefaultSize); String m_cssStyle; bool m_applyBold; @@ -217,6 +223,7 @@ private: // FIXME: Remove these functions or make them non-global to discourage using CSSStyleDeclaration directly. int getIdentifierValue(CSSStyleDeclaration*, CSSPropertyID); +int getIdentifierValue(StylePropertySet*, CSSPropertyID); } // namespace WebCore diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp index 72ce5b81b..97b153365 100644 --- a/Source/WebCore/editing/Editor.cpp +++ b/Source/WebCore/editing/Editor.cpp @@ -30,7 +30,6 @@ #include "AXObjectCache.h" #include "ApplyStyleCommand.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" #include "CSSStyleSelector.h" @@ -78,6 +77,7 @@ #include "Sound.h" #include "SpellChecker.h" #include "SpellingCorrectionCommand.h" +#include "StylePropertySet.h" #include "Text.h" #include "TextCheckerClient.h" #include "TextCheckingHelper.h" @@ -1346,9 +1346,9 @@ void Editor::setBaseWritingDirection(WritingDirection direction) return; } - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyDirection, direction == LeftToRightWritingDirection ? "ltr" : direction == RightToLeftWritingDirection ? "rtl" : "inherit", false); - applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection); + applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); } void Editor::selectComposition() @@ -2090,7 +2090,7 @@ void Editor::markAndReplaceFor(PassRefPtr<SpellCheckRequest> request, const Vect RefPtr<Range> misspellingRange = paragraph.subrange(resultLocation, resultLength); if (!m_spellingCorrector->isSpellingMarkerAllowed(misspellingRange)) continue; - misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling); + misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling, result->replacement); } else if (shouldMarkGrammar && result->type == TextCheckingTypeGrammar && paragraph.checkingRangeCovers(resultLocation, resultLength)) { ASSERT(resultLength > 0 && resultLocation >= 0); for (unsigned j = 0; j < result->details.size(); j++) { @@ -2318,7 +2318,7 @@ void Editor::deletedAutocorrectionAtPosition(const Position& position, const Str m_spellingCorrector->deletedAutocorrectionAtPosition(position, originalString); } -PassRefPtr<Range> Editor::rangeForPoint(const LayoutPoint& windowPoint) +PassRefPtr<Range> Editor::rangeForPoint(const IntPoint& windowPoint) { Document* document = m_frame->documentAtPoint(windowPoint); if (!document) @@ -2633,7 +2633,7 @@ String Editor::selectedText() const IntRect Editor::firstRectForRange(Range* range) const { - int extraWidthToEndOfLine = 0; + LayoutUnit extraWidthToEndOfLine = 0; ASSERT(range->startContainer()); ASSERT(range->endContainer()); @@ -2745,7 +2745,7 @@ void Editor::applyEditingStyleToElement(Element* element) const ASSERT(element->isStyledElement()); if (!element->isStyledElement()) return; - CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); + StylePropertySet* style = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); style->setProperty(CSSPropertyWordWrap, "break-word", false); style->setProperty(CSSPropertyWebkitNbspMode, "space", false); style->setProperty(CSSPropertyWebkitLineBreak, "after-white-space", false); diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp index 74d70dbaf..a2ad63372 100644 --- a/Source/WebCore/editing/EditorCommand.cpp +++ b/Source/WebCore/editing/EditorCommand.cpp @@ -29,7 +29,6 @@ #include "Editor.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" #include "CSSValueList.h" @@ -55,6 +54,7 @@ #include "Scrollbar.h" #include "Settings.h" #include "Sound.h" +#include "StylePropertySet.h" #include "TypingCommand.h" #include "UnlinkCommand.h" #include "UserTypingGestureIndicator.h" @@ -98,16 +98,16 @@ static Frame* targetFrame(Frame* frame, Event* event) return node->document()->frame(); } -static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, CSSMutableStyleDeclaration* style) +static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAction action, StylePropertySet* style) { // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that? switch (source) { case CommandFromMenuOrKeyBinding: - frame->editor()->applyStyleToSelection(style, action); + frame->editor()->applyStyleToSelection(style->ensureCSSStyleDeclaration(), action); return true; case CommandFromDOM: case CommandFromDOMWithUserInterface: - frame->editor()->applyStyle(style); + frame->editor()->applyStyle(style->ensureCSSStyleDeclaration()); return true; } ASSERT_NOT_REACHED(); @@ -116,14 +116,14 @@ static bool applyCommandToFrame(Frame* frame, EditorCommandSource source, EditAc static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(propertyID, propertyValue); return applyCommandToFrame(frame, source, action, style.get()); } static bool executeApplyStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, int propertyValue) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(propertyID, propertyValue); return applyCommandToFrame(frame, source, action, style.get()); } @@ -151,7 +151,7 @@ static bool executeToggleStyleInList(Frame* frame, EditorCommandSource source, E newStyle = value->cssText(); // FIXME: We shouldn't be having to convert new style into text. We should have setPropertyCSSValue. - RefPtr<CSSMutableStyleDeclaration> newMutableStyle = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> newMutableStyle = StylePropertySet::create(); newMutableStyle->setProperty(propertyID, newStyle, ec); return applyCommandToFrame(frame, source, action, newMutableStyle.get()); } @@ -174,16 +174,16 @@ static bool executeToggleStyle(Frame* frame, EditorCommandSource source, EditAct static bool executeApplyParagraphStyle(Frame* frame, EditorCommandSource source, EditAction action, int propertyID, const String& propertyValue) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(propertyID, propertyValue); // FIXME: We don't call shouldApplyStyle when the source is DOM; is there a good reason for that? switch (source) { case CommandFromMenuOrKeyBinding: - frame->editor()->applyParagraphStyleToSelection(style.get(), action); + frame->editor()->applyParagraphStyleToSelection(style->ensureCSSStyleDeclaration(), action); return true; case CommandFromDOM: case CommandFromDOMWithUserInterface: - frame->editor()->applyParagraphStyle(style.get()); + frame->editor()->applyParagraphStyle(style->ensureCSSStyleDeclaration()); return true; } ASSERT_NOT_REACHED(); @@ -580,27 +580,27 @@ static bool executeJustifyRight(Frame* frame, Event*, EditorCommandSource source static bool executeMakeTextWritingDirectionLeftToRight(Frame* frame, Event*, EditorCommandSource, const String&) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); style->setProperty(CSSPropertyDirection, CSSValueLtr); - frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection); + frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); return true; } static bool executeMakeTextWritingDirectionNatural(Frame* frame, Event*, EditorCommandSource, const String&) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyUnicodeBidi, CSSValueNormal); - frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection); + frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); return true; } static bool executeMakeTextWritingDirectionRightToLeft(Frame* frame, Event*, EditorCommandSource, const String&) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); style->setProperty(CSSPropertyDirection, CSSValueRtl); - frame->editor()->applyStyle(style.get(), EditActionSetWritingDirection); + frame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetWritingDirection); return true; } diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp index 539cc5bd0..fc7286eba 100644 --- a/Source/WebCore/editing/FrameSelection.cpp +++ b/Source/WebCore/editing/FrameSelection.cpp @@ -1837,7 +1837,7 @@ void DragCaretController::paintDragCaret(Frame* frame, GraphicsContext* p, const #endif } -PassRefPtr<CSSMutableStyleDeclaration> FrameSelection::copyTypingStyle() const +PassRefPtr<StylePropertySet> FrameSelection::copyTypingStyle() const { if (!m_typingStyle || !m_typingStyle->style()) return 0; diff --git a/Source/WebCore/editing/FrameSelection.h b/Source/WebCore/editing/FrameSelection.h index 114e77d82..b1877f6d0 100644 --- a/Source/WebCore/editing/FrameSelection.h +++ b/Source/WebCore/editing/FrameSelection.h @@ -38,13 +38,13 @@ namespace WebCore { class CharacterData; -class CSSMutableStyleDeclaration; class Frame; class GraphicsContext; class HTMLFormElement; class RenderObject; class RenderView; class Settings; +class StylePropertySet; class VisiblePosition; enum EUserTriggered { NotUserTriggered = 0, UserTriggered = 1 }; @@ -235,7 +235,7 @@ public: void paintDragCaret(GraphicsContext*, const LayoutPoint&, const LayoutRect& clipRect) const; EditingStyle* typingStyle() const; - PassRefPtr<CSSMutableStyleDeclaration> copyTypingStyle() const; + PassRefPtr<StylePropertySet> copyTypingStyle() const; void setTypingStyle(PassRefPtr<EditingStyle>); void clearTypingStyle(); diff --git a/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp b/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp index e646b51f2..4aec419a1 100644 --- a/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp +++ b/Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp @@ -51,8 +51,7 @@ static Element* highestVisuallyEquivalentDivBelowRoot(Element* startBlock) // We don't want to return a root node (if it happens to be a div, e.g., in a document fragment) because there are no // siblings for us to append to. while (!curBlock->nextSibling() && curBlock->parentElement()->hasTagName(divTag) && curBlock->parentElement()->parentElement()) { - NamedNodeMap* attributes = curBlock->parentElement()->updatedAttributes(); - if (attributes && !attributes->isEmpty()) + if (curBlock->parentElement()->hasAttributes()) break; curBlock = curBlock->parentElement(); } diff --git a/Source/WebCore/editing/MarkupAccumulator.cpp b/Source/WebCore/editing/MarkupAccumulator.cpp index 5226b214c..306a84655 100644 --- a/Source/WebCore/editing/MarkupAccumulator.cpp +++ b/Source/WebCore/editing/MarkupAccumulator.cpp @@ -349,11 +349,10 @@ void MarkupAccumulator::appendElement(StringBuilder& out, Element* element, Name { appendOpenTag(out, element, namespaces); - NamedNodeMap* attributes = element->updatedAttributes(); - if (attributes) { - unsigned length = attributes->length(); + if (element->hasAttributes()) { + unsigned length = element->attributeCount(); for (unsigned int i = 0; i < length; i++) - appendAttribute(out, element, *attributes->attributeItem(i), namespaces); + appendAttribute(out, element, *element->attributeItem(i), namespaces); } // Give an opportunity to subclasses to add their own attributes. diff --git a/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp b/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp index 5408e39da..cbbba5225 100644 --- a/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp +++ b/Source/WebCore/editing/RemoveCSSPropertyCommand.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "RemoveCSSPropertyCommand.h" -#include "CSSMutableStyleDeclaration.h" +#include "StylePropertySet.h" #include <wtf/Assertions.h> namespace WebCore { @@ -42,7 +42,7 @@ RemoveCSSPropertyCommand::RemoveCSSPropertyCommand(Document* document, PassRefPt void RemoveCSSPropertyCommand::doApply() { - CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl(); + StylePropertySet* style = m_element->inlineStyleDecl(); m_oldValue = style->getPropertyValue(m_property); m_important = style->propertyIsImportant(m_property); style->removeProperty(m_property); @@ -50,7 +50,7 @@ void RemoveCSSPropertyCommand::doApply() void RemoveCSSPropertyCommand::doUnapply() { - CSSMutableStyleDeclaration* style = m_element->inlineStyleDecl(); + StylePropertySet* style = m_element->inlineStyleDecl(); style->setProperty(m_property, m_oldValue, m_important); } diff --git a/Source/WebCore/editing/RenderedPosition.cpp b/Source/WebCore/editing/RenderedPosition.cpp index 290d7a63f..fb3bfb06a 100644 --- a/Source/WebCore/editing/RenderedPosition.cpp +++ b/Source/WebCore/editing/RenderedPosition.cpp @@ -224,7 +224,7 @@ Position RenderedPosition::positionAtRightBoundaryOfBiDiRun() const return createLegacyEditingPosition(prevLeafChild()->renderer()->node(), prevLeafChild()->caretRightmostOffset()); } -LayoutRect RenderedPosition::absoluteRect(int* extraWidthToEndOfLine) const +LayoutRect RenderedPosition::absoluteRect(LayoutUnit* extraWidthToEndOfLine) const { if (isNull()) return LayoutRect(); diff --git a/Source/WebCore/editing/RenderedPosition.h b/Source/WebCore/editing/RenderedPosition.h index 6b8412021..eef01a1f4 100644 --- a/Source/WebCore/editing/RenderedPosition.h +++ b/Source/WebCore/editing/RenderedPosition.h @@ -68,7 +68,7 @@ public: Position positionAtRightBoundaryOfBiDiRun() const; LayoutRect absoluteRect() const { return absoluteRect(0); } - LayoutRect absoluteRect(int& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); } + LayoutRect absoluteRect(LayoutUnit& extraWidthToEndOfLine) const { return absoluteRect(&extraWidthToEndOfLine); } private: bool operator==(const RenderedPosition&) const { return false; } @@ -81,7 +81,7 @@ private: bool atLeftBoundaryOfBidiRun(ShouldMatchBidiLevel, unsigned char bidiLevelOfRun) const; bool atRightBoundaryOfBidiRun(ShouldMatchBidiLevel, unsigned char bidiLevelOfRun) const; - LayoutRect absoluteRect(int* extraWidthToEndOfLine) const; + LayoutRect absoluteRect(LayoutUnit* extraWidthToEndOfLine) const; RenderObject* m_renderer; InlineBox* m_inlineBox; diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.cpp b/Source/WebCore/editing/ReplaceSelectionCommand.cpp index 18f622e05..8ce9446a9 100644 --- a/Source/WebCore/editing/ReplaceSelectionCommand.cpp +++ b/Source/WebCore/editing/ReplaceSelectionCommand.cpp @@ -31,7 +31,6 @@ #include "BeforeTextInsertedEvent.h" #include "BreakBlockquoteCommand.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" #include "Document.h" @@ -51,6 +50,7 @@ #include "RenderObject.h" #include "RenderText.h" #include "SmartReplace.h" +#include "StylePropertySet.h" #include "TextIterator.h" #include "htmlediting.h" #include "markup.h" @@ -481,7 +481,7 @@ void ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline(Insert StyledElement* element = static_cast<StyledElement*>(node.get()); - CSSMutableStyleDeclaration* inlineStyle = element->inlineStyleDecl(); + StylePropertySet* inlineStyle = element->inlineStyleDecl(); RefPtr<EditingStyle> newInlineStyle = EditingStyle::create(inlineStyle); if (inlineStyle) { ContainerNode* context = element->parentNode(); diff --git a/Source/WebCore/editing/ReplaceSelectionCommand.h b/Source/WebCore/editing/ReplaceSelectionCommand.h index fcb55ccce..da053b834 100644 --- a/Source/WebCore/editing/ReplaceSelectionCommand.h +++ b/Source/WebCore/editing/ReplaceSelectionCommand.h @@ -30,11 +30,11 @@ namespace WebCore { -class CSSMutableStyleDeclaration; class DocumentFragment; class EditingStyle; class Node; class ReplacementFragment; +class StylePropertySet; class ReplaceSelectionCommand : public CompositeEditCommand { public: diff --git a/Source/WebCore/editing/TypingCommand.cpp b/Source/WebCore/editing/TypingCommand.cpp index 4101ecfd7..9ae395541 100644 --- a/Source/WebCore/editing/TypingCommand.cpp +++ b/Source/WebCore/editing/TypingCommand.cpp @@ -296,15 +296,19 @@ EditAction TypingCommand::editingAction() const void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) { + Frame* frame = document()->frame(); + if (!frame) + return; + #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) - if (!document()->frame()->editor()->isContinuousSpellCheckingEnabled() - && !document()->frame()->editor()->isAutomaticQuoteSubstitutionEnabled() - && !document()->frame()->editor()->isAutomaticLinkDetectionEnabled() - && !document()->frame()->editor()->isAutomaticDashSubstitutionEnabled() - && !document()->frame()->editor()->isAutomaticTextReplacementEnabled()) + if (!frame->editor()->isContinuousSpellCheckingEnabled() + && !frame->editor()->isAutomaticQuoteSubstitutionEnabled() + && !frame->editor()->isAutomaticLinkDetectionEnabled() + && !frame->editor()->isAutomaticDashSubstitutionEnabled() + && !frame->editor()->isAutomaticTextReplacementEnabled()) return; #else - if (!document()->frame()->editor()->isContinuousSpellCheckingEnabled()) + if (!frame->editor()->isContinuousSpellCheckingEnabled()) return; #endif // Take a look at the selection that results after typing and determine whether we need to spellcheck. @@ -321,25 +325,29 @@ void TypingCommand::markMisspellingsAfterTyping(ETypingCommand commandType) String strippedPreviousWord; if (range && (commandType == TypingCommand::InsertText || commandType == TypingCommand::InsertLineBreak || commandType == TypingCommand::InsertParagraphSeparator || commandType == TypingCommand::InsertParagraphSeparatorInQuotedContent)) strippedPreviousWord = plainText(range.get()).stripWhiteSpace(); - document()->frame()->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty()); + frame->editor()->markMisspellingsAfterTypingToWord(p1, endingSelection(), !strippedPreviousWord.isEmpty()); } else if (commandType == TypingCommand::InsertText) - document()->frame()->editor()->startCorrectionPanelTimer(); + frame->editor()->startCorrectionPanelTimer(); } } void TypingCommand::typingAddedToOpenCommand(ETypingCommand commandTypeForAddedTyping) { + Frame* frame = document()->frame(); + if (!frame) + return; + updatePreservesTypingStyle(commandTypeForAddedTyping); #if PLATFORM(MAC) && !defined(BUILDING_ON_LEOPARD) - document()->frame()->editor()->appliedEditing(this); + frame->editor()->appliedEditing(this); // Since the spellchecking code may also perform corrections and other replacements, it should happen after the typing changes. if (!m_shouldPreventSpellChecking) markMisspellingsAfterTyping(commandTypeForAddedTyping); #else // The old spellchecking code requires that checking be done first, to prevent issues like that in 6864072, where <doesn't> is marked as misspelled. markMisspellingsAfterTyping(commandTypeForAddedTyping); - document()->frame()->editor()->appliedEditing(this); + frame->editor()->appliedEditing(this); #endif } @@ -431,7 +439,11 @@ bool TypingCommand::makeEditableRootEmpty() void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing) { - document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false); + Frame* frame = document()->frame(); + if (!frame) + return; + + frame->editor()->updateMarkersForWordsAffectedByEditing(false); VisibleSelection selectionToDelete; VisibleSelection selectionAfterUndo; @@ -513,11 +525,11 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing) if (selectionToDelete.isNone()) return; - if (selectionToDelete.isCaret() || !document()->frame()->selection()->shouldDeleteSelection(selectionToDelete)) + if (selectionToDelete.isCaret() || !frame->selection()->shouldDeleteSelection(selectionToDelete)) return; if (killRing) - document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); + frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); // Make undo select everything that has been deleted, unless an undo will undo more than just this deletion. // FIXME: This behaves like TextEdit except for the case where you open with text insertion and then delete // more text than you insert. In that case all of the text that was around originally should be selected. @@ -530,7 +542,11 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing) void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool killRing) { - document()->frame()->editor()->updateMarkersForWordsAffectedByEditing(false); + Frame* frame = document()->frame(); + if (!frame) + return; + + frame->editor()->updateMarkersForWordsAffectedByEditing(false); VisibleSelection selectionToDelete; VisibleSelection selectionAfterUndo; @@ -599,11 +615,11 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki if (selectionToDelete.isNone()) return; - if (selectionToDelete.isCaret() || !document()->frame()->selection()->shouldDeleteSelection(selectionToDelete)) + if (selectionToDelete.isCaret() || !frame->selection()->shouldDeleteSelection(selectionToDelete)) return; if (killRing) - document()->frame()->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); + frame->editor()->addToKillRing(selectionToDelete.toNormalizedRange().get(), false); // make undo select what was deleted setStartingSelection(selectionAfterUndo); CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); diff --git a/Source/WebCore/editing/VisiblePosition.h b/Source/WebCore/editing/VisiblePosition.h index 20eee94de..c3f11f37e 100644 --- a/Source/WebCore/editing/VisiblePosition.h +++ b/Source/WebCore/editing/VisiblePosition.h @@ -93,7 +93,7 @@ public: } // Rect is local to the returned renderer - IntRect localCaretRect(RenderObject*&) const; + LayoutRect localCaretRect(RenderObject*&) const; // Bounds of (possibly transformed) caret in absolute coords IntRect absoluteCaretBounds() const; // Abs x/y position of the caret ignoring transforms. diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp index a5482af23..c9a0e78dd 100644 --- a/Source/WebCore/editing/markup.cpp +++ b/Source/WebCore/editing/markup.cpp @@ -31,7 +31,6 @@ #include "CDATASection.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPrimitiveValue.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" @@ -54,6 +53,7 @@ #include "MarkupAccumulator.h" #include "Range.h" #include "RenderObject.h" +#include "StylePropertySet.h" #include "TextIterator.h" #include "VisibleSelection.h" #include "XMLNSNames.h" @@ -69,7 +69,7 @@ namespace WebCore { using namespace HTMLNames; -static bool propertyMissingOrEqualToNone(CSSMutableStyleDeclaration*, int propertyID); +static bool propertyMissingOrEqualToNone(StylePropertySet*, int propertyID); class AttributeChange { public: @@ -104,12 +104,11 @@ static void completeURLs(Node* node, const String& baseURL) for (Node* n = node; n != end; n = n->traverseNextNode()) { if (n->isElementNode()) { Element* e = static_cast<Element*>(n); - NamedNodeMap* attributes = e->updatedAttributes(); - if (!attributes) + if (!e->hasAttributes()) continue; - unsigned length = attributes->length(); + unsigned length = e->attributeCount(); for (unsigned i = 0; i < length; i++) { - Attribute* attribute = attributes->attributeItem(i); + Attribute* attribute = e->attributeItem(i); if (e->isURLAttribute(attribute)) changes.append(AttributeChange(e, attribute->name(), KURL(parsedBaseURL, attribute->value()).string())); } @@ -129,11 +128,11 @@ public: Node* serializeNodes(Node* startNode, Node* pastEnd); virtual void appendString(const String& s) { return MarkupAccumulator::appendString(s); } void wrapWithNode(Node*, bool convertBlocksToInlines = false, RangeFullySelectsNode = DoesFullySelectNode); - void wrapWithStyleNode(CSSMutableStyleDeclaration*, Document*, bool isBlock = false); + void wrapWithStyleNode(StylePropertySet*, Document*, bool isBlock = false); String takeResults(); private: - void appendStyleNodeOpenTag(StringBuilder&, CSSMutableStyleDeclaration*, Document*, bool isBlock = false); + void appendStyleNodeOpenTag(StringBuilder&, StylePropertySet*, Document*, bool isBlock = false); const String styleNodeCloseTag(bool isBlock = false); virtual void appendText(StringBuilder& out, Text*); String renderedText(const Node*, const Range*); @@ -178,7 +177,7 @@ void StyledMarkupAccumulator::wrapWithNode(Node* node, bool convertBlocksToInlin m_nodes->append(node); } -void StyledMarkupAccumulator::wrapWithStyleNode(CSSMutableStyleDeclaration* style, Document* document, bool isBlock) +void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style, Document* document, bool isBlock) { StringBuilder openTag; appendStyleNodeOpenTag(openTag, style, document, isBlock); @@ -186,7 +185,7 @@ void StyledMarkupAccumulator::wrapWithStyleNode(CSSMutableStyleDeclaration* styl appendString(styleNodeCloseTag(isBlock)); } -void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, CSSMutableStyleDeclaration* style, Document* document, bool isBlock) +void StyledMarkupAccumulator::appendStyleNodeOpenTag(StringBuilder& out, StylePropertySet* style, Document* document, bool isBlock) { // wrappingStyleForSerialization should have removed -webkit-text-decorations-in-effect ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsInEffect)); @@ -289,12 +288,11 @@ void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element* element const bool documentIsHTML = element->document()->isHTMLDocument(); appendOpenTag(out, element, 0); - NamedNodeMap* attributes = element->updatedAttributes(); - const unsigned length = attributes ? attributes->length() : 0; + const unsigned length = element->hasAttributes() ? element->attributeCount() : 0; const bool shouldAnnotateOrForceInline = element->isHTMLElement() && (shouldAnnotate() || addDisplayInline); const bool shouldOverrideStyleAttr = shouldAnnotateOrForceInline || shouldApplyWrappingStyle(element); for (unsigned int i = 0; i < length; i++) { - Attribute* attribute = attributes->attributeItem(i); + Attribute* attribute = element->attributeItem(i); // We'll handle the style attribute separately, below. if (attribute->name() == styleAttr && shouldOverrideStyleAttr) continue; @@ -467,7 +465,7 @@ static inline Node* ancestorToRetainStructureAndAppearanceWithNoRenderer(Node* c return ancestorToRetainStructureAndAppearanceForBlock(commonAncestorBlock); } -static bool propertyMissingOrEqualToNone(CSSMutableStyleDeclaration* style, int propertyID) +static bool propertyMissingOrEqualToNone(StylePropertySet* style, int propertyID) { if (!style) return false; diff --git a/Source/WebCore/fileapi/Blob.idl b/Source/WebCore/fileapi/Blob.idl index 9902cd454..1400dc1b3 100644 --- a/Source/WebCore/fileapi/Blob.idl +++ b/Source/WebCore/fileapi/Blob.idl @@ -31,16 +31,16 @@ module html { interface [ - GenerateIsReachable=Impl, - CustomToJS, - NoStaticTables + JSGenerateIsReachable=Impl, + JSCustomToJS, + JSNoStaticTables ] Blob { readonly attribute unsigned long long size; readonly attribute DOMString type; #if !defined(LANGUAGE_OBJECTIVE_C) #if defined(ENABLE_BLOB) && ENABLE_BLOB - Blob webkitSlice(in [Optional] long long start, in [Optional] long long end, in [Optional, ConvertUndefinedOrNullToNullString] DOMString contentType); + Blob webkitSlice(in [Optional] long long start, in [Optional] long long end, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); #endif #endif }; diff --git a/Source/WebCore/fileapi/DOMFileSystem.idl b/Source/WebCore/fileapi/DOMFileSystem.idl index e7cdf7023..2e98fbf93 100644 --- a/Source/WebCore/fileapi/DOMFileSystem.idl +++ b/Source/WebCore/fileapi/DOMFileSystem.idl @@ -33,7 +33,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, ActiveDOMObject, - NoStaticTables + JSNoStaticTables ] DOMFileSystem { readonly attribute DOMString name; readonly attribute DirectoryEntry root; diff --git a/Source/WebCore/fileapi/DOMFileSystemSync.idl b/Source/WebCore/fileapi/DOMFileSystemSync.idl index b51d8ccd6..706aa5027 100644 --- a/Source/WebCore/fileapi/DOMFileSystemSync.idl +++ b/Source/WebCore/fileapi/DOMFileSystemSync.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, - NoStaticTables + JSNoStaticTables ] DOMFileSystemSync { readonly attribute DOMString name; readonly attribute DirectoryEntrySync root; diff --git a/Source/WebCore/fileapi/DirectoryEntry.idl b/Source/WebCore/fileapi/DirectoryEntry.idl index ac345e7dc..7d9246502 100644 --- a/Source/WebCore/fileapi/DirectoryEntry.idl +++ b/Source/WebCore/fileapi/DirectoryEntry.idl @@ -31,13 +31,13 @@ module storage { interface [ Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] DirectoryEntry : Entry { DirectoryReader createReader(); - [Custom] void getFile(in [ConvertUndefinedOrNullToNullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - [Custom] void getDirectory(in [ConvertUndefinedOrNullToNullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [Custom] void getFile(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + [Custom] void getDirectory(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in [Optional] WebKitFlags flags, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); void removeRecursively(in [Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); }; } diff --git a/Source/WebCore/fileapi/DirectoryEntrySync.idl b/Source/WebCore/fileapi/DirectoryEntrySync.idl index b0ab178ff..e4ca8d7ea 100644 --- a/Source/WebCore/fileapi/DirectoryEntrySync.idl +++ b/Source/WebCore/fileapi/DirectoryEntrySync.idl @@ -31,13 +31,13 @@ module storage { interface [ Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] DirectoryEntrySync : EntrySync { DirectoryReaderSync createReader() raises (FileException); - [Custom] FileEntrySync getFile(in [ConvertUndefinedOrNullToNullString] DOMString path, in WebKitFlags flags) raises (FileException); - [Custom] DirectoryEntrySync getDirectory(in [ConvertUndefinedOrNullToNullString] DOMString path, in WebKitFlags flags) raises (FileException); + [Custom] FileEntrySync getFile(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in WebKitFlags flags) raises (FileException); + [Custom] DirectoryEntrySync getDirectory(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString path, in WebKitFlags flags) raises (FileException); void removeRecursively() raises (FileException); }; } diff --git a/Source/WebCore/fileapi/DirectoryReader.idl b/Source/WebCore/fileapi/DirectoryReader.idl index 831fb05bc..87ce8521d 100644 --- a/Source/WebCore/fileapi/DirectoryReader.idl +++ b/Source/WebCore/fileapi/DirectoryReader.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, - NoStaticTables + JSNoStaticTables ] DirectoryReader { void readEntries(in [Callback] EntriesCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); }; diff --git a/Source/WebCore/fileapi/DirectoryReaderSync.idl b/Source/WebCore/fileapi/DirectoryReaderSync.idl index aa3992832..a8ff685ce 100644 --- a/Source/WebCore/fileapi/DirectoryReaderSync.idl +++ b/Source/WebCore/fileapi/DirectoryReaderSync.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, - NoStaticTables + JSNoStaticTables ] DirectoryReaderSync { EntryArraySync readEntries() raises (FileException); }; diff --git a/Source/WebCore/fileapi/Entry.idl b/Source/WebCore/fileapi/Entry.idl index d6d280ba8..4be6c8b75 100644 --- a/Source/WebCore/fileapi/Entry.idl +++ b/Source/WebCore/fileapi/Entry.idl @@ -31,8 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - CustomToJS, - NoStaticTables + JSCustomToJS, + JSNoStaticTables ] Entry { readonly attribute boolean isFile; readonly attribute boolean isDirectory; @@ -41,8 +41,8 @@ module storage { readonly attribute DOMFileSystem filesystem; void getMetadata(in [Callback] MetadataCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void moveTo(in DirectoryEntry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); - void copyTo(in DirectoryEntry parent, in [Optional, ConvertUndefinedOrNullToNullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void moveTo(in DirectoryEntry parent, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); + void copyTo(in DirectoryEntry parent, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name, in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); DOMString toURL(); void remove(in [Callback] VoidCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); void getParent(in [Optional, Callback] EntryCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); diff --git a/Source/WebCore/fileapi/EntryArray.idl b/Source/WebCore/fileapi/EntryArray.idl index dca782743..324dbc68b 100644 --- a/Source/WebCore/fileapi/EntryArray.idl +++ b/Source/WebCore/fileapi/EntryArray.idl @@ -31,8 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - HasIndexGetter, - NoStaticTables + IndexedGetter, + JSNoStaticTables ] EntryArray { readonly attribute unsigned long length; Entry item(in [IsIndex] unsigned long index); diff --git a/Source/WebCore/fileapi/EntryArraySync.idl b/Source/WebCore/fileapi/EntryArraySync.idl index bd54f33ee..224a68a24 100644 --- a/Source/WebCore/fileapi/EntryArraySync.idl +++ b/Source/WebCore/fileapi/EntryArraySync.idl @@ -31,8 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - HasIndexGetter, - NoStaticTables + IndexedGetter, + JSNoStaticTables ] EntryArraySync { readonly attribute unsigned long length; EntrySync item(in [IsIndex] unsigned long index); diff --git a/Source/WebCore/fileapi/EntrySync.idl b/Source/WebCore/fileapi/EntrySync.idl index 459a01441..2db476d33 100644 --- a/Source/WebCore/fileapi/EntrySync.idl +++ b/Source/WebCore/fileapi/EntrySync.idl @@ -31,8 +31,8 @@ module storage { interface [ Conditional=FILE_SYSTEM, - CustomToJS, - NoStaticTables + JSCustomToJS, + JSNoStaticTables ] EntrySync { readonly attribute boolean isFile; readonly attribute boolean isDirectory; @@ -41,8 +41,8 @@ module storage { readonly attribute DOMFileSystemSync filesystem; Metadata getMetadata() raises (FileException); - EntrySync moveTo(in DirectoryEntrySync parent, in [ConvertUndefinedOrNullToNullString] DOMString name) raises (FileException); - EntrySync copyTo(in DirectoryEntrySync parent, in [ConvertUndefinedOrNullToNullString] DOMString name) raises (FileException); + EntrySync moveTo(in DirectoryEntrySync parent, in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name) raises (FileException); + EntrySync copyTo(in DirectoryEntrySync parent, in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString name) raises (FileException); DOMString toURL(); void remove() raises (FileException); DirectoryEntrySync getParent(); diff --git a/Source/WebCore/fileapi/File.idl b/Source/WebCore/fileapi/File.idl index 74a6f769f..4a6bbd3cb 100644 --- a/Source/WebCore/fileapi/File.idl +++ b/Source/WebCore/fileapi/File.idl @@ -26,9 +26,9 @@ module html { interface [ - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] File : Blob { readonly attribute DOMString name; #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT diff --git a/Source/WebCore/fileapi/FileEntry.idl b/Source/WebCore/fileapi/FileEntry.idl index 73ef89563..d176cdeb8 100644 --- a/Source/WebCore/fileapi/FileEntry.idl +++ b/Source/WebCore/fileapi/FileEntry.idl @@ -31,9 +31,9 @@ module storage { interface [ Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] FileEntry : Entry { void createWriter(in [Callback] FileWriterCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); void file(in [Callback] FileCallback successCallback, in [Optional, Callback] ErrorCallback errorCallback); diff --git a/Source/WebCore/fileapi/FileEntrySync.idl b/Source/WebCore/fileapi/FileEntrySync.idl index c56983959..0d79250da 100644 --- a/Source/WebCore/fileapi/FileEntrySync.idl +++ b/Source/WebCore/fileapi/FileEntrySync.idl @@ -31,9 +31,9 @@ module storage { interface [ Conditional=FILE_SYSTEM, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] FileEntrySync : EntrySync { File file() raises (FileException); FileWriterSync createWriter() raises (FileException); diff --git a/Source/WebCore/fileapi/FileError.idl b/Source/WebCore/fileapi/FileError.idl index bab815ad6..158d78488 100644 --- a/Source/WebCore/fileapi/FileError.idl +++ b/Source/WebCore/fileapi/FileError.idl @@ -31,7 +31,7 @@ module html { interface [ Conditional=BLOB|FILE_SYSTEM, - NoStaticTables + JSNoStaticTables ] FileError { #if !defined(LANGUAGE_OBJECTIVE_C) // FIXME: Some of constant names are already defined in DOMException.h for Objective-C binding and we cannot have the same names here (they are translated into a enum in the same namespace). diff --git a/Source/WebCore/fileapi/FileException.idl b/Source/WebCore/fileapi/FileException.idl index 10bd15177..65de225ff 100644 --- a/Source/WebCore/fileapi/FileException.idl +++ b/Source/WebCore/fileapi/FileException.idl @@ -31,8 +31,8 @@ module html { interface [ Conditional=BLOB|FILE_SYSTEM, - DontCheckEnums, - NoStaticTables + DoNotCheckConstants, + JSNoStaticTables ] FileException { readonly attribute unsigned short code; @@ -41,7 +41,7 @@ module html { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // FileExceptionCode diff --git a/Source/WebCore/fileapi/FileList.idl b/Source/WebCore/fileapi/FileList.idl index 0d0b046c3..0cdf86116 100644 --- a/Source/WebCore/fileapi/FileList.idl +++ b/Source/WebCore/fileapi/FileList.idl @@ -26,8 +26,8 @@ module html { interface [ - HasIndexGetter, - NoStaticTables + IndexedGetter, + JSNoStaticTables ] FileList { readonly attribute unsigned long length; File item(in [IsIndex] unsigned long index); diff --git a/Source/WebCore/fileapi/FileReader.idl b/Source/WebCore/fileapi/FileReader.idl index 7407c11c6..9a6440c30 100644 --- a/Source/WebCore/fileapi/FileReader.idl +++ b/Source/WebCore/fileapi/FileReader.idl @@ -36,7 +36,7 @@ module html { Constructor, CallWith=ScriptExecutionContext, EventTarget, - NoStaticTables + JSNoStaticTables ] FileReader { // ready states const unsigned short EMPTY = 0; diff --git a/Source/WebCore/fileapi/FileReaderSync.idl b/Source/WebCore/fileapi/FileReaderSync.idl index 62242f15a..77250da29 100644 --- a/Source/WebCore/fileapi/FileReaderSync.idl +++ b/Source/WebCore/fileapi/FileReaderSync.idl @@ -32,7 +32,7 @@ module html { interface [ Conditional=BLOB, Constructor, - NoStaticTables + JSNoStaticTables ] FileReaderSync { [CallWith=ScriptExecutionContext] ArrayBuffer readAsArrayBuffer(in Blob blob) raises(FileException); diff --git a/Source/WebCore/fileapi/FileWriter.idl b/Source/WebCore/fileapi/FileWriter.idl index 4de2c9fdb..c6a88f366 100644 --- a/Source/WebCore/fileapi/FileWriter.idl +++ b/Source/WebCore/fileapi/FileWriter.idl @@ -35,7 +35,7 @@ module html { ActiveDOMObject, CallWith=ScriptExecutionContext, EventTarget, - NoStaticTables + JSNoStaticTables ] FileWriter { // ready states const unsigned short INIT = 0; diff --git a/Source/WebCore/fileapi/Metadata.idl b/Source/WebCore/fileapi/Metadata.idl index df50b66d7..ad477f771 100644 --- a/Source/WebCore/fileapi/Metadata.idl +++ b/Source/WebCore/fileapi/Metadata.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=FILE_SYSTEM, - NoStaticTables + JSNoStaticTables ] Metadata { readonly attribute Date modificationTime; }; diff --git a/Source/WebCore/fileapi/OperationNotAllowedException.idl b/Source/WebCore/fileapi/OperationNotAllowedException.idl index 215cbc436..d01a377f9 100644 --- a/Source/WebCore/fileapi/OperationNotAllowedException.idl +++ b/Source/WebCore/fileapi/OperationNotAllowedException.idl @@ -31,8 +31,8 @@ module html { interface [ Conditional=BLOB|FILE_SYSTEM, - DontCheckEnums, - NoStaticTables + DoNotCheckConstants, + JSNoStaticTables ] OperationNotAllowedException { readonly attribute unsigned short code; readonly attribute DOMString name; @@ -40,7 +40,7 @@ module html { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif const unsigned short NOT_ALLOWED_ERR = 1; diff --git a/Source/WebCore/fileapi/WebKitBlobBuilder.idl b/Source/WebCore/fileapi/WebKitBlobBuilder.idl index 4563613e9..5209ff8d4 100644 --- a/Source/WebCore/fileapi/WebKitBlobBuilder.idl +++ b/Source/WebCore/fileapi/WebKitBlobBuilder.idl @@ -31,17 +31,17 @@ module html { interface [ Constructor, - GenerateNativeConverter, - NoStaticTables + JSGenerateToNativeObject, + JSNoStaticTables ] WebKitBlobBuilder { #if !defined(LANGUAGE_OBJECTIVE_C) - Blob getBlob(in [Optional, ConvertUndefinedOrNullToNullString] DOMString contentType); + Blob getBlob(in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString contentType); #endif void append(in Blob blob); #if defined(ENABLE_BLOB) && ENABLE_BLOB void append(in ArrayBuffer arrayBuffer); #endif - void append(in DOMString value, in [Optional, ConvertUndefinedOrNullToNullString] DOMString endings) raises (DOMException); + void append(in DOMString value, in [Optional, TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString endings) raises (DOMException); }; } diff --git a/Source/WebCore/html/CheckboxInputType.cpp b/Source/WebCore/html/CheckboxInputType.cpp index ed83517b9..4e9663443 100644 --- a/Source/WebCore/html/CheckboxInputType.cpp +++ b/Source/WebCore/html/CheckboxInputType.cpp @@ -101,4 +101,9 @@ bool CheckboxInputType::isCheckbox() const return true; } +bool CheckboxInputType::supportsIndeterminateAppearance() const +{ + return true; +} + } // namespace WebCore diff --git a/Source/WebCore/html/CheckboxInputType.h b/Source/WebCore/html/CheckboxInputType.h index 160c39124..c4c009a39 100644 --- a/Source/WebCore/html/CheckboxInputType.h +++ b/Source/WebCore/html/CheckboxInputType.h @@ -48,6 +48,7 @@ private: virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual bool isCheckbox() const OVERRIDE; + virtual bool supportsIndeterminateAppearance() const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/ColorInputType.cpp b/Source/WebCore/html/ColorInputType.cpp index d7bd81f4c..071cc3416 100644 --- a/Source/WebCore/html/ColorInputType.cpp +++ b/Source/WebCore/html/ColorInputType.cpp @@ -178,7 +178,7 @@ void ColorInputType::updateColorSwatch() if (!colorSwatch) return; - colorSwatch->style()->setProperty(CSSPropertyBackgroundColor, element()->value(), false, ASSERT_NO_EXCEPTION); + colorSwatch->ensureInlineStyleDecl()->setProperty(CSSPropertyBackgroundColor, element()->value(), false); } HTMLElement* ColorInputType::shadowColorSwatch() const diff --git a/Source/WebCore/html/ColorInputType.h b/Source/WebCore/html/ColorInputType.h index d51deaa7d..3e064bd44 100644 --- a/Source/WebCore/html/ColorInputType.h +++ b/Source/WebCore/html/ColorInputType.h @@ -54,12 +54,12 @@ private: virtual bool supportsRequired() const OVERRIDE; virtual String fallbackValue() const OVERRIDE; virtual String sanitizeValue(const String&) const OVERRIDE; - virtual Color valueAsColor() const OVERRIDE; virtual void createShadowSubtree() OVERRIDE; virtual void setValue(const String&, bool valueChanged, bool sendChangeEvent) OVERRIDE; virtual void handleDOMActivateEvent(Event*) OVERRIDE; virtual void detach() OVERRIDE; + Color valueAsColor() const; void endColorChooser(); void updateColorSwatch(); HTMLElement* shadowColorSwatch() const; diff --git a/Source/WebCore/html/DOMFormData.idl b/Source/WebCore/html/DOMFormData.idl index 992f04766..73ac211e1 100644 --- a/Source/WebCore/html/DOMFormData.idl +++ b/Source/WebCore/html/DOMFormData.idl @@ -32,8 +32,8 @@ module html { interface [ CustomConstructor, - GenerateNativeConverter, - GenerateToJS + JSGenerateToNativeObject, + JSGenerateToJS ] DOMFormData { // void append(DOMString name, DOMString value); // void append(DOMString name, Blob value, optional DOMString filename); diff --git a/Source/WebCore/html/DOMSettableTokenList.idl b/Source/WebCore/html/DOMSettableTokenList.idl index 02c6500b0..f0646e5a0 100644 --- a/Source/WebCore/html/DOMSettableTokenList.idl +++ b/Source/WebCore/html/DOMSettableTokenList.idl @@ -25,8 +25,8 @@ module core { interface [ - HasIndexGetter, - GenerateToJS + IndexedGetter, + JSGenerateToJS ] DOMSettableTokenList : DOMTokenList { attribute DOMString value; }; diff --git a/Source/WebCore/html/DOMTokenList.idl b/Source/WebCore/html/DOMTokenList.idl index 0bcc4889f..88169acb9 100644 --- a/Source/WebCore/html/DOMTokenList.idl +++ b/Source/WebCore/html/DOMTokenList.idl @@ -25,8 +25,8 @@ module core { interface [ - GenerateIsReachable=ImplElementRoot, - HasIndexGetter + JSGenerateIsReachable=ImplElementRoot, + IndexedGetter ] DOMTokenList { readonly attribute unsigned long length; [ConvertNullStringTo=Null] DOMString item(in unsigned long index); @@ -36,7 +36,7 @@ module core { boolean toggle(in DOMString token) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif }; diff --git a/Source/WebCore/html/DOMURL.cpp b/Source/WebCore/html/DOMURL.cpp index e42060d48..086bf778c 100644 --- a/Source/WebCore/html/DOMURL.cpp +++ b/Source/WebCore/html/DOMURL.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,11 +30,15 @@ #include "DOMURL.h" +#include "ActiveDOMObject.h" #include "Blob.h" #include "BlobURL.h" #include "KURL.h" +#include "PublicURLManager.h" #include "ScriptExecutionContext.h" +#include "SecurityOrigin.h" #include "ThreadableBlobRegistry.h" +#include <wtf/PassOwnPtr.h> #include <wtf/MainThread.h> #if ENABLE(MEDIA_STREAM) @@ -43,37 +48,13 @@ namespace WebCore { -DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext) - : ContextDestructionObserver(scriptExecutionContext) -{ -} - -DOMURL::~DOMURL() -{ -} - -void DOMURL::contextDestroyed() -{ - ContextDestructionObserver::contextDestroyed(); - - HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end(); - for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter) - ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); - -#if ENABLE(MEDIA_STREAM) - HashSet<String>::iterator publicStreamURLsEnd = m_publicStreamURLs.end(); - for (HashSet<String>::iterator iter = m_publicStreamURLs.begin(); iter != publicStreamURLsEnd; ++iter) - MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); -#endif -} - #if ENABLE(MEDIA_STREAM) -String DOMURL::createObjectURL(MediaStream* stream) +String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, MediaStream* stream) { - if (!m_scriptExecutionContext || !stream) + if (!scriptExecutionContext || !stream) return String(); - KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); + KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin()); if (publicURL.isEmpty()) return String(); @@ -81,46 +62,48 @@ String DOMURL::createObjectURL(MediaStream* stream) ASSERT(isMainThread()); MediaStreamRegistry::registry().registerMediaStreamURL(publicURL, stream); - m_publicStreamURLs.add(publicURL.string()); + scriptExecutionContext->publicURLManager().streamURLs().add(publicURL.string()); return publicURL.string(); } #endif -String DOMURL::createObjectURL(Blob* blob) +String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob) { - if (!m_scriptExecutionContext || !blob) + if (!scriptExecutionContext || !blob) return String(); - KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); + KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext->securityOrigin()); if (publicURL.isEmpty()) return String(); ThreadableBlobRegistry::registerBlobURL(publicURL, blob->url()); - m_publicBlobURLs.add(publicURL.string()); + scriptExecutionContext->publicURLManager().blobURLs().add(publicURL.string()); return publicURL.string(); } -void DOMURL::revokeObjectURL(const String& urlString) +void DOMURL::revokeObjectURL(ScriptExecutionContext* scriptExecutionContext, const String& urlString) { - if (!m_scriptExecutionContext) + if (!scriptExecutionContext) return; KURL url(KURL(), urlString); - if (m_publicBlobURLs.contains(url.string())) { + HashSet<String>& blobURLs = scriptExecutionContext->publicURLManager().blobURLs(); + if (blobURLs.contains(url.string())) { ThreadableBlobRegistry::unregisterBlobURL(url); - m_publicBlobURLs.remove(url.string()); + blobURLs.remove(url.string()); } #if ENABLE(MEDIA_STREAM) - if (m_publicStreamURLs.contains(url.string())) { + HashSet<String>& streamURLs = scriptExecutionContext->publicURLManager().streamURLs(); + if (streamURLs.contains(url.string())) { // FIXME: make sure of this assertion below. Raise a spec question if required. // Since WebWorkers cannot obtain Stream objects, we should be on the main thread. ASSERT(isMainThread()); MediaStreamRegistry::registry().unregisterMediaStreamURL(url); - m_publicStreamURLs.remove(url.string()); + streamURLs.remove(url.string()); } #endif } diff --git a/Source/WebCore/html/DOMURL.h b/Source/WebCore/html/DOMURL.h index d02fe887c..25ae013eb 100644 --- a/Source/WebCore/html/DOMURL.h +++ b/Source/WebCore/html/DOMURL.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,9 +27,7 @@ #ifndef DOMURL_h #define DOMURL_h -#if ENABLE(BLOB) - -#include "ActiveDOMObject.h" +#include "KURL.h" #include "PlatformString.h" #include <wtf/HashSet.h> #include <wtf/PassRefPtr.h> @@ -40,30 +39,22 @@ class Blob; class MediaStream; class ScriptExecutionContext; -class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver { -public: - static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); } - ~DOMURL(); - -#if ENABLE(MEDIA_STREAM) - String createObjectURL(MediaStream*); -#endif - String createObjectURL(Blob*); - void revokeObjectURL(const String&); +class DOMURL : public RefCounted<DOMURL> { -private: - explicit DOMURL(ScriptExecutionContext*); +public: + static PassRefPtr<DOMURL> create() { return adoptRef(new DOMURL); } - virtual void contextDestroyed(); +#if ENABLE(BLOB) + static void contextDestroyed(ScriptExecutionContext*); - HashSet<String> m_publicBlobURLs; + static String createObjectURL(ScriptExecutionContext*, Blob*); + static void revokeObjectURL(ScriptExecutionContext*, const String&); #if ENABLE(MEDIA_STREAM) - HashSet<String> m_publicStreamURLs; + static String createObjectURL(ScriptExecutionContext*, MediaStream*); +#endif #endif }; } // namespace WebCore -#endif // ENABLE(BLOB) - #endif // DOMURL_h diff --git a/Source/WebCore/html/DOMURL.idl b/Source/WebCore/html/DOMURL.idl index d6d55790f..4f9722df3 100644 --- a/Source/WebCore/html/DOMURL.idl +++ b/Source/WebCore/html/DOMURL.idl @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Motorola Mobility Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,15 +27,15 @@ module html { interface [ Conditional=BLOB, - OmitConstructor, - GenerateNativeConverter, - GenerateToJS, - NoStaticTables + Constructor, + JSGenerateToNativeObject, + JSGenerateToJS, + JSNoStaticTables ] DOMURL { #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); + static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); #endif - [ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); - void revokeObjectURL(in DOMString url); + static [CallWith=ScriptExecutionContext,ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); + static [CallWith=ScriptExecutionContext] void revokeObjectURL(in DOMString url); }; } diff --git a/Source/WebCore/html/HTMLAllCollection.idl b/Source/WebCore/html/HTMLAllCollection.idl index 33e459b6a..3068e40fd 100644 --- a/Source/WebCore/html/HTMLAllCollection.idl +++ b/Source/WebCore/html/HTMLAllCollection.idl @@ -26,11 +26,11 @@ module html { interface [ - HasIndexGetter, - HasNameGetter, + IndexedGetter, + NamedGetter, CustomCall, MasqueradesAsUndefined, - GenerateIsReachable + JSGenerateIsReachable ] HTMLAllCollection { readonly attribute unsigned long length; [Custom] Node item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/html/HTMLAnchorElement.cpp b/Source/WebCore/html/HTMLAnchorElement.cpp index 6cfce16df..8b932b4fa 100644 --- a/Source/WebCore/html/HTMLAnchorElement.cpp +++ b/Source/WebCore/html/HTMLAnchorElement.cpp @@ -210,7 +210,7 @@ void HTMLAnchorElement::setActive(bool down, bool pause) ContainerNode::setActive(down, pause); } -void HTMLAnchorElement::parseMappedAttribute(Attribute* attr) +void HTMLAnchorElement::parseAttribute(Attribute* attr) { if (attr->name() == hrefAttr) { bool wasLink = isLink(); @@ -234,7 +234,7 @@ void HTMLAnchorElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == relAttr) setRel(attr->value()); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLAnchorElement::accessKeyAction(bool sendMouseEvents) diff --git a/Source/WebCore/html/HTMLAnchorElement.h b/Source/WebCore/html/HTMLAnchorElement.h index 99a6332ce..1fec65864 100644 --- a/Source/WebCore/html/HTMLAnchorElement.h +++ b/Source/WebCore/html/HTMLAnchorElement.h @@ -103,7 +103,7 @@ public: protected: HTMLAnchorElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; private: virtual bool supportsFocus() const; diff --git a/Source/WebCore/html/HTMLAnchorElement.idl b/Source/WebCore/html/HTMLAnchorElement.idl index 898f9eab7..3c40b73b6 100644 --- a/Source/WebCore/html/HTMLAnchorElement.idl +++ b/Source/WebCore/html/HTMLAnchorElement.idl @@ -43,21 +43,21 @@ module html { readonly attribute DOMString protocol; readonly attribute DOMString search; #else - attribute [TreatNullAs=EmptyString] DOMString hash; - attribute [TreatNullAs=EmptyString] DOMString host; - attribute [TreatNullAs=EmptyString] DOMString hostname; - attribute [TreatNullAs=EmptyString] DOMString pathname; - attribute [TreatNullAs=EmptyString] DOMString port; - attribute [TreatNullAs=EmptyString] DOMString protocol; - attribute [TreatNullAs=EmptyString] DOMString search; + attribute [TreatNullAs=NullString] DOMString hash; + attribute [TreatNullAs=NullString] DOMString host; + attribute [TreatNullAs=NullString] DOMString hostname; + attribute [TreatNullAs=NullString] DOMString pathname; + attribute [TreatNullAs=NullString] DOMString port; + attribute [TreatNullAs=NullString] DOMString protocol; + attribute [TreatNullAs=NullString] DOMString search; - readonly attribute [TreatNullAs=EmptyString] DOMString origin; + readonly attribute [TreatNullAs=NullString] DOMString origin; #endif readonly attribute DOMString text; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C diff --git a/Source/WebCore/html/HTMLAppletElement.cpp b/Source/WebCore/html/HTMLAppletElement.cpp index 14ba11feb..df55cd901 100644 --- a/Source/WebCore/html/HTMLAppletElement.cpp +++ b/Source/WebCore/html/HTMLAppletElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<HTMLAppletElement> HTMLAppletElement::create(const QualifiedName& tag return adoptRef(new HTMLAppletElement(tagName, document)); } -void HTMLAppletElement::parseMappedAttribute(Attribute* attr) +void HTMLAppletElement::parseAttribute(Attribute* attr) { if (attr->name() == altAttr || attr->name() == archiveAttr || @@ -57,7 +57,7 @@ void HTMLAppletElement::parseMappedAttribute(Attribute* attr) attr->name() == objectAttr) { // Do nothing. } else - HTMLPlugInElement::parseMappedAttribute(attr); + HTMLPlugInElement::parseAttribute(attr); } bool HTMLAppletElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLAppletElement.h b/Source/WebCore/html/HTMLAppletElement.h index e5387d99a..49e29b5e0 100644 --- a/Source/WebCore/html/HTMLAppletElement.h +++ b/Source/WebCore/html/HTMLAppletElement.h @@ -34,7 +34,7 @@ public: private: HTMLAppletElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/html/HTMLAppletElement.idl b/Source/WebCore/html/HTMLAppletElement.idl index 388b5cb23..6a683d7fc 100644 --- a/Source/WebCore/html/HTMLAppletElement.idl +++ b/Source/WebCore/html/HTMLAppletElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLAppletElement : HTMLElement { attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLAreaElement.cpp b/Source/WebCore/html/HTMLAreaElement.cpp index b00471678..57b5f768d 100644 --- a/Source/WebCore/html/HTMLAreaElement.cpp +++ b/Source/WebCore/html/HTMLAreaElement.cpp @@ -52,7 +52,7 @@ PassRefPtr<HTMLAreaElement> HTMLAreaElement::create(const QualifiedName& tagName return adoptRef(new HTMLAreaElement(tagName, document)); } -void HTMLAreaElement::parseMappedAttribute(Attribute* attr) +void HTMLAreaElement::parseAttribute(Attribute* attr) { if (attr->name() == shapeAttr) { if (equalIgnoringCase(attr->value(), "default")) @@ -70,7 +70,7 @@ void HTMLAreaElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) { // Do nothing. } else - HTMLAnchorElement::parseMappedAttribute(attr); + HTMLAnchorElement::parseAttribute(attr); } void HTMLAreaElement::invalidateCachedRegion() diff --git a/Source/WebCore/html/HTMLAreaElement.h b/Source/WebCore/html/HTMLAreaElement.h index 817391861..0970af8cd 100644 --- a/Source/WebCore/html/HTMLAreaElement.h +++ b/Source/WebCore/html/HTMLAreaElement.h @@ -50,7 +50,7 @@ public: private: HTMLAreaElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool supportsFocus() const; virtual String target() const; virtual bool isKeyboardFocusable(KeyboardEvent*) const; diff --git a/Source/WebCore/html/HTMLBRElement.cpp b/Source/WebCore/html/HTMLBRElement.cpp index 263906010..5efe6379a 100644 --- a/Source/WebCore/html/HTMLBRElement.cpp +++ b/Source/WebCore/html/HTMLBRElement.cpp @@ -48,30 +48,21 @@ PassRefPtr<HTMLBRElement> HTMLBRElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLBRElement(tagName, document)); } -bool HTMLBRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == clearAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLBRElement::parseMappedAttribute(Attribute* attr) +void HTMLBRElement::parseAttribute(Attribute* attr) { if (attr->name() == clearAttr) { // If the string is empty, then don't add the clear property. // <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh - const AtomicString& str = attr->value(); - if (!str.isEmpty()) { - if (equalIgnoringCase(str, "all")) - addCSSProperty(attr, CSSPropertyClear, "both"); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyClear); + else if (!attr->value().isEmpty()) { + if (equalIgnoringCase(attr->value(), "all")) + addCSSProperty(CSSPropertyClear, "both"); else - addCSSProperty(attr, CSSPropertyClear, str); + addCSSProperty(CSSPropertyClear, attr->value()); } } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style) diff --git a/Source/WebCore/html/HTMLBRElement.h b/Source/WebCore/html/HTMLBRElement.h index 3857a9ba6..10a6432c7 100644 --- a/Source/WebCore/html/HTMLBRElement.h +++ b/Source/WebCore/html/HTMLBRElement.h @@ -38,8 +38,7 @@ public: private: HTMLBRElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); }; diff --git a/Source/WebCore/html/HTMLBaseElement.cpp b/Source/WebCore/html/HTMLBaseElement.cpp index 9df2ad758..b3da89a16 100644 --- a/Source/WebCore/html/HTMLBaseElement.cpp +++ b/Source/WebCore/html/HTMLBaseElement.cpp @@ -42,12 +42,12 @@ PassRefPtr<HTMLBaseElement> HTMLBaseElement::create(const QualifiedName& tagName return adoptRef(new HTMLBaseElement(tagName, document)); } -void HTMLBaseElement::parseMappedAttribute(Attribute* attribute) +void HTMLBaseElement::parseAttribute(Attribute* attribute) { if (attribute->name() == hrefAttr || attribute->name() == targetAttr) document()->processBaseElement(); else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } void HTMLBaseElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLBaseElement.h b/Source/WebCore/html/HTMLBaseElement.h index fd3cef616..5f526a606 100644 --- a/Source/WebCore/html/HTMLBaseElement.h +++ b/Source/WebCore/html/HTMLBaseElement.h @@ -36,7 +36,7 @@ private: virtual String target() const; virtual bool isURLAttribute(Attribute*) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); }; diff --git a/Source/WebCore/html/HTMLBodyElement.cpp b/Source/WebCore/html/HTMLBodyElement.cpp index 6558d46d6..a769a2c21 100644 --- a/Source/WebCore/html/HTMLBodyElement.cpp +++ b/Source/WebCore/html/HTMLBodyElement.cpp @@ -60,46 +60,43 @@ HTMLBodyElement::~HTMLBodyElement() { } -bool HTMLBodyElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == bgcolorAttr || - attrName == textAttr || - attrName == marginwidthAttr || - attrName == leftmarginAttr || - attrName == marginheightAttr || - attrName == topmarginAttr || - attrName == bgpropertiesAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLBodyElement::parseMappedAttribute(Attribute* attr) +void HTMLBodyElement::parseAttribute(Attribute* attr) { if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) { - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginRight, CSSPropertyMarginLeft); + else { + addCSSLength(CSSPropertyMarginRight, attr->value()); + addCSSLength(CSSPropertyMarginLeft, attr->value()); + } } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) { - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginBottom, CSSPropertyMarginTop); + else { + addCSSLength(CSSPropertyMarginBottom, attr->value()); + addCSSLength(CSSPropertyMarginTop, attr->value()); + } } else if (attr->name() == bgcolorAttr) { - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); } else if (attr->name() == textAttr) { - addCSSColor(attr, CSSPropertyColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyColor); + else + addCSSColor(CSSPropertyColor, attr->value()); } else if (attr->name() == bgpropertiesAttr) { if (equalIgnoringCase(attr->value(), "fixed")) - addCSSProperty(attr, CSSPropertyBackgroundAttachment, CSSValueFixed); + addCSSProperty(CSSPropertyBackgroundAttachment, CSSValueFixed); + else + removeCSSProperty(CSSPropertyBackgroundAttachment); } else if (attr->name() == vlinkAttr || attr->name() == alinkAttr || attr->name() == linkAttr) { @@ -159,13 +156,15 @@ void HTMLBodyElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onofflineAttr) document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLBodyElement::insertedIntoDocument() { HTMLElement::insertedIntoDocument(); + ASSERT(document()); + // FIXME: Perhaps this code should be in attach() instead of here. Element* ownerElement = document()->ownerElement(); if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) { @@ -183,8 +182,7 @@ void HTMLBodyElement::insertedIntoDocument() if (FrameView* view = document()->view()) view->scheduleRelayout(); - if (document() && document()->page()) - document()->page()->updateViewportArguments(); + document()->updateViewportArguments(); } bool HTMLBodyElement::isURLAttribute(Attribute *attr) const diff --git a/Source/WebCore/html/HTMLBodyElement.h b/Source/WebCore/html/HTMLBodyElement.h index 5c632649c..8004b10da 100644 --- a/Source/WebCore/html/HTMLBodyElement.h +++ b/Source/WebCore/html/HTMLBodyElement.h @@ -70,8 +70,7 @@ public: private: HTMLBodyElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLBodyElement.idl b/Source/WebCore/html/HTMLBodyElement.idl index d6851d49b..a6b7f567d 100644 --- a/Source/WebCore/html/HTMLBodyElement.idl +++ b/Source/WebCore/html/HTMLBodyElement.idl @@ -30,29 +30,29 @@ module html { #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes - attribute [DontEnum, WindowEventListener] EventListener onbeforeunload; - attribute [DontEnum, WindowEventListener] EventListener onhashchange; - attribute [DontEnum, WindowEventListener] EventListener onmessage; - attribute [DontEnum, WindowEventListener] EventListener onoffline; - attribute [DontEnum, WindowEventListener] EventListener ononline; - attribute [DontEnum, WindowEventListener] EventListener onpopstate; - attribute [DontEnum, WindowEventListener] EventListener onresize; - attribute [DontEnum, WindowEventListener] EventListener onstorage; - attribute [DontEnum, WindowEventListener] EventListener onunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; + attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; + attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; + attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; + attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; + attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, DontEnum, WindowEventListener] EventListener onorientationchange; + attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable, JSWindowEventListener] EventListener onorientationchange; // Overrides of Element attributes (with different implementation in bindings). - attribute [DontEnum, WindowEventListener] EventListener onblur; - attribute [DontEnum, WindowEventListener] EventListener onerror; - attribute [DontEnum, WindowEventListener] EventListener onfocus; - attribute [DontEnum, WindowEventListener] EventListener onload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; + attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; + attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; + attribute [NotEnumerable, JSWindowEventListener] EventListener onload; // Not implemented yet. - // attribute [DontEnum, WindowEventListener] EventListener onafterprint; - // attribute [DontEnum, WindowEventListener] EventListener onbeforeprint; - // attribute [DontEnum, WindowEventListener] EventListener onredo; - // attribute [DontEnum, WindowEventListener] EventListener onundo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif }; diff --git a/Source/WebCore/html/HTMLButtonElement.cpp b/Source/WebCore/html/HTMLButtonElement.cpp index 54c907dc0..1468248b9 100644 --- a/Source/WebCore/html/HTMLButtonElement.cpp +++ b/Source/WebCore/html/HTMLButtonElement.cpp @@ -79,7 +79,7 @@ const AtomicString& HTMLButtonElement::formControlType() const return emptyAtom; } -void HTMLButtonElement::parseMappedAttribute(Attribute* attr) +void HTMLButtonElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) { if (equalIgnoringCase(attr->value(), "reset")) @@ -93,7 +93,7 @@ void HTMLButtonElement::parseMappedAttribute(Attribute* attr) // Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera. // See http://bugs.webkit.org/show_bug.cgi?id=12071 } else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } void HTMLButtonElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/HTMLButtonElement.h b/Source/WebCore/html/HTMLButtonElement.h index 374eb3e97..9699bef0e 100644 --- a/Source/WebCore/html/HTMLButtonElement.h +++ b/Source/WebCore/html/HTMLButtonElement.h @@ -43,7 +43,7 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void defaultEventHandler(Event*); virtual bool appendFormData(FormDataList&, bool); diff --git a/Source/WebCore/html/HTMLButtonElement.idl b/Source/WebCore/html/HTMLButtonElement.idl index c91947bb3..b8b8621f9 100644 --- a/Source/WebCore/html/HTMLButtonElement.idl +++ b/Source/WebCore/html/HTMLButtonElement.idl @@ -24,8 +24,8 @@ module html { readonly attribute HTMLFormElement form; attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=EmptyString] DOMString formEnctype; - attribute [TreatNullAs=EmptyString] DOMString formMethod; + attribute [TreatNullAs=NullString] DOMString formEnctype; + attribute [TreatNullAs=NullString] DOMString formMethod; attribute [Reflect] boolean formNoValidate; attribute [Reflect] DOMString formTarget; readonly attribute ValidityState validity; @@ -39,7 +39,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); void click(); diff --git a/Source/WebCore/html/HTMLCanvasElement.cpp b/Source/WebCore/html/HTMLCanvasElement.cpp index 143d33475..9cf78d403 100644 --- a/Source/WebCore/html/HTMLCanvasElement.cpp +++ b/Source/WebCore/html/HTMLCanvasElement.cpp @@ -105,12 +105,12 @@ HTMLCanvasElement::~HTMLCanvasElement() m_context.clear(); // Ensure this goes away before the ImageBuffer. } -void HTMLCanvasElement::parseMappedAttribute(Attribute* attr) +void HTMLCanvasElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); if (attrName == widthAttr || attrName == heightAttr) reset(); - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* style) @@ -177,7 +177,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext(const String& type, Canvas #if ENABLE(WEBGL) Settings* settings = document()->settings(); if (settings && settings->webGLEnabled() -#if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) +#if !PLATFORM(CHROMIUM) && !PLATFORM(GTK) && !PLATFORM(EFL) && settings->acceleratedCompositingEnabled() #endif ) { diff --git a/Source/WebCore/html/HTMLCanvasElement.h b/Source/WebCore/html/HTMLCanvasElement.h index 0493902b2..967444d0c 100644 --- a/Source/WebCore/html/HTMLCanvasElement.h +++ b/Source/WebCore/html/HTMLCanvasElement.h @@ -137,7 +137,7 @@ public: private: HTMLCanvasElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); void reset(); diff --git a/Source/WebCore/html/HTMLCanvasElement.idl b/Source/WebCore/html/HTMLCanvasElement.idl index 50d4ae461..35a806c65 100644 --- a/Source/WebCore/html/HTMLCanvasElement.idl +++ b/Source/WebCore/html/HTMLCanvasElement.idl @@ -27,13 +27,13 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLCanvasElement : HTMLElement { attribute long width; attribute long height; - [Custom] DOMString toDataURL(in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString type) + [Custom] DOMString toDataURL(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString type) raises(DOMException); #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP diff --git a/Source/WebCore/html/HTMLCollection.idl b/Source/WebCore/html/HTMLCollection.idl index 8fa2309cc..a4d172d1a 100644 --- a/Source/WebCore/html/HTMLCollection.idl +++ b/Source/WebCore/html/HTMLCollection.idl @@ -21,11 +21,11 @@ module html { interface [ - HasIndexGetter, - HasNameGetter, - CustomToJS, - GenerateIsReachable, - Polymorphic + IndexedGetter, + NamedGetter, + JSCustomToJS, + JSGenerateIsReachable, + ObjCPolymorphic ] HTMLCollection { readonly attribute unsigned long length; Node item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/html/HTMLDetailsElement.cpp b/Source/WebCore/html/HTMLDetailsElement.cpp index ddec73876..015cf61ce 100644 --- a/Source/WebCore/html/HTMLDetailsElement.cpp +++ b/Source/WebCore/html/HTMLDetailsElement.cpp @@ -62,6 +62,12 @@ class DetailsSummaryElement : public HTMLContentElement { public: static PassRefPtr<DetailsSummaryElement> create(Document*); + Element* fallbackSummary() + { + ASSERT(firstChild() && firstChild()->hasTagName(summaryTag)); + return toElement(firstChild()); + } + private: DetailsSummaryElement(Document* document) : HTMLContentElement(HTMLNames::divTag, document) @@ -72,20 +78,24 @@ private: PassRefPtr<DetailsSummaryElement> DetailsSummaryElement::create(Document* document) { - return adoptRef(new DetailsSummaryElement(document)); + RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document); + defaultSummary->appendChild(Text::create(document, defaultDetailsSummaryText()), ASSERT_NO_EXCEPTION); + + RefPtr<DetailsSummaryElement> elem = adoptRef(new DetailsSummaryElement(document)); + elem->appendChild(defaultSummary); + return elem.release(); } PassRefPtr<HTMLDetailsElement> HTMLDetailsElement::create(const QualifiedName& tagName, Document* document) { - RefPtr<HTMLDetailsElement> result = adoptRef(new HTMLDetailsElement(tagName, document)); - result->ensureShadowSubtreeOf(ForwardingSummary); - return result; + RefPtr<HTMLDetailsElement> elem = adoptRef(new HTMLDetailsElement(tagName, document)); + elem->createShadowSubtree(); + + return elem.release(); } HTMLDetailsElement::HTMLDetailsElement(const QualifiedName& tagName, Document* document) : HTMLElement(tagName, document) - , m_summaryType(NoSummary) - , m_mainSummary(0) , m_isOpen(false) { ASSERT(hasTagName(detailsTag)); @@ -96,86 +106,26 @@ RenderObject* HTMLDetailsElement::createRenderer(RenderArena* arena, RenderStyle return new (arena) RenderDetails(this); } -void HTMLDetailsElement::ensureShadowSubtreeOf(SummaryType type) -{ - if (type == m_summaryType) - return; - m_summaryType = type; - removeShadowRoot(); - createShadowSubtree(); -} - -static Node* findSummaryFor(PassRefPtr<ContainerNode> container) -{ - for (Node* child = container->firstChild(); child; child = child->nextSibling()) { - if (child->hasTagName(summaryTag)) - return child; - } - - return 0; -} - -Node* HTMLDetailsElement::ensureMainSummary() -{ - Node* summary = findSummaryFor(this); - if (summary) { - ensureShadowSubtreeOf(ForwardingSummary); - return summary; - } - - ensureShadowSubtreeOf(DefaultSummary); - return findSummaryFor(shadowRoot()); -} - -void HTMLDetailsElement::refreshMainSummary(RefreshRenderer refreshRenderer) -{ - RefPtr<Node> oldSummary = m_mainSummary; - m_mainSummary = ensureMainSummary(); - - if (oldSummary == m_mainSummary || !attached()) - return; - - if (oldSummary && oldSummary->parentNodeForRenderingAndStyle()) - oldSummary->reattach(); - if (m_mainSummary && refreshRenderer == RefreshRendererAllowed) - m_mainSummary->reattach(); -} - void HTMLDetailsElement::createShadowSubtree() { ASSERT(!shadowRoot()); - ExceptionCode ec = 0; - if (m_summaryType == DefaultSummary) { - RefPtr<HTMLSummaryElement> defaultSummary = HTMLSummaryElement::create(summaryTag, document()); - defaultSummary->appendChild(Text::create(document(), defaultDetailsSummaryText()), ec); - ensureShadowRoot()->appendChild(defaultSummary, ec, true); - ensureShadowRoot()->appendChild(DetailsContentElement::create(document()), ec, true); - } else { - ASSERT(m_summaryType == ForwardingSummary); - ensureShadowRoot()->appendChild(DetailsSummaryElement::create(document()), ec, true); - ensureShadowRoot()->appendChild(DetailsContentElement::create(document()), ec, true); - } -} - -void HTMLDetailsElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) -{ - HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); - // If childCountDelta is less then zero and the main summary has changed it must be because previous main - // summary was removed. The new main summary was then inside the unrevealed content and needs to be - // reattached to create its renderer. If childCountDelta is not less then zero then a new <summary> element - // has been added and it will be attached without our help. - if (!changedByParser) - refreshMainSummary(childCountDelta < 0 ? RefreshRendererAllowed : RefreshRendererSupressed); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(DetailsSummaryElement::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(DetailsContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } -void HTMLDetailsElement::finishParsingChildren() +Element* HTMLDetailsElement::findMainSummary() const { - HTMLElement::finishParsingChildren(); - refreshMainSummary(RefreshRendererAllowed); + for (Node* child = firstChild(); child; child = child->nextSibling()) { + if (child->hasTagName(summaryTag)) + return toElement(child); + } + + return static_cast<DetailsSummaryElement*>(shadowRoot()->firstChild())->fallbackSummary(); } -void HTMLDetailsElement::parseMappedAttribute(Attribute* attr) +void HTMLDetailsElement::parseAttribute(Attribute* attr) { if (attr->name() == openAttr) { bool oldValue = m_isOpen; @@ -183,12 +133,18 @@ void HTMLDetailsElement::parseMappedAttribute(Attribute* attr) if (oldValue != m_isOpen) reattachIfAttached(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLDetailsElement::childShouldCreateRenderer(Node* child) const { - return m_isOpen || child == m_mainSummary; + if (m_isOpen) + return true; + + if (!child->hasTagName(summaryTag)) + return false; + + return child == findMainSummary(); } void HTMLDetailsElement::toggleOpen() diff --git a/Source/WebCore/html/HTMLDetailsElement.h b/Source/WebCore/html/HTMLDetailsElement.h index 0d8dda710..a86a365c6 100644 --- a/Source/WebCore/html/HTMLDetailsElement.h +++ b/Source/WebCore/html/HTMLDetailsElement.h @@ -28,37 +28,20 @@ namespace WebCore { class HTMLDetailsElement : public HTMLElement { public: static PassRefPtr<HTMLDetailsElement> create(const QualifiedName& tagName, Document* document); - Node* mainSummary() const { return m_mainSummary; } void toggleOpen(); -private: - enum RefreshRenderer { - RefreshRendererAllowed, - RefreshRendererSupressed, - }; - - enum SummaryType { - NoSummary, - DefaultSummary, - ForwardingSummary - }; + Element* findMainSummary() const; +private: HTMLDetailsElement(const QualifiedName&, Document*); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta); - virtual void finishParsingChildren(); - void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; bool childShouldCreateRenderer(Node*) const; - Node* ensureMainSummary(); - void refreshMainSummary(RefreshRenderer); - void ensureShadowSubtreeOf(SummaryType); void createShadowSubtree(); - SummaryType m_summaryType; - Node* m_mainSummary; bool m_isOpen; }; diff --git a/Source/WebCore/html/HTMLDivElement.cpp b/Source/WebCore/html/HTMLDivElement.cpp index 23e6585fb..da2785c1f 100644 --- a/Source/WebCore/html/HTMLDivElement.cpp +++ b/Source/WebCore/html/HTMLDivElement.cpp @@ -48,28 +48,21 @@ PassRefPtr<HTMLDivElement> HTMLDivElement::create(const QualifiedName& tagName, return adoptRef(new HTMLDivElement(tagName, document)); } -bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eBlock; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLDivElement::parseMappedAttribute(Attribute* attr) +void HTMLDivElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyTextAlign); if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(attr->value(), "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(attr->value(), "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLDivElement.h b/Source/WebCore/html/HTMLDivElement.h index 2e2b41710..cd90d8728 100644 --- a/Source/WebCore/html/HTMLDivElement.h +++ b/Source/WebCore/html/HTMLDivElement.h @@ -36,8 +36,7 @@ protected: HTMLDivElement(const QualifiedName&, Document*); private: - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLDocument.idl b/Source/WebCore/html/HTMLDocument.idl index a7a6bcda6..dd020e2c5 100644 --- a/Source/WebCore/html/HTMLDocument.idl +++ b/Source/WebCore/html/HTMLDocument.idl @@ -21,9 +21,9 @@ module html { interface [ - HasOverridingNameGetter + CustomNamedGetter ] HTMLDocument : Document { - [Custom, NoCPPCustom] void open(); + [JSCustom, V8Custom] void open(); void close(); [Custom] void write(in [Optional=CallWithDefaultValue] DOMString text); [Custom] void writeln(in [Optional=CallWithDefaultValue] DOMString text); @@ -48,19 +48,19 @@ module html { readonly attribute long width; readonly attribute long height; #endif - attribute [TreatNullAs=EmptyString] DOMString dir; - attribute [TreatNullAs=EmptyString] DOMString designMode; + attribute [TreatNullAs=NullString] DOMString dir; + attribute [TreatNullAs=NullString] DOMString designMode; readonly attribute DOMString compatMode; readonly attribute Element activeElement; boolean hasFocus(); // Deprecated attributes - attribute [TreatNullAs=EmptyString] DOMString bgColor; - attribute [TreatNullAs=EmptyString] DOMString fgColor; - attribute [TreatNullAs=EmptyString] DOMString alinkColor; - attribute [TreatNullAs=EmptyString] DOMString linkColor; - attribute [TreatNullAs=EmptyString] DOMString vlinkColor; + attribute [TreatNullAs=NullString] DOMString bgColor; + attribute [TreatNullAs=NullString] DOMString fgColor; + attribute [TreatNullAs=NullString] DOMString alinkColor; + attribute [TreatNullAs=NullString] DOMString linkColor; + attribute [TreatNullAs=NullString] DOMString vlinkColor; }; } diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index 680c23b5d..a018fe23b 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -120,27 +120,6 @@ bool HTMLElement::ieForbidsInsertHTML() const return false; } -bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr - || attrName == contenteditableAttr - || attrName == hiddenAttr) { - result = eUniversal; - return false; - } - if (attrName == dirAttr) { - if (hasLocalName(bdoTag)) - result = eBDO; - else if (hasLocalName(bdiTag)) - result = eBDI; - else - result = eUniversal; - return true; - } - - return StyledElement::mapToEntry(attrName, result); -} - static inline int unicodeBidiAttributeForDirAuto(HTMLElement* element) { if (element->hasLocalName(preTag) || element->hasLocalName(textareaTag)) @@ -163,48 +142,53 @@ static unsigned parseBorderWidthAttribute(Attribute* attr) void HTMLElement::applyBorderAttribute(Attribute* attr) { - addCSSLength(attr, CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr))); - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSLength(CSSPropertyBorderWidth, String::number(parseBorderWidthAttribute(attr))); + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); } void HTMLElement::mapLanguageAttributeToLocale(Attribute* attribute) { ASSERT(attribute && (attribute->name() == langAttr || attribute->name().matches(XMLNames::langAttr))); const AtomicString& value = attribute->value(); - if (!value.isEmpty()) { + if (value.isNull()) + removeCSSProperty(CSSPropertyWebkitLocale); + else if (!value.isEmpty()) { // Have to quote so the locale id is treated as a string instead of as a CSS keyword. - addCSSProperty(attribute, CSSPropertyWebkitLocale, quoteCSSString(value)); + addCSSProperty(CSSPropertyWebkitLocale, quoteCSSString(value)); } else { // The empty string means the language is explicitly unknown. - addCSSProperty(attribute, CSSPropertyWebkitLocale, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitLocale, CSSValueAuto); } setNeedsStyleRecalc(); } -void HTMLElement::parseMappedAttribute(Attribute* attr) +void HTMLElement::parseAttribute(Attribute* attr) { if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr) - return StyledElement::parseMappedAttribute(attr); + return StyledElement::parseAttribute(attr); - String indexstring; if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "middle")) - addCSSProperty(attr, CSSPropertyTextAlign, "center"); + if (attr->isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(attr->value(), "middle")) + addCSSProperty(CSSPropertyTextAlign, "center"); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else if (attr->name() == contenteditableAttr) { setContentEditable(attr); } else if (attr->name() == hiddenAttr) { - addCSSProperty(attr, CSSPropertyDisplay, CSSValueNone); + if (attr->isNull()) + removeCSSProperty(CSSPropertyDisplay); + else + addCSSProperty(CSSPropertyDisplay, CSSValueNone); } else if (attr->name() == tabindexAttr) { - indexstring = getAttribute(tabindexAttr); int tabindex = 0; - if (!indexstring.length()) { + if (attr->isEmpty()) clearTabIndexExplicitly(); - } else if (parseHTMLInteger(indexstring, tabindex)) { + else if (parseHTMLInteger(attr->value(), tabindex)) { // Clamp tabindex to the range of 'short' to match Firefox's behavior. setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max())))); } @@ -215,21 +199,33 @@ void HTMLElement::parseMappedAttribute(Attribute* attr) if (!fastHasAttribute(XMLNames::langAttr)) mapLanguageAttributeToLocale(attr); } else if (attr->name() == dirAttr) { - bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); - if (!dirIsAuto) - addCSSProperty(attr, CSSPropertyDirection, attr->value()); - dirAttributeChanged(attr); - if (dirIsAuto) - addCSSProperty(attr, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); - else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) - addCSSProperty(attr, CSSPropertyUnicodeBidi, CSSValueEmbed); + if (attr->isNull()) + removeCSSProperties(CSSPropertyDirection, CSSPropertyUnicodeBidi); + else { + bool dirIsAuto = equalIgnoringCase(attr->value(), "auto"); + if (!dirIsAuto) + addCSSProperty(CSSPropertyDirection, attr->value()); + else + removeCSSProperty(CSSPropertyDirection); + + dirAttributeChanged(attr); + if (dirIsAuto) + addCSSProperty(CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this)); + else if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag)) + addCSSProperty(CSSPropertyUnicodeBidi, CSSValueEmbed); + else + removeCSSProperty(CSSPropertyUnicodeBidi); + } } else if (attr->name() == draggableAttr) { const AtomicString& value = attr->value(); if (equalIgnoringCase(value, "true")) { - addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueElement); - addCSSProperty(attr, CSSPropertyWebkitUserSelect, CSSValueNone); - } else if (equalIgnoringCase(value, "false")) - addCSSProperty(attr, CSSPropertyWebkitUserDrag, CSSValueNone); + addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueElement); + addCSSProperty(CSSPropertyWebkitUserSelect, CSSValueNone); + } else if (equalIgnoringCase(value, "false")) { + addCSSProperty(CSSPropertyWebkitUserDrag, CSSValueNone); + removeCSSProperty(CSSPropertyWebkitUserSelect); + } else + removeCSSProperties(CSSPropertyWebkitUserDrag, CSSPropertyWebkitUserSelect); #if ENABLE(MICRODATA) } else if (attr->name() == itempropAttr) { setItemProp(attr->value()); @@ -687,6 +683,11 @@ void HTMLElement::addHTMLAlignment(Attribute* attr) addHTMLAlignmentToStyledElement(this, attr); } +void HTMLElement::removeHTMLAlignment() +{ + removeCSSProperties(CSSPropertyFloat, CSSPropertyVerticalAlign); +} + void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attribute* attr) { // Vertical alignment with respect to the current baseline of the text @@ -717,10 +718,14 @@ void HTMLElement::addHTMLAlignmentToStyledElement(StyledElement* element, Attrib verticalAlignValue = CSSValueTextTop; if (floatValue != CSSValueInvalid) - element->addCSSProperty(attr, CSSPropertyFloat, floatValue); + element->addCSSProperty(CSSPropertyFloat, floatValue); + else + element->removeCSSProperty(CSSPropertyFloat); if (verticalAlignValue != CSSValueInvalid) - element->addCSSProperty(attr, CSSPropertyVerticalAlign, verticalAlignValue); + element->addCSSProperty(CSSPropertyVerticalAlign, verticalAlignValue); + else + element->removeCSSProperty(CSSPropertyVerticalAlign); } bool HTMLElement::supportsFocus() const @@ -747,21 +752,21 @@ String HTMLElement::contentEditable() const void HTMLElement::setContentEditable(Attribute* attr) { const AtomicString& enabled = attr->value(); - if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWrite); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); - addCSSProperty(attr, CSSPropertyWebkitNbspMode, CSSValueSpace); - addCSSProperty(attr, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); + if (enabled.isNull()) + removeCSSProperties(CSSPropertyWebkitUserModify, CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); + else if (enabled.isEmpty() || equalIgnoringCase(enabled, "true")) { + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWrite); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); + addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); } else if (equalIgnoringCase(enabled, "false")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadOnly); - removeCSSProperty(attr, CSSPropertyWordWrap); - removeCSSProperty(attr, CSSPropertyWebkitNbspMode); - removeCSSProperty(attr, CSSPropertyWebkitLineBreak); + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadOnly); + removeCSSProperties(CSSPropertyWordWrap, CSSPropertyWebkitNbspMode, CSSPropertyWebkitLineBreak); } else if (equalIgnoringCase(enabled, "plaintext-only")) { - addCSSProperty(attr, CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); - addCSSProperty(attr, CSSPropertyWebkitNbspMode, CSSValueSpace); - addCSSProperty(attr, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); + addCSSProperty(CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWebkitNbspMode, CSSValueSpace); + addCSSProperty(CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace); } } diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h index a86b2b917..47197261a 100644 --- a/Source/WebCore/html/HTMLElement.h +++ b/Source/WebCore/html/HTMLElement.h @@ -94,9 +94,9 @@ protected: HTMLElement(const QualifiedName& tagName, Document*); void addHTMLAlignment(Attribute*); + void removeHTMLAlignment(); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; void applyBorderAttribute(Attribute*); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl index 068cb8d74..308010f40 100644 --- a/Source/WebCore/html/HTMLElement.idl +++ b/Source/WebCore/html/HTMLElement.idl @@ -21,8 +21,8 @@ module html { interface [ - GenerateNativeConverter, - CustomPushEventHandlerScope + JSGenerateToNativeObject, + JSCustomPushEventHandlerScope ] HTMLElement : Element { // iht.com relies on id returning the empty string when no id is present. // Other browsers do this as well. So we don't convert null to JS null. @@ -40,13 +40,13 @@ module html { attribute [Reflect] DOMString accessKey; // Extensions - attribute [TreatNullAs=EmptyString] DOMString innerHTML + attribute [TreatNullAs=NullString] DOMString innerHTML setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString innerText + attribute [TreatNullAs=NullString] DOMString innerText setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString outerHTML + attribute [TreatNullAs=NullString] DOMString outerHTML setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString outerText + attribute [TreatNullAs=NullString] DOMString outerText setter raises(DOMException); Element insertAdjacentElement(in [Optional=CallWithDefaultValue] DOMString where, @@ -61,7 +61,7 @@ module html { readonly attribute HTMLCollection children; - attribute [TreatNullAs=EmptyString] DOMString contentEditable + attribute [TreatNullAs=NullString] DOMString contentEditable setter raises(DOMException); readonly attribute boolean isContentEditable; diff --git a/Source/WebCore/html/HTMLElementsAllInOne.cpp b/Source/WebCore/html/HTMLElementsAllInOne.cpp index ba4b99aba..3fe0da498 100644 --- a/Source/WebCore/html/HTMLElementsAllInOne.cpp +++ b/Source/WebCore/html/HTMLElementsAllInOne.cpp @@ -90,6 +90,7 @@ #include "HTMLQuoteElement.cpp" #include "HTMLScriptElement.cpp" #include "HTMLSelectElement.cpp" +#include "HTMLShadowElement.cpp" #include "HTMLSourceElement.cpp" #include "HTMLSpanElement.cpp" #include "HTMLStyleElement.cpp" diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp index 309aafe05..1d64ecaae 100644 --- a/Source/WebCore/html/HTMLEmbedElement.cpp +++ b/Source/WebCore/html/HTMLEmbedElement.cpp @@ -74,17 +74,7 @@ RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() return findWidgetRenderer(this); } -bool HTMLEmbedElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == hiddenAttr) { - result = eUniversal; - return false; - } - - return HTMLPlugInImageElement::mapToEntry(attrName, result); -} - -void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) +void HTMLEmbedElement::parseAttribute(Attribute* attr) { const AtomicString& value = attr->value(); @@ -108,21 +98,21 @@ void HTMLEmbedElement::parseMappedAttribute(Attribute* attr) if (equalIgnoringCase(value.string(), "yes") || equalIgnoringCase(value.string(), "true")) { // FIXME: Not dynamic, since we add this but don't remove it, but it may be OK for now // that this rarely-used attribute won't work properly if you remove it. - addCSSLength(attr, CSSPropertyWidth, "0"); - addCSSLength(attr, CSSPropertyHeight, "0"); - } + addCSSLength(CSSPropertyWidth, "0"); + addCSSLength(CSSPropertyHeight, "0"); + } else + removeCSSProperties(CSSPropertyWidth, CSSPropertyHeight); } else - HTMLPlugInImageElement::parseMappedAttribute(attr); + HTMLPlugInImageElement::parseAttribute(attr); } void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues) { - NamedNodeMap* attributes = updatedAttributes(); - if (!attributes) + if (!hasAttributes()) return; - for (unsigned i = 0; i < attributes->length(); ++i) { - Attribute* it = attributes->attributeItem(i); + for (unsigned i = 0; i < attributeCount(); ++i) { + Attribute* it = attributeItem(i); paramNames.append(it->localName().string()); paramValues.append(it->value().string()); } @@ -143,11 +133,15 @@ void HTMLEmbedElement::updateWidget(PluginCreationOption pluginCreationOption) // <object> which modifies url and serviceType before calling these. if (!allowedToLoadFrameURL(m_url)) return; + // FIXME: It's sadness that we have this special case here. // See http://trac.webkit.org/changeset/25128 and // plugins/netscape-plugin-setwindow-size.html - if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType)) + if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(m_url, m_serviceType)) { + // Ensure updateWidget() is called again during layout to create the Netscape plug-in. + setNeedsWidgetUpdate(true); return; + } // FIXME: These should be joined into a PluginParameters class. Vector<String> paramNames; diff --git a/Source/WebCore/html/HTMLEmbedElement.h b/Source/WebCore/html/HTMLEmbedElement.h index 12ce2714b..f37760361 100644 --- a/Source/WebCore/html/HTMLEmbedElement.h +++ b/Source/WebCore/html/HTMLEmbedElement.h @@ -34,8 +34,7 @@ public: private: HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLEmbedElement.idl b/Source/WebCore/html/HTMLEmbedElement.idl index 0ef638450..8ccc38830 100644 --- a/Source/WebCore/html/HTMLEmbedElement.idl +++ b/Source/WebCore/html/HTMLEmbedElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLEmbedElement : HTMLElement { attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLFieldSetElement.idl b/Source/WebCore/html/HTMLFieldSetElement.idl index 8cffe3db0..dd699c0e8 100644 --- a/Source/WebCore/html/HTMLFieldSetElement.idl +++ b/Source/WebCore/html/HTMLFieldSetElement.idl @@ -25,7 +25,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); }; } diff --git a/Source/WebCore/html/HTMLFontElement.cpp b/Source/WebCore/html/HTMLFontElement.cpp index d0ade290b..86f52984a 100644 --- a/Source/WebCore/html/HTMLFontElement.cpp +++ b/Source/WebCore/html/HTMLFontElement.cpp @@ -123,18 +123,6 @@ static bool parseFontSize(const String& input, int& size) return true; } -bool HTMLFontElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == sizeAttr || - attrName == colorAttr || - attrName == faceAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size) { int num = 0; @@ -170,18 +158,26 @@ bool HTMLFontElement::cssValueFromFontSizeNumber(const String& s, int& size) return true; } -void HTMLFontElement::parseMappedAttribute(Attribute* attr) +void HTMLFontElement::parseAttribute(Attribute* attr) { if (attr->name() == sizeAttr) { int size = 0; if (cssValueFromFontSizeNumber(attr->value(), size)) - addCSSProperty(attr, CSSPropertyFontSize, size); + addCSSProperty(CSSPropertyFontSize, size); + else + removeCSSProperty(CSSPropertyFontSize); } else if (attr->name() == colorAttr) { - addCSSColor(attr, CSSPropertyColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyColor); + else + addCSSColor(CSSPropertyColor, attr->value()); } else if (attr->name() == faceAttr) { - addCSSProperty(attr, CSSPropertyFontFamily, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyFontFamily); + else + addCSSProperty(CSSPropertyFontFamily, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLFontElement.h b/Source/WebCore/html/HTMLFontElement.h index f97ab080a..eea8b44fb 100644 --- a/Source/WebCore/html/HTMLFontElement.h +++ b/Source/WebCore/html/HTMLFontElement.h @@ -37,8 +37,7 @@ public: private: HTMLFontElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLFormControlElement.cpp b/Source/WebCore/html/HTMLFormControlElement.cpp index 2b06f3d04..c092f617a 100644 --- a/Source/WebCore/html/HTMLFormControlElement.cpp +++ b/Source/WebCore/html/HTMLFormControlElement.cpp @@ -99,7 +99,7 @@ bool HTMLFormControlElement::formNoValidate() const return fastHasAttribute(formnovalidateAttr); } -void HTMLFormControlElement::parseMappedAttribute(Attribute* attr) +void HTMLFormControlElement::parseAttribute(Attribute* attr) { if (attr->name() == formAttr) formAttributeChanged(); @@ -125,7 +125,7 @@ void HTMLFormControlElement::parseMappedAttribute(Attribute* attr) if (oldRequired != m_required) requiredAttributeChanged(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); setNeedsWillValidateCheck(); } diff --git a/Source/WebCore/html/HTMLFormControlElement.h b/Source/WebCore/html/HTMLFormControlElement.h index edc406f51..1bd485965 100644 --- a/Source/WebCore/html/HTMLFormControlElement.h +++ b/Source/WebCore/html/HTMLFormControlElement.h @@ -114,7 +114,7 @@ public: protected: HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void requiredAttributeChanged(); virtual void attach(); virtual void insertedIntoTree(bool deep); diff --git a/Source/WebCore/html/HTMLFormElement.cpp b/Source/WebCore/html/HTMLFormElement.cpp index 695a39b10..89f1e7b9b 100644 --- a/Source/WebCore/html/HTMLFormElement.cpp +++ b/Source/WebCore/html/HTMLFormElement.cpp @@ -357,7 +357,7 @@ void HTMLFormElement::reset() m_isInResetFunction = false; } -void HTMLFormElement::parseMappedAttribute(Attribute* attr) +void HTMLFormElement::parseAttribute(Attribute* attr) { if (attr->name() == actionAttr) m_attributes.parseAction(attr->value()); @@ -379,7 +379,7 @@ void HTMLFormElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onresetAttr) setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } template<class T, size_t n> static void removeFromVector(Vector<T*, n> & vec, T* item) diff --git a/Source/WebCore/html/HTMLFormElement.h b/Source/WebCore/html/HTMLFormElement.h index 08c114119..98d3d8af7 100644 --- a/Source/WebCore/html/HTMLFormElement.h +++ b/Source/WebCore/html/HTMLFormElement.h @@ -120,7 +120,7 @@ private: virtual void handleLocalEvents(Event*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLFormElement.idl b/Source/WebCore/html/HTMLFormElement.idl index d1884efe8..25386f5d9 100644 --- a/Source/WebCore/html/HTMLFormElement.idl +++ b/Source/WebCore/html/HTMLFormElement.idl @@ -21,8 +21,8 @@ module html { interface [ - HasIndexGetter, - HasOverridingNameGetter + IndexedGetter, + CustomNamedGetter ] HTMLFormElement : HTMLElement { readonly attribute HTMLCollection elements; readonly attribute long length; @@ -31,14 +31,14 @@ module html { attribute [Reflect] boolean noValidate; attribute [Reflect=accept_charset] DOMString acceptCharset; attribute [Reflect, URL] DOMString action; - attribute [TreatNullAs=EmptyString] DOMString encoding; - attribute [TreatNullAs=EmptyString] DOMString enctype; - attribute [TreatNullAs=EmptyString] DOMString method; + attribute [TreatNullAs=NullString] DOMString encoding; + attribute [TreatNullAs=NullString] DOMString enctype; + attribute [TreatNullAs=NullString] DOMString method; attribute [Reflect] DOMString target; attribute [Reflect] DOMString autocomplete; #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [ImplementationFunction=submitFromJavaScript] void submit(); + [ImplementedAs=submitFromJavaScript] void submit(); #else void submit(); #endif diff --git a/Source/WebCore/html/HTMLFrameElement.cpp b/Source/WebCore/html/HTMLFrameElement.cpp index 34ede8df8..b346494c4 100644 --- a/Source/WebCore/html/HTMLFrameElement.cpp +++ b/Source/WebCore/html/HTMLFrameElement.cpp @@ -82,7 +82,7 @@ void HTMLFrameElement::attach() } } -void HTMLFrameElement::parseMappedAttribute(Attribute* attr) +void HTMLFrameElement::parseAttribute(Attribute* attr) { if (attr->name() == frameborderAttr) { m_frameBorder = attr->value().toInt(); @@ -92,7 +92,7 @@ void HTMLFrameElement::parseMappedAttribute(Attribute* attr) if (renderer()) renderer()->updateFromElement(); } else - HTMLFrameElementBase::parseMappedAttribute(attr); + HTMLFrameElementBase::parseAttribute(attr); } } // namespace WebCore diff --git a/Source/WebCore/html/HTMLFrameElement.h b/Source/WebCore/html/HTMLFrameElement.h index 3b0761a7a..f43ea8c8a 100644 --- a/Source/WebCore/html/HTMLFrameElement.h +++ b/Source/WebCore/html/HTMLFrameElement.h @@ -44,7 +44,7 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; #if ENABLE(FULLSCREEN_API) virtual bool allowFullScreen() const { return false; } diff --git a/Source/WebCore/html/HTMLFrameElement.idl b/Source/WebCore/html/HTMLFrameElement.idl index 1c6851b8a..51a471621 100644 --- a/Source/WebCore/html/HTMLFrameElement.idl +++ b/Source/WebCore/html/HTMLFrameElement.idl @@ -44,7 +44,7 @@ module html { #endif #endif - attribute [TreatNullAs=EmptyString, CustomSetter] DOMString location; + attribute [TreatNullAs=NullString, CustomSetter] DOMString location; readonly attribute long width; readonly attribute long height; diff --git a/Source/WebCore/html/HTMLFrameElementBase.cpp b/Source/WebCore/html/HTMLFrameElementBase.cpp index fddec7f92..727173bb9 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.cpp +++ b/Source/WebCore/html/HTMLFrameElementBase.cpp @@ -131,13 +131,13 @@ void HTMLFrameElementBase::openURL(bool lockHistory, bool lockBackForwardList) contentFrame()->setInViewSourceMode(viewSourceMode()); } -void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr) +void HTMLFrameElementBase::parseAttribute(Attribute* attr) { if (attr->name() == srcAttr) setLocation(stripLeadingAndTrailingHTMLSpaces(attr->value())); else if (isIdAttributeName(attr->name())) { // Important to call through to base for the id attribute so the hasID bit gets set. - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); m_frameName = attr->value(); } else if (attr->name() == nameAttr) { m_frameName = attr->value(); @@ -169,7 +169,7 @@ void HTMLFrameElementBase::parseMappedAttribute(Attribute* attr) // FIXME: should <frame> elements have beforeunload handlers? setAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(this, attr)); } else - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); } void HTMLFrameElementBase::setNameAndOpenURL() diff --git a/Source/WebCore/html/HTMLFrameElementBase.h b/Source/WebCore/html/HTMLFrameElementBase.h index 0f587c9c8..41ee2eae2 100644 --- a/Source/WebCore/html/HTMLFrameElementBase.h +++ b/Source/WebCore/html/HTMLFrameElementBase.h @@ -55,7 +55,7 @@ protected: bool isURLAllowed() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void attach(); diff --git a/Source/WebCore/html/HTMLFrameSetElement.cpp b/Source/WebCore/html/HTMLFrameSetElement.cpp index 978a72d7a..4af6342bd 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.cpp +++ b/Source/WebCore/html/HTMLFrameSetElement.cpp @@ -64,17 +64,7 @@ PassRefPtr<HTMLFrameSetElement> HTMLFrameSetElement::create(const QualifiedName& return adoptRef(new HTMLFrameSetElement(tagName, document)); } -bool HTMLFrameSetElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == bordercolorAttr) { - result = eUniversal; - return true; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) +void HTMLFrameSetElement::parseAttribute(Attribute* attr) { if (attr->name() == rowsAttr) { if (!attr->isNull()) { @@ -109,11 +99,11 @@ void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) } else m_borderSet = false; } else if (attr->name() == bordercolorAttr) { - m_borderColorSet = attr->decl(); - if (!attr->decl() && !attr->isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - m_borderColorSet = true; - } + m_borderColorSet = !attr->isEmpty(); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBorderColor); + else + addCSSColor(CSSPropertyBorderColor, attr->value()); } else if (attr->name() == onloadAttr) document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attr)); else if (attr->name() == onbeforeunloadAttr) @@ -147,7 +137,7 @@ void HTMLFrameSetElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onpopstateAttr) document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLFrameSetElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLFrameSetElement.h b/Source/WebCore/html/HTMLFrameSetElement.h index 698897408..187902396 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.h +++ b/Source/WebCore/html/HTMLFrameSetElement.h @@ -67,8 +67,7 @@ public: private: HTMLFrameSetElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); virtual bool rendererIsNeeded(const NodeRenderingContext&); diff --git a/Source/WebCore/html/HTMLFrameSetElement.idl b/Source/WebCore/html/HTMLFrameSetElement.idl index db26410b8..552841208 100644 --- a/Source/WebCore/html/HTMLFrameSetElement.idl +++ b/Source/WebCore/html/HTMLFrameSetElement.idl @@ -21,36 +21,36 @@ module html { interface [ - HasOverridingNameGetter + CustomNamedGetter ] HTMLFrameSetElement : HTMLElement { attribute [Reflect] DOMString cols; attribute [Reflect] DOMString rows; #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C // Event handler attributes - attribute [DontEnum, WindowEventListener] EventListener onbeforeunload; - attribute [DontEnum, WindowEventListener] EventListener onhashchange; - attribute [DontEnum, WindowEventListener] EventListener onmessage; - attribute [DontEnum, WindowEventListener] EventListener onoffline; - attribute [DontEnum, WindowEventListener] EventListener ononline; - attribute [DontEnum, WindowEventListener] EventListener onpopstate; - attribute [DontEnum, WindowEventListener] EventListener onresize; - attribute [DontEnum, WindowEventListener] EventListener onstorage; - attribute [DontEnum, WindowEventListener] EventListener onunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeunload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onhashchange; + attribute [NotEnumerable, JSWindowEventListener] EventListener onmessage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onoffline; + attribute [NotEnumerable, JSWindowEventListener] EventListener ononline; + attribute [NotEnumerable, JSWindowEventListener] EventListener onpopstate; + attribute [NotEnumerable, JSWindowEventListener] EventListener onresize; + attribute [NotEnumerable, JSWindowEventListener] EventListener onstorage; + attribute [NotEnumerable, JSWindowEventListener] EventListener onunload; - attribute [Conditional=ORIENTATION_EVENTS, DontEnum] EventListener onorientationchange; + attribute [Conditional=ORIENTATION_EVENTS, NotEnumerable] EventListener onorientationchange; // Overrides of Element attributes (with different implementation in bindings). - attribute [DontEnum, WindowEventListener] EventListener onblur; - attribute [DontEnum, WindowEventListener] EventListener onerror; - attribute [DontEnum, WindowEventListener] EventListener onfocus; - attribute [DontEnum, WindowEventListener] EventListener onload; + attribute [NotEnumerable, JSWindowEventListener] EventListener onblur; + attribute [NotEnumerable, JSWindowEventListener] EventListener onerror; + attribute [NotEnumerable, JSWindowEventListener] EventListener onfocus; + attribute [NotEnumerable, JSWindowEventListener] EventListener onload; // Not implemented yet. - // attribute [DontEnum, WindowEventListener] EventListener onafterprint; - // attribute [DontEnum, WindowEventListener] EventListener onbeforeprint; - // attribute [DontEnum, WindowEventListener] EventListener onredo; - // attribute [DontEnum, WindowEventListener] EventListener onundo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onafterprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onbeforeprint; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onredo; + // attribute [NotEnumerable, JSWindowEventListener] EventListener onundo; #endif }; diff --git a/Source/WebCore/html/HTMLHRElement.cpp b/Source/WebCore/html/HTMLHRElement.cpp index 44aa05266..5534b929f 100644 --- a/Source/WebCore/html/HTMLHRElement.cpp +++ b/Source/WebCore/html/HTMLHRElement.cpp @@ -48,62 +48,70 @@ PassRefPtr<HTMLHRElement> HTMLHRElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLHRElement(tagName, document)); } -bool HTMLHRElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr || - attrName == widthAttr || - attrName == colorAttr || - attrName == sizeAttr || - attrName == noshadeAttr) { - result = eHR; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLHRElement::parseMappedAttribute(Attribute* attr) +void HTMLHRElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "left")) { - addCSSProperty(attr, CSSPropertyMarginLeft, "0"); - addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto); + if (attr->value().isNull()) { + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + } else if (equalIgnoringCase(attr->value(), "left")) { + addCSSProperty(CSSPropertyMarginLeft, "0"); + addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); } else if (equalIgnoringCase(attr->value(), "right")) { - addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto); - addCSSProperty(attr, CSSPropertyMarginRight, "0"); + addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); + addCSSProperty(CSSPropertyMarginRight, "0"); } else { - addCSSProperty(attr, CSSPropertyMarginLeft, CSSValueAuto); - addCSSProperty(attr, CSSPropertyMarginRight, CSSValueAuto); + addCSSProperty(CSSPropertyMarginLeft, CSSValueAuto); + addCSSProperty(CSSPropertyMarginRight, CSSValueAuto); } } else if (attr->name() == widthAttr) { - bool ok; - int v = attr->value().toInt(&ok); - if (ok && !v) - addCSSLength(attr, CSSPropertyWidth, "1"); - else - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else { + bool ok; + int v = attr->value().toInt(&ok); + if (ok && !v) + addCSSLength(CSSPropertyWidth, "1"); + else + addCSSLength(CSSPropertyWidth, attr->value()); + } } else if (attr->name() == colorAttr) { - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); + else { + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSColor(CSSPropertyBorderColor, attr->value()); + addCSSColor(CSSPropertyBackgroundColor, attr->value()); + } } else if (attr->name() == noshadeAttr) { - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSColor(attr, CSSPropertyBorderColor, String("grey")); - addCSSColor(attr, CSSPropertyBackgroundColor, String("grey")); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderColor, CSSPropertyBackgroundColor); + else { + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSColor(CSSPropertyBorderColor, String("grey")); + addCSSColor(CSSPropertyBackgroundColor, String("grey")); + } } else if (attr->name() == sizeAttr) { - StringImpl* si = attr->value().impl(); - int size = si->toInt(); - if (size <= 1) - addCSSProperty(attr, CSSPropertyBorderBottomWidth, String("0")); - else - addCSSLength(attr, CSSPropertyHeight, String::number(size-2)); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyBorderBottomWidth, CSSPropertyHeight); + else { + StringImpl* si = attr->value().impl(); + int size = si->toInt(); + if (size <= 1) { + addCSSProperty(CSSPropertyBorderBottomWidth, String("0")); + removeCSSProperty(CSSPropertyHeight); + } else { + addCSSLength(CSSPropertyHeight, String::number(size-2)); + removeCSSProperty(CSSPropertyBorderBottomWidth); + } + } } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLHRElement.h b/Source/WebCore/html/HTMLHRElement.h index 37c1190f9..f05085b29 100644 --- a/Source/WebCore/html/HTMLHRElement.h +++ b/Source/WebCore/html/HTMLHRElement.h @@ -36,9 +36,8 @@ public: private: HTMLHRElement(const QualifiedName&, Document*); - - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp index 817b5d749..5cba88842 100644 --- a/Source/WebCore/html/HTMLIFrameElement.cpp +++ b/Source/WebCore/html/HTMLIFrameElement.cpp @@ -48,32 +48,12 @@ PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(const QualifiedName& tag return adoptRef(new HTMLIFrameElement(tagName, document)); } -bool HTMLIFrameElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || attrName == heightAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eReplaced; // Share with <img> since the alignment behavior is the same. - return false; - } - - if (attrName == frameborderAttr) { - result = eReplaced; - return false; - } - - return HTMLFrameElementBase::mapToEntry(attrName, result); -} - -void HTMLIFrameElement::parseMappedAttribute(Attribute* attr) +void HTMLIFrameElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == alignAttr) addHTMLAlignment(attr); else if (attr->name() == nameAttr) { @@ -87,13 +67,15 @@ void HTMLIFrameElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == frameborderAttr) { // Frame border doesn't really match the HTML4 spec definition for iframes. It simply adds // a presentational hint that the border should be off if set to zero. - if (!attr->isNull() && !attr->value().toInt()) + if (!attr->isNull() && !attr->value().toInt()) { // Add a rule that nulls out our border width. - addCSSLength(attr, CSSPropertyBorderWidth, "0"); + addCSSLength(CSSPropertyBorderWidth, "0"); + } else + removeCSSProperty(CSSPropertyBorderWidth); } else if (attr->name() == sandboxAttr) setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value())); else - HTMLFrameElementBase::parseMappedAttribute(attr); + HTMLFrameElementBase::parseAttribute(attr); } bool HTMLIFrameElement::rendererIsNeeded(const NodeRenderingContext& context) diff --git a/Source/WebCore/html/HTMLIFrameElement.h b/Source/WebCore/html/HTMLIFrameElement.h index a7aecf81d..bcba2a257 100644 --- a/Source/WebCore/html/HTMLIFrameElement.h +++ b/Source/WebCore/html/HTMLIFrameElement.h @@ -35,8 +35,7 @@ public: private: HTMLIFrameElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/html/HTMLImageElement.cpp b/Source/WebCore/html/HTMLImageElement.cpp index b5c513de7..6c22edc12 100644 --- a/Source/WebCore/html/HTMLImageElement.cpp +++ b/Source/WebCore/html/HTMLImageElement.cpp @@ -78,26 +78,7 @@ PassRefPtr<HTMLImageElement> HTMLImageElement::createForJSConstructor(Document* return image.release(); } -bool HTMLImageElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == valignAttr) { - result = eUniversal; - return false; - } - - if (attrName == borderAttr || attrName == alignAttr) { - result = eReplaced; // Shared with embed and iframe elements. - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLImageElement::parseMappedAttribute(Attribute* attr) +void HTMLImageElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); if (attrName == altAttr) { @@ -106,22 +87,39 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr) } else if (attrName == srcAttr) m_imageLoader.updateFromElementIgnoringPreviousError(); else if (attrName == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attrName == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attrName == borderAttr) { // border="noborder" -> border="0" applyBorderAttribute(attr); } else if (attrName == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attrName == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->value().isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attrName == alignAttr) addHTMLAlignment(attr); else if (attrName == valignAttr) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyVerticalAlign); + else + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); else if (attrName == usemapAttr) setIsLink(!attr->isNull()); else if (attrName == onabortAttr) @@ -134,7 +132,7 @@ void HTMLImageElement::parseMappedAttribute(Attribute* attr) if (!parseCompositeOperator(attr->value(), m_compositeOperator)) m_compositeOperator = CompositeSourceOver; } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } String HTMLImageElement::altText() const diff --git a/Source/WebCore/html/HTMLImageElement.h b/Source/WebCore/html/HTMLImageElement.h index 8cb3ee901..b24d348bb 100644 --- a/Source/WebCore/html/HTMLImageElement.h +++ b/Source/WebCore/html/HTMLImageElement.h @@ -83,8 +83,7 @@ protected: virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; private: - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/html/HTMLImageElement.idl b/Source/WebCore/html/HTMLImageElement.idl index c6a88ea9d..d893b6c0c 100644 --- a/Source/WebCore/html/HTMLImageElement.idl +++ b/Source/WebCore/html/HTMLImageElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLImageElement : HTMLElement { attribute [Reflect] DOMString name; attribute [Reflect] DOMString align; diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp index 413c1277c..960040fdd 100644 --- a/Source/WebCore/html/HTMLInputElement.cpp +++ b/Source/WebCore/html/HTMLInputElement.cpp @@ -502,7 +502,7 @@ void HTMLInputElement::updateType() if (hadType && !newType->canChangeFromAnotherType()) { // Set the attribute back to the old value. - // Useful in case we were called from inside parseMappedAttribute. + // Useful in case we were called from inside parseAttribute. setAttribute(typeAttr, type()); return; } @@ -545,14 +545,13 @@ void HTMLInputElement::updateType() registerForSuspensionCallbackIfNeeded(); if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) { - NamedNodeMap* map = attributeMap(); - ASSERT(map); - if (Attribute* height = map->getAttributeItem(heightAttr)) - attributeChanged(height, false); - if (Attribute* width = map->getAttributeItem(widthAttr)) - attributeChanged(width, false); - if (Attribute* align = map->getAttributeItem(alignAttr)) - attributeChanged(align, false); + ASSERT(attributeMap()); + if (Attribute* height = getAttributeItem(heightAttr)) + attributeChanged(height); + if (Attribute* width = getAttributeItem(widthAttr)) + attributeChanged(width); + if (Attribute* align = getAttributeItem(alignAttr)) + attributeChanged(align); } if (wasAttached) { @@ -659,31 +658,13 @@ void HTMLInputElement::accessKeyAction(bool sendMouseEvents) m_inputType->accessKeyAction(sendMouseEvents); } -bool HTMLInputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (((attrName == heightAttr || attrName == widthAttr) && m_inputType->shouldRespectHeightAndWidthAttributes()) - || attrName == vspaceAttr - || attrName == hspaceAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr && m_inputType->shouldRespectAlignAttribute()) { - // Share with <img> since the alignment behavior is the same. - result = eReplaced; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLInputElement::parseMappedAttribute(Attribute* attr) +void HTMLInputElement::parseAttribute(Attribute* attr) { if (attr->name() == nameAttr) { checkedRadioButtons().removeButton(this); m_name = attr->value(); checkedRadioButtons().addButton(this); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } else if (attr->name() == autocompleteAttr) { if (equalIgnoringCase(attr->value(), "off")) { m_autocomplete = Off; @@ -733,20 +714,26 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == usemapAttr || attr->name() == accesskeyAttr) { // FIXME: ignore for the moment } else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); } else if (attr->name() == alignAttr) { if (m_inputType->shouldRespectAlignAttribute()) addHTMLAlignment(attr); + else + removeHTMLAlignment(); } else if (attr->name() == widthAttr) { if (m_inputType->shouldRespectHeightAndWidthAttributes()) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); + else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (m_inputType->shouldRespectHeightAndWidthAttributes()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else if (attr->name() == borderAttr && isImageButton()) { applyBorderAttribute(attr); } else if (attr->name() == onsearchAttr) { @@ -775,10 +762,10 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) setNeedsValidityCheck(); else if (attr->name() == disabledAttr) { m_inputType->disabledAttributeChanged(); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } else if (attr->name() == readonlyAttr) { m_inputType->readonlyAttributeChanged(); - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } #if ENABLE(DATALIST) else if (attr->name() == listAttr) @@ -805,7 +792,7 @@ void HTMLInputElement::parseMappedAttribute(Attribute* attr) setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, attr)); #endif else - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); updateInnerTextValue(); } @@ -946,7 +933,7 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) void HTMLInputElement::setIndeterminate(bool newValue) { - if (!m_inputType->isCheckable() || indeterminate() == newValue) + if (indeterminate() == newValue) return; m_isIndeterminate = newValue; @@ -1256,13 +1243,6 @@ void HTMLInputElement::setDefaultValue(const String &value) setAttribute(valueAttr, value); } -void HTMLInputElement::setInitialName(const AtomicString& name) -{ - ASSERT(hasTagName(isindexTag)); - ASSERT(m_name.isNull()); - m_name = name; -} - static inline bool isRFC2616TokenCharacter(UChar ch) { return isASCII(ch) && ch > ' ' && ch != '"' && ch != '(' && ch != ')' && ch != ',' && ch != '/' && (ch < ':' || ch > '@') && (ch < '[' || ch > ']') && ch != '{' && ch != '}' && ch != 0x7f; @@ -1829,4 +1809,9 @@ String HTMLInputElement::defaultToolTip() const return m_inputType->defaultToolTip(); } +bool HTMLInputElement::isIndeterminate() const +{ + return m_inputType->supportsIndeterminateAppearance() && indeterminate(); +} + } // namespace diff --git a/Source/WebCore/html/HTMLInputElement.h b/Source/WebCore/html/HTMLInputElement.h index 47ac4d326..b6fa0f623 100644 --- a/Source/WebCore/html/HTMLInputElement.h +++ b/Source/WebCore/html/HTMLInputElement.h @@ -128,7 +128,7 @@ public: void setIndeterminate(bool); // shouldAppearChecked is used by the rendering tree/CSS while checked() is used by JS to determine checked state bool shouldAppearChecked() const; - virtual bool isIndeterminate() const { return indeterminate(); } + virtual bool isIndeterminate() const; int size() const; bool sizeShouldIncludeDecoration(int& preferredSize) const; @@ -241,7 +241,6 @@ public: protected: HTMLInputElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); void createShadowSubtree(); - void setInitialName(const AtomicString&); virtual void defaultEventHandler(Event*); private: @@ -276,8 +275,7 @@ private: virtual void accessKeyAction(bool sendMouseEvents); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void finishParsingChildren(); virtual void copyNonAttributeProperties(const Element* source); diff --git a/Source/WebCore/html/HTMLInputElement.idl b/Source/WebCore/html/HTMLInputElement.idl index bedeb9ae4..4e218b96c 100644 --- a/Source/WebCore/html/HTMLInputElement.idl +++ b/Source/WebCore/html/HTMLInputElement.idl @@ -21,13 +21,13 @@ module html { interface HTMLInputElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString defaultValue; attribute [Reflect=checked] boolean defaultChecked; attribute [Reflect] DOMString dirName; readonly attribute HTMLFormElement form; attribute [Reflect, URL] DOMString formAction; - attribute [TreatNullAs=EmptyString] DOMString formEnctype; - attribute [TreatNullAs=EmptyString] DOMString formMethod; + attribute [TreatNullAs=NullString] DOMString formEnctype; + attribute [TreatNullAs=NullString] DOMString formMethod; attribute [Reflect] boolean formNoValidate; attribute [Reflect] DOMString formTarget; readonly attribute ValidityState validity; @@ -50,16 +50,15 @@ module html { attribute [Reflect] boolean readOnly; attribute [Reflect] boolean required; #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C - attribute [ConvertToString] DOMString size; // DOM level 2 changed this to a long, but our existing API is a string + attribute [ObjCImplementedAsUnsignedLong] DOMString size; // DOM level 2 changed this to a long, but ObjC API is a string #else - // FIXME: The spec says this should be a long, not an unsigned long. - attribute unsigned long size; // Changed string -> long as part of DOM level 2 + attribute unsigned long size; // Changed string -> long -> unsigned long #endif attribute [Reflect, URL] DOMString src; attribute [Reflect] DOMString step; - attribute [TreatNullAs=EmptyString] DOMString type; // readonly dropped as part of DOM level 2 + attribute [TreatNullAs=NullString] DOMString type; // readonly dropped as part of DOM level 2 attribute [Reflect] DOMString useMap; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute Date valueAsDate setter raises(DOMException); #endif @@ -73,12 +72,12 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); void select(); void click(); #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT - void setValueForUser(in [TreatNullAs=EmptyString] DOMString value); + void setValueForUser(in [TreatNullAs=NullString] DOMString value); #endif // WinIE extension: @@ -105,9 +104,9 @@ module html { readonly attribute FileList files; readonly attribute NodeList labels; - attribute [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime] boolean webkitSpeech; - attribute [Conditional=INPUT_SPEECH, Reflect, EnabledAtRuntime] boolean webkitGrammar; - attribute [Conditional=INPUT_SPEECH, DontEnum] EventListener onwebkitspeechchange; + attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitSpeech; + attribute [Conditional=INPUT_SPEECH, Reflect, V8EnabledAtRuntime] boolean webkitGrammar; + attribute [Conditional=INPUT_SPEECH, NotEnumerable] EventListener onwebkitspeechchange; }; } diff --git a/Source/WebCore/html/HTMLKeygenElement.cpp b/Source/WebCore/html/HTMLKeygenElement.cpp index 11b7e92ef..85252819a 100644 --- a/Source/WebCore/html/HTMLKeygenElement.cpp +++ b/Source/WebCore/html/HTMLKeygenElement.cpp @@ -85,7 +85,9 @@ inline HTMLKeygenElement::HTMLKeygenElement(const QualifiedName& tagName, Docume option->appendChild(Text::create(document, keys[i]), ec); } - ensureShadowRoot()->appendChild(select, ec); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(select, ec); } PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form) @@ -93,13 +95,13 @@ PassRefPtr<HTMLKeygenElement> HTMLKeygenElement::create(const QualifiedName& tag return adoptRef(new HTMLKeygenElement(tagName, document, form)); } -void HTMLKeygenElement::parseMappedAttribute(Attribute* attr) +void HTMLKeygenElement::parseAttribute(Attribute* attr) { // Reflect disabled attribute on the shadow select element if (attr->name() == disabledAttr) shadowSelect()->setAttribute(attr->name(), attr->value()); - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool) diff --git a/Source/WebCore/html/HTMLKeygenElement.h b/Source/WebCore/html/HTMLKeygenElement.h index cc477d692..c793cb120 100644 --- a/Source/WebCore/html/HTMLKeygenElement.h +++ b/Source/WebCore/html/HTMLKeygenElement.h @@ -41,7 +41,7 @@ private: virtual bool canStartSelection() const { return false; } - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool appendFormData(FormDataList&, bool); virtual const AtomicString& formControlType() const; diff --git a/Source/WebCore/html/HTMLKeygenElement.idl b/Source/WebCore/html/HTMLKeygenElement.idl index c34a92582..914fb99b0 100644 --- a/Source/WebCore/html/HTMLKeygenElement.idl +++ b/Source/WebCore/html/HTMLKeygenElement.idl @@ -44,7 +44,7 @@ module html { readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); readonly attribute NodeList labels; }; diff --git a/Source/WebCore/html/HTMLLIElement.cpp b/Source/WebCore/html/HTMLLIElement.cpp index 32886cbe9..f789d32fe 100644 --- a/Source/WebCore/html/HTMLLIElement.cpp +++ b/Source/WebCore/html/HTMLLIElement.cpp @@ -49,36 +49,28 @@ PassRefPtr<HTMLLIElement> HTMLLIElement::create(const QualifiedName& tagName, Do return adoptRef(new HTMLLIElement(tagName, document)); } -bool HTMLLIElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eListItem; // Share with <ol> since all the values are the same - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLLIElement::parseMappedAttribute(Attribute* attr) +void HTMLLIElement::parseAttribute(Attribute* attr) { if (attr->name() == valueAttr) { if (renderer() && renderer()->isListItem()) parseValue(attr->value()); } else if (attr->name() == typeAttr) { - if (attr->value() == "a") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyListStyleType); + else if (attr->value() == "a") + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); else if (attr->value() == "A") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); else if (attr->value() == "i") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); else if (attr->value() == "I") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); else if (attr->value() == "1") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueDecimal); + addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); else - addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); + addCSSProperty(CSSPropertyListStyleType, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLLIElement::attach() diff --git a/Source/WebCore/html/HTMLLIElement.h b/Source/WebCore/html/HTMLLIElement.h index 7e6a95370..77a90e801 100644 --- a/Source/WebCore/html/HTMLLIElement.h +++ b/Source/WebCore/html/HTMLLIElement.h @@ -35,8 +35,7 @@ public: private: HTMLLIElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); diff --git a/Source/WebCore/html/HTMLLabelElement.cpp b/Source/WebCore/html/HTMLLabelElement.cpp index 318fe88da..b4748d626 100644 --- a/Source/WebCore/html/HTMLLabelElement.cpp +++ b/Source/WebCore/html/HTMLLabelElement.cpp @@ -154,7 +154,7 @@ void HTMLLabelElement::accessKeyAction(bool sendMouseEvents) HTMLElement::accessKeyAction(sendMouseEvents); } -void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) +void HTMLLabelElement::parseAttribute(Attribute* attribute) { if (attribute->name() == forAttr) { // htmlFor attribute change affects other nodes than this. @@ -162,7 +162,7 @@ void HTMLLabelElement::parseMappedAttribute(Attribute* attribute) if (document()) document()->notifyLocalNodeListsLabelChanged(); } else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } } // namespace diff --git a/Source/WebCore/html/HTMLLabelElement.h b/Source/WebCore/html/HTMLLabelElement.h index 2f8497839..526379cd0 100644 --- a/Source/WebCore/html/HTMLLabelElement.h +++ b/Source/WebCore/html/HTMLLabelElement.h @@ -51,7 +51,7 @@ private: void focus(bool restorePreviousSelection = true); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLLinkElement.cpp b/Source/WebCore/html/HTMLLinkElement.cpp index fa54279ca..1d6536fc5 100644 --- a/Source/WebCore/html/HTMLLinkElement.cpp +++ b/Source/WebCore/html/HTMLLinkElement.cpp @@ -119,7 +119,7 @@ void HTMLLinkElement::setDisabledState(bool disabled) } } -void HTMLLinkElement::parseMappedAttribute(Attribute* attr) +void HTMLLinkElement::parseAttribute(Attribute* attr) { if (attr->name() == relAttr) { m_relAttribute = LinkRelAttribute(attr->value()); @@ -150,7 +150,7 @@ void HTMLLinkElement::parseMappedAttribute(Attribute* attr) else { if (attr->name() == titleAttr && m_sheet) m_sheet->setTitle(attr->value()); - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLLinkElement.h b/Source/WebCore/html/HTMLLinkElement.h index d67a0774f..b99b62949 100644 --- a/Source/WebCore/html/HTMLLinkElement.h +++ b/Source/WebCore/html/HTMLLinkElement.h @@ -61,7 +61,7 @@ public: DOMSettableTokenList* sizes() const; private: - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool shouldLoadLink(); void process(); diff --git a/Source/WebCore/html/HTMLMapElement.cpp b/Source/WebCore/html/HTMLMapElement.cpp index bf4a3b333..2e467137a 100644 --- a/Source/WebCore/html/HTMLMapElement.cpp +++ b/Source/WebCore/html/HTMLMapElement.cpp @@ -98,7 +98,7 @@ HTMLImageElement* HTMLMapElement::imageElement() return 0; } -void HTMLMapElement::parseMappedAttribute(Attribute* attribute) +void HTMLMapElement::parseAttribute(Attribute* attribute) { // FIXME: This logic seems wrong for XML documents. // Either the id or name will be used depending on the order the attributes are parsed. @@ -107,7 +107,7 @@ void HTMLMapElement::parseMappedAttribute(Attribute* attribute) if (isIdAttributeName(attrName) || attrName == nameAttr) { if (isIdAttributeName(attrName)) { // Call base class so that hasID bit gets set. - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); if (document()->isHTMLDocument()) return; } @@ -123,7 +123,7 @@ void HTMLMapElement::parseMappedAttribute(Attribute* attribute) return; } - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } HTMLCollection* HTMLMapElement::areas() diff --git a/Source/WebCore/html/HTMLMapElement.h b/Source/WebCore/html/HTMLMapElement.h index 925895cab..8aad96fa0 100644 --- a/Source/WebCore/html/HTMLMapElement.h +++ b/Source/WebCore/html/HTMLMapElement.h @@ -46,7 +46,7 @@ public: private: HTMLMapElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/html/HTMLMarqueeElement.cpp b/Source/WebCore/html/HTMLMarqueeElement.cpp index 053ffa892..1d883b409 100644 --- a/Source/WebCore/html/HTMLMarqueeElement.cpp +++ b/Source/WebCore/html/HTMLMarqueeElement.cpp @@ -51,69 +51,67 @@ PassRefPtr<HTMLMarqueeElement> HTMLMarqueeElement::create(const QualifiedName& t return adoptRef(new HTMLMarqueeElement(tagName, document)); } -bool HTMLMarqueeElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == bgcolorAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == scrollamountAttr || - attrName == scrolldelayAttr || - attrName == loopAttr || - attrName == behaviorAttr || - attrName == directionAttr) { - result = eUniversal; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLMarqueeElement::parseMappedAttribute(Attribute* attr) +void HTMLMarqueeElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); + else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else if (attr->name() == bgcolorAttr) { if (!attr->value().isEmpty()) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + addCSSColor(CSSPropertyBackgroundColor, attr->value()); + else + removeCSSProperty(CSSPropertyBackgroundColor); } else if (attr->name() == vspaceAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); - } + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } else + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); } else if (attr->name() == hspaceAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); - } + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } else + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); } else if (attr->name() == scrollamountAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWebkitMarqueeIncrement, attr->value()); + addCSSLength(CSSPropertyWebkitMarqueeIncrement, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeIncrement); } else if (attr->name() == scrolldelayAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyWebkitMarqueeSpeed, attr->value()); + addCSSLength(CSSPropertyWebkitMarqueeSpeed, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeSpeed); } else if (attr->name() == loopAttr) { if (!attr->value().isEmpty()) { if (attr->value() == "-1" || equalIgnoringCase(attr->value(), "infinite")) - addCSSProperty(attr, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite); + addCSSProperty(CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite); else - addCSSLength(attr, CSSPropertyWebkitMarqueeRepetition, attr->value()); - } + addCSSLength(CSSPropertyWebkitMarqueeRepetition, attr->value()); + } else + removeCSSProperty(CSSPropertyWebkitMarqueeRepetition); } else if (attr->name() == behaviorAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyWebkitMarqueeStyle, attr->value()); + addCSSProperty(CSSPropertyWebkitMarqueeStyle, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeStyle); } else if (attr->name() == directionAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyWebkitMarqueeDirection, attr->value()); + addCSSProperty(CSSPropertyWebkitMarqueeDirection, attr->value()); + else + removeCSSProperty(CSSPropertyWebkitMarqueeDirection); } else if (attr->name() == truespeedAttr) m_minimumDelay = !attr->isEmpty() ? 0 : defaultMinimumDelay; else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMarqueeElement::start() diff --git a/Source/WebCore/html/HTMLMarqueeElement.h b/Source/WebCore/html/HTMLMarqueeElement.h index 586aa6fde..d1e3070d2 100644 --- a/Source/WebCore/html/HTMLMarqueeElement.h +++ b/Source/WebCore/html/HTMLMarqueeElement.h @@ -53,8 +53,7 @@ public: private: HTMLMarqueeElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; // ActiveDOMObject virtual bool canSuspend() const; diff --git a/Source/WebCore/html/HTMLMediaElement.cpp b/Source/WebCore/html/HTMLMediaElement.cpp index e8bb788d6..7e664840b 100644 --- a/Source/WebCore/html/HTMLMediaElement.cpp +++ b/Source/WebCore/html/HTMLMediaElement.cpp @@ -315,9 +315,14 @@ bool HTMLMediaElement::supportsFocus() const return controls() || HTMLElement::supportsFocus(); } -void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls) +bool HTMLMediaElement::isMouseFocusable() const { - HTMLElement::attributeChanged(attr, preserveDecls); + return false; +} + +void HTMLMediaElement::attributeChanged(Attribute* attr) +{ + HTMLElement::attributeChanged(attr); const QualifiedName& attrName = attr->name(); if (attrName == srcAttr) { @@ -332,7 +337,7 @@ void HTMLMediaElement::attributeChanged(Attribute* attr, bool preserveDecls) #endif } -void HTMLMediaElement::parseMappedAttribute(Attribute* attr) +void HTMLMediaElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -406,7 +411,7 @@ void HTMLMediaElement::parseMappedAttribute(Attribute* attr) else if (attrName == onwebkitendfullscreenAttr) setAttributeEventListener(eventNames().webkitendfullscreenEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMediaElement::finishParsingChildren() diff --git a/Source/WebCore/html/HTMLMediaElement.h b/Source/WebCore/html/HTMLMediaElement.h index 98fdf5a0f..76c24cbab 100644 --- a/Source/WebCore/html/HTMLMediaElement.h +++ b/Source/WebCore/html/HTMLMediaElement.h @@ -301,7 +301,7 @@ protected: HTMLMediaElement(const QualifiedName&, Document*, bool); virtual ~HTMLMediaElement(); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void finishParsingChildren(); virtual bool isURLAttribute(Attribute*) const; virtual void attach(); @@ -336,7 +336,8 @@ private: void createMediaPlayer(); virtual bool supportsFocus() const; - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual bool isMouseFocusable() const; + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/html/HTMLMediaElement.idl b/Source/WebCore/html/HTMLMediaElement.idl index 484d574e8..4260c2025 100644 --- a/Source/WebCore/html/HTMLMediaElement.idl +++ b/Source/WebCore/html/HTMLMediaElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO, - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLMediaElement : HTMLElement { // error state @@ -93,31 +93,31 @@ module html { #if defined(ENABLE_MEDIA_SOURCE) && ENABLE_MEDIA_SOURCE // URL passed to src attribute to enable the media source logic. - readonly attribute [EnabledAtRuntime=webkitMediaSource, URL] DOMString webkitMediaSourceURL; + readonly attribute [V8EnabledAtRuntime=webkitMediaSource, URL] DOMString webkitMediaSourceURL; // Appends media to to the source. - [EnabledAtRuntime=webkitMediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); + [V8EnabledAtRuntime=webkitMediaSource] void webkitSourceAppend(in Uint8Array data) raises (DOMException); // Signals the end of stream. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream. - const [EnabledAtRuntime=webkitMediaSource] unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream. - [EnabledAtRuntime=webkitMediaSource] void webkitSourceEndOfStream(in unsigned short status) raises (DOMException); + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NO_ERROR = 0; // End of stream reached w/o error. + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_NETWORK_ERR = 1; // A network error triggered end of stream. + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short EOS_DECODE_ERR = 2; // A decode error triggered end of stream. + [V8EnabledAtRuntime=webkitMediaSource] void webkitSourceEndOfStream(in unsigned short status) raises (DOMException); // Indicates the current state of the media source. - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_CLOSED = 0; - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_OPEN = 1; - const [EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_ENDED = 2; - readonly attribute [EnabledAtRuntime=webkitMediaSource] unsigned short webkitSourceState; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_CLOSED = 0; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_OPEN = 1; + const [V8EnabledAtRuntime=webkitMediaSource] unsigned short SOURCE_ENDED = 2; + readonly attribute [V8EnabledAtRuntime=webkitMediaSource] unsigned short webkitSourceState; #endif #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK - [EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) + [V8EnabledAtRuntime=webkitVideoTrack] TextTrack addTextTrack(in DOMString kind, in [Optional] DOMString label, in [Optional] DOMString language) raises (DOMException); - readonly attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; + readonly attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackList textTracks; #endif - attribute [Reflect, TreatNullAs=EmptyString, ConvertNullStringToNull] DOMString mediaGroup; + attribute [Reflect, TreatNullAs=NullString, ConvertNullStringToNull] DOMString mediaGroup; attribute [CustomSetter] MediaController controller; }; } diff --git a/Source/WebCore/html/HTMLMetaElement.cpp b/Source/WebCore/html/HTMLMetaElement.cpp index 213ae15b1..fd1f40392 100644 --- a/Source/WebCore/html/HTMLMetaElement.cpp +++ b/Source/WebCore/html/HTMLMetaElement.cpp @@ -42,7 +42,7 @@ PassRefPtr<HTMLMetaElement> HTMLMetaElement::create(const QualifiedName& tagName return adoptRef(new HTMLMetaElement(tagName, document)); } -void HTMLMetaElement::parseMappedAttribute(Attribute* attr) +void HTMLMetaElement::parseAttribute(Attribute* attr) { if (attr->name() == http_equivAttr) process(); @@ -51,7 +51,7 @@ void HTMLMetaElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == nameAttr) { // Do nothing } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLMetaElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLMetaElement.h b/Source/WebCore/html/HTMLMetaElement.h index df4d7e1f9..7fe03efa3 100644 --- a/Source/WebCore/html/HTMLMetaElement.h +++ b/Source/WebCore/html/HTMLMetaElement.h @@ -38,7 +38,7 @@ public: private: HTMLMetaElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); void process(); diff --git a/Source/WebCore/html/HTMLMeterElement.cpp b/Source/WebCore/html/HTMLMeterElement.cpp index 011a669e0..a1fdaf6c7 100644 --- a/Source/WebCore/html/HTMLMeterElement.cpp +++ b/Source/WebCore/html/HTMLMeterElement.cpp @@ -71,12 +71,12 @@ bool HTMLMeterElement::supportsFocus() const return Node::supportsFocus() && !disabled(); } -void HTMLMeterElement::parseMappedAttribute(Attribute* attribute) +void HTMLMeterElement::parseAttribute(Attribute* attribute) { if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr) didElementStateChange(); else - HTMLFormControlElement::parseMappedAttribute(attribute); + HTMLFormControlElement::parseAttribute(attribute); } void HTMLMeterElement::attach() @@ -234,11 +234,15 @@ void HTMLMeterElement::didElementStateChange() void HTMLMeterElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr<MeterBarElement> bar = MeterBarElement::create(document()); m_value = MeterValueElement::create(document()); ExceptionCode ec = 0; bar->appendChild(m_value, ec); - ensureShadowRoot()->appendChild(bar, ec); + + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(bar, ec); } } // namespace diff --git a/Source/WebCore/html/HTMLMeterElement.h b/Source/WebCore/html/HTMLMeterElement.h index c1c02cd49..fb71bc922 100644 --- a/Source/WebCore/html/HTMLMeterElement.h +++ b/Source/WebCore/html/HTMLMeterElement.h @@ -70,7 +70,7 @@ private: virtual bool recalcWillValidate() const { return false; } virtual const AtomicString& formControlType() const; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); void didElementStateChange(); diff --git a/Source/WebCore/html/HTMLOListElement.cpp b/Source/WebCore/html/HTMLOListElement.cpp index d90a2f772..2bfa2ff43 100644 --- a/Source/WebCore/html/HTMLOListElement.cpp +++ b/Source/WebCore/html/HTMLOListElement.cpp @@ -54,29 +54,21 @@ PassRefPtr<HTMLOListElement> HTMLOListElement::create(const QualifiedName& tagNa return adoptRef(new HTMLOListElement(tagName, document)); } -bool HTMLOListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eListItem; // Share with <li> - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLOListElement::parseMappedAttribute(Attribute* attr) +void HTMLOListElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) { if (attr->value() == "a") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerAlpha); else if (attr->value() == "A") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperAlpha); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperAlpha); else if (attr->value() == "i") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueLowerRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueLowerRoman); else if (attr->value() == "I") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueUpperRoman); + addCSSProperty(CSSPropertyListStyleType, CSSValueUpperRoman); else if (attr->value() == "1") - addCSSProperty(attr, CSSPropertyListStyleType, CSSValueDecimal); + addCSSProperty(CSSPropertyListStyleType, CSSValueDecimal); + else + removeCSSProperty(CSSPropertyListStyleType); } else if (attr->name() == startAttr) { int oldStart = start(); bool canParse; @@ -93,7 +85,7 @@ void HTMLOListElement::parseMappedAttribute(Attribute* attr) m_isReversed = reversed; updateItemValues(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLOListElement::setStart(int start) diff --git a/Source/WebCore/html/HTMLOListElement.h b/Source/WebCore/html/HTMLOListElement.h index 8000b28bc..0731fb007 100644 --- a/Source/WebCore/html/HTMLOListElement.h +++ b/Source/WebCore/html/HTMLOListElement.h @@ -53,8 +53,7 @@ private: void recalculateItemCount(); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; int m_start; unsigned m_itemCount; diff --git a/Source/WebCore/html/HTMLObjectElement.cpp b/Source/WebCore/html/HTMLObjectElement.cpp index 590d69b98..e2bef0157 100644 --- a/Source/WebCore/html/HTMLObjectElement.cpp +++ b/Source/WebCore/html/HTMLObjectElement.cpp @@ -77,7 +77,7 @@ RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() return renderPart(); // This will return 0 if the renderer is not a RenderPart. } -void HTMLObjectElement::parseMappedAttribute(Attribute* attr) +void HTMLObjectElement::parseAttribute(Attribute* attr) { if (attr->name() == formAttr) formAttributeChanged(); @@ -111,7 +111,7 @@ void HTMLObjectElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == borderAttr) applyBorderAttribute(attr); else - HTMLPlugInImageElement::parseMappedAttribute(attr); + HTMLPlugInImageElement::parseAttribute(attr); } static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues) @@ -177,10 +177,9 @@ void HTMLObjectElement::parametersForPlugin(Vector<String>& paramNames, Vector<S } // Turn the attributes of the <object> element into arrays, but don't override <param> values. - NamedNodeMap* attributes = updatedAttributes(); - if (attributes) { - for (unsigned i = 0; i < attributes->length(); ++i) { - Attribute* it = attributes->attributeItem(i); + if (hasAttributes()) { + for (unsigned i = 0; i < attributeCount(); ++i) { + Attribute* it = attributeItem(i); const AtomicString& name = it->name().localName(); if (!uniqueParamNames.contains(name.impl())) { paramNames.append(name.string()); @@ -286,8 +285,14 @@ void HTMLObjectElement::updateWidget(PluginCreationOption pluginCreationOption) bool fallbackContent = hasFallbackContent(); renderEmbeddedObject()->setHasFallbackContent(fallbackContent); - if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) + // FIXME: It's sadness that we have this special case here. + // See http://trac.webkit.org/changeset/25128 and + // plugins/netscape-plugin-setwindow-size.html + if (pluginCreationOption == CreateOnlyNonNetscapePlugins && wouldLoadAsNetscapePlugin(url, serviceType)) { + // Ensure updateWidget() is called again during layout to create the Netscape plug-in. + setNeedsWidgetUpdate(true); return; + } RefPtr<HTMLObjectElement> protect(this); // beforeload and plugin loading can make arbitrary DOM mutations. bool beforeLoadAllowedLoad = guardedDispatchBeforeLoadEvent(url); diff --git a/Source/WebCore/html/HTMLObjectElement.h b/Source/WebCore/html/HTMLObjectElement.h index 2878039fe..85bf16f8b 100644 --- a/Source/WebCore/html/HTMLObjectElement.h +++ b/Source/WebCore/html/HTMLObjectElement.h @@ -66,7 +66,7 @@ public: private: HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoTree(bool deep); virtual void removedFromTree(bool deep); diff --git a/Source/WebCore/html/HTMLObjectElement.idl b/Source/WebCore/html/HTMLObjectElement.idl index 27e998a1b..4553fbc06 100644 --- a/Source/WebCore/html/HTMLObjectElement.idl +++ b/Source/WebCore/html/HTMLObjectElement.idl @@ -21,8 +21,8 @@ module html { interface [ - DelegatingPutFunction, - DelegatingGetOwnPropertySlot, + CustomNamedSetter, + JSCustomGetOwnPropertySlotDelegate, CustomCall ] HTMLObjectElement : HTMLElement { readonly attribute HTMLFormElement form; @@ -46,7 +46,7 @@ module html { readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // Introduced in DOM Level 2: readonly attribute [CheckAccessToNode] Document contentDocument; diff --git a/Source/WebCore/html/HTMLOptGroupElement.cpp b/Source/WebCore/html/HTMLOptGroupElement.cpp index dfc6d8d19..3213842f0 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.cpp +++ b/Source/WebCore/html/HTMLOptGroupElement.cpp @@ -72,9 +72,9 @@ void HTMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChan HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLOptGroupElement::parseMappedAttribute(Attribute* attr) +void HTMLOptGroupElement::parseAttribute(Attribute* attr) { - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); recalcSelectOptions(); } diff --git a/Source/WebCore/html/HTMLOptGroupElement.h b/Source/WebCore/html/HTMLOptGroupElement.h index 3d8dd1753..85d531e43 100644 --- a/Source/WebCore/html/HTMLOptGroupElement.h +++ b/Source/WebCore/html/HTMLOptGroupElement.h @@ -44,7 +44,7 @@ private: virtual const AtomicString& formControlType() const; virtual bool supportsFocus() const; virtual bool isFocusable() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } virtual void attach(); virtual void detach(); diff --git a/Source/WebCore/html/HTMLOptionElement.cpp b/Source/WebCore/html/HTMLOptionElement.cpp index 9654d674b..73f6ffa91 100644 --- a/Source/WebCore/html/HTMLOptionElement.cpp +++ b/Source/WebCore/html/HTMLOptionElement.cpp @@ -187,7 +187,7 @@ int HTMLOptionElement::index() const return 0; } -void HTMLOptionElement::parseMappedAttribute(Attribute* attr) +void HTMLOptionElement::parseAttribute(Attribute* attr) { if (attr->name() == selectedAttr) { // FIXME: This doesn't match what the HTML specification says. @@ -198,7 +198,7 @@ void HTMLOptionElement::parseMappedAttribute(Attribute* attr) // case; we'd need to do the other work from the setSelected function. m_isSelected = !attr->isNull(); } else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } String HTMLOptionElement::value() const diff --git a/Source/WebCore/html/HTMLOptionElement.h b/Source/WebCore/html/HTMLOptionElement.h index 19a8abd76..2eedadf1f 100644 --- a/Source/WebCore/html/HTMLOptionElement.h +++ b/Source/WebCore/html/HTMLOptionElement.h @@ -74,7 +74,7 @@ private: virtual const AtomicString& formControlType() const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoTree(bool); virtual void accessKeyAction(bool); diff --git a/Source/WebCore/html/HTMLOptionElement.idl b/Source/WebCore/html/HTMLOptionElement.idl index fb84a8ec8..73e9c3bdf 100644 --- a/Source/WebCore/html/HTMLOptionElement.idl +++ b/Source/WebCore/html/HTMLOptionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter, + JSGenerateToNativeObject, NamedConstructor=Option(in [Optional=CallWithNullValue] DOMString data, in [Optional=CallWithNullValue] DOMString value, in [Optional=CallWithDefaultValue] boolean defaultSelected, in [Optional=CallWithDefaultValue] boolean selected), ConstructorRaisesException ] HTMLOptionElement : HTMLElement { diff --git a/Source/WebCore/html/HTMLOptionsCollection.idl b/Source/WebCore/html/HTMLOptionsCollection.idl index 7d1f27458..b28643994 100644 --- a/Source/WebCore/html/HTMLOptionsCollection.idl +++ b/Source/WebCore/html/HTMLOptionsCollection.idl @@ -21,8 +21,8 @@ module html { interface [ - GenerateNativeConverter, - HasCustomIndexSetter + JSGenerateToNativeObject, + CustomIndexedSetter ] HTMLOptionsCollection : HTMLCollection { attribute long selectedIndex; attribute [Custom] unsigned long length diff --git a/Source/WebCore/html/HTMLOutputElement.cpp b/Source/WebCore/html/HTMLOutputElement.cpp index ee3c0d852..ccad10741 100644 --- a/Source/WebCore/html/HTMLOutputElement.cpp +++ b/Source/WebCore/html/HTMLOutputElement.cpp @@ -61,22 +61,12 @@ bool HTMLOutputElement::supportsFocus() const return Node::supportsFocus() && !disabled(); } -bool HTMLOutputElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == HTMLNames::dirAttr) { - result = eBDI; - return true; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLOutputElement::parseMappedAttribute(Attribute* attr) +void HTMLOutputElement::parseAttribute(Attribute* attr) { if (attr->name() == HTMLNames::forAttr) setFor(attr->value()); else - HTMLFormControlElement::parseMappedAttribute(attr); + HTMLFormControlElement::parseAttribute(attr); } DOMSettableTokenList* HTMLOutputElement::htmlFor() const diff --git a/Source/WebCore/html/HTMLOutputElement.h b/Source/WebCore/html/HTMLOutputElement.h index 83df7fae7..4a94e4e3d 100644 --- a/Source/WebCore/html/HTMLOutputElement.h +++ b/Source/WebCore/html/HTMLOutputElement.h @@ -55,8 +55,7 @@ public: private: HTMLOutputElement(const QualifiedName&, Document*, HTMLFormElement*); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const OVERRIDE; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual const AtomicString& formControlType() const; virtual bool isEnumeratable() const { return true; } virtual bool supportsFocus() const; diff --git a/Source/WebCore/html/HTMLOutputElement.idl b/Source/WebCore/html/HTMLOutputElement.idl index 378ae53de..35761c335 100644 --- a/Source/WebCore/html/HTMLOutputElement.idl +++ b/Source/WebCore/html/HTMLOutputElement.idl @@ -29,14 +29,14 @@ module html { attribute [Reflect] DOMString name; readonly attribute DOMString type; - attribute [TreatNullAs=EmptyString] DOMString defaultValue; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString value; readonly attribute boolean willValidate; readonly attribute ValidityState validity; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); readonly attribute NodeList labels; }; diff --git a/Source/WebCore/html/HTMLParagraphElement.cpp b/Source/WebCore/html/HTMLParagraphElement.cpp index e8a5aa70f..6cc9f51b8 100644 --- a/Source/WebCore/html/HTMLParagraphElement.cpp +++ b/Source/WebCore/html/HTMLParagraphElement.cpp @@ -44,28 +44,21 @@ PassRefPtr<HTMLParagraphElement> HTMLParagraphElement::create(const QualifiedNam return adoptRef(new HTMLParagraphElement(tagName, document)); } -bool HTMLParagraphElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eBlock; // We can share with DIV here. - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLParagraphElement::parseMappedAttribute(Attribute* attr) +void HTMLParagraphElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { - if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(attr->value(), "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(attr->value(), "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, attr->value()); + addCSSProperty(CSSPropertyTextAlign, attr->value()); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLParagraphElement.h b/Source/WebCore/html/HTMLParagraphElement.h index 6dbf07110..0c8c290bb 100644 --- a/Source/WebCore/html/HTMLParagraphElement.h +++ b/Source/WebCore/html/HTMLParagraphElement.h @@ -34,8 +34,7 @@ public: private: HTMLParagraphElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLParamElement.cpp b/Source/WebCore/html/HTMLParamElement.cpp index aa228bc31..c0f919951 100644 --- a/Source/WebCore/html/HTMLParamElement.cpp +++ b/Source/WebCore/html/HTMLParamElement.cpp @@ -47,11 +47,11 @@ bool HTMLParamElement::isURLParameter(const String& name) return equalIgnoringCase(name, "data") || equalIgnoringCase(name, "movie") || equalIgnoringCase(name, "src"); } -void HTMLParamElement::parseMappedAttribute(Attribute* attr) +void HTMLParamElement::parseAttribute(Attribute* attr) { if (isIdAttributeName(attr->name())) { // Must call base class so that hasID bit gets set. - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); if (document()->isHTMLDocument()) return; m_name = attr->value(); @@ -60,13 +60,13 @@ void HTMLParamElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == valueAttr) { m_value = attr->value(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } bool HTMLParamElement::isURLAttribute(Attribute* attr) const { if (attr->name() == valueAttr && hasAttributes()) { - Attribute* nameAttribute = attributeMap()->getAttributeItem(nameAttr); + Attribute* nameAttribute = getAttributeItem(nameAttr); if (nameAttribute) { const AtomicString& value = nameAttribute->value(); if (isURLParameter(value)) diff --git a/Source/WebCore/html/HTMLParamElement.h b/Source/WebCore/html/HTMLParamElement.h index f448547cb..eadec5440 100644 --- a/Source/WebCore/html/HTMLParamElement.h +++ b/Source/WebCore/html/HTMLParamElement.h @@ -39,7 +39,7 @@ public: private: HTMLParamElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLPlugInElement.cpp b/Source/WebCore/html/HTMLPlugInElement.cpp index 6229d2e03..66d60922c 100644 --- a/Source/WebCore/html/HTMLPlugInElement.cpp +++ b/Source/WebCore/html/HTMLPlugInElement.cpp @@ -112,7 +112,11 @@ PassScriptInstance HTMLPlugInElement::getInstance() bool HTMLPlugInElement::guardedDispatchBeforeLoadEvent(const String& sourceURL) { - ASSERT(!m_inBeforeLoadEventHandler); + // FIXME: Our current plug-in loading design can't guarantee the following + // assertion is true, since plug-in loading can be initiated during layout, + // and synchronous layout can be initiated in a beforeload event handler! + // See <http://webkit.org/b/71264>. + // ASSERT(!m_inBeforeLoadEventHandler); m_inBeforeLoadEventHandler = true; // static_cast is used to avoid a compile error since dispatchBeforeLoadEvent // is intentionally undefined on this class. @@ -136,40 +140,36 @@ Widget* HTMLPlugInElement::pluginWidget() return renderWidget->widget(); } -bool HTMLPlugInElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || - attrName == heightAttr || - attrName == vspaceAttr || - attrName == hspaceAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eReplaced; // Share with <img> since the alignment behavior is the same. - return false; - } - - return HTMLFrameOwnerElement::mapToEntry(attrName, result); -} - -void HTMLPlugInElement::parseMappedAttribute(Attribute* attr) +void HTMLPlugInElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attr->name() == alignAttr) addHTMLAlignment(attr); else - HTMLFrameOwnerElement::parseMappedAttribute(attr); + HTMLFrameOwnerElement::parseAttribute(attr); } void HTMLPlugInElement::defaultEventHandler(Event* event) diff --git a/Source/WebCore/html/HTMLPlugInElement.h b/Source/WebCore/html/HTMLPlugInElement.h index a10af6141..8c2214167 100644 --- a/Source/WebCore/html/HTMLPlugInElement.h +++ b/Source/WebCore/html/HTMLPlugInElement.h @@ -58,8 +58,7 @@ protected: virtual void detach(); virtual void removedFromDocument(); - virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; bool m_inBeforeLoadEventHandler; // Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly. diff --git a/Source/WebCore/html/HTMLPreElement.cpp b/Source/WebCore/html/HTMLPreElement.cpp index fc67aca7f..7ed85fccd 100644 --- a/Source/WebCore/html/HTMLPreElement.cpp +++ b/Source/WebCore/html/HTMLPreElement.cpp @@ -42,16 +42,7 @@ PassRefPtr<HTMLPreElement> HTMLPreElement::create(const QualifiedName& tagName, return adoptRef(new HTMLPreElement(tagName, document)); } -bool HTMLPreElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr || attrName == wrapAttr) { - result = ePre; - return false; - } - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLPreElement::parseMappedAttribute(Attribute* attr) +void HTMLPreElement::parseAttribute(Attribute* attr) { if (attr->name() == widthAttr) { // FIXME: Implement this some day. Width on a <pre> is the # of characters that @@ -59,10 +50,12 @@ void HTMLPreElement::parseMappedAttribute(Attribute* attr) // multiply by the value of the attribute and then set that as the width CSS // property. } else if (attr->name() == wrapAttr) { - if (!attr->value().isNull()) - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePreWrap); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWhiteSpace); + else + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); } else - return HTMLElement::parseMappedAttribute(attr); + return HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLPreElement.h b/Source/WebCore/html/HTMLPreElement.h index 3ccdb8603..3ad3152f1 100644 --- a/Source/WebCore/html/HTMLPreElement.h +++ b/Source/WebCore/html/HTMLPreElement.h @@ -34,8 +34,7 @@ public: private: HTMLPreElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp index 960f15782..0c2372581 100644 --- a/Source/WebCore/html/HTMLProgressElement.cpp +++ b/Source/WebCore/html/HTMLProgressElement.cpp @@ -75,14 +75,14 @@ const AtomicString& HTMLProgressElement::formControlType() const return progress; } -void HTMLProgressElement::parseMappedAttribute(Attribute* attribute) +void HTMLProgressElement::parseAttribute(Attribute* attribute) { if (attribute->name() == valueAttr) didElementStateChange(); else if (attribute->name() == maxAttr) didElementStateChange(); else - HTMLFormControlElement::parseMappedAttribute(attribute); + HTMLFormControlElement::parseAttribute(attribute); } void HTMLProgressElement::attach() @@ -153,11 +153,14 @@ void HTMLProgressElement::didElementStateChange() void HTMLProgressElement::createShadowSubtree() { + ASSERT(!shadowRoot()); + RefPtr<ProgressBarElement> bar = ProgressBarElement::create(document()); m_value = ProgressValueElement::create(document()); - ExceptionCode ec = 0; - bar->appendChild(m_value, ec); - ensureShadowRoot()->appendChild(bar, ec); + bar->appendChild(m_value, ASSERT_NO_EXCEPTION); + + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot, ASSERT_NO_EXCEPTION); + root->appendChild(bar, ASSERT_NO_EXCEPTION); } } // namespace diff --git a/Source/WebCore/html/HTMLProgressElement.h b/Source/WebCore/html/HTMLProgressElement.h index 2ee4c6ba8..731f80b4a 100644 --- a/Source/WebCore/html/HTMLProgressElement.h +++ b/Source/WebCore/html/HTMLProgressElement.h @@ -59,7 +59,7 @@ private: virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void attach(); diff --git a/Source/WebCore/html/HTMLPropertiesCollection.idl b/Source/WebCore/html/HTMLPropertiesCollection.idl index 1697ea904..470ab2eec 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.idl +++ b/Source/WebCore/html/HTMLPropertiesCollection.idl @@ -32,7 +32,7 @@ module html { interface [ Conditional=MICRODATA, - HasIndexGetter + IndexedGetter ] HTMLPropertiesCollection : HTMLCollection { readonly attribute unsigned long length; Node item(in unsigned long index); diff --git a/Source/WebCore/html/HTMLScriptElement.cpp b/Source/WebCore/html/HTMLScriptElement.cpp index a4c5586dc..1df19a63b 100644 --- a/Source/WebCore/html/HTMLScriptElement.cpp +++ b/Source/WebCore/html/HTMLScriptElement.cpp @@ -58,14 +58,14 @@ void HTMLScriptElement::childrenChanged(bool changedByParser, Node* beforeChange HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLScriptElement::attributeChanged(Attribute* attr, bool preserveDecls) +void HTMLScriptElement::attributeChanged(Attribute* attr) { if (attr->name() == asyncAttr) handleAsyncAttribute(); - HTMLElement::attributeChanged(attr, preserveDecls); + HTMLElement::attributeChanged(attr); } -void HTMLScriptElement::parseMappedAttribute(Attribute* attr) +void HTMLScriptElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -76,7 +76,7 @@ void HTMLScriptElement::parseMappedAttribute(Attribute* attr) else if (attrName == onbeforeloadAttr) setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr)); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLScriptElement::insertedIntoDocument() diff --git a/Source/WebCore/html/HTMLScriptElement.h b/Source/WebCore/html/HTMLScriptElement.h index a5fe048a1..61d9de094 100644 --- a/Source/WebCore/html/HTMLScriptElement.h +++ b/Source/WebCore/html/HTMLScriptElement.h @@ -44,10 +44,10 @@ public: private: HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void attributeChanged(Attribute*, bool preserveDecls = false); + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLScriptElement.idl b/Source/WebCore/html/HTMLScriptElement.idl index 03b5ac816..1e5c21e74 100644 --- a/Source/WebCore/html/HTMLScriptElement.idl +++ b/Source/WebCore/html/HTMLScriptElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLScriptElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString text; + attribute [TreatNullAs=NullString] DOMString text; attribute [Reflect=for] DOMString htmlFor; attribute [Reflect] DOMString event; attribute [Reflect] DOMString charset; diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp index 4bd10b800..1b96d226f 100644 --- a/Source/WebCore/html/HTMLSelectElement.cpp +++ b/Source/WebCore/html/HTMLSelectElement.cpp @@ -256,7 +256,7 @@ void HTMLSelectElement::setValue(const String &value) setSelectedIndex(-1); } -void HTMLSelectElement::parseMappedAttribute(Attribute* attr) +void HTMLSelectElement::parseAttribute(Attribute* attr) { if (attr->name() == sizeAttr) { int oldSize = m_size; @@ -288,7 +288,7 @@ void HTMLSelectElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == onchangeAttr) setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr)); else - HTMLFormControlElementWithState::parseMappedAttribute(attr); + HTMLFormControlElementWithState::parseAttribute(attr); } bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const diff --git a/Source/WebCore/html/HTMLSelectElement.h b/Source/WebCore/html/HTMLSelectElement.h index cd0ebb4e4..8d9b738a4 100644 --- a/Source/WebCore/html/HTMLSelectElement.h +++ b/Source/WebCore/html/HTMLSelectElement.h @@ -121,7 +121,7 @@ private: virtual bool saveFormControlState(String& value) const; virtual void restoreFormControlState(const String&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle *); virtual bool appendFormData(FormDataList&, bool); diff --git a/Source/WebCore/html/HTMLSelectElement.idl b/Source/WebCore/html/HTMLSelectElement.idl index 9749780c1..5d60ef4f8 100644 --- a/Source/WebCore/html/HTMLSelectElement.idl +++ b/Source/WebCore/html/HTMLSelectElement.idl @@ -21,12 +21,12 @@ module html { interface [ - HasIndexGetter, - HasCustomIndexSetter + IndexedGetter, + CustomIndexedSetter ] HTMLSelectElement : HTMLElement { readonly attribute DOMString type; attribute long selectedIndex; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; // Modified in DOM Level 2: #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C @@ -40,7 +40,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // Modified in DOM Level 2: readonly attribute HTMLOptionsCollection options; @@ -48,11 +48,11 @@ module html { attribute [Reflect] boolean disabled; attribute [Reflect] boolean autofocus; attribute boolean multiple; - attribute [TreatNullAs=EmptyString] DOMString name; + attribute [TreatNullAs=NullString] DOMString name; attribute [Reflect] boolean required; attribute long size; - [OldStyleObjC] void add(in [Optional=CallWithDefaultValue] HTMLElement element, + [ObjCLegacyUnnamedParameters] void add(in [Optional=CallWithDefaultValue] HTMLElement element, in [Optional=CallWithDefaultValue] HTMLElement before) raises(DOMException); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT diff --git a/Source/WebCore/html/HTMLStyleElement.cpp b/Source/WebCore/html/HTMLStyleElement.cpp index cc1fa2300..4156ce5f1 100644 --- a/Source/WebCore/html/HTMLStyleElement.cpp +++ b/Source/WebCore/html/HTMLStyleElement.cpp @@ -57,7 +57,7 @@ PassRefPtr<HTMLStyleElement> HTMLStyleElement::create(const QualifiedName& tagNa return adoptRef(new HTMLStyleElement(tagName, document, createdByParser)); } -void HTMLStyleElement::parseMappedAttribute(Attribute* attr) +void HTMLStyleElement::parseAttribute(Attribute* attr) { if (attr->name() == titleAttr && m_sheet) m_sheet->setTitle(attr->value()); @@ -71,7 +71,7 @@ void HTMLStyleElement::parseMappedAttribute(Attribute* attr) } #endif else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } void HTMLStyleElement::finishParsingChildren() diff --git a/Source/WebCore/html/HTMLStyleElement.h b/Source/WebCore/html/HTMLStyleElement.h index d56d46d6d..9c50ee240 100644 --- a/Source/WebCore/html/HTMLStyleElement.h +++ b/Source/WebCore/html/HTMLStyleElement.h @@ -52,7 +52,7 @@ private: HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser); // overload from HTMLElement - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); #if ENABLE(STYLE_SCOPED) diff --git a/Source/WebCore/html/HTMLSummaryElement.cpp b/Source/WebCore/html/HTMLSummaryElement.cpp index 9925627fe..f57a5db23 100644 --- a/Source/WebCore/html/HTMLSummaryElement.cpp +++ b/Source/WebCore/html/HTMLSummaryElement.cpp @@ -73,9 +73,10 @@ RenderObject* HTMLSummaryElement::createRenderer(RenderArena* arena, RenderStyle void HTMLSummaryElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(DetailsMarkerControl::create(document()), ec, true); - ensureShadowRoot()->appendChild(SummaryContentElement::create(document()), ec, true); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(DetailsMarkerControl::create(document()), ASSERT_NO_EXCEPTION, true); + root->appendChild(SummaryContentElement::create(document()), ASSERT_NO_EXCEPTION, true); } HTMLDetailsElement* HTMLSummaryElement::detailsElement() const @@ -89,8 +90,9 @@ HTMLDetailsElement* HTMLSummaryElement::detailsElement() const bool HTMLSummaryElement::isMainSummary() const { if (HTMLDetailsElement* details = detailsElement()) - return details->mainSummary() == this; - return 0; + return details->findMainSummary() == this; + + return false; } static bool isClickableControl(Node* node) diff --git a/Source/WebCore/html/HTMLTableCaptionElement.cpp b/Source/WebCore/html/HTMLTableCaptionElement.cpp index b726df62c..88450d43a 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.cpp +++ b/Source/WebCore/html/HTMLTableCaptionElement.cpp @@ -44,23 +44,15 @@ PassRefPtr<HTMLTableCaptionElement> HTMLTableCaptionElement::create(const Qualif return adoptRef(new HTMLTableCaptionElement(tagName, document)); } -bool HTMLTableCaptionElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == alignAttr) { - result = eCaption; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLTableCaptionElement::parseMappedAttribute(Attribute* attr) +void HTMLTableCaptionElement::parseAttribute(Attribute* attr) { if (attr->name() == alignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyCaptionSide, attr->value()); + addCSSProperty(CSSPropertyCaptionSide, attr->value()); + else + removeCSSProperty(CSSPropertyCaptionSide); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLTableCaptionElement.h b/Source/WebCore/html/HTMLTableCaptionElement.h index a2dd2faae..da40e821d 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.h +++ b/Source/WebCore/html/HTMLTableCaptionElement.h @@ -36,9 +36,8 @@ public: private: HTMLTableCaptionElement(const QualifiedName&, Document*); - - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + + virtual void parseAttribute(Attribute*) OVERRIDE; }; } // namespace diff --git a/Source/WebCore/html/HTMLTableCaptionElement.idl b/Source/WebCore/html/HTMLTableCaptionElement.idl index c56c45600..075953978 100644 --- a/Source/WebCore/html/HTMLTableCaptionElement.idl +++ b/Source/WebCore/html/HTMLTableCaptionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLTableCaptionElement : HTMLElement { attribute [Reflect] DOMString align; }; diff --git a/Source/WebCore/html/HTMLTableCellElement.cpp b/Source/WebCore/html/HTMLTableCellElement.cpp index 9a96a3607..84a1c9654 100644 --- a/Source/WebCore/html/HTMLTableCellElement.cpp +++ b/Source/WebCore/html/HTMLTableCellElement.cpp @@ -75,23 +75,7 @@ int HTMLTableCellElement::cellIndex() const return index; } -bool HTMLTableCellElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == nowrapAttr) { - result = eUniversal; - return false; - } - - if (attrName == widthAttr || - attrName == heightAttr) { - result = eCell; // Because of the quirky behavior of ignoring 0 values, cells are special. - return false; - } - - return HTMLTablePartElement::mapToEntry(attrName, result); -} - -void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) +void HTMLTableCellElement::parseAttribute(Attribute* attr) { if (attr->name() == rowspanAttr) { if (renderer() && renderer()->isTableCell()) @@ -100,25 +84,30 @@ void HTMLTableCellElement::parseMappedAttribute(Attribute* attr) if (renderer() && renderer()->isTableCell()) toRenderTableCell(renderer())->colSpanOrRowSpanChanged(); } else if (attr->name() == nowrapAttr) { - if (!attr->isNull()) - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueWebkitNowrap); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWhiteSpace); + else + addCSSProperty(CSSPropertyWhiteSpace, CSSValueWebkitNowrap); + } else if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) { int widthInt = attr->value().toInt(); if (widthInt > 0) // width="0" is ignored for compatibility with WinIE. - addCSSLength(attr, CSSPropertyWidth, attr->value()); - } + addCSSLength(CSSPropertyWidth, attr->value()); + } else + removeCSSProperty(CSSPropertyWidth); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) { int heightInt = attr->value().toInt(); if (heightInt > 0) // height="0" is ignored for compatibility with WinIE. - addCSSLength(attr, CSSPropertyHeight, attr->value()); - } + addCSSLength(CSSPropertyHeight, attr->value()); + } else + removeCSSProperty(CSSPropertyHeight); } else - HTMLTablePartElement::parseMappedAttribute(attr); + HTMLTablePartElement::parseAttribute(attr); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableCellElement::additionalAttributeStyle() +StylePropertySet* HTMLTableCellElement::additionalAttributeStyle() { ContainerNode* p = parentNode(); while (p && !p->hasTagName(tableTag)) diff --git a/Source/WebCore/html/HTMLTableCellElement.h b/Source/WebCore/html/HTMLTableCellElement.h index d7ddc8692..5c32d6a9d 100644 --- a/Source/WebCore/html/HTMLTableCellElement.h +++ b/Source/WebCore/html/HTMLTableCellElement.h @@ -53,10 +53,9 @@ public: private: HTMLTableCellElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; virtual bool isURLAttribute(Attribute*) const; diff --git a/Source/WebCore/html/HTMLTableColElement.cpp b/Source/WebCore/html/HTMLTableColElement.cpp index 10657e682..0c83e781c 100644 --- a/Source/WebCore/html/HTMLTableColElement.cpp +++ b/Source/WebCore/html/HTMLTableColElement.cpp @@ -47,17 +47,7 @@ PassRefPtr<HTMLTableColElement> HTMLTableColElement::create(const QualifiedName& return adoptRef(new HTMLTableColElement(tagName, document)); } -bool HTMLTableColElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == widthAttr) { - result = eUniversal; - return false; - } - - return HTMLTablePartElement::mapToEntry(attrName, result); -} - -void HTMLTableColElement::parseMappedAttribute(Attribute* attr) +void HTMLTableColElement::parseAttribute(Attribute* attr) { if (attr->name() == spanAttr) { m_span = !attr->isNull() ? attr->value().toInt() : 1; @@ -65,19 +55,20 @@ void HTMLTableColElement::parseMappedAttribute(Attribute* attr) renderer()->updateFromElement(); } else if (attr->name() == widthAttr) { if (!attr->value().isEmpty()) { - addCSSLength(attr, CSSPropertyWidth, attr->value()); + addCSSLength(CSSPropertyWidth, attr->value()); if (renderer() && renderer()->isTableCol()) { RenderTableCol* col = toRenderTableCol(renderer()); int newWidth = width().toInt(); if (newWidth != col->width()) col->setNeedsLayoutAndPrefWidthsRecalc(); } - } + } else + removeCSSProperty(CSSPropertyWidth); } else - HTMLTablePartElement::parseMappedAttribute(attr); + HTMLTablePartElement::parseAttribute(attr); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableColElement::additionalAttributeStyle() +StylePropertySet* HTMLTableColElement::additionalAttributeStyle() { if (!hasLocalName(colgroupTag)) return 0; diff --git a/Source/WebCore/html/HTMLTableColElement.h b/Source/WebCore/html/HTMLTableColElement.h index 36180c773..01cea8e1b 100644 --- a/Source/WebCore/html/HTMLTableColElement.h +++ b/Source/WebCore/html/HTMLTableColElement.h @@ -42,9 +42,8 @@ public: private: HTMLTableColElement(const QualifiedName& tagName, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual void parseAttribute(Attribute*) OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; int m_span; }; diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp index cac8b4d61..be3aaa2ce 100644 --- a/Source/WebCore/html/HTMLTableElement.cpp +++ b/Source/WebCore/html/HTMLTableElement.cpp @@ -241,42 +241,6 @@ void HTMLTableElement::deleteRow(int index, ExceptionCode& ec) row->remove(ec); } -bool HTMLTableElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == widthAttr || - attrName == heightAttr || - attrName == bgcolorAttr || - attrName == cellspacingAttr || - attrName == vspaceAttr || - attrName == hspaceAttr || - attrName == valignAttr) { - result = eUniversal; - return false; - } - - if (attrName == bordercolorAttr || attrName == frameAttr || attrName == rulesAttr) { - result = eUniversal; - return true; - } - - if (attrName == borderAttr) { - result = eTable; - return true; - } - - if (attrName == alignAttr) { - result = eTable; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - static inline bool isTableCellAncestor(Node* n) { return n->hasTagName(theadTag) || n->hasTagName(tbodyTag) || @@ -302,44 +266,52 @@ static bool setTableCellsChanged(Node* n) return cellChanged; } -void HTMLTableElement::parseMappedAttribute(Attribute* attr) +void HTMLTableElement::parseAttribute(Attribute* attr) { CellBorders bordersBefore = cellBorders(); unsigned short oldPadding = m_padding; if (attr->name() == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attr->name() == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else if (attr->name() == borderAttr) { m_borderAttr = true; - if (attr->decl()) { - RefPtr<CSSValue> val = attr->decl()->getPropertyCSSValue(CSSPropertyBorderLeftWidth); - if (val && val->isPrimitiveValue()) { - CSSPrimitiveValue* primVal = static_cast<CSSPrimitiveValue*>(val.get()); - m_borderAttr = primVal->getDoubleValue(CSSPrimitiveValue::CSS_NUMBER); - } - } else if (!attr->isNull()) { + + if (attr->isNull()) + removeCSSProperty(CSSPropertyBorderWidth); + else { int border = 0; if (attr->isEmpty()) border = 1; else border = attr->value().toInt(); m_borderAttr = border; - addCSSLength(attr, CSSPropertyBorderWidth, String::number(border)); + addCSSLength(CSSPropertyBorderWidth, String::number(border)); } } else if (attr->name() == bgcolorAttr) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == bordercolorAttr) { - m_borderColorAttr = attr->decl(); - if (!attr->decl() && !attr->isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - m_borderColorAttr = true; - } + m_borderColorAttr = !attr->isEmpty(); + if (!attr->isEmpty()) + addCSSColor(CSSPropertyBorderColor, attr->value()); + else + removeCSSProperty(CSSPropertyBorderColor); } else if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == frameAttr) { // Cache the value of "frame" so that the table can examine it later. m_frameAttr = false; @@ -380,15 +352,16 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) // Now map in the border styles of solid and hidden respectively. if (m_frameAttr) { - addCSSProperty(attr, CSSPropertyBorderTopWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderBottomWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderLeftWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderRightWidth, CSSValueThin); - addCSSProperty(attr, CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); - addCSSProperty(attr, CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); - } + addCSSProperty(CSSPropertyBorderTopWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderBottomWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderLeftWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderRightWidth, CSSValueThin); + addCSSProperty(CSSPropertyBorderTopStyle, borders[cTop] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderBottomStyle, borders[cBottom] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderLeftStyle, borders[cLeft] ? CSSValueSolid : CSSValueHidden); + addCSSProperty(CSSPropertyBorderRightStyle, borders[cRight] ? CSSValueSolid : CSSValueHidden); + } else + removeCSSProperties(CSSPropertyBorderTopWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); } else if (attr->name() == rulesAttr) { m_rulesAttr = UnsetRules; if (equalIgnoringCase(attr->value(), "none")) @@ -404,10 +377,14 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) // The presence of a valid rules attribute causes border collapsing to be enabled. if (m_rulesAttr != UnsetRules) - addCSSProperty(attr, CSSPropertyBorderCollapse, CSSValueCollapse); + addCSSProperty(CSSPropertyBorderCollapse, CSSValueCollapse); + else + removeCSSProperty(CSSPropertyBorderCollapse); } else if (attr->name() == cellspacingAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyBorderSpacing, attr->value()); + addCSSLength(CSSPropertyBorderSpacing, attr->value()); + else + removeCSSProperty(CSSPropertyBorderSpacing); } else if (attr->name() == cellpaddingAttr) { if (!attr->value().isEmpty()) m_padding = max(0, attr->value().toInt()); @@ -416,24 +393,35 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == colsAttr) { // ### } else if (attr->name() == vspaceAttr) { - addCSSLength(attr, CSSPropertyMarginTop, attr->value()); - addCSSLength(attr, CSSPropertyMarginBottom, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginTop, CSSPropertyMarginBottom); + else { + addCSSLength(CSSPropertyMarginTop, attr->value()); + addCSSLength(CSSPropertyMarginBottom, attr->value()); + } } else if (attr->name() == hspaceAttr) { - addCSSLength(attr, CSSPropertyMarginLeft, attr->value()); - addCSSLength(attr, CSSPropertyMarginRight, attr->value()); + if (attr->isNull()) + removeCSSProperties(CSSPropertyMarginLeft, CSSPropertyMarginRight); + else { + addCSSLength(CSSPropertyMarginLeft, attr->value()); + addCSSLength(CSSPropertyMarginRight, attr->value()); + } } else if (attr->name() == alignAttr) { if (!attr->value().isEmpty()) { if (equalIgnoringCase(attr->value(), "center")) { - addCSSProperty(attr, CSSPropertyWebkitMarginStart, CSSValueAuto); - addCSSProperty(attr, CSSPropertyWebkitMarginEnd, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitMarginStart, CSSValueAuto); + addCSSProperty(CSSPropertyWebkitMarginEnd, CSSValueAuto); } else - addCSSProperty(attr, CSSPropertyFloat, attr->value()); - } + addCSSProperty(CSSPropertyFloat, attr->value()); + } else + removeCSSProperties(CSSPropertyWebkitMarginStart, CSSPropertyWebkitMarginEnd, CSSPropertyFloat); } else if (attr->name() == valignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); + else + removeCSSProperty(CSSPropertyVerticalAlign); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); if (bordersBefore != cellBorders() || oldPadding != m_padding) { m_sharedCellStyle = 0; @@ -445,9 +433,9 @@ void HTMLTableElement::parseMappedAttribute(Attribute* attr) } } -static CSSMutableStyleDeclaration* leakBorderStyle(int value) +static StylePropertySet* leakBorderStyle(int value) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyBorderTopStyle, value); style->setProperty(CSSPropertyBorderBottomStyle, value); style->setProperty(CSSPropertyBorderLeftStyle, value); @@ -455,16 +443,16 @@ static CSSMutableStyleDeclaration* leakBorderStyle(int value) return style.release().leakRef(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalAttributeStyle() +StylePropertySet* HTMLTableElement::additionalAttributeStyle() { if ((!m_borderAttr && !m_borderColorAttr) || m_frameAttr) return 0; if (m_borderColorAttr) { - static CSSMutableStyleDeclaration* solidBorderStyle = leakBorderStyle(CSSValueSolid); + static StylePropertySet* solidBorderStyle = leakBorderStyle(CSSValueSolid); return solidBorderStyle; } - static CSSMutableStyleDeclaration* outsetBorderStyle = leakBorderStyle(CSSValueOutset); + static StylePropertySet* outsetBorderStyle = leakBorderStyle(CSSValueOutset); return outsetBorderStyle; } @@ -491,9 +479,9 @@ HTMLTableElement::CellBorders HTMLTableElement::cellBorders() const return NoBorders; } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle() +PassRefPtr<StylePropertySet> HTMLTableElement::createSharedCellStyle() { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); switch (cellBorders()) { case SolidBordersColsOnly: @@ -542,16 +530,16 @@ PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::createSharedCellStyle() return style.release(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalCellStyle() +StylePropertySet* HTMLTableElement::additionalCellStyle() { if (!m_sharedCellStyle) m_sharedCellStyle = createSharedCellStyle(); - return m_sharedCellStyle; + return m_sharedCellStyle.get(); } -static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows) +static StylePropertySet* leakGroupBorderStyle(int rows) { - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); if (rows) { style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin); style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin); @@ -566,16 +554,16 @@ static CSSMutableStyleDeclaration* leakGroupBorderStyle(int rows) return style.release().leakRef(); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableElement::additionalGroupStyle(bool rows) +StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) { if (m_rulesAttr != GroupsRules) return 0; if (rows) { - static CSSMutableStyleDeclaration* rowBorderStyle = leakGroupBorderStyle(true); + static StylePropertySet* rowBorderStyle = leakGroupBorderStyle(true); return rowBorderStyle; } - static CSSMutableStyleDeclaration* columnBorderStyle = leakGroupBorderStyle(false); + static StylePropertySet* columnBorderStyle = leakGroupBorderStyle(false); return columnBorderStyle; } diff --git a/Source/WebCore/html/HTMLTableElement.h b/Source/WebCore/html/HTMLTableElement.h index cfde1df95..ef8ccde6e 100644 --- a/Source/WebCore/html/HTMLTableElement.h +++ b/Source/WebCore/html/HTMLTableElement.h @@ -66,18 +66,17 @@ public: virtual void attach(); - PassRefPtr<CSSMutableStyleDeclaration> additionalCellStyle(); - PassRefPtr<CSSMutableStyleDeclaration> additionalGroupStyle(bool rows); + StylePropertySet* additionalCellStyle(); + StylePropertySet* additionalGroupStyle(bool rows); private: HTMLTableElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isURLAttribute(Attribute*) const; // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes. - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; @@ -86,7 +85,7 @@ private: CellBorders cellBorders() const; - PassRefPtr<CSSMutableStyleDeclaration> createSharedCellStyle(); + PassRefPtr<StylePropertySet> createSharedCellStyle(); HTMLTableSectionElement* lastBody() const; @@ -98,7 +97,7 @@ private: unsigned short m_padding; OwnPtr<HTMLTableRowsCollection> m_rowsCollection; - RefPtr<CSSMutableStyleDeclaration> m_sharedCellStyle; + RefPtr<StylePropertySet> m_sharedCellStyle; }; } //namespace diff --git a/Source/WebCore/html/HTMLTablePartElement.cpp b/Source/WebCore/html/HTMLTablePartElement.cpp index dfaecca9a..8fd747bd8 100644 --- a/Source/WebCore/html/HTMLTablePartElement.cpp +++ b/Source/WebCore/html/HTMLTablePartElement.cpp @@ -36,65 +36,54 @@ namespace WebCore { using namespace HTMLNames; -bool HTMLTablePartElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == backgroundAttr) { - result = (MappedAttributeEntry)(eLastEntry + document()->docID()); - return false; - } - - if (attrName == bgcolorAttr || - attrName == bordercolorAttr || - attrName == valignAttr || - attrName == heightAttr) { - result = eUniversal; - return false; - } - - if (attrName == alignAttr) { - result = eCell; // All table parts will just share in the TD space. - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLTablePartElement::parseMappedAttribute(Attribute* attr) +void HTMLTablePartElement::parseAttribute(Attribute* attr) { if (attr->name() == bgcolorAttr) - addCSSColor(attr, CSSPropertyBackgroundColor, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyBackgroundColor); + else + addCSSColor(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == backgroundAttr) { String url = stripLeadingAndTrailingHTMLSpaces(attr->value()); if (!url.isEmpty()) - addCSSImageProperty(attr, CSSPropertyBackgroundImage, document()->completeURL(url).string()); + addCSSImageProperty(CSSPropertyBackgroundImage, document()->completeURL(url).string()); + else + removeCSSProperty(CSSPropertyBackgroundImage); } else if (attr->name() == bordercolorAttr) { if (!attr->value().isEmpty()) { - addCSSColor(attr, CSSPropertyBorderColor, attr->value()); - addCSSProperty(attr, CSSPropertyBorderTopStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderBottomStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderLeftStyle, CSSValueSolid); - addCSSProperty(attr, CSSPropertyBorderRightStyle, CSSValueSolid); - } + addCSSColor(CSSPropertyBorderColor, attr->value()); + addCSSProperty(CSSPropertyBorderTopStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); + addCSSProperty(CSSPropertyBorderRightStyle, CSSValueSolid); + } else + removeCSSProperties(CSSPropertyBorderColor, CSSPropertyBorderTopStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle, CSSPropertyBorderRightStyle); } else if (attr->name() == valignAttr) { if (!attr->value().isEmpty()) - addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value()); + addCSSProperty(CSSPropertyVerticalAlign, attr->value()); + else + removeCSSProperty(CSSPropertyVerticalAlign); } else if (attr->name() == alignAttr) { const AtomicString& v = attr->value(); - if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitCenter); + if (v.isNull()) + removeCSSProperty(CSSPropertyTextAlign); + else if (equalIgnoringCase(v, "middle") || equalIgnoringCase(v, "center")) + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitCenter); else if (equalIgnoringCase(v, "absmiddle")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueCenter); + addCSSProperty(CSSPropertyTextAlign, CSSValueCenter); else if (equalIgnoringCase(v, "left")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitLeft); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitLeft); else if (equalIgnoringCase(v, "right")) - addCSSProperty(attr, CSSPropertyTextAlign, CSSValueWebkitRight); + addCSSProperty(CSSPropertyTextAlign, CSSValueWebkitRight); else - addCSSProperty(attr, CSSPropertyTextAlign, v); + addCSSProperty(CSSPropertyTextAlign, v); } else if (attr->name() == heightAttr) { if (!attr->value().isEmpty()) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + addCSSLength(CSSPropertyHeight, attr->value()); + else + removeCSSProperty(CSSPropertyHeight); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLTablePartElement.h b/Source/WebCore/html/HTMLTablePartElement.h index 9df2f919d..c139bbe3c 100644 --- a/Source/WebCore/html/HTMLTablePartElement.h +++ b/Source/WebCore/html/HTMLTablePartElement.h @@ -37,8 +37,7 @@ protected: { } - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLTableSectionElement.cpp b/Source/WebCore/html/HTMLTableSectionElement.cpp index ef6e9f23e..0e7872d12 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.cpp +++ b/Source/WebCore/html/HTMLTableSectionElement.cpp @@ -47,7 +47,7 @@ PassRefPtr<HTMLTableSectionElement> HTMLTableSectionElement::create(const Qualif return adoptRef(new HTMLTableSectionElement(tagName, document)); } -PassRefPtr<CSSMutableStyleDeclaration> HTMLTableSectionElement::additionalAttributeStyle() +StylePropertySet* HTMLTableSectionElement::additionalAttributeStyle() { ContainerNode* p = parentNode(); while (p && !p->hasTagName(tableTag)) diff --git a/Source/WebCore/html/HTMLTableSectionElement.h b/Source/WebCore/html/HTMLTableSectionElement.h index b1680c42e..93b5f6953 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.h +++ b/Source/WebCore/html/HTMLTableSectionElement.h @@ -56,7 +56,7 @@ public: private: HTMLTableSectionElement(const QualifiedName& tagName, Document*); - virtual PassRefPtr<CSSMutableStyleDeclaration> additionalAttributeStyle() OVERRIDE; + virtual StylePropertySet* additionalAttributeStyle() OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLTableSectionElement.idl b/Source/WebCore/html/HTMLTableSectionElement.idl index 9c0e53b86..1553b5ea1 100644 --- a/Source/WebCore/html/HTMLTableSectionElement.idl +++ b/Source/WebCore/html/HTMLTableSectionElement.idl @@ -21,7 +21,7 @@ module html { interface [ - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLTableSectionElement : HTMLElement { attribute [Reflect] DOMString align; attribute [Reflect=char] DOMString ch; diff --git a/Source/WebCore/html/HTMLTagNames.in b/Source/WebCore/html/HTMLTagNames.in index 4c302edd4..62ba50100 100644 --- a/Source/WebCore/html/HTMLTagNames.in +++ b/Source/WebCore/html/HTMLTagNames.in @@ -93,6 +93,7 @@ ol interfaceName=HTMLOListElement optgroup interfaceName=HTMLOptGroupElement, constructorNeedsFormElement option constructorNeedsFormElement output constructorNeedsFormElement +shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM p interfaceName=HTMLParagraphElement param plaintext interfaceName=HTMLElement diff --git a/Source/WebCore/html/HTMLTextAreaElement.cpp b/Source/WebCore/html/HTMLTextAreaElement.cpp index b5ac63390..bff7574be 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.cpp +++ b/Source/WebCore/html/HTMLTextAreaElement.cpp @@ -84,8 +84,9 @@ PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName& void HTMLTextAreaElement::createShadowSubtree() { - ExceptionCode ec = 0; - ensureShadowRoot()->appendChild(TextControlInnerTextElement::create(document()), ec); + ASSERT(!shadowRoot()); + RefPtr<ShadowRoot> root = ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot); + root->appendChild(TextControlInnerTextElement::create(document()), ASSERT_NO_EXCEPTION); } const AtomicString& HTMLTextAreaElement::formControlType() const @@ -117,7 +118,7 @@ void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChan HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta); } -void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) +void HTMLTextAreaElement::parseAttribute(Attribute* attr) { if (attr->name() == rowsAttr) { int rows = attr->value().toInt(); @@ -151,11 +152,11 @@ void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) m_wrap = wrap; if (shouldWrapText()) { - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePreWrap); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueBreakWord); + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePreWrap); + addCSSProperty(CSSPropertyWordWrap, CSSValueBreakWord); } else { - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePre); - addCSSProperty(attr, CSSPropertyWordWrap, CSSValueNormal); + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); + addCSSProperty(CSSPropertyWordWrap, CSSValueNormal); } if (renderer()) @@ -169,7 +170,7 @@ void HTMLTextAreaElement::parseMappedAttribute(Attribute* attr) } else if (attr->name() == maxlengthAttr) setNeedsValidityCheck(); else - HTMLTextFormControlElement::parseMappedAttribute(attr); + HTMLTextFormControlElement::parseAttribute(attr); } RenderObject* HTMLTextAreaElement::createRenderer(RenderArena* arena, RenderStyle*) diff --git a/Source/WebCore/html/HTMLTextAreaElement.h b/Source/WebCore/html/HTMLTextAreaElement.h index f455da7fd..c2bbc718c 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.h +++ b/Source/WebCore/html/HTMLTextAreaElement.h @@ -93,7 +93,7 @@ private: virtual bool isTextFormControl() const { return true; } virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); virtual bool appendFormData(FormDataList&, bool); virtual void reset(); diff --git a/Source/WebCore/html/HTMLTextAreaElement.idl b/Source/WebCore/html/HTMLTextAreaElement.idl index b34142350..3b76115e5 100644 --- a/Source/WebCore/html/HTMLTextAreaElement.idl +++ b/Source/WebCore/html/HTMLTextAreaElement.idl @@ -22,7 +22,7 @@ module html { interface HTMLTextAreaElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString defaultValue; + attribute [TreatNullAs=NullString] DOMString defaultValue; readonly attribute HTMLFormElement form; readonly attribute ValidityState validity; attribute long cols; @@ -30,14 +30,14 @@ module html { attribute [Reflect] boolean disabled; attribute [Reflect] boolean autofocus; attribute long maxLength setter raises(DOMException); - attribute [TreatNullAs=EmptyString] DOMString name; + attribute [TreatNullAs=NullString] DOMString name; attribute [Reflect] DOMString placeholder; attribute [Reflect] boolean readOnly; attribute [Reflect] boolean required; attribute long rows; attribute [Reflect] DOMString wrap; readonly attribute DOMString type; - attribute [TreatNullAs=EmptyString] DOMString value; + attribute [TreatNullAs=NullString] DOMString value; readonly attribute unsigned long textLength; void select(); @@ -45,7 +45,7 @@ module html { readonly attribute boolean willValidate; readonly attribute DOMString validationMessage; boolean checkValidity(); - void setCustomValidity(in [ConvertUndefinedOrNullToNullString] DOMString error); + void setCustomValidity(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString error); // WinIE & FireFox extension: attribute long selectionStart; diff --git a/Source/WebCore/html/HTMLTextFormControlElement.cpp b/Source/WebCore/html/HTMLTextFormControlElement.cpp index 04c926c88..c7f64903f 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.cpp +++ b/Source/WebCore/html/HTMLTextFormControlElement.cpp @@ -421,7 +421,7 @@ void HTMLTextFormControlElement::selectionChanged(bool userTriggered) } } -void HTMLTextFormControlElement::parseMappedAttribute(Attribute* attr) +void HTMLTextFormControlElement::parseAttribute(Attribute* attr) { if (attr->name() == placeholderAttr) updatePlaceholderVisibility(true); @@ -430,7 +430,7 @@ void HTMLTextFormControlElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == onchangeAttr) setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr)); else - HTMLFormControlElementWithState::parseMappedAttribute(attr); + HTMLFormControlElementWithState::parseAttribute(attr); } void HTMLTextFormControlElement::notifyFormStateChanged() diff --git a/Source/WebCore/html/HTMLTextFormControlElement.h b/Source/WebCore/html/HTMLTextFormControlElement.h index c13440cbf..8aff29093 100644 --- a/Source/WebCore/html/HTMLTextFormControlElement.h +++ b/Source/WebCore/html/HTMLTextFormControlElement.h @@ -85,7 +85,7 @@ protected: HTMLTextFormControlElement(const QualifiedName&, Document*, HTMLFormElement*); virtual void updatePlaceholderText() = 0; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; } diff --git a/Source/WebCore/html/HTMLTitleElement.idl b/Source/WebCore/html/HTMLTitleElement.idl index 3692c39de..e691f7b13 100644 --- a/Source/WebCore/html/HTMLTitleElement.idl +++ b/Source/WebCore/html/HTMLTitleElement.idl @@ -20,7 +20,7 @@ module html { interface HTMLTitleElement : HTMLElement { - attribute [TreatNullAs=EmptyString] DOMString text; + attribute [TreatNullAs=NullString] DOMString text; }; } diff --git a/Source/WebCore/html/HTMLTrackElement.cpp b/Source/WebCore/html/HTMLTrackElement.cpp index e723c5d08..ea2ad05c7 100644 --- a/Source/WebCore/html/HTMLTrackElement.cpp +++ b/Source/WebCore/html/HTMLTrackElement.cpp @@ -88,7 +88,7 @@ void HTMLTrackElement::removedFromDocument() HTMLElement::removedFromDocument(); } -void HTMLTrackElement::parseMappedAttribute(Attribute* attribute) +void HTMLTrackElement::parseAttribute(Attribute* attribute) { const QualifiedName& attrName = attribute->name(); @@ -97,12 +97,12 @@ void HTMLTrackElement::parseMappedAttribute(Attribute* attribute) else if (attrName == onerrorAttr) setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute)); else - HTMLElement::parseMappedAttribute(attribute); + HTMLElement::parseAttribute(attribute); } -void HTMLTrackElement::attributeChanged(Attribute* attr, bool preserveDecls) +void HTMLTrackElement::attributeChanged(Attribute* attr) { - HTMLElement::attributeChanged(attr, preserveDecls); + HTMLElement::attributeChanged(attr); if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled()) return; diff --git a/Source/WebCore/html/HTMLTrackElement.h b/Source/WebCore/html/HTMLTrackElement.h index 965e39631..d3a05544a 100644 --- a/Source/WebCore/html/HTMLTrackElement.h +++ b/Source/WebCore/html/HTMLTrackElement.h @@ -75,8 +75,8 @@ private: HTMLTrackElement(const QualifiedName&, Document*); virtual ~HTMLTrackElement(); - virtual void parseMappedAttribute(Attribute*); - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual void parseAttribute(Attribute*) OVERRIDE; + virtual void attributeChanged(Attribute*) OVERRIDE; virtual void insertedIntoDocument() OVERRIDE; virtual void removedFromDocument() OVERRIDE; diff --git a/Source/WebCore/html/HTMLTrackElement.idl b/Source/WebCore/html/HTMLTrackElement.idl index 839711e80..cee39d3b8 100644 --- a/Source/WebCore/html/HTMLTrackElement.idl +++ b/Source/WebCore/html/HTMLTrackElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack + V8EnabledAtRuntime=webkitVideoTrack ] HTMLTrackElement : HTMLElement { attribute [Reflect, URL] DOMString src; attribute DOMString kind; diff --git a/Source/WebCore/html/HTMLUListElement.cpp b/Source/WebCore/html/HTMLUListElement.cpp index 4b121aa58..cc3c06999 100644 --- a/Source/WebCore/html/HTMLUListElement.cpp +++ b/Source/WebCore/html/HTMLUListElement.cpp @@ -47,22 +47,15 @@ PassRefPtr<HTMLUListElement> HTMLUListElement::create(const QualifiedName& tagNa return adoptRef(new HTMLUListElement(tagName, document)); } -bool HTMLUListElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == typeAttr) { - result = eUnorderedList; - return false; - } - - return HTMLElement::mapToEntry(attrName, result); -} - -void HTMLUListElement::parseMappedAttribute(Attribute* attr) +void HTMLUListElement::parseAttribute(Attribute* attr) { if (attr->name() == typeAttr) - addCSSProperty(attr, CSSPropertyListStyleType, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyListStyleType); + else + addCSSProperty(CSSPropertyListStyleType, attr->value()); else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/HTMLUListElement.h b/Source/WebCore/html/HTMLUListElement.h index f91bf1c3b..c7867469f 100644 --- a/Source/WebCore/html/HTMLUListElement.h +++ b/Source/WebCore/html/HTMLUListElement.h @@ -35,8 +35,7 @@ public: private: HTMLUListElement(const QualifiedName&, Document*); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } //namespace diff --git a/Source/WebCore/html/HTMLVideoElement.cpp b/Source/WebCore/html/HTMLVideoElement.cpp index fed2fa435..c59f995e4 100644 --- a/Source/WebCore/html/HTMLVideoElement.cpp +++ b/Source/WebCore/html/HTMLVideoElement.cpp @@ -93,7 +93,7 @@ void HTMLVideoElement::detach() m_imageLoader.clear(); } -void HTMLVideoElement::parseMappedAttribute(Attribute* attr) +void HTMLVideoElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); @@ -114,11 +114,17 @@ void HTMLVideoElement::parseMappedAttribute(Attribute* attr) } #endif } else if (attrName == widthAttr) - addCSSLength(attr, CSSPropertyWidth, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyWidth); + else + addCSSLength(CSSPropertyWidth, attr->value()); else if (attrName == heightAttr) - addCSSLength(attr, CSSPropertyHeight, attr->value()); + if (attr->value().isNull()) + removeCSSProperty(CSSPropertyHeight); + else + addCSSLength(CSSPropertyHeight, attr->value()); else - HTMLMediaElement::parseMappedAttribute(attr); + HTMLMediaElement::parseAttribute(attr); } bool HTMLVideoElement::supportsFullscreen() const diff --git a/Source/WebCore/html/HTMLVideoElement.h b/Source/WebCore/html/HTMLVideoElement.h index af5acbda6..e8f6331ef 100644 --- a/Source/WebCore/html/HTMLVideoElement.h +++ b/Source/WebCore/html/HTMLVideoElement.h @@ -75,7 +75,7 @@ private: #endif virtual void attach(); virtual void detach(); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool isVideo() const { return true; } virtual bool hasVideo() const { return player() && player()->hasVideo(); } virtual bool supportsFullscreen() const; diff --git a/Source/WebCore/html/HTMLVideoElement.idl b/Source/WebCore/html/HTMLVideoElement.idl index 1099681a5..97a17796e 100644 --- a/Source/WebCore/html/HTMLVideoElement.idl +++ b/Source/WebCore/html/HTMLVideoElement.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=VIDEO, - GenerateNativeConverter + JSGenerateToNativeObject ] HTMLVideoElement : HTMLMediaElement { attribute [Reflect] unsigned long width; attribute [Reflect] unsigned long height; diff --git a/Source/WebCore/html/ImageData.idl b/Source/WebCore/html/ImageData.idl index 605020577..bbfa460a3 100644 --- a/Source/WebCore/html/ImageData.idl +++ b/Source/WebCore/html/ImageData.idl @@ -29,7 +29,7 @@ module html { interface [ - CustomToJS + JSCustomToJS ] ImageData { readonly attribute long width; readonly attribute long height; diff --git a/Source/WebCore/html/InputType.cpp b/Source/WebCore/html/InputType.cpp index 551f095ca..f34e6eb32 100644 --- a/Source/WebCore/html/InputType.cpp +++ b/Source/WebCore/html/InputType.cpp @@ -43,7 +43,6 @@ #include "HTMLInputElement.h" #include "HiddenInputType.h" #include "ImageInputType.h" -#include "IsIndexInputType.h" #include "KeyboardEvent.h" #include "LocalizedStrings.h" #include "MonthInputType.h" @@ -96,7 +95,6 @@ static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap() map->add(InputTypeNames::file(), FileInputType::create); map->add(InputTypeNames::hidden(), HiddenInputType::create); map->add(InputTypeNames::image(), ImageInputType::create); - map->add(InputTypeNames::isindex(), IsIndexInputType::create); #if ENABLE(INPUT_TYPE_MONTH) map->add(InputTypeNames::month(), MonthInputType::create); #endif @@ -731,6 +729,11 @@ String InputType::defaultToolTip() const return String(); } +bool InputType::supportsIndeterminateAppearance() const +{ + return false; +} + namespace InputTypeNames { // The type names must be lowercased because they will be the return values of @@ -798,12 +801,6 @@ const AtomicString& image() return name; } -const AtomicString& isindex() -{ - DEFINE_STATIC_LOCAL(AtomicString, name, ("khtml_isindex")); - return name; -} - const AtomicString& month() { DEFINE_STATIC_LOCAL(AtomicString, name, ("month")); diff --git a/Source/WebCore/html/InputType.h b/Source/WebCore/html/InputType.h index 93e600e8f..c76aacc8f 100644 --- a/Source/WebCore/html/InputType.h +++ b/Source/WebCore/html/InputType.h @@ -263,6 +263,8 @@ public: // string. This should not be called for types without valueAsNumber. virtual String serialize(double) const; + virtual bool supportsIndeterminateAppearance() const; + protected: InputType(HTMLInputElement* element) : m_element(element) { } HTMLInputElement* element() const { return m_element; } @@ -290,7 +292,6 @@ const AtomicString& email(); const AtomicString& file(); const AtomicString& hidden(); const AtomicString& image(); -const AtomicString& isindex(); const AtomicString& month(); const AtomicString& number(); const AtomicString& password(); diff --git a/Source/WebCore/html/MediaController.idl b/Source/WebCore/html/MediaController.idl index f7b9fb224..1899dc3d8 100644 --- a/Source/WebCore/html/MediaController.idl +++ b/Source/WebCore/html/MediaController.idl @@ -28,7 +28,7 @@ module html { Conditional=VIDEO, Constructor, CallWith=ScriptExecutionContext, - GenerateToJS, + JSGenerateToJS, EventTarget ] MediaController { readonly attribute TimeRanges buffered; diff --git a/Source/WebCore/html/NumberInputType.cpp b/Source/WebCore/html/NumberInputType.cpp index 44fb35a73..3a4d420cd 100644 --- a/Source/WebCore/html/NumberInputType.cpp +++ b/Source/WebCore/html/NumberInputType.cpp @@ -283,11 +283,19 @@ void NumberInputType::handleBlurEvent() element()->updateInnerTextValue(); } +static bool isE(UChar ch) +{ + return ch == 'e' || ch == 'E'; +} + String NumberInputType::visibleValue() const { String currentValue = element()->value(); if (currentValue.isEmpty()) return currentValue; + // We don't localize scientific notations. + if (currentValue.find(isE) != notFound) + return currentValue; // FIXME: The following three lines should be removed when we // remove the second argument of convertToLocalizedNumber(). double doubleValue = numeric_limits<double>::quiet_NaN(); @@ -300,12 +308,16 @@ String NumberInputType::convertFromVisibleValue(const String& visibleValue) cons { if (visibleValue.isEmpty()) return visibleValue; + // We don't localize scientific notations. + if (visibleValue.find(isE) != notFound) + return visibleValue; return convertFromLocalizedNumber(visibleValue); } bool NumberInputType::isAcceptableValue(const String& proposedValue) { - return proposedValue.isEmpty() || parseToDoubleForNumberType(convertFromLocalizedNumber(proposedValue), 0) || parseToDoubleForNumberType(proposedValue, 0); + String standardValue = convertFromVisibleValue(proposedValue); + return standardValue.isEmpty() || parseToDoubleForNumberType(standardValue, 0); } String NumberInputType::sanitizeValue(const String& proposedValue) const diff --git a/Source/WebCore/html/PublicURLManager.h b/Source/WebCore/html/PublicURLManager.h new file mode 100644 index 000000000..258ac067a --- /dev/null +++ b/Source/WebCore/html/PublicURLManager.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2012 Motorola Mobility 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 AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PublicURLManager_h +#define PublicURLManager_h + +#if ENABLE(BLOB) +#include "PlatformString.h" +#include "ScriptExecutionContext.h" +#include "ThreadableBlobRegistry.h" +#include <wtf/HashSet.h> + +#if ENABLE(MEDIA_STREAM) +#include "MediaStream.h" +#include "MediaStreamRegistry.h" +#endif + +namespace WebCore { + +class ScriptExecutionContext; + +class PublicURLManager { + +public: + static PassOwnPtr<PublicURLManager> create() { return adoptPtr(new PublicURLManager); } + void contextDestroyed() + { + HashSet<String>::iterator blobURLsEnd = m_blobURLs.end(); + for (HashSet<String>::iterator iter = m_blobURLs.begin(); iter != blobURLsEnd; ++iter) + ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); + +#if ENABLE(MEDIA_STREAM) + HashSet<String>::iterator streamURLsEnd = m_streamURLs.end(); + for (HashSet<String>::iterator iter = m_streamURLs.begin(); iter != streamURLsEnd; ++iter) + MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); +#endif + } + + HashSet<String>& blobURLs() { return m_blobURLs; } +#if ENABLE(MEDIA_STREAM) + HashSet<String>& streamURLs() { return m_streamURLs; } +#endif + +private: + HashSet<String> m_blobURLs; +#if ENABLE(MEDIA_STREAM) + HashSet<String> m_streamURLs; +#endif +}; + +} // namespace WebCore + +#endif // BLOB +#endif // PUBLICURLMANAGER_h diff --git a/Source/WebCore/html/RadioInputType.cpp b/Source/WebCore/html/RadioInputType.cpp index baec9e861..d31cc2daf 100644 --- a/Source/WebCore/html/RadioInputType.cpp +++ b/Source/WebCore/html/RadioInputType.cpp @@ -152,11 +152,15 @@ PassOwnPtr<ClickHandlingState> RadioInputType::willDispatchClick() OwnPtr<ClickHandlingState> state = adoptPtr(new ClickHandlingState); state->checked = element()->checked(); - state->indeterminate = element()->indeterminate(); state->checkedRadioButton = element()->checkedRadioButtons().checkedButtonForGroup(element()->name()); +#if PLATFORM(IOS) + state->indeterminate = element()->indeterminate(); + if (element()->indeterminate()) element()->setIndeterminate(false); +#endif + element()->setChecked(true, true); return state.release(); @@ -174,7 +178,11 @@ void RadioInputType::didDispatchClick(Event* event, const ClickHandlingState& st && checkedRadioButton->name() == element()->name()) { checkedRadioButton->setChecked(true); } + +#if PLATFORM(IOS) element()->setIndeterminate(state.indeterminate); +#endif + } // The work we did in willDispatchClick was default handling. @@ -186,4 +194,13 @@ bool RadioInputType::isRadioButton() const return true; } +bool RadioInputType::supportsIndeterminateAppearance() const +{ +#if PLATFORM(IOS) + return true; +#else + return false; +#endif +} + } // namespace WebCore diff --git a/Source/WebCore/html/RadioInputType.h b/Source/WebCore/html/RadioInputType.h index 9cefe516b..7790b504c 100644 --- a/Source/WebCore/html/RadioInputType.h +++ b/Source/WebCore/html/RadioInputType.h @@ -52,6 +52,7 @@ private: virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE; virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE; virtual bool isRadioButton() const OVERRIDE; + virtual bool supportsIndeterminateAppearance() const OVERRIDE; }; } // namespace WebCore diff --git a/Source/WebCore/html/TextTrack.idl b/Source/WebCore/html/TextTrack.idl index 0ac01b438..845a80c01 100644 --- a/Source/WebCore/html/TextTrack.idl +++ b/Source/WebCore/html/TextTrack.idl @@ -27,10 +27,10 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, + V8EnabledAtRuntime=webkitVideoTrack, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrack { readonly attribute DOMString kind; readonly attribute DOMString label; diff --git a/Source/WebCore/html/TextTrackCue.idl b/Source/WebCore/html/TextTrackCue.idl index 913a9bd44..4f7a40bae 100644 --- a/Source/WebCore/html/TextTrackCue.idl +++ b/Source/WebCore/html/TextTrackCue.idl @@ -27,13 +27,13 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - GenerateNativeConverter, + V8EnabledAtRuntime=webkitVideoTrack, + JSGenerateToNativeObject, Constructor(in DOMString id, in double startTime, in double endTime, in DOMString text, in [Optional=CallWithDefaultValue] DOMString settings, in [Optional=CallWithDefaultValue] boolean pauseOnExit), CallWith=ScriptExecutionContext, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrackCue { readonly attribute TextTrack track; diff --git a/Source/WebCore/html/TextTrackCueList.idl b/Source/WebCore/html/TextTrackCueList.idl index c1b700d04..551840fe9 100644 --- a/Source/WebCore/html/TextTrackCueList.idl +++ b/Source/WebCore/html/TextTrackCueList.idl @@ -27,8 +27,8 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - HasIndexGetter + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter ] TextTrackCueList { readonly attribute unsigned long length; TextTrackCue item(in unsigned long index); diff --git a/Source/WebCore/html/ValidationMessage.cpp b/Source/WebCore/html/ValidationMessage.cpp index 604e54a13..bc3c45489 100644 --- a/Source/WebCore/html/ValidationMessage.cpp +++ b/Source/WebCore/html/ValidationMessage.cpp @@ -119,7 +119,7 @@ static void adjustBubblePosition(const LayoutRect& hostRect, HTMLElement* bubble hostY -= containerLocation.y() + container->borderTop(); } - CSSMutableStyleDeclaration* style = bubble->ensureInlineStyleDecl(); + StylePropertySet* style = bubble->ensureInlineStyleDecl(); style->setProperty(CSSPropertyTop, hostY + hostRect.height(), CSSPrimitiveValue::CSS_PX); // The 'left' value of ::-webkit-validation-bubble-arrow. const int bubbleArrowTopOffset = 32; diff --git a/Source/WebCore/html/VoidCallback.idl b/Source/WebCore/html/VoidCallback.idl index 2a199751e..d0f159b83 100644 --- a/Source/WebCore/html/VoidCallback.idl +++ b/Source/WebCore/html/VoidCallback.idl @@ -25,7 +25,7 @@ module html { interface [ - CustomNativeConverter, + JSCustomToNativeObject, OmitConstructor ] VoidCallback { void handleEvent(); diff --git a/Source/WebCore/html/canvas/ArrayBuffer.idl b/Source/WebCore/html/canvas/ArrayBuffer.idl index 9ba85ca2e..a631b138c 100644 --- a/Source/WebCore/html/canvas/ArrayBuffer.idl +++ b/Source/WebCore/html/canvas/ArrayBuffer.idl @@ -26,9 +26,9 @@ module html { interface [ - GenerateIsReachable=Impl, + JSGenerateIsReachable=Impl, CustomConstructor, - NoStaticTables + JSNoStaticTables ] ArrayBuffer { readonly attribute int byteLength; ArrayBuffer slice(in long begin, in [Optional] long end); diff --git a/Source/WebCore/html/canvas/ArrayBufferView.idl b/Source/WebCore/html/canvas/ArrayBufferView.idl index 0e3d76540..ed158bfae 100644 --- a/Source/WebCore/html/canvas/ArrayBufferView.idl +++ b/Source/WebCore/html/canvas/ArrayBufferView.idl @@ -25,8 +25,8 @@ module html { interface [ - CustomToJS, - NoStaticTables, + JSCustomToJS, + JSNoStaticTables, OmitConstructor ] ArrayBufferView { readonly attribute ArrayBuffer buffer; diff --git a/Source/WebCore/html/canvas/CanvasPixelArray.idl b/Source/WebCore/html/canvas/CanvasPixelArray.idl index 8b7edbd5d..a12c8ce9b 100644 --- a/Source/WebCore/html/canvas/CanvasPixelArray.idl +++ b/Source/WebCore/html/canvas/CanvasPixelArray.idl @@ -30,9 +30,8 @@ module html { #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT || defined(V8_BINDING) && V8_BINDING interface [ OmitConstructor, - CustomHeader, - HasNumericIndexGetter, - HasCustomIndexSetter + NumericIndexedGetter, + CustomIndexedSetter ] CanvasPixelArray { #if !defined(V8_BINDING) || !V8_BINDING readonly attribute long length; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext.idl b/Source/WebCore/html/canvas/CanvasRenderingContext.idl index d8657cc8f..acdd0b75c 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext.idl @@ -26,9 +26,9 @@ module html { interface [ - CustomMarkFunction, - GenerateIsReachable, - CustomToJS + JSCustomMarkFunction, + JSGenerateIsReachable, + JSCustomToJS ] CanvasRenderingContext { readonly attribute HTMLCanvasElement canvas; diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp index a24cd692a..b0e053ff3 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp @@ -33,7 +33,6 @@ #include "AffineTransform.h" #include "CSSFontSelector.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSPropertyNames.h" #include "CSSStyleSelector.h" @@ -60,6 +59,7 @@ #include "SecurityOrigin.h" #include "Settings.h" #include "StrokeStyleApplier.h" +#include "StylePropertySet.h" #include "TextMetrics.h" #include "TextRun.h" @@ -496,7 +496,6 @@ void CanvasRenderingContext2D::setShadowColor(const String& color) { if (!parseColorOrCurrentColor(state().m_shadowColor, color, canvas())) return; - applyShadow(); } @@ -1102,26 +1101,6 @@ void CanvasRenderingContext2D::strokeRect(float x, float y, float width, float h didDraw(boundingRect); } -#if USE(CG) -static inline CGSize adjustedShadowSize(CGFloat width, CGFloat height) -{ - // Work around <rdar://problem/5539388> by ensuring that shadow offsets will get truncated - // to the desired integer. - static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128); - if (width > 0) - width += extraShadowOffset; - else if (width < 0) - width -= extraShadowOffset; - - if (height > 0) - height += extraShadowOffset; - else if (height < 0) - height -= extraShadowOffset; - - return CGSizeMake(width, height); -} -#endif - void CanvasRenderingContext2D::setShadow(float width, float height, float blur) { state().m_shadowOffset = FloatSize(width, height); @@ -1145,11 +1124,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, 1.0f); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1163,11 +1137,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowColor = colorWithOverrideAlpha(rgba, alpha); state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1176,11 +1145,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(grayLevel, grayLevel, grayLevel, alpha); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1189,11 +1153,6 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBA32FromFloats(r, g, b, a); - - GraphicsContext* c = drawingContext(); - if (!c) - return; - applyShadow(); } @@ -1202,20 +1161,7 @@ void CanvasRenderingContext2D::setShadow(float width, float height, float blur, state().m_shadowOffset = FloatSize(width, height); state().m_shadowBlur = blur; state().m_shadowColor = makeRGBAFromCMYKA(c, m, y, k, a); - - GraphicsContext* dc = drawingContext(); - if (!dc) - return; -#if USE(CG) - const CGFloat components[5] = { c, m, y, k, a }; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceCMYK(); - CGColorRef shadowColor = CGColorCreate(colorSpace, components); - CGColorSpaceRelease(colorSpace); - CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor); - CGColorRelease(shadowColor); -#else applyShadow(); -#endif } void CanvasRenderingContext2D::clearShadow() @@ -1294,10 +1240,6 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode& ec) { - if (!image) { - ec = TYPE_MISMATCH_ERR; - return; - } drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); } @@ -1364,38 +1306,22 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec } } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y, ExceptionCode& ec) +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec) { - if (!canvas) { - ec = TYPE_MISMATCH_ERR; - return; - } - - // In order to emulate drawing the result of toDataURL() into the canvas, we - // need to deflate the size of the source rectangle by the source canvas's - // backing store scale factor. - // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=15041 for motivation. - - FloatSize logicalSize = canvas->convertDeviceToLogical(canvas->size()); - - drawImage(canvas, 0, 0, logicalSize.width(), logicalSize.height(), x, y, canvas->width(), canvas->height(), ec); + drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, float width, float height, ExceptionCode& ec) { - if (!canvas) { - ec = TYPE_MISMATCH_ERR; - return; - } - drawImage(canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec); + drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), ec); } -void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, +void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh, ExceptionCode& ec) { - drawImage(canvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); + drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); } void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const FloatRect& srcRect, @@ -1978,7 +1904,7 @@ void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy, IntRect sourceRect(destRect); sourceRect.move(-destOffset); - buffer->putUnmultipliedImageData(data->data()->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset)); + buffer->putByteArray(Unmultiplied, data->data()->data(), IntSize(data->width(), data->height()), sourceRect, IntPoint(destOffset)); didDraw(destRect, CanvasDidDrawApplyNone); // ignore transform, shadow and clip } @@ -1989,7 +1915,7 @@ String CanvasRenderingContext2D::font() const void CanvasRenderingContext2D::setFont(const String& newFont) { - RefPtr<CSSMutableStyleDeclaration> tempDecl = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> tempDecl = StylePropertySet::create(); CSSParser parser(!m_usesCSSCompatibilityParseMode); String declarationText("font: "); diff --git a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl index d7efe1328..d4560f7a0 100644 --- a/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl +++ b/Source/WebCore/html/canvas/CanvasRenderingContext2D.idl @@ -49,7 +49,7 @@ module html { in [Optional=CallWithDefaultValue] float dy); attribute float globalAlpha; - attribute [TreatNullAs=EmptyString] DOMString globalCompositeOperation; + attribute [TreatNullAs=NullString] DOMString globalCompositeOperation; CanvasGradient createLinearGradient(in [Optional=CallWithDefaultValue] float x0, in [Optional=CallWithDefaultValue] float y0, @@ -65,14 +65,14 @@ module html { raises (DOMException); attribute float lineWidth; - attribute [TreatNullAs=EmptyString] DOMString lineCap; - attribute [TreatNullAs=EmptyString] DOMString lineJoin; + attribute [TreatNullAs=NullString] DOMString lineCap; + attribute [TreatNullAs=NullString] DOMString lineJoin; attribute float miterLimit; attribute float shadowOffsetX; attribute float shadowOffsetY; attribute float shadowBlur; - attribute [TreatNullAs=EmptyString] DOMString shadowColor; + attribute [TreatNullAs=NullString] DOMString shadowColor; // FIXME: These attributes should also be implemented for V8. #if !(defined(V8_BINDING) && V8_BINDING) @@ -204,9 +204,9 @@ module html { void putImageData(in ImageData imagedata, in float dx, in float dy, in float dirtyX, in float dirtyY, in float dirtyWidth, in float dirtyHeight) raises(DOMException); - CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs=EmptyString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLCanvasElement canvas, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); - CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=EmptyString] DOMString repetitionType) + CanvasPattern createPattern(in HTMLImageElement image, in [TreatNullAs=NullString] DOMString repetitionType) raises (DOMException); ImageData createImageData(in ImageData imagedata) raises (DOMException); diff --git a/Source/WebCore/html/canvas/DataView.idl b/Source/WebCore/html/canvas/DataView.idl index bba13c93a..9530220dc 100755 --- a/Source/WebCore/html/canvas/DataView.idl +++ b/Source/WebCore/html/canvas/DataView.idl @@ -27,8 +27,8 @@ module html { interface [ CustomConstructor, - CustomToJS, - NoStaticTables + JSCustomToJS, + JSNoStaticTables ] DataView : ArrayBufferView { // All these methods raise an exception if they would read or write beyond the end of the view. @@ -50,9 +50,9 @@ module html { raises (DOMException); // Use custom code to handle NaN case for JSC. - [JSCCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) + [JSCustom, StrictTypeChecking] float getFloat32(in unsigned long byteOffset, in [Optional] boolean littleEndian) raises (DOMException); - [JSCCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) + [JSCustom, StrictTypeChecking] double getFloat64(in unsigned long byteOffset, in [Optional] boolean littleEndian) raises (DOMException); // We have to use custom code because our code generator does not support uint8_t type. diff --git a/Source/WebCore/html/canvas/Float32Array.idl b/Source/WebCore/html/canvas/Float32Array.idl index ef6c956b7..785ed819c 100644 --- a/Source/WebCore/html/canvas/Float32Array.idl +++ b/Source/WebCore/html/canvas/Float32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Float32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Float64Array.idl b/Source/WebCore/html/canvas/Float64Array.idl index 01495350b..7180811fa 100644 --- a/Source/WebCore/html/canvas/Float64Array.idl +++ b/Source/WebCore/html/canvas/Float64Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Float64Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 8; diff --git a/Source/WebCore/html/canvas/Int16Array.idl b/Source/WebCore/html/canvas/Int16Array.idl index b1a547180..40e18d530 100644 --- a/Source/WebCore/html/canvas/Int16Array.idl +++ b/Source/WebCore/html/canvas/Int16Array.idl @@ -26,12 +26,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int16Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 2; diff --git a/Source/WebCore/html/canvas/Int32Array.idl b/Source/WebCore/html/canvas/Int32Array.idl index bad745d6e..0f5320ac4 100644 --- a/Source/WebCore/html/canvas/Int32Array.idl +++ b/Source/WebCore/html/canvas/Int32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Int8Array.idl b/Source/WebCore/html/canvas/Int8Array.idl index 4ae2eace6..9984ada66 100644 --- a/Source/WebCore/html/canvas/Int8Array.idl +++ b/Source/WebCore/html/canvas/Int8Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Int8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/OESStandardDerivatives.idl b/Source/WebCore/html/canvas/OESStandardDerivatives.idl index f1d4740b2..93f0a01d8 100644 --- a/Source/WebCore/html/canvas/OESStandardDerivatives.idl +++ b/Source/WebCore/html/canvas/OESStandardDerivatives.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] OESStandardDerivatives { const unsigned int FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B; }; diff --git a/Source/WebCore/html/canvas/OESTextureFloat.idl b/Source/WebCore/html/canvas/OESTextureFloat.idl index 950c355c3..6537f4707 100644 --- a/Source/WebCore/html/canvas/OESTextureFloat.idl +++ b/Source/WebCore/html/canvas/OESTextureFloat.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] OESTextureFloat { }; diff --git a/Source/WebCore/html/canvas/OESVertexArrayObject.idl b/Source/WebCore/html/canvas/OESVertexArrayObject.idl index cfb6506bb..c4adf99d8 100644 --- a/Source/WebCore/html/canvas/OESVertexArrayObject.idl +++ b/Source/WebCore/html/canvas/OESVertexArrayObject.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] OESVertexArrayObject { const unsigned int VERTEX_ARRAY_BINDING_OES = 0x85B5; diff --git a/Source/WebCore/html/canvas/Uint16Array.idl b/Source/WebCore/html/canvas/Uint16Array.idl index bb08a4f01..83877b582 100644 --- a/Source/WebCore/html/canvas/Uint16Array.idl +++ b/Source/WebCore/html/canvas/Uint16Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint16Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 2; diff --git a/Source/WebCore/html/canvas/Uint32Array.idl b/Source/WebCore/html/canvas/Uint32Array.idl index 2a87885a7..2726473cb 100644 --- a/Source/WebCore/html/canvas/Uint32Array.idl +++ b/Source/WebCore/html/canvas/Uint32Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint32Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 4; diff --git a/Source/WebCore/html/canvas/Uint8Array.idl b/Source/WebCore/html/canvas/Uint8Array.idl index 1a6f5889f..4892da8a8 100644 --- a/Source/WebCore/html/canvas/Uint8Array.idl +++ b/Source/WebCore/html/canvas/Uint8Array.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint8Array : ArrayBufferView { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/Uint8ClampedArray.idl b/Source/WebCore/html/canvas/Uint8ClampedArray.idl index 31b8247de..a9a49f362 100644 --- a/Source/WebCore/html/canvas/Uint8ClampedArray.idl +++ b/Source/WebCore/html/canvas/Uint8ClampedArray.idl @@ -27,12 +27,12 @@ module html { interface [ CustomConstructor, - HasNumericIndexGetter, - HasCustomIndexSetter, - GenerateNativeConverter, - NoStaticTables, - CustomToJS, - DontCheckEnums + NumericIndexedGetter, + CustomIndexedSetter, + JSGenerateToNativeObject, + JSNoStaticTables, + JSCustomToJS, + DoNotCheckConstants ] Uint8ClampedArray : Uint8Array { const unsigned int BYTES_PER_ELEMENT = 1; diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp new file mode 100644 index 000000000..02357ef35 --- /dev/null +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(WEBGL) + +#include "WebGLCompressedTextureS3TC.h" + +#include "Extensions3D.h" +#include "WebGLRenderingContext.h" + +#include <wtf/Int32Array.h> +#include <wtf/OwnArrayPtr.h> + +namespace WebCore { + +WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC(WebGLRenderingContext* context) + : WebGLExtension(context) +{ + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT); + context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT); +} + +WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC() +{ +} + +WebGLExtension::ExtensionName WebGLCompressedTextureS3TC::getName() const +{ + return WebKitWebGLCompressedTextureS3TCName; +} + +PassOwnPtr<WebGLCompressedTextureS3TC> WebGLCompressedTextureS3TC::create(WebGLRenderingContext* context) +{ + return adoptPtr(new WebGLCompressedTextureS3TC(context)); +} + +bool WebGLCompressedTextureS3TC::supported(WebGLRenderingContext* context) +{ + Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); + return extensions->supports("GL_EXT_texture_compression_s3tc") + || (extensions->supports("GL_EXT_texture_compression_dxt1") + && extensions->supports("GL_CHROMIUM_texture_compression_dxt3") + && extensions->supports("GL_CHROMIUM_texture_compression_dxt5")); +} + +} // namespace WebCore + +#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.h b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h index 52b71c213..93242cb83 100644 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.h +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,54 +23,30 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebGLCompressedTextures_h -#define WebGLCompressedTextures_h +#ifndef WebGLCompressedTextureS3TC_h +#define WebGLCompressedTextureS3TC_h #include "ExceptionCode.h" #include "WebGLExtension.h" -#include <wtf/ArrayBufferView.h> #include <wtf/PassOwnPtr.h> namespace WebCore { class WebGLTexture; -class WebGLCompressedTextures : public WebGLExtension { +class WebGLCompressedTextureS3TC : public WebGLExtension { public: - static PassOwnPtr<WebGLCompressedTextures> create(WebGLRenderingContext*); + static PassOwnPtr<WebGLCompressedTextureS3TC> create(WebGLRenderingContext*); static bool supported(WebGLRenderingContext*); - virtual ~WebGLCompressedTextures(); + virtual ~WebGLCompressedTextureS3TC(); virtual ExtensionName getName() const; - void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, - GC3Dsizei height, GC3Dint border, ArrayBufferView* data); - void compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data); - - WebGLGetInfo getCompressedTextureFormats(); - private: - WebGLCompressedTextures(WebGLRenderingContext*); - - bool validateCompressedTexFuncData(const char* functionName, - GC3Dsizei width, GC3Dsizei height, - GC3Denum format, ArrayBufferView* pixels); - - bool validateCompressedTexFormat(GC3Denum format); - - bool validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*); - - bool m_supportsDxt1; - bool m_supportsDxt5; - bool m_supportsEtc1; - bool m_supportsPvrtc; - - Vector<int> m_formats; + WebGLCompressedTextureS3TC(WebGLRenderingContext*); }; } // namespace WebCore -#endif // WebGLCompressedTextures_h +#endif // WebGLCompressedTextureS3TC_h diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.idl b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl index bbd9a256c..7fde5bba9 100644 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.idl +++ b/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,21 +26,14 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums - ] WebGLCompressedTextures { + DoNotCheckConstants + ] WebGLCompressedTextureS3TC { /* Compressed Texture Formats */ const unsigned int COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0; const unsigned int COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1; + const unsigned int COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2; const unsigned int COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3; - const unsigned int ETC1_RGB8_OES = 0x8D64; - const unsigned int COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00; - const unsigned int COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02; - - [StrictTypeChecking] void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, - in long width, in long height, in long border, in ArrayBufferView data); - [StrictTypeChecking] void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, - in long width, in long height, in unsigned long format, in ArrayBufferView data); }; } diff --git a/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp b/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp deleted file mode 100644 index 151980caa..000000000 --- a/Source/WebCore/html/canvas/WebGLCompressedTextures.cpp +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#if ENABLE(WEBGL) - -#include "WebGLCompressedTextures.h" - -#include "Extensions3D.h" -#include "WebGLRenderingContext.h" - -#include <wtf/Int32Array.h> -#include <wtf/OwnArrayPtr.h> - -namespace WebCore { - -WebGLCompressedTextures::WebGLCompressedTextures(WebGLRenderingContext* context) - : WebGLExtension(context) - , m_supportsDxt1(false) - , m_supportsDxt5(false) - , m_supportsEtc1(false) - , m_supportsPvrtc(false) -{ - Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); - if (extensions->supports("GL_EXT_texture_compression_dxt1")) { - extensions->ensureEnabled("GL_EXT_texture_compression_dxt1"); - m_supportsDxt1 = true; - } - if (extensions->supports("GL_EXT_texture_compression_s3tc")) { - extensions->ensureEnabled("GL_EXT_texture_compression_s3tc"); - m_supportsDxt1 = true; - m_supportsDxt5 = true; - } - if (extensions->supports("GL_CHROMIUM_texture_compression_dxt5")) { - extensions->ensureEnabled("GL_CHROMIUM_texture_compression_dxt5"); - m_supportsDxt5 = true; - } - if (extensions->supports("GL_OES_compressed_ETC1_RGB8_texture")) { - extensions->ensureEnabled("GL_OES_compressed_ETC1_RGB8_texture"); - m_supportsEtc1 = true; - } - if (extensions->supports("GL_IMG_texture_compression_pvrtc")) { - extensions->ensureEnabled("GL_IMG_texture_compression_pvrtc"); - m_supportsPvrtc = true; - } - - if (m_supportsDxt1) { - m_formats.append(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT); - m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT); - } - - if (m_supportsDxt5) - m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT); - - if (m_supportsEtc1) - m_formats.append(Extensions3D::ETC1_RGB8_OES); - - if (m_supportsPvrtc) { - m_formats.append(Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG); - m_formats.append(Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG); - } -} - -WebGLCompressedTextures::~WebGLCompressedTextures() -{ -} - -WebGLExtension::ExtensionName WebGLCompressedTextures::getName() const -{ - return WebKitWebGLCompressedTexturesName; -} - -PassOwnPtr<WebGLCompressedTextures> WebGLCompressedTextures::create(WebGLRenderingContext* context) -{ - return adoptPtr(new WebGLCompressedTextures(context)); -} - -bool WebGLCompressedTextures::supported(WebGLRenderingContext* context) -{ - Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); - return extensions->supports("GL_EXT_texture_compression_dxt1") - || extensions->supports("GL_EXT_texture_compression_s3tc") - || extensions->supports("GL_CHROMIUM_texture_compression_dxt5") - || extensions->supports("GL_OES_compressed_ETC1_RGB8_texture") - || extensions->supports("GL_IMG_texture_compression_pvrtc"); -} - -bool WebGLCompressedTextures::validateCompressedTexFormat(GC3Denum format) -{ - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - return m_supportsDxt1; - case Extensions3D::ETC1_RGB8_OES: - return m_supportsEtc1; - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - return m_supportsDxt5; - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - return m_supportsPvrtc; - } - return false; -} - -bool WebGLCompressedTextures::validateCompressedTexFuncData(const char* functionName, - GC3Dsizei width, GC3Dsizei height, - GC3Denum format, ArrayBufferView* pixels) -{ - if (!pixels) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels"); - return false; - } - if (width < 0 || height < 0) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0"); - return false; - } - - unsigned int bytesRequired = 0; - - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - case Extensions3D::ETC1_RGB8_OES: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - const int kBlockSize = 8; - int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; - int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; - int numBlocks = numBlocksAcross * numBlocksDown; - bytesRequired = numBlocks * kBlockSize; - } - break; - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - const int kBlockSize = 16; - int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; - int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; - int numBlocks = numBlocksAcross * numBlocksDown; - bytesRequired = numBlocks * kBlockSize; - } - break; - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - { - bytesRequired = (std::max(width, 8) * std::max(height, 8) + 7) / 8; - } - break; - default: - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format"); - return false; - } - - if (pixels->byteLength() != bytesRequired) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions"); - return false; - } - - return true; -} - -bool WebGLCompressedTextures::validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex) -{ - switch (format) { - case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: - case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: - case Extensions3D::ETC1_RGB8_OES: - { - const int kBlockWidth = 4; - const int kBlockHeight = 4; - if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) - return false; - if (!xoffset) { - if (width != tex->getWidth(target, level)) - return false; - } else { - if (width % kBlockWidth) - return false; - } - if (!yoffset) { - if (height != tex->getHeight(target, level)) - return false; - } else { - if (height % kBlockHeight) - return false; - } - return true; - } - case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG: - case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: - { - if (xoffset || yoffset - || width != tex->getWidth(target, level) || height != tex->getHeight(target, level)) { - return false; - } - return true; - } - } - return false; -} - -void WebGLCompressedTextures::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, - GC3Dsizei height, GC3Dint border, ArrayBufferView* data) -{ - if (m_context->isContextLost()) - return; - if (!validateCompressedTexFormat(internalformat)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); - return; - } - if (border) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0"); - return; - } - if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data)) - return; - WebGLTexture* tex = m_context->validateTextureBinding("compressedTexImage2D", target, true); - if (!tex) - return; - if (!m_context->isGLES2NPOTStrict()) { - if (level && WebGLTexture::isNPOT(width, height)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2"); - return; - } - } - m_context->graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height, - border, data->byteLength(), data->baseAddress()); - tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); - m_context->cleanupAfterGraphicsCall(false); -} - -void WebGLCompressedTextures::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, - GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data) -{ - if (m_context->isContextLost()) - return; - if (!validateCompressedTexFormat(format)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); - return; - } - if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data)) - return; - - WebGLTexture* tex = m_context->validateTextureBinding("compressedTexSubImage2D", target, true); - if (!tex) - return; - - if (format != tex->getInternalFormat(target, level)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexSubImage2D", "format does not match texture format"); - return; - } - - if (!validateCompressedTexSubDimensions(target, level, xoffset, yoffset, width, height, format, tex)) { - m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "dimensions invalid for format"); - return; - } - - m_context->graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset, - width, height, format, data->byteLength(), data->baseAddress()); - m_context->cleanupAfterGraphicsCall(false); -} - -WebGLGetInfo WebGLCompressedTextures::getCompressedTextureFormats() -{ - return WebGLGetInfo(Int32Array::create(&m_formats[0], m_formats.size())); -} - -} // namespace WebCore - -#endif // ENABLE(WEBGL) diff --git a/Source/WebCore/html/canvas/WebGLContextEvent.idl b/Source/WebCore/html/canvas/WebGLContextEvent.idl index 8b4bbddbc..3735f1245 100644 --- a/Source/WebCore/html/canvas/WebGLContextEvent.idl +++ b/Source/WebCore/html/canvas/WebGLContextEvent.idl @@ -29,7 +29,7 @@ module html { Conditional=WEBGL, ConstructorTemplate=Event ] WebGLContextEvent : Event { - readonly attribute [InitializedByConstructor] DOMString statusMessage; + readonly attribute [InitializedByEventConstructor] DOMString statusMessage; }; } diff --git a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl index da2082a2c..b307a1498 100644 --- a/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl +++ b/Source/WebCore/html/canvas/WebGLDebugRendererInfo.idl @@ -26,9 +26,9 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] WebGLDebugRendererInfo { const unsigned int UNMASKED_VENDOR_WEBGL = 0x9245; const unsigned int UNMASKED_RENDERER_WEBGL = 0x9246; diff --git a/Source/WebCore/html/canvas/WebGLDebugShaders.idl b/Source/WebCore/html/canvas/WebGLDebugShaders.idl index ce120327d..82d047550 100644 --- a/Source/WebCore/html/canvas/WebGLDebugShaders.idl +++ b/Source/WebCore/html/canvas/WebGLDebugShaders.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] WebGLDebugShaders { [StrictTypeChecking, ConvertNullStringTo=Null] DOMString getTranslatedShaderSource(in WebGLShader shader) raises(DOMException); diff --git a/Source/WebCore/html/canvas/WebGLExtension.h b/Source/WebCore/html/canvas/WebGLExtension.h index 4ff969086..ff482facd 100644 --- a/Source/WebCore/html/canvas/WebGLExtension.h +++ b/Source/WebCore/html/canvas/WebGLExtension.h @@ -40,7 +40,7 @@ public: OESVertexArrayObjectName, WebGLDebugRendererInfoName, WebGLDebugShadersName, - WebKitWebGLCompressedTexturesName, // WEBKIT_ prefix until extension is official + WebKitWebGLCompressedTextureS3TCName, // WEBKIT_ prefix until extension is official }; void ref() { m_context->ref(); } diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.cpp b/Source/WebCore/html/canvas/WebGLGetInfo.cpp index 87bec7919..f7166c419 100644 --- a/Source/WebCore/html/canvas/WebGLGetInfo.cpp +++ b/Source/WebCore/html/canvas/WebGLGetInfo.cpp @@ -38,6 +38,7 @@ #include "WebGLVertexArrayObjectOES.h" #include <wtf/Float32Array.h> #include <wtf/Int32Array.h> +#include <wtf/Uint32Array.h> #include <wtf/Uint8Array.h> namespace WebCore { @@ -191,6 +192,16 @@ WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint8Array> value) { } +WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint32Array> value) + : m_type(kTypeWebGLUnsignedIntArray) + , m_bool(false) + , m_float(0) + , m_int(0) + , m_unsignedInt(0) + , m_webglUnsignedIntArray(value) +{ +} + WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value) : m_type(kTypeWebGLVertexArrayObjectOES) , m_bool(false) @@ -294,6 +305,12 @@ PassRefPtr<Uint8Array> WebGLGetInfo::getWebGLUnsignedByteArray() const return m_webglUnsignedByteArray; } +PassRefPtr<Uint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const +{ + ASSERT(getType() == kTypeWebGLUnsignedIntArray); + return m_webglUnsignedIntArray; +} + PassRefPtr<WebGLVertexArrayObjectOES> WebGLGetInfo::getWebGLVertexArrayObjectOES() const { ASSERT(getType() == kTypeWebGLVertexArrayObjectOES); diff --git a/Source/WebCore/html/canvas/WebGLGetInfo.h b/Source/WebCore/html/canvas/WebGLGetInfo.h index f747a0902..d1f73a656 100644 --- a/Source/WebCore/html/canvas/WebGLGetInfo.h +++ b/Source/WebCore/html/canvas/WebGLGetInfo.h @@ -39,6 +39,7 @@ #include <wtf/Int32Array.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +#include <wtf/Uint32Array.h> #include <wtf/Uint8Array.h> namespace WebCore { @@ -67,6 +68,7 @@ public: kTypeWebGLRenderbuffer, kTypeWebGLTexture, kTypeWebGLUnsignedByteArray, + kTypeWebGLUnsignedIntArray, kTypeWebGLVertexArrayObjectOES, }; @@ -88,6 +90,7 @@ public: explicit WebGLGetInfo(PassRefPtr<WebGLRenderbuffer> value); explicit WebGLGetInfo(PassRefPtr<WebGLTexture> value); explicit WebGLGetInfo(PassRefPtr<Uint8Array> value); + explicit WebGLGetInfo(PassRefPtr<Uint32Array> value); explicit WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value); virtual ~WebGLGetInfo(); @@ -110,6 +113,7 @@ public: PassRefPtr<WebGLRenderbuffer> getWebGLRenderbuffer() const; PassRefPtr<WebGLTexture> getWebGLTexture() const; PassRefPtr<Uint8Array> getWebGLUnsignedByteArray() const; + PassRefPtr<Uint32Array> getWebGLUnsignedIntArray() const; PassRefPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const; private: @@ -130,6 +134,7 @@ private: RefPtr<WebGLRenderbuffer> m_webglRenderbuffer; RefPtr<WebGLTexture> m_webglTexture; RefPtr<Uint8Array> m_webglUnsignedByteArray; + RefPtr<Uint32Array> m_webglUnsignedIntArray; RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObject; }; diff --git a/Source/WebCore/html/canvas/WebGLLoseContext.idl b/Source/WebCore/html/canvas/WebGLLoseContext.idl index 50955cbb6..390da2638 100644 --- a/Source/WebCore/html/canvas/WebGLLoseContext.idl +++ b/Source/WebCore/html/canvas/WebGLLoseContext.idl @@ -26,7 +26,7 @@ module html { interface [ Conditional=WEBGL, - GenerateIsReachable=ImplContext, + JSGenerateIsReachable=ImplContext, OmitConstructor ] WebGLLoseContext { [StrictTypeChecking] void loseContext(); diff --git a/Source/WebCore/html/canvas/WebGLObject.cpp b/Source/WebCore/html/canvas/WebGLObject.cpp index 192852c75..6d7b9d8cf 100644 --- a/Source/WebCore/html/canvas/WebGLObject.cpp +++ b/Source/WebCore/html/canvas/WebGLObject.cpp @@ -32,7 +32,7 @@ #include "OESStandardDerivatives.h" #include "OESTextureFloat.h" #include "OESVertexArrayObject.h" -#include "WebGLCompressedTextures.h" +#include "WebGLCompressedTextureS3TC.h" #include "WebGLContextGroup.h" #include "WebGLDebugRendererInfo.h" #include "WebGLDebugShaders.h" diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp index 945c17e74..9a5a295b5 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp @@ -54,7 +54,7 @@ #include "Settings.h" #include "WebGLActiveInfo.h" #include "WebGLBuffer.h" -#include "WebGLCompressedTextures.h" +#include "WebGLCompressedTextureS3TC.h" #include "WebGLContextAttributes.h" #include "WebGLContextEvent.h" #include "WebGLContextGroup.h" @@ -72,6 +72,7 @@ #include <wtf/OwnArrayPtr.h> #include <wtf/PassOwnArrayPtr.h> #include <wtf/Uint16Array.h> +#include <wtf/Uint32Array.h> #include <wtf/text/StringBuilder.h> #if PLATFORM(QT) @@ -404,7 +405,7 @@ PassOwnPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElemen RefPtr<GraphicsContext3D> context(GraphicsContext3D::create(attributes, hostWindow)); - if (!context) { + if (!context || !context->makeContextCurrent()) { canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Could not create a WebGL context.")); return nullptr; } @@ -517,6 +518,10 @@ void WebGLRenderingContext::setupFlags() { ASSERT(m_context); + Page* p = canvas()->document()->page(); + if (p && p->settings()->webGLErrorsToConsoleEnabled()) + m_synthesizedErrorsToConsole = true; + m_isGLES2Compliant = m_context->isGLES2Compliant(); m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions()->isEnabled("GL_CHROMIUM_strict_attribs"); m_isResourceSafe = m_context->getExtensions()->isEnabled("GL_CHROMIUM_resource_safe"); @@ -537,6 +542,12 @@ bool WebGLRenderingContext::allowPrivilegedExtensions() const return false; } +void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) +{ + if (!m_compressedTextureFormats.contains(format)) + m_compressedTextureFormats.append(format); +} + WebGLRenderingContext::~WebGLRenderingContext() { // Remove all references to WebGLObjects so if they are the last reference @@ -1208,24 +1219,71 @@ void WebGLRenderingContext::compileShader(WebGLShader* shader, ExceptionCode& ec cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::compressedTexImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Denum /*internalformat*/, GC3Dsizei /*width*/, - GC3Dsizei /*height*/, GC3Dint /*border*/, ArrayBufferView* /*data*/) +void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, + GC3Dsizei height, GC3Dint border, ArrayBufferView* data) { if (isContextLost()) return; + if (!validateTexFuncLevel("compressedTexImage2D", target, level)) + return; + + if (!validateCompressedTexFormat(internalformat)) { + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); + return; + } + if (border) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0"); + return; + } + if (!validateCompressedTexDimensions("compressedTexImage2D", level, width, height, internalformat)) + return; + if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data)) + return; - // FIXME: implement this. - synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat"); + WebGLTexture* tex = validateTextureBinding("compressedTexImage2D", target, true); + if (!tex) + return; + if (!isGLES2NPOTStrict()) { + if (level && WebGLTexture::isNPOT(width, height)) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2"); + return; + } + } + graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height, + border, data->byteLength(), data->baseAddress()); + tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE); + cleanupAfterGraphicsCall(false); } -void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Dint /*xoffset*/, GC3Dint /*yoffset*/, - GC3Dsizei /*width*/, GC3Dsizei /*height*/, GC3Denum /*format*/, ArrayBufferView* /*data*/) +void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data) { if (isContextLost()) return; + if (!validateTexFuncLevel("compressedTexSubImage2D", target, level)) + return; + if (!validateCompressedTexFormat(format)) { + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); + return; + } + if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data)) + return; + + WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target, true); + if (!tex) + return; + + if (format != tex->getInternalFormat(target, level)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "format does not match texture format"); + return; + } + + if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, tex)) + return; - // FIXME: implement this. - synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format"); + graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset, + width, height, format, data->byteLength(), data->baseAddress()); + cleanupAfterGraphicsCall(false); } void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) @@ -2186,11 +2244,11 @@ WebGLExtension* WebGLRenderingContext::getExtension(const String& name) m_webglLoseContext = WebGLLoseContext::create(this); return m_webglLoseContext.get(); } - if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_textures")) { + if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_s3tc")) { // Use WEBKIT_ prefix until extension is official. - if (!m_webglCompressedTextures) - m_webglCompressedTextures = WebGLCompressedTextures::create(this); - return m_webglCompressedTextures.get(); + if (!m_webglCompressedTextureS3TC) + m_webglCompressedTextureS3TC = WebGLCompressedTextureS3TC::create(this); + return m_webglCompressedTextureS3TC.get(); } if (allowPrivilegedExtensions()) { @@ -2303,10 +2361,7 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& case GraphicsContext3D::COLOR_WRITEMASK: return getBooleanArrayParameter(pname); case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS: - if (m_webglCompressedTextures) - return m_webglCompressedTextures->getCompressedTextureFormats(); - // Defined as null in the spec - return WebGLGetInfo(); + return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size())); case GraphicsContext3D::CULL_FACE: return getBooleanParameter(pname); case GraphicsContext3D::CULL_FACE_MODE: @@ -2361,9 +2416,6 @@ WebGLGetInfo WebGLRenderingContext::getParameter(GC3Denum pname, ExceptionCode& return getIntParameter(pname); case GraphicsContext3D::MAX_VIEWPORT_DIMS: return getWebGLIntArrayParameter(pname); - case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS: - // WebGL 1.0 specifies that there are no compressed texture formats. - return WebGLGetInfo(static_cast<int>(0)); case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS: // FIXME: should we always return 0 for this? return getIntParameter(pname); @@ -2513,7 +2565,7 @@ String WebGLRenderingContext::getProgramInfoLog(WebGLProgram* program, Exception if (!validateWebGLObject("getProgramInfoLog", program)) return ""; WebGLStateRestorer(this, false); - return m_context->getProgramInfoLog(objectOrZero(program)); + return ensureNotNull(m_context->getProgramInfoLog(objectOrZero(program))); } WebGLGetInfo WebGLRenderingContext::getRenderbufferParameter(GC3Denum target, GC3Denum pname, ExceptionCode& ec) @@ -2613,7 +2665,7 @@ String WebGLRenderingContext::getShaderInfoLog(WebGLShader* shader, ExceptionCod if (!validateWebGLObject("getShaderInfoLog", shader)) return ""; WebGLStateRestorer(this, false); - return m_context->getShaderInfoLog(objectOrZero(shader)); + return ensureNotNull(m_context->getShaderInfoLog(objectOrZero(shader))); } String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode& ec) @@ -2623,7 +2675,7 @@ String WebGLRenderingContext::getShaderSource(WebGLShader* shader, ExceptionCode return String(); if (!validateWebGLObject("getShaderSource", shader)) return ""; - return shader->getSource(); + return ensureNotNull(shader->getSource()); } Vector<String> WebGLRenderingContext::getSupportedExtensions() @@ -2636,8 +2688,8 @@ Vector<String> WebGLRenderingContext::getSupportedExtensions() if (m_context->getExtensions()->supports("GL_OES_vertex_array_object")) result.append("OES_vertex_array_object"); result.append("WEBKIT_WEBGL_lose_context"); - if (WebGLCompressedTextures::supported(this)) - result.append("WEBKIT_WEBGL_compressed_textures"); + if (WebGLCompressedTextureS3TC::supported(this)) + result.append("WEBKIT_WEBGL_compressed_texture_s3tc"); if (allowPrivilegedExtensions()) { if (m_context->getExtensions()->supports("GL_ANGLE_translated_shader_source")) @@ -4681,6 +4733,117 @@ bool WebGLRenderingContext::validateTexFuncData(const char* functionName, return true; } +bool WebGLRenderingContext::validateCompressedTexFormat(GC3Denum format) +{ + return m_compressedTextureFormats.contains(format); +} + +bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionName, + GC3Dsizei width, GC3Dsizei height, + GC3Denum format, ArrayBufferView* pixels) +{ + if (!pixels) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels"); + return false; + } + if (width < 0 || height < 0) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0"); + return false; + } + + unsigned int bytesRequired = 0; + + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + const int kBlockSize = 8; + int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; + int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; + int numBlocks = numBlocksAcross * numBlocksDown; + bytesRequired = numBlocks * kBlockSize; + } + break; + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: + { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + const int kBlockSize = 16; + int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth; + int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight; + int numBlocks = numBlocksAcross * numBlocksDown; + bytesRequired = numBlocks * kBlockSize; + } + break; + default: + synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format"); + return false; + } + + if (pixels->byteLength() != bytesRequired) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions"); + return false; + } + + return true; +} + +bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format) +{ + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + bool widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth); + bool heightValid = (level && height == 1) || (level && height == 2) || !(height % kBlockHeight); + if (!widthValid || !heightValid) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level"); + return false; + } + return true; + } + default: + return false; + } +} + +bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex) +{ + if (xoffset < 0 || yoffset < 0) { + synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0"); + return false; + } + + switch (format) { + case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT: + case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: { + const int kBlockWidth = 4; + const int kBlockHeight = 4; + if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "xoffset or yoffset not multiple of 4"); + return false; + } + if (width - xoffset > tex->getWidth(target, level) + || height - yoffset > tex->getHeight(target, level)) { + synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "dimensions out of range"); + return false; + } + return validateCompressedTexDimensions(functionName, level, width, height, format); + } + default: + return false; + } +} + bool WebGLRenderingContext::validateDrawMode(const char* functionName, GC3Denum mode) { switch (mode) { @@ -5123,6 +5286,13 @@ void WebGLRenderingContext::maybeRestoreContext(Timer<WebGLRenderingContext>*) canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, "")); } +String WebGLRenderingContext::ensureNotNull(const String& text) const +{ + if (text.isNull()) + return WTF::emptyString(); + return text; +} + WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity) : m_buffers(adoptArrayPtr(new OwnPtr<ImageBuffer>[capacity])) , m_capacity(capacity) diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.h b/Source/WebCore/html/canvas/WebGLRenderingContext.h index 620b4d4e6..0449eade1 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.h +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.h @@ -52,7 +52,7 @@ class WebGLActiveInfo; class WebGLBuffer; class WebGLContextGroup; class WebGLContextObject; -class WebGLCompressedTextures; +class WebGLCompressedTextureS3TC; class WebGLContextAttributes; class WebGLDebugRendererInfo; class WebGLDebugShaders; @@ -321,7 +321,7 @@ public: friend class WebGLObject; friend class OESVertexArrayObject; friend class WebGLDebugShaders; - friend class WebGLCompressedTextures; + friend class WebGLCompressedTextureS3TC; friend class WebGLRenderingContextErrorMessageCallback; WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes); @@ -367,6 +367,9 @@ public: bool validateWebGLObject(const char*, WebGLObject*); + // Adds a compressed texture format. + void addCompressedTextureFormat(GC3Denum); + #if ENABLE(VIDEO) PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, ExceptionCode&); #endif @@ -443,6 +446,8 @@ public: RefPtr<WebGLTexture> m_blackTexture2D; RefPtr<WebGLTexture> m_blackTextureCubeMap; + Vector<GC3Denum> m_compressedTextureFormats; + // Fixed-size cache of reusable image buffers for video texImage2D calls. class LRUImageBufferCache { public: @@ -500,7 +505,7 @@ public: OwnPtr<WebGLLoseContext> m_webglLoseContext; OwnPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo; OwnPtr<WebGLDebugShaders> m_webglDebugShaders; - OwnPtr<WebGLCompressedTextures> m_webglCompressedTextures; + OwnPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC; // Helpers for getParameter and others WebGLGetInfo getBooleanParameter(GC3Denum); @@ -588,6 +593,24 @@ public: GC3Denum format, GC3Denum type, ArrayBufferView* pixels); + // Helper function to validate compressed texture data is correct size + // for the given format and dimensions. + bool validateCompressedTexFuncData(const char* functionName, + GC3Dsizei width, GC3Dsizei height, + GC3Denum format, ArrayBufferView* pixels); + + // Helper function for validating compressed texture formats. + bool validateCompressedTexFormat(GC3Denum format); + + // Helper function to validate compressed texture dimensions are valid for + // the given format. + bool validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format); + + // Helper function to validate compressed texture dimensions are valid for + // the given format. + bool validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, + GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*); + // Helper function to validate mode for draw{Arrays/Elements}. bool validateDrawMode(const char* functionName, GC3Denum); @@ -662,6 +685,8 @@ public: // to the JavaScript console. void synthesizeGLError(GC3Denum, const char* functionName, const char* description); + String ensureNotNull(const String&) const; + friend class WebGLStateRestorer; }; diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.idl b/Source/WebCore/html/canvas/WebGLRenderingContext.idl index 16aae17b0..6db811dd8 100644 --- a/Source/WebCore/html/canvas/WebGLRenderingContext.idl +++ b/Source/WebCore/html/canvas/WebGLRenderingContext.idl @@ -27,8 +27,8 @@ module html { interface [ Conditional=WEBGL, - CustomMarkFunction, - DontCheckEnums + JSCustomMarkFunction, + DoNotCheckConstants ] WebGLRenderingContext : CanvasRenderingContext { /* ClearBufferMask */ @@ -206,7 +206,6 @@ module html { /* TEXTURE_WRAP_S */ /* TEXTURE_WRAP_T */ - const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2; const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3; /* HintMode */ diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 0ee89f152..e551c2ff5 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -432,7 +432,7 @@ inline PassOwnPtr<NamedNodeMap> cloneAttributes(Element* element) OwnPtr<NamedNodeMap> newAttributes = NamedNodeMap::create(); for (size_t i = 0; i < attributes->length(); ++i) { Attribute* attribute = attributes->attributeItem(i); - RefPtr<Attribute> clone = Attribute::createMapped(attribute->name(), attribute->value()); + RefPtr<Attribute> clone = Attribute::create(attribute->name(), attribute->value()); newAttributes->addAttribute(clone); } return newAttributes.release(); diff --git a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp index f331af7e7..0145de0e6 100644 --- a/Source/WebCore/html/parser/HTMLFormattingElementList.cpp +++ b/Source/WebCore/html/parser/HTMLFormattingElementList.cpp @@ -40,9 +40,9 @@ namespace WebCore { // Noah's Ark of Formatting Elements can fit three of each element. static const size_t kNoahsArkCapacity = 3; -static inline size_t attributeCount(Element* element) +static inline size_t attributeCountWithoutUpdate(Element* element) { - return element->attributeMap() ? element->attributeMap()->length() : 0; + return element->hasAttributesWithoutUpdate() ? element->attributeCount() : 0; } HTMLFormattingElementList::HTMLFormattingElementList() @@ -142,7 +142,7 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new // of a quickly ensuring the condition. Vector<Element*, 10> candidates; - size_t newElementAttributeCount = attributeCount(newElement); + size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); for (size_t i = m_entries.size(); i; ) { --i; @@ -154,7 +154,7 @@ void HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly(Element* new Element* candidate = entry.element(); if (newElement->tagQName() != candidate->tagQName()) continue; - if (attributeCount(candidate) != newElementAttributeCount) + if (attributeCountWithoutUpdate(candidate) != newElementAttributeCount) continue; candidates.append(candidate); @@ -178,18 +178,16 @@ void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) Vector<Element*> remainingCandidates; remainingCandidates.reserveInitialCapacity(candidates.size()); - NamedNodeMap* attributeMap = newElement->attributeMap(); - size_t newElementAttributeCount = attributeCount(newElement); + size_t newElementAttributeCount = attributeCountWithoutUpdate(newElement); for (size_t i = 0; i < newElementAttributeCount; ++i) { - QualifiedName attributeName = attributeMap->attributeItem(i)->name(); - AtomicString attributeValue = newElement->fastGetAttribute(attributeName); + Attribute* attribute = newElement->attributeItem(i); for (size_t j = 0; j < candidates.size(); ++j) { Element* candidate = candidates[j]; // These properties should already have been checked by tryToEnsureNoahsArkConditionQuickly. - ASSERT(newElement->attributeMap()->length() == candidate->attributeMap()->length()); + ASSERT(newElement->attributeCount() == candidate->attributeCount()); ASSERT(newElement->tagQName() == candidate->tagQName()); // FIXME: Technically we shouldn't read this information back from @@ -199,7 +197,7 @@ void HTMLFormattingElementList::ensureNoahsArkCondition(Element* newElement) // that implementations can run off the main thread. If JavaScript // changes the attributes values, we could get a slightly wrong // output here. - if (candidate->fastGetAttribute(attributeName) == attributeValue) + if (candidate->fastGetAttribute(attribute->name()) == attribute->value()) remainingCandidates.append(candidate); } diff --git a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp index 09e0a8e10..9d839120d 100644 --- a/Source/WebCore/html/parser/HTMLTreeBuilder.cpp +++ b/Source/WebCore/html/parser/HTMLTreeBuilder.cpp @@ -452,7 +452,7 @@ void HTMLTreeBuilder::constructTreeFromToken(HTMLToken& rawToken) // // FIXME: Stop clearing the rawToken once we start running the parser off // the main thread or once we stop allowing synchronous JavaScript - // execution from parseMappedAttribute. + // execution from parseAttribute. if (rawToken.type() != HTMLTokenTypes::Character) rawToken.clear(); @@ -571,7 +571,7 @@ PassOwnPtr<NamedNodeMap> HTMLTreeBuilder::attributesForIsindexInput(AtomicHTMLTo attributes->removeAttribute(promptAttr); } - RefPtr<Attribute> mappedAttribute = Attribute::createMapped(nameAttr, isindexTag.localName()); + RefPtr<Attribute> mappedAttribute = Attribute::create(nameAttr, isindexTag.localName()); attributes->insertAttribute(mappedAttribute.release(), false); return attributes.release(); } diff --git a/Source/WebCore/html/parser/TextDocumentParser.cpp b/Source/WebCore/html/parser/TextDocumentParser.cpp index 1c55fc254..f4601de6a 100644 --- a/Source/WebCore/html/parser/TextDocumentParser.cpp +++ b/Source/WebCore/html/parser/TextDocumentParser.cpp @@ -60,7 +60,7 @@ void TextDocumentParser::insertFakePreElement() // sending fake bytes through the front-end of the parser to avoid // distrubing the line/column number calculations. - RefPtr<Attribute> styleAttribute = Attribute::createMapped("style", "word-wrap: break-word; white-space: pre-wrap;"); + RefPtr<Attribute> styleAttribute = Attribute::create("style", "word-wrap: break-word; white-space: pre-wrap;"); OwnPtr<NamedNodeMap> attributes = NamedNodeMap::create(); attributes->insertAttribute(styleAttribute.release(), false); AtomicHTMLToken fakePre(HTMLTokenTypes::StartTag, preTag.localName(), attributes.release()); diff --git a/Source/WebCore/html/shadow/HTMLContentElement.cpp b/Source/WebCore/html/shadow/HTMLContentElement.cpp index c1a1ef083..961dd1d30 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.cpp +++ b/Source/WebCore/html/shadow/HTMLContentElement.cpp @@ -118,13 +118,13 @@ void HTMLContentElement::setSelect(const AtomicString& selectValue) setAttribute(selectAttr, selectValue); } -void HTMLContentElement::parseMappedAttribute(Attribute* attr) +void HTMLContentElement::parseAttribute(Attribute* attr) { if (attr->name() == selectAttr) { if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode())) root->setNeedsReattachHostChildrenAndShadow(); } else - HTMLElement::parseMappedAttribute(attr); + HTMLElement::parseAttribute(attr); } } diff --git a/Source/WebCore/html/shadow/HTMLContentElement.h b/Source/WebCore/html/shadow/HTMLContentElement.h index 7845e0937..6e1816c78 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.h +++ b/Source/WebCore/html/shadow/HTMLContentElement.h @@ -73,7 +73,7 @@ private: virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; } - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; OwnPtr<ShadowInclusionList> m_inclusions; }; diff --git a/Source/WebCore/html/shadow/HTMLContentElement.idl b/Source/WebCore/html/shadow/HTMLContentElement.idl index 0febfa26b..c928d4494 100644 --- a/Source/WebCore/html/shadow/HTMLContentElement.idl +++ b/Source/WebCore/html/shadow/HTMLContentElement.idl @@ -27,7 +27,7 @@ module html { interface [ Conditional=SHADOW_DOM, - EnabledAtRuntime=shadowDOM + V8EnabledAtRuntime=shadowDOM ] HTMLContentElement : HTMLElement { attribute [Reflect] DOMString select; }; diff --git a/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp b/Source/WebCore/html/shadow/HTMLShadowElement.cpp index 08051abd5..cb01cd21f 100644 --- a/Source/WebCore/bindings/v8/custom/V8DOMTokenListCustom.cpp +++ b/Source/WebCore/html/shadow/HTMLShadowElement.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -29,28 +29,32 @@ */ #include "config.h" -#include "V8DOMTokenList.h" -#include "DOMTokenList.h" -#include "V8Binding.h" -#include "V8DOMWrapper.h" -#include "V8Element.h" +#if ENABLE(SHADOW_DOM) + +#include "HTMLShadowElement.h" + +#include "HTMLNames.h" namespace WebCore { -v8::Handle<v8::Value> toV8(DOMTokenList* impl) +class Document; + +inline HTMLShadowElement::HTMLShadowElement(const QualifiedName& tagName, Document* document) + : HTMLElement(tagName, document) +{ + ASSERT(hasTagName(HTMLNames::shadowTag)); +} + +PassRefPtr<HTMLShadowElement> HTMLShadowElement::create(const QualifiedName& tagName, Document* document) +{ + return adoptRef(new HTMLShadowElement(tagName, document)); +} + +HTMLShadowElement::~HTMLShadowElement() { - if (!impl) - return v8::Null(); - v8::Handle<v8::Object> wrapper = V8DOMTokenList::wrap(impl); - // Add a hidden reference from the element to the DOMTokenList. - Element* element = impl->element(); - if (!wrapper.IsEmpty() && element) { - v8::Handle<v8::Value> elementValue = toV8(element); - if (!elementValue.IsEmpty() && elementValue->IsObject()) - V8DOMWrapper::setNamedHiddenReference(elementValue.As<v8::Object>(), "domTokenList", wrapper); - } - return wrapper; } } // namespace WebCore + +#endif // ENABLE(SHADOW_DOM) diff --git a/Source/WebCore/html/IsIndexInputType.h b/Source/WebCore/html/shadow/HTMLShadowElement.h index 2cf702f85..bfc85e2fb 100644 --- a/Source/WebCore/html/IsIndexInputType.h +++ b/Source/WebCore/html/shadow/HTMLShadowElement.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,26 +28,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef IsIndexInputType_h -#define IsIndexInputType_h +#ifndef HTMLShadowElement_h +#define HTMLShadowElement_h -#include "TextFieldInputType.h" -#include <wtf/text/AtomicString.h> +#if ENABLE(SHADOW_DOM) + +#include "HTMLElement.h" namespace WebCore { -class IsIndexInputType : public TextFieldInputType { +class HTMLShadowElement : public HTMLElement { public: - static PassOwnPtr<InputType> create(HTMLInputElement*); + static PassRefPtr<HTMLShadowElement> create(const QualifiedName&, Document*); + + virtual ~HTMLShadowElement(); private: - IsIndexInputType(HTMLInputElement* element) : TextFieldInputType(element) { }; - virtual const AtomicString& formControlType() const OVERRIDE; - virtual bool supportsRequired() const OVERRIDE; - virtual PassRefPtr<HTMLFormElement> formForSubmission() const OVERRIDE; - virtual bool shouldRespectListAttribute() OVERRIDE; + HTMLShadowElement(const QualifiedName&, Document*); }; } // namespace WebCore -#endif // IsIndexInputType_h +#endif // ENABLE(SHADOW_DOM) + +#endif // HTMLShadowElement_h diff --git a/Source/WebCore/html/shadow/HTMLShadowElement.idl b/Source/WebCore/html/shadow/HTMLShadowElement.idl new file mode 100644 index 000000000..1310a1482 --- /dev/null +++ b/Source/WebCore/html/shadow/HTMLShadowElement.idl @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 [ + Conditional=SHADOW_DOM, + EnabledAtRuntime=shadowDOM + ] HTMLShadowElement : HTMLElement { + }; + +} diff --git a/Source/WebCore/html/shadow/MediaControlElements.cpp b/Source/WebCore/html/shadow/MediaControlElements.cpp index c75b2b78c..e932e73d3 100644 --- a/Source/WebCore/html/shadow/MediaControlElements.cpp +++ b/Source/WebCore/html/shadow/MediaControlElements.cpp @@ -175,7 +175,7 @@ void MediaControlPanelElement::endDrag() void MediaControlPanelElement::setPosition(const LayoutPoint& position) { - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); double left = position.x(); double top = position.y(); @@ -193,7 +193,7 @@ void MediaControlPanelElement::setPosition(const LayoutPoint& position) void MediaControlPanelElement::resetPosition() { - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->removeProperty(CSSPropertyLeft); style->removeProperty(CSSPropertyTop); @@ -211,7 +211,7 @@ void MediaControlPanelElement::makeOpaque() double duration = document()->page() ? document()->page()->theme()->mediaControlsFadeInDuration() : 0; - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); style->setProperty(CSSPropertyWebkitTransitionDuration, duration, CSSPrimitiveValue::CSS_S); style->setProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBER); @@ -224,7 +224,7 @@ void MediaControlPanelElement::makeTransparent() if (!m_opaque) return; - CSSMutableStyleDeclaration* style = ensureInlineStyleDecl(); + StylePropertySet* style = ensureInlineStyleDecl(); style->setProperty(CSSPropertyWebkitTransitionProperty, CSSPropertyOpacity); style->setProperty(CSSPropertyWebkitTransitionDuration, document()->page()->theme()->mediaControlsFadeOutDuration(), CSSPrimitiveValue::CSS_S); style->setProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBER); diff --git a/Source/WebCore/html/shadow/MeterShadowElement.cpp b/Source/WebCore/html/shadow/MeterShadowElement.cpp index be1041f71..410535414 100644 --- a/Source/WebCore/html/shadow/MeterShadowElement.cpp +++ b/Source/WebCore/html/shadow/MeterShadowElement.cpp @@ -32,12 +32,12 @@ #if ENABLE(METER_TAG) #include "MeterShadowElement.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "HTMLMeterElement.h" #include "HTMLNames.h" #include "RenderMeter.h" #include "RenderTheme.h" +#include "StylePropertySet.h" namespace WebCore { diff --git a/Source/WebCore/html/shadow/SliderThumbElement.cpp b/Source/WebCore/html/shadow/SliderThumbElement.cpp index 60b9e3527..319a11e80 100644 --- a/Source/WebCore/html/shadow/SliderThumbElement.cpp +++ b/Source/WebCore/html/shadow/SliderThumbElement.cpp @@ -334,7 +334,7 @@ PassRefPtr<TrackLimiterElement> TrackLimiterElement::create(Document* document) { RefPtr<TrackLimiterElement> element = adoptRef(new TrackLimiterElement(document)); - CSSMutableStyleDeclaration* style = element->ensureInlineStyleDecl(); + StylePropertySet* style = element->ensureInlineStyleDecl(); style->setProperty(CSSPropertyVisibility, CSSValueHidden); style->setProperty(CSSPropertyPosition, CSSValueStatic); diff --git a/Source/WebCore/html/track/TextTrackList.idl b/Source/WebCore/html/track/TextTrackList.idl index f1460b6da..aedda2e07 100644 --- a/Source/WebCore/html/track/TextTrackList.idl +++ b/Source/WebCore/html/track/TextTrackList.idl @@ -27,11 +27,11 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, - HasIndexGetter, + V8EnabledAtRuntime=webkitVideoTrack, + IndexedGetter, EventTarget, - CustomMarkFunction, - CustomIsReachable + JSCustomMarkFunction, + JSCustomIsReachable ] TextTrackList { readonly attribute unsigned long length; TextTrack item(in unsigned long index); diff --git a/Source/WebCore/html/track/TrackEvent.idl b/Source/WebCore/html/track/TrackEvent.idl index 5d28f3b53..b475ad41a 100644 --- a/Source/WebCore/html/track/TrackEvent.idl +++ b/Source/WebCore/html/track/TrackEvent.idl @@ -27,10 +27,10 @@ module html { interface [ Conditional=VIDEO_TRACK, - EnabledAtRuntime=webkitVideoTrack, + V8EnabledAtRuntime=webkitVideoTrack, ConstructorTemplate=Event ] TrackEvent : Event { - readonly attribute [InitializedByConstructor, CustomGetter] object track; + readonly attribute [InitializedByEventConstructor, CustomGetter] object track; }; } diff --git a/Source/WebCore/inspector/CodeGeneratorInspector.py b/Source/WebCore/inspector/CodeGeneratorInspector.py index 04358edcb..1bb5bdcdb 100755 --- a/Source/WebCore/inspector/CodeGeneratorInspector.py +++ b/Source/WebCore/inspector/CodeGeneratorInspector.py @@ -153,15 +153,9 @@ VALIDATOR_IFDEF_NAME = "!ASSERT_DISABLED" class DomainNameFixes: @classmethod def get_fixed_data(cls, domain_name): - if domain_name in cls.agent_type_map: - agent_name_res = cls.agent_type_map[domain_name] - else: - agent_name_res = "Inspector%sAgent" % domain_name - field_name_res = Capitalizer.upper_camel_case_to_lower(domain_name) + "Agent" class Res(object): - agent_type_name = agent_name_res skip_js_bind = domain_name in cls.skip_js_bind_domains agent_field_name = field_name_res @@ -184,7 +178,6 @@ class DomainNameFixes: return Res skip_js_bind_domains = set(["Runtime", "DOMDebugger"]) - agent_type_map = {"Network": "InspectorResourceAgent", "Inspector": "InspectorAgent", } class CParamType(object): @@ -429,7 +422,11 @@ class RawTypes(object): @staticmethod def get_validate_method_params(): - raise Exception("TODO") + class ValidateMethodParams: + name = "Boolean" + var_type = "bool" + as_method_name = "Boolean" + return ValidateMethodParams @staticmethod def get_output_pass_model(): @@ -1129,7 +1126,7 @@ class TypeBindings: } """ % class_name) - writer.newline(" typedef StructItemTraits ItemTraits;\n") + writer.newline(" typedef TypeBuilder::StructItemTraits ItemTraits;\n") for prop_data in resolve_data.optional_properties: prop_name = prop_data.p["name"] @@ -1174,22 +1171,29 @@ class TypeBindings: validator_writer.newline(" RefPtr<InspectorObject> object;\n") validator_writer.newline(" bool castRes = value->asObject(&object);\n") validator_writer.newline(" ASSERT_UNUSED(castRes, castRes);\n") - validator_writer.newline(" InspectorObject::iterator it;\n") for prop_data in resolve_data.main_properties: - validator_writer.newline(" it = object->find(\"%s\");\n" % prop_data.p["name"]) - validator_writer.newline(" ASSERT(it != object->end());\n") - validator_writer.newline(" %s(it->second.get());\n" % prop_data.param_type_binding.get_validator_call_text()) + validator_writer.newline(" {\n") + it_name = "%sPos" % prop_data.p["name"] + validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) + validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) + validator_writer.newline(" ASSERT(%s != object->end());\n" % it_name) + validator_writer.newline(" %s(%s->second.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + validator_writer.newline(" }\n") - validator_writer.newline(" int count = %s;\n" % len(resolve_data.main_properties)) + validator_writer.newline(" int foundPropertiesCount = %s;\n" % len(resolve_data.main_properties)) for prop_data in resolve_data.optional_properties: - validator_writer.newline(" it = object->find(\"%s\");\n" % prop_data.p["name"]) - validator_writer.newline(" if (it != object->end()) {\n") - validator_writer.newline(" %s(it->second.get());\n" % prop_data.param_type_binding.get_validator_call_text()) - validator_writer.newline(" ++count;\n") + validator_writer.newline(" {\n") + it_name = "%sPos" % prop_data.p["name"] + validator_writer.newline(" InspectorObject::iterator %s;\n" % it_name) + validator_writer.newline(" %s = object->find(\"%s\");\n" % (it_name, prop_data.p["name"])) + validator_writer.newline(" if (%s != object->end()) {\n" % it_name) + validator_writer.newline(" %s(%s->second.get());\n" % (prop_data.param_type_binding.get_validator_call_text(), it_name)) + validator_writer.newline(" ++foundPropertiesCount;\n") + validator_writer.newline(" }\n") validator_writer.newline(" }\n") - validator_writer.newline(" ASSERT(count == object->size());\n") + validator_writer.newline(" ASSERT(foundPropertiesCount == object->size());\n") validator_writer.newline("}\n\n\n") writer.newline("};\n\n") @@ -1675,8 +1679,6 @@ class InspectorObject; class InspectorArray; class InspectorFrontendChannel; -$forwardDeclarations - typedef String ErrorString; class InspectorBackendDispatcher: public RefCounted<InspectorBackendDispatcher> { @@ -1731,7 +1733,6 @@ $methodNamesEnumContent #include "InspectorValues.h" #include "InspectorFrontendChannel.h" #include <wtf/text/WTFString.h> -$includes namespace WebCore { @@ -1747,9 +1748,9 @@ public: $constructorInit { } - void clearFrontend() { m_inspectorFrontendChannel = 0; } - void dispatch(const String& message); - void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const; + virtual void clearFrontend() { m_inspectorFrontendChannel = 0; } + virtual void dispatch(const String& message); + virtual void reportProtocolError(const long* const callId, CommonErrorCode, const String& errorMessage, PassRefPtr<InspectorArray> data) const; using InspectorBackendDispatcher::reportProtocolError; $setters @@ -2153,8 +2154,28 @@ public: return adoptRef(new Array<T>()); } + static PassRefPtr<Array<T> > runtimeCast(PassRefPtr<InspectorValue> value) + { + RefPtr<InspectorArray> array; + bool castRes = value->asArray(&array); + ASSERT_UNUSED(castRes, castRes); +#if !ASSERT_DISABLED + assertCorrectValue(array.get()); +#endif // !ASSERT_DISABLED + COMPILE_ASSERT(sizeof(Array<T>) == sizeof(InspectorArray), type_cast_problem); + return static_cast<Array<T>*>(array.get()); + } + #if """ + VALIDATOR_IFDEF_NAME + """ - static void assertCorrectValue(InspectorValue* value); + static void assertCorrectValue(InspectorValue* value) + { + RefPtr<InspectorArray> array; + bool castRes = value->asArray(&array); + ASSERT_UNUSED(castRes, castRes); + for (unsigned i = 0; i < array->length(); i++) + ArrayItemHelper<T>::Traits::template assertCorrectValue<T>(array->get(i).get()); + } + #endif // """ + VALIDATOR_IFDEF_NAME + """ }; @@ -2229,16 +2250,6 @@ String getEnumConstantValue(int code) { #if """ + VALIDATOR_IFDEF_NAME + """ -template<typename T> -void TypeBuilder::Array<T>::assertCorrectValue(InspectorValue* value) -{ - RefPtr<InspectorArray> array; - bool castRes = value->asArray(&array); - ASSERT_UNUSED(castRes, castRes); - for (unsigned i = 0; i < array->length(); i++) - ArrayItemHelper<T>::Traits::template assertCorrectValue<T>(array->get(i).get()); -} - $validatorCode #endif // """ + VALIDATOR_IFDEF_NAME + """ @@ -2397,8 +2408,6 @@ class Generator: backend_setters_list = [] backend_constructor_init_list = [] backend_field_list = [] - backend_forward_list = [] - backend_include_list = [] frontend_constructor_init_list = [] type_builder_fragments = [] type_builder_forwards = [] @@ -2459,10 +2468,11 @@ class Generator: agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler" Generator.backend_agent_interface_list.append(" class %s {\n" % agent_interface_name) Generator.backend_agent_interface_list.append(" public:\n") - Generator.backend_agent_interface_list.append(" virtual ~%s() { }\n" % agent_interface_name); if "commands" in json_domain: for json_command in json_domain["commands"]: Generator.process_command(json_command, domain_name, agent_field_name) + Generator.backend_agent_interface_list.append("\n protected:\n") + Generator.backend_agent_interface_list.append(" virtual ~%s() { }\n" % agent_interface_name) Generator.backend_agent_interface_list.append(" };\n\n") if domain_guard: @@ -2477,9 +2487,7 @@ class Generator: Generator.backend_constructor_init_list, Generator.backend_virtual_setters_list, Generator.backend_setters_list, - Generator.backend_field_list, - Generator.backend_forward_list, - Generator.backend_include_list] + Generator.backend_field_list] for json_domain in sorted_json_domains: domain_name = json_domain["domain"] @@ -2493,14 +2501,11 @@ class Generator: agent_interface_name = Capitalizer.lower_camel_case_to_upper(domain_name) + "CommandHandler" - agent_type_name = domain_fixes.agent_type_name agent_field_name = domain_fixes.agent_field_name Generator.backend_constructor_init_list.append(" , m_%s(0)" % agent_field_name) - Generator.backend_virtual_setters_list.append(" virtual void registerAgent(%s /* %s */* %s) = 0;" % (agent_type_name, agent_interface_name, agent_field_name)) - Generator.backend_setters_list.append(" void registerAgent(%s /* %s */* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_type_name, agent_interface_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name)) - Generator.backend_field_list.append(" %s /* %s */* m_%s;" % (agent_type_name, agent_interface_name, agent_field_name)) - Generator.backend_forward_list.append("class %s;" % agent_type_name) - Generator.backend_include_list.append("#include \"%s.h\"" % agent_type_name) + Generator.backend_virtual_setters_list.append(" virtual void registerAgent(%s* %s) = 0;" % (agent_interface_name, agent_field_name)) + Generator.backend_setters_list.append(" virtual void registerAgent(%s* %s) { ASSERT(!m_%s); m_%s = %s; }" % (agent_interface_name, agent_field_name, agent_field_name, agent_field_name, agent_field_name)) + Generator.backend_field_list.append(" %s* m_%s;" % (agent_interface_name, agent_field_name)) if domain_guard: for l in reversed(sorted_cycle_guardable_list_list): @@ -2677,8 +2682,9 @@ class Generator: param = ", %sout_%s" % (raw_type.get_output_pass_model().get_argument_prefix(), json_return_name) cook = " result->set%s(\"%s\", out_%s);\n" % (setter_type, json_return_name, json_return_name) if optional: - # FIXME: support optional properly. Probably an additional output parameter should be in each case. - if var_type.get_text() == "bool": + # FIXME: support optional properly. Probably an additional output parameter should be in each case. + # FIXME: refactor this condition; it's a hack now. + if var_type.get_text() == "bool" or var_type.get_text().startswith("RefPtr<"): cook = (" if (out_%s)\n " % json_return_name) + cook else: cook = " // FIXME: support optional here.\n" + cook @@ -2802,15 +2808,13 @@ backend_js_file = open(output_cpp_dirname + "/InspectorBackendStub.js", "w") backend_h_file.write(Templates.backend_h.substitute(None, virtualSetters=join(Generator.backend_virtual_setters_list, "\n"), agentInterfaces=join(Generator.backend_agent_interface_list, ""), - methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"), - forwardDeclarations=join(Generator.backend_forward_list, "\n"))) + methodNamesEnumContent=join(Generator.method_name_enum_list, "\n"))) backend_cpp_file.write(Templates.backend_cpp.substitute(None, constructorInit=join(Generator.backend_constructor_init_list, "\n"), setters=join(Generator.backend_setters_list, "\n"), fieldDeclarations=join(Generator.backend_field_list, "\n"), methodNameDeclarations=join(Generator.backend_method_name_declaration_list, "\n"), - includes=join(Generator.backend_include_list, "\n"), methods=join(Generator.backend_method_implementation_list, "\n"), methodDeclarations=join(Generator.backend_method_declaration_list, "\n"), messageHandlers=join(Generator.method_handler_list, "\n"))) diff --git a/Source/WebCore/inspector/DOMEditor.cpp b/Source/WebCore/inspector/DOMEditor.cpp index 3c9d89b5d..63afa9639 100644 --- a/Source/WebCore/inspector/DOMEditor.cpp +++ b/Source/WebCore/inspector/DOMEditor.cpp @@ -160,16 +160,17 @@ void DOMEditor::innerPatchNode(Digest* oldDigest, Digest* newDigest, ExceptionCo Element* oldElement = static_cast<Element*>(oldNode); Element* newElement = static_cast<Element*>(newNode); if (oldDigest->m_attrsSHA1 != newDigest->m_attrsSHA1) { - NamedNodeMap* oldAttributeMap = oldElement->attributeMap(); - - while (oldAttributeMap && oldAttributeMap->length()) - oldAttributeMap->removeAttribute(0); + // FIXME: Create a function in Element for removing all properties. Take in account whether did/willModifyAttribute are important. + if (oldElement->hasAttributesWithoutUpdate()) { + while (oldElement->attributeCount()) + oldElement->removeAttribute(0); + } - NamedNodeMap* newAttributeMap = newElement->attributeMap(); - if (newAttributeMap) { - size_t numAttrs = newAttributeMap->length(); + // FIXME: Create a function in Element for copying properties. setAttributesFromElement() is close but not enough for this case. + if (newElement->hasAttributesWithoutUpdate()) { + size_t numAttrs = newElement->attributeCount(); for (size_t i = 0; i < numAttrs; ++i) { - const Attribute* attribute = newAttributeMap->attributeItem(i); + const Attribute* attribute = newElement->attributeItem(i); oldElement->setAttribute(attribute->name(), attribute->value()); } } @@ -384,12 +385,11 @@ PassOwnPtr<DOMEditor::Digest> DOMEditor::createDigest(Node* node, UnusedNodesMap } Element* element = static_cast<Element*>(node); - NamedNodeMap* attrMap = element->attributeMap(); - if (attrMap && attrMap->length()) { - size_t numAttrs = attrMap->length(); + if (element->hasAttributesWithoutUpdate()) { + size_t numAttrs = element->attributeCount(); SHA1 attrsSHA1; for (size_t i = 0; i < numAttrs; ++i) { - const Attribute* attribute = attrMap->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); addStringToSHA1(attrsSHA1, attribute->name().toString()); addStringToSHA1(attrsSHA1, attribute->value()); } diff --git a/Source/WebCore/inspector/DOMNodeHighlighter.cpp b/Source/WebCore/inspector/DOMNodeHighlighter.cpp index c258e217f..7b03c2e1a 100644 --- a/Source/WebCore/inspector/DOMNodeHighlighter.cpp +++ b/Source/WebCore/inspector/DOMNodeHighlighter.cpp @@ -288,8 +288,8 @@ void drawElementTitle(GraphicsContext& context, Node* node, RenderObject* render titleRect.inflate(rectInflatePx); // The initial offsets needed to compensate for a 1px-thick border stroke (which is not a part of the rectangle). - LayoutUnit dx = -borderWidthPx; - LayoutUnit dy = borderWidthPx; + int dx = -borderWidthPx; + int dy = borderWidthPx; // If the tip sticks beyond the right of visibleRect, right-align the tip with the said boundary. if (titleRect.maxX() + dx > visibleRect.maxX()) diff --git a/Source/WebCore/inspector/InjectedScript.cpp b/Source/WebCore/inspector/InjectedScript.cpp index ca6751e6e..6d09b2917 100644 --- a/Source/WebCore/inspector/InjectedScript.cpp +++ b/Source/WebCore/inspector/InjectedScript.cpp @@ -208,7 +208,21 @@ void InjectedScript::makeCall(ScriptFunctionCall& function, RefPtr<InspectorValu DOMWindow* domWindow = domWindowFromScriptState(m_injectedScriptObject.scriptState()); InspectorInstrumentationCookie cookie = domWindow && domWindow->frame() ? InspectorInstrumentation::willCallFunction(domWindow->frame()->page(), "InjectedScript", 1) : InspectorInstrumentationCookie(); bool hadException = false; + + ScriptState* scriptState = m_injectedScriptObject.scriptState(); + bool evalIsDisabled = false; + if (scriptState) { + evalIsDisabled = !evalEnabled(scriptState); + // Temporarily enable allow evals for inspector. + if (evalIsDisabled) + setEvalEnabled(scriptState, true); + } + ScriptValue resultValue = function.call(hadException); + + if (evalIsDisabled) + setEvalEnabled(scriptState, false); + InspectorInstrumentation::didCallFunction(cookie); ASSERT(!hadException); diff --git a/Source/WebCore/inspector/InjectedScriptHost.idl b/Source/WebCore/inspector/InjectedScriptHost.idl index 848fe34ae..b30a83587 100644 --- a/Source/WebCore/inspector/InjectedScriptHost.idl +++ b/Source/WebCore/inspector/InjectedScriptHost.idl @@ -36,8 +36,6 @@ module core { ] InjectedScriptHost { void clearConsoleMessages(); - [Custom] DOMObject evaluate(in DOMString text); - void copyText(in DOMString text); [Custom] void inspect(in DOMObject objectId, in DOMObject hints); [Custom] DOMObject inspectedNode(in int num); diff --git a/Source/WebCore/inspector/InjectedScriptSource.js b/Source/WebCore/inspector/InjectedScriptSource.js index b3c0f4a77..27089a887 100644 --- a/Source/WebCore/inspector/InjectedScriptSource.js +++ b/Source/WebCore/inspector/InjectedScriptSource.js @@ -141,7 +141,7 @@ InjectedScript.prototype = { _parseObjectId: function(objectId) { - return InjectedScriptHost.evaluate("(" + objectId + ")"); + return eval("(" + objectId + ")"); }, releaseObjectGroup: function(objectGroupName) @@ -156,7 +156,7 @@ InjectedScript.prototype = { dispatch: function(methodName, args) { - var argsArray = InjectedScriptHost.evaluate("(" + args + ")"); + var argsArray = eval("(" + args + ")"); var result = this[methodName].apply(this, argsArray); if (typeof result === "undefined") { inspectedWindow.console.error("Web Inspector error: InjectedScript.%s returns undefined", methodName); @@ -259,7 +259,7 @@ InjectedScript.prototype = { evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByValue) { - return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, expression, objectGroup, false, injectCommandLineAPI, returnByValue); + return this._evaluateAndWrap(inspectedWindow.eval, inspectedWindow, expression, objectGroup, false, injectCommandLineAPI, returnByValue); }, callFunctionOn: function(objectId, expression, args, returnByValue) @@ -271,7 +271,7 @@ InjectedScript.prototype = { if (args) { var resolvedArgs = []; - args = InjectedScriptHost.evaluate(args); + args = eval(args); for (var i = 0; i < args.length; ++i) { var objectId = args[i].objectId; if (objectId) { @@ -293,7 +293,7 @@ InjectedScript.prototype = { try { var objectGroup = this._idToObjectGroupName[parsedObjectId.id]; - var func = InjectedScriptHost.evaluate("(" + expression + ")"); + var func = eval("(" + expression + ")"); if (typeof func !== "function") return "Given expression does not evaluate to a function"; @@ -366,7 +366,7 @@ InjectedScript.prototype = { _callFrameForId: function(topCallFrame, callFrameId) { - var parsedCallFrameId = InjectedScriptHost.evaluate("(" + callFrameId + ")"); + var parsedCallFrameId = eval("(" + callFrameId + ")"); var ordinal = parsedCallFrameId.ordinal; var callFrame = topCallFrame; while (--ordinal >= 0 && callFrame) diff --git a/Source/WebCore/inspector/Inspector-0.1.json b/Source/WebCore/inspector/Inspector-0.1.json index 04a0f815d..0086d9a58 100644 --- a/Source/WebCore/inspector/Inspector-0.1.json +++ b/Source/WebCore/inspector/Inspector-0.1.json @@ -279,7 +279,7 @@ "description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.", "properties": [ { "name": "value", "type": "any", "optional": true, "description": "Primitive value." }, - { "name": "objectId", "$ref": "RemoteObject", "optional": true, "description": "Remote object handle." } + { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." } ] } ], diff --git a/Source/WebCore/inspector/Inspector-1.0.json b/Source/WebCore/inspector/Inspector-1.0.json index 33912b8de..1d3cbdc02 100644 --- a/Source/WebCore/inspector/Inspector-1.0.json +++ b/Source/WebCore/inspector/Inspector-1.0.json @@ -390,7 +390,7 @@ "description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.", "properties": [ { "name": "value", "type": "any", "optional": true, "description": "Primitive value." }, - { "name": "objectId", "$ref": "RemoteObject", "optional": true, "description": "Remote object handle." } + { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." } ] } ], diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index e8da038a7..ffd22de21 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -391,7 +391,7 @@ "description": "Represents function call argument. Either remote object id <code>objectId</code> or primitive <code>value</code> or neither of (for undefined) them should be specified.", "properties": [ { "name": "value", "type": "any", "optional": true, "description": "Primitive value." }, - { "name": "objectId", "$ref": "RemoteObject", "optional": true, "description": "Remote object handle." } + { "name": "objectId", "$ref": "RemoteObjectId", "optional": true, "description": "Remote object handle." } ] } ], @@ -1508,6 +1508,24 @@ { "name": "nodeId", "$ref": "NodeId", "description": "New id of the moved node." } ], "description": "Moves node into the new container, places it before the given anchor." + }, + { + "name": "setTouchEmulationEnabled", + "parameters": [ + { "name": "enabled", "type": "boolean", "description": "Whether the touch event emulation should be enabled." } + ], + "description": "Toggles mouse event-based touch event emulation.", + "hidden": true + }, + { + "name": "undo", + "description": "Undoes the last performed action.", + "hidden": true + }, + { + "name": "markUndoableState", + "description": "Marks last undoable state.", + "hidden": true } ], "events": [ @@ -1784,7 +1802,7 @@ ], "returns": [ { "name": "inlineStyle", "$ref": "CSSStyle", "optional": true, "description": "Inline style for the specified DOM node." }, - { "name": "styleAttributes", "type": "array", "items": { "$ref": "CSSStyleAttribute" }, "optional": true, "description": "Entries for style-related element attributes (e.g. width=20)."} + { "name": "attributesStyle", "$ref": "CSSStyle", "optional": true, "description": "Attribute-defined element style (e.g. resulting from \"width=20 height=100%\")."} ], "description": "Returns the styles defined inline (explicitly in the \"style\" attribute and implicitly, using DOM attributes) for a DOM node identified by <code>nodeId</code>." }, @@ -2392,7 +2410,8 @@ { "name": "getObjectByHeapObjectId", "parameters": [ - { "name": "objectId", "type": "integer" } + { "name": "objectId", "type": "integer" }, + { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." } ], "returns": [ { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Evaluation result." } diff --git a/Source/WebCore/inspector/InspectorAgent.h b/Source/WebCore/inspector/InspectorAgent.h index f7c8e48c2..a38be21ee 100644 --- a/Source/WebCore/inspector/InspectorAgent.h +++ b/Source/WebCore/inspector/InspectorAgent.h @@ -52,7 +52,7 @@ class Page; typedef String ErrorString; -class InspectorAgent : public InspectorBaseAgent<InspectorAgent> { +class InspectorAgent : public InspectorBaseAgent<InspectorAgent>, public InspectorBackendDispatcher::InspectorCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorAgent); public: static PassOwnPtr<InspectorAgent> create(Page* page, InjectedScriptManager* injectedScriptManager, InstrumentingAgents* instrumentingAgents, InspectorState* state) diff --git a/Source/WebCore/inspector/InspectorAllInOne.cpp b/Source/WebCore/inspector/InspectorAllInOne.cpp index 789a2718e..35173cb9e 100644 --- a/Source/WebCore/inspector/InspectorAllInOne.cpp +++ b/Source/WebCore/inspector/InspectorAllInOne.cpp @@ -42,6 +42,7 @@ #include "InspectorFileSystemAgent.cpp" #include "InspectorFrontendClientLocal.cpp" #include "InspectorFrontendHost.cpp" +#include "InspectorHistory.cpp" #include "InspectorIndexedDBAgent.cpp" #include "InspectorInstrumentation.cpp" #include "InspectorMemoryAgent.cpp" diff --git a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h index ac0929759..7afa3cf72 100644 --- a/Source/WebCore/inspector/InspectorApplicationCacheAgent.h +++ b/Source/WebCore/inspector/InspectorApplicationCacheAgent.h @@ -49,7 +49,7 @@ class ResourceResponse; typedef String ErrorString; -class InspectorApplicationCacheAgent : public InspectorBaseAgent<InspectorApplicationCacheAgent> { +class InspectorApplicationCacheAgent : public InspectorBaseAgent<InspectorApplicationCacheAgent>, public InspectorBackendDispatcher::ApplicationCacheCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<InspectorApplicationCacheAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InspectorPageAgent* pageAgent) @@ -68,10 +68,10 @@ public: void networkStateChanged(); // ApplicationCache API for InspectorFrontend - void enable(ErrorString*); - void getFramesWithManifests(ErrorString*, RefPtr<InspectorArray>& result); - void getManifestForFrame(ErrorString*, const String& frameId, String* manifestURL); - void getApplicationCacheForFrame(ErrorString*, const String& frameId, RefPtr<InspectorObject>& applicationCache); + virtual void enable(ErrorString*); + virtual void getFramesWithManifests(ErrorString*, RefPtr<InspectorArray>& result); + virtual void getManifestForFrame(ErrorString*, const String& frameId, String* manifestURL); + virtual void getApplicationCacheForFrame(ErrorString*, const String& frameId, RefPtr<InspectorObject>& applicationCache); private: InspectorApplicationCacheAgent(InstrumentingAgents*, InspectorState*, InspectorPageAgent*); diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index 06635f523..05d22bd06 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -29,7 +29,6 @@ #include "CSSComputedStyleDeclaration.h" #include "CSSImportRule.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSPropertySourceData.h" #include "CSSRule.h" @@ -40,11 +39,13 @@ #include "DOMWindow.h" #include "HTMLHeadElement.h" #include "InspectorDOMAgent.h" +#include "InspectorHistory.h" #include "InspectorState.h" #include "InspectorValues.h" #include "InstrumentingAgents.h" #include "Node.h" #include "NodeList.h" +#include "StylePropertySet.h" #include "StyleSheetList.h" #include <wtf/CurrentTime.h> @@ -217,6 +218,158 @@ PassRefPtr<InspectorObject> SelectorProfile::toInspectorObject() const return result.release(); } +class InspectorCSSAgent::StyleSheetAction : public InspectorHistory::Action { + WTF_MAKE_NONCOPYABLE(StyleSheetAction); +public: + StyleSheetAction(const String& name, InspectorCSSAgent* cssAgent, const String& styleSheetId) + : InspectorHistory::Action(name) + , m_cssAgent(cssAgent) + , m_styleSheetId(styleSheetId) + { + } + + virtual bool perform(ErrorString* errorString) + { + InspectorStyleSheet* styleSheet = m_cssAgent->assertStyleSheetForId(errorString, m_styleSheetId); + if (!styleSheet) + return false; + return perform(styleSheet, errorString); + } + + virtual bool undo(ErrorString* errorString) + { + InspectorStyleSheet* styleSheet = m_cssAgent->assertStyleSheetForId(errorString, m_styleSheetId); + if (!styleSheet) + return false; + return undo(styleSheet, errorString); + } + + virtual bool perform(InspectorStyleSheet*, ErrorString*) = 0; + + virtual bool undo(InspectorStyleSheet*, ErrorString*) = 0; + +protected: + InspectorCSSAgent* m_cssAgent; + String m_styleSheetId; +}; + +class InspectorCSSAgent::SetStyleSheetTextAction : public InspectorCSSAgent::StyleSheetAction { + WTF_MAKE_NONCOPYABLE(SetStyleSheetTextAction); +public: + SetStyleSheetTextAction(InspectorCSSAgent* cssAgent, const String& styleSheetId, const String& text) + : InspectorCSSAgent::StyleSheetAction("SetStyleSheetText", cssAgent, styleSheetId) + , m_text(text) + { + } + + virtual bool perform(InspectorStyleSheet* inspectorStyleSheet, ErrorString*) + { + if (!inspectorStyleSheet->getText(&m_oldText)) + return false; + + if (inspectorStyleSheet->setText(m_text)) { + inspectorStyleSheet->reparseStyleSheet(m_text); + return true; + } + return false; + } + + virtual bool undo(InspectorStyleSheet* inspectorStyleSheet, ErrorString*) + { + if (inspectorStyleSheet->setText(m_oldText)) { + inspectorStyleSheet->reparseStyleSheet(m_oldText); + return true; + } + return false; + } + +private: + String m_text; + String m_oldText; +}; + +class InspectorCSSAgent::SetPropertyTextAction : public InspectorCSSAgent::StyleSheetAction { + WTF_MAKE_NONCOPYABLE(SetPropertyTextAction); +public: + SetPropertyTextAction(InspectorCSSAgent* cssAgent, const String& styleSheetId, const InspectorCSSId& cssId, unsigned propertyIndex, const String& text, bool overwrite) + : InspectorCSSAgent::StyleSheetAction("SetPropertyText", cssAgent, styleSheetId) + , m_cssId(cssId) + , m_propertyIndex(propertyIndex) + , m_text(text) + , m_overwrite(overwrite) + { + } + + virtual String toString() + { + return mergeId() + ": " + m_oldText + " -> " + m_text; + } + + virtual bool perform(InspectorStyleSheet* inspectorStyleSheet, ErrorString* errorString) + { + String oldText; + bool result = inspectorStyleSheet->setPropertyText(errorString, m_cssId, m_propertyIndex, m_text, m_overwrite, &oldText); + m_oldText = oldText.stripWhiteSpace(); + // FIXME: remove this once the model handles this case. + if (!m_oldText.endsWith(";")) + m_oldText += ";"; + return result; + } + + virtual bool undo(InspectorStyleSheet* inspectorStyleSheet, ErrorString* errorString) + { + String placeholder; + return inspectorStyleSheet->setPropertyText(errorString, m_cssId, m_propertyIndex, m_overwrite ? m_oldText : "", true, &placeholder); + } + + virtual String mergeId() + { + return String::format("SetPropertyText %s:%u:%s", m_styleSheetId.utf8().data(), m_propertyIndex, m_overwrite ? "true" : "false"); + } + + virtual void merge(PassOwnPtr<Action> action) + { + ASSERT(action->mergeId() == mergeId()); + + SetPropertyTextAction* other = static_cast<SetPropertyTextAction*>(action.get()); + m_text = other->m_text; + } + +private: + InspectorCSSId m_cssId; + unsigned m_propertyIndex; + String m_text; + String m_oldText; + bool m_overwrite; +}; + +class InspectorCSSAgent::TogglePropertyAction : public InspectorCSSAgent::StyleSheetAction { + WTF_MAKE_NONCOPYABLE(TogglePropertyAction); +public: + TogglePropertyAction(InspectorCSSAgent* cssAgent, const String& styleSheetId, const InspectorCSSId& cssId, unsigned propertyIndex, bool disable) + : InspectorCSSAgent::StyleSheetAction("ToggleProperty", cssAgent, styleSheetId) + , m_cssId(cssId) + , m_propertyIndex(propertyIndex) + , m_disable(disable) + { + } + + virtual bool perform(InspectorStyleSheet* inspectorStyleSheet, ErrorString* errorString) + { + return inspectorStyleSheet->toggleProperty(errorString, m_cssId, m_propertyIndex, m_disable); + } + + virtual bool undo(InspectorStyleSheet* inspectorStyleSheet, ErrorString* errorString) + { + return inspectorStyleSheet->toggleProperty(errorString, m_cssId, m_propertyIndex, !m_disable); + } + +private: + InspectorCSSId m_cssId; + unsigned m_propertyIndex; + bool m_disable; +}; + // static CSSStyleRule* InspectorCSSAgent::asCSSStyleRule(CSSRule* rule) { @@ -331,7 +484,7 @@ void InspectorCSSAgent::recalcStyleForPseudoStateIfNeeded(Element* element, Insp element->ownerDocument()->styleSelectorChanged(RecalcStyleImmediately); } -void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, bool* needPseudo, bool* needInherited, RefPtr<InspectorArray>& matchedCSSRules, RefPtr<InspectorArray>& pseudoIdRules, RefPtr<InspectorArray>& inheritedEntries) +void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, const bool* needPseudo, const bool* needInherited, RefPtr<InspectorArray>& matchedCSSRules, RefPtr<InspectorArray>& pseudoIdRules, RefPtr<InspectorArray>& inheritedEntries) { Element* element = elementForId(errorString, nodeId); if (!element) @@ -383,7 +536,7 @@ void InspectorCSSAgent::getMatchedStylesForNode(ErrorString* errorString, int no } } -void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorArray>& attributes) +void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorObject>& attributesStyle) { Element* element = elementForId(errorString, nodeId); if (!element) @@ -394,7 +547,8 @@ void InspectorCSSAgent::getInlineStylesForNode(ErrorString* errorString, int nod return; inlineStyle = styleSheet->buildObjectForStyle(element->style()); - attributes = buildArrayForAttributeStyles(element); + RefPtr<InspectorObject> attributes = buildObjectForAttributesStyle(element); + attributesStyle = attributes ? attributes.release() : 0; } void InspectorCSSAgent::getComputedStyleForNode(ErrorString* errorString, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<InspectorArray>& style) @@ -438,19 +592,13 @@ void InspectorCSSAgent::getStyleSheetText(ErrorString* errorString, const String if (!inspectorStyleSheet) return; - inspectorStyleSheet->text(result); + inspectorStyleSheet->getText(result); } void InspectorCSSAgent::setStyleSheetText(ErrorString* errorString, const String& styleSheetId, const String& text) { - InspectorStyleSheet* inspectorStyleSheet = assertStyleSheetForId(errorString, styleSheetId); - if (!inspectorStyleSheet) - return; - - if (inspectorStyleSheet->setText(text)) - inspectorStyleSheet->reparseStyleSheet(text); - else - *errorString = "Internal error setting style sheet text"; + m_domAgent->history()->perform(adoptPtr(new SetStyleSheetTextAction(this, styleSheetId, text)), errorString); + m_domAgent->history()->markUndoableState(); } void InspectorCSSAgent::setPropertyText(ErrorString* errorString, const RefPtr<InspectorObject>& fullStyleId, int propertyIndex, const String& text, bool overwrite, RefPtr<InspectorObject>& result) @@ -462,7 +610,7 @@ void InspectorCSSAgent::setPropertyText(ErrorString* errorString, const RefPtr<I if (!inspectorStyleSheet) return; - bool success = inspectorStyleSheet->setPropertyText(errorString, compoundId, propertyIndex, text, overwrite); + bool success = m_domAgent->history()->perform(adoptPtr(new SetPropertyTextAction(this, compoundId.styleSheetId(), compoundId, propertyIndex, text, overwrite)), errorString); if (success) result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId)); } @@ -476,9 +624,10 @@ void InspectorCSSAgent::toggleProperty(ErrorString* errorString, const RefPtr<In if (!inspectorStyleSheet) return; - bool success = inspectorStyleSheet->toggleProperty(errorString, compoundId, propertyIndex, disable); + bool success = m_domAgent->history()->perform(adoptPtr(new TogglePropertyAction(this, compoundId.styleSheetId(), compoundId, propertyIndex, disable)), errorString); if (success) result = inspectorStyleSheet->buildObjectForStyle(inspectorStyleSheet->styleForId(compoundId)); + m_domAgent->history()->markUndoableState(); } void InspectorCSSAgent::setRuleSelector(ErrorString* errorString, const RefPtr<InspectorObject>& fullRuleId, const String& selector, RefPtr<InspectorObject>& result) @@ -714,26 +863,17 @@ PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForRuleList(CSSRuleList* return result.release(); } -PassRefPtr<InspectorArray> InspectorCSSAgent::buildArrayForAttributeStyles(Element* element) +PassRefPtr<InspectorObject> InspectorCSSAgent::buildObjectForAttributesStyle(Element* element) { - RefPtr<InspectorArray> attrStyles = InspectorArray::create(); - NamedNodeMap* attributes = element->updatedAttributes(); - if (!attributes) - return attrStyles.release(); + if (!element->isStyledElement()) + return 0; - for (unsigned i = 0; attributes && i < attributes->length(); ++i) { - Attribute* attribute = attributes->attributeItem(i); - if (!attribute->decl()) - continue; - RefPtr<InspectorObject> attrStyleObject = InspectorObject::create(); - String attributeName = attribute->localName(); - RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attribute->decl(), 0); - attrStyleObject->setString("name", attributeName.utf8().data()); - attrStyleObject->setObject("style", inspectorStyle->buildObjectForStyle()); - attrStyles->pushObject(attrStyleObject.release()); - } + StylePropertySet* attributeStyle = static_cast<StyledElement*>(element)->attributeStyle(); + if (!attributeStyle) + return 0; - return attrStyles.release(); + RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSId(), attributeStyle->ensureCSSStyleDeclaration(), 0); + return inspectorStyle->buildObjectForStyle(); } void InspectorCSSAgent::didRemoveDocument(Document* document) diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h index 70b2dd90a..4afd9fb1c 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.h +++ b/Source/WebCore/inspector/InspectorCSSAgent.h @@ -54,7 +54,7 @@ class SelectorProfile; #if ENABLE(INSPECTOR) -class InspectorCSSAgent : public InspectorBaseAgent<InspectorCSSAgent>, public InspectorDOMAgent::DOMListener { +class InspectorCSSAgent : public InspectorBaseAgent<InspectorCSSAgent>, public InspectorDOMAgent::DOMListener, public InspectorBackendDispatcher::CSSCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); public: static CSSStyleRule* asCSSStyleRule(CSSRule*); @@ -70,26 +70,27 @@ public: virtual void clearFrontend(); virtual void discardAgent(); virtual void restore(); - void enable(ErrorString*); - void disable(ErrorString*); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); void reset(); void mediaQueryResultChanged(); - void getComputedStyleForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<InspectorArray>& style); - void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorArray>& attributes); - void getMatchedStylesForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, bool* includePseudo, bool* includeInherited, RefPtr<InspectorArray>& matchedCSSRules, RefPtr<InspectorArray>& pseudoIdRules, RefPtr<InspectorArray>& inheritedEntries); - void getAllStyleSheets(ErrorString*, RefPtr<InspectorArray>& styleSheetInfos); - void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorObject>& result); - void getStyleSheetText(ErrorString*, const String& styleSheetId, String* result); - void setStyleSheetText(ErrorString*, const String& styleSheetId, const String& text); - void setPropertyText(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, const String& text, bool overwrite, RefPtr<InspectorObject>& result); - void toggleProperty(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, bool disable, RefPtr<InspectorObject>& result); - void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorObject>& result); - void addRule(ErrorString*, const int contextNodeId, const String& selector, RefPtr<InspectorObject>& result); - void getSupportedCSSProperties(ErrorString*, RefPtr<InspectorArray>& result); - - void startSelectorProfiler(ErrorString*); - void stopSelectorProfiler(ErrorString*, RefPtr<InspectorObject>&); + virtual void getComputedStyleForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, RefPtr<InspectorArray>& style); + virtual void getInlineStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>& inlineStyle, RefPtr<InspectorObject>& attributes); + virtual void getMatchedStylesForNode(ErrorString*, int nodeId, const RefPtr<InspectorArray>* forcedPseudoClasses, const bool* includePseudo, const bool* includeInherited, RefPtr<InspectorArray>& matchedCSSRules, RefPtr<InspectorArray>& pseudoIdRules, RefPtr<InspectorArray>& inheritedEntries); + virtual void getAllStyleSheets(ErrorString*, RefPtr<InspectorArray>& styleSheetInfos); + virtual void getStyleSheet(ErrorString*, const String& styleSheetId, RefPtr<InspectorObject>& result); + virtual void getStyleSheetText(ErrorString*, const String& styleSheetId, String* result); + virtual void setStyleSheetText(ErrorString*, const String& styleSheetId, const String& text); + virtual void setPropertyText(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, const String& text, bool overwrite, RefPtr<InspectorObject>& result); + virtual void toggleProperty(ErrorString*, const RefPtr<InspectorObject>& styleId, int propertyIndex, bool disable, RefPtr<InspectorObject>& result); + virtual void setRuleSelector(ErrorString*, const RefPtr<InspectorObject>& ruleId, const String& selector, RefPtr<InspectorObject>& result); + virtual void addRule(ErrorString*, int contextNodeId, const String& selector, RefPtr<InspectorObject>& result); + virtual void getSupportedCSSProperties(ErrorString*, RefPtr<InspectorArray>& result); + + virtual void startSelectorProfiler(ErrorString*); + virtual void stopSelectorProfiler(ErrorString*, RefPtr<InspectorObject>&); + void stopSelectorProfilerImpl(ErrorString*, RefPtr<InspectorObject>* = 0); void willMatchRule(const CSSStyleRule*); void didMatchRule(bool); @@ -97,6 +98,11 @@ public: void didProcessRule(); private: + class StyleSheetAction; + class SetStyleSheetTextAction; + class SetPropertyTextAction; + class TogglePropertyAction; + InspectorCSSAgent(InstrumentingAgents*, InspectorState*, InspectorDOMAgent*); typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleSheet; @@ -115,7 +121,7 @@ private: String detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument); PassRefPtr<InspectorArray> buildArrayForRuleList(CSSRuleList* ruleList); - PassRefPtr<InspectorArray> buildArrayForAttributeStyles(Element*); + PassRefPtr<InspectorObject> buildObjectForAttributesStyle(Element*); // InspectorDOMAgent::DOMListener interface virtual void didRemoveDocument(Document*); diff --git a/Source/WebCore/inspector/InspectorConsoleAgent.h b/Source/WebCore/inspector/InspectorConsoleAgent.h index 7123be80c..302429a45 100644 --- a/Source/WebCore/inspector/InspectorConsoleAgent.h +++ b/Source/WebCore/inspector/InspectorConsoleAgent.h @@ -52,14 +52,14 @@ class ScriptProfile; typedef String ErrorString; -class InspectorConsoleAgent : public InspectorBaseAgent<InspectorConsoleAgent> { +class InspectorConsoleAgent : public InspectorBaseAgent<InspectorConsoleAgent>, public InspectorBackendDispatcher::ConsoleCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent); public: InspectorConsoleAgent(InstrumentingAgents*, InspectorState*, InjectedScriptManager*); virtual ~InspectorConsoleAgent(); - void enable(ErrorString*); - void disable(ErrorString*); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); virtual void clearMessages(ErrorString*); void reset(); @@ -83,7 +83,7 @@ public: void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); #endif - void setMonitoringXHREnabled(ErrorString* error, bool enabled); + virtual void setMonitoringXHREnabled(ErrorString*, bool enabled); virtual void addInspectedNode(ErrorString*, int nodeId) = 0; protected: diff --git a/Source/WebCore/inspector/InspectorDOMAgent.cpp b/Source/WebCore/inspector/InspectorDOMAgent.cpp index b50025bb0..98185c178 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.cpp +++ b/Source/WebCore/inspector/InspectorDOMAgent.cpp @@ -35,7 +35,6 @@ #include "Attr.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSPropertySourceData.h" #include "CSSRule.h" @@ -79,6 +78,8 @@ #include "RenderStyle.h" #include "RenderStyleConstants.h" #include "ScriptEventListener.h" +#include "Settings.h" +#include "StylePropertySet.h" #include "StyleSheetList.h" #include "Text.h" #include "XPathResult.h" @@ -96,6 +97,10 @@ namespace WebCore { namespace DOMAgentState { static const char documentRequested[] = "documentRequested"; + +#if ENABLE(TOUCH_EVENTS) +static const char touchEventEmulationEnabled[] = "touchEventEmulationEnabled"; +#endif }; static const size_t maxTextSize = 10000; @@ -172,6 +177,251 @@ void RevalidateStyleAttributeTask::onTimer(Timer<RevalidateStyleAttributeTask>*) m_elements.clear(); } +class InspectorDOMAgent::DOMAction : public InspectorHistory::Action { +public: + DOMAction(const String& name) : InspectorHistory::Action(name) { } + + virtual bool perform(ErrorString* errorString) + { + ExceptionCode ec = 0; + bool result = perform(ec); + if (ec) { + ExceptionCodeDescription description(ec); + *errorString = description.name; + } + return result && !ec; + } + + virtual bool undo(ErrorString* errorString) + { + ExceptionCode ec = 0; + bool result = undo(ec); + if (ec) { + ExceptionCodeDescription description(ec); + *errorString = description.name; + } + return result && !ec; + } + + virtual bool perform(ExceptionCode&) = 0; + + virtual bool undo(ExceptionCode&) = 0; + +private: + RefPtr<Node> m_parentNode; + RefPtr<Node> m_node; + RefPtr<Node> m_anchorNode; +}; + +class InspectorDOMAgent::RemoveChildAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(RemoveChildAction); +public: + RemoveChildAction(Node* parentNode, Node* node) + : InspectorDOMAgent::DOMAction("RemoveChild") + , m_parentNode(parentNode) + , m_node(node) + { + } + + virtual bool perform(ExceptionCode& ec) + { + m_anchorNode = m_node->nextSibling(); + return m_parentNode->removeChild(m_node.get(), ec); + } + + virtual bool undo(ExceptionCode& ec) + { + return m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec); + } + +private: + RefPtr<Node> m_parentNode; + RefPtr<Node> m_node; + RefPtr<Node> m_anchorNode; +}; + +class InspectorDOMAgent::InsertBeforeAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(InsertBeforeAction); +public: + InsertBeforeAction(Node* parentNode, Node* node, Node* anchorNode) + : InspectorDOMAgent::DOMAction("InsertBefore") + , m_parentNode(parentNode) + , m_node(node) + , m_anchorNode(anchorNode) + { + } + + virtual bool perform(ExceptionCode& ec) + { + if (m_node->parentNode()) { + m_removeChildAction = adoptPtr(new RemoveChildAction(m_node->parentNode(), m_node.get())); + if (!m_removeChildAction->perform(ec)) + return false; + } + return m_parentNode->insertBefore(m_node.get(), m_anchorNode.get(), ec); + } + + virtual bool undo(ExceptionCode& ec) + { + if (m_removeChildAction) + return m_removeChildAction->undo(ec); + + return m_parentNode->removeChild(m_node.get(), ec); + } + +private: + RefPtr<Node> m_parentNode; + RefPtr<Node> m_node; + RefPtr<Node> m_anchorNode; + OwnPtr<RemoveChildAction> m_removeChildAction; +}; + +class InspectorDOMAgent::RemoveAttributeAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(RemoveAttributeAction); +public: + RemoveAttributeAction(Element* element, const String& name) + : InspectorDOMAgent::DOMAction("RemoveAttribute") + , m_element(element) + , m_name(name) + { + } + + virtual bool perform(ExceptionCode&) + { + m_value = m_element->getAttribute(m_name); + m_element->removeAttribute(m_name); + return true; + } + + virtual bool undo(ExceptionCode& ec) + { + m_element->setAttribute(m_name, m_value, ec); + return true; + } + +private: + RefPtr<Element> m_element; + String m_name; + String m_value; +}; + +class InspectorDOMAgent::SetAttributeAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(SetAttributeAction); +public: + SetAttributeAction(Element* element, const String& name, const String& value) + : InspectorDOMAgent::DOMAction("SetAttribute") + , m_element(element) + , m_name(name) + , m_value(value) + , m_hadAttribute(false) + { + } + + virtual bool perform(ExceptionCode& ec) + { + m_hadAttribute = m_element->hasAttribute(m_name); + if (m_hadAttribute) + m_oldValue = m_element->getAttribute(m_name); + m_element->setAttribute(m_name, m_value, ec); + return !ec; + } + + virtual bool undo(ExceptionCode& ec) + { + if (m_hadAttribute) + m_element->setAttribute(m_name, m_oldValue, ec); + else + m_element->removeAttribute(m_name); + return true; + } + +private: + RefPtr<Element> m_element; + String m_name; + String m_value; + bool m_hadAttribute; + String m_oldValue; +}; + +class InspectorDOMAgent::SetOuterHTMLAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(SetOuterHTMLAction); +public: + SetOuterHTMLAction(Node* node, const String& html) + : InspectorDOMAgent::DOMAction("SetOuterHTML") + , m_node(node) + , m_nextSibling(node->nextSibling()) + , m_html(html) + , m_newNode(0) + { + } + + virtual bool perform(ExceptionCode& ec) + { + m_oldHTML = createMarkup(m_node.get()); + DOMEditor domEditor(m_node->ownerDocument()); + m_newNode = domEditor.patchNode(m_node.get(), m_html, ec); + return !ec; + } + + virtual bool undo(ExceptionCode& ec) + { + DOMEditor domEditor(m_newNode->ownerDocument()); + Node* node = domEditor.patchNode(m_newNode, m_oldHTML, ec); + if (ec || !node) + return false; + // HTML editing could have produced extra nodes. Remove them if necessary. + node = node->nextSibling(); + + while (!ec && node && node != m_nextSibling.get()) { + Node* nodeToRemove = node; + node = node->nextSibling(); + nodeToRemove->remove(ec); + } + return !ec; + } + + Node* newNode() + { + return m_newNode; + } + +private: + RefPtr<Node> m_node; + RefPtr<Node> m_nextSibling; + String m_html; + String m_oldHTML; + Node* m_newNode; +}; + +class InspectorDOMAgent::ReplaceWholeTextAction : public InspectorDOMAgent::DOMAction { + WTF_MAKE_NONCOPYABLE(ReplaceWholeTextAction); +public: + ReplaceWholeTextAction(Text* textNode, const String& text) + : DOMAction("ReplaceWholeText") + , m_textNode(textNode) + , m_text(text) + { + } + + virtual bool perform(ExceptionCode& ec) + { + m_oldText = m_textNode->wholeText(); + m_textNode->replaceWholeText(m_text, ec); + return true; + } + + virtual bool undo(ExceptionCode& ec) + { + m_textNode->replaceWholeText(m_oldText, ec); + return true; + } + +private: + RefPtr<Text> m_textNode; + String m_text; + String m_oldText; +}; + InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* inspectorState, InjectedScriptManager* injectedScriptManager) : InspectorBaseAgent<InspectorDOMAgent>("DOM", instrumentingAgents, inspectorState) , m_pageAgent(pageAgent) @@ -181,6 +431,7 @@ InspectorDOMAgent::InspectorDOMAgent(InstrumentingAgents* instrumentingAgents, I , m_domListener(0) , m_lastNodeId(1) , m_searchingForNode(false) + , m_history(adoptPtr(new InspectorHistory())) { } @@ -213,6 +464,9 @@ void InspectorDOMAgent::clearFrontend() m_frontend = 0; m_instrumentingAgents->setInspectorDOMAgent(0); m_state->setBoolean(DOMAgentState::documentRequested, false); +#if ENABLE(TOUCH_EVENTS) + updateTouchEventEmulationInPage(false); +#endif reset(); } @@ -221,6 +475,9 @@ void InspectorDOMAgent::restore() // Reset document to avoid early return from setDocument. m_document = 0; setDocument(m_pageAgent->mainFrame()->document()); +#if ENABLE(TOUCH_EVENTS) + updateTouchEventEmulationInPage(m_state->getBoolean(DOMAgentState::touchEventEmulationEnabled)); +#endif } Vector<Document*> InspectorDOMAgent::documents() @@ -242,7 +499,7 @@ Node* InspectorDOMAgent::highlightedNode() const void InspectorDOMAgent::reset() { - ErrorString error; + m_history->reset(); m_searchResults.clear(); discardBindings(); if (m_revalidateStyleAttrTask) @@ -391,6 +648,15 @@ void InspectorDOMAgent::discardBindings() m_childrenRequested.clear(); } +#if ENABLE(TOUCH_EVENTS) +void InspectorDOMAgent::updateTouchEventEmulationInPage(bool enabled) +{ + m_state->setBoolean(DOMAgentState::touchEventEmulationEnabled, enabled); + if (m_pageAgent->mainFrame() && m_pageAgent->mainFrame()->settings()) + m_pageAgent->mainFrame()->settings()->setTouchEventEmulationEnabled(enabled); +} +#endif + Node* InspectorDOMAgent::nodeForId(int id) { if (!id) @@ -499,10 +765,8 @@ void InspectorDOMAgent::setAttributeValue(ErrorString* errorString, int elementI if (!element) return; - ExceptionCode ec = 0; - element->setAttribute(name, value, ec); - if (ec) - *errorString = "Internal error: could not set attribute value"; + m_history->perform(adoptPtr(new SetAttributeAction(element, name, value)), errorString); + m_history->markUndoableState(); } void InspectorDOMAgent::setAttributesAsText(ErrorString* errorString, int elementId, const String& text, const String* const name) @@ -530,32 +794,36 @@ void InspectorDOMAgent::setAttributesAsText(ErrorString* errorString, int elemen return; } - const NamedNodeMap* attrMap = toHTMLElement(child)->updatedAttributes(); - if (!attrMap && name) { - element->removeAttribute(*name); + Element* childElement = toElement(child); + if (!childElement->hasAttributes() && name) { + m_history->perform(adoptPtr(new RemoveAttributeAction(element, *name)), errorString); return; } bool foundOriginalAttribute = false; - unsigned numAttrs = attrMap->length(); + unsigned numAttrs = childElement->attributeCount(); for (unsigned i = 0; i < numAttrs; ++i) { // Add attribute pair - const Attribute* attribute = attrMap->attributeItem(i); + const Attribute* attribute = childElement->attributeItem(i); foundOriginalAttribute = foundOriginalAttribute || (name && attribute->name().toString() == *name); - element->setAttribute(attribute->name(), attribute->value()); + if (!m_history->perform(adoptPtr(new SetAttributeAction(element, attribute->name().toString(), attribute->value())), errorString)) + return; } - if (!foundOriginalAttribute && name) { - element->removeAttribute(*name); - return; - } + if (!foundOriginalAttribute && name && !name->stripWhiteSpace().isEmpty()) + m_history->perform(adoptPtr(new RemoveAttributeAction(element, *name)), errorString); + + m_history->markUndoableState(); } void InspectorDOMAgent::removeAttribute(ErrorString* errorString, int elementId, const String& name) { Element* element = assertElement(errorString, elementId); - if (element) - element->removeAttribute(name); + if (!element) + return; + + m_history->perform(adoptPtr(new RemoveAttributeAction(element, name)), errorString); + m_history->markUndoableState(); } void InspectorDOMAgent::removeNode(ErrorString* errorString, int nodeId) @@ -570,13 +838,11 @@ void InspectorDOMAgent::removeNode(ErrorString* errorString, int nodeId) return; } - ExceptionCode ec = 0; - parentNode->removeChild(node, ec); - if (ec) - *errorString = "Could not remove node due to DOM exception"; + m_history->perform(adoptPtr(new RemoveChildAction(parentNode, node)), errorString); + m_history->markUndoableState(); } -void InspectorDOMAgent::setNodeName(ErrorString*, int nodeId, const String& tagName, int* newId) +void InspectorDOMAgent::setNodeName(ErrorString* errorString, int nodeId, const String& tagName, int* newId) { *newId = 0; @@ -594,16 +860,18 @@ void InspectorDOMAgent::setNodeName(ErrorString*, int nodeId, const String& tagN // Copy over the original node's children. Node* child; - while ((child = oldNode->firstChild())) - newElem->appendChild(child, ec); + while ((child = oldNode->firstChild())) { + if (!m_history->perform(adoptPtr(new InsertBeforeAction(newElem.get(), child, 0)), errorString)) + return; + } // Replace the old node with the new node ContainerNode* parent = oldNode->parentNode(); - parent->insertBefore(newElem, oldNode->nextSibling(), ec); - parent->removeChild(oldNode, ec); - - if (ec) + if (!m_history->perform(adoptPtr(new InsertBeforeAction(parent, newElem.get(), oldNode->nextSibling())), errorString)) + return; + if (!m_history->perform(adoptPtr(new RemoveChildAction(parent, oldNode)), errorString)) return; + m_history->markUndoableState(); *newId = pushNodePathToFrontend(newElem.get()); if (m_childrenRequested.contains(nodeId)) @@ -639,13 +907,14 @@ void InspectorDOMAgent::setOuterHTML(ErrorString* errorString, int nodeId, const DOMEditor domEditor(document); - ExceptionCode ec = 0; - Node* newNode = domEditor.patchNode(node, outerHTML, ec); - if (ec) { - ExceptionCodeDescription description(ec); - *errorString = description.name; + OwnPtr<SetOuterHTMLAction> action = adoptPtr(new SetOuterHTMLAction(node, outerHTML)); + SetOuterHTMLAction* rawAction = action.get(); + Node* newNode = 0; + if (!m_history->perform(action.release(), errorString)) return; - } + m_history->markUndoableState(); + + newNode = rawAction->newNode(); if (!newNode) { // The only child node has been deleted. @@ -670,11 +939,7 @@ void InspectorDOMAgent::setNodeValue(ErrorString* errorString, int nodeId, const return; } - Text* textNode = static_cast<Text*>(node); - ExceptionCode ec = 0; - textNode->replaceWholeText(value, ec); - if (ec) - *errorString = "DOM Error while setting the node value"; + m_history->perform(adoptPtr(new ReplaceWholeTextAction(static_cast<Text*>(node), value)), errorString); } void InspectorDOMAgent::getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>& listenersArray) @@ -781,14 +1046,14 @@ void InspectorDOMAgent::performSearch(ErrorString*, const String& whitespaceTrim break; } // Go through all attributes and serialize them. - const NamedNodeMap* attrMap = static_cast<Element*>(node)->updatedAttributes(); - if (!attrMap) + const Element* element = toElement(node); + if (!element->hasAttributes()) break; - unsigned numAttrs = attrMap->length(); + unsigned numAttrs = element->attributeCount(); for (unsigned i = 0; i < numAttrs; ++i) { // Add attribute pair - const Attribute* attribute = attrMap->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); if (attribute->localName().find(whitespaceTrimmedQuery) != notFound) { resultCollector.add(node); break; @@ -975,7 +1240,7 @@ void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int void InspectorDOMAgent::highlightNode( ErrorString*, int nodeId, - const RefPtr<InspectorObject> highlightConfig) + const RefPtr<InspectorObject>& highlightConfig) { if (Node* node = nodeForId(nodeId)) { if (setHighlightDataFromConfig(highlightConfig.get())) { @@ -1011,36 +1276,57 @@ void InspectorDOMAgent::hideHighlight(ErrorString*) m_client->hideHighlight(); } -void InspectorDOMAgent::moveTo(ErrorString* error, int nodeId, int targetElementId, const int* const anchorNodeId, int* newNodeId) +void InspectorDOMAgent::moveTo(ErrorString* errorString, int nodeId, int targetElementId, const int* const anchorNodeId, int* newNodeId) { - Node* node = assertNode(error, nodeId); + Node* node = assertNode(errorString, nodeId); if (!node) return; - Element* targetElement = assertElement(error, targetElementId); + Element* targetElement = assertElement(errorString, targetElementId); if (!targetElement) return; Node* anchorNode = 0; if (anchorNodeId && *anchorNodeId) { - anchorNode = assertNode(error, *anchorNodeId); + anchorNode = assertNode(errorString, *anchorNodeId); if (!anchorNode) return; if (anchorNode->parentNode() != targetElement) { - *error = "Anchor node must be child of the target element"; + *errorString = "Anchor node must be child of the target element"; return; } } - ExceptionCode ec = 0; - bool success = targetElement->insertBefore(node, anchorNode, ec); - if (ec || !success) { - *error = "Could not drop node"; + if (!m_history->perform(adoptPtr(new InsertBeforeAction(targetElement, node, anchorNode)), errorString)) return; - } + m_history->markUndoableState(); + *newNodeId = pushNodePathToFrontend(node); } +void InspectorDOMAgent::setTouchEmulationEnabled(ErrorString* error, bool enabled) +{ +#if ENABLE(TOUCH_EVENTS) + if (m_state->getBoolean(DOMAgentState::touchEventEmulationEnabled) == enabled) + return; + UNUSED_PARAM(error); + updateTouchEventEmulationInPage(enabled); +#else + *error = "Touch events emulation not supported"; + UNUSED_PARAM(enabled); +#endif +} + +void InspectorDOMAgent::undo(ErrorString* errorString) +{ + m_history->undo(errorString); +} + +void InspectorDOMAgent::markUndoableState(ErrorString*) +{ + m_history->markUndoableState(); +} + void InspectorDOMAgent::resolveNode(ErrorString* error, int nodeId, const String* const objectGroup, RefPtr<InspectorObject>& result) { String objectGroupName = objectGroup ? *objectGroup : ""; @@ -1159,13 +1445,12 @@ PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForElementAttributes(Ele { RefPtr<InspectorArray> attributesValue = InspectorArray::create(); // Go through all attributes and serialize them. - const NamedNodeMap* attrMap = element->updatedAttributes(); - if (!attrMap) + if (!element->hasAttributes()) return attributesValue.release(); - unsigned numAttrs = attrMap->length(); + unsigned numAttrs = element->attributeCount(); for (unsigned i = 0; i < numAttrs; ++i) { // Add attribute pair - const Attribute* attribute = attrMap->attributeItem(i); + const Attribute* attribute = element->attributeItem(i); attributesValue->pushString(attribute->name().toString()); attributesValue->pushString(attribute->value()); } diff --git a/Source/WebCore/inspector/InspectorDOMAgent.h b/Source/WebCore/inspector/InspectorDOMAgent.h index 01c49dccc..40f0f81b2 100644 --- a/Source/WebCore/inspector/InspectorDOMAgent.h +++ b/Source/WebCore/inspector/InspectorDOMAgent.h @@ -35,6 +35,7 @@ #include "InjectedScriptManager.h" #include "InspectorBaseAgent.h" #include "InspectorFrontend.h" +#include "InspectorHistory.h" #include "InspectorValues.h" #include "Timer.h" @@ -89,7 +90,7 @@ struct EventListenerInfo { const EventListenerVector eventListenerVector; }; -class InspectorDOMAgent : public InspectorBaseAgent<InspectorDOMAgent> { +class InspectorDOMAgent : public InspectorBaseAgent<InspectorDOMAgent>, public InspectorBackendDispatcher::DOMCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorDOMAgent); public: struct DOMListener { @@ -116,32 +117,35 @@ public: void reset(); // Methods called from the frontend for DOM nodes inspection. - void querySelector(ErrorString*, int nodeId, const String& selectors, int* elementId); - void querySelectorAll(ErrorString*, int nodeId, const String& selectors, RefPtr<InspectorArray>& result); - void getDocument(ErrorString*, RefPtr<InspectorObject>& root); - void requestChildNodes(ErrorString*, int nodeId); - void setAttributeValue(ErrorString*, int elementId, const String& name, const String& value); - void setAttributesAsText(ErrorString*, int elementId, const String& text, const String* const name); - void removeAttribute(ErrorString*, int elementId, const String& name); - void removeNode(ErrorString*, int nodeId); - void setNodeName(ErrorString*, int nodeId, const String& name, int* newId); - void getOuterHTML(ErrorString*, int nodeId, WTF::String* outerHTML); - void setOuterHTML(ErrorString*, int nodeId, const String& outerHTML); - void setNodeValue(ErrorString*, int nodeId, const String& value); - void getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>& listenersArray); - void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, String* searchId, int* resultCount); - void getSearchResults(ErrorString*, const String& searchId, int fromIndex, int toIndex, RefPtr<InspectorArray>&); - void discardSearchResults(ErrorString*, const String& searchId); - void resolveNode(ErrorString*, int nodeId, const String* const objectGroup, RefPtr<InspectorObject>& result); - void getAttributes(ErrorString*, int nodeId, RefPtr<InspectorArray>& result); - void setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig); - void requestNode(ErrorString*, const String& objectId, int* nodeId); - void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId); - void hideHighlight(ErrorString*); - void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); - void highlightNode(ErrorString*, int nodeId, const RefPtr<InspectorObject> highlightConfig); - void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); - void moveTo(ErrorString*, int nodeId, int targetNodeId, const int* const anchorNodeId, int* newNodeId); + virtual void querySelector(ErrorString*, int nodeId, const String& selectors, int* elementId); + virtual void querySelectorAll(ErrorString*, int nodeId, const String& selectors, RefPtr<InspectorArray>& result); + virtual void getDocument(ErrorString*, RefPtr<InspectorObject>& root); + virtual void requestChildNodes(ErrorString*, int nodeId); + virtual void setAttributeValue(ErrorString*, int elementId, const String& name, const String& value); + virtual void setAttributesAsText(ErrorString*, int elementId, const String& text, const String* name); + virtual void removeAttribute(ErrorString*, int elementId, const String& name); + virtual void removeNode(ErrorString*, int nodeId); + virtual void setNodeName(ErrorString*, int nodeId, const String& name, int* newId); + virtual void getOuterHTML(ErrorString*, int nodeId, WTF::String* outerHTML); + virtual void setOuterHTML(ErrorString*, int nodeId, const String& outerHTML); + virtual void setNodeValue(ErrorString*, int nodeId, const String& value); + virtual void getEventListenersForNode(ErrorString*, int nodeId, RefPtr<InspectorArray>& listenersArray); + virtual void performSearch(ErrorString*, const String& whitespaceTrimmedQuery, String* searchId, int* resultCount); + virtual void getSearchResults(ErrorString*, const String& searchId, int fromIndex, int toIndex, RefPtr<InspectorArray>&); + virtual void discardSearchResults(ErrorString*, const String& searchId); + virtual void resolveNode(ErrorString*, int nodeId, const String* objectGroup, RefPtr<InspectorObject>& result); + virtual void getAttributes(ErrorString*, int nodeId, RefPtr<InspectorArray>& result); + virtual void setInspectModeEnabled(ErrorString*, bool enabled, const RefPtr<InspectorObject>* highlightConfig); + virtual void requestNode(ErrorString*, const String& objectId, int* nodeId); + virtual void pushNodeByPathToFrontend(ErrorString*, const String& path, int* nodeId); + virtual void hideHighlight(ErrorString*); + virtual void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); + virtual void highlightNode(ErrorString*, int nodeId, const RefPtr<InspectorObject>& highlightConfig); + virtual void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); + virtual void moveTo(ErrorString*, int nodeId, int targetNodeId, const int* anchorNodeId, int* newNodeId); + virtual void setTouchEmulationEnabled(ErrorString*, bool); + virtual void undo(ErrorString*); + virtual void markUndoableState(ErrorString*); Node* highlightedNode() const; @@ -175,6 +179,8 @@ public: void drawHighlight(GraphicsContext&) const; void getHighlight(Highlight*) const; + InspectorHistory* history() { return m_history.get(); } + // 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. static Node* innerFirstChild(Node*); @@ -187,6 +193,14 @@ public: Node* assertNode(ErrorString*, int nodeId); private: + class DOMAction; + class RemoveChildAction; + class InsertBeforeAction; + class RemoveAttributeAction; + class SetAttributeAction; + class SetOuterHTMLAction; + class ReplaceWholeTextAction; + InspectorDOMAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorClient*, InspectorState*, InjectedScriptManager*); void setSearchingForNode(bool enabled, InspectorObject* highlightConfig); @@ -216,6 +230,10 @@ private: void discardBindings(); +#if ENABLE(TOUCH_EVENTS) + void updateTouchEventEmulationInPage(bool); +#endif + InspectorPageAgent* m_pageAgent; InspectorClient* m_client; InjectedScriptManager* m_injectedScriptManager; @@ -235,6 +253,7 @@ private: OwnPtr<HighlightData> m_highlightData; RefPtr<Node> m_nodeToFocus; bool m_searchingForNode; + OwnPtr<InspectorHistory> m_history; }; #endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h b/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h index c49f6bec5..9683a58db 100644 --- a/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDOMDebuggerAgent.h @@ -54,7 +54,7 @@ class Node; typedef String ErrorString; -class InspectorDOMDebuggerAgent : public InspectorBaseAgent<InspectorDOMDebuggerAgent>, public InspectorDebuggerAgent::Listener { +class InspectorDOMDebuggerAgent : public InspectorBaseAgent<InspectorDOMDebuggerAgent>, public InspectorDebuggerAgent::Listener, public InspectorBackendDispatcher::DOMDebuggerCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorDOMDebuggerAgent); public: static PassOwnPtr<InspectorDOMDebuggerAgent> create(InstrumentingAgents*, InspectorState*, InspectorDOMAgent*, InspectorDebuggerAgent*, InspectorAgent*); @@ -62,14 +62,14 @@ public: virtual ~InspectorDOMDebuggerAgent(); // DOMDebugger API for InspectorFrontend - void setXHRBreakpoint(ErrorString*, const String& url); - void removeXHRBreakpoint(ErrorString*, const String& url); - void setEventListenerBreakpoint(ErrorString*, const String& eventName); - void removeEventListenerBreakpoint(ErrorString*, const String& eventName); - void setInstrumentationBreakpoint(ErrorString*, const String& eventName); - void removeInstrumentationBreakpoint(ErrorString*, const String& eventName); - void setDOMBreakpoint(ErrorString*, int nodeId, const String& type); - void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type); + virtual void setXHRBreakpoint(ErrorString*, const String& url); + virtual void removeXHRBreakpoint(ErrorString*, const String& url); + virtual void setEventListenerBreakpoint(ErrorString*, const String& eventName); + virtual void removeEventListenerBreakpoint(ErrorString*, const String& eventName); + virtual void setInstrumentationBreakpoint(ErrorString*, const String& eventName); + virtual void removeInstrumentationBreakpoint(ErrorString*, const String& eventName); + virtual void setDOMBreakpoint(ErrorString*, int nodeId, const String& type); + virtual void removeDOMBreakpoint(ErrorString*, int nodeId, const String& type); // InspectorInstrumentation API void willInsertDOMNode(Node*, Node* parent); diff --git a/Source/WebCore/inspector/InspectorDOMStorageAgent.h b/Source/WebCore/inspector/InspectorDOMStorageAgent.h index bd1d6a719..befbd9022 100644 --- a/Source/WebCore/inspector/InspectorDOMStorageAgent.h +++ b/Source/WebCore/inspector/InspectorDOMStorageAgent.h @@ -47,7 +47,7 @@ class StorageArea; typedef String ErrorString; -class InspectorDOMStorageAgent : public InspectorBaseAgent<InspectorDOMStorageAgent> { +class InspectorDOMStorageAgent : public InspectorBaseAgent<InspectorDOMStorageAgent>, public InspectorBackendDispatcher::DOMStorageCommandHandler { public: static PassOwnPtr<InspectorDOMStorageAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state) { @@ -62,11 +62,11 @@ public: void clearResources(); // Called from the front-end. - void enable(ErrorString*); - void disable(ErrorString*); - void getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>& entries); - void setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success); - void removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void getDOMStorageEntries(ErrorString*, int storageId, RefPtr<InspectorArray>& entries); + virtual void setDOMStorageItem(ErrorString*, int storageId, const String& key, const String& value, bool* success); + virtual void removeDOMStorageItem(ErrorString*, int storageId, const String& key, bool* success); // Called from the injected script. int storageId(Storage*); diff --git a/Source/WebCore/inspector/InspectorDatabaseAgent.h b/Source/WebCore/inspector/InspectorDatabaseAgent.h index c9c2c53c4..9f4e94677 100644 --- a/Source/WebCore/inspector/InspectorDatabaseAgent.h +++ b/Source/WebCore/inspector/InspectorDatabaseAgent.h @@ -29,6 +29,8 @@ #ifndef InspectorDatabaseAgent_h #define InspectorDatabaseAgent_h +#if ENABLE(INSPECTOR) && ENABLE(SQL_DATABASE) + #include "InspectorBaseAgent.h" #include "PlatformString.h" #include <wtf/HashMap.h> @@ -45,7 +47,7 @@ class InstrumentingAgents; typedef String ErrorString; -class InspectorDatabaseAgent : public InspectorBaseAgent<InspectorDatabaseAgent> { +class InspectorDatabaseAgent : public InspectorBaseAgent<InspectorDatabaseAgent>, public InspectorBackendDispatcher::DatabaseCommandHandler { public: class FrontendProvider; @@ -62,10 +64,10 @@ public: void clearResources(); // Called from the front-end. - void enable(ErrorString*); - void disable(ErrorString*); - void getDatabaseTableNames(ErrorString*, int databaseId, RefPtr<InspectorArray>& names); - void executeSQL(ErrorString*, int databaseId, const String& query, bool* success, int* transactionId); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void getDatabaseTableNames(ErrorString*, int databaseId, RefPtr<InspectorArray>& names); + virtual void executeSQL(ErrorString*, int databaseId, const String& query, bool* success, int* transactionId); // Called from the injected script. int databaseId(Database*); @@ -85,4 +87,6 @@ private: } // namespace WebCore +#endif // ENABLE(INSPECTOR) && ENABLE(SQL_DATABASE) + #endif // !defined(InspectorDatabaseAgent_h) diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp index 5ef6dc451..742d288df 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.cpp +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.cpp @@ -185,6 +185,11 @@ void InspectorDebuggerAgent::didClearMainFrameWindowObject() m_frontend->globalObjectCleared(); } +bool InspectorDebuggerAgent::isPaused() +{ + return scriptDebugServer().isPaused(); +} + static PassRefPtr<InspectorObject> buildObjectForBreakpointCookie(const String& url, int lineNumber, int columnNumber, const String& condition, bool isRegex) { RefPtr<InspectorObject> breakpointObject = InspectorObject::create(); @@ -250,7 +255,7 @@ static bool parseLocation(ErrorString* errorString, RefPtr<InspectorObject> loca return true; } -void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorObject>& actualLocation) +void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorObject>& actualLocation) { String scriptId; int lineNumber; @@ -286,7 +291,7 @@ void InspectorDebuggerAgent::removeBreakpoint(ErrorString*, const String& breakp m_breakpointIdToDebugServerBreakpointIds.remove(debugServerBreakpointIdsIterator); } -void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, PassRefPtr<InspectorObject> location) +void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<InspectorObject>& location) { if (!m_continueToLocationBreakpointId.isEmpty()) { scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId); diff --git a/Source/WebCore/inspector/InspectorDebuggerAgent.h b/Source/WebCore/inspector/InspectorDebuggerAgent.h index dd37fb08c..b64fedc89 100644 --- a/Source/WebCore/inspector/InspectorDebuggerAgent.h +++ b/Source/WebCore/inspector/InspectorDebuggerAgent.h @@ -58,53 +58,54 @@ class ScriptValue; typedef String ErrorString; -class InspectorDebuggerAgent : public InspectorBaseAgent<InspectorDebuggerAgent>, public ScriptDebugListener { +class InspectorDebuggerAgent : public InspectorBaseAgent<InspectorDebuggerAgent>, public ScriptDebugListener, public InspectorBackendDispatcher::DebuggerCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorDebuggerAgent); WTF_MAKE_FAST_ALLOCATED; public: static const char* backtraceObjectGroup; virtual ~InspectorDebuggerAgent(); - void causesRecompilation(ErrorString*, bool*); - void canSetScriptSource(ErrorString*, bool*); - void supportsNativeBreakpoints(ErrorString*, bool*); + virtual void causesRecompilation(ErrorString*, bool*); + virtual void canSetScriptSource(ErrorString*, bool*); + virtual void supportsNativeBreakpoints(ErrorString*, bool*); - void enable(ErrorString*); - void disable(ErrorString*); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); virtual void setFrontend(InspectorFrontend*); virtual void clearFrontend(); virtual void restore(); void didClearMainFrameWindowObject(); + bool isPaused(); // Part of the protocol. - void setBreakpointsActive(ErrorString*, bool active); + virtual void setBreakpointsActive(ErrorString*, bool active); - void setBreakpointByUrl(ErrorString*, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorArray>& locations); - void setBreakpoint(ErrorString*, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorObject>& actualLocation); - void removeBreakpoint(ErrorString*, const String& breakpointId); - void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location); + virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const String* optionalCondition, String* breakpointId, RefPtr<InspectorArray>& locations); + virtual void setBreakpoint(ErrorString*, const RefPtr<InspectorObject>& location, const String* optionalCondition, String* breakpointId, RefPtr<InspectorObject>& actualLocation); + virtual void removeBreakpoint(ErrorString*, const String& breakpointId); + virtual void continueToLocation(ErrorString*, const RefPtr<InspectorObject>& location); - void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<InspectorArray>&); - void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<InspectorArray>& newCallFrames, RefPtr<InspectorObject>& result); - void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource); - void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<InspectorObject>& details); + virtual void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<InspectorArray>&); + virtual void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* preview, RefPtr<InspectorArray>& newCallFrames, RefPtr<InspectorObject>& result); + virtual void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource); + virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<InspectorObject>& details); void schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data); void cancelPauseOnNextStatement(); void breakProgram(const String& breakReason, PassRefPtr<InspectorObject> data); - void pause(ErrorString*); - void resume(ErrorString*); - void stepOver(ErrorString*); - void stepInto(ErrorString*); - void stepOut(ErrorString*); - void setPauseOnExceptions(ErrorString*, const String& pauseState); - void evaluateOnCallFrame(ErrorString*, + virtual void pause(ErrorString*); + virtual void resume(ErrorString*); + virtual void stepOver(ErrorString*); + virtual void stepInto(ErrorString*); + virtual void stepOut(ErrorString*); + virtual void setPauseOnExceptions(ErrorString*, const String& pauseState); + virtual void evaluateOnCallFrame(ErrorString*, const String& callFrameId, const String& expression, - const String* const objectGroup, - const bool* const includeCommandLineAPI, - const bool* const returnByValue, + const String* objectGroup, + const bool* includeCommandLineAPI, + const bool* returnByValue, RefPtr<InspectorObject>& result, bool* wasThrown); diff --git a/Source/WebCore/inspector/InspectorFileSystemAgent.h b/Source/WebCore/inspector/InspectorFileSystemAgent.h index 003a9c559..d53643c4f 100644 --- a/Source/WebCore/inspector/InspectorFileSystemAgent.h +++ b/Source/WebCore/inspector/InspectorFileSystemAgent.h @@ -45,7 +45,7 @@ class InspectorFrontend; class InspectorState; class InstrumentingAgents; -class InspectorFileSystemAgent : public InspectorBaseAgent<InspectorFileSystemAgent> { +class InspectorFileSystemAgent : public InspectorBaseAgent<InspectorFileSystemAgent>, public InspectorBackendDispatcher::FileSystemCommandHandler { public: static PassOwnPtr<InspectorFileSystemAgent> create(InstrumentingAgents*, InspectorState*); virtual ~InspectorFileSystemAgent(); @@ -53,8 +53,8 @@ public: void didOpenFileSystem(PassRefPtr<DOMFileSystem>); void fileSystemInvalidated(PassRefPtr<DOMFileSystem>); - void enable(ErrorString*); - void disable(ErrorString*); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); virtual void setFrontend(InspectorFrontend*); virtual void clearFrontend(); diff --git a/Source/WebCore/inspector/InspectorHistory.cpp b/Source/WebCore/inspector/InspectorHistory.cpp new file mode 100644 index 000000000..bf68c1ff5 --- /dev/null +++ b/Source/WebCore/inspector/InspectorHistory.cpp @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 "InspectorHistory.h" + +#if ENABLE(INSPECTOR) + +#include "Node.h" + +namespace WebCore { + +namespace { + +class UndoableStateMark : public InspectorHistory::Action { +public: + UndoableStateMark() : InspectorHistory::Action("[UndoableState]") { } + + virtual bool perform(ErrorString*) { return true; } + + virtual bool undo(ErrorString*) { return true; } + + virtual bool isUndoableStateMark() { return true; } +}; + +} + +InspectorHistory::Action::Action(const String& name) : m_name(name) +{ +} + +InspectorHistory::Action::~Action() +{ +} + +String InspectorHistory::Action::toString() +{ + return m_name; +} + +bool InspectorHistory::Action::isUndoableStateMark() +{ + return false; +} + +String InspectorHistory::Action::mergeId() +{ + return ""; +} + +void InspectorHistory::Action::merge(PassOwnPtr<Action>) +{ +} + +InspectorHistory::InspectorHistory() { } + +InspectorHistory::~InspectorHistory() { } + +bool InspectorHistory::perform(PassOwnPtr<Action> action, ErrorString* errorString) +{ + if (!action->perform(errorString)) + return false; + + if (!m_history.isEmpty() && !action->mergeId().isEmpty() && action->mergeId() == m_history.first()->mergeId()) + m_history.first()->merge(action); + else + m_history.prepend(action); + + return true; +} + +void InspectorHistory::markUndoableState() +{ + m_history.prepend(adoptPtr(new UndoableStateMark())); +} + +bool InspectorHistory::undo(ErrorString* errorString) +{ + while (!m_history.isEmpty() && m_history.first()->isUndoableStateMark()) + m_history.removeFirst(); + + while (!m_history.isEmpty()) { + OwnPtr<Action> first = m_history.takeFirst(); + if (!first->undo(errorString)) { + m_history.clear(); + return false; + } + + if (first->isUndoableStateMark()) + break; + } + + return true; +} + +void InspectorHistory::reset() +{ + m_history.clear(); +} + +} // namespace WebCore + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorHistory.h b/Source/WebCore/inspector/InspectorHistory.h new file mode 100644 index 000000000..e506e05b9 --- /dev/null +++ b/Source/WebCore/inspector/InspectorHistory.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 InspectorHistory_h +#define InspectorHistory_h + +#include "ExceptionCode.h" + +#include <wtf/Deque.h> +#include <wtf/OwnPtr.h> +#include <wtf/text/WTFString.h> + +namespace WebCore { + +class ContainerNode; +class Element; +class Node; + +typedef String ErrorString; + +#if ENABLE(INSPECTOR) + +class InspectorHistory { + WTF_MAKE_NONCOPYABLE(InspectorHistory); +public: + class Action { + public: + Action(const String& name); + virtual ~Action(); + virtual String toString(); + + virtual bool isUndoableStateMark(); + + virtual String mergeId(); + virtual void merge(PassOwnPtr<Action>); + + virtual bool perform(ErrorString*) = 0; + virtual bool undo(ErrorString*) = 0; + private: + String m_name; + }; + + InspectorHistory(); + virtual ~InspectorHistory(); + + bool perform(PassOwnPtr<Action>, ErrorString*); + void markUndoableState(); + + bool undo(ErrorString*); + void reset(); + +private: + void dump(); + Deque<OwnPtr<Action> > m_history; +}; + +#endif // ENABLE(INSPECTOR) + +} // namespace WebCore + +#endif // !defined(InspectorHistory_h) diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp index 9f029d677..b00525966 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp @@ -172,7 +172,7 @@ void ExecutableWithDatabase::start(IDBFactoryBackendInterface* idbFactory, Secur static PassRefPtr<IDBTransactionBackendInterface> transactionForDatabase(IDBDatabaseBackendInterface* idbDatabase, const String& objectStoreName) { - ExceptionCode ec; + ExceptionCode ec = 0; RefPtr<DOMStringList> transactionObjectStoreNamesList = DOMStringList::create(); transactionObjectStoreNamesList->append(objectStoreName); RefPtr<IDBTransactionBackendInterface> idbTransaction = idbDatabase->transaction(transactionObjectStoreNamesList.get(), IDBTransaction::READ_ONLY, ec); @@ -183,7 +183,7 @@ static PassRefPtr<IDBTransactionBackendInterface> transactionForDatabase(IDBData static PassRefPtr<IDBObjectStoreBackendInterface> objectStoreForTransaction(IDBTransactionBackendInterface* idbTransaction, const String& objectStoreName) { - ExceptionCode ec; + ExceptionCode ec = 0; RefPtr<IDBObjectStoreBackendInterface> idbObjectStore = idbTransaction->objectStore(objectStoreName, ec); if (ec) return 0; @@ -192,7 +192,7 @@ static PassRefPtr<IDBObjectStoreBackendInterface> objectStoreForTransaction(IDBT static PassRefPtr<IDBIndexBackendInterface> indexForObjectStore(IDBObjectStoreBackendInterface* idbObjectStore, const String& indexName) { - ExceptionCode ec; + ExceptionCode ec = 0; RefPtr<IDBIndexBackendInterface> idbIndex = idbObjectStore->index(indexName, ec); if (ec) return 0; diff --git a/Source/WebCore/inspector/InspectorIndexedDBAgent.h b/Source/WebCore/inspector/InspectorIndexedDBAgent.h index e8c77161d..1b46dd143 100644 --- a/Source/WebCore/inspector/InspectorIndexedDBAgent.h +++ b/Source/WebCore/inspector/InspectorIndexedDBAgent.h @@ -43,7 +43,7 @@ class InspectorPageAgent; typedef String ErrorString; -class InspectorIndexedDBAgent : public InspectorBaseAgent<InspectorIndexedDBAgent> { +class InspectorIndexedDBAgent : public InspectorBaseAgent<InspectorIndexedDBAgent>, public InspectorBackendDispatcher::IndexedDBCommandHandler { public: class FrontendProvider; @@ -58,10 +58,10 @@ public: virtual void restore(); // Called from the front-end. - void enable(ErrorString*); - void disable(ErrorString*); - void requestDatabaseNamesForFrame(ErrorString*, int requestId, const String& frameId); - void requestDatabase(ErrorString*, int requestId, const String& frameId, const String& databaseName); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void requestDatabaseNamesForFrame(ErrorString*, int requestId, const String& frameId); + virtual void requestDatabase(ErrorString*, int requestId, const String& frameId, const String& databaseName); private: InspectorIndexedDBAgent(InstrumentingAgents*, InspectorState*, InspectorPageAgent*); diff --git a/Source/WebCore/inspector/InspectorInstrumentation.cpp b/Source/WebCore/inspector/InspectorInstrumentation.cpp index 33d002159..95d6f30c6 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.cpp +++ b/Source/WebCore/inspector/InspectorInstrumentation.cpp @@ -109,6 +109,15 @@ void InspectorInstrumentation::didClearWindowObjectInWorldImpl(InstrumentingAgen #endif } +bool InspectorInstrumentation::isDebuggerPausedImpl(InstrumentingAgents* instrumentingAgents) +{ +#if ENABLE(JAVASCRIPT_DEBUGGER) + if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) + return debuggerAgent->isPaused(); +#endif + return false; +} + void InspectorInstrumentation::willInsertDOMNodeImpl(InstrumentingAgents* instrumentingAgents, Node* node, Node* parent) { #if ENABLE(JAVASCRIPT_DEBUGGER) diff --git a/Source/WebCore/inspector/InspectorInstrumentation.h b/Source/WebCore/inspector/InspectorInstrumentation.h index d0435519c..da7dfe019 100644 --- a/Source/WebCore/inspector/InspectorInstrumentation.h +++ b/Source/WebCore/inspector/InspectorInstrumentation.h @@ -80,6 +80,7 @@ typedef pair<InstrumentingAgents*, int> InspectorInstrumentationCookie; class InspectorInstrumentation { public: static void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*); + static bool isDebuggerPaused(Frame*); static void willInsertDOMNode(Document*, Node*, Node* parent); static void didInsertDOMNode(Document*, Node*); @@ -228,6 +229,7 @@ public: private: #if ENABLE(INSPECTOR) static void didClearWindowObjectInWorldImpl(InstrumentingAgents*, Frame*, DOMWrapperWorld*); + static bool isDebuggerPausedImpl(InstrumentingAgents*); static void willInsertDOMNodeImpl(InstrumentingAgents*, Node*, Node* parent); static void didInsertDOMNodeImpl(InstrumentingAgents*, Node*); @@ -383,6 +385,16 @@ inline void InspectorInstrumentation::didClearWindowObjectInWorld(Frame* frame, #endif } +inline bool InspectorInstrumentation::isDebuggerPaused(Frame* frame) +{ +#if ENABLE(INSPECTOR) + FAST_RETURN_IF_NO_FRONTENDS(false); + if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame)) + return isDebuggerPausedImpl(instrumentingAgents); +#endif + return false; +} + inline void InspectorInstrumentation::willInsertDOMNode(Document* document, Node* node, Node* parent) { #if ENABLE(INSPECTOR) diff --git a/Source/WebCore/inspector/InspectorMemoryAgent.h b/Source/WebCore/inspector/InspectorMemoryAgent.h index ab5305ee6..320abd98e 100644 --- a/Source/WebCore/inspector/InspectorMemoryAgent.h +++ b/Source/WebCore/inspector/InspectorMemoryAgent.h @@ -47,7 +47,7 @@ class Page; typedef String ErrorString; -class InspectorMemoryAgent : public InspectorBaseAgent<InspectorMemoryAgent> { +class InspectorMemoryAgent : public InspectorBaseAgent<InspectorMemoryAgent>, public InspectorBackendDispatcher::MemoryCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorMemoryAgent); public: typedef Vector<OwnPtr<InspectorBaseAgentInterface> > InspectorAgents; diff --git a/Source/WebCore/inspector/InspectorPageAgent.h b/Source/WebCore/inspector/InspectorPageAgent.h index d61c0939e..59ed709d7 100644 --- a/Source/WebCore/inspector/InspectorPageAgent.h +++ b/Source/WebCore/inspector/InspectorPageAgent.h @@ -60,7 +60,7 @@ class SharedBuffer; typedef String ErrorString; -class InspectorPageAgent : public InspectorBaseAgent<InspectorPageAgent> { +class InspectorPageAgent : public InspectorBaseAgent<InspectorPageAgent>, public InspectorBackendDispatcher::PageCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorPageAgent); public: enum ResourceType { @@ -87,20 +87,20 @@ public: static String cachedResourceTypeString(const CachedResource&); // Page API for InspectorFrontend - void enable(ErrorString*); - void disable(ErrorString*); - void addScriptToEvaluateOnLoad(ErrorString*, const String& source, String* result); - void removeScriptToEvaluateOnLoad(ErrorString*, const String& identifier); - void reload(ErrorString*, const bool* const optionalIgnoreCache, const String* optionalScriptToEvaluateOnLoad); - void navigate(ErrorString*, const String& url); - void getCookies(ErrorString*, RefPtr<InspectorArray>& cookies, WTF::String* cookiesString); - void deleteCookie(ErrorString*, const String& cookieName, const String& domain); - void getResourceTree(ErrorString*, RefPtr<InspectorObject>&); - void getResourceContent(ErrorString*, const String& frameId, const String& url, String* content, bool* base64Encoded); - void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<InspectorArray>&); - void searchInResources(ErrorString*, const String&, const bool* const caseSensitive, const bool* const isRegex, RefPtr<InspectorArray>&); - void setDocumentContent(ErrorString*, const String& frameId, const String& html); - void setScreenSizeOverride(ErrorString*, const int width, const int height); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& source, String* result); + virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& identifier); + virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const String* optionalScriptToEvaluateOnLoad); + virtual void navigate(ErrorString*, const String& url); + virtual void getCookies(ErrorString*, RefPtr<InspectorArray>& cookies, WTF::String* cookiesString); + virtual void deleteCookie(ErrorString*, const String& cookieName, const String& domain); + virtual void getResourceTree(ErrorString*, RefPtr<InspectorObject>&); + virtual void getResourceContent(ErrorString*, const String& frameId, const String& url, String* content, bool* base64Encoded); + virtual void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<InspectorArray>&); + virtual void searchInResources(ErrorString*, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<InspectorArray>&); + virtual void setDocumentContent(ErrorString*, const String& frameId, const String& html); + virtual void setScreenSizeOverride(ErrorString*, int width, int height); // InspectorInstrumentation API void didClearWindowObjectInWorld(Frame*, DOMWrapperWorld*); diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.cpp b/Source/WebCore/inspector/InspectorProfilerAgent.cpp index fdd56a865..8774276cb 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.cpp +++ b/Source/WebCore/inspector/InspectorProfilerAgent.cpp @@ -33,6 +33,7 @@ #if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR) #include "Console.h" +#include "InjectedScript.h" #include "InspectorConsoleAgent.h" #include "InspectorFrontend.h" #include "InspectorState.h" @@ -42,6 +43,7 @@ #include "Page.h" #include "PageScriptDebugServer.h" #include "ScriptHeapSnapshot.h" +#include "ScriptObject.h" #include "ScriptProfile.h" #include "ScriptProfiler.h" #include <wtf/OwnPtr.h> @@ -217,8 +219,9 @@ private: } // namespace -void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, unsigned uid, RefPtr<InspectorObject>& profileObject) +void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, int rawUid, RefPtr<InspectorObject>& profileObject) { + unsigned uid = static_cast<unsigned>(rawUid); if (type == CPUProfileType) { ProfilesMap::iterator it = m_profiles.find(uid); if (it != m_profiles.end()) { @@ -240,8 +243,9 @@ void InspectorProfilerAgent::getProfile(ErrorString*, const String& type, unsign } } -void InspectorProfilerAgent::removeProfile(ErrorString*, const String& type, unsigned uid) +void InspectorProfilerAgent::removeProfile(ErrorString*, const String& type, int rawUid) { + unsigned uid = static_cast<unsigned>(rawUid); if (type == CPUProfileType) { if (m_profiles.contains(uid)) m_profiles.remove(uid); @@ -387,13 +391,21 @@ void InspectorProfilerAgent::toggleRecordButton(bool isProfiling) m_frontend->setRecordingProfile(isProfiling); } -void InspectorProfilerAgent::getObjectByHeapObjectId(ErrorString* error, int id, RefPtr<InspectorObject>& result) +void InspectorProfilerAgent::getObjectByHeapObjectId(ErrorString* error, int id, const String* objectGroup, RefPtr<InspectorObject>& result) { - RefPtr<InspectorValue> heapObject = ScriptProfiler::objectByHeapObjectId(id, m_injectedScriptManager); - if (!heapObject->isNull()) - heapObject->asObject(&result); - else + ScriptObject heapObject = ScriptProfiler::objectByHeapObjectId(id); + if (heapObject.hasNoValue()) { *error = "Object is not available."; + return; + } + InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(heapObject.scriptState()); + if (injectedScript.hasNoValue()) { + *error = "Object is not available. Inspected context is gone."; + return; + } + result = injectedScript.wrapObject(heapObject, objectGroup ? *objectGroup : ""); + if (!result) + *error = "Failed to wrap object."; } } // namespace WebCore diff --git a/Source/WebCore/inspector/InspectorProfilerAgent.h b/Source/WebCore/inspector/InspectorProfilerAgent.h index 02bcb7b43..a5576d899 100644 --- a/Source/WebCore/inspector/InspectorProfilerAgent.h +++ b/Source/WebCore/inspector/InspectorProfilerAgent.h @@ -55,7 +55,7 @@ class ScriptProfile; typedef String ErrorString; -class InspectorProfilerAgent : public InspectorBaseAgent<InspectorProfilerAgent> { +class InspectorProfilerAgent : public InspectorBaseAgent<InspectorProfilerAgent>, public InspectorBackendDispatcher::ProfilerCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorProfilerAgent); WTF_MAKE_FAST_ALLOCATED; public: static PassOwnPtr<InspectorProfilerAgent> create(InstrumentingAgents*, InspectorConsoleAgent*, Page*, InspectorState*, InjectedScriptManager*); @@ -64,35 +64,35 @@ public: void addProfile(PassRefPtr<ScriptProfile> prpProfile, unsigned lineNumber, const String& sourceURL); void addProfileFinishedMessageToConsole(PassRefPtr<ScriptProfile>, unsigned lineNumber, const String& sourceURL); void addStartProfilingMessageToConsole(const String& title, unsigned lineNumber, const String& sourceURL); - void collectGarbage(ErrorString*); - void clearProfiles(ErrorString*) { resetState(); } + virtual void collectGarbage(ErrorString*); + virtual void clearProfiles(ErrorString*) { resetState(); } void resetState(); - void causesRecompilation(ErrorString*, bool*); - void isSampling(ErrorString*, bool*); - void hasHeapProfiler(ErrorString*, bool*); + virtual void causesRecompilation(ErrorString*, bool*); + virtual void isSampling(ErrorString*, bool*); + virtual void hasHeapProfiler(ErrorString*, bool*); - void enable(ErrorString*); - void disable(ErrorString*); - void start(ErrorString* = 0); - void stop(ErrorString* = 0); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void start(ErrorString* = 0); + virtual void stop(ErrorString* = 0); void disable(); void enable(bool skipRecompile); bool enabled() { return m_enabled; } String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false); - void getProfileHeaders(ErrorString* error, RefPtr<InspectorArray>& headers); - void getProfile(ErrorString* error, const String& type, unsigned uid, RefPtr<InspectorObject>& profileObject); - void removeProfile(ErrorString* error, const String& type, unsigned uid); + virtual void getProfileHeaders(ErrorString*, RefPtr<InspectorArray>& headers); + virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<InspectorObject>& profileObject); + virtual void removeProfile(ErrorString*, const String& type, int uid); virtual void setFrontend(InspectorFrontend*); virtual void clearFrontend(); virtual void restore(); - void takeHeapSnapshot(ErrorString*); + virtual void takeHeapSnapshot(ErrorString*); void toggleRecordButton(bool isProfiling); - void getObjectByHeapObjectId(ErrorString*, int id, RefPtr<InspectorObject>& result); + virtual void getObjectByHeapObjectId(ErrorString*, int id, const String* objectGroup, RefPtr<InspectorObject>& result); private: typedef HashMap<unsigned int, RefPtr<ScriptProfile> > ProfilesMap; diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp index d8e4c6902..ca3b0e925 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.cpp +++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp @@ -473,7 +473,7 @@ void InspectorResourceAgent::setUserAgentOverride(ErrorString*, const String& us m_state->setString(ResourceAgentState::userAgentOverride, userAgent); } -void InspectorResourceAgent::setExtraHTTPHeaders(ErrorString*, PassRefPtr<InspectorObject> headers) +void InspectorResourceAgent::setExtraHTTPHeaders(ErrorString*, const RefPtr<InspectorObject>& headers) { m_state->setObject(ResourceAgentState::extraRequestHeaders, headers); } diff --git a/Source/WebCore/inspector/InspectorResourceAgent.h b/Source/WebCore/inspector/InspectorResourceAgent.h index 8f6f75bf2..099fa76df 100644 --- a/Source/WebCore/inspector/InspectorResourceAgent.h +++ b/Source/WebCore/inspector/InspectorResourceAgent.h @@ -73,7 +73,7 @@ class WebSocketHandshakeResponse; typedef String ErrorString; -class InspectorResourceAgent : public InspectorBaseAgent<InspectorResourceAgent> { +class InspectorResourceAgent : public InspectorBaseAgent<InspectorResourceAgent>, public InspectorBackendDispatcher::NetworkCommandHandler { public: static PassOwnPtr<InspectorResourceAgent> create(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorClient* client, InspectorState* state) { @@ -123,18 +123,19 @@ public: void setResourcesDataSizeLimitsFromInternals(int maximumResourcesContentSize, int maximumSingleResourceContentSize); // Called from frontend - void enable(ErrorString*); - void disable(ErrorString*); - void setUserAgentOverride(ErrorString*, const String& userAgent); - void setExtraHTTPHeaders(ErrorString*, PassRefPtr<InspectorObject>); - void getResponseBody(ErrorString*, const String& requestId, String* content, bool* base64Encoded); + virtual void enable(ErrorString*); + virtual void disable(ErrorString*); + virtual void setUserAgentOverride(ErrorString*, const String& userAgent); + virtual void setExtraHTTPHeaders(ErrorString*, const RefPtr<InspectorObject>&); + virtual void getResponseBody(ErrorString*, const String& requestId, String* content, bool* base64Encoded); + // FIXME: this seems to be unsued. void clearCache(ErrorString*, const String* const optionalPreservedLoaderId); - void canClearBrowserCache(ErrorString*, bool*); - void clearBrowserCache(ErrorString*); - void canClearBrowserCookies(ErrorString*, bool*); - void clearBrowserCookies(ErrorString*); - void setCacheDisabled(ErrorString*, bool cacheDisabled); + virtual void canClearBrowserCache(ErrorString*, bool*); + virtual void clearBrowserCache(ErrorString*); + virtual void canClearBrowserCookies(ErrorString*, bool*); + virtual void clearBrowserCookies(ErrorString*); + virtual void setCacheDisabled(ErrorString*, bool cacheDisabled); private: InspectorResourceAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorClient*, InspectorState*); diff --git a/Source/WebCore/inspector/InspectorRuntimeAgent.h b/Source/WebCore/inspector/InspectorRuntimeAgent.h index 79a202b89..627da73ea 100644 --- a/Source/WebCore/inspector/InspectorRuntimeAgent.h +++ b/Source/WebCore/inspector/InspectorRuntimeAgent.h @@ -51,32 +51,32 @@ class WorkerContext; typedef String ErrorString; -class InspectorRuntimeAgent : public InspectorBaseAgent<InspectorRuntimeAgent> { +class InspectorRuntimeAgent : public InspectorBaseAgent<InspectorRuntimeAgent>, public InspectorBackendDispatcher::RuntimeCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorRuntimeAgent); public: virtual ~InspectorRuntimeAgent(); // Part of the protocol. - void evaluate(ErrorString*, + virtual void evaluate(ErrorString*, const String& expression, - const String* const objectGroup, - const bool* const includeCommandLineAPI, - const bool* const doNotPauseOnExceptions, - const String* const frameId, - const bool* const returnByValue, + const String* objectGroup, + const bool* includeCommandLineAPI, + const bool* doNotPauseOnExceptions, + const String* frameId, + const bool* returnByValue, RefPtr<InspectorObject>& result, bool* wasThrown); - void callFunctionOn(ErrorString*, + virtual void callFunctionOn(ErrorString*, const String& objectId, const String& expression, - const RefPtr<InspectorArray>* const optionalArguments, - const bool* const returnByValue, + const RefPtr<InspectorArray>* optionalArguments, + const bool* returnByValue, RefPtr<InspectorObject>& result, bool* wasThrown); - void releaseObject(ErrorString*, const String& objectId); - void getProperties(ErrorString*, const String& objectId, const bool* const ownProperties, RefPtr<InspectorArray>& result); - void releaseObjectGroup(ErrorString*, const String& objectGroup); - void run(ErrorString*); + virtual void releaseObject(ErrorString*, const String& objectId); + virtual void getProperties(ErrorString*, const String& objectId, const bool* ownProperties, RefPtr<InspectorArray>& result); + virtual void releaseObjectGroup(ErrorString*, const String& objectGroup); + virtual void run(ErrorString*); #if ENABLE(JAVASCRIPT_DEBUGGER) void setScriptDebugServer(ScriptDebugServer*); diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp index 2f37f0d34..c7c4edb77 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.cpp +++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp @@ -280,7 +280,7 @@ PassRefPtr<InspectorArray> InspectorStyle::buildArrayForComputedStyle() const // // The propertyText (if not empty) is checked to be a valid style declaration (containing at least one property). If not, // the method returns false (denoting an error). -bool InspectorStyle::setPropertyText(ErrorString* errorString, unsigned index, const String& propertyText, bool overwrite) +bool InspectorStyle::setPropertyText(ErrorString* errorString, unsigned index, const String& propertyText, bool overwrite, String* oldText) { ASSERT(m_parentStyleSheet); DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); @@ -294,7 +294,7 @@ bool InspectorStyle::setPropertyText(ErrorString* errorString, unsigned index, c populateAllProperties(&allProperties); if (propertyText.stripWhiteSpace().length()) { - RefPtr<CSSMutableStyleDeclaration> tempMutableStyle = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> tempMutableStyle = StylePropertySet::create(); RefPtr<CSSStyleSourceData> sourceData = CSSStyleSourceData::create(); CSSParser p; p.parseDeclaration(tempMutableStyle.get(), propertyText + " " + bogusPropertyName + ": none", &sourceData, m_style->parentStyleSheet()); @@ -328,9 +328,10 @@ bool InspectorStyle::setPropertyText(ErrorString* errorString, unsigned index, c } InspectorStyleTextEditor editor(&allProperties, &m_disabledProperties, text, newLineAndWhitespaceDelimiters()); - if (overwrite) + if (overwrite) { + *oldText = allProperties.at(index).rawText; editor.replaceProperty(index, propertyText); - else + } else editor.insertProperty(index, propertyText, sourceData->styleSourceData->styleBodyRange.length()); return applyStyleText(editor.styleText()); @@ -385,7 +386,7 @@ bool InspectorStyle::styleText(String* result) const return false; String styleSheetText; - bool success = m_parentStyleSheet->text(&styleSheetText); + bool success = m_parentStyleSheet->getText(&styleSheetText); if (!success) return false; @@ -729,7 +730,7 @@ bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String CSSStyleRule* InspectorStyleSheet::addRule(const String& selector) { String styleSheetText; - bool success = text(&styleSheetText); + bool success = getText(&styleSheetText); if (!success) return 0; @@ -777,7 +778,7 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyleSheet() result->setArray("rules", cssRules.release()); String styleSheetText; - bool success = text(&styleSheetText); + bool success = getText(&styleSheetText); if (success) result->setString("text", styleSheetText); @@ -857,7 +858,7 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyle(CSSStyleDec // Style text cannot be retrieved without stylesheet, so set cssText here. if (sourceData) { String sheetText; - bool success = text(&sheetText); + bool success = getText(&sheetText); if (success) { const SourceRange& bodyRange = sourceData->styleSourceData->styleBodyRange; result->setString("cssText", sheetText.substring(bodyRange.start, bodyRange.end - bodyRange.start)); @@ -867,7 +868,7 @@ PassRefPtr<InspectorObject> InspectorStyleSheet::buildObjectForStyle(CSSStyleDec return result.release(); } -bool InspectorStyleSheet::setPropertyText(ErrorString* errorString, const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite) +bool InspectorStyleSheet::setPropertyText(ErrorString* errorString, const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, String* oldText) { RefPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id); if (!inspectorStyle) { @@ -875,7 +876,7 @@ bool InspectorStyleSheet::setPropertyText(ErrorString* errorString, const Inspec return false; } - return inspectorStyle->setPropertyText(errorString, propertyIndex, text, overwrite); + return inspectorStyle->setPropertyText(errorString, propertyIndex, text, overwrite, oldText); } bool InspectorStyleSheet::toggleProperty(ErrorString* errorString, const InspectorCSSId& id, unsigned propertyIndex, bool disable) @@ -896,7 +897,7 @@ bool InspectorStyleSheet::toggleProperty(ErrorString* errorString, const Inspect return success; } -bool InspectorStyleSheet::text(String* result) const +bool InspectorStyleSheet::getText(String* result) const { if (!ensureText()) return false; @@ -1241,7 +1242,7 @@ void InspectorStyleSheetForInlineStyle::didModifyElementAttribute() m_ruleSourceData.clear(); } -bool InspectorStyleSheetForInlineStyle::text(String* result) const +bool InspectorStyleSheetForInlineStyle::getText(String* result) const { if (!m_isStyleTextValid) { m_styleText = elementStyleText(); @@ -1317,7 +1318,7 @@ bool InspectorStyleSheetForInlineStyle::getStyleAttributeRanges(RefPtr<CSSStyleS return true; } - RefPtr<CSSMutableStyleDeclaration> tempDeclaration = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> tempDeclaration = StylePropertySet::create(); CSSParser p; p.parseDeclaration(tempDeclaration.get(), m_styleText, result, m_element->document()->elementSheet()); return true; diff --git a/Source/WebCore/inspector/InspectorStyleSheet.h b/Source/WebCore/inspector/InspectorStyleSheet.h index f3195e889..d627b1dda 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.h +++ b/Source/WebCore/inspector/InspectorStyleSheet.h @@ -131,7 +131,7 @@ public: PassRefPtr<InspectorObject> buildObjectForStyle() const; PassRefPtr<InspectorArray> buildArrayForComputedStyle() const; bool hasDisabledProperties() const { return !m_disabledProperties.isEmpty(); } - bool setPropertyText(ErrorString*, unsigned index, const String& text, bool overwrite); + bool setPropertyText(ErrorString*, unsigned index, const String& text, bool overwrite, String* oldText); bool toggleProperty(ErrorString*, unsigned index, bool disable); private: @@ -174,10 +174,10 @@ public: PassRefPtr<InspectorObject> buildObjectForStyleSheetInfo(); PassRefPtr<InspectorObject> buildObjectForRule(CSSStyleRule*); PassRefPtr<InspectorObject> buildObjectForStyle(CSSStyleDeclaration*); - bool setPropertyText(ErrorString*, const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite); + bool setPropertyText(ErrorString*, const InspectorCSSId&, unsigned propertyIndex, const String& text, bool overwrite, String* oldPropertyText); bool toggleProperty(ErrorString*, const InspectorCSSId&, unsigned propertyIndex, bool disable); - virtual bool text(String* result) const; + virtual bool getText(String* result) const; virtual CSSStyleDeclaration* styleForId(const InspectorCSSId&) const; protected: @@ -228,7 +228,7 @@ public: static PassRefPtr<InspectorStyleSheetForInlineStyle> create(const String& id, PassRefPtr<Element> element, const String& origin); void didModifyElementAttribute(); - virtual bool text(String* result) const; + virtual bool getText(String* result) const; virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } protected: diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.cpp b/Source/WebCore/inspector/InspectorTimelineAgent.cpp index 5c0acd18b..d23c1ea21 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.cpp +++ b/Source/WebCore/inspector/InspectorTimelineAgent.cpp @@ -136,7 +136,7 @@ void InspectorTimelineAgent::restore() } } -void InspectorTimelineAgent::start(ErrorString*, int* maxCallStackDepth) +void InspectorTimelineAgent::start(ErrorString*, const int* maxCallStackDepth) { if (!m_frontend) return; diff --git a/Source/WebCore/inspector/InspectorTimelineAgent.h b/Source/WebCore/inspector/InspectorTimelineAgent.h index 92a970cd9..dc0b9e4f6 100644 --- a/Source/WebCore/inspector/InspectorTimelineAgent.h +++ b/Source/WebCore/inspector/InspectorTimelineAgent.h @@ -54,7 +54,7 @@ class ResourceResponse; typedef String ErrorString; -class InspectorTimelineAgent : public InspectorBaseAgent<InspectorTimelineAgent>, ScriptGCEventListener { +class InspectorTimelineAgent : public InspectorBaseAgent<InspectorTimelineAgent>, ScriptGCEventListener, public InspectorBackendDispatcher::TimelineCommandHandler { WTF_MAKE_NONCOPYABLE(InspectorTimelineAgent); public: static PassOwnPtr<InspectorTimelineAgent> create(InstrumentingAgents* instrumentingAgents, InspectorState* state, InspectorMemoryAgent* memoryAgent) @@ -68,9 +68,9 @@ public: virtual void clearFrontend(); virtual void restore(); - void start(ErrorString*, int* maxCallStackDepth); - void stop(ErrorString*); - void setIncludeMemoryDetails(ErrorString*, bool); + virtual void start(ErrorString*, const int* maxCallStackDepth); + virtual void stop(ErrorString*); + virtual void setIncludeMemoryDetails(ErrorString*, bool); int id() const { return m_id; } diff --git a/Source/WebCore/inspector/InspectorWorkerAgent.cpp b/Source/WebCore/inspector/InspectorWorkerAgent.cpp index 7511da1d6..1b3859571 100644 --- a/Source/WebCore/inspector/InspectorWorkerAgent.cpp +++ b/Source/WebCore/inspector/InspectorWorkerAgent.cpp @@ -169,7 +169,7 @@ void InspectorWorkerAgent::disconnectFromWorker(ErrorString* error, int workerId *error = "Worker is gone"; } -void InspectorWorkerAgent::sendMessageToWorker(ErrorString* error, int workerId, PassRefPtr<InspectorObject> message) +void InspectorWorkerAgent::sendMessageToWorker(ErrorString* error, int workerId, const RefPtr<InspectorObject>& message) { WorkerFrontendChannel* channel = m_idToChannel.get(workerId); if (channel) diff --git a/Source/WebCore/inspector/InspectorWorkerAgent.h b/Source/WebCore/inspector/InspectorWorkerAgent.h index 596ff16af..be33a5071 100644 --- a/Source/WebCore/inspector/InspectorWorkerAgent.h +++ b/Source/WebCore/inspector/InspectorWorkerAgent.h @@ -47,7 +47,7 @@ class WorkerContextProxy; typedef String ErrorString; -class InspectorWorkerAgent : public InspectorBaseAgent<InspectorWorkerAgent> { +class InspectorWorkerAgent : public InspectorBaseAgent<InspectorWorkerAgent>, public InspectorBackendDispatcher::WorkerCommandHandler { public: static PassOwnPtr<InspectorWorkerAgent> create(InstrumentingAgents*, InspectorState*); ~InspectorWorkerAgent(); @@ -62,11 +62,11 @@ public: void workerContextTerminated(WorkerContextProxy*); // Called from InspectorBackendDispatcher - void setWorkerInspectionEnabled(ErrorString*, bool value); - void connectToWorker(ErrorString*, int workerId); - void disconnectFromWorker(ErrorString*, int workerId); - void sendMessageToWorker(ErrorString*, int workerId, PassRefPtr<InspectorObject> message); - void setAutoconnectToWorkers(ErrorString*, bool value); + virtual void setWorkerInspectionEnabled(ErrorString*, bool value); + virtual void connectToWorker(ErrorString*, int workerId); + virtual void disconnectFromWorker(ErrorString*, int workerId); + virtual void sendMessageToWorker(ErrorString*, int workerId, const RefPtr<InspectorObject>& message); + virtual void setAutoconnectToWorkers(ErrorString*, bool value); private: InspectorWorkerAgent(InstrumentingAgents*, InspectorState*); diff --git a/Source/WebCore/inspector/JavaScriptCallFrame.idl b/Source/WebCore/inspector/JavaScriptCallFrame.idl index db0e0a62a..47ca5d181 100644 --- a/Source/WebCore/inspector/JavaScriptCallFrame.idl +++ b/Source/WebCore/inspector/JavaScriptCallFrame.idl @@ -28,7 +28,7 @@ module inspector { interface [ Conditional=JAVASCRIPT_DEBUGGER, OmitConstructor, - DontCheckEnums + DoNotCheckConstants ] JavaScriptCallFrame { // Scope type diff --git a/Source/WebCore/inspector/front-end/AuditRules.js b/Source/WebCore/inspector/front-end/AuditRules.js index 937a87243..8430ffa1e 100644 --- a/Source/WebCore/inspector/front-end/AuditRules.js +++ b/Source/WebCore/inspector/front-end/AuditRules.js @@ -729,8 +729,10 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { return; } - var widthFound = "width" in styles.styleAttributes; - var heightFound = "height" in styles.styleAttributes; + if (styles.attributesStyle) { + var widthFound = !!styles.attributesStyle.getLiveProperty("width"); + var heightFound = !!styles.attributesStyle.getLiveProperty("height"); + } var inlineStyle = styles.inlineStyle; if (inlineStyle) { @@ -765,10 +767,10 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = { return; var targetResult = {}; - function inlineCallback(inlineStyle, styleAttributes) + function inlineCallback(inlineStyle, attributesStyle) { targetResult.inlineStyle = inlineStyle; - targetResult.styleAttributes = styleAttributes; + targetResult.attributesStyle = attributesStyle; } function matchedCallback(result) diff --git a/Source/WebCore/inspector/front-end/CSSStyleModel.js b/Source/WebCore/inspector/front-end/CSSStyleModel.js index 1eb7d032f..50686bac4 100644 --- a/Source/WebCore/inspector/front-end/CSSStyleModel.js +++ b/Source/WebCore/inspector/front-end/CSSStyleModel.js @@ -132,28 +132,19 @@ WebInspector.CSSStyleModel.prototype = { /** * @param {DOMAgent.NodeId} nodeId - * @param {function(?WebInspector.CSSStyleDeclaration, ?Object.<string, string>)} userCallback + * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback */ getInlineStylesAsync: function(nodeId, userCallback) { /** - * @param {function(?WebInspector.CSSStyleDeclaration, ?Object.<string, string>)} userCallback + * @param {function(?WebInspector.CSSStyleDeclaration, ?WebInspector.CSSStyleDeclaration)} userCallback */ - function callback(userCallback, error, inlinePayload, attributesPayload) + function callback(userCallback, error, inlinePayload, attributesStylePayload) { if (error || !inlinePayload) userCallback(null, null); - else { - var styleAttributes; - if (attributesPayload) { - styleAttributes = {}; - for (var i = 0; i < attributesPayload.length; ++i) { - var name = attributesPayload[i].name; - styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(attributesPayload[i].style); - } - } - userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), styleAttributes || null); - } + else + userCallback(WebInspector.CSSStyleDeclaration.parsePayload(inlinePayload), attributesStylePayload ? WebInspector.CSSStyleDeclaration.parsePayload(attributesStylePayload) : null); } CSSAgent.getInlineStylesForNode(nodeId, callback.bind(null, userCallback)); @@ -643,6 +634,8 @@ WebInspector.CSSProperty.prototype = { // An index past all the properties adds a new property to the style. CSSAgent.setPropertyText(this.ownerStyle.id, this.index, propertyText, this.index < this.ownerStyle.pastLastSourcePropertyIndex(), callback.bind(this)); + if (majorChange) + DOMAgent.markUndoableState(); }, setValue: function(newValue, majorChange, userCallback) diff --git a/Source/WebCore/inspector/front-end/Color.js b/Source/WebCore/inspector/front-end/Color.js index 2c2778324..b5227503f 100644 --- a/Source/WebCore/inspector/front-end/Color.js +++ b/Source/WebCore/inspector/front-end/Color.js @@ -44,6 +44,11 @@ WebInspector.Color.fromRGBA = function(r, g, b, a) return new WebInspector.Color("rgba(" + r + "," + g + "," + b + "," + (typeof a === "undefined" ? 1 : a) + ")"); } +WebInspector.Color.fromRGB = function(r, g, b) +{ + return new WebInspector.Color("rgb(" + r + "," + g + "," + b + ")"); +} + WebInspector.Color.prototype = { /** * @return {string} diff --git a/Source/WebCore/inspector/front-end/DOMAgent.js b/Source/WebCore/inspector/front-end/DOMAgent.js index 0473235d8..c17f20394 100644 --- a/Source/WebCore/inspector/front-end/DOMAgent.js +++ b/Source/WebCore/inspector/front-end/DOMAgent.js @@ -40,6 +40,7 @@ WebInspector.DOMNode = function(domAgent, doc, payload) { this.ownerDocument = doc; this.id = payload.nodeId; + domAgent._idToDOMNode[this.id] = this; this._nodeType = payload.nodeType; this._nodeName = payload.nodeName; this._localName = payload.localName; @@ -84,6 +85,24 @@ WebInspector.DOMNode = function(domAgent, doc, payload) { } } +/** + * @constructor + * @param {string} value + * @param {boolean} optimized + */ +WebInspector.DOMNode.XPathStep = function(value, optimized) +{ + this.value = value; + this.optimized = optimized; +} + +WebInspector.DOMNode.XPathStep.prototype = { + toString: function() + { + return this.value; + } +} + WebInspector.DOMNode.prototype = { /** * @return {boolean} @@ -280,6 +299,14 @@ WebInspector.DOMNode.prototype = { }, /** + * @param {boolean} optimized + */ + copyXPath: function(optimized) + { + InspectorFrontendHost.copyText(this.xPath(optimized)); + }, + + /** * @param {function(?Protocol.Error)=} callback */ eventListeners: function(callback) @@ -489,6 +516,121 @@ WebInspector.DOMNode.prototype = { isXMLNode: function() { return !!this.ownerDocument && !!this.ownerDocument.xmlVersion; + }, + + /** + * @param {boolean} optimized + * @return {string} + */ + xPath: function(optimized) + { + if (this._nodeType === Node.DOCUMENT_NODE) + return "/"; + + var steps = []; + var contextNode = this; + while (contextNode) { + var step = contextNode._xPathValue(optimized); + if (!step) + break; // Error - bail out early. + steps.push(step); + if (step.optimized) + break; + contextNode = contextNode.parentNode; + } + + steps.reverse(); + return (steps.length && steps[0].optimized ? "" : "/") + steps.join("/"); + }, + + /** + * @param {boolean} optimized + * @return {WebInspector.DOMNode.XPathStep} + */ + _xPathValue: function(optimized) + { + var ownValue; + var ownIndex = this._xPathIndex(); + if (ownIndex === -1) + return null; // Error. + + switch (this._nodeType) { + case Node.ELEMENT_NODE: + if (optimized && this.getAttribute("id")) + return new WebInspector.DOMNode.XPathStep("//*[@id=\"" + this.getAttribute("id") + "\"]", true); + ownValue = this._localName; + break; + case Node.ATTRIBUTE_NODE: + ownValue = "@" + this._nodeName; + break; + case Node.TEXT_NODE: + case Node.CDATA_SECTION_NODE: + ownValue = "text()"; + break; + case Node.PROCESSING_INSTRUCTION_NODE: + ownValue = "processing-instruction()"; + break; + case Node.COMMENT_NODE: + ownValue = "comment()"; + break; + case Node.DOCUMENT_NODE: + ownValue = ""; + break; + default: + ownValue = ""; + break; + } + + if (ownIndex > 0) + ownValue += "[" + ownIndex + "]"; + + return new WebInspector.DOMNode.XPathStep(ownValue, this._nodeType === Node.DOCUMENT_NODE); + }, + + /** + * @return {number} + */ + _xPathIndex: function() + { + // Returns -1 in case of error, 0 if no siblings matching the same expression, <XPath index among the same expression-matching sibling nodes> otherwise. + function areNodesSimilar(left, right) + { + if (left === right) + return true; + + if (left._nodeType === Node.ELEMENT_NODE && right._nodeType === Node.ELEMENT_NODE) + return left._localName === right._localName; + + if (left._nodeType === right._nodeType) + return true; + + // XPath treats CDATA as text nodes. + var leftType = left._nodeType === Node.CDATA_SECTION_NODE ? Node.TEXT_NODE : left._nodeType; + var rightType = right._nodeType === Node.CDATA_SECTION_NODE ? Node.TEXT_NODE : right._nodeType; + return leftType === rightType; + } + + var siblings = this.parentNode ? this.parentNode.children : null; + if (!siblings) + return 0; // Root node - no siblings. + var hasSameNamedElements; + for (var i = 0; i < siblings.length; ++i) { + if (areNodesSimilar(this, siblings[i]) && siblings[i] !== this) { + hasSameNamedElements = true; + break; + } + } + if (!hasSameNamedElements) + return 0; + var ownIndex = 1; // XPath indices start with 1. + for (var i = 0; i < siblings.length; ++i) { + if (areNodesSimilar(this, siblings[i])) { + if (siblings[i] === this) + return ownIndex; + ++ownIndex; + } + } + return -1; // An error occurred: |this| not found in parent's children. } } @@ -503,7 +645,6 @@ WebInspector.DOMDocument = function(domAgent, payload) WebInspector.DOMNode.call(this, domAgent, this, payload); this.documentURL = payload.documentURL || ""; this.xmlVersion = payload.xmlVersion; - domAgent._idToDOMNode[this.id] = this; this._listeners = {}; } @@ -521,6 +662,10 @@ WebInspector.DOMAgent = function() { InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this)); if (WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled()) new WebInspector.DOMModelResourceBinding(this); + + if (WebInspector.settings.emulateTouchEvents.get()) + this._emulateTouchEventsChanged(); + WebInspector.settings.emulateTouchEvents.addChangeListener(this._emulateTouchEventsChanged, this); } WebInspector.DOMAgent.Events = { @@ -731,11 +876,9 @@ WebInspector.DOMAgent.prototype = { _setDocument: function(payload) { this._idToDOMNode = {}; - if (payload && "nodeId" in payload) { + if (payload && "nodeId" in payload) this._document = new WebInspector.DOMDocument(this, payload); - if (this._document.children) - this._bindNodes(this._document.children); - } else + else this._document = null; this.dispatchEventToListeners(WebInspector.DOMAgent.Events.DocumentUpdated, this._document); }, @@ -745,8 +888,7 @@ WebInspector.DOMAgent.prototype = { */ _setDetachedRoot: function(payload) { - var root = new WebInspector.DOMNode(this, null, payload); - this._idToDOMNode[payload.nodeId] = root; + new WebInspector.DOMNode(this, null, payload); }, /** @@ -762,20 +904,6 @@ WebInspector.DOMAgent.prototype = { var parent = this._idToDOMNode[parentId]; parent._setChildrenPayload(payloads); - this._bindNodes(parent.children); - }, - - /** - * @param {Array.<WebInspector.DOMNode>} children - */ - _bindNodes: function(children) - { - for (var i = 0; i < children.length; ++i) { - var child = children[i]; - this._idToDOMNode[child.id] = child; - if (child.children) - this._bindNodes(child.children); - } }, /** @@ -812,8 +940,18 @@ WebInspector.DOMAgent.prototype = { var parent = this._idToDOMNode[parentId]; var node = this._idToDOMNode[nodeId]; parent._removeChild(node); + this._unbind(node); this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeRemoved, {node:node, parent:parent}); - delete this._idToDOMNode[nodeId]; + }, + + /** + * @param {DOMAgent.Node} node + */ + _unbind: function(node) + { + delete this._idToDOMNode[node.id]; + for (var i = 0; node.children && i < node.children.length; ++i) + this._unbind(node.children[i]); }, /** @@ -978,7 +1116,7 @@ WebInspector.DOMAgent.prototype = { function wrapperFunction(error) { if (callback) - callback(error); + callback.apply(this, arguments); if (error || !WebInspector.experimentsSettings.freeFlowDOMEditing.isEnabled()) return; if (this._captureDOMTimer) @@ -1016,6 +1154,11 @@ WebInspector.DOMAgent.prototype = { } DOMAgent.getOuterHTML(node.ownerDocument.id, callback); + }, + + _emulateTouchEventsChanged: function() + { + DOMAgent.setTouchEmulationEnabled(WebInspector.settings.emulateTouchEvents.get()); } } diff --git a/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js b/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js index 5bbcd90d5..66213163d 100644 --- a/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js +++ b/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js @@ -60,6 +60,30 @@ WebInspector.HeapSnapshotGridNode.prototype = { { }, + _toPercentString: function(num) + { + return num.toFixed(2) + "%"; + }, + + _createValueCell: function(columnIdentifier) + { + var cell = document.createElement("td"); + cell.className = columnIdentifier + "-column"; + var div = document.createElement("div"); + var valueSpan = document.createElement("span"); + valueSpan.textContent = this.data[columnIdentifier]; + var percentColumn = columnIdentifier + "-percent"; + if (percentColumn in this.data) { + var percentSpan = document.createElement("span"); + percentSpan.className = "percent-column"; + percentSpan.textContent = this.data[percentColumn]; + div.appendChild(percentSpan); + } + div.appendChild(valueSpan); + cell.appendChild(div); + return cell; + }, + _populate: function(event) { this.removeEventListener("populate", this._populate, this); @@ -195,7 +219,7 @@ WebInspector.HeapSnapshotGenericObjectNode = function(tree, node) WebInspector.HeapSnapshotGenericObjectNode.prototype = { createCell: function(columnIdentifier) { - var cell = columnIdentifier !== "object" ? WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier) : this._createObjectCell(); + var cell = columnIdentifier !== "object" ? this._createValueCell(columnIdentifier) : this._createObjectCell(); if (this._searchMatched) cell.addStyleClass("highlight"); return cell; @@ -215,6 +239,10 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { valueSpan.className = "value console-formatted-" + data.valueStyle; valueSpan.textContent = data.value; div.appendChild(valueSpan); + var idSpan = document.createElement("span"); + idSpan.className = "console-formatted-id"; + idSpan.textContent = " @" + data["nodeId"]; + div.appendChild(idSpan); if (this._postfixObjectCell) this._postfixObjectCell(div, data); cell.appendChild(div); @@ -245,7 +273,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { valueStyle = "string"; break; case "closure": - value = "function " + value + "()"; + value = "function" + (value ? " " : "") + value + "()"; valueStyle = "function"; break; case "number": @@ -258,23 +286,29 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { if (!value) value = "[]"; else - value += " []"; + value += "[]"; break; }; if (this.hasHoverMessage) valueStyle += " highlight"; + if (value === "Object") + value = ""; if (this.detachedDOMTreeNode) valueStyle += " detached-dom-tree-node"; - data["object"] = { valueStyle: valueStyle, value: value + ": @" + this.snapshotNodeId }; + data["object"] = { valueStyle: valueStyle, value: value, nodeId: this.snapshotNodeId }; var view = this.dataGrid.snapshotView; - data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize); - data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize); + data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize); + data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize); + if (view._showPercentage) { + data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent); + data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent); + } return this._enhanceData ? this._enhanceData(data) : data; }, - queryObjectContent: function(callback) + queryObjectContent: function(callback, objectGroupName) { if (this._type === "string") callback(WebInspector.RemoteObject.fromPrimitiveValue(this._name)); @@ -286,7 +320,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { else callback(WebInspector.RemoteObject.fromPrimitiveValue(WebInspector.UIString("Not available"))); } - ProfilerAgent.getObjectByHeapObjectId(this.snapshotNodeId, formatResult); + ProfilerAgent.getObjectByHeapObjectId(this.snapshotNodeId, objectGroupName, formatResult); } }, @@ -300,7 +334,7 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { return this._shallowSize / this.dataGrid.snapshot.totalSize * 100.0; }, - _updateHasChildren: function() + updateHasChildren: function() { function isEmptyCallback(isEmpty) { @@ -331,31 +365,49 @@ WebInspector.HeapSnapshotGenericObjectNode.prototype = { WebInspector.HeapSnapshotGenericObjectNode.prototype.__proto__ = WebInspector.HeapSnapshotGridNode.prototype; -WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge) +WebInspector.HeapSnapshotObjectNode = function(tree, isFromBaseSnapshot, edge, parentGridNode) { WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, edge.node); this._referenceName = edge.name; this._referenceType = edge.type; this._propertyAccessor = edge.propertyAccessor; - this._retainerNode = tree.showRetainingEdges; + this._distanceToWindow = edge.distanceToWindow; + this.showRetainingEdges = tree.showRetainingEdges; this._isFromBaseSnapshot = isFromBaseSnapshot; this._provider = this._createProvider(!isFromBaseSnapshot ? tree.snapshot : tree.baseSnapshot, edge.nodeIndex, tree); - this._updateHasChildren(); + this.updateHasChildren(parentGridNode); } WebInspector.HeapSnapshotObjectNode.prototype = { + updateHasChildren: function(parentGridNode) + { + if (this.showRetainingEdges) { + this._parentGridNode = parentGridNode; + var ancestor = parentGridNode; + while (ancestor) { + if (ancestor.snapshotNodeId === this.snapshotNodeId) { + this._cycledWithAncestorGridNode = ancestor; + return; + } + ancestor = ancestor._parentGridNode; + } + } + WebInspector.HeapSnapshotGenericObjectNode.prototype.updateHasChildren.call(this); + }, + _createChildNode: function(item) { - return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item); + return new WebInspector.HeapSnapshotObjectNode(this.dataGrid, this._isFromBaseSnapshot, item, this); }, _createProvider: function(snapshot, nodeIndex, tree) { var showHiddenData = WebInspector.settings.showHeapSnapshotObjectsHiddenProperties.get(); - var filter = "function(edge) {" + - " return !edge.isInvisible" + - " && (" + showHiddenData + " || (!edge.isHidden && !edge.node.isHidden));" + - "}"; + var filter = "function(edge) {\n" + + " return !edge.isInvisible\n" + + " && (" + !this.showRetainingEdges + " || (edge.node.id !== 1 && !edge.node.isSynthetic))\n" + + " && (" + showHiddenData + " || (!edge.isHidden && !edge.node.isHidden));\n" + + "}\n"; if (tree.showRetainingEdges) return snapshot.createRetainingEdgesProvider(nodeIndex, filter); else @@ -364,12 +416,14 @@ WebInspector.HeapSnapshotObjectNode.prototype = { _childHashForEntity: function(edge) { - return edge.type + "#" + edge.name; + var prefix = this.showRetainingEdges ? edge.node.id + "#" : ""; + return prefix + edge.type + "#" + edge.name; }, _childHashForNode: function(childNode) { - return childNode._referenceType + "#" + childNode._referenceName; + var prefix = this.showRetainingEdges ? childNode.snapshotNodeId + "#" : ""; + return prefix + childNode._referenceType + "#" + childNode._referenceName; }, comparator: function() @@ -380,14 +434,15 @@ WebInspector.HeapSnapshotObjectNode.prototype = { object: ["!edgeName", sortAscending, "retainedSize", false], count: ["!edgeName", true, "retainedSize", false], shallowSize: ["selfSize", sortAscending, "!edgeName", true], - retainedSize: ["retainedSize", sortAscending, "!edgeName", true] + retainedSize: ["retainedSize", sortAscending, "!edgeName", true], + distanceToWindow: ["distanceToWindow", sortAscending, "_name", true] }[sortColumnIdentifier] || ["!edgeName", true, "retainedSize", false]; return WebInspector.HeapSnapshotFilteredOrderedIterator.prototype.createComparator(sortFields); }, _emptyData: function() { - return {count:"", addedCount: "", removedCount: "", countDelta:"", addedSize: "", removedSize: "", sizeDelta: ""}; + return { count: "", addedCount: "", removedCount: "", countDelta: "", addedSize: "", removedSize: "", sizeDelta: "" }; }, _enhanceData: function(data) @@ -403,20 +458,20 @@ WebInspector.HeapSnapshotObjectNode.prototype = { case "hidden": nameClass = "console-formatted-null"; break; + case "element": + name = "[" + name + "]"; + break; } data["object"].nameClass = nameClass; data["object"].name = name; + data["distanceToWindow"] = this._distanceToWindow; return data; }, _prefixObjectCell: function(div, data) { - if (this._retainerNode) { - var prefixSpan = document.createElement("span"); - prefixSpan.textContent = WebInspector.UIString("retained by "); - div.appendChild(prefixSpan); - return; - } + if (this.showRetainingEdges && this._cycledWithAncestorGridNode) + div.className += " cycled-ancessor-node"; var nameSpan = document.createElement("span"); nameSpan.className = data.nameClass; @@ -424,19 +479,9 @@ WebInspector.HeapSnapshotObjectNode.prototype = { div.appendChild(nameSpan); var separatorSpan = document.createElement("span"); - separatorSpan.className = "separator"; - separatorSpan.textContent = ": "; + separatorSpan.className = "grayed"; + separatorSpan.textContent = this.showRetainingEdges ? " in " : " :: "; div.appendChild(separatorSpan); - }, - - _postfixObjectCell: function(div, data) - { - if (this._retainerNode) { - var referenceTypeSpan = document.createElement("span"); - referenceTypeSpan.className = "console-formatted-object"; - referenceTypeSpan.textContent = this._propertyAccessor; - div.appendChild(referenceTypeSpan); - } } } @@ -447,7 +492,7 @@ WebInspector.HeapSnapshotInstanceNode = function(tree, baseSnapshot, snapshot, n WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node); this._isDeletedNode = !!baseSnapshot; this._provider = this._createProvider(baseSnapshot || snapshot, node.nodeIndex); - this._updateHasChildren(); + this.updateHasChildren(); }; WebInspector.HeapSnapshotInstanceNode.prototype = { @@ -532,6 +577,14 @@ WebInspector.HeapSnapshotConstructorNode = function(tree, className, aggregate, } WebInspector.HeapSnapshotConstructorNode.prototype = { + createCell: function(columnIdentifier) + { + var cell = columnIdentifier !== "object" ? this._createValueCell(columnIdentifier) : WebInspector.HeapSnapshotGridNode.prototype.createCell.call(this, columnIdentifier); + if (this._searchMatched) + cell.addStyleClass("highlight"); + return cell; + }, + _createChildNode: function(item) { return new WebInspector.HeapSnapshotInstanceNode(this.dataGrid, null, this.dataGrid.snapshot, item); @@ -567,11 +620,15 @@ WebInspector.HeapSnapshotConstructorNode.prototype = { get data() { - var data = {object: this._name, count: this._count}; + var data = { object: this._name }; var view = this.dataGrid.snapshotView; - data["count"] = view.showCountAsPercent ? WebInspector.UIString("%.2f%%", this._countPercent) : this._count; - data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize); - data["retainedSize"] = view.showRetainedSizeAsPercent ? "~" + WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize) + "+"; + data["count"] = Number.withThousandsSeparator(this._count); + data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize); + data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize); + if (view._showPercentage) { + data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent); + data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent); + } return data; }, @@ -748,12 +805,12 @@ WebInspector.HeapSnapshotDiffNode.prototype = { { var data = {object: this._name}; - data["addedCount"] = this._addedCount; - data["removedCount"] = this._removedCount; - data["countDelta"] = WebInspector.UIString("%s%d", this._signForDelta(this._countDelta), Math.abs(this._countDelta)); + data["addedCount"] = Number.withThousandsSeparator(this._addedCount); + data["removedCount"] = Number.withThousandsSeparator(this._removedCount); + data["countDelta"] = this._signForDelta(this._countDelta) + Number.withThousandsSeparator(Math.abs(this._countDelta)); data["addedSize"] = Number.withThousandsSeparator(this._addedSize); data["removedSize"] = Number.withThousandsSeparator(this._removedSize); - data["sizeDelta"] = WebInspector.UIString("%s%s", this._signForDelta(this._sizeDelta), Number.withThousandsSeparator(Math.abs(this._sizeDelta))); + data["sizeDelta"] = this._signForDelta(this._sizeDelta) + Number.withThousandsSeparator(Math.abs(this._sizeDelta)); return data; } @@ -765,7 +822,7 @@ WebInspector.HeapSnapshotDominatorObjectNode = function(tree, node) { WebInspector.HeapSnapshotGenericObjectNode.call(this, tree, node); this._provider = this._createProvider(tree.snapshot, node.nodeIndex); - this._updateHasChildren(); + this.updateHasChildren(); }; WebInspector.HeapSnapshotDominatorObjectNode.prototype = { diff --git a/Source/WebCore/inspector/front-end/DetailedHeapshotView.js b/Source/WebCore/inspector/front-end/DetailedHeapshotView.js index fd8d1231d..7db87f962 100644 --- a/Source/WebCore/inspector/front-end/DetailedHeapshotView.js +++ b/Source/WebCore/inspector/front-end/DetailedHeapshotView.js @@ -112,12 +112,12 @@ WebInspector.HeapSnapshotSortableDataGrid.prototype = { WebInspector.HeapSnapshotSortableDataGrid.prototype.__proto__ = WebInspector.DataGrid.prototype; -WebInspector.HeapSnapshotContainmentDataGrid = function() +WebInspector.HeapSnapshotContainmentDataGrid = function(columns) { - var columns = { - object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true, sort: "ascending" }, - shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "90px", sortable: true }, - retainedSize: { title: WebInspector.UIString("Retained Size"), width: "90px", sortable: true } + columns = columns || { + object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true }, + shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true }, + retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true, sort: "descending" } }; WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); } @@ -183,10 +183,27 @@ WebInspector.HeapSnapshotContainmentDataGrid.prototype.__proto__ = WebInspector. WebInspector.HeapSnapshotRetainmentDataGrid = function() { this.showRetainingEdges = true; - WebInspector.HeapSnapshotContainmentDataGrid.call(this); + var columns = { + object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true }, + shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true }, + retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sortable: true }, + distanceToWindow: { title: WebInspector.UIString("Distance"), width: "80px", sortable: true, sort: "ascending" } + }; + WebInspector.HeapSnapshotContainmentDataGrid.call(this, columns); } WebInspector.HeapSnapshotRetainmentDataGrid.prototype = { + _sortFields: function(sortColumn, sortAscending) + { + return { + object: ["_name", sortAscending, "_count", false], + count: ["_count", sortAscending, "_name", true], + shallowSize: ["_shallowSize", sortAscending, "_name", true], + retainedSize: ["_retainedSize", sortAscending, "_name", true], + distanceToWindow: ["_distanceToWindow", sortAscending, "_name", true] + }[sortColumn]; + }, + reset: function() { this.removeChildren(); @@ -200,9 +217,9 @@ WebInspector.HeapSnapshotConstructorsDataGrid = function() { var columns = { object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true }, - count: { title: WebInspector.UIString("#"), width: "45px", sortable: true }, - shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "90px", sortable: true }, - retainedSize: { title: WebInspector.UIString("Retained Size"), width: "90px", sort: "descending", sortable: true } + count: { title: WebInspector.UIString("Objects Count"), width: "90px", sortable: true }, + shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true }, + retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true } }; WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); this._filterProfileIndex = -1; @@ -238,17 +255,13 @@ WebInspector.HeapSnapshotConstructorsDataGrid.prototype = { this.sortingChanged(); } - if (this._filterProfileIndex === -1) { - this.snapshot.aggregates(false, "allObjects", null, aggregatesReceived.bind(this, "allObjects")); - return; - } - this.dispose(); this.removeChildren(); this.resetSortingCache(); - var key = this._minNodeId + ".." + this._maxNodeId; - var filter = "function(node) { var id = node.id; return id > " + this._minNodeId + " && id <= " + this._maxNodeId + "; }"; + var key = this._filterProfileIndex === -1 ? "allObjects" : this._minNodeId + ".." + this._maxNodeId; + var filter = this._filterProfileIndex === -1 ? null : "function(node) { var id = node.id; return id > " + this._minNodeId + " && id <= " + this._maxNodeId + "; }"; + this.snapshot.aggregates(false, key, filter, aggregatesReceived.bind(this, key)); }, @@ -291,13 +304,12 @@ WebInspector.HeapSnapshotDiffDataGrid = function() { var columns = { object: { title: WebInspector.UIString("Constructor"), disclosure: true, sortable: true }, - addedCount: { title: WebInspector.UIString("# New"), width: "72px", sortable: true, sort: "descending" }, + addedCount: { title: WebInspector.UIString("# New"), width: "72px", sortable: true }, removedCount: { title: WebInspector.UIString("# Deleted"), width: "72px", sortable: true }, - // \u0394 is a Greek delta letter. - countDelta: { title: "\u0394", width: "40px", sortable: true }, - addedSize: { title: WebInspector.UIString("Alloc. Size"), width: "72px", sortable: true }, + countDelta: { title: "# Delta", width: "64px", sortable: true }, + addedSize: { title: WebInspector.UIString("Alloc. Size"), width: "72px", sortable: true, sort: "descending" }, removedSize: { title: WebInspector.UIString("Freed Size"), width: "72px", sortable: true }, - sizeDelta: { title: "\u0394", width: "72px", sortable: true } + sizeDelta: { title: "Size Delta", width: "72px", sortable: true } }; WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); } @@ -381,8 +393,8 @@ WebInspector.HeapSnapshotDominatorsDataGrid = function() { var columns = { object: { title: WebInspector.UIString("Object"), disclosure: true, sortable: true }, - shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "90px", sortable: true }, - retainedSize: { title: WebInspector.UIString("Retained Size"), width: "90px", sort: "descending", sortable: true } + shallowSize: { title: WebInspector.UIString("Shallow Size"), width: "120px", sortable: true }, + retainedSize: { title: WebInspector.UIString("Retained Size"), width: "120px", sort: "descending", sortable: true } }; WebInspector.HeapSnapshotSortableDataGrid.call(this, columns); } @@ -418,9 +430,7 @@ WebInspector.DetailedHeapshotView = function(parent, profile) this.parent.addEventListener("profile added", this._updateBaseOptions, this); this.parent.addEventListener("profile added", this._updateFilterOptions, this); - this.showCountAsPercent = false; - this.showShallowSizeAsPercent = false; - this.showRetainedSizeAsPercent = false; + this._showPercentage = false; this.viewsContainer = document.createElement("div"); this.viewsContainer.addStyleClass("views-container"); @@ -509,7 +519,7 @@ WebInspector.DetailedHeapshotView = function(parent, profile) this.helpButton = new WebInspector.StatusBarButton("", "heapshot-help-status-bar-item status-bar-item"); this.helpButton.addEventListener("click", this._helpClicked.bind(this), false); - this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._showObjectPopover.bind(this), null, true); + this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.element, this._getHoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), null, true); this._loadProfile(this._profileUid, profileCallback.bind(this)); @@ -602,7 +612,7 @@ WebInspector.DetailedHeapshotView.prototype = { this._updateRetainmentViewHeight(height); }, - refreshShowAsPercents: function() + refreshShowPercents: function() { this._updatePercentButton(); this.refreshVisibleData(); @@ -833,13 +843,7 @@ WebInspector.DetailedHeapshotView.prototype = { if (!cell || (!cell.hasStyleClass("count-column") && !cell.hasStyleClass("shallowSize-column") && !cell.hasStyleClass("retainedSize-column"))) return; - if (cell.hasStyleClass("count-column")) - this.showCountAsPercent = !this.showCountAsPercent; - else if (cell.hasStyleClass("shallowSize-column")) - this.showShallowSizeAsPercent = !this.showShallowSizeAsPercent; - else if (cell.hasStyleClass("retainedSize-column")) - this.showRetainedSizeAsPercent = !this.showRetainedSizeAsPercent; - this.refreshShowAsPercents(); + this.refreshShowPercents(); event.preventDefault(); event.stopPropagation(); @@ -942,23 +946,15 @@ WebInspector.DetailedHeapshotView.prototype = { return span; }, - get _isShowingAsPercent() - { - return this.showCountAsPercent && this.showShallowSizeAsPercent && this.showRetainedSizeAsPercent; - }, - _percentClicked: function(event) { - var currentState = this._isShowingAsPercent; - this.showCountAsPercent = !currentState; - this.showShallowSizeAsPercent = !currentState; - this.showRetainedSizeAsPercent = !currentState; - this.refreshShowAsPercents(); + this._showPercentage = !this._showPercentage; + this.refreshShowPercents(); }, - _showObjectPopover: function(element, showCallback) + _resolveObjectForPopover: function(element, showCallback, objectGroupName) { - element.node.queryObjectContent(showCallback); + element.node.queryObjectContent(showCallback, objectGroupName); }, _helpClicked: function(event) @@ -1103,11 +1099,11 @@ WebInspector.DetailedHeapshotView.prototype = { _updatePercentButton: function() { - if (this._isShowingAsPercent) { - this.percentButton.title = WebInspector.UIString("Show absolute counts and sizes."); + if (this._showPercentage) { + this.percentButton.title = WebInspector.UIString("Hide percentages of counts and sizes."); this.percentButton.toggled = true; } else { - this.percentButton.title = WebInspector.UIString("Show counts and sizes as percentages."); + this.percentButton.title = WebInspector.UIString("Show percentages of counts and sizes."); this.percentButton.toggled = false; } } diff --git a/Source/WebCore/inspector/front-end/ElementsPanel.js b/Source/WebCore/inspector/front-end/ElementsPanel.js index 5256bd104..3585e32ae 100644 --- a/Source/WebCore/inspector/front-end/ElementsPanel.js +++ b/Source/WebCore/inspector/front-end/ElementsPanel.js @@ -167,6 +167,16 @@ WebInspector.ElementsPanel.prototype = { this.updateBreadcrumb(false); + this._updateSidebars(); + + if (selectedNode) { + ConsoleAgent.addInspectedNode(selectedNode.id); + this._lastValidSelectedNode = selectedNode; + } + }, + + _updateSidebars: function() + { for (var pane in this.sidebarPanes) this.sidebarPanes[pane].needsUpdate = true; @@ -174,11 +184,6 @@ WebInspector.ElementsPanel.prototype = { this.updateMetrics(); this.updateProperties(); this.updateEventListeners(); - - if (selectedNode) { - ConsoleAgent.addInspectedNode(selectedNode.id); - this._lastValidSelectedNode = selectedNode; - } }, _reset: function() @@ -899,6 +904,7 @@ WebInspector.ElementsPanel.prototype = { ]; section.addRelatedKeys(keys, WebInspector.UIString("Expand/collapse")); section.addKey(shortcut.shortcutToString(shortcut.Keys.Enter), WebInspector.UIString("Edit attribute")); + section.addKey(shortcut.shortcutToString(shortcut.Keys.F2), WebInspector.UIString("Toggle edit as HTML")); this.sidebarPanes.styles.registerShortcuts(); }, @@ -907,7 +913,7 @@ WebInspector.ElementsPanel.prototype = { { // Cmd/Control + Shift + C should be a shortcut to clicking the Node Search Button. // This shortcut matches Firebug. - if (event.keyIdentifier === "U+0043") { // C key + if (event.keyIdentifier === "U+0043") { // C key if (WebInspector.isMac()) var isNodeSearchKey = event.metaKey && !event.ctrlKey && !event.altKey && event.shiftKey; else @@ -918,7 +924,15 @@ WebInspector.ElementsPanel.prototype = { event.handled = true; return; } + return; } + + if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.keyIdentifier === "U+005A") { // Z key + DOMAgent.undo(this._updateSidebars.bind(this)); + return; + } + + this.treeOutline.handleShortcut(event); }, handleCopyEvent: function(event) diff --git a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js index 96b864ef3..7fc53b669 100644 --- a/Source/WebCore/inspector/front-end/ElementsTreeOutline.js +++ b/Source/WebCore/inspector/front-end/ElementsTreeOutline.js @@ -329,7 +329,7 @@ WebInspector.ElementsTreeOutline.prototype = { event.dataTransfer.setData("text/plain", treeElement.listItemElement.textContent); event.dataTransfer.effectAllowed = "copyMove"; - this._nodeBeingDragged = treeElement.representedObject; + this._treeElementBeingDragged = treeElement; WebInspector.domAgent.hideDOMNodeHighlight(); @@ -338,7 +338,7 @@ WebInspector.ElementsTreeOutline.prototype = { _ondragover: function(event) { - if (!this._nodeBeingDragged) + if (!this._treeElementBeingDragged) return false; var treeElement = this._treeElementFromEvent(event); @@ -347,7 +347,7 @@ WebInspector.ElementsTreeOutline.prototype = { var node = treeElement.representedObject; while (node) { - if (node === this._nodeBeingDragged) + if (node === this._treeElementBeingDragged.representedObject) return false; node = node.parentNode; } @@ -386,40 +386,38 @@ WebInspector.ElementsTreeOutline.prototype = { { event.preventDefault(); var treeElement = this._treeElementFromEvent(event); - if (this._nodeBeingDragged && treeElement) { - var parentNode; - var anchorNode; + if (treeElement) + this._doMove(treeElement); + }, - if (treeElement._elementCloseTag) { - // Drop onto closing tag -> insert as last child. - parentNode = treeElement.representedObject; - } else { - var dragTargetNode = treeElement.representedObject; - parentNode = dragTargetNode.parentNode; - anchorNode = dragTargetNode; - } + _doMove: function(treeElement) + { + if (!this._treeElementBeingDragged) + return; - function callback(error, newNodeId) - { - if (error) - return; + var parentNode; + var anchorNode; - this._updateModifiedNodes(); - var newNode = WebInspector.domAgent.nodeForId(newNodeId); - if (newNode) - this.selectDOMNode(newNode, true); - } - this._nodeBeingDragged.moveTo(parentNode, anchorNode, callback.bind(this)); + if (treeElement._elementCloseTag) { + // Drop onto closing tag -> insert as last child. + parentNode = treeElement.representedObject; + } else { + var dragTargetNode = treeElement.representedObject; + parentNode = dragTargetNode.parentNode; + anchorNode = dragTargetNode; } - delete this._nodeBeingDragged; + var wasExpanded = this._treeElementBeingDragged.expanded; + this._treeElementBeingDragged.representedObject.moveTo(parentNode, anchorNode, this._selectNodeAfterEdit.bind(this, null, wasExpanded)); + + delete this._treeElementBeingDragged; }, _ondragend: function(event) { event.preventDefault(); this._clearDragOverTreeElementMarker(); - delete this._nodeBeingDragged; + delete this._treeElementBeingDragged; }, _clearDragOverTreeElementMarker: function() @@ -493,6 +491,65 @@ WebInspector.ElementsTreeOutline.prototype = { { if (this._contextMenuCallback) this._contextMenuCallback(contextMenu, node); + }, + + handleShortcut: function(event) + { + var node = this.selectedDOMNode(); + var treeElement = this.getCachedTreeElement(node); + if (!node || !treeElement) + return; + + if (event.keyIdentifier === "F2") { + this._toggleEditAsHTML(node); + return; + } + + if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && node.parentNode) { + if (event.keyIdentifier === "Up" && node.previousSibling) { + node.moveTo(node.parentNode, node.previousSibling, this._selectNodeAfterEdit.bind(this, null, treeElement.expanded)); + return; + } + if (event.keyIdentifier === "Down" && node.nextSibling) { + node.moveTo(node.parentNode, node.nextSibling.nextSibling, this._selectNodeAfterEdit.bind(this, null, treeElement.expanded)); + return; + } + } + + }, + + _toggleEditAsHTML: function(node) + { + var treeElement = this.getCachedTreeElement(node); + if (!treeElement) + return; + + if (treeElement._editing && treeElement._htmlEditElement && WebInspector.isBeingEdited(treeElement._htmlEditElement)) + treeElement._editing.commit(); + else + treeElement._editAsHTML(); + }, + + _selectNodeAfterEdit: function(fallbackNode, wasExpanded, error, nodeId) + { + if (error) + return; + + // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date. + this._updateModifiedNodes(); + + var newNode = WebInspector.domAgent.nodeForId(nodeId) || fallbackNode; + if (!newNode) + return; + + this.selectDOMNode(newNode, true); + + var newTreeItem = this.findTreeElement(newNode); + if (wasExpanded) { + if (newTreeItem) + newTreeItem.expand(); + } + return newTreeItem; } } @@ -1079,6 +1136,7 @@ WebInspector.ElementsTreeElement.prototype = { // Add free-form node-related actions. contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), this._editAsHTML.bind(this)); contextMenu.appendItem(WebInspector.UIString("Copy as HTML"), this._copyHTML.bind(this)); + contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXPath.bind(this)); contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMenuTitles() ? "Delete node" : "Delete Node"), this.remove.bind(this)); }, @@ -1254,7 +1312,7 @@ WebInspector.ElementsTreeElement.prototype = { function commit() { - commitCallback(this._htmlEditElement.textContent); + commitCallback(initialValue, this._htmlEditElement.textContent); dispose.call(this); } @@ -1390,17 +1448,7 @@ WebInspector.ElementsTreeElement.prototype = { cancel(); return; } - - var node = WebInspector.domAgent.nodeForId(nodeId); - - // Select it and expand if necessary. We force tree update so that it processes dom events and is up to date. - treeOutline._updateModifiedNodes(); - treeOutline.selectDOMNode(node, true); - - var newTreeItem = treeOutline.findTreeElement(node); - if (wasExpanded) - newTreeItem.expand(); - + var newTreeItem = treeOutline._selectNodeAfterEdit(null, wasExpanded, error, nodeId); moveToNextAttributeIfNeeded.call(newTreeItem); } @@ -1676,6 +1724,8 @@ WebInspector.ElementsTreeElement.prototype = { parentElement.adjustCollapsedRange(); } + if (!this.representedObject.parentNode || this.representedObject.parentNode.nodeType() === Node.DOCUMENT_NODE) + return; this.representedObject.removeNode(removeNodeCallback); }, @@ -1708,9 +1758,12 @@ WebInspector.ElementsTreeElement.prototype = { } } - function commitChange(value) + function commitChange(initialValue, value) { - node.setOuterHTML(value, selectNode); + if (initialValue !== value) + node.setOuterHTML(value, selectNode); + else + return; } node.getOuterHTML(this._startEditingAsHTML.bind(this, commitChange)); @@ -1721,6 +1774,11 @@ WebInspector.ElementsTreeElement.prototype = { this.representedObject.copyNode(); }, + _copyXPath: function() + { + this.representedObject.copyXPath(true); + }, + _highlightSearchResults: function() { if (!this._searchQuery || !this._searchHighlightsVisible) diff --git a/Source/WebCore/inspector/front-end/HeapSnapshot.js b/Source/WebCore/inspector/front-end/HeapSnapshot.js index 1a33ee3ec..084ad0e28 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshot.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshot.js @@ -436,17 +436,32 @@ WebInspector.HeapSnapshotRetainerEdge.prototype = { { if (newIndex !== this._retainerIndex) { this._retainerIndex = newIndex; - this._setupEdge(); + this.edgeIndex = newIndex; } }, - _setupEdge: function() + set edgeIndex(edgeIndex) { - var globalEdgeIndex = this._retainers.item(this._retainerIndex); - this._nodeIndex = this._snapshot._findNearestNodeIndex(globalEdgeIndex); - this._node = new WebInspector.HeapSnapshotNode(this._snapshot, this._nodeIndex); - var edgeIndex = globalEdgeIndex - this._nodeIndex - this._snapshot._firstEdgeOffset; - this._edge = new WebInspector.HeapSnapshotEdge(this._snapshot, this._node.rawEdges, edgeIndex); + this._globalEdgeIndex = this._retainers.item(edgeIndex); + this._nodeIndex = this._snapshot._findNearestNodeIndex(this._globalEdgeIndex); + delete this._edgeInstance; + delete this._nodeInstance; + }, + + get _node() + { + if (!this._nodeInstance) + this._nodeInstance = new WebInspector.HeapSnapshotNode(this._snapshot, this._nodeIndex); + return this._nodeInstance; + }, + + get _edge() + { + if (!this._edgeInstance) { + var edgeIndex = this._globalEdgeIndex - this._nodeIndex - this._snapshot._firstEdgeOffset; + this._edgeInstance = new WebInspector.HeapSnapshotEdge(this._snapshot, this._node.rawEdges, edgeIndex); + } + return this._edgeInstance; }, toString: function() @@ -511,6 +526,11 @@ WebInspector.HeapSnapshotNode.prototype = { return !!(flags & this._snapshot._nodeFlags.canBeQueried); }, + get distanceToWindow() + { + return this._snapshot._distancesToWindow[this.nodeIndex]; + }, + get className() { switch (this.type) { @@ -566,14 +586,19 @@ WebInspector.HeapSnapshotNode.prototype = { return this._type() === this._snapshot._nodeHiddenType; }, + get isSynthetic() + { + return this._type() === this._snapshot._nodeSyntheticType; + }, + get isDOMWindow() { return this.name.substr(0, 9) === "DOMWindow"; }, - get isNativeRoot() + get isDetachedDOMTreesRoot() { - return this.name === "(Native objects)"; + return this.name === "(Detached DOM trees)"; }, get isDetachedDOMTree() @@ -706,6 +731,7 @@ WebInspector.HeapSnapshot.prototype = { this._firstEdgeOffset = meta.fields.indexOf("children"); this._nodeTypes = meta.types[this._nodeTypeOffset]; this._nodeHiddenType = this._nodeTypes.indexOf("hidden"); + this._nodeSyntheticType = this._nodeTypes.indexOf("synthetic"); var edgesMeta = meta.types[this._firstEdgeOffset]; this._edgeFieldsCount = edgesMeta.fields.length; this._edgeTypeOffset = edgesMeta.fields.indexOf("type"); @@ -725,6 +751,7 @@ WebInspector.HeapSnapshot.prototype = { detachedDOMTreeNode: 2, }; + this._distancesToWindow = []; this._markInvisibleEdges(); }, @@ -911,32 +938,103 @@ WebInspector.HeapSnapshot.prototype = { dataCallback(indexCallback(retIndex), node.nodeIndex + this._firstEdgeOffset + edge.edgeIndex); } }).bind(this)); + this._calculateObjectToWindowDistance(); + }, + + _calculateObjectToWindowDistance: function() + { + this._distancesToWindow = new Array(this.nodeCount); + + // bfs for DOMWindow roots + var list = []; + for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) { + if (iter.edge.node.isDOMWindow) { + list.push(iter.edge.node); + this._distancesToWindow[iter.edge.node.nodeIndex] = 0; + } + } + this._bfs(list); + + // bfs for root + list = []; + list.push(this.rootNode); + this._distancesToWindow[this.rootNode.nodeIndex] = 0; + this._bfs(list); + }, + + _bfs: function(list) + { + var index = 0; + while (index < list.length) { + var node = list[index++]; // shift generates too much garbage. + if (index > 100000) { + list = list.slice(index); + index = 0; + } + var distance = this._distancesToWindow[node.nodeIndex] + 1; + for (var iter = node.edges; iter.hasNext(); iter.next()) { + var edge = iter.edge; + var childNode = edge.node; + if (typeof this._distancesToWindow[childNode.nodeIndex] !== "undefined") + continue; + this._distancesToWindow[childNode.nodeIndex] = distance; + list.push(childNode); + } + } }, _buildAggregates: function(filter) { - var aggregates = {}; - for (var iter = this._allNodes; iter.hasNext(); iter.next()) { - var node = iter.node; + function shouldSkip(node) + { if (filter && !filter(node)) - continue; + return true; if (node.type !== "native" && node.selfSize === 0) - continue; + return true; var className = node.className; if (className === "Document DOM tree") - continue; + return true; if (className === "Detached DOM tree") + return true; + return false; + } + + var aggregates = {}; + for (var iter = this._allNodes; iter.hasNext(); iter.next()) { + var node = iter.node; + if (shouldSkip(node)) continue; + var className = node.className; var nameMatters = node.type === "object" || node.type === "native"; if (!aggregates.hasOwnProperty(className)) aggregates[className] = { count: 0, self: 0, maxRet: 0, type: node.type, name: nameMatters ? node.name : null, idxs: [] }; var clss = aggregates[className]; ++clss.count; clss.self += node.selfSize; - if (node.retainedSize > clss.maxRet) - clss.maxRet = node.retainedSize; clss.idxs.push(node.nodeIndex); } + + // Recursively visit dominators tree and sum up retained sizes + // of topmost objects in each class. + // This gives us retained sizes for classes. + var seenClasses = {}; + var snapshot = this; + function forDominatedNodes(nodeIndex) + { + var node = new WebInspector.HeapSnapshotNode(snapshot, nodeIndex); + var className = node.className; + var seen = !!seenClasses[className]; + if (!seen && className in aggregates && !shouldSkip(node)) { + aggregates[className].maxRet += node.retainedSize; + seenClasses[className] = true; + } + var dominatedNodes = snapshot._dominatedNodesOfNode(node); + for (var i = 0; i < dominatedNodes.length; i++) + forDominatedNodes(dominatedNodes.item(i)); + seenClasses[className] = seen; + } + forDominatedNodes(this._rootNodeIndex); + // Shave off provisionally allocated space. for (var className in aggregates) aggregates[className].idxs = aggregates[className].idxs.slice(0); @@ -1053,19 +1151,19 @@ WebInspector.HeapSnapshot.prototype = { _markDetachedDOMTreeNodes: function() { var flag = this._nodeFlags.detachedDOMTreeNode; - var nativeRoot; + var detachedDOMTreesRoot; for (var iter = this.rootNode.edges; iter.hasNext(); iter.next()) { var node = iter.edge.node; - if (node.isNativeRoot) { - nativeRoot = node; + if (node.isDetachedDOMTreesRoot) { + detachedDOMTreesRoot = node; break; } } - if (!nativeRoot) + if (!detachedDOMTreesRoot) return; - for (var iter = nativeRoot.edges; iter.hasNext(); iter.next()) { + for (var iter = detachedDOMTreesRoot.edges; iter.hasNext(); iter.next()) { var node = iter.edge.node; if (node.isDetachedDOMTree) { for (var edgesIter = node.edges; edgesIter.hasNext(); edgesIter.next()) @@ -1095,14 +1193,14 @@ WebInspector.HeapSnapshot.prototype = { for (var iter = node.edges; iter.hasNext(); iter.next()) { var edge = iter.edge; var node = edge.node; - if (this._flags[node.nodeIndex]) + if (this._flags[node.nodeIndex] & flag) continue; if (edge.isHidden || edge.isInvisible) continue; var name = edge.name; if (!name) continue; - if (edge.isInternal && name !== "native") + if (edge.isInternal) continue; list.push(node); } @@ -1318,7 +1416,14 @@ WebInspector.HeapSnapshotEdgesProvider = function(snapshot, nodeIndex, filter, i WebInspector.HeapSnapshotEdgesProvider.prototype = { _serialize: function(edge) { - return {name: edge.name, propertyAccessor: edge.toString(), node: WebInspector.HeapSnapshotNodesProvider.prototype._serialize(edge.node), nodeIndex: edge.nodeIndex, type: edge.type}; + return { + name: edge.name, + propertyAccessor: edge.toString(), + node: WebInspector.HeapSnapshotNodesProvider.prototype._serialize(edge.node), + nodeIndex: edge.nodeIndex, + type: edge.type, + distanceToWindow: edge.node.distanceToWindow + }; }, sort: function(comparator, leftBound, rightBound, count) @@ -1333,7 +1438,7 @@ WebInspector.HeapSnapshotEdgesProvider.prototype = { var nodeA = new WebInspector.HeapSnapshotNode(this.snapshot); var nodeB = new WebInspector.HeapSnapshotNode(this.snapshot); - function sortByEdgeFieldName(ascending, indexA, indexB) + function compareEdgeFieldName(ascending, indexA, indexB) { edgeA.edgeIndex = indexA; edgeB.edgeIndex = indexB; @@ -1346,45 +1451,47 @@ WebInspector.HeapSnapshotEdgesProvider.prototype = { return ascending ? result : -result; } - function sortByNodeField(fieldName, ascending, indexA, indexB) + function compareNodeField(fieldName, ascending, indexA, indexB) { edgeA.edgeIndex = indexA; - edgeB.edgeIndex = indexB; nodeA.nodeIndex = edgeA.nodeIndex; - nodeB.nodeIndex = edgeB.nodeIndex; var valueA = nodeA[fieldName]; + + edgeB.edgeIndex = indexB; + nodeB.nodeIndex = edgeB.nodeIndex; var valueB = nodeB[fieldName]; + var result = valueA < valueB ? -1 : (valueA > valueB ? 1 : 0); return ascending ? result : -result; } - function sortByEdgeAndNode(indexA, indexB) { - var result = sortByEdgeFieldName(ascending1, indexA, indexB); + function compareEdgeAndNode(indexA, indexB) { + var result = compareEdgeFieldName(ascending1, indexA, indexB); if (result === 0) - result = sortByNodeField(fieldName2, ascending2, indexA, indexB); + result = compareNodeField(fieldName2, ascending2, indexA, indexB); return result; } - function sortByNodeAndEdge(indexA, indexB) { - var result = sortByNodeField(fieldName1, ascending1, indexA, indexB); + function compareNodeAndEdge(indexA, indexB) { + var result = compareNodeField(fieldName1, ascending1, indexA, indexB); if (result === 0) - result = sortByEdgeFieldName(ascending2, indexA, indexB); + result = compareEdgeFieldName(ascending2, indexA, indexB); return result; } - function sortByNodeAndNode(indexA, indexB) { - var result = sortByNodeField(fieldName1, ascending1, indexA, indexB); + function compareNodeAndNode(indexA, indexB) { + var result = compareNodeField(fieldName1, ascending1, indexA, indexB); if (result === 0) - result = sortByNodeField(fieldName2, ascending2, indexA, indexB); + result = compareNodeField(fieldName2, ascending2, indexA, indexB); return result; } if (fieldName1 === "!edgeName") - this._iterationOrder.sortRange(sortByEdgeAndNode, leftBound, rightBound, count); + this._iterationOrder.sortRange(compareEdgeAndNode, leftBound, rightBound, count); else if (fieldName2 === "!edgeName") - this._iterationOrder.sortRange(sortByNodeAndEdge, leftBound, rightBound, count); + this._iterationOrder.sortRange(compareNodeAndEdge, leftBound, rightBound, count); else - this._iterationOrder.sortRange(sortByNodeAndNode, leftBound, rightBound, count); + this._iterationOrder.sortRange(compareNodeAndNode, leftBound, rightBound, count); } }; @@ -1399,7 +1506,15 @@ WebInspector.HeapSnapshotNodesProvider = function(snapshot, filter, nodeIndexes) WebInspector.HeapSnapshotNodesProvider.prototype = { _serialize: function(node) { - return {id: node.id, name: node.name, nodeIndex: node.nodeIndex, retainedSize: node.retainedSize, selfSize: node.selfSize, type: node.type, flags: node.flags}; + return { + id: node.id, + name: node.name, + nodeIndex: node.nodeIndex, + retainedSize: node.retainedSize, + selfSize: node.selfSize, + type: node.type, + flags: node.flags + }; }, sort: function(comparator, leftBound, rightBound, count) diff --git a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js index f2723ae03..32d7afff1 100644 --- a/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js +++ b/Source/WebCore/inspector/front-end/JavaScriptSourceFrame.js @@ -40,13 +40,12 @@ WebInspector.JavaScriptSourceFrame = function(scriptsPanel, model, uiSourceCode) this._scriptsPanel = scriptsPanel; this._model = model; this._uiSourceCode = uiSourceCode; - this._popoverObjectGroup = "popover"; this._breakpoints = {}; WebInspector.SourceFrame.call(this, uiSourceCode.url); this._popoverHelper = new WebInspector.ObjectPopoverHelper(this.textViewer.element, - this._getPopoverAnchor.bind(this), this._onShowPopover.bind(this), this._onHidePopover.bind(this), true); + this._getPopoverAnchor.bind(this), this._resolveObjectForPopover.bind(this), this._onHidePopover.bind(this), true); this.textViewer.element.addEventListener("mousedown", this._onMouseDown.bind(this), true); this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.ContentChanged, this._onContentChanged, this); @@ -279,7 +278,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { return element; }, - _onShowPopover: function(element, showCallback) + _resolveObjectForPopover: function(element, showCallback, objectGroupName) { if (!this.readOnly) { this._popoverHelper.hidePopover(); @@ -300,7 +299,7 @@ WebInspector.JavaScriptSourceFrame.prototype = { } var selectedCallFrame = this._model.selectedCallFrame; - selectedCallFrame.evaluate(this._highlightElement.textContent, this._popoverObjectGroup, false, false, showObjectPopover.bind(this)); + selectedCallFrame.evaluate(this._highlightElement.textContent, objectGroupName, false, false, showObjectPopover.bind(this)); }, _onHidePopover: function() @@ -322,7 +321,6 @@ WebInspector.JavaScriptSourceFrame.prototype = { parentElement.removeChild(highlightElement); } delete this._highlightElement; - RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup); }, _highlightExpression: function(element) diff --git a/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js b/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js index cad81e49f..3a560dbf0 100644 --- a/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js +++ b/Source/WebCore/inspector/front-end/ObjectPopoverHelper.js @@ -37,6 +37,7 @@ WebInspector.ObjectPopoverHelper = function(panelElement, getAnchor, queryObject WebInspector.PopoverHelper.call(this, panelElement, getAnchor, this._showObjectPopover.bind(this), this._onHideObjectPopover.bind(this), disableOnClick); this._queryObject = queryObject; this._onHideCallback = onHide; + this._popoverObjectGroup = "popover"; panelElement.addEventListener("scroll", this.hidePopover.bind(this), true); }; @@ -110,7 +111,7 @@ WebInspector.ObjectPopoverHelper.prototype = { popover.show(popoverContentElement, element, popoverWidth, popoverHeight); } } - this._queryObject(element, showObjectPopover.bind(this)); + this._queryObject(element, showObjectPopover.bind(this), this._popoverObjectGroup); }, _onHideObjectPopover: function() @@ -121,6 +122,7 @@ WebInspector.ObjectPopoverHelper.prototype = { } if (this._onHideCallback) this._onHideCallback(); + RuntimeAgent.releaseObjectGroup(this._popoverObjectGroup); }, _updateHTMLId: function(properties, rootTreeElementConstructor, rootPropertyComparer) diff --git a/Source/WebCore/inspector/front-end/ScriptsPanel.js b/Source/WebCore/inspector/front-end/ScriptsPanel.js index 5578643c7..43325c00b 100644 --- a/Source/WebCore/inspector/front-end/ScriptsPanel.js +++ b/Source/WebCore/inspector/front-end/ScriptsPanel.js @@ -404,7 +404,7 @@ WebInspector.ScriptsPanel.prototype = { this._debuggerResumed(); - delete this._curentUISourceCode; + delete this._currentUISourceCode; this._editorContainer.reset(); this._updateScriptViewStatusBarItems(); @@ -475,9 +475,9 @@ WebInspector.ScriptsPanel.prototype = { return null; var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); - if (this._curentUISourceCode === uiSourceCode) + if (this._currentUISourceCode === uiSourceCode) return sourceFrame; - this._curentUISourceCode = uiSourceCode; + this._currentUISourceCode = uiSourceCode; this._fileSelector.revealUISourceCode(uiSourceCode); this._editorContainer.showFile(uiSourceCode); @@ -629,6 +629,9 @@ WebInspector.ScriptsPanel.prototype = { { var uiSourceCode = /** @type {WebInspector.UISourceCode} */ event.data; + if (this._currentUISourceCode === uiSourceCode) + delete this._currentUISourceCode; + // We don't need to update file selector here regardless of whether useScriptsNavigator is set or not: // SingleFileEditorContainer never dispatches EditorClosed, so no need to update ComboBoxFileSelector; // ScriptsNavigator does not need to update on EditorClosed. diff --git a/Source/WebCore/inspector/front-end/Settings.js b/Source/WebCore/inspector/front-end/Settings.js index 23f0cfaa8..68bc38b3a 100644 --- a/Source/WebCore/inspector/front-end/Settings.js +++ b/Source/WebCore/inspector/front-end/Settings.js @@ -88,6 +88,7 @@ WebInspector.Settings = function() this.userAgent = this.createSetting("userAgent", ""); this.showScriptFolders = this.createSetting("showScriptFolders", true); this.dockToRight = this.createSetting("dockToRight", false); + this.emulateTouchEvents = this.createSetting("emulateTouchEvents", false); // If there are too many breakpoints in a storage, it is likely due to a recent bug that caused // periodical breakpoints duplication leading to inspector slowness. diff --git a/Source/WebCore/inspector/front-end/SettingsScreen.js b/Source/WebCore/inspector/front-end/SettingsScreen.js index 7b706a0a0..8d8eac08a 100644 --- a/Source/WebCore/inspector/front-end/SettingsScreen.js +++ b/Source/WebCore/inspector/front-end/SettingsScreen.js @@ -38,13 +38,17 @@ WebInspector.SettingsScreen = function() this._leftColumnElement = document.createElement("td"); this._rightColumnElement = document.createElement("td"); - - if (Preferences.showDockToRight) { - var p = this._appendSection(WebInspector.UIString("General")); - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight)); + var p; + + if (Preferences.showDockToRight || Preferences.exposeDisableCache) { + p = this._appendSection(WebInspector.UIString("General")); + if (Preferences.showDockToRight) + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Dock to right"), WebInspector.settings.dockToRight)); + if (Preferences.exposeDisableCache) + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); } - var p = this._appendSection(WebInspector.UIString("Elements")); + p = this._appendSection(WebInspector.UIString("Elements")); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Word wrap"), WebInspector.settings.domWordWrap)); p = this._appendSection(WebInspector.UIString("Styles")); @@ -63,10 +67,9 @@ WebInspector.SettingsScreen = function() [ WebInspector.UIString("Tab character"), WebInspector.TextEditorModel.Indent.TabCharacter ] ], WebInspector.settings.textEditorIndent)); - p = this._appendSection(WebInspector.UIString("Network"), true); - if (Preferences.exposeDisableCache) - p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache"), WebInspector.settings.cacheDisabled)); + p = this._appendSection(WebInspector.UIString("User Agent"), true); p.appendChild(this._createUserActionControl()); + p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Emulate touch events"), WebInspector.settings.emulateTouchEvents)); p = this._appendSection(WebInspector.UIString("Scripts"), true); p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Show script folders"), WebInspector.settings.showScriptFolders)); @@ -309,6 +312,8 @@ WebInspector.SettingsScreen.prototype = { ["BlackBerry \u2014 PlayBook 2.0", "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.0.0; en-US) AppleWebKit/535.8+ (KHTML, like Gecko) Version/7.2.0.0 Safari/535.8+"], ["BlackBerry \u2014 9900", "Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en-US) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.0.0.187 Mobile Safari/534.11+"], + ["MeeGo \u2014 Nokia N9", "Mozilla/5.0 (MeeGo; NokiaN9) AppleWebKit/534.13 (KHTML, like Gecko) NokiaBrowser/8.5.0 Mobile Safari/534.13"], + [WebInspector.UIString("Other..."), "Other"] ]; diff --git a/Source/WebCore/inspector/front-end/StylesSidebarPane.js b/Source/WebCore/inspector/front-end/StylesSidebarPane.js index 080570c17..4791b547b 100644 --- a/Source/WebCore/inspector/front-end/StylesSidebarPane.js +++ b/Source/WebCore/inspector/front-end/StylesSidebarPane.js @@ -81,6 +81,7 @@ WebInspector.StylesSidebarPane = function(computedStylePane) this.titleElement.appendChild(addButton); this._computedStylePane = computedStylePane; + computedStylePane._stylesSidebarPane = this; this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); WebInspector.settings.colorFormat.addChangeListener(this._colorFormatSettingChanged.bind(this)); @@ -231,6 +232,14 @@ WebInspector.StylesSidebarPane.prototype = { function stylesCallback(matchedResult) { + delete this._innerUpdateInProgress; + + if (this._lastNodeForInnerUpdate) { + delete this._lastNodeForInnerUpdate; + this._innerUpdate(false, null, callback); + return; + } + if (matchedResult && this.node === node) { resultStyles.matchedCSSRules = matchedResult.matchedCSSRules; resultStyles.pseudoElements = matchedResult.pseudoElements; @@ -241,10 +250,10 @@ WebInspector.StylesSidebarPane.prototype = { callback(); } - function inlineCallback(inlineStyle, styleAttributes) + function inlineCallback(inlineStyle, attributesStyle) { resultStyles.inlineStyle = inlineStyle; - resultStyles.styleAttributes = styleAttributes; + resultStyles.attributesStyle = attributesStyle; } function computedCallback(computedStyle) @@ -252,17 +261,28 @@ WebInspector.StylesSidebarPane.prototype = { resultStyles.computedStyle = computedStyle; } - WebInspector.cssModel.getComputedStyleAsync(node.id, this._forcedPseudoClasses, computedCallback.bind(this)); + if (this._computedStylePane.expanded) + WebInspector.cssModel.getComputedStyleAsync(node.id, this._forcedPseudoClasses, computedCallback.bind(this)); WebInspector.cssModel.getInlineStylesAsync(node.id, inlineCallback.bind(this)); WebInspector.cssModel.getMatchedStylesAsync(node.id, this._forcedPseudoClasses, true, true, stylesCallback.bind(this)); }, + _refreshComputedStyleSection: function(callback) + { + this._innerUpdate(true, null, callback); + }, + /** * @param {WebInspector.StylePropertiesSection=} editedSection * @param {function()=} userCallback */ _innerUpdate: function(refresh, editedSection, userCallback) { + if (this._innerUpdateInProgress) { + this._lastNodeForInnerUpdate = this.node; + return; + } + var node = this.node; if (!node) { this._sectionsContainer.removeChildren(); @@ -275,12 +295,23 @@ WebInspector.StylesSidebarPane.prototype = { function computedStyleCallback(computedStyle) { + delete this._innerUpdateInProgress; + + if (this._lastNodeForInnerUpdate) { + delete this._lastNodeForInnerUpdate; + this._innerUpdate(refresh, editedSection, userCallback); + return; + } + if (this.node === node && computedStyle) this._refreshUpdate(node, computedStyle, editedSection); + if (userCallback) userCallback(); } + this._innerUpdateInProgress = true; + if (refresh) WebInspector.cssModel.getComputedStyleAsync(node.id, this._forcedPseudoClasses, computedStyleCallback.bind(this)); else @@ -333,9 +364,8 @@ WebInspector.StylesSidebarPane.prototype = { for (var pseudoId in this.sections) { var styleRules = this._refreshStyleRules(this.sections[pseudoId], computedStyle); var usedProperties = {}; - var disabledComputedProperties = {}; - this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); - this._refreshSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, editedSection); + this._markUsedProperties(styleRules, usedProperties); + this._refreshSectionsForStyleRules(styleRules, usedProperties, editedSection); } // Trace the computed style. this.sections[0][0].rebuildComputedTrace(this.sections[0]); @@ -350,9 +380,8 @@ WebInspector.StylesSidebarPane.prototype = { var styleRules = this._rebuildStyleRules(node, styles); var usedProperties = {}; - var disabledComputedProperties = {}; - this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); - this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, 0, null); + this._markUsedProperties(styleRules, usedProperties); + this.sections[0] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, 0, null); var anchorElement = this.sections[0].inheritedPropertiesSeparatorElement; // Trace the computed style. this.sections[0][0].rebuildComputedTrace(this.sections[0]); @@ -372,9 +401,8 @@ WebInspector.StylesSidebarPane.prototype = { styleRules.push({ style: rule.style, selectorText: rule.selectorText, media: rule.media, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) }); } usedProperties = {}; - disabledComputedProperties = {}; - this._markUsedProperties(styleRules, usedProperties, disabledComputedProperties); - this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, disabledComputedProperties, pseudoId, anchorElement); + this._markUsedProperties(styleRules, usedProperties); + this.sections[pseudoId] = this._rebuildSectionsForStyleRules(styleRules, usedProperties, pseudoId, anchorElement); } this._nodeStylesUpdatedForTest(node, false); @@ -408,16 +436,13 @@ WebInspector.StylesSidebarPane.prototype = { var styleRules = []; - function addStyleAttributes() + function addAttributesStyle() { - for (var name in styles.styleAttributes) { - var attrStyle = { style: styles.styleAttributes[name], editable: false }; - attrStyle.selectorText = node.nodeNameInCorrectCase() + "[" + name; - if (node.getAttribute(name)) - attrStyle.selectorText += "=" + node.getAttribute(name); - attrStyle.selectorText += "]"; - styleRules.push(attrStyle); - } + if (!styles.attributesStyle) + return; + var attrStyle = { style: styles.attributesStyle, editable: false }; + attrStyle.selectorText = node.nodeNameInCorrectCase() + "[" + WebInspector.UIString("Attributes Style") + "]"; + styleRules.push(attrStyle); } styleRules.push({ computedStyle: true, selectorText: "", style: nodeComputedStyle, editable: false }); @@ -431,21 +456,21 @@ WebInspector.StylesSidebarPane.prototype = { // Add rules in reverse order to match the cascade order. if (styles.matchedCSSRules.length) styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") }); - var addedStyleAttributes; + var addedAttributesStyle; for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) { var rule = styles.matchedCSSRules[i]; if (!WebInspector.settings.showUserAgentStyles.get() && (rule.isUser || rule.isUserAgent)) continue; - if ((rule.isUser || rule.isUserAgent) && !addedStyleAttributes) { + if ((rule.isUser || rule.isUserAgent) && !addedAttributesStyle) { // Show element's Style Attributes after all author rules. - addedStyleAttributes = true; - addStyleAttributes(); + addedAttributesStyle = true; + addAttributesStyle(); } styleRules.push({ style: rule.style, selectorText: rule.selectorText, media: rule.media, sourceURL: rule.sourceURL, rule: rule, editable: !!(rule.style && rule.style.id) }); } - if (!addedStyleAttributes) - addStyleAttributes(); + if (!addedAttributesStyle) + addAttributesStyle(); // Walk the node structure and identify styles with inherited properties. var parentNode = node.parentNode; @@ -490,7 +515,7 @@ WebInspector.StylesSidebarPane.prototype = { return styleRules; }, - _markUsedProperties: function(styleRules, usedProperties, disabledComputedProperties) + _markUsedProperties: function(styleRules, usedProperties) { var priorityUsed = false; @@ -557,14 +582,13 @@ WebInspector.StylesSidebarPane.prototype = { } }, - _refreshSectionsForStyleRules: function(styleRules, usedProperties, disabledComputedProperties, editedSection) + _refreshSectionsForStyleRules: function(styleRules, usedProperties, editedSection) { // Walk the style rules and update the sections with new overloaded and used properties. for (var i = 0; i < styleRules.length; ++i) { var styleRule = styleRules[i]; var section = styleRule.section; if (styleRule.computedStyle) { - section._disabledComputedProperties = disabledComputedProperties; section._usedProperties = usedProperties; section.update(); } else { @@ -574,7 +598,7 @@ WebInspector.StylesSidebarPane.prototype = { } }, - _rebuildSectionsForStyleRules: function(styleRules, usedProperties, disabledComputedProperties, pseudoId, anchorElement) + _rebuildSectionsForStyleRules: function(styleRules, usedProperties, pseudoId, anchorElement) { // Make a property section for each style rule. var sections = []; @@ -610,7 +634,7 @@ WebInspector.StylesSidebarPane.prototype = { editable = true; if (computedStyle) - var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties, disabledComputedProperties); + var section = new WebInspector.ComputedStylePropertiesSection(styleRule, usedProperties); else var section = new WebInspector.StylePropertiesSection(this, styleRule, editable, styleRule.isInherited, lastWasSeparator); section.pane = this; @@ -844,6 +868,20 @@ WebInspector.ComputedStyleSidebarPane = function() showInheritedCheckbox.addEventListener(showInheritedToggleFunction.bind(this)); } +WebInspector.ComputedStyleSidebarPane.prototype = { + + // Overriding expand() rather than onexpand() to eliminate the visual slowness due to a possible backend trip. + expand: function() + { + function callback() + { + WebInspector.SidebarPane.prototype.expand.call(this); + } + + this._stylesSidebarPane._refreshComputedStyleSection(callback.bind(this)); + } +} + WebInspector.ComputedStyleSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; /** @@ -1053,9 +1091,6 @@ WebInspector.StylePropertiesSection.prototype = { for (var i = 0; i < this.uniqueProperties.length; ++i) { var property = this.uniqueProperties[i]; var disabled = property.disabled; - if (!disabled && this.disabledComputedProperties && !(property.name in this.usedProperties) && property.name in this.disabledComputedProperties) - disabled = true; - var shorthand = !disabled ? property.shorthand : null; if (shorthand && shorthand in handledProperties) @@ -1075,7 +1110,7 @@ WebInspector.StylePropertiesSection.prototype = { var inherited = this.isPropertyInherited(property.name); var overloaded = this.isPropertyOverloaded(property.name, isShorthand); - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); + var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, isShorthand, inherited, overloaded); this.propertiesTreeOutline.appendChild(item); handledProperties[property.name] = property; } @@ -1099,7 +1134,7 @@ WebInspector.StylePropertiesSection.prototype = { { var style = this.styleRule.style; var property = style.newBlankProperty(); - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this.styleRule, style, property, false, false, false); + var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this.styleRule, style, property, false, false, false); this.propertiesTreeOutline.appendChild(item); item.listItemElement.textContent = ""; item._newProperty = true; @@ -1251,14 +1286,13 @@ WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.Propertie * @constructor * @extends {WebInspector.PropertiesSection} */ -WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties, disabledComputedProperties) +WebInspector.ComputedStylePropertiesSection = function(styleRule, usedProperties) { WebInspector.PropertiesSection.call(this, ""); this.headerElement.addStyleClass("hidden"); this.element.className = "styles-section monospace first-styles-section read-only computed-style"; this.styleRule = styleRule; this._usedProperties = usedProperties; - this._disabledComputedProperties = disabledComputedProperties; this._alwaysShowComputedProperties = { "display": true, "height": true, "width": true }; this.computedStyle = true; this._propertyTreeElements = {}; @@ -1273,7 +1307,7 @@ WebInspector.ComputedStylePropertiesSection.prototype = { _isPropertyInherited: function(propertyName) { - return !(propertyName in this._usedProperties) && !(propertyName in this._alwaysShowComputedProperties) && !(propertyName in this._disabledComputedProperties); + return !(propertyName in this._usedProperties) && !(propertyName in this._alwaysShowComputedProperties); }, update: function() @@ -1296,6 +1330,9 @@ WebInspector.ComputedStylePropertiesSection.prototype = { } var style = this.styleRule.style; + if (!style) + return; + var uniqueProperties = []; var allProperties = style.allProperties; for (var i = 0; i < allProperties.length; ++i) @@ -1306,7 +1343,7 @@ WebInspector.ComputedStylePropertiesSection.prototype = { for (var i = 0; i < uniqueProperties.length; ++i) { var property = uniqueProperties[i]; var inherited = this._isPropertyInherited(property.name); - var item = new WebInspector.StylePropertyTreeElement(null, this.styleRule, style, property, false, inherited, false); + var item = new WebInspector.StylePropertyTreeElement(this, null, this.styleRule, style, property, false, inherited, false); this.propertiesTreeOutline.appendChild(item); this._propertyTreeElements[property.name] = item; } @@ -1432,8 +1469,9 @@ WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.Styl * @extends {TreeElement} * @param {?WebInspector.StylesSidebarPane} parentPane */ -WebInspector.StylePropertyTreeElement = function(parentPane, styleRule, style, property, shorthand, inherited, overloaded) +WebInspector.StylePropertyTreeElement = function(section, parentPane, styleRule, style, property, shorthand, inherited, overloaded) { + this.section = section; this._parentPane = parentPane; this._styleRule = styleRule; this.style = style; @@ -1827,7 +1865,7 @@ WebInspector.StylePropertyTreeElement.prototype = { } var liveProperty = this.style.getLiveProperty(name); - var item = new WebInspector.StylePropertyTreeElement(this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded); + var item = new WebInspector.StylePropertyTreeElement(this, this._parentPane, this._styleRule, this.style, liveProperty, false, inherited, overloaded); this.appendChild(item); } }, diff --git a/Source/WebCore/inspector/front-end/TabbedEditorContainer.js b/Source/WebCore/inspector/front-end/TabbedEditorContainer.js index 14ed4582b..e5caa2cfd 100644 --- a/Source/WebCore/inspector/front-end/TabbedEditorContainer.js +++ b/Source/WebCore/inspector/front-end/TabbedEditorContainer.js @@ -206,6 +206,7 @@ WebInspector.TabbedEditorContainer.prototype = { var uiSourceCode = this._files[tabId]; this._tabIds.remove(uiSourceCode); delete this._files[tabId]; + delete this._currentFile; this.dispatchEventToListeners(WebInspector.EditorContainer.Events.EditorClosed, uiSourceCode); diff --git a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js index fe68aa28b..8718f19e0 100644 --- a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -524,12 +524,17 @@ WebInspector.HeapGraph = function() { this._canvas = document.createElement("canvas"); this._maxHeapSizeLabel = document.createElement("div"); + this._maxHeapSizeLabel.addStyleClass("max"); this._maxHeapSizeLabel.addStyleClass("memory-graph-label"); + this._minHeapSizeLabel = document.createElement("div"); + this._minHeapSizeLabel.addStyleClass("min"); + this._minHeapSizeLabel.addStyleClass("memory-graph-label"); this._element = document.createElement("div"); this._element.addStyleClass("hidden"); this._element.appendChild(this._canvas); this._element.appendChild(this._maxHeapSizeLabel); + this._element.appendChild(this._minHeapSizeLabel); } WebInspector.HeapGraph.prototype = { @@ -560,30 +565,33 @@ WebInspector.HeapGraph.prototype = { if (!records.length) return; - var maxTotalHeapSize = 0; + const lowerOffset = 3; + var maxUsedHeapSize = 0; + var minUsedHeapSize = 100000000000; var minTime; var maxTime; this._forAllRecords(records, function(r) { - if (r.totalHeapSize && r.totalHeapSize > maxTotalHeapSize) - maxTotalHeapSize = r.totalHeapSize; + maxUsedHeapSize = Math.max(maxUsedHeapSize, r.usedHeapSize || maxUsedHeapSize); + minUsedHeapSize = Math.min(minUsedHeapSize, r.usedHeapSize || minUsedHeapSize); if (typeof minTime === "undefined" || r.startTime < minTime) minTime = r.startTime; if (typeof maxTime === "undefined" || r.endTime > maxTime) maxTime = r.endTime; }); + minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); var width = this._canvas.width; - var height = this._canvas.height; + var height = this._canvas.height - lowerOffset; var xFactor = width / (maxTime - minTime); - var yFactor = height / maxTotalHeapSize; + var yFactor = height / (maxUsedHeapSize - minUsedHeapSize); var histogram = new Array(width); this._forAllRecords(records, function(r) { if (!r.usedHeapSize) return; var x = Math.round((r.endTime - minTime) * xFactor); - var y = Math.round(r.usedHeapSize * yFactor); + var y = Math.round((r.usedHeapSize - minUsedHeapSize) * yFactor); histogram[x] = Math.max(histogram[x] || 0, y); }); @@ -620,7 +628,8 @@ WebInspector.HeapGraph.prototype = { ctx.fill(); ctx.closePath(); - this._maxHeapSizeLabel.textContent = Number.bytesToString(maxTotalHeapSize); + this._maxHeapSizeLabel.textContent = Number.bytesToString(maxUsedHeapSize); + this._minHeapSizeLabel.textContent = Number.bytesToString(minUsedHeapSize); }, _clear: function(ctx) { diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index e62535d8d..0e268634e 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -268,7 +268,7 @@ WebInspector.EditingConfig.prototype = { WebInspector.startEditing = function(element, config) { if (!WebInspector.markBeingEdited(element, true)) - return; + return null; config = config || new WebInspector.EditingConfig(function() {}, function() {}); var committedCallback = config.commitHandler; diff --git a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js index ec965bca2..e6d3db341 100644 --- a/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js +++ b/Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js @@ -277,19 +277,23 @@ WebInspector.WatchExpressionsSection.prototype = { _updateHoveredElement: function(pageY) { - if (this._hoveredElement) - this._hoveredElement.removeStyleClass("hovered"); - - this._hoveredElement = this.propertiesElement.firstChild; + var candidateElement = this.propertiesElement.firstChild; while (true) { - var next = this._hoveredElement.nextSibling; - while(next && !next.clientHeight) + var next = candidateElement.nextSibling; + while (next && !next.clientHeight) next = next.nextSibling; if (!next || next.totalOffsetTop() > pageY) break; - this._hoveredElement = next; + candidateElement = next; + } + + if (this._hoveredElement !== candidateElement) { + if (this._hoveredElement) + this._hoveredElement.removeStyleClass("hovered"); + if (candidateElement) + candidateElement.addStyleClass("hovered"); + this._hoveredElement = candidateElement; } - this._hoveredElement.addStyleClass("hovered"); this._lastMouseMovePageY = pageY; } diff --git a/Source/WebCore/inspector/front-end/heapProfiler.css b/Source/WebCore/inspector/front-end/heapProfiler.css index 10e2022ed..7f20296c1 100644 --- a/Source/WebCore/inspector/front-end/heapProfiler.css +++ b/Source/WebCore/inspector/front-end/heapProfiler.css @@ -115,6 +115,16 @@ body.inactive .heap-snapshot-sidebar-tree-item.wait.selected .icon { text-align: right; } +.detailed-heapshot-view .data-grid td.distanceToWindow-column { + text-align: right; +} + +.detailed-heapshot-view .data-grid span.percent-column { + color: grey; + width: 42px; + float: left; +} + .detailed-heapshot-view .console-formatted-object, .console-formatted-node { display: inline; position: static; @@ -128,6 +138,10 @@ body.inactive .heap-snapshot-sidebar-tree-item.wait.selected .icon { white-space: nowrap; } +.detailed-heapshot-view .console-formatted-id { + color: grey; +} + .detailed-heapshot-view .data-grid tr.selected * { color: inherit; } @@ -202,6 +216,10 @@ body.inactive .heap-snapshot-sidebar-tree-item.wait.selected .icon { background-color: rgb(255, 255, 200); } +.detailed-heapshot-view td.object-column span.grayed { + color: gray; +} + .heapshot-help-status-bar-item .glyph { -webkit-mask-position: -160px 0; } @@ -214,3 +232,8 @@ div.retaining-paths-view td.path-column div:hover { text-decoration: underline; color: blue; } + +.cycled-ancessor-node { + opacity: 0.6; +} + diff --git a/Source/WebCore/inspector/front-end/timelinePanel.css b/Source/WebCore/inspector/front-end/timelinePanel.css index f81afef3f..3dc8c115f 100644 --- a/Source/WebCore/inspector/front-end/timelinePanel.css +++ b/Source/WebCore/inspector/front-end/timelinePanel.css @@ -496,13 +496,20 @@ .memory-graph-label { position: absolute; - top: 5px; left: 5px; font-size: 9px; color: rgb(50%, 50%, 50%); white-space: nowrap; } +.max.memory-graph-label { + top: 5px; +} + +.min.memory-graph-label { + bottom: 5px; +} + #timeline-memory-splitter { position: absolute; z-index: 5; diff --git a/Source/WebCore/inspector/front-end/treeoutline.js b/Source/WebCore/inspector/front-end/treeoutline.js index 015ffb318..ce36fe82c 100644 --- a/Source/WebCore/inspector/front-end/treeoutline.js +++ b/Source/WebCore/inspector/front-end/treeoutline.js @@ -237,7 +237,7 @@ TreeOutline.prototype._forgetChildrenRecursive = function(parentElement) var child = parentElement.children[0]; while (child) { this._forgetTreeElement(child); - child = child.traverseNextTreeElement(false, this, true); + child = child.traverseNextTreeElement(false, parentElement, true); } } diff --git a/Source/WebCore/inspector/front-end/utilities.js b/Source/WebCore/inspector/front-end/utilities.js index e2c4366bb..ebe2ec7b1 100644 --- a/Source/WebCore/inspector/front-end/utilities.js +++ b/Source/WebCore/inspector/front-end/utilities.js @@ -256,14 +256,7 @@ DocumentFragment.prototype.createChild = Element.prototype.createChild; */ Element.prototype.totalOffsetLeft = function() { - var total = 0; - for (var element = this; element; element = element.offsetParent) { - total += element.offsetLeft - if (this !== element) - total += element.clientLeft - element.scrollLeft; - } - - return total; + return this.totalOffset().left; } /** @@ -271,14 +264,36 @@ Element.prototype.totalOffsetLeft = function() */ Element.prototype.totalOffsetTop = function() { - var total = 0; + return this.totalOffset().top; + +} + +Element.prototype.totalOffset = function() +{ + var totalLeft = 0; + var totalTop = 0; + for (var element = this; element; element = element.offsetParent) { - total += element.offsetTop - if (this !== element) - total += element.clientTop - element.scrollTop; + totalLeft += element.offsetLeft; + totalTop += element.offsetTop; + if (this !== element) { + totalLeft += element.clientLeft - element.scrollLeft; + totalTop += element.clientTop - element.scrollTop; + } } - - return total; + + return { left: totalLeft, top: totalTop }; +} + +Element.prototype.scrollOffset = function() +{ + var curLeft = 0; + var curTop = 0; + for (var element = this; element; element = element.scrollParent) { + curLeft += element.scrollLeft; + curTop += element.scrollTop; + } + return { left: curLeft, top: curTop }; } /** @@ -901,6 +916,11 @@ function isEnterKey(event) { return event.keyCode !== 229 && event.keyIdentifier === "Enter"; } +function stopPropagation(e) +{ + e.stopPropagation(); +} + /** * @param {Element} element * @param {number} offset diff --git a/Source/WebCore/loader/FormSubmission.cpp b/Source/WebCore/loader/FormSubmission.cpp index b121f9867..0cab71057 100644 --- a/Source/WebCore/loader/FormSubmission.cpp +++ b/Source/WebCore/loader/FormSubmission.cpp @@ -142,8 +142,11 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A ASSERT(form); HTMLFormControlElement* submitButton = 0; - if (event && event->target() && event->target()->toNode()) - submitButton = static_cast<HTMLFormControlElement*>(event->target()->toNode()); + if (event && event->target()) { + Node* node = event->target()->toNode(); + if (node && node->isElementNode() && toElement(node)->isFormControlElement()) + submitButton = static_cast<HTMLFormControlElement*>(node); + } FormSubmission::Attributes copiedAttributes; copiedAttributes.copyFrom(attributes); diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp index 9d636f5f7..cd228d4ba 100644 --- a/Source/WebCore/loader/FrameLoader.cpp +++ b/Source/WebCore/loader/FrameLoader.cpp @@ -750,6 +750,8 @@ void FrameLoader::checkCompleted() void FrameLoader::checkTimerFired(Timer<FrameLoader>*) { + RefPtr<Frame> protect(m_frame); + if (Page* page = m_frame->page()) { if (page->defersLoading()) return; diff --git a/Source/WebCore/loader/MainResourceLoader.cpp b/Source/WebCore/loader/MainResourceLoader.cpp index 050c8a276..6809c7f16 100644 --- a/Source/WebCore/loader/MainResourceLoader.cpp +++ b/Source/WebCore/loader/MainResourceLoader.cpp @@ -469,7 +469,7 @@ void MainResourceLoader::didFinishLoading(double finishTime) // There is a bug in CFNetwork where callbacks can be dispatched even when loads are deferred. // See <rdar://problem/6304600> for more details. #if !USE(CF) - ASSERT(shouldLoadAsEmptyDocument(frameLoader()->activeDocumentLoader()->url()) || !defersLoading()); + ASSERT(shouldLoadAsEmptyDocument(frameLoader()->activeDocumentLoader()->url()) || !defersLoading() || InspectorInstrumentation::isDebuggerPaused(m_frame.get())); #endif // The additional processing can do anything including possibly removing the last diff --git a/Source/WebCore/loader/PingLoader.cpp b/Source/WebCore/loader/PingLoader.cpp index e8da4aa52..7328f5b4f 100644 --- a/Source/WebCore/loader/PingLoader.cpp +++ b/Source/WebCore/loader/PingLoader.cpp @@ -56,7 +56,7 @@ void PingLoader::loadImage(Frame* frame, const KURL& url) } ResourceRequest request(url); -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) request.setTargetType(ResourceRequest::TargetIsImage); #endif request.setHTTPHeaderField("Cache-Control", "max-age=0"); @@ -75,7 +75,7 @@ void PingLoader::loadImage(Frame* frame, const KURL& url) void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destinationURL) { ResourceRequest request(pingURL); -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) request.setTargetType(ResourceRequest::TargetIsSubresource); #endif request.setHTTPMethod("POST"); @@ -106,7 +106,7 @@ void PingLoader::sendPing(Frame* frame, const KURL& pingURL, const KURL& destina void PingLoader::reportContentSecurityPolicyViolation(Frame* frame, const KURL& reportURL, PassRefPtr<FormData> report) { ResourceRequest request(reportURL); -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) request.setTargetType(ResourceRequest::TargetIsSubresource); #endif request.setHTTPMethod("POST"); diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp index af0d074cd..3d7f5c5e8 100644 --- a/Source/WebCore/loader/SubframeLoader.cpp +++ b/Source/WebCore/loader/SubframeLoader.cpp @@ -191,7 +191,7 @@ PassRefPtr<Widget> SubframeLoader::loadMediaPlayerProxyPlugin(Node* node, const } #endif // ENABLE(PLUGIN_PROXY_FOR_VIDEO) -PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const IntSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) +PassRefPtr<Widget> SubframeLoader::createJavaAppletWidget(const LayoutSize& size, HTMLAppletElement* element, const HashMap<String, String>& args) { String baseURLString; String codeBaseURLString; @@ -244,6 +244,8 @@ Frame* SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement* ownerElemen Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL& url, const String& name, const String& referrer) { + RefPtr<Frame> protect(m_frame); + bool allowsScrolling = true; int marginWidth = -1; int marginHeight = -1; diff --git a/Source/WebCore/loader/SubframeLoader.h b/Source/WebCore/loader/SubframeLoader.h index 01c59e627..312675505 100644 --- a/Source/WebCore/loader/SubframeLoader.h +++ b/Source/WebCore/loader/SubframeLoader.h @@ -32,6 +32,7 @@ #define SubframeLoader_h #include "FrameLoaderTypes.h" +#include "LayoutTypes.h" #include "PlatformString.h" #include <wtf/Forward.h> #include <wtf/HashMap.h> @@ -71,7 +72,7 @@ public: PassRefPtr<Widget> loadMediaPlayerProxyPlugin(Node*, const KURL&, const Vector<String>& paramNames, const Vector<String>& paramValues); #endif - PassRefPtr<Widget> createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const HashMap<String, String>& args); + PassRefPtr<Widget> createJavaAppletWidget(const LayoutSize&, HTMLAppletElement*, const HashMap<String, String>& args); bool allowPlugins(ReasonForCallingAllowPlugins); diff --git a/Source/WebCore/loader/appcache/DOMApplicationCache.idl b/Source/WebCore/loader/appcache/DOMApplicationCache.idl index 93798886c..a35fa47bb 100644 --- a/Source/WebCore/loader/appcache/DOMApplicationCache.idl +++ b/Source/WebCore/loader/appcache/DOMApplicationCache.idl @@ -28,8 +28,8 @@ module offline { interface [ EventTarget, OmitConstructor, - DontCheckEnums, - GenerateIsReachable=ImplFrame + DoNotCheckConstants, + JSGenerateIsReachable=ImplFrame ] DOMApplicationCache { // update status const unsigned short UNCACHED = 0; diff --git a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp index 55e3efcf2..9be88d24a 100644 --- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp +++ b/Source/WebCore/loader/archive/cf/LegacyWebArchive.cpp @@ -428,7 +428,7 @@ RetainPtr<CFDataRef> LegacyWebArchive::createPropertyListRepresentation(const Re #endif -PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node) +PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node, FrameFilter* filter) { ASSERT(node); if (!node) @@ -445,7 +445,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node) if (nodeType != Node::DOCUMENT_NODE && nodeType != Node::DOCUMENT_TYPE_NODE) markupString = frame->documentTypeString() + markupString; - return create(markupString, frame, nodeList); + return create(markupString, frame, nodeList, filter); } PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Frame* frame) @@ -494,10 +494,10 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Range* range) // FIXME: This is always "for interchange". Is that right? See the previous method. String markupString = frame->documentTypeString() + createMarkup(range, &nodeList, AnnotateForInterchange); - return create(markupString, frame, nodeList); + return create(markupString, frame, nodeList, 0); } -PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString, Frame* frame, const Vector<Node*>& nodes) +PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString, Frame* frame, const Vector<Node*>& nodes, FrameFilter* frameFilter) { ASSERT(frame); @@ -521,7 +521,10 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(const String& markupString Frame* childFrame; if ((node->hasTagName(HTMLNames::frameTag) || node->hasTagName(HTMLNames::iframeTag) || node->hasTagName(HTMLNames::objectTag)) && (childFrame = static_cast<HTMLFrameOwnerElement*>(node)->contentFrame())) { - RefPtr<LegacyWebArchive> subframeArchive = create(childFrame->document()); + if (frameFilter && !frameFilter->shouldIncludeSubframe(childFrame)) + continue; + + RefPtr<LegacyWebArchive> subframeArchive = create(childFrame->document(), frameFilter); if (subframeArchive) subframeArchives.append(subframeArchive); @@ -584,7 +587,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::createFromSelection(Frame* frame) Vector<Node*> nodeList; String markupString = frame->documentTypeString() + createMarkup(selectionRange.get(), &nodeList, AnnotateForInterchange); - RefPtr<LegacyWebArchive> archive = create(markupString, frame, nodeList); + RefPtr<LegacyWebArchive> archive = create(markupString, frame, nodeList, 0); if (!frame->document() || !frame->document()->isFrameSet()) return archive.release(); diff --git a/Source/WebCore/loader/archive/cf/LegacyWebArchive.h b/Source/WebCore/loader/archive/cf/LegacyWebArchive.h index ee19ea686..ce1b71255 100644 --- a/Source/WebCore/loader/archive/cf/LegacyWebArchive.h +++ b/Source/WebCore/loader/archive/cf/LegacyWebArchive.h @@ -37,13 +37,19 @@ class Frame; class Node; class Range; +class FrameFilter { +public: + virtual ~FrameFilter() { } + virtual bool shouldIncludeSubframe(Frame*) const = 0; +}; + class LegacyWebArchive : public Archive { public: static PassRefPtr<LegacyWebArchive> create(); static PassRefPtr<LegacyWebArchive> create(SharedBuffer*); static PassRefPtr<LegacyWebArchive> create(const KURL&, SharedBuffer*); static PassRefPtr<LegacyWebArchive> create(PassRefPtr<ArchiveResource> mainResource, Vector<PassRefPtr<ArchiveResource> >& subresources, Vector<PassRefPtr<LegacyWebArchive> >& subframeArchives); - static PassRefPtr<LegacyWebArchive> create(Node*); + static PassRefPtr<LegacyWebArchive> create(Node*, FrameFilter* = 0); static PassRefPtr<LegacyWebArchive> create(Frame*); static PassRefPtr<LegacyWebArchive> createFromSelection(Frame*); static PassRefPtr<LegacyWebArchive> create(Range*); @@ -57,7 +63,7 @@ private: enum MainResourceStatus { Subresource, MainResource }; - static PassRefPtr<LegacyWebArchive> create(const String& markupString, Frame*, const Vector<Node*>& nodes); + static PassRefPtr<LegacyWebArchive> create(const String& markupString, Frame*, const Vector<Node*>& nodes, FrameFilter*); static PassRefPtr<ArchiveResource> createResource(CFDictionaryRef); static ResourceResponse createResourceResponseFromMacArchivedData(CFDataRef); static ResourceResponse createResourceResponseFromPropertyListData(CFDataRef, CFStringRef responseDataType); diff --git a/Source/WebCore/mathml/MathMLElement.cpp b/Source/WebCore/mathml/MathMLElement.cpp index 6088810ef..830ad45d0 100644 --- a/Source/WebCore/mathml/MathMLElement.cpp +++ b/Source/WebCore/mathml/MathMLElement.cpp @@ -48,43 +48,31 @@ PassRefPtr<MathMLElement> MathMLElement::create(const QualifiedName& tagName, Do return adoptRef(new MathMLElement(tagName, document)); } -bool MathMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const -{ - if (attrName == mathcolorAttr || attrName == mathbackgroundAttr - || attrName == colorAttr || attrName == backgroundAttr - || attrName == fontsizeAttr || attrName == fontstyleAttr - || attrName == fontweightAttr || attrName == fontfamilyAttr) { - result = eMathML; - return false; - } - return StyledElement::mapToEntry(attrName, result); -} - -void MathMLElement::parseMappedAttribute(Attribute* attr) +void MathMLElement::parseAttribute(Attribute* attr) { if (attr->name() == mathbackgroundAttr) - addCSSProperty(attr, CSSPropertyBackgroundColor, attr->value()); + addCSSProperty(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == mathsizeAttr) { // The following three values of mathsize are handled in WebCore/css/mathml.css if (attr->value() != "normal" && attr->value() != "small" && attr->value() != "big") - addCSSProperty(attr, CSSPropertyFontSize, attr->value()); + addCSSProperty(CSSPropertyFontSize, attr->value()); } else if (attr->name() == mathcolorAttr) - addCSSProperty(attr, CSSPropertyColor, attr->value()); + addCSSProperty(CSSPropertyColor, attr->value()); // FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute else if (attr->name() == fontsizeAttr) - addCSSProperty(attr, CSSPropertyFontSize, attr->value()); + addCSSProperty(CSSPropertyFontSize, attr->value()); else if (attr->name() == backgroundAttr) - addCSSProperty(attr, CSSPropertyBackgroundColor, attr->value()); + addCSSProperty(CSSPropertyBackgroundColor, attr->value()); else if (attr->name() == colorAttr) - addCSSProperty(attr, CSSPropertyColor, attr->value()); + addCSSProperty(CSSPropertyColor, attr->value()); else if (attr->name() == fontstyleAttr) - addCSSProperty(attr, CSSPropertyFontStyle, attr->value()); + addCSSProperty(CSSPropertyFontStyle, attr->value()); else if (attr->name() == fontweightAttr) - addCSSProperty(attr, CSSPropertyFontWeight, attr->value()); + addCSSProperty(CSSPropertyFontWeight, attr->value()); else if (attr->name() == fontfamilyAttr) - addCSSProperty(attr, CSSPropertyFontFamily, attr->value()); + addCSSProperty(CSSPropertyFontFamily, attr->value()); else - StyledElement::parseMappedAttribute(attr); + StyledElement::parseAttribute(attr); } } diff --git a/Source/WebCore/mathml/MathMLElement.h b/Source/WebCore/mathml/MathMLElement.h index 7678f26a9..201f0835c 100644 --- a/Source/WebCore/mathml/MathMLElement.h +++ b/Source/WebCore/mathml/MathMLElement.h @@ -42,8 +42,7 @@ protected: private: virtual bool isMathMLElement() const { return true; } - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; }; } diff --git a/Source/WebCore/mediastream/LocalMediaStream.idl b/Source/WebCore/mediastream/LocalMediaStream.idl index 15a2c42e5..29d97215a 100644 --- a/Source/WebCore/mediastream/LocalMediaStream.idl +++ b/Source/WebCore/mediastream/LocalMediaStream.idl @@ -26,9 +26,9 @@ module core { interface [ Conditional=MEDIA_STREAM, - GenerateNativeConverter, + JSGenerateToNativeObject, EventTarget, - GenerateToJS + JSGenerateToJS ] LocalMediaStream : MediaStream { void stop(); }; diff --git a/Source/WebCore/mediastream/MediaStreamList.idl b/Source/WebCore/mediastream/MediaStreamList.idl index 3ad77a95e..d182e6f82 100644 --- a/Source/WebCore/mediastream/MediaStreamList.idl +++ b/Source/WebCore/mediastream/MediaStreamList.idl @@ -26,7 +26,7 @@ module core { interface [ Conditional=MEDIA_STREAM, - HasIndexGetter + IndexedGetter ] MediaStreamList { MediaStream item(in [IsIndex] unsigned long index); diff --git a/Source/WebCore/mediastream/MediaStreamTrackList.idl b/Source/WebCore/mediastream/MediaStreamTrackList.idl index 3e3eca14e..4dd9c2972 100644 --- a/Source/WebCore/mediastream/MediaStreamTrackList.idl +++ b/Source/WebCore/mediastream/MediaStreamTrackList.idl @@ -26,7 +26,7 @@ module core { interface [ Conditional=MEDIA_STREAM, - HasIndexGetter + IndexedGetter ] MediaStreamTrackList { MediaStreamTrack item(in [IsIndex] unsigned long index); diff --git a/Source/WebCore/mediastream/PeerConnection.cpp b/Source/WebCore/mediastream/PeerConnection.cpp index bb493d768..11944823b 100644 --- a/Source/WebCore/mediastream/PeerConnection.cpp +++ b/Source/WebCore/mediastream/PeerConnection.cpp @@ -367,6 +367,8 @@ void PeerConnection::changeReadyState(ReadyState readyState) case CLOSED: break; } + + dispatchEvent(Event::create(eventNames().statechangeEvent, false, false)); } } // namespace WebCore diff --git a/Source/WebCore/mediastream/PeerConnection.h b/Source/WebCore/mediastream/PeerConnection.h index d29d1625f..fd2f2fb2d 100644 --- a/Source/WebCore/mediastream/PeerConnection.h +++ b/Source/WebCore/mediastream/PeerConnection.h @@ -58,14 +58,6 @@ public: void processSignalingMessage(const String& message, ExceptionCode&); - // Name and values of the enum must match the corressponding constants in the .idl file. - enum ReadyState { - NEW = 0, - NEGOTIATING = 1, - ACTIVE = 2, - CLOSED = 3 - }; - ReadyState readyState() const; void send(const String& text, ExceptionCode&); @@ -78,6 +70,7 @@ public: DEFINE_ATTRIBUTE_EVENT_LISTENER(connecting); DEFINE_ATTRIBUTE_EVENT_LISTENER(open); DEFINE_ATTRIBUTE_EVENT_LISTENER(message); + DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); DEFINE_ATTRIBUTE_EVENT_LISTENER(addstream); DEFINE_ATTRIBUTE_EVENT_LISTENER(removestream); @@ -87,6 +80,7 @@ public: virtual void didReceiveDataStreamMessage(const char* data, size_t length); virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>); virtual void didRemoveRemoteStream(MediaStreamDescriptor*); + virtual void didChangeState(ReadyState state) { changeReadyState(state); } // EventTarget virtual const AtomicString& interfaceName() const; diff --git a/Source/WebCore/mediastream/PeerConnection.idl b/Source/WebCore/mediastream/PeerConnection.idl index 59d35e316..afaebd705 100644 --- a/Source/WebCore/mediastream/PeerConnection.idl +++ b/Source/WebCore/mediastream/PeerConnection.idl @@ -58,6 +58,7 @@ module p2p { attribute EventListener onconnecting; attribute EventListener onopen; attribute EventListener onmessage; + attribute EventListener onstatechange; attribute EventListener onaddstream; attribute EventListener onremovestream; diff --git a/Source/WebCore/mediastream/UserMediaClient.h b/Source/WebCore/mediastream/UserMediaClient.h index ce67433ee..c8e2952ff 100644 --- a/Source/WebCore/mediastream/UserMediaClient.h +++ b/Source/WebCore/mediastream/UserMediaClient.h @@ -42,7 +42,7 @@ class UserMediaClient { public: virtual void pageDestroyed() = 0; - virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector&, const MediaStreamSourceVector&) = 0; + virtual void requestUserMedia(PassRefPtr<UserMediaRequest>, const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0; virtual void cancelUserMediaRequest(UserMediaRequest*) = 0; protected: diff --git a/Source/WebCore/mediastream/UserMediaRequest.cpp b/Source/WebCore/mediastream/UserMediaRequest.cpp index f875d37fe..faf3d4d4f 100644 --- a/Source/WebCore/mediastream/UserMediaRequest.cpp +++ b/Source/WebCore/mediastream/UserMediaRequest.cpp @@ -71,7 +71,7 @@ void UserMediaRequest::start() MediaStreamCenter::instance().queryMediaStreamSources(this); } -void UserMediaRequest::mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) +void UserMediaRequest::didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) { if (m_client) m_client->requestUserMedia(this, audioSources, videoSources); diff --git a/Source/WebCore/mediastream/UserMediaRequest.h b/Source/WebCore/mediastream/UserMediaRequest.h index 90d5527b6..a71b5e93f 100644 --- a/Source/WebCore/mediastream/UserMediaRequest.h +++ b/Source/WebCore/mediastream/UserMediaRequest.h @@ -51,21 +51,21 @@ public: static PassRefPtr<UserMediaRequest> create(ScriptExecutionContext*, UserMediaClient*, const String& options, PassRefPtr<NavigatorUserMediaSuccessCallback>, PassRefPtr<NavigatorUserMediaErrorCallback>); ~UserMediaRequest(); - bool audio() const { return m_audio; } - bool video() const { return m_video; } - - bool cameraPreferenceUser() const { return m_cameraPreferenceUser; } - bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; } - NavigatorUserMediaSuccessCallback* successCallback() const { return m_successCallback.get(); } NavigatorUserMediaErrorCallback* errorCallback() const { return m_errorCallback.get(); } void start(); - void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); void succeed(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); void fail(); + // MediaStreamSourcesQueryClient + virtual bool audio() const { return m_audio; } + virtual bool video() const { return m_video; } + virtual bool cameraPreferenceUser() const { return m_cameraPreferenceUser; } + virtual bool cameraPreferenceEnvironment() const { return m_cameraPreferenceEnvironment; } + virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources); + // ContextDestructionObserver virtual void contextDestroyed(); diff --git a/Source/WebCore/notifications/NotificationCenter.cpp b/Source/WebCore/notifications/NotificationCenter.cpp index 45dc345df..37ed5473c 100644 --- a/Source/WebCore/notifications/NotificationCenter.cpp +++ b/Source/WebCore/notifications/NotificationCenter.cpp @@ -66,6 +66,7 @@ void NotificationCenter::disconnectFrame() if (!m_notificationPresenter) return; m_notificationPresenter->cancelRequestsForPermission(scriptExecutionContext()); + m_notificationPresenter->clearNotifications(scriptExecutionContext()); m_notificationPresenter = 0; } diff --git a/Source/WebCore/notifications/NotificationPresenter.h b/Source/WebCore/notifications/NotificationPresenter.h index d1c995a29..108f05583 100644 --- a/Source/WebCore/notifications/NotificationPresenter.h +++ b/Source/WebCore/notifications/NotificationPresenter.h @@ -57,6 +57,10 @@ public: // Requests that a notification that has already been shown be canceled. virtual void cancel(Notification*) = 0; + // When the user closes a page, or quits the client application, all of the page's + // associated notifications are cleared. + virtual void clearNotifications(ScriptExecutionContext*) { } + // 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. diff --git a/Source/WebCore/page/BarInfo.idl b/Source/WebCore/page/BarInfo.idl index 2f036c11b..11a97c70e 100644 --- a/Source/WebCore/page/BarInfo.idl +++ b/Source/WebCore/page/BarInfo.idl @@ -29,7 +29,7 @@ module window { interface [ - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] BarInfo { readonly attribute boolean visible; diff --git a/Source/WebCore/page/Console.idl b/Source/WebCore/page/Console.idl index 3c63a8ace..42cd187f9 100644 --- a/Source/WebCore/page/Console.idl +++ b/Source/WebCore/page/Console.idl @@ -29,7 +29,7 @@ module window { interface [ - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] Console { @@ -41,7 +41,7 @@ module window { [CustomArgumentHandling] void dir(); [CustomArgumentHandling] void dirxml(); [V8Custom, CustomArgumentHandling] void trace(); - [V8Custom, CustomArgumentHandling, ImplementationFunction=assertCondition] void assert(in boolean condition); + [V8Custom, CustomArgumentHandling, ImplementedAs=assertCondition] void assert(in boolean condition); [CustomArgumentHandling] void count(); [CustomArgumentHandling] void markTimeline(); @@ -51,8 +51,8 @@ module window { [Custom] void profileEnd(in DOMString title); #endif - void time(in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString title); - [CustomArgumentHandling] void timeEnd(in [ConvertUndefinedOrNullToNullString] DOMString title); + void time(in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString title); + [CustomArgumentHandling] void timeEnd(in [TreatNullAs=NullString, TreatUndefinedAs=NullString] DOMString title); [CustomArgumentHandling] void timeStamp(); [CustomArgumentHandling] void group(); [CustomArgumentHandling] void groupCollapsed(); diff --git a/Source/WebCore/page/DOMSelection.idl b/Source/WebCore/page/DOMSelection.idl index 8a28e6ddb..ccd30e375 100644 --- a/Source/WebCore/page/DOMSelection.idl +++ b/Source/WebCore/page/DOMSelection.idl @@ -32,7 +32,7 @@ module window { // This is based off of Mozilla's Selection interface // https://developer.mozilla.org/En/DOM/Selection interface [ - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] DOMSelection { readonly attribute Node anchorNode; @@ -67,7 +67,7 @@ module window { void addRange(in [Optional=CallWithDefaultValue] Range range); #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // WebKit extensions diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp index f6fe47b69..2597f864f 100644 --- a/Source/WebCore/page/DOMWindow.cpp +++ b/Source/WebCore/page/DOMWindow.cpp @@ -874,7 +874,7 @@ void DOMWindow::postMessageTimerFired(PassOwnPtr<PostMessageTimer> t) // Give the embedder a chance to intercept this postMessage because this // DOMWindow might be a proxy for another in browsers that support // postMessage calls across WebKit instances. - if (isCurrentlyDisplayedInFrame() && m_frame->loader()->client()->willCheckAndDispatchMessageEvent(timer->targetOrigin(), PassRefPtr<MessageEvent>(event).leakRef())) + if (isCurrentlyDisplayedInFrame() && m_frame->loader()->client()->willCheckAndDispatchMessageEvent(timer->targetOrigin(), event.get())) return; if (timer->targetOrigin()) { @@ -1550,8 +1550,11 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event if (!EventTarget::addEventListener(eventType, listener, useCapture)) return false; - if (Document* document = this->document()) + if (Document* document = this->document()) { document->addListenerTypeIfNeeded(eventType); + if (eventType == eventNames().mousewheelEvent) + document->didAddWheelEventHandler(); + } if (eventType == eventNames().unloadEvent) addUnloadEventListener(this); @@ -1572,6 +1575,11 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener if (!EventTarget::removeEventListener(eventType, listener, useCapture)) return false; + if (Document* document = this->document()) { + if (eventType == eventNames().mousewheelEvent) + document->didRemoveWheelEventHandler(); + } + if (eventType == eventNames().unloadEvent) removeUnloadEventListener(this); else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this)) @@ -1889,15 +1897,6 @@ void DOMWindow::showModalDialog(const String& urlString, const String& dialogFea dialogFrame->page()->chrome()->runModal(); } -#if ENABLE(BLOB) -DOMURL* DOMWindow::webkitURL() const -{ - if (!m_domURL && isCurrentlyDisplayedInFrame()) - m_domURL = DOMURL::create(this->scriptExecutionContext()); - return m_domURL.get(); -} -#endif - #if ENABLE(QUOTA) StorageInfo* DOMWindow::webkitStorageInfo() const { diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h index 38e8c5d73..96a58e583 100644 --- a/Source/WebCore/page/DOMWindow.h +++ b/Source/WebCore/page/DOMWindow.h @@ -351,10 +351,6 @@ namespace WebCore { using RefCounted<DOMWindow>::ref; using RefCounted<DOMWindow>::deref; -#if ENABLE(BLOB) - DOMURL* webkitURL() const; -#endif - #if ENABLE(DEVICE_ORIENTATION) DEFINE_ATTRIBUTE_EVENT_LISTENER(devicemotion); DEFINE_ATTRIBUTE_EVENT_LISTENER(deviceorientation); diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl index 6eb74773d..41ace04d0 100644 --- a/Source/WebCore/page/DOMWindow.idl +++ b/Source/WebCore/page/DOMWindow.idl @@ -28,23 +28,22 @@ module window { interface [ CheckDomainSecurity, - CustomDefineGetter, - CustomDefineSetter, + JSCustomDefineOwnProperty, CustomDeleteProperty, CustomGetOwnPropertySlot, CustomGetPropertyNames, - CustomMarkFunction, - CustomNativeConverter, + JSCustomMarkFunction, + JSCustomToNativeObject, CustomPutFunction, EventTarget, ExtendsDOMGlobalObject, - GenerateNativeConverter, + JSGenerateToNativeObject, ReplaceableConstructor, - LegacyParent=JSDOMWindowBase + JSLegacyParent=JSDOMWindowBase ] DOMWindow { // DOM Level 0 attribute [Replaceable] Screen screen; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet, JSCCustomGetter] History history; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, JSCustomGetter] History history; attribute [Replaceable] BarInfo locationbar; attribute [Replaceable] BarInfo menubar; attribute [Replaceable] BarInfo personalbar; @@ -54,14 +53,14 @@ module window { attribute [Replaceable] Navigator navigator; attribute [Replaceable] Navigator clientInformation; readonly attribute Crypto crypto; - attribute [DoNotCheckDomainSecurity, JSCCustom, V8CustomSetter, V8Unforgeable, CPPCustom] Location location; + attribute [DoNotCheckDomainSecurity, JSCustom, V8CustomSetter, V8Unforgeable, CPPCustom] Location location; attribute [Replaceable, CustomGetter, V8CustomSetter] Event event; DOMSelection getSelection(); - readonly attribute [CheckNodeSecurity] Element frameElement; + readonly attribute [CheckAccessToNode] Element frameElement; [DoNotCheckDomainSecurity] void focus(); [DoNotCheckDomainSecurity] void blur(); @@ -81,7 +80,7 @@ module window { void alert(in [Optional=CallWithDefaultValue] DOMString message); boolean confirm(in [Optional=CallWithDefaultValue] DOMString message); [ConvertNullStringTo=Null] DOMString prompt(in [Optional=CallWithDefaultValue] DOMString message, - in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString defaultValue); + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString defaultValue); boolean find(in [Optional=CallWithDefaultValue] DOMString string, in [Optional=CallWithDefaultValue] boolean caseSensitive, @@ -116,7 +115,7 @@ module window { readonly attribute [DoNotCheckDomainSecurity] boolean closed; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet] unsigned long length; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] unsigned long length; attribute DOMString name; @@ -128,13 +127,13 @@ module window { #endif // Self referential attributes - attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow self; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow self; readonly attribute [DoNotCheckDomainSecurity, V8Unforgeable] DOMWindow window; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow frames; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow frames; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet, V8CustomSetter] DOMWindow opener; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet] DOMWindow parent; - attribute [Replaceable, DoNotCheckDomainSecurityOnGet, V8Unforgeable, V8ReadOnly] DOMWindow top; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, V8CustomSetter] DOMWindow opener; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter] DOMWindow parent; + attribute [Replaceable, DoNotCheckDomainSecurityOnGetter, V8Unforgeable, V8ReadOnly] DOMWindow top; // DOM Level 2 AbstractView Interface readonly attribute Document document; @@ -147,7 +146,7 @@ module window { // DOM Level 2 Style Interface CSSStyleDeclaration getComputedStyle(in [Optional=CallWithDefaultValue] Element element, - in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString pseudoElement); + in [TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=CallWithDefaultValue] DOMString pseudoElement); // WebKit extensions #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT @@ -162,21 +161,21 @@ module window { WebKitPoint webkitConvertPointFromNodeToPage(in [Optional=CallWithDefaultValue] Node node, in [Optional=CallWithDefaultValue] WebKitPoint p); - readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache; + readonly attribute [V8EnabledAtRuntime] DOMApplicationCache applicationCache; - readonly attribute [EnabledAtRuntime] Storage sessionStorage + readonly attribute [V8EnabledAtRuntime] Storage sessionStorage getter raises(DOMException); - readonly attribute [EnabledAtRuntime] Storage localStorage + readonly attribute [V8EnabledAtRuntime] Storage localStorage getter raises(DOMException); #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS - readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; + readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications; #endif #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM const unsigned short TEMPORARY = 0; const unsigned short PERSISTENT = 1; - [EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [V8EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [V8EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); #endif #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS @@ -228,9 +227,9 @@ module window { #endif // Base64 - DOMString atob(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString string) + DOMString atob(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString string) raises(DOMException); - DOMString btoa(in [TreatNullAs=EmptyString,Optional=CallWithDefaultValue] DOMString string) + DOMString btoa(in [TreatNullAs=NullString,Optional=CallWithDefaultValue] DOMString string) raises(DOMException); // Events @@ -314,15 +313,15 @@ module window { #if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS attribute EventListener onorientationchange; #endif - attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart; - attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove; - attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend; - attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchstart; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchmove; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchend; + attribute [Conditional=TOUCH_EVENTS,V8EnabledAtRuntime] EventListener ontouchcancel; - attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] EventListener ondevicemotion; - attribute [Conditional=DEVICE_ORIENTATION,EnabledAtRuntime] EventListener ondeviceorientation; + attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondevicemotion; + attribute [Conditional=DEVICE_ORIENTATION,V8EnabledAtRuntime] EventListener ondeviceorientation; - attribute [Conditional=MEDIA_STREAM,EnabledAtRuntime] PeerConnectionConstructor webkitPeerConnection; + attribute [Conditional=MEDIA_STREAM,V8EnabledAtRuntime] PeerConnectionConstructor webkitPeerConnection; // EventTarget interface [Custom] void addEventListener(in DOMString type, @@ -398,7 +397,7 @@ module window { attribute EntityConstructor Entity; attribute EntityReferenceConstructor EntityReference; attribute ProcessingInstructionConstructor ProcessingInstruction; - attribute [Conditional=SHADOW_DOM, EnabledAtRuntime=shadowDOM] ShadowRootConstructor WebKitShadowRoot; + attribute [Conditional=SHADOW_DOM, V8EnabledAtRuntime=shadowDOM] ShadowRootConstructor WebKitShadowRoot; attribute HTMLDocumentConstructor HTMLDocument; @@ -472,8 +471,8 @@ module window { attribute [Conditional=MICRODATA] HTMLPropertiesCollectionConstructor HTMLPropertiesCollection; attribute HTMLUnknownElementConstructor HTMLUnknownElement; - attribute [JSCCustomGetter, CustomConstructor] HTMLImageElementConstructorConstructor Image; // Usable with new operator - attribute [JSCCustomGetter] HTMLOptionElementConstructorConstructor Option; // Usable with new operator + attribute [JSCustomGetter, CustomConstructor] HTMLImageElementConstructorConstructor Image; // Usable with new operator + attribute [JSCustomGetter] HTMLOptionElementConstructorConstructor Option; // Usable with new operator attribute CanvasPatternConstructor CanvasPattern; attribute CanvasGradientConstructor CanvasGradient; @@ -526,8 +525,8 @@ module window { attribute WheelEventConstructor WheelEvent; attribute XMLHttpRequestProgressEventConstructor XMLHttpRequestProgressEvent; attribute [Conditional=SVG] SVGZoomEventConstructor SVGZoomEvent; - attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] DeviceMotionEventConstructor DeviceMotionEvent; - attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent; + attribute [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] DeviceMotionEventConstructor DeviceMotionEvent; + attribute [Conditional=DEVICE_ORIENTATION, V8EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent; attribute [Conditional=TOUCH_EVENTS] TouchEventConstructor TouchEvent; attribute StorageEventConstructor StorageEvent; attribute [Conditional=INPUT_SPEECH] SpeechInputEventConstructor SpeechInputEvent; @@ -579,16 +578,16 @@ module window { #endif #if defined(ENABLE_SHARED_WORKERS) && ENABLE_SHARED_WORKERS - attribute [JSCCustomGetter, EnabledAtRuntime] SharedWorkerConstructor SharedWorker; // Usable with the new operator + attribute [JSCustomGetter, V8EnabledAtRuntime] SharedWorkerConstructor SharedWorker; // Usable with the new operator #endif #if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK - attribute [EnabledAtRuntime=webkitVideoTrack] HTMLTrackElementConstructor HTMLTrackElement; - attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackConstructor TextTrack; - attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackCueConstructor TextTrackCue; // Usable with the new operator - attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackCueListConstructor TextTrackCueList; - attribute [EnabledAtRuntime=webkitVideoTrack] TextTrackListConstructor TextTrackList; - attribute [EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent; + attribute [V8EnabledAtRuntime=webkitVideoTrack] HTMLTrackElementConstructor HTMLTrackElement; + attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackConstructor TextTrack; + attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackCueConstructor TextTrackCue; // Usable with the new operator + attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackCueListConstructor TextTrackCueList; + attribute [V8EnabledAtRuntime=webkitVideoTrack] TextTrackListConstructor TextTrackList; + attribute [V8EnabledAtRuntime=webkitVideoTrack] TrackEventConstructor TrackEvent; #endif attribute DOMPluginConstructor Plugin; @@ -602,14 +601,14 @@ module window { attribute StorageConstructor Storage; - attribute [JSCCustomGetter, Conditional=VIDEO, EnabledAtRuntime] HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator - attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLAudioElementConstructor HTMLAudioElement; - attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLMediaElementConstructor HTMLMediaElement; - attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLVideoElementConstructor HTMLVideoElement; - attribute [Conditional=VIDEO, EnabledAtRuntime] MediaErrorConstructor MediaError; - attribute [Conditional=VIDEO, EnabledAtRuntime] TimeRangesConstructor TimeRanges; - attribute [Conditional=VIDEO, EnabledAtRuntime] HTMLSourceElementConstructor HTMLSourceElement; - attribute [Conditional=VIDEO, EnabledAtRuntime] MediaControllerConstructor MediaController; + attribute [JSCustomGetter, Conditional=VIDEO, V8EnabledAtRuntime] HTMLAudioElementConstructorConstructor Audio; // Usable with the new operator + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLAudioElementConstructor HTMLAudioElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLMediaElementConstructor HTMLMediaElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLVideoElementConstructor HTMLVideoElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] MediaErrorConstructor MediaError; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] TimeRangesConstructor TimeRanges; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] HTMLSourceElementConstructor HTMLSourceElement; + attribute [Conditional=VIDEO, V8EnabledAtRuntime] MediaControllerConstructor MediaController; #if defined(ENABLE_ANIMATION_API) && ENABLE_ANIMATION_API attribute WebKitAnimationConstructor WebKitAnimation; @@ -783,10 +782,10 @@ module window { attribute [Conditional=BLOB] WebKitBlobBuilderConstructor WebKitBlobBuilder; - readonly attribute [Conditional=BLOB] DOMURL webkitURL; + attribute [Conditional=BLOB] DOMURLConstructor webkitURL; #if defined(ENABLE_QUOTA) && ENABLE_QUOTA - readonly attribute [EnabledAtRuntime=Quota] StorageInfo webkitStorageInfo; + readonly attribute [V8EnabledAtRuntime=Quota] StorageInfo webkitStorageInfo; #endif attribute [Conditional=MUTATION_OBSERVERS] WebKitMutationObserverConstructor WebKitMutationObserver; @@ -795,7 +794,7 @@ module window { #if defined(V8_BINDING) && V8_BINDING // window.toString() requires special handling in V8 - [V8DoNotCheckSignature, DoNotCheckDomainSecurity, Custom, DontEnum] DOMString toString(); + [V8DoNotCheckSignature, DoNotCheckDomainSecurity, Custom, NotEnumerable] DOMString toString(); #endif // defined(V8_BINDING) }; diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp index a47b6a4bc..7919d761e 100644 --- a/Source/WebCore/page/DragController.cpp +++ b/Source/WebCore/page/DragController.cpp @@ -27,7 +27,6 @@ #include "DragController.h" #if ENABLE(DRAG_SUPPORT) -#include "CSSMutableStyleDeclaration.h" #include "Clipboard.h" #include "ClipboardAccessPolicy.h" #include "CachedResourceLoader.h" @@ -64,6 +63,7 @@ #include "ResourceRequest.h" #include "SecurityOrigin.h" #include "Settings.h" +#include "StylePropertySet.h" #include "Text.h" #include "TextEvent.h" #include "htmlediting.h" @@ -447,12 +447,12 @@ bool DragController::concludeEditDrag(DragData* dragData) if (!color.isValid()) return false; RefPtr<Range> innerRange = innerFrame->selection()->toNormalizedRange(); - RefPtr<CSSMutableStyleDeclaration> style = CSSMutableStyleDeclaration::create(); + RefPtr<StylePropertySet> style = StylePropertySet::create(); style->setProperty(CSSPropertyColor, color.serialized(), false); - if (!innerFrame->editor()->shouldApplyStyle(style.get(), innerRange.get())) + if (!innerFrame->editor()->shouldApplyStyle(style->ensureCSSStyleDeclaration(), innerRange.get())) return false; m_client->willPerformDragDestinationAction(DragDestinationActionEdit, dragData); - innerFrame->editor()->applyStyle(style.get(), EditActionSetColor); + innerFrame->editor()->applyStyle(style->ensureCSSStyleDeclaration(), EditActionSetColor); return true; } diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index a2f322e26..9acfc54d2 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -60,6 +60,7 @@ #include "MouseEvent.h" #include "MouseEventWithHitTestResults.h" #include "Page.h" +#include "PlatformEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformWheelEvent.h" #include "PluginDocument.h" @@ -142,6 +143,73 @@ private: Cursor m_cursor; }; +#if ENABLE(TOUCH_EVENTS) +class SyntheticTouchPoint : public PlatformTouchPoint { +public: + + // The default values are based on http://dvcs.w3.org/hg/webevents/raw-file/tip/touchevents.html + explicit SyntheticTouchPoint(const PlatformMouseEvent& event) + { + const static int idDefaultValue = 0; + const static int radiusYDefaultValue = 1; + const static int radiusXDefaultValue = 1; + const static float rotationAngleDefaultValue = 0.0f; + const static float forceDefaultValue = 1.0f; + + m_id = idDefaultValue; // There is only one active TouchPoint. + m_screenPos = event.globalPosition(); + m_pos = event.position(); + m_radiusY = radiusYDefaultValue; + m_radiusX = radiusXDefaultValue; + m_rotationAngle = rotationAngleDefaultValue; + m_force = forceDefaultValue; + + PlatformEvent::Type type = event.type(); + ASSERT(type == PlatformEvent::MouseMoved || type == PlatformEvent::MousePressed || type == PlatformEvent::MouseReleased); + + switch (type) { + case PlatformEvent::MouseMoved: + m_state = TouchMoved; + break; + case PlatformEvent::MousePressed: + m_state = TouchPressed; + break; + case PlatformEvent::MouseReleased: + m_state = TouchReleased; + break; + default: + ASSERT_NOT_REACHED(); + break; + } + } +}; + +class SyntheticSingleTouchEvent : public PlatformTouchEvent { +public: + explicit SyntheticSingleTouchEvent(const PlatformMouseEvent& event) + { + switch (event.type()) { + case PlatformEvent::MouseMoved: + m_type = TouchMove; + break; + case PlatformEvent::MousePressed: + m_type = TouchStart; + break; + case PlatformEvent::MouseReleased: + m_type = TouchEnd; + break; + default: + ASSERT_NOT_REACHED(); + m_type = NoType; + break; + } + m_timestamp = event.timestamp(); + m_modifiers = event.modifiers(); + m_touchPoints.append(SyntheticTouchPoint(event)); + } +}; +#endif + static inline bool scrollNode(float delta, WheelEvent::Granularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Node** stopNode) { if (!delta) @@ -1375,6 +1443,12 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) { RefPtr<FrameView> protector(m_frame->view()); +#if ENABLE(TOUCH_EVENTS) + bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); + if (defaultPrevented) + return true; +#endif + UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); // FIXME (bug 68185): this call should be made at another abstraction layer @@ -1401,7 +1475,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) HitTestRequest request(HitTestRequest::Active); // Save the document point we generate in case the window coordinate is invalidated by what happens // when we dispatch the event. - IntPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position()); + LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, mouseEvent.position()); MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(request, documentPoint, mouseEvent); if (!targetNode(mev)) { @@ -1561,6 +1635,13 @@ bool EventHandler::mouseMoved(const PlatformMouseEvent& event) { RefPtr<FrameView> protector(m_frame->view()); +#if ENABLE(TOUCH_EVENTS) + // FIXME: this should be moved elsewhere to also be able to dispatch touchcancel events. + bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(event); + if (defaultPrevented) + return true; +#endif + HitTestResult hoveredNode = HitTestResult(LayoutPoint()); bool result = handleMouseMoveEvent(event, &hoveredNode); @@ -1569,8 +1650,10 @@ bool EventHandler::mouseMoved(const PlatformMouseEvent& event) return result; if (RenderLayer* layer = layerForNode(hoveredNode.innerNode())) { - if (page->containsScrollableArea(layer)) - layer->mouseMovedInContentArea(); + if (FrameView* frameView = m_frame->view()) { + if (frameView->containsScrollableArea(layer)) + layer->mouseMovedInContentArea(); + } } if (FrameView* frameView = m_frame->view()) @@ -1698,7 +1781,13 @@ void EventHandler::invalidateClick() bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) { RefPtr<FrameView> protector(m_frame->view()); - + +#if ENABLE(TOUCH_EVENTS) + bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent); + if (defaultPrevented) + return true; +#endif + UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); #if ENABLE(PAN_SCROLLING) @@ -2030,10 +2119,14 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo } } else if (page && (layerForLastNode && (!layerForNodeUnderMouse || layerForNodeUnderMouse != layerForLastNode))) { // The mouse has moved between layers. - if (page->containsScrollableArea(layerForLastNode)) - layerForLastNode->mouseExitedContentArea(); + if (Frame* frame = m_lastNodeUnderMouse->document()->frame()) { + if (FrameView* frameView = frame->view()) { + if (frameView->containsScrollableArea(layerForLastNode)) + layerForLastNode->mouseExitedContentArea(); + } + } } - + if (m_nodeUnderMouse && (!m_lastNodeUnderMouse || m_lastNodeUnderMouse->document() != m_frame->document())) { // The mouse has moved between frames. if (Frame* frame = m_nodeUnderMouse->document()->frame()) { @@ -2042,10 +2135,14 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo } } else if (page && (layerForNodeUnderMouse && (!layerForLastNode || layerForNodeUnderMouse != layerForLastNode))) { // The mouse has moved between layers. - if (page->containsScrollableArea(layerForNodeUnderMouse)) - layerForNodeUnderMouse->mouseEnteredContentArea(); + if (Frame* frame = m_nodeUnderMouse->document()->frame()) { + if (FrameView* frameView = frame->view()) { + if (frameView->containsScrollableArea(layerForNodeUnderMouse)) + layerForNodeUnderMouse->mouseEnteredContentArea(); + } + } } - + if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame->document()) { m_lastNodeUnderMouse = 0; m_lastScrollbarUnderMouse = 0; @@ -3194,6 +3291,8 @@ static const AtomicString& eventNameForTouchPointState(PlatformTouchPoint::State return eventNames().touchstartEvent; case PlatformTouchPoint::TouchMoved: return eventNames().touchmoveEvent; + case PlatformTouchPoint::TouchStationary: + // TouchStationary state is not converted to touch events, so fall through to assert. default: ASSERT_NOT_REACHED(); return emptyAtom; @@ -3249,6 +3348,9 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) case PlatformTouchPoint::TouchCancelled: hitType |= HitTestRequest::Release; break; + case PlatformTouchPoint::TouchStationary: + hitType |= HitTestRequest::Active | HitTestRequest::ReadOnly; + break; default: ASSERT_NOT_REACHED(); break; @@ -3281,7 +3383,7 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) // we also remove it from the map. touchTarget = m_originatingTouchPointTargets.take(touchPointTargetKey); } else - // No hittest is performed on move, since the target is not allowed to change anyway. + // No hittest is performed on move or stationary, since the target is not allowed to change anyway. touchTarget = m_originatingTouchPointTargets.get(touchPointTargetKey); if (!touchTarget.get()) @@ -3362,7 +3464,21 @@ bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event) return defaultPrevented; } +bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent& event) +{ + if (!m_frame || !m_frame->settings() || !m_frame->settings()->isTouchEventEmulationEnabled()) + return false; + + PlatformEvent::Type eventType = event.type(); + if (eventType != PlatformEvent::MouseMoved && eventType != PlatformEvent::MousePressed && eventType != PlatformEvent::MouseReleased) + return false; + if (eventType == PlatformEvent::MouseMoved && !m_touchPressed) + return false; + + SyntheticSingleTouchEvent touchEvent(event); + return handleTouchEvent(touchEvent); +} #endif diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index 547bfe57d..7733a0f65 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -264,6 +264,10 @@ private: void fakeMouseMoveEventTimerFired(Timer<EventHandler>*); void cancelFakeMouseMoveEvent(); +#if ENABLE(TOUCH_EVENTS) + bool dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent&); +#endif + void invalidateClick(); Node* nodeUnderMouse() const; diff --git a/Source/WebCore/page/EventSource.idl b/Source/WebCore/page/EventSource.idl index 4c4433f7a..9b7fe38dc 100644 --- a/Source/WebCore/page/EventSource.idl +++ b/Source/WebCore/page/EventSource.idl @@ -38,7 +38,7 @@ module window { CallWith=ScriptExecutionContext, ConstructorRaisesException, EventTarget, - NoStaticTables + JSNoStaticTables ] EventSource { readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp index b0ef2110f..51426a308 100644 --- a/Source/WebCore/page/FocusController.cpp +++ b/Source/WebCore/page/FocusController.cpp @@ -88,6 +88,7 @@ FocusController::FocusController(Page* page) , m_isActive(false) , m_isFocused(false) , m_isChangingFocusedFrame(false) + , m_containingWindowIsVisible(false) { } @@ -573,16 +574,6 @@ void FocusController::setActive(bool active) view->updateLayoutAndStyleIfNeededRecursive(); view->updateControlTints(); } - - if (const HashSet<ScrollableArea*>* scrollableAreas = m_page->scrollableAreaSet()) { - HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end(); - for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) { - if (!active) - (*it)->contentAreaDidHide(); - else - (*it)->contentAreaDidShow(); - } - } } focusedOrMainFrame()->selection()->pageActivationChanged(); @@ -591,6 +582,45 @@ void FocusController::setActive(bool active) dispatchEventsOnWindowAndFocusedNode(m_focusedFrame->document(), active); } +static void contentAreaDidShowOrHide(ScrollableArea* scrollableArea, bool didShow) +{ + if (didShow) + scrollableArea->contentAreaDidShow(); + else + scrollableArea->contentAreaDidHide(); +} + +void FocusController::setContainingWindowIsVisible(bool containingWindowIsVisible) +{ + if (m_containingWindowIsVisible == containingWindowIsVisible) + return; + + m_containingWindowIsVisible = containingWindowIsVisible; + + FrameView* view = m_page->mainFrame()->view(); + if (!view) + return; + + contentAreaDidShowOrHide(view, containingWindowIsVisible); + + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + FrameView* frameView = frame->view(); + if (!frameView) + continue; + + const HashSet<ScrollableArea*>* scrollableAreas = frameView->scrollableAreas(); + if (!scrollableAreas) + continue; + + for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) { + ScrollableArea* scrollableArea = *it; + ASSERT(scrollableArea->isOnActivePage()); + + contentAreaDidShowOrHide(scrollableArea, containingWindowIsVisible); + } + } +} + static void updateFocusCandidateIfNeeded(FocusDirection direction, const FocusCandidate& current, FocusCandidate& candidate, FocusCandidate& closest) { ASSERT(candidate.visibleNode->isElementNode()); diff --git a/Source/WebCore/page/FocusController.h b/Source/WebCore/page/FocusController.h index 6880a1c45..3b56377bd 100644 --- a/Source/WebCore/page/FocusController.h +++ b/Source/WebCore/page/FocusController.h @@ -63,6 +63,9 @@ public: void setFocused(bool); bool isFocused() const { return m_isFocused; } + void setContainingWindowIsVisible(bool); + bool containingWindowIsVisible() const { return m_containingWindowIsVisible; } + bool transferFocusToElementInShadowRoot(Element* shadowHost, bool restorePreviousSelection); private: @@ -96,6 +99,7 @@ private: bool m_isActive; bool m_isFocused; bool m_isChangingFocusedFrame; + bool m_containingWindowIsVisible; }; diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp index e1f5bcf99..72ddd62cb 100644 --- a/Source/WebCore/page/Frame.cpp +++ b/Source/WebCore/page/Frame.cpp @@ -33,7 +33,6 @@ #include "ApplyStyleCommand.h" #include "BackForwardController.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSProperty.h" #include "CSSPropertyNames.h" #include "CachedCSSStyleSheet.h" @@ -80,6 +79,7 @@ #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "Settings.h" +#include "StylePropertySet.h" #include "TextIterator.h" #include "TextResourceDecoder.h" #include "UserContentURLPattern.h" @@ -290,11 +290,11 @@ void Frame::setDocument(PassRefPtr<Document> newDoc) // Update the cached 'document' property, which is now stale. m_script.updateDocument(); - if (m_page) { - m_page->updateViewportArguments(); - if (m_page->mainFrame() == this) - notifyChromeClientWheelEventHandlerCountChanged(); - } + if (m_doc) + m_doc->updateViewportArguments(); + + if (m_page && m_page->mainFrame() == this) + notifyChromeClientWheelEventHandlerCountChanged(); } #if ENABLE(ORIENTATION_EVENTS) @@ -668,6 +668,9 @@ void Frame::pageDestroyed() if (m_domWindow) { m_domWindow->resetGeolocation(); +#if ENABLE(NOTIFICATIONS) + m_domWindow->resetNotifications(); +#endif m_domWindow->pageDestroyed(); } @@ -1068,7 +1071,7 @@ DragImageRef Frame::nodeImage(Node* node) m_doc->updateLayout(); m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode. - IntRect topLevelRect; + LayoutRect topLevelRect; IntRect paintingRect = renderer->paintingRootRect(topLevelRect); OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size())); diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index 9fc1cc605..baba068e4 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -152,16 +152,17 @@ FrameView::FrameView(Frame* frame) { init(); - if (m_frame) { - if (Page* page = m_frame->page()) { - m_page = page; - m_page->addScrollableArea(this); + // FIXME: Can m_frame ever be null here? + if (!m_frame) + return; - if (m_frame == m_page->mainFrame()) { - ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); - ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); - } - } + Page* page = m_frame->page(); + if (!page) + return; + + if (m_frame == page->mainFrame()) { + ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); + ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); } } @@ -202,9 +203,6 @@ FrameView::~FrameView() ASSERT(!m_scrollCorner); ASSERT(m_actionScheduler->isEmpty()); - if (m_page) - m_page->removeScrollableArea(this); - if (m_frame) { ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); RenderPart* renderer = m_frame->ownerRenderer(); @@ -323,21 +321,6 @@ void FrameView::detachCustomScrollbars() } } -void FrameView::didAddHorizontalScrollbar(Scrollbar* scrollbar) -{ - if (m_frame && m_frame->document()) - m_frame->document()->didAddWheelEventHandler(); - ScrollView::didAddHorizontalScrollbar(scrollbar); -} - -void FrameView::willRemoveHorizontalScrollbar(Scrollbar* scrollbar) -{ - ScrollView::willRemoveHorizontalScrollbar(scrollbar); - // FIXME: maybe need a separate ScrollableArea::didRemoveHorizontalScrollbar callback? - if (m_frame && m_frame->document()) - m_frame->document()->didRemoveWheelEventHandler(); -} - void FrameView::recalculateScrollbarOverlayStyle() { ScrollbarOverlayStyle oldOverlayStyle = scrollbarOverlayStyle(); @@ -1242,8 +1225,8 @@ void FrameView::removeWidgetToUpdate(RenderEmbeddedObject* object) void FrameView::zoomAnimatorTransformChanged(float scale, float x, float y, ZoomAnimationState state) { if (state == ZoomAnimationFinishing) { - m_page->setPageScaleFactor(m_page->pageScaleFactor() * scale, - IntPoint(scale * scrollX() - x, scale * scrollY() - y)); + if (Page* page = m_frame->page()) + page->setPageScaleFactor(page->pageScaleFactor() * scale, IntPoint(scale * scrollX() - x, scale * scrollY() - y)); scrollAnimator()->resetZoom(); } @@ -2280,8 +2263,10 @@ void FrameView::performPostLayoutTasks() if (m_firstLayoutCallbackPending) { m_firstLayoutCallbackPending = false; m_frame->loader()->didFirstLayout(); - if (Page* page = m_frame->page()) - page->startCountingRelevantRepaintedObjects(); + if (Page* page = m_frame->page()) { + if (page->mainFrame() == m_frame) + page->startCountingRelevantRepaintedObjects(); + } } // Ensure that we always send this eventually. @@ -2305,6 +2290,13 @@ void FrameView::performPostLayoutTasks() break; } +#if ENABLE(THREADED_SCROLLING) + if (Page* page = m_frame->page()) { + if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) + scrollingCoordinator->frameViewLayoutUpdated(this); + } +#endif + scrollToAnchor(); m_actionScheduler->resume(); @@ -2542,6 +2534,12 @@ ScrollableArea* FrameView::enclosingScrollableArea() const return 0; } +IntRect FrameView::scrollableAreaBoundingBox() const +{ + // FIXME: This isn't correct for transformed frames. We probably need to ask the renderer instead. + return frameRect(); +} + bool FrameView::shouldSuspendScrollAnimations() const { return m_frame->loader()->state() != FrameStateComplete; @@ -2566,18 +2564,16 @@ void FrameView::setAnimatorsAreActive() if (!page) return; - const HashSet<ScrollableArea*>* scrollableAreas = page->scrollableAreaSet(); - if (!scrollableAreas) + scrollAnimator()->setIsActive(); + + if (!m_scrollableAreas) return; - HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end(); - for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) { - // FIXME: This extra check to make sure the ScrollableArea is on an active page needs - // to be here as long as the ScrollableArea HashSet lives on Page. But it should really be - // moved to the top-level Document or a similar class that really represents a single - // web page. https://bugs.webkit.org/show_bug.cgi?id=62762 - if ((*it)->isOnActivePage()) - (*it)->scrollAnimator()->setIsActive(); + for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) { + ScrollableArea* scrollableArea = *it; + + ASSERT(scrollableArea->isOnActivePage()); + scrollableArea->scrollAnimator()->setIsActive(); } } @@ -2587,21 +2583,28 @@ void FrameView::notifyPageThatContentAreaWillPaint() const if (!page) return; - const HashSet<ScrollableArea*>* scrollableAreas = page->scrollableAreaSet(); - if (!scrollableAreas) + contentAreaWillPaint(); + + if (!m_scrollableAreas) return; - HashSet<ScrollableArea*>::const_iterator end = scrollableAreas->end(); - for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(); it != end; ++it) - (*it)->contentAreaWillPaint(); + for (HashSet<ScrollableArea*>::const_iterator it = m_scrollableAreas->begin(), end = m_scrollableAreas->end(); it != end; ++it) { + ScrollableArea* scrollableArea = *it; + + if (!scrollableArea->isOnActivePage()) + continue; + + scrollableArea->contentAreaWillPaint(); + } } bool FrameView::scrollAnimatorEnabled() const { #if ENABLE(SMOOTH_SCROLLING) - if (m_page && m_page->settings()) - return m_page->settings()->scrollAnimatorEnabled(); + if (Page* page = m_frame->page()) + return page->settings()->scrollAnimatorEnabled(); #endif + return false; } @@ -3253,6 +3256,43 @@ void FrameView::setTracksRepaints(bool trackRepaints) m_isTrackingRepaints = trackRepaints; } +void FrameView::addScrollableArea(ScrollableArea* scrollableArea) +{ + if (!m_scrollableAreas) + m_scrollableAreas = adoptPtr(new ScrollableAreaSet); + m_scrollableAreas->add(scrollableArea); +} + +void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) +{ + if (!m_scrollableAreas) + return; + m_scrollableAreas->remove(scrollableArea); +} + +bool FrameView::containsScrollableArea(ScrollableArea* scrollableArea) const +{ + if (!m_scrollableAreas) + return false; + return m_scrollableAreas->contains(scrollableArea); +} + +void FrameView::addChild(PassRefPtr<Widget> widget) +{ + if (widget->isFrameView()) + addScrollableArea(static_cast<FrameView*>(widget.get())); + + ScrollView::addChild(widget); +} + +void FrameView::removeChild(Widget* widget) +{ + if (widget->isFrameView()) + removeScrollableArea(static_cast<FrameView*>(widget)); + + ScrollView::removeChild(widget); +} + bool FrameView::isVerticalDocument() const { RenderView* root = rootRenderer(this); diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index 466a88939..51fe7c370 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -86,8 +86,6 @@ public: virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); virtual bool avoidScrollbarCreation() const; - virtual void didAddHorizontalScrollbar(Scrollbar*); - virtual void willRemoveHorizontalScrollbar(Scrollbar*); virtual void setContentsSize(const IntSize&); @@ -308,6 +306,15 @@ public: void resetTrackedRepaints() { m_trackedRepaintRects.clear(); } const Vector<IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; } + typedef HashSet<ScrollableArea*> ScrollableAreaSet; + void addScrollableArea(ScrollableArea*); + void removeScrollableArea(ScrollableArea*); + bool containsScrollableArea(ScrollableArea*) const; + const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); } + + virtual void addChild(PassRefPtr<Widget>) OVERRIDE; + virtual void removeChild(Widget*) OVERRIDE; + protected: virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); virtual void scrollContentsSlowPath(const IntRect& updateRect); @@ -362,6 +369,7 @@ private: virtual void setVisibleScrollerThumbRect(const IntRect&); virtual bool isOnActivePage() const; virtual ScrollableArea* enclosingScrollableArea() const; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; #if USE(ACCELERATED_COMPOSITING) virtual GraphicsLayer* layerForHorizontalScrollbar() const OVERRIDE; @@ -373,7 +381,6 @@ private: #endif virtual void notifyPageThatContentAreaWillPaint() const; - virtual void disconnectFromPage() { m_page = 0; } virtual bool scrollAnimatorEnabled() const; @@ -476,8 +483,6 @@ private: // Renderer to hold our custom scroll corner. RenderScrollbarPart* m_scrollCorner; - Page* m_page; - // If true, automatically resize the frame view around its content. bool m_shouldAutoSize; bool m_inAutoSize; @@ -486,6 +491,8 @@ private: // The upper bound on the size when autosizing. IntSize m_maxAutoSize; + OwnPtr<ScrollableAreaSet> m_scrollableAreas; + static double s_deferredRepaintDelay; static double s_initialDeferredRepaintDelayDuringLoading; static double s_maxDeferredRepaintDelayDuringLoading; diff --git a/Source/WebCore/page/Geolocation.idl b/Source/WebCore/page/Geolocation.idl index d1d534992..4f159bcb1 100644 --- a/Source/WebCore/page/Geolocation.idl +++ b/Source/WebCore/page/Geolocation.idl @@ -28,7 +28,7 @@ module core { // http://www.w3.org/TR/geolocation-API/#geolocation_interface interface [ Conditional=GEOLOCATION, - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] Geolocation { [Custom] void getCurrentPosition(in PositionCallback successCallback, diff --git a/Source/WebCore/page/History.cpp b/Source/WebCore/page/History.cpp index 1f5a39f28..a1f9a05f6 100644 --- a/Source/WebCore/page/History.cpp +++ b/Source/WebCore/page/History.cpp @@ -42,6 +42,7 @@ namespace WebCore { History::History(Frame* frame) : DOMWindowProperty(frame) + , m_lastStateObjectRequested(0) { } @@ -54,6 +55,28 @@ unsigned History::length() const return m_frame->page()->backForward()->count(); } +SerializedScriptValue* History::state() +{ + m_lastStateObjectRequested = stateInternal(); + return m_lastStateObjectRequested; +} + +SerializedScriptValue* History::stateInternal() const +{ + if (!m_frame) + return 0; + + if (HistoryItem* historyItem = m_frame->loader()->history()->currentItem()) + return historyItem->stateObject(); + + return 0; +} + +bool History::stateChanged() const +{ + return m_lastStateObjectRequested != stateInternal(); +} + void History::back() { go(-1); diff --git a/Source/WebCore/page/History.h b/Source/WebCore/page/History.h index bd50fccd2..bd6f6aa21 100644 --- a/Source/WebCore/page/History.h +++ b/Source/WebCore/page/History.h @@ -44,6 +44,8 @@ public: static PassRefPtr<History> create(Frame* frame) { return adoptRef(new History(frame)); } unsigned length() const; + SerializedScriptValue* state(); + bool stateChanged() const; void back(); void forward(); void go(int distance); @@ -62,6 +64,10 @@ private: explicit History(Frame*); KURL urlForState(const String& url); + + SerializedScriptValue* stateInternal() const; + + SerializedScriptValue* m_lastStateObjectRequested; }; } // namespace WebCore diff --git a/Source/WebCore/page/History.idl b/Source/WebCore/page/History.idl index ff3701ed2..f7036403a 100644 --- a/Source/WebCore/page/History.idl +++ b/Source/WebCore/page/History.idl @@ -29,22 +29,23 @@ module window { #if defined(V8_BINDING) && V8_BINDING CheckDomainSecurity, #endif - DelegatingGetOwnPropertySlot, - DelegatingPutFunction, - GenerateIsReachable=ImplFrame, + JSCustomGetOwnPropertySlotDelegate, + CustomNamedSetter, + JSGenerateIsReachable=ImplFrame, CustomDeleteProperty, CustomGetPropertyNames, OmitConstructor ] History { readonly attribute unsigned long length; + readonly attribute [CachedAttribute, Custom] SerializedScriptValue state; [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void back(); [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void forward(); [DoNotCheckDomainSecurity, CallWith=ScriptExecutionContext] void go(in [Optional=CallWithDefaultValue] long distance); - [Custom, EnabledAtRuntime] void pushState(in any data, in DOMString title, in [Optional] DOMString url) + [Custom, V8EnabledAtRuntime] void pushState(in any data, in DOMString title, in [Optional] DOMString url) raises(DOMException); - [Custom, EnabledAtRuntime] void replaceState(in any data, in DOMString title, in [Optional] DOMString url) + [Custom, V8EnabledAtRuntime] void replaceState(in any data, in DOMString title, in [Optional] DOMString url) raises(DOMException); }; diff --git a/Source/WebCore/page/Location.idl b/Source/WebCore/page/Location.idl index d510052c3..d5d27e2c6 100644 --- a/Source/WebCore/page/Location.idl +++ b/Source/WebCore/page/Location.idl @@ -32,18 +32,18 @@ module window { #if defined(V8_BINDING) && V8_BINDING CheckDomainSecurity, #endif - DelegatingGetOwnPropertySlot, - DelegatingPutFunction, - GenerateIsReachable=ImplFrame, + JSCustomGetOwnPropertySlotDelegate, + CustomNamedSetter, + JSGenerateIsReachable=ImplFrame, CustomDeleteProperty, CustomGetPropertyNames, - CustomDefineGetter, - DelegatingPrototypePutFunction, - CustomPrototypeDefineGetter, + JSCustomDefineOwnProperty, + JSCustomPrototypePutDelegate, + JSCustomPrototypeDefineOwnProperty, OmitConstructor ] Location { #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute [DoNotCheckDomainSecurityOnSet, CustomSetter, V8Unforgeable] DOMString href; + attribute [DoNotCheckDomainSecurityOnSetter, CustomSetter, V8Unforgeable] DOMString href; #endif [Custom, V8OnInstance] void assign(in [Optional=CallWithDefaultValue] DOMString url); @@ -64,10 +64,10 @@ module window { #endif #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT - [DontEnum, Custom, V8OnInstance, V8ReadOnly, ImplementationFunction=toStringFunction] DOMString toString(); + [NotEnumerable, Custom, V8OnInstance, V8ReadOnly, ImplementedAs=toStringFunction] DOMString toString(); #endif #if defined(V8_BINDING) && V8_BINDING - [DontEnum, Custom, V8OnInstance, V8ReadOnly] DOMObject valueOf(); + [NotEnumerable, Custom, V8OnInstance, V8ReadOnly] DOMObject valueOf(); #endif }; diff --git a/Source/WebCore/page/MemoryInfo.idl b/Source/WebCore/page/MemoryInfo.idl index f04447479..b9149d54d 100644 --- a/Source/WebCore/page/MemoryInfo.idl +++ b/Source/WebCore/page/MemoryInfo.idl @@ -36,7 +36,7 @@ module window { readonly attribute unsigned long totalJSHeapSize; readonly attribute unsigned long usedJSHeapSize; - readonly attribute [JSCCustomGetter] unsigned long jsHeapSizeLimit; + readonly attribute [JSCustomGetter] unsigned long jsHeapSizeLimit; }; diff --git a/Source/WebCore/page/Navigator.idl b/Source/WebCore/page/Navigator.idl index 6fe43e660..213fab125 100644 --- a/Source/WebCore/page/Navigator.idl +++ b/Source/WebCore/page/Navigator.idl @@ -20,7 +20,7 @@ module window { interface [ - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] Navigator { readonly attribute DOMString appCodeName; @@ -41,11 +41,11 @@ module window { readonly attribute boolean onLine; #if defined(ENABLE_GEOLOCATION) && ENABLE_GEOLOCATION - readonly attribute [EnabledAtRuntime] Geolocation geolocation; + readonly attribute [V8EnabledAtRuntime] Geolocation geolocation; #endif #if defined(ENABLE_POINTER_LOCK) && ENABLE_POINTER_LOCK - readonly attribute [EnabledAtRuntime] PointerLock webkitPointer; + readonly attribute [V8EnabledAtRuntime] PointerLock webkitPointer; #endif void getStorageUpdates(); // FIXME: Remove this method or rename to yieldForStorageUpdates. @@ -56,7 +56,7 @@ module window { #endif #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM - [Custom, EnabledAtRuntime] void webkitGetUserMedia(in DOMString options, + [Custom, V8EnabledAtRuntime] void webkitGetUserMedia(in DOMString options, in [Callback=FunctionOnly] NavigatorUserMediaSuccessCallback successCallback, in [Callback=FunctionOnly, Optional] NavigatorUserMediaErrorCallback errorCallback) raises(DOMException); diff --git a/Source/WebCore/page/Page.cpp b/Source/WebCore/page/Page.cpp index 2442bf7c2..492e949ee 100644 --- a/Source/WebCore/page/Page.cpp +++ b/Source/WebCore/page/Page.cpp @@ -211,12 +211,6 @@ Page::~Page() for (Frame* frame = mainFrame(); frame; frame = frame->tree()->traverseNext()) frame->pageDestroyed(); - if (m_scrollableAreaSet) { - ScrollableAreaSet::const_iterator end = m_scrollableAreaSet->end(); - for (ScrollableAreaSet::const_iterator it = m_scrollableAreaSet->begin(); it != end; ++it) - (*it)->disconnectFromPage(); - } - m_editorClient->pageDestroyed(); #if ENABLE(INSPECTOR) @@ -240,6 +234,11 @@ Page::~Page() #endif } +ViewportArguments Page::viewportArguments() const +{ + return mainFrame() && mainFrame()->document() ? mainFrame()->document()->viewportArguments() : ViewportArguments(); +} + #if ENABLE(THREADED_SCROLLING) ScrollingCoordinator* Page::scrollingCoordinator() { @@ -430,15 +429,6 @@ void Page::setNeedsRecalcStyleInAllFrames() frame->document()->styleSelectorChanged(DeferRecalcStyle); } -void Page::updateViewportArguments() -{ - if (!mainFrame() || !mainFrame()->document()) - return; - - m_viewportArguments = mainFrame()->document()->viewportArguments(); - chrome()->dispatchViewportPropertiesDidChange(m_viewportArguments); -} - void Page::refreshPlugins(bool reload) { if (!allPages) @@ -1030,27 +1020,6 @@ void Page::privateBrowsingStateChanged() pluginViewBases[i]->privateBrowsingStateChanged(privateBrowsingEnabled); } -void Page::addScrollableArea(ScrollableArea* scrollableArea) -{ - if (!m_scrollableAreaSet) - m_scrollableAreaSet = adoptPtr(new ScrollableAreaSet); - m_scrollableAreaSet->add(scrollableArea); -} - -void Page::removeScrollableArea(ScrollableArea* scrollableArea) -{ - if (!m_scrollableAreaSet) - return; - m_scrollableAreaSet->remove(scrollableArea); -} - -bool Page::containsScrollableArea(ScrollableArea* scrollableArea) const -{ - if (!m_scrollableAreaSet) - return false; - return m_scrollableAreaSet->contains(scrollableArea); -} - #if !ASSERT_DISABLED void Page::checkFrameCountConsistency() const { diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h index 887893f9f..5f6e20649 100644 --- a/Source/WebCore/page/Page.h +++ b/Source/WebCore/page/Page.h @@ -133,8 +133,7 @@ namespace WebCore { RenderTheme* theme() const { return m_theme.get(); }; - ViewportArguments viewportArguments() const { return m_viewportArguments; } - void updateViewportArguments(); + ViewportArguments viewportArguments() const; static void refreshPlugins(bool reload); PluginData* pluginData() const; @@ -334,12 +333,6 @@ namespace WebCore { void setJavaScriptURLsAreAllowed(bool); bool javaScriptURLsAreAllowed() const; - typedef HashSet<ScrollableArea*> ScrollableAreaSet; - void addScrollableArea(ScrollableArea*); - void removeScrollableArea(ScrollableArea*); - bool containsScrollableArea(ScrollableArea*) const; - const ScrollableAreaSet* scrollableAreaSet() const { return m_scrollableAreaSet.get(); } - // Don't allow more than a certain number of frames in a page. // This seems like a reasonable upper bound, and otherwise mutually // recursive frameset pages can quickly bring the program to its knees @@ -464,12 +457,8 @@ namespace WebCore { ViewMode m_viewMode; - ViewportArguments m_viewportArguments; - double m_minimumTimerInterval; - OwnPtr<ScrollableAreaSet> m_scrollableAreaSet; - bool m_isEditable; #if ENABLE(PAGE_VISIBILITY_API) diff --git a/Source/WebCore/page/PageSerializer.cpp b/Source/WebCore/page/PageSerializer.cpp index 2c3778b46..64d901b7a 100644 --- a/Source/WebCore/page/PageSerializer.cpp +++ b/Source/WebCore/page/PageSerializer.cpp @@ -69,9 +69,9 @@ static bool isCharsetSpecifyingNode(Node* node) if (!element->hasTagName(HTMLNames::metaTag)) return false; HTMLMetaCharsetParser::AttributeList attributes; - if (const NamedNodeMap* attributesMap = element->updatedAttributes()) { - for (unsigned i = 0; i < attributesMap->length(); ++i) { - Attribute* item = attributesMap->attributeItem(i); + if (element->hasAttributes()) { + for (unsigned i = 0; i < element->attributeCount(); ++i) { + Attribute* item = element->attributeItem(i); // FIXME: We should deal appropriately with the attribute if they have a namespace. attributes.append(make_pair(item->name().toString(), item->value().string())); } @@ -227,7 +227,7 @@ void PageSerializer::serializeFrame(Frame* frame) Element* element = toElement(node); // We have to process in-line style as it might contain some resources (typically background images). if (element->isStyledElement()) - retrieveResourcesForCSSDeclaration(static_cast<StyledElement*>(element)->inlineStyleDecl()); + retrieveResourcesForCSSDeclaration(static_cast<StyledElement*>(element)->inlineStyleDecl(), document); if (element->hasTagName(HTMLNames::imgTag)) { HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(element); @@ -263,10 +263,10 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KUR if (i < styleSheet->length() - 1) cssText.append("\n\n"); } + Document* document = styleSheet->findDocument(); // Some rules have resources associated with them that we need to retrieve. if (rule->isImportRule()) { - CSSImportRule* importRule = static_cast<CSSImportRule*>(rule); - Document* document = styleSheet->findDocument(); + CSSImportRule* importRule = static_cast<CSSImportRule*>(rule); KURL importURL = document->completeURL(importRule->href()); if (m_resourceURLs.contains(importURL)) continue; @@ -275,7 +275,7 @@ void PageSerializer::serializeCSSStyleSheet(CSSStyleSheet* styleSheet, const KUR // FIXME: Add support for font face rule. It is not clear to me at this point if the actual otf/eot file can // be retrieved from the CSSFontFaceRule object. } else if (rule->isStyleRule()) - retrieveResourcesForCSSRule(static_cast<CSSStyleRule*>(rule)); + retrieveResourcesForCSSRule(static_cast<CSSStyleRule*>(rule), document); } if (url.isValid() && !m_resourceURLs.contains(url)) { @@ -302,19 +302,16 @@ void PageSerializer::addImageToResources(CachedImage* image, RenderObject* image m_resourceURLs.add(url); } -void PageSerializer::retrieveResourcesForCSSRule(CSSStyleRule* rule) +void PageSerializer::retrieveResourcesForCSSRule(CSSStyleRule* rule, Document* document) { - retrieveResourcesForCSSDeclaration(rule->declaration()); + retrieveResourcesForCSSDeclaration(rule->declaration(), document); } -void PageSerializer::retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclaration* styleDeclaration) +void PageSerializer::retrieveResourcesForCSSDeclaration(StylePropertySet* styleDeclaration, Document* document) { if (!styleDeclaration) return; - CSSStyleSheet* cssStyleSheet = styleDeclaration->parentStyleSheet(); - ASSERT(cssStyleSheet); - // The background-image and list-style-image (for ul or ol) are the CSS properties // that make use of images. We iterate to make sure we include any other // image properties there might be. @@ -332,7 +329,6 @@ void PageSerializer::retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclarati CachedImage* image = static_cast<StyleCachedImage*>(styleImage)->cachedImage(); - Document* document = cssStyleSheet->findDocument(); KURL url = document->completeURL(image->url()); addImageToResources(image, 0, url); } diff --git a/Source/WebCore/page/PageSerializer.h b/Source/WebCore/page/PageSerializer.h index d92ef20ab..a900f150a 100644 --- a/Source/WebCore/page/PageSerializer.h +++ b/Source/WebCore/page/PageSerializer.h @@ -41,12 +41,13 @@ namespace WebCore { class CachedImage; -class CSSMutableStyleDeclaration; class CSSStyleRule; class CSSStyleSheet; +class Document; class Frame; class Page; class RenderObject; +class StylePropertySet; // This class is used to serialize a page contents back to text (typically HTML). // It serializes all the page frames and retrieves resources such as images and CSS stylesheets. @@ -77,8 +78,8 @@ private: void serializeCSSStyleSheet(CSSStyleSheet*, const KURL&); void addImageToResources(CachedImage*, RenderObject*, const KURL&); - void retrieveResourcesForCSSDeclaration(CSSMutableStyleDeclaration*); - void retrieveResourcesForCSSRule(CSSStyleRule*); + void retrieveResourcesForCSSDeclaration(StylePropertySet*, Document*); + void retrieveResourcesForCSSRule(CSSStyleRule*, Document*); Vector<Resource>* m_resources; ListHashSet<KURL> m_resourceURLs; diff --git a/Source/WebCore/page/PrintContext.cpp b/Source/WebCore/page/PrintContext.cpp index abb417128..0af0bb576 100644 --- a/Source/WebCore/page/PrintContext.cpp +++ b/Source/WebCore/page/PrintContext.cpp @@ -249,8 +249,8 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi scaledPageSize.scale(frame->view()->contentsSize().width() / pageRect.width()); printContext.computePageRectsWithPageSize(scaledPageSize, false); - int top = box->offsetTop(); - int left = box->offsetLeft(); + int top = box->pixelSnappedOffsetTop(); + int left = box->pixelSnappedOffsetLeft(); size_t pageNumber = 0; for (; pageNumber < printContext.pageCount(); pageNumber++) { const IntRect& page = printContext.pageRect(pageNumber); diff --git a/Source/WebCore/page/Screen.idl b/Source/WebCore/page/Screen.idl index 4471617b1..588060914 100644 --- a/Source/WebCore/page/Screen.idl +++ b/Source/WebCore/page/Screen.idl @@ -30,7 +30,7 @@ module window { interface [ - GenerateIsReachable=ImplFrame, + JSGenerateIsReachable=ImplFrame, OmitConstructor ] Screen { readonly attribute unsigned long height; diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 599cb3110..b5cb963bb 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -189,6 +189,7 @@ Settings::Settings(Page* page) , m_showRepaintCounter(false) , m_experimentalNotificationsEnabled(false) , m_webGLEnabled(false) + , m_webGLErrorsToConsoleEnabled(false) , m_openGLMultisamplingEnabled(true) , m_privilegedWebGLExtensionsEnabled(false) , m_webAudioEnabled(false) @@ -240,6 +241,9 @@ Settings::Settings(Page* page) , m_scrollingCoordinatorEnabled(false) #endif , m_notificationsEnabled(true) +#if ENABLE(TOUCH_EVENTS) + , m_touchEventEmulationEnabled(false) +#endif , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired) { // A Frame may not have been created yet, so we initialize the AtomicString @@ -803,6 +807,11 @@ void Settings::setWebGLEnabled(bool enabled) m_webGLEnabled = enabled; } +void Settings::setWebGLErrorsToConsoleEnabled(bool enabled) +{ + m_webGLErrorsToConsoleEnabled = enabled; +} + void Settings::setOpenGLMultisamplingEnabled(bool enabled) { m_openGLMultisamplingEnabled = enabled; diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 5ef8eea7f..3a1406601 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -357,6 +357,9 @@ namespace WebCore { void setWebGLEnabled(bool); bool webGLEnabled() const { return m_webGLEnabled; } + void setWebGLErrorsToConsoleEnabled(bool); + bool webGLErrorsToConsoleEnabled() const { return m_webGLErrorsToConsoleEnabled; } + void setOpenGLMultisamplingEnabled(bool); bool openGLMultisamplingEnabled() const { return m_openGLMultisamplingEnabled; } @@ -523,6 +526,11 @@ namespace WebCore { void setNotificationsEnabled(bool enabled) { m_notificationsEnabled = enabled; } bool notificationsEnabled() const { return m_notificationsEnabled; } +#if ENABLE(TOUCH_EVENTS) + void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; } + bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; } +#endif + private: Settings(Page*); @@ -618,6 +626,7 @@ namespace WebCore { bool m_showRepaintCounter : 1; bool m_experimentalNotificationsEnabled : 1; bool m_webGLEnabled : 1; + bool m_webGLErrorsToConsoleEnabled : 1; bool m_openGLMultisamplingEnabled : 1; bool m_privilegedWebGLExtensionsEnabled : 1; bool m_webAudioEnabled : 1; @@ -669,6 +678,10 @@ namespace WebCore { bool m_notificationsEnabled : 1; +#if ENABLE(TOUCH_EVENTS) + bool m_touchEventEmulationEnabled : 1; +#endif + Timer<Settings> m_loadsImagesAutomaticallyTimer; void loadsImagesAutomaticallyTimerFired(Timer<Settings>*); diff --git a/Source/WebCore/page/SpeechInputResultList.idl b/Source/WebCore/page/SpeechInputResultList.idl index 5a23d4f02..b9213d002 100644 --- a/Source/WebCore/page/SpeechInputResultList.idl +++ b/Source/WebCore/page/SpeechInputResultList.idl @@ -26,7 +26,7 @@ module core { interface [ - HasIndexGetter, + IndexedGetter, Conditional=INPUT_SPEECH ] SpeechInputResultList { readonly attribute unsigned long length; diff --git a/Source/WebCore/page/WebKitAnimation.cpp b/Source/WebCore/page/WebKitAnimation.cpp index b757d2317..98e77367c 100644 --- a/Source/WebCore/page/WebKitAnimation.cpp +++ b/Source/WebCore/page/WebKitAnimation.cpp @@ -84,9 +84,18 @@ bool WebKitAnimation::ended() const WebKitAnimation::Direction WebKitAnimation::direction() const { - if (m_keyframeAnimation->animation()->direction() == Animation::AnimationDirectionNormal) + switch (m_keyframeAnimation->animation()->direction()) { + case Animation::AnimationDirectionNormal: return DIRECTION_NORMAL; - return DIRECTION_ALTERNATE; + case Animation::AnimationDirectionAlternate: + return DIRECTION_ALTERNATE; + case Animation::AnimationDirectionReverse: + return DIRECTION_REVERSE; + case Animation::AnimationDirectionAlternateReverse: + return DIRECTION_ALTERNATE_REVERSE; + } + ASSERT_NOT_REACHED(); + return DIRECTION_NORMAL; } WebKitAnimation::FillMode WebKitAnimation::fillMode() const diff --git a/Source/WebCore/page/WebKitAnimation.h b/Source/WebCore/page/WebKitAnimation.h index 6bea1e5d4..bef74382a 100644 --- a/Source/WebCore/page/WebKitAnimation.h +++ b/Source/WebCore/page/WebKitAnimation.h @@ -59,7 +59,7 @@ public: bool ended() const; // direction - enum Direction { DIRECTION_NORMAL, DIRECTION_ALTERNATE }; + enum Direction { DIRECTION_NORMAL, DIRECTION_ALTERNATE, DIRECTION_REVERSE, DIRECTION_ALTERNATE_REVERSE }; Direction direction() const; // fill mode diff --git a/Source/WebCore/page/WebKitAnimationList.idl b/Source/WebCore/page/WebKitAnimationList.idl index 72172a70a..ed305f792 100644 --- a/Source/WebCore/page/WebKitAnimationList.idl +++ b/Source/WebCore/page/WebKitAnimationList.idl @@ -26,7 +26,7 @@ module html { interface [ - HasIndexGetter + IndexedGetter ] WebKitAnimationList { readonly attribute unsigned long length; WebKitAnimation item(in unsigned long index); diff --git a/Source/WebCore/page/WorkerNavigator.idl b/Source/WebCore/page/WorkerNavigator.idl index 1544f155e..819de09d6 100644 --- a/Source/WebCore/page/WorkerNavigator.idl +++ b/Source/WebCore/page/WorkerNavigator.idl @@ -30,8 +30,8 @@ module threads { interface [ Conditional=WORKERS, - GenerateIsReachable=Impl, - NoStaticTables, + JSGenerateIsReachable=Impl, + JSNoStaticTables, OmitConstructor ] WorkerNavigator { readonly attribute DOMString appName; diff --git a/Source/WebCore/page/animation/AnimationBase.cpp b/Source/WebCore/page/animation/AnimationBase.cpp index e3ad92fa0..4fd0409ec 100644 --- a/Source/WebCore/page/animation/AnimationBase.cpp +++ b/Source/WebCore/page/animation/AnimationBase.cpp @@ -1673,7 +1673,9 @@ double AnimationBase::fractionalTime(double scale, double elapsedTime, double of integralTime = min(integralTime, m_animation->iterationCount() - 1); fractionalTime -= integralTime; - if ((m_animation->direction() == Animation::AnimationDirectionAlternate) && (integralTime & 1)) + if (((m_animation->direction() == Animation::AnimationDirectionAlternate) && (integralTime & 1)) + || ((m_animation->direction() == Animation::AnimationDirectionAlternateReverse) && !(integralTime & 1)) + || m_animation->direction() == Animation::AnimationDirectionReverse) fractionalTime = 1 - fractionalTime; if (scale != 1 || offset) diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp b/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp index c83bcb4aa..e569b2c25 100644 --- a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp +++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp @@ -34,7 +34,11 @@ #include "IntRect.h" #include "Page.h" #include "PlatformWheelEvent.h" +#include "Region.h" #include "ScrollAnimator.h" +#include "ScrollingThread.h" +#include "ScrollingTree.h" +#include "ScrollingTreeState.h" #include <wtf/Functional.h> #include <wtf/MainThread.h> #include <wtf/PassRefPtr.h> @@ -48,19 +52,31 @@ PassRefPtr<ScrollingCoordinator> ScrollingCoordinator::create(Page* page) ScrollingCoordinator::ScrollingCoordinator(Page* page) : m_page(page) - , m_didDispatchDidUpdateMainFrameScrollPosition(false) + , m_scrollingTree(ScrollingTree::create(this)) + , m_scrollingTreeState(ScrollingTreeState::create()) + , m_scrollingTreeStateCommitterTimer(this, &ScrollingCoordinator::scrollingTreeStateCommitterTimerFired) { } ScrollingCoordinator::~ScrollingCoordinator() { ASSERT(!m_page); + ASSERT(!m_scrollingTree); } void ScrollingCoordinator::pageDestroyed() { ASSERT(m_page); m_page = 0; + + // Invalidating the scrolling tree will break the reference cycle between the ScrollingCoordinator and ScrollingTree objects. + ScrollingThread::dispatch(bind(&ScrollingTree::invalidate, m_scrollingTree.release())); +} + +ScrollingTree* ScrollingCoordinator::scrollingTree() const +{ + ASSERT(m_scrollingTree); + return m_scrollingTree.get(); } bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const @@ -75,78 +91,103 @@ bool ScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView return true; } -void ScrollingCoordinator::syncFrameViewGeometry(FrameView* frameView) +void ScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView) { ASSERT(isMainThread()); ASSERT(m_page); - if (frameView->frame() != m_page->mainFrame()) + if (!coordinatesScrollingForFrameView(frameView)) return; - IntRect visibleContentRect = frameView->visibleContentRect(); - IntSize contentsSize = frameView->contentsSize(); + // Compute the region of the page that we can't do fast scrolling for. This currently includes + // all scrollable areas, such as subframes, overflow divs and list boxes. + Region nonScrollableRegion; + if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) { + for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) { + ScrollableArea* scrollableArea = *it; - MutexLocker locker(m_mainFrameGeometryMutex); - if (m_mainFrameVisibleContentRect == visibleContentRect && m_mainFrameContentsSize == contentsSize) - return; + // Check if this area can be scrolled at all. + if ((!scrollableArea->horizontalScrollbar() || !scrollableArea->horizontalScrollbar()->enabled()) + && (!scrollableArea->verticalScrollbar() || !scrollableArea->verticalScrollbar()->enabled())) + continue; - m_mainFrameVisibleContentRect = visibleContentRect; - m_mainFrameContentsSize = contentsSize; + nonScrollableRegion.unite(scrollableArea->scrollableAreaBoundingBox()); + } + } - // FIXME: Inform the scrolling thread that the frame geometry has changed. + m_scrollingTreeState->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size())); + m_scrollingTreeState->setContentsSize(frameView->contentsSize()); + m_scrollingTreeState->setNonFastScrollableRegion(nonScrollableRegion); + scheduleTreeStateCommit(); } -bool ScrollingCoordinator::handleWheelEvent(const PlatformWheelEvent& wheelEvent) +void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView*) { - // FIXME: Check for wheel event handlers. - // FIXME: Check if we're over a subframe or overflow div. - // FIXME: As soon as we've determined that we can handle the wheel event, we should do the - // bulk of the work on the scrolling thread and return from this function. - // FIXME: Handle rubberbanding. - float deltaX = wheelEvent.deltaX(); - float deltaY = wheelEvent.deltaY(); - - // Slightly prefer scrolling vertically by applying the = case to deltaY - if (fabsf(deltaY) >= fabsf(deltaX)) - deltaX = 0; - else - deltaY = 0; - - IntSize scrollOffset = IntSize(-deltaX, -deltaY); - dispatchOnScrollingThread(bind(&ScrollingCoordinator::scrollByOnScrollingThread, this, scrollOffset)); - return true; -} + ASSERT(isMainThread()); + ASSERT(m_page); -#if ENABLE(GESTURE_EVENTS) -bool ScrollingCoordinator::handleGestureEvent(const PlatformGestureEvent&) -{ - // FIXME: Implement. - return false; + recomputeWheelEventHandlerCount(); } -#endif -void ScrollingCoordinator::didUpdateMainFrameScrollPosition() +void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition) { ASSERT(isMainThread()); if (!m_page) return; - IntPoint scrollPosition; + FrameView* frameView = m_page->mainFrame()->view(); + if (!frameView) + return; - { - MutexLocker locker(m_mainFrameGeometryMutex); - ASSERT(m_didDispatchDidUpdateMainFrameScrollPosition); + frameView->setConstrainsScrollingToContentEdge(false); + frameView->scrollToOffsetWithoutAnimation(scrollPosition); + frameView->setConstrainsScrollingToContentEdge(true); +} - scrollPosition = m_mainFrameScrollPosition; - m_didDispatchDidUpdateMainFrameScrollPosition = false; +void ScrollingCoordinator::recomputeWheelEventHandlerCount() +{ + unsigned wheelEventHandlerCount = 0; + for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { + if (frame->document()) + wheelEventHandlerCount += frame->document()->wheelEventHandlerCount(); } - if (FrameView* frameView = m_page->mainFrame()->view()) { - frameView->setConstrainsScrollingToContentEdge(false); - frameView->scrollToOffsetWithoutAnimation(scrollPosition); - frameView->setConstrainsScrollingToContentEdge(true); - } + m_scrollingTreeState->setWheelEventHandlerCount(wheelEventHandlerCount); + scheduleTreeStateCommit(); +} + +void ScrollingCoordinator::scheduleTreeStateCommit() +{ + if (m_scrollingTreeStateCommitterTimer.isActive()) + return; + + if (!m_scrollingTreeState->hasChangedProperties()) + return; + + m_scrollingTreeStateCommitterTimer.startOneShot(0); +} + +void ScrollingCoordinator::scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*) +{ + commitTreeState(); +} + +void ScrollingCoordinator::commitTreeStateIfNeeded() +{ + if (!m_scrollingTreeState->hasChangedProperties()) + return; + + commitTreeState(); + m_scrollingTreeStateCommitterTimer.stop(); +} + +void ScrollingCoordinator::commitTreeState() +{ + ASSERT(m_scrollingTreeState->hasChangedProperties()); + + OwnPtr<ScrollingTreeState> treeState = m_scrollingTreeState->commit(); + ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release())); } } // namespace WebCore diff --git a/Source/WebCore/page/scrolling/ScrollingCoordinator.h b/Source/WebCore/page/scrolling/ScrollingCoordinator.h index e295d8031..eb597b8b0 100644 --- a/Source/WebCore/page/scrolling/ScrollingCoordinator.h +++ b/Source/WebCore/page/scrolling/ScrollingCoordinator.h @@ -30,6 +30,7 @@ #include "GraphicsLayer.h" #include "IntRect.h" +#include "Timer.h" #include <wtf/Forward.h> #include <wtf/ThreadSafeRefCounted.h> #include <wtf/Threading.h> @@ -44,6 +45,8 @@ class FrameView; class GraphicsLayer; class Page; class PlatformWheelEvent; +class ScrollingTree; +class ScrollingTreeState; #if ENABLE(GESTURE_EVENTS) class PlatformGestureEvent; @@ -56,9 +59,18 @@ public: void pageDestroyed(); + ScrollingTree* scrollingTree() const; + // Return whether this scrolling coordinator handles scrolling for the given frame view. bool coordinatesScrollingForFrameView(FrameView*) const; + // Should be called whenever the given frame view has been laid out. + void frameViewLayoutUpdated(FrameView*); + + // Should be called whenever a wheel event handler is added or removed in the + // frame view's underlying document. + void frameViewWheelEventHandlerCountChanged(FrameView*); + // Should be called whenever the scroll layer for the given frame view changes. void frameViewScrollLayerDidChange(FrameView*, const GraphicsLayer*); @@ -68,49 +80,24 @@ public: // Should be called whenever the horizontal scrollbar layer for the given frame view changes. void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer* verticalScrollbarLayer); - // Should be called whenever the geometry of the given frame view changes, - // including the visible content rect and the content size. - void syncFrameViewGeometry(FrameView*); - - // Can be called from any thread. Will try to handle the wheel event on the scrolling thread, - // and return false if the event must be sent again to the WebCore event handler. - bool handleWheelEvent(const PlatformWheelEvent&); - -#if ENABLE(GESTURE_EVENTS) - // Can be called from any thread. Will try to handle the gesture event on the scrolling thread, - // and return false if the event must be sent again to the WebCore event handler. - bool handleGestureEvent(const PlatformGestureEvent&); -#endif + // Dispatched by the scrolling tree whenever the main frame scroll position changes. + void updateMainFrameScrollPosition(const IntPoint&); private: explicit ScrollingCoordinator(Page*); - // FIXME: Once we have a proper thread/run loop abstraction we should get rid of these - // functions and just use something like scrollingRunLoop()->dispatch(function); - static bool isScrollingThread(); - static void dispatchOnScrollingThread(const Function<void()>&); + void recomputeWheelEventHandlerCount(); - // The following functions can only be called from the main thread. - void didUpdateMainFrameScrollPosition(); + void scheduleTreeStateCommit(); + void scrollingTreeStateCommitterTimerFired(Timer<ScrollingCoordinator>*); + void commitTreeStateIfNeeded(); + void commitTreeState(); - // The following functions can only be called from the scrolling thread. - void scrollByOnScrollingThread(const IntSize& offset); - - // This function must be called with the main frame geometry mutex held. - void updateMainFrameScrollLayerPositionOnScrollingThread(const FloatPoint&); - -private: Page* m_page; + RefPtr<ScrollingTree> m_scrollingTree; - Mutex m_mainFrameGeometryMutex; - IntRect m_mainFrameVisibleContentRect; - IntSize m_mainFrameContentsSize; -#if PLATFORM(MAC) - RetainPtr<PlatformLayer> m_mainFrameScrollLayer; -#endif - - bool m_didDispatchDidUpdateMainFrameScrollPosition; - IntPoint m_mainFrameScrollPosition; + OwnPtr<ScrollingTreeState> m_scrollingTreeState; + Timer<ScrollingCoordinator> m_scrollingTreeStateCommitterTimer; }; } // namespace WebCore diff --git a/Source/WebCore/page/scrolling/ScrollingThread.cpp b/Source/WebCore/page/scrolling/ScrollingThread.cpp new file mode 100644 index 000000000..fc5a405da --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingThread.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingThread.h" + +#if ENABLE(THREADED_SCROLLING) + +namespace WebCore { + +ScrollingThread::ScrollingThread() + : m_threadIdentifier(0) +{ +} + +bool ScrollingThread::isCurrentThread() +{ + if (!shared().m_threadIdentifier) + return false; + + return currentThread() == shared().m_threadIdentifier; +} + +void ScrollingThread::dispatch(const Function<void()>& function) +{ + shared().createThreadIfNeeded(); + + { + MutexLocker locker(shared().m_functionsMutex); + shared().m_functions.append(function); + } + + shared().wakeUpRunLoop(); +} + +ScrollingThread& ScrollingThread::shared() +{ + DEFINE_STATIC_LOCAL(ScrollingThread, scrollingThread, ()); + return scrollingThread; +} + +void ScrollingThread::createThreadIfNeeded() +{ + if (m_threadIdentifier) + return; + + m_threadIdentifier = createThread(threadCallback, this, "WebCore: Scrolling"); + + // Wait for the thread to initialize the run loop. + { + MutexLocker locker(m_initializeRunLoopConditionMutex); + + while (!m_threadRunLoop) + m_initializeRunLoopCondition.wait(m_initializeRunLoopConditionMutex); + } +} + +void* ScrollingThread::threadCallback(void* scrollingThread) +{ + static_cast<ScrollingThread*>(scrollingThread)->threadBody(); + + return 0; +} + +void ScrollingThread::threadBody() +{ + ASSERT(isCurrentThread()); + + initializeRunLoop(); +} + +void ScrollingThread::dispatchFunctionsFromScrollingThread() +{ + ASSERT(isCurrentThread()); + + Vector<Function<void()> > functions; + + { + MutexLocker locker(m_functionsMutex); + m_functions.swap(functions); + } + + for (size_t i = 0; i < functions.size(); ++i) + functions[i](); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingThread.h b/Source/WebCore/page/scrolling/ScrollingThread.h new file mode 100644 index 000000000..22671e4f5 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingThread.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollingThread_h +#define ScrollingThread_h + +#if ENABLE(THREADED_SCROLLING) + +#include <wtf/Functional.h> +#include <wtf/Noncopyable.h> +#include <wtf/Threading.h> +#include <wtf/Vector.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + +namespace WebCore { + +class ScrollingThread { + WTF_MAKE_NONCOPYABLE(ScrollingThread); + +public: + static bool isCurrentThread(); + static void dispatch(const Function<void()>&); + +private: + ScrollingThread(); + + static ScrollingThread& shared(); + + void createThreadIfNeeded(); + static void* threadCallback(void* scrollingThread); + void threadBody(); + void dispatchFunctionsFromScrollingThread(); + + void initializeRunLoop(); + void wakeUpRunLoop(); + +#if PLATFORM(MAC) + static void threadRunLoopSourceCallback(void* scrollingThread); + void threadRunLoopSourceCallback(); +#endif + + ThreadIdentifier m_threadIdentifier; + + ThreadCondition m_initializeRunLoopCondition; + Mutex m_initializeRunLoopConditionMutex; + + Mutex m_functionsMutex; + Vector<Function<void()> > m_functions; + +#if PLATFORM(MAC) + // FIXME: We should use WebCore::RunLoop here. + RetainPtr<CFRunLoopRef> m_threadRunLoop; + RetainPtr<CFRunLoopSourceRef> m_threadRunLoopSource; +#endif +}; + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) + +#endif // ScrollingThread_h diff --git a/Source/WebCore/page/scrolling/ScrollingTree.cpp b/Source/WebCore/page/scrolling/ScrollingTree.cpp new file mode 100644 index 000000000..bc1c50d9f --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTree.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTree.h" + +#if ENABLE(THREADED_SCROLLING) + +#include "PlatformWheelEvent.h" +#include "ScrollingCoordinator.h" +#include "ScrollingThread.h" +#include "ScrollingTreeNode.h" +#include "ScrollingTreeState.h" +#include <wtf/MainThread.h> + +namespace WebCore { + +PassRefPtr<ScrollingTree> ScrollingTree::create(ScrollingCoordinator* scrollingCoordinator) +{ + return adoptRef(new ScrollingTree(scrollingCoordinator)); +} + +ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator) + : m_scrollingCoordinator(scrollingCoordinator) + , m_rootNode(ScrollingTreeNode::create(this)) + , m_hasWheelEventHandlers(false) +{ +} + +ScrollingTree::~ScrollingTree() +{ + ASSERT(!m_scrollingCoordinator); +} + +bool ScrollingTree::tryToHandleWheelEvent(const PlatformWheelEvent& wheelEvent) +{ + { + MutexLocker lock(m_mutex); + + if (m_hasWheelEventHandlers) + return false; + + if (!m_nonFastScrollableRegion.isEmpty()) { + // FIXME: This is not correct for non-default scroll origins. + IntPoint position = wheelEvent.position(); + position.moveBy(m_mainFrameScrollPosition); + if (m_nonFastScrollableRegion.contains(position)) + return false; + } + } + + ScrollingThread::dispatch(bind(&ScrollingTree::handleWheelEvent, this, wheelEvent)); + return true; +} + +void ScrollingTree::handleWheelEvent(const PlatformWheelEvent& wheelEvent) +{ + ASSERT(ScrollingThread::isCurrentThread()); + + m_rootNode->handleWheelEvent(wheelEvent); +} + +void ScrollingTree::invalidate() +{ + // Invalidate is dispatched by the ScrollingCoordinator class on the ScrollingThread + // to break the reference cycle between ScrollingTree and ScrollingCoordinator when the + // ScrollingCoordinator's page is destroyed. + ASSERT(ScrollingThread::isCurrentThread()); + m_scrollingCoordinator = nullptr; +} + +void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingTreeState> scrollingTreeState) +{ + ASSERT(ScrollingThread::isCurrentThread()); + + if (scrollingTreeState->changedProperties() & (ScrollingTreeState::WheelEventHandlerCount | ScrollingTreeState::NonFastScrollableRegion)) { + MutexLocker lock(m_mutex); + + if (scrollingTreeState->changedProperties() & ScrollingTreeState::WheelEventHandlerCount) + m_hasWheelEventHandlers = scrollingTreeState->wheelEventHandlerCount(); + if (scrollingTreeState->changedProperties() & ScrollingTreeState::NonFastScrollableRegion) + m_nonFastScrollableRegion = scrollingTreeState->nonFastScrollableRegion(); + } + + m_rootNode->update(scrollingTreeState.get()); +} + +void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition) +{ + if (!m_scrollingCoordinator) + return; + + { + MutexLocker lock(m_mutex); + m_mainFrameScrollPosition = scrollPosition; + } + + callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition)); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingTree.h b/Source/WebCore/page/scrolling/ScrollingTree.h new file mode 100644 index 000000000..76cbfda0a --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTree.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollingTree_h +#define ScrollingTree_h + +#if ENABLE(THREADED_SCROLLING) + +#include "Region.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/PassRefPtr.h> +#include <wtf/RefPtr.h> +#include <wtf/ThreadSafeRefCounted.h> + +namespace WebCore { + +class IntPoint; +class PlatformWheelEvent; +class ScrollingCoordinator; +class ScrollingTreeNode; +class ScrollingTreeState; + +// The ScrollingTree class lives almost exclusively on the scrolling thread and manages the +// hierarchy of scrollable regions on the page. It's also responsible for dispatching events +// to the correct scrolling tree nodes or dispatching events back to the ScrollingCoordinator +// object on the main thread if they can't be handled on the scrolling thread for various reasons. +class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> { +public: + static PassRefPtr<ScrollingTree> create(ScrollingCoordinator*); + ~ScrollingTree(); + + // Can be called from any thread. Will try to handle the wheel event on the scrolling thread. + // Returns true if the wheel event can be handled on the scrolling thread and false if the + // event must be sent again to the WebCore event handler. + bool tryToHandleWheelEvent(const PlatformWheelEvent&); + + // Must be called from the scrolling thread. Handles the wheel event. + void handleWheelEvent(const PlatformWheelEvent&); + + void invalidate(); + void commitNewTreeState(PassOwnPtr<ScrollingTreeState>); + + void updateMainFrameScrollPosition(const IntPoint& scrollPosition); + +private: + explicit ScrollingTree(ScrollingCoordinator*); + + RefPtr<ScrollingCoordinator> m_scrollingCoordinator; + OwnPtr<ScrollingTreeNode> m_rootNode; + + Mutex m_mutex; + Region m_nonFastScrollableRegion; + IntPoint m_mainFrameScrollPosition; + bool m_hasWheelEventHandlers; +}; + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) + +#endif // ScrollingTree_h diff --git a/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp new file mode 100644 index 000000000..bd94f00dc --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTreeNode.h" + +#if ENABLE(THREADED_SCROLLING) + +#include "ScrollingTreeState.h" + +namespace WebCore { + +ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree) + : m_scrollingTree(scrollingTree) +{ +} + +ScrollingTreeNode::~ScrollingTreeNode() +{ +} + +void ScrollingTreeNode::update(ScrollingTreeState* state) +{ + if (state->changedProperties() & ScrollingTreeState::ViewportRect) + m_viewportRect = state->viewportRect(); + + if (state->changedProperties() & ScrollingTreeState::ContentsSize) + m_contentsSize = state->contentsSize(); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingTreeNode.h b/Source/WebCore/page/scrolling/ScrollingTreeNode.h new file mode 100644 index 000000000..d26293a89 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTreeNode.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollingTreeNode_h +#define ScrollingTreeNode_h + +#if ENABLE(THREADED_SCROLLING) + +#include "IntRect.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +class PlatformWheelEvent; +class ScrollingTree; +class ScrollingTreeState; + +class ScrollingTreeNode { +public: + static PassOwnPtr<ScrollingTreeNode> create(ScrollingTree*); + virtual ~ScrollingTreeNode(); + + virtual void update(ScrollingTreeState*); + virtual void handleWheelEvent(const PlatformWheelEvent&) = 0; + +protected: + explicit ScrollingTreeNode(ScrollingTree*); + + ScrollingTree* scrollingTree() const { return m_scrollingTree; } + const IntRect& viewportRect() const { return m_viewportRect; } + const IntSize& contentsSize() const { return m_contentsSize; } + +private: + ScrollingTree* m_scrollingTree; + + IntRect m_viewportRect; + IntSize m_contentsSize; +}; + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) + +#endif // ScrollingTreeNode_h diff --git a/Source/WebCore/page/scrolling/ScrollingTreeState.cpp b/Source/WebCore/page/scrolling/ScrollingTreeState.cpp new file mode 100644 index 000000000..c368152c3 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTreeState.cpp @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTreeState.h" + +#if ENABLE(THREADED_SCROLLING) + +namespace WebCore { + +PassOwnPtr<ScrollingTreeState> ScrollingTreeState::create() +{ + return adoptPtr(new ScrollingTreeState); +} + +ScrollingTreeState::ScrollingTreeState() + : m_changedProperties(0) + , m_wheelEventHandlerCount(0) +{ +} + +ScrollingTreeState::~ScrollingTreeState() +{ +} + +void ScrollingTreeState::setViewportRect(const IntRect& viewportRect) +{ + if (m_viewportRect == viewportRect) + return; + + m_viewportRect = viewportRect; + m_changedProperties |= ViewportRect; +} + +void ScrollingTreeState::setContentsSize(const IntSize& contentsSize) +{ + if (m_contentsSize == contentsSize) + return; + + m_contentsSize = contentsSize; + m_changedProperties |= ContentsSize; +} + +void ScrollingTreeState::setNonFastScrollableRegion(const Region& nonFastScrollableRegion) +{ + if (m_nonFastScrollableRegion == nonFastScrollableRegion) + return; + + m_nonFastScrollableRegion = nonFastScrollableRegion; + m_changedProperties |= NonFastScrollableRegion; +} + +void ScrollingTreeState::setWheelEventHandlerCount(unsigned wheelEventHandlerCount) +{ + if (m_wheelEventHandlerCount == wheelEventHandlerCount) + return; + + m_wheelEventHandlerCount = wheelEventHandlerCount; + m_changedProperties |= WheelEventHandlerCount; +} + +PassOwnPtr<ScrollingTreeState> ScrollingTreeState::commit() +{ + OwnPtr<ScrollingTreeState> treeState = adoptPtr(new ScrollingTreeState(*this)); + m_changedProperties = 0; + + return treeState.release(); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/ScrollingTreeState.h b/Source/WebCore/page/scrolling/ScrollingTreeState.h new file mode 100644 index 000000000..fde884922 --- /dev/null +++ b/Source/WebCore/page/scrolling/ScrollingTreeState.h @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollingTreeState_h +#define ScrollingTreeState_h + +#if ENABLE(THREADED_SCROLLING) + +#include "GraphicsLayer.h" +#include "IntRect.h" +#include "Region.h" +#include <wtf/PassOwnPtr.h> + +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif + +namespace WebCore { + +// The ScrollingTreeState object keeps track of the current state of scrolling related properties. +// Whenever any properties change, the scrolling coordinator will be informed and will update the state +// and schedule a timer that will clone the new state and send it over to the scrolling thread, avoiding locking. +// FIXME: Once we support fast scrolling in subframes, this will have to become a tree-like structure. +class ScrollingTreeState { +public: + static PassOwnPtr<ScrollingTreeState> create(); + ~ScrollingTreeState(); + + enum ChangedProperty { + ViewportRect = 1 << 0, + ContentsSize = 1 << 1, + NonFastScrollableRegion = 1 << 2, + WheelEventHandlerCount = 1 << 3, + ScrollLayer = 1 << 4, + }; + + bool hasChangedProperties() const { return m_changedProperties; } + unsigned changedProperties() const { return m_changedProperties; } + + const IntRect& viewportRect() const { return m_viewportRect; } + void setViewportRect(const IntRect&); + + const IntSize& contentsSize() const { return m_contentsSize; } + void setContentsSize(const IntSize&); + + const Region& nonFastScrollableRegion() const { return m_nonFastScrollableRegion; } + void setNonFastScrollableRegion(const Region&); + + unsigned wheelEventHandlerCount() const { return m_wheelEventHandlerCount; } + void setWheelEventHandlerCount(unsigned); + + PlatformLayer* platformScrollLayer() const; + void setScrollLayer(const GraphicsLayer*); + + // Copies the current tree state and clears the changed properties mask in the original. + PassOwnPtr<ScrollingTreeState> commit(); + +private: + ScrollingTreeState(); + + unsigned m_changedProperties; + + IntRect m_viewportRect; + IntSize m_contentsSize; + + Region m_nonFastScrollableRegion; + + unsigned m_wheelEventHandlerCount; + +#if PLATFORM(MAC) + RetainPtr<PlatformLayer> m_platformScrollLayer; +#endif + +}; + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) + +#endif // ScrollingTreeState_h diff --git a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm index 00535d2b9..31fa76683 100644 --- a/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm +++ b/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm @@ -31,6 +31,8 @@ #import "FrameView.h" #import "Page.h" +#import "ScrollingThread.h" +#import "ScrollingTreeState.h" #import <QuartzCore/QuartzCore.h> #import <wtf/Functional.h> #import <wtf/MainThread.h> @@ -40,127 +42,6 @@ namespace WebCore { -class ScrollingThread { -public: - ScrollingThread() - : m_threadIdentifier(0) - { - } - - bool isCurrentThread() const; - void dispatch(const Function<void()>&); - -private: - void createThreadIfNeeded(); - - static void* threadCallback(void* scrollingThread); - void threadBody(); - - static void threadRunLoopSourceCallback(void* scrollingThread); - void threadRunLoopSourceCallback(); - - ThreadIdentifier m_threadIdentifier; - - ThreadCondition m_initializeRunLoopCondition; - Mutex m_initializeRunLoopConditionMutex; - - RetainPtr<CFRunLoopRef> m_threadRunLoop; - RetainPtr<CFRunLoopSourceRef> m_threadRunLoopSource; - - Mutex m_functionsMutex; - Vector<Function<void()> > m_functions; -}; - -bool ScrollingThread::isCurrentThread() const -{ - if (!m_threadIdentifier) - return false; - - return currentThread() == m_threadIdentifier; -} - -void ScrollingThread::createThreadIfNeeded() -{ - if (m_threadIdentifier) - return; - - m_threadIdentifier = createThread(threadCallback, this, "WebCore: Scrolling"); - - // Wait for the thread to initialize the run loop. - { - MutexLocker locker(m_initializeRunLoopConditionMutex); - - while (!m_threadRunLoop) - m_initializeRunLoopCondition.wait(m_initializeRunLoopConditionMutex); - } -} - -void* ScrollingThread::threadCallback(void* scrollingThread) -{ - static_cast<ScrollingThread*>(scrollingThread)->threadBody(); - - return 0; -} - -void ScrollingThread::threadBody() -{ - ASSERT(isCurrentThread()); - - // Initialize the run loop. - { - MutexLocker locker(m_initializeRunLoopConditionMutex); - - m_threadRunLoop = CFRunLoopGetCurrent(); - - CFRunLoopSourceContext context = { 0, this, 0, 0, 0, 0, 0, 0, 0, threadRunLoopSourceCallback }; - m_threadRunLoopSource = adoptCF(CFRunLoopSourceCreate(0, 0, &context)); - CFRunLoopAddSource(CFRunLoopGetCurrent(), m_threadRunLoopSource.get(), kCFRunLoopDefaultMode); - - m_initializeRunLoopCondition.broadcast(); - } - - CFRunLoopRun(); -} - -void ScrollingThread::threadRunLoopSourceCallback(void* scrollingThread) -{ - static_cast<ScrollingThread*>(scrollingThread)->threadRunLoopSourceCallback(); -} - -void ScrollingThread::threadRunLoopSourceCallback() -{ - ASSERT(isCurrentThread()); - - Vector<Function<void ()> > functions; - - { - MutexLocker locker(m_functionsMutex); - m_functions.swap(functions); - } - - for (size_t i = 0; i < functions.size(); ++i) - functions[i](); -} - -void ScrollingThread::dispatch(const Function<void()>& function) -{ - createThreadIfNeeded(); - - { - MutexLocker locker(m_functionsMutex); - m_functions.append(function); - } - - CFRunLoopSourceSignal(m_threadRunLoopSource.get()); - CFRunLoopWakeUp(m_threadRunLoop.get()); -} - -static ScrollingThread& scrollingThread() -{ - DEFINE_STATIC_LOCAL(ScrollingThread, scrollingThread, ()); - return scrollingThread; -} - void ScrollingCoordinator::frameViewHorizontalScrollbarLayerDidChange(FrameView* frameView, GraphicsLayer*) { ASSERT(isMainThread()); @@ -191,56 +72,8 @@ void ScrollingCoordinator::frameViewScrollLayerDidChange(FrameView* frameView, c if (frameView->frame() != m_page->mainFrame()) return; - MutexLocker locker(m_mainFrameGeometryMutex); - m_mainFrameScrollLayer = scrollLayer->platformLayer(); - - // FIXME: Inform the scrolling thread? -} - -bool ScrollingCoordinator::isScrollingThread() -{ - return scrollingThread().isCurrentThread(); -} - -void ScrollingCoordinator::dispatchOnScrollingThread(const Function<void()>& function) -{ - return scrollingThread().dispatch(function); -} - -void ScrollingCoordinator::scrollByOnScrollingThread(const IntSize& offset) -{ - ASSERT(isScrollingThread()); - - MutexLocker locker(m_mainFrameGeometryMutex); - - // FIXME: Should we cache the scroll position as well or always get it from the layer? - IntPoint scrollPosition = IntPoint([m_mainFrameScrollLayer.get() position]); - scrollPosition = -scrollPosition; - - scrollPosition += offset; - scrollPosition.clampNegativeToZero(); - - IntPoint maximumScrollPosition = IntPoint(m_mainFrameContentsSize.width() - m_mainFrameVisibleContentRect.width(), m_mainFrameContentsSize.height() - m_mainFrameVisibleContentRect.height()); - scrollPosition = scrollPosition.shrunkTo(maximumScrollPosition); - - updateMainFrameScrollLayerPositionOnScrollingThread(-scrollPosition); - - m_mainFrameScrollPosition = scrollPosition; - if (!m_didDispatchDidUpdateMainFrameScrollPosition) { - callOnMainThread(bind(&ScrollingCoordinator::didUpdateMainFrameScrollPosition, this)); - m_didDispatchDidUpdateMainFrameScrollPosition = true; - } -} - -void ScrollingCoordinator::updateMainFrameScrollLayerPositionOnScrollingThread(const FloatPoint& scrollLayerPosition) -{ - ASSERT(isScrollingThread()); - ASSERT(!m_mainFrameGeometryMutex.tryLock()); - - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - [m_mainFrameScrollLayer.get() setPosition:scrollLayerPosition]; - [CATransaction commit]; + m_scrollingTreeState->setScrollLayer(scrollLayer); + scheduleTreeStateCommit(); } } // namespace WebCore diff --git a/Source/WebCore/page/scrolling/mac/ScrollingThreadMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingThreadMac.mm new file mode 100644 index 000000000..a6a768113 --- /dev/null +++ b/Source/WebCore/page/scrolling/mac/ScrollingThreadMac.mm @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingThread.h" + +#if ENABLE(THREADED_SCROLLING) + +namespace WebCore { + +void ScrollingThread::initializeRunLoop() +{ + // Initialize the run loop. + { + MutexLocker locker(m_initializeRunLoopConditionMutex); + + m_threadRunLoop = CFRunLoopGetCurrent(); + + CFRunLoopSourceContext context = { 0, this, 0, 0, 0, 0, 0, 0, 0, threadRunLoopSourceCallback }; + m_threadRunLoopSource = adoptCF(CFRunLoopSourceCreate(0, 0, &context)); + CFRunLoopAddSource(CFRunLoopGetCurrent(), m_threadRunLoopSource.get(), kCFRunLoopDefaultMode); + + m_initializeRunLoopCondition.broadcast(); + } + + CFRunLoopRun(); +} + +void ScrollingThread::wakeUpRunLoop() +{ + CFRunLoopSourceSignal(m_threadRunLoopSource.get()); + CFRunLoopWakeUp(m_threadRunLoop.get()); +} + +void ScrollingThread::threadRunLoopSourceCallback(void* scrollingThread) +{ + static_cast<ScrollingThread*>(scrollingThread)->threadRunLoopSourceCallback(); +} + +void ScrollingThread::threadRunLoopSourceCallback() +{ + dispatchFunctionsFromScrollingThread(); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h new file mode 100644 index 000000000..b1ae6ee76 --- /dev/null +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ScrollingTreeNodeMac_h +#define ScrollingTreeNodeMac_h + +#if ENABLE(THREADED_SCROLLING) + +#include "ScrollingTreeNode.h" +#include <wtf/RetainPtr.h> + +OBJC_CLASS CALayer; + +namespace WebCore { + +class ScrollingTreeNodeMac : public ScrollingTreeNode { +public: + explicit ScrollingTreeNodeMac(ScrollingTree*); + +private: + virtual void update(ScrollingTreeState*) OVERRIDE; + virtual void handleWheelEvent(const PlatformWheelEvent&) OVERRIDE; + + IntPoint scrollPosition() const; + void setScrollPosition(const IntPoint&); + + void scrollBy(const IntSize&); + + RetainPtr<CALayer> m_scrollLayer; +}; + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) + +#endif // ScrollingTreeNodeMac_h diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm new file mode 100644 index 000000000..76a8e3eaf --- /dev/null +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeNodeMac.mm @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTreeNodeMac.h" + +#if ENABLE(THREADED_SCROLLING) + +#include "PlatformWheelEvent.h" +#include "ScrollingTree.h" +#include "ScrollingTreeState.h" + +namespace WebCore { + +PassOwnPtr<ScrollingTreeNode> ScrollingTreeNode::create(ScrollingTree* scrollingTree) +{ + return adoptPtr(new ScrollingTreeNodeMac(scrollingTree)); +} + +ScrollingTreeNodeMac::ScrollingTreeNodeMac(ScrollingTree* scrollingTree) + : ScrollingTreeNode(scrollingTree) +{ +} + +void ScrollingTreeNodeMac::update(ScrollingTreeState* state) +{ + ScrollingTreeNode::update(state); + + if (state->changedProperties() & ScrollingTreeState::ScrollLayer) + m_scrollLayer = state->platformScrollLayer(); +} + +void ScrollingTreeNodeMac::handleWheelEvent(const PlatformWheelEvent& wheelEvent) +{ + // FXIME: This needs to handle rubberbanding. + scrollBy(IntSize(-wheelEvent.deltaX(), -wheelEvent.deltaY())); +} + +IntPoint ScrollingTreeNodeMac::scrollPosition() const +{ + CGPoint scrollLayerPosition = m_scrollLayer.get().position; + return IntPoint(-scrollLayerPosition.x, -scrollLayerPosition.y); +} + +void ScrollingTreeNodeMac::setScrollPosition(const IntPoint& position) +{ + m_scrollLayer.get().position = CGPointMake(-position.x(), -position.y()); +} + +void ScrollingTreeNodeMac::scrollBy(const IntSize &offset) +{ + setScrollPosition(scrollPosition() + offset); + + scrollingTree()->updateMainFrameScrollPosition(scrollPosition()); +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/scrolling/mac/ScrollingTreeStateMac.mm b/Source/WebCore/page/scrolling/mac/ScrollingTreeStateMac.mm new file mode 100644 index 000000000..21f0c7253 --- /dev/null +++ b/Source/WebCore/page/scrolling/mac/ScrollingTreeStateMac.mm @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ScrollingTreeState.h" + +#if ENABLE(THREADED_SCROLLING) + +namespace WebCore { + +PlatformLayer* ScrollingTreeState::platformScrollLayer() const +{ + return m_platformScrollLayer.get(); +} + +void ScrollingTreeState::setScrollLayer(const GraphicsLayer* graphicsLayer) +{ + PlatformLayer* platformScrollLayer = graphicsLayer ? graphicsLayer->platformLayer() : nil; + + if (m_platformScrollLayer == platformScrollLayer) + return; + + m_platformScrollLayer = platformScrollLayer; + m_changedProperties |= ScrollLayer; +} + +} // namespace WebCore + +#endif // ENABLE(THREADED_SCROLLING) diff --git a/Source/WebCore/page/win/FrameCGWin.cpp b/Source/WebCore/page/win/FrameCGWin.cpp index 39f8d0a6b..ea2c391e7 100644 --- a/Source/WebCore/page/win/FrameCGWin.cpp +++ b/Source/WebCore/page/win/FrameCGWin.cpp @@ -97,7 +97,7 @@ DragImageRef Frame::nodeImage(Node* node) if (!renderer) return 0; - IntRect topLevelRect; + LayoutRect topLevelRect; IntRect paintingRect = renderer->paintingRootRect(topLevelRect); document()->updateLayout(); diff --git a/Source/WebCore/platform/Clock.cpp b/Source/WebCore/platform/Clock.cpp index cc594e7f8..883023c3a 100644 --- a/Source/WebCore/platform/Clock.cpp +++ b/Source/WebCore/platform/Clock.cpp @@ -26,7 +26,9 @@ #include "config.h" #include "Clock.h" -#if USE(COREAUDIO) +#if USE(COREMEDIA) + #include "PlatformClockCM.h" +#elif USE(COREAUDIO) #include "PlatformClockCA.h" #else #include "ClockGeneric.h" @@ -36,7 +38,9 @@ using namespace WebCore; PassRefPtr<Clock> Clock::create() { -#if USE(COREAUDIO) +#if USE(COREMEDIA) + return adoptRef(new PlatformClockCM()); +#elif USE(COREAUDIO) return adoptRef(new PlatformClockCA()); #else return adoptRef(new ClockGeneric()); diff --git a/Source/WebCore/platform/ColorChooserClient.h b/Source/WebCore/platform/ColorChooserClient.h index e5ea2fdcf..0c5bf3623 100644 --- a/Source/WebCore/platform/ColorChooserClient.h +++ b/Source/WebCore/platform/ColorChooserClient.h @@ -13,6 +13,8 @@ class Color; class ColorChooserClient { public: + virtual ~ColorChooserClient() { } + virtual void didChooseColor(const Color&) = 0; virtual void didEndChooser() = 0; }; diff --git a/Source/WebCore/platform/Pasteboard.h b/Source/WebCore/platform/Pasteboard.h index fedfc8abd..8e5f91bb8 100644 --- a/Source/WebCore/platform/Pasteboard.h +++ b/Source/WebCore/platform/Pasteboard.h @@ -80,9 +80,8 @@ class Pasteboard { WTF_MAKE_NONCOPYABLE(Pasteboard); WTF_MAKE_FAST_ALLOCATED; public: #if PLATFORM(MAC) + // This is required to support OS X services. void writeSelectionForTypes(NSArray* pasteboardTypes, Range* selectedRange, bool canSmartCopyOrDelete, Frame*); - void writeURLForTypes(NSArray* types, const KURL&, const String& titleStr, Frame*); - Pasteboard(const String& pasteboardName); #endif @@ -91,10 +90,6 @@ public: void writePlainText(const String&); void writeURL(const KURL&, const String&, Frame* = 0); void writeImage(Node*, const KURL&, const String& title); -#if PLATFORM(MAC) - void writeFileWrapperAsRTFDAttachment(NSFileWrapper*); - String asURL(Frame*); -#endif void writeClipboard(Clipboard*); void clear(); bool canSmartReplace(); @@ -115,9 +110,6 @@ private: #if PLATFORM(MAC) RetainPtr<NSPasteboard> m_pasteboard; - PassRefPtr<DocumentFragment> documentFragmentWithImageResource(Frame* frame, PassRefPtr<ArchiveResource> resource); - PassRefPtr<DocumentFragment> documentFragmentWithRtf(Frame* frame, NSString* pboardType); - NSURL *getBestURL(Frame *); #endif #if PLATFORM(WIN) diff --git a/Source/WebCore/platform/PlatformGestureEvent.h b/Source/WebCore/platform/PlatformGestureEvent.h index e313be50e..ed557c178 100644 --- a/Source/WebCore/platform/PlatformGestureEvent.h +++ b/Source/WebCore/platform/PlatformGestureEvent.h @@ -28,7 +28,9 @@ #if ENABLE(GESTURE_EVENTS) +#include "FloatPoint.h" #include "IntPoint.h" +#include "IntSize.h" #include "PlatformEvent.h" namespace WebCore { @@ -51,15 +53,28 @@ public: { } + PlatformGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, double timestamp, const IntSize& area, const FloatPoint& delta, bool shiftKey, bool ctrlKey, bool altKey, bool metaKey) + : PlatformEvent(type, shiftKey, ctrlKey, altKey, metaKey, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) + , m_area(area) + , m_deltaX(delta.x()) + , m_deltaY(delta.y()) + { + } + const IntPoint& position() const { return m_position; } // PlatformWindow coordinates. const IntPoint& globalPosition() const { return m_globalPosition; } // Screen coordinates. + const IntSize& area() const { return m_area; } + float deltaX() const { return m_deltaX; } float deltaY() const { return m_deltaY; } protected: IntPoint m_position; IntPoint m_globalPosition; + IntSize m_area; float m_deltaX; float m_deltaY; }; diff --git a/Source/WebCore/platform/PlatformScreen.h b/Source/WebCore/platform/PlatformScreen.h index 827801b44..969193f1c 100644 --- a/Source/WebCore/platform/PlatformScreen.h +++ b/Source/WebCore/platform/PlatformScreen.h @@ -40,7 +40,6 @@ typedef uint32_t PlatformDisplayID; namespace WebCore { class FloatRect; - class FrameView; class Widget; int screenHorizontalDPI(Widget*); @@ -49,14 +48,14 @@ namespace WebCore { int screenDepthPerComponent(Widget*); bool screenIsMonochrome(Widget*); - FloatRect screenRect(FrameView*); - FloatRect screenAvailableRect(FrameView*); + FloatRect screenRect(Widget*); + FloatRect screenAvailableRect(Widget*); #if PLATFORM(MAC) NSScreen *screenForWindow(NSWindow *); - FloatRect toUserSpace(const NSRect&, NSWindow *destination, float deviceScaleFactor); - NSRect toDeviceSpace(const FloatRect&, NSWindow *source, float deviceScaleFactor); + FloatRect toUserSpace(const NSRect&, NSWindow *destination); + NSRect toDeviceSpace(const FloatRect&, NSWindow *source); NSPoint flipScreenPoint(const NSPoint&, NSScreen *); #endif diff --git a/Source/WebCore/platform/PlatformTouchPoint.h b/Source/WebCore/platform/PlatformTouchPoint.h index d66eb23c8..b18192d90 100644 --- a/Source/WebCore/platform/PlatformTouchPoint.h +++ b/Source/WebCore/platform/PlatformTouchPoint.h @@ -44,9 +44,11 @@ public: TouchStateEnd // Placeholder: must remain the last item. }; + // This is necessary for us to be able to build synthetic events. + PlatformTouchPoint() { }; + #if PLATFORM(QT) PlatformTouchPoint(const QTouchEvent::TouchPoint&); - PlatformTouchPoint() {}; #elif PLATFORM(EFL) PlatformTouchPoint(unsigned id, const IntPoint& windowPos, State); #endif diff --git a/Source/WebCore/platform/PopupMenuClient.h b/Source/WebCore/platform/PopupMenuClient.h index 4abe3379c..bfa24ac1b 100644 --- a/Source/WebCore/platform/PopupMenuClient.h +++ b/Source/WebCore/platform/PopupMenuClient.h @@ -22,6 +22,7 @@ #ifndef PopupMenuClient_h #define PopupMenuClient_h +#include "LayoutTypes.h" #include "PopupMenuStyle.h" #include "ScrollTypes.h" #include <wtf/Forward.h> @@ -51,8 +52,8 @@ public: virtual PopupMenuStyle menuStyle() const = 0; virtual int clientInsetLeft() const = 0; virtual int clientInsetRight() const = 0; - virtual int clientPaddingLeft() const = 0; - virtual int clientPaddingRight() const = 0; + virtual LayoutUnit clientPaddingLeft() const = 0; + virtual LayoutUnit clientPaddingRight() const = 0; virtual int listSize() const = 0; virtual int selectedIndex() const = 0; virtual void popupDidHide() = 0; diff --git a/Source/WebCore/platform/ScrollView.h b/Source/WebCore/platform/ScrollView.h index ba586a4ab..cb6ab4e3d 100644 --- a/Source/WebCore/platform/ScrollView.h +++ b/Source/WebCore/platform/ScrollView.h @@ -72,8 +72,8 @@ public: // Functions for child manipulation and inspection. const HashSet<RefPtr<Widget> >* children() const { return &m_children; } - void addChild(PassRefPtr<Widget>); - void removeChild(Widget*); + virtual void addChild(PassRefPtr<Widget>); + virtual void removeChild(Widget*); // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions // can be used to obtain those scrollbars. diff --git a/Source/WebCore/platform/ScrollableArea.h b/Source/WebCore/platform/ScrollableArea.h index 0b4583bbe..353b6f074 100644 --- a/Source/WebCore/platform/ScrollableArea.h +++ b/Source/WebCore/platform/ScrollableArea.h @@ -155,14 +155,15 @@ public: // Note that this only returns scrollable areas that can actually be scrolled. virtual ScrollableArea* enclosingScrollableArea() const = 0; + // Returns the bounding box of this scrollable area, in the coordinate system of the enclosing scroll view. + virtual IntRect scrollableAreaBoundingBox() const { ASSERT_NOT_REACHED(); return IntRect(); } + bool isPinnedInBothDirections(const IntSize&) const; bool isPinnedHorizontallyInDirection(int horizontalScrollDelta) const; bool isPinnedVerticallyInDirection(int verticalScrollDelta) const; virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; } - virtual void disconnectFromPage() { } - virtual bool scrollAnimatorEnabled() const { return false; } // NOTE: Only called from Internals for testing. diff --git a/Source/WebCore/platform/ScrollbarTheme.h b/Source/WebCore/platform/ScrollbarTheme.h index 9ef124276..2a83d5385 100644 --- a/Source/WebCore/platform/ScrollbarTheme.h +++ b/Source/WebCore/platform/ScrollbarTheme.h @@ -36,6 +36,10 @@ class PlatformMouseEvent; class Scrollbar; class ScrollView; +#if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) +class GraphicsLayer; +#endif + class ScrollbarTheme { WTF_MAKE_NONCOPYABLE(ScrollbarTheme); WTF_MAKE_FAST_ALLOCATED; public: @@ -84,6 +88,11 @@ public: virtual void paintOverhangAreas(ScrollView*, GraphicsContext*, const IntRect&, const IntRect&, const IntRect&) { } +#if USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) + virtual void setUpOverhangAreasLayerContents(GraphicsLayer*) { } + virtual void setUpContentShadowLayer(GraphicsLayer*) { } +#endif + virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&) { return false; } virtual bool shouldSnapBackToDragOrigin(Scrollbar*, const PlatformMouseEvent&) { return false; } virtual bool shouldDragDocumentInsteadOfThumb(Scrollbar*, const PlatformMouseEvent&) { return false; } diff --git a/Source/WebCore/platform/animation/Animation.h b/Source/WebCore/platform/animation/Animation.h index 0a5f4d286..175d95a5b 100644 --- a/Source/WebCore/platform/animation/Animation.h +++ b/Source/WebCore/platform/animation/Animation.h @@ -42,7 +42,7 @@ public: static PassRefPtr<Animation> create() { return adoptRef(new Animation); } static PassRefPtr<Animation> create(const Animation* o) { return adoptRef(new Animation(*o)); } - + bool isDelaySet() const { return m_delaySet; } bool isDirectionSet() const { return m_directionSet; } bool isDurationSet() const { return m_durationSet; } @@ -96,7 +96,12 @@ public: double delay() const { return m_delay; } - enum AnimationDirection { AnimationDirectionNormal, AnimationDirectionAlternate }; + enum AnimationDirection { + AnimationDirectionNormal, + AnimationDirectionAlternate, + AnimationDirectionReverse, + AnimationDirectionAlternateReverse + }; AnimationDirection direction() const { return static_cast<AnimationDirection>(m_direction); } unsigned fillMode() const { return m_fillMode; } @@ -144,7 +149,7 @@ private: double m_delay; double m_duration; RefPtr<TimingFunction> m_timingFunction; - unsigned m_direction : 1; // AnimationDirection + unsigned m_direction : 2; // AnimationDirection unsigned m_fillMode : 2; unsigned m_playState : 2; diff --git a/Source/WebCore/platform/animation/AnimationUtilities.h b/Source/WebCore/platform/animation/AnimationUtilities.h index aebca46bb..87dabe6a6 100644 --- a/Source/WebCore/platform/animation/AnimationUtilities.h +++ b/Source/WebCore/platform/animation/AnimationUtilities.h @@ -37,7 +37,7 @@ inline int blend(int from, int to, double progress) inline unsigned blend(unsigned from, unsigned to, double progress) { - return static_cast<unsigned>(lround(static_cast<double>(from) + static_cast<double>(to - from) * progress)); + return static_cast<unsigned>(lround(to > from ? static_cast<double>(from) + static_cast<double>(to - from) * progress : static_cast<double>(from) - static_cast<double>(from - to) * progress)); } inline double blend(double from, double to, double progress) diff --git a/Source/WebCore/platform/audio/AudioBus.cpp b/Source/WebCore/platform/audio/AudioBus.cpp index eea191961..d6aa35002 100644 --- a/Source/WebCore/platform/audio/AudioBus.cpp +++ b/Source/WebCore/platform/audio/AudioBus.cpp @@ -196,21 +196,35 @@ void AudioBus::scale(float scale) // Just copies the samples from the source bus to this one. // This is just a simple copy if the number of channels match, otherwise a mixup or mixdown is done. -// For now, we just support a mixup from mono -> stereo. +// For now, we just support mixup from mono -> stereo and mixdown from stereo -> mono. void AudioBus::copyFrom(const AudioBus& sourceBus) { if (&sourceBus == this) return; - if (numberOfChannels() == sourceBus.numberOfChannels()) { - for (unsigned i = 0; i < numberOfChannels(); ++i) + unsigned numberOfSourceChannels = sourceBus.numberOfChannels(); + unsigned numberOfDestinationChannels = numberOfChannels(); + + if (numberOfDestinationChannels == numberOfSourceChannels) { + for (unsigned i = 0; i < numberOfSourceChannels; ++i) channel(i)->copyFrom(sourceBus.channel(i)); - } else if (numberOfChannels() == 2 && sourceBus.numberOfChannels() == 1) { + } else if (numberOfDestinationChannels == 2 && numberOfSourceChannels == 1) { // Handle mono -> stereo case (for now simply copy mono channel into both left and right) // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center... const AudioChannel* sourceChannel = sourceBus.channel(0); channel(0)->copyFrom(sourceChannel); channel(1)->copyFrom(sourceChannel); + } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 2) { + // Handle stereo -> mono case. output = 0.5 * (input.L + input.R). + AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus); + + const float* sourceL = sourceBusSafe.channelByType(ChannelLeft)->data(); + const float* sourceR = sourceBusSafe.channelByType(ChannelRight)->data(); + + float* destination = channelByType(ChannelLeft)->mutableData(); + vadd(sourceL, 1, sourceR, 1, destination, 1, length()); + float scale = 0.5; + vsmul(destination, 1, &scale, destination, 1, length()); } else { // Case not handled ASSERT_NOT_REACHED(); @@ -219,15 +233,29 @@ void AudioBus::copyFrom(const AudioBus& sourceBus) void AudioBus::sumFrom(const AudioBus &sourceBus) { - if (numberOfChannels() == sourceBus.numberOfChannels()) { + unsigned numberOfSourceChannels = sourceBus.numberOfChannels(); + unsigned numberOfDestinationChannels = numberOfChannels(); + + if (numberOfDestinationChannels == numberOfSourceChannels) { for (unsigned i = 0; i < numberOfChannels(); ++i) channel(i)->sumFrom(sourceBus.channel(i)); - } else if (numberOfChannels() == 2 && sourceBus.numberOfChannels() == 1) { + } else if (numberOfDestinationChannels == 2 && numberOfSourceChannels == 1) { // Handle mono -> stereo case (for now simply sum mono channel into both left and right) // FIXME: Really we should apply an equal-power scaling factor here, since we're effectively panning center... const AudioChannel* sourceChannel = sourceBus.channel(0); channel(0)->sumFrom(sourceChannel); channel(1)->sumFrom(sourceChannel); + } else if (numberOfDestinationChannels == 1 && numberOfSourceChannels == 2) { + // Handle stereo -> mono case. output += 0.5 * (input.L + input.R). + AudioBus& sourceBusSafe = const_cast<AudioBus&>(sourceBus); + + const float* sourceL = sourceBusSafe.channelByType(ChannelLeft)->data(); + const float* sourceR = sourceBusSafe.channelByType(ChannelRight)->data(); + + float* destination = channelByType(ChannelLeft)->mutableData(); + float scale = 0.5; + vsma(sourceL, 1, &scale, destination, 1, length()); + vsma(sourceR, 1, &scale, destination, 1, length()); } else { // Case not handled ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/platform/audio/Biquad.cpp b/Source/WebCore/platform/audio/Biquad.cpp index 8dc1f4fb6..cfee9cfd9 100644 --- a/Source/WebCore/platform/audio/Biquad.cpp +++ b/Source/WebCore/platform/audio/Biquad.cpp @@ -188,43 +188,84 @@ void Biquad::reset() void Biquad::setLowpassParams(double cutoff, double resonance) { resonance = std::max(0.0, resonance); // can't go negative - + // Limit cutoff to 0 to 1. + cutoff = std::max(0.0, std::min(cutoff, 1.0)); + double g = pow(10.0, 0.05 * resonance); double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2); - // Compute biquad coefficients for lopass filter - double theta = piDouble * cutoff; - double sn = 0.5 * d * sin(theta); - double beta = 0.5 * (1 - sn) / (1 + sn); - double gamma = (0.5 + beta) * cos(theta); - double alpha = 0.25 * (0.5 + beta - gamma); - - m_b0 = 2 * alpha; - m_b1 = 2 * 2 * alpha; - m_b2 = 2 * alpha; - m_a1 = 2 * -gamma; - m_a2 = 2 * beta; + if (cutoff == 1) { + // When cutoff is 1, the z-transform is 1. + m_b0 = 1; + m_b1 = 0; + m_b2 = 0; + m_a1 = 0; + m_a2 = 0; + } else if (cutoff > 0) { + // Compute biquad coefficients for lowpass filter + double theta = piDouble * cutoff; + double sn = 0.5 * d * sin(theta); + double beta = 0.5 * (1 - sn) / (1 + sn); + double gamma = (0.5 + beta) * cos(theta); + double alpha = 0.25 * (0.5 + beta - gamma); + + m_b0 = 2 * alpha; + m_b1 = 2 * 2 * alpha; + m_b2 = 2 * alpha; + m_a1 = 2 * -gamma; + m_a2 = 2 * beta; + } else { + // When cutoff is zero, nothing gets through the filter, so set + // coefficients up correctly. + m_b0 = 0; + m_b1 = 0; + m_b2 = 0; + m_a1 = 0; + m_a2 = 0; + } } void Biquad::setHighpassParams(double cutoff, double resonance) { resonance = std::max(0.0, resonance); // can't go negative + // Limit cutoff to 0 to 1. + cutoff = std::max(0.0, std::min(cutoff, 1.0)); + double g = pow(10.0, 0.05 * resonance); double d = sqrt((4 - sqrt(16 - 16 / (g * g))) / 2); - // Compute biquad coefficients for highpass filter - double theta = piDouble * cutoff; - double sn = 0.5 * d * sin(theta); - double beta = 0.5 * (1 - sn) / (1 + sn); - double gamma = (0.5 + beta) * cos(theta); - double alpha = 0.25 * (0.5 + beta + gamma); - - m_b0 = 2 * alpha; - m_b1 = 2 * -2 * alpha; - m_b2 = 2 * alpha; - m_a1 = 2 * -gamma; - m_a2 = 2 * beta; + if (cutoff == 1) { + // The z-transform is 0. + m_b0 = 0; + m_b1 = 0; + m_b2 = 0; + m_a1 = 0; + m_a2 = 0; + } else if (cutoff > 0) { + // Compute biquad coefficients for highpass filter + double theta = piDouble * cutoff; + double sn = 0.5 * d * sin(theta); + double beta = 0.5 * (1 - sn) / (1 + sn); + double gamma = (0.5 + beta) * cos(theta); + double alpha = 0.25 * (0.5 + beta + gamma); + + m_b0 = 2 * alpha; + m_b1 = 2 * -2 * alpha; + m_b2 = 2 * alpha; + m_a1 = 2 * -gamma; + m_a2 = 2 * beta; + } else { + // When cutoff is zero, we need to be careful because the above + // gives a quadratic divided by the same quadratic, with poles + // and zeros on the unit circle in the same place. When cutoff + // is zero, the z-transform is 1. + m_b0 = 1; + m_b1 = 0; + m_b2 = 0; + m_a1 = 0; + m_a2 = 0; + } } void Biquad::setNormalizedCoefficients(double b0, double b1, double b2, double a0, double a1, double a2) @@ -240,119 +281,222 @@ void Biquad::setNormalizedCoefficients(double b0, double b1, double b2, double a void Biquad::setLowShelfParams(double frequency, double dbGain) { - double w0 = piDouble * frequency; - + // Clip frequencies to between 0 and 1, inclusive. + frequency = std::max(0.0, std::min(frequency, 1.0)); + double A = pow(10.0, dbGain / 40); - double S = 1; // filter slope (1 is max value) - double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2); - double k = cos(w0); - double k2 = 2 * sqrt(A) * alpha; - - double aPlusOne = A + 1; - double aMinusOne = A - 1; - - double b0 = A * (aPlusOne - aMinusOne * k + k2); - double b1 = 2 * A * (aMinusOne - aPlusOne * k); - double b2 = A * (aPlusOne - aMinusOne * k - k2); - double a0 = aPlusOne + aMinusOne * k + k2; - double a1 = -2 * (aMinusOne + aPlusOne * k); - double a2 = aPlusOne + aMinusOne * k - k2; - - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + if (frequency == 1) { + // The z-transform is a constant gain. + setNormalizedCoefficients(A * A, 0, 0, + 1, 0, 0); + } else if (frequency > 0) { + double w0 = piDouble * frequency; + double S = 1; // filter slope (1 is max value) + double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2); + double k = cos(w0); + double k2 = 2 * sqrt(A) * alpha; + double aPlusOne = A + 1; + double aMinusOne = A - 1; + + double b0 = A * (aPlusOne - aMinusOne * k + k2); + double b1 = 2 * A * (aMinusOne - aPlusOne * k); + double b2 = A * (aPlusOne - aMinusOne * k - k2); + double a0 = aPlusOne + aMinusOne * k + k2; + double a1 = -2 * (aMinusOne + aPlusOne * k); + double a2 = aPlusOne + aMinusOne * k - k2; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When frequency is 0, the z-transform is 1. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } } void Biquad::setHighShelfParams(double frequency, double dbGain) { - double w0 = piDouble * frequency; + // Clip frequencies to between 0 and 1, inclusive. + frequency = std::max(0.0, std::min(frequency, 1.0)); double A = pow(10.0, dbGain / 40); - double S = 1; // filter slope (1 is max value) - double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2); - double k = cos(w0); - double k2 = 2 * sqrt(A) * alpha; - - double aPlusOne = A + 1; - double aMinusOne = A - 1; - - double b0 = A * (aPlusOne + aMinusOne * k + k2); - double b1 = -2 * A * (aMinusOne + aPlusOne * k); - double b2 = A * (aPlusOne + aMinusOne * k - k2); - double a0 = aPlusOne - aMinusOne * k + k2; - double a1 = 2 * (aMinusOne - aPlusOne * k); - double a2 = aPlusOne - aMinusOne * k - k2; - - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + if (frequency == 1) { + // The z-transform is 1. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } else if (frequency > 0) { + double w0 = piDouble * frequency; + double S = 1; // filter slope (1 is max value) + double alpha = 0.5 * sin(w0) * sqrt((A + 1 / A) * (1 / S - 1) + 2); + double k = cos(w0); + double k2 = 2 * sqrt(A) * alpha; + double aPlusOne = A + 1; + double aMinusOne = A - 1; + + double b0 = A * (aPlusOne + aMinusOne * k + k2); + double b1 = -2 * A * (aMinusOne + aPlusOne * k); + double b2 = A * (aPlusOne + aMinusOne * k - k2); + double a0 = aPlusOne - aMinusOne * k + k2; + double a1 = 2 * (aMinusOne - aPlusOne * k); + double a2 = aPlusOne - aMinusOne * k - k2; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When frequency = 0, the filter is just a gain, A^2. + setNormalizedCoefficients(A * A, 0, 0, + 1, 0, 0); + } } void Biquad::setPeakingParams(double frequency, double Q, double dbGain) { - double w0 = piDouble * frequency; - double alpha = sin(w0) / (2 * Q); - double A = pow(10.0, dbGain / 40); + // Clip frequencies to between 0 and 1, inclusive. + frequency = std::max(0.0, std::min(frequency, 1.0)); - double k = cos(w0); + // Don't let Q go negative, which causes an unstable filter. + Q = std::max(0.0, Q); - double b0 = 1 + alpha * A; - double b1 = -2 * k; - double b2 = 1 - alpha * A; - double a0 = 1 + alpha / A; - double a1 = -2 * k; - double a2 = 1 - alpha / A; + double A = pow(10.0, dbGain / 40); - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + if (frequency > 0 && frequency < 1) { + if (Q > 0) { + double w0 = piDouble * frequency; + double alpha = sin(w0) / (2 * Q); + double k = cos(w0); + + double b0 = 1 + alpha * A; + double b1 = -2 * k; + double b2 = 1 - alpha * A; + double a0 = 1 + alpha / A; + double a1 = -2 * k; + double a2 = 1 - alpha / A; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When Q = 0, the above formulas have problems. If we look at + // the z-transform, we can see that the limit as Q->0 is A^2, so + // set the filter that way. + setNormalizedCoefficients(A * A, 0, 0, + 1, 0, 0); + } + } else { + // When frequency is 0 or 1, the z-transform is 1. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } } void Biquad::setAllpassParams(double frequency, double Q) { - double w0 = piDouble * frequency; - double alpha = sin(w0) / (2 * Q); - - double k = cos(w0); - - double b0 = 1 - alpha; - double b1 = -2 * k; - double b2 = 1 + alpha; - double a0 = 1 + alpha; - double a1 = -2 * k; - double a2 = 1 - alpha; - - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + // Clip frequencies to between 0 and 1, inclusive. + frequency = std::max(0.0, std::min(frequency, 1.0)); + + // Don't let Q go negative, which causes an unstable filter. + Q = std::max(0.0, Q); + + if (frequency > 0 && frequency < 1) { + if (Q > 0) { + double w0 = piDouble * frequency; + double alpha = sin(w0) / (2 * Q); + double k = cos(w0); + + double b0 = 1 - alpha; + double b1 = -2 * k; + double b2 = 1 + alpha; + double a0 = 1 + alpha; + double a1 = -2 * k; + double a2 = 1 - alpha; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When Q = 0, the above formulas have problems. If we look at + // the z-transform, we can see that the limit as Q->0 is -1, so + // set the filter that way. + setNormalizedCoefficients(-1, 0, 0, + 1, 0, 0); + } + } else { + // When frequency is 0 or 1, the z-transform is 1. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } } void Biquad::setNotchParams(double frequency, double Q) { - double w0 = piDouble * frequency; - double alpha = sin(w0) / (2 * Q); - - double k = cos(w0); - - double b0 = 1; - double b1 = -2 * k; - double b2 = 1; - double a0 = 1 + alpha; - double a1 = -2 * k; - double a2 = 1 - alpha; - - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + // Clip frequencies to between 0 and 1, inclusive. + frequency = std::max(0.0, std::min(frequency, 1.0)); + + // Don't let Q go negative, which causes an unstable filter. + Q = std::max(0.0, Q); + + if (frequency > 0 && frequency < 1) { + if (Q > 0) { + double w0 = piDouble * frequency; + double alpha = sin(w0) / (2 * Q); + double k = cos(w0); + + double b0 = 1; + double b1 = -2 * k; + double b2 = 1; + double a0 = 1 + alpha; + double a1 = -2 * k; + double a2 = 1 - alpha; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When Q = 0, the above formulas have problems. If we look at + // the z-transform, we can see that the limit as Q->0 is 0, so + // set the filter that way. + setNormalizedCoefficients(0, 0, 0, + 1, 0, 0); + } + } else { + // When frequency is 0 or 1, the z-transform is 1. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } } void Biquad::setBandpassParams(double frequency, double Q) { - double w0 = piDouble * frequency; - double alpha = sin(w0) / (2 * Q); + // No negative frequencies allowed. + frequency = std::max(0.0, frequency); + + // Don't let Q go negative, which causes an unstable filter. + Q = std::max(0.0, Q); - double k = cos(w0); + if (frequency > 0 && frequency < 1) { + double w0 = piDouble * frequency; + if (Q > 0) { + double alpha = sin(w0) / (2 * Q); + double k = cos(w0); - double b0 = alpha; - double b1 = 0; - double b2 = -alpha; - double a0 = 1 + alpha; - double a1 = -2 * k; - double a2 = 1 - alpha; - - setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + double b0 = alpha; + double b1 = 0; + double b2 = -alpha; + double a0 = 1 + alpha; + double a1 = -2 * k; + double a2 = 1 - alpha; + + setNormalizedCoefficients(b0, b1, b2, a0, a1, a2); + } else { + // When Q = 0, the above formulas have problems. If we look at + // the z-transform, we can see that the limit as Q->0 is 1, so + // set the filter that way. + setNormalizedCoefficients(1, 0, 0, + 1, 0, 0); + } + } else { + // When the cutoff is zero, the z-transform approaches 0, if Q + // > 0. When both Q and cutoff are zero, the z-transform is + // pretty much undefined. What should we do in this case? + // For now, just make the filter 0. When the cutoff is 1, the + // z-transform also approaches 0. + setNormalizedCoefficients(0, 0, 0, + 1, 0, 0); + } } void Biquad::setZeroPolePairs(const Complex &zero, const Complex &pole) diff --git a/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp b/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp index a7a4c1212..a322a3302 100644 --- a/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp +++ b/Source/WebCore/platform/audio/DynamicsCompressorKernel.cpp @@ -69,7 +69,7 @@ DynamicsCompressorKernel::DynamicsCompressorKernel(float sampleRate) void DynamicsCompressorKernel::setPreDelayTime(float preDelayTime) { // Re-configure look-ahead section pre-delay if delay time has changed. - unsigned preDelayFrames = preDelayTime / sampleRate(); + unsigned preDelayFrames = preDelayTime * sampleRate(); if (preDelayFrames > MaxPreDelayFrames - 1) preDelayFrames = MaxPreDelayFrames - 1; diff --git a/Source/WebCore/platform/audio/FFTFrame.h b/Source/WebCore/platform/audio/FFTFrame.h index db1d042ee..3fb3a782f 100644 --- a/Source/WebCore/platform/audio/FFTFrame.h +++ b/Source/WebCore/platform/audio/FFTFrame.h @@ -60,6 +60,10 @@ struct RDFTContext; #endif // !USE_ACCELERATE_FFT +#if USE(WEBAUDIO_IPP) +#include <ipps.h> +#endif // USE(WEBAUDIO_IPP) + #include <wtf/PassOwnPtr.h> #include <wtf/Platform.h> #include <wtf/Threading.h> @@ -161,6 +165,16 @@ private: AudioFloatArray m_imagData; #endif // USE(WEBAUDIO_GSTREAMER) +#if USE(WEBAUDIO_IPP) + Ipp8u* m_buffer; + IppsDFTSpec_R_32f* m_DFTSpec; + + float* getUpToDateComplexData(); + AudioFloatArray m_complexData; + AudioFloatArray m_realData; + AudioFloatArray m_imagData; +#endif // USE(WEBAUDIO_IPP) + #endif // !USE_ACCELERATE_FFT }; diff --git a/Source/WebCore/platform/audio/FFTFrameStub.cpp b/Source/WebCore/platform/audio/FFTFrameStub.cpp index aa26ec605..19a800d35 100644 --- a/Source/WebCore/platform/audio/FFTFrameStub.cpp +++ b/Source/WebCore/platform/audio/FFTFrameStub.cpp @@ -29,7 +29,7 @@ #if ENABLE(WEB_AUDIO) -#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_GSTREAMER) +#if !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_GSTREAMER) && !USE(WEBAUDIO_IPP) #include "FFTFrame.h" @@ -102,6 +102,6 @@ float* FFTFrame::imagData() const } // namespace WebCore -#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_GSTREAMER) +#endif // !OS(DARWIN) && !USE(WEBAUDIO_MKL) && !USE(WEBAUDIO_FFMPEG) && !USE(WEBAUDIO_GSTREAMER) && !USE(WEBAUDIO_IPP) #endif // ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/platform/audio/VectorMath.cpp b/Source/WebCore/platform/audio/VectorMath.cpp index 572dbf353..5693c1b89 100644 --- a/Source/WebCore/platform/audio/VectorMath.cpp +++ b/Source/WebCore/platform/audio/VectorMath.cpp @@ -418,8 +418,13 @@ void zvmul(const float* real1P, const float* imag1P, const float* real2P, const } #endif for (; i < framesToProcess; ++i) { - realDestP[i] = real1P[i] * real2P[i] - imag1P[i] * imag2P[i]; - imagDestP[i] = real1P[i] * imag2P[i] + imag1P[i] * real2P[i]; + // Read and compute result before storing them, in case the + // destination is the same as one of the sources. + float realResult = real1P[i] * real2P[i] - imag1P[i] * imag2P[i]; + float imagResult = real1P[i] * imag2P[i] + imag1P[i] * real2P[i]; + + realDestP[i] = realResult; + imagDestP[i] = imagResult; } } diff --git a/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp b/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp new file mode 100644 index 000000000..29374764f --- /dev/null +++ b/Source/WebCore/platform/audio/gstreamer/FFTFrameGStreamer.cpp @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2012 Igalia S.L + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +// FFTFrame implementation using the GStreamer FFT library. + +#include "config.h" + +#if USE(WEBAUDIO_GSTREAMER) + +#include "FFTFrame.h" + +#include "VectorMath.h" +#include <wtf/FastAllocBase.h> + +namespace { + +size_t unpackedFFTDataSize(unsigned fftSize) +{ + return fftSize / 2 + 1; +} + +} // anonymous namespace + +namespace WebCore { + +// Normal constructor: allocates for a given fftSize. +FFTFrame::FFTFrame(unsigned fftSize) + : m_FFTSize(fftSize) + , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) + , m_realData(unpackedFFTDataSize(m_FFTSize)) + , m_imagData(unpackedFFTDataSize(m_FFTSize)) +{ + m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize)); + + int fftLength = gst_fft_next_fast_length(m_FFTSize); + m_fft = gst_fft_f32_new(fftLength, FALSE); + m_inverseFft = gst_fft_f32_new(fftLength, TRUE); +} + +// Creates a blank/empty frame (interpolate() must later be called). +FFTFrame::FFTFrame() + : m_FFTSize(0) + , m_log2FFTSize(0) + , m_complexData(0) +{ + int fftLength = gst_fft_next_fast_length(m_FFTSize); + m_fft = gst_fft_f32_new(fftLength, FALSE); + m_inverseFft = gst_fft_f32_new(fftLength, TRUE); +} + +// Copy constructor. +FFTFrame::FFTFrame(const FFTFrame& frame) + : m_FFTSize(frame.m_FFTSize) + , m_log2FFTSize(frame.m_log2FFTSize) + , m_realData(unpackedFFTDataSize(frame.m_FFTSize)) + , m_imagData(unpackedFFTDataSize(frame.m_FFTSize)) +{ + m_complexData = WTF::fastNewArray<GstFFTF32Complex>(unpackedFFTDataSize(m_FFTSize)); + + int fftLength = gst_fft_next_fast_length(m_FFTSize); + m_fft = gst_fft_f32_new(fftLength, FALSE); + m_inverseFft = gst_fft_f32_new(fftLength, TRUE); + + // Copy/setup frame data. + memcpy(realData(), frame.realData(), sizeof(float) * unpackedFFTDataSize(m_FFTSize)); + memcpy(imagData(), frame.imagData(), sizeof(float) * unpackedFFTDataSize(m_FFTSize)); +} + +void FFTFrame::initialize() +{ +} + +void FFTFrame::cleanup() +{ +} + +FFTFrame::~FFTFrame() +{ + if (!m_fft) + return; + + gst_fft_f32_free(m_fft); + m_fft = 0; + + gst_fft_f32_free(m_inverseFft); + m_inverseFft = 0; + + WTF::fastDeleteArray(m_complexData); +} + +void FFTFrame::multiply(const FFTFrame& frame) +{ + FFTFrame& frame1 = *this; + FFTFrame& frame2 = const_cast<FFTFrame&>(frame); + + float* realP1 = frame1.realData(); + float* imagP1 = frame1.imagData(); + const float* realP2 = frame2.realData(); + const float* imagP2 = frame2.imagData(); + + size_t size = unpackedFFTDataSize(m_FFTSize); + VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, size); + + // Scale accounts the peculiar scaling of vecLib on the Mac. + // This ensures the right scaling all the way back to inverse FFT. + // FIXME: if we change the scaling on the Mac then this scale + // factor will need to change too. + float scale = 0.5f; + + VectorMath::vsmul(realP1, 1, &scale, realP1, 1, size); + VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, size); +} + +void FFTFrame::doFFT(const float* data) +{ + gst_fft_f32_fft(m_fft, data, m_complexData); + + // Scale the frequency domain data to match vecLib's scale factor + // on the Mac. FIXME: if we change the definition of FFTFrame to + // eliminate this scale factor then this code will need to change. + // Also, if this loop turns out to be hot then we should use SSE + // or other intrinsics to accelerate it. + float scaleFactor = 2; + + float* imagData = m_imagData.data(); + float* realData = m_realData.data(); + for (unsigned i = 0; i < unpackedFFTDataSize(m_FFTSize); ++i) { + imagData[i] = m_complexData[i].i * scaleFactor; + realData[i] = m_complexData[i].r * scaleFactor; + } +} + +void FFTFrame::doInverseFFT(float* data) +{ + // Merge the real and imaginary vectors to complex vector. + float* realData = m_realData.data(); + float* imagData = m_imagData.data(); + + for (size_t i = 0; i < unpackedFFTDataSize(m_FFTSize); ++i) { + m_complexData[i].i = imagData[i]; + m_complexData[i].r = realData[i]; + } + + gst_fft_f32_inverse_fft(m_inverseFft, m_complexData, data); + + // Scale so that a forward then inverse FFT yields exactly the original data. + const float scaleFactor = 1.0 / (2 * m_FFTSize); + VectorMath::vsmul(data, 1, &scaleFactor, data, 1, m_FFTSize); +} + +float* FFTFrame::realData() const +{ + return const_cast<float*>(m_realData.data()); +} + +float* FFTFrame::imagData() const +{ + return const_cast<float*>(m_imagData.data()); +} + +} // namespace WebCore + +#endif // USE(WEBAUDIO_GSTREAMER) diff --git a/Source/WebCore/platform/audio/ipp/FFTFrameIPP.cpp b/Source/WebCore/platform/audio/ipp/FFTFrameIPP.cpp new file mode 100644 index 000000000..747057398 --- /dev/null +++ b/Source/WebCore/platform/audio/ipp/FFTFrameIPP.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Intel Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// FFTFrame implementation using Intel IPP's DFT algorithm, +// suitable for use on Linux. + +#include "config.h" + +#if ENABLE(WEB_AUDIO) + +#if USE(WEBAUDIO_IPP) + +#include "FFTFrame.h" + +#include "VectorMath.h" + +#include <wtf/MathExtras.h> + +namespace WebCore { + +const unsigned maximumFFTPower2Size = 24; + +// Normal constructor: allocates for a given fftSize. +FFTFrame::FFTFrame(unsigned fftSize) + : m_FFTSize(fftSize) + , m_log2FFTSize(static_cast<unsigned>(log2(fftSize))) + , m_complexData(fftSize) + , m_realData(fftSize / 2) + , m_imagData(fftSize / 2) +{ + // We only allow power of two. + ASSERT(1UL << m_log2FFTSize == m_FFTSize); + ASSERT(m_log2FFTSize <= maximumFFTPower2Size); + + ippsDFTInitAlloc_R_32f(&m_DFTSpec, m_FFTSize, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast); + int bufferSize = 0; + ippsDFTGetBufSize_R_32f(m_DFTSpec, &bufferSize); + m_buffer = ippsMalloc_8u(bufferSize); +} + +// Creates a blank/empty frame (interpolate() must later be called). +FFTFrame::FFTFrame() + : m_FFTSize(0) + , m_log2FFTSize(0) +{ +} + +// Copy constructor. +FFTFrame::FFTFrame(const FFTFrame& frame) + : m_FFTSize(frame.m_FFTSize) + , m_log2FFTSize(frame.m_log2FFTSize) + , m_complexData(frame.m_FFTSize) + , m_realData(frame.m_FFTSize / 2) + , m_imagData(frame.m_FFTSize / 2) +{ + ippsDFTInitAlloc_R_32f(&m_DFTSpec, m_FFTSize, IPP_FFT_NODIV_BY_ANY, ippAlgHintFast); + int bufferSize = 0; + ippsDFTGetBufSize_R_32f(m_DFTSpec, &bufferSize); + m_buffer = ippsMalloc_8u(bufferSize); + + // Copy/setup frame data. + unsigned numberOfBytes = sizeof(float) * m_FFTSize; + memcpy(realData(), frame.realData(), numberOfBytes); + memcpy(imagData(), frame.imagData(), numberOfBytes); +} + +void FFTFrame::initialize() +{ +} + +void FFTFrame::cleanup() +{ +} + +FFTFrame::~FFTFrame() +{ + ippsFree(m_buffer); + ippsDFTFree_R_32f(m_DFTSpec); +} + +void FFTFrame::multiply(const FFTFrame& frame) +{ + FFTFrame& frame1 = *this; + FFTFrame& frame2 = const_cast<FFTFrame&>(frame); + + float* realP1 = frame1.realData(); + float* imagP1 = frame1.imagData(); + const float* realP2 = frame2.realData(); + const float* imagP2 = frame2.imagData(); + + unsigned halfSize = fftSize() / 2; + float real0 = realP1[0]; + float imag0 = imagP1[0]; + + VectorMath::zvmul(realP1, imagP1, realP2, imagP2, realP1, imagP1, halfSize); + + // Multiply the packed DC/nyquist component + realP1[0] = real0 * realP2[0]; + imagP1[0] = imag0 * imagP2[0]; + + // Scale accounts the peculiar scaling of vecLib on the Mac. + // This ensures the right scaling all the way back to inverse FFT. + // FIXME: if we change the scaling on the Mac then this scale + // factor will need to change too. + float scale = 0.5f; + + VectorMath::vsmul(realP1, 1, &scale, realP1, 1, halfSize); + VectorMath::vsmul(imagP1, 1, &scale, imagP1, 1, halfSize); +} + +void FFTFrame::doFFT(const float* data) +{ + Ipp32f* complexP = m_complexData.data(); + + // Compute Forward transform to perm format. + ippsDFTFwd_RToPerm_32f(reinterpret_cast<Ipp32f*>(const_cast<float*>(data)), complexP, m_DFTSpec, m_buffer); + + const Ipp32f scale = 2.0f; + + ippsMulC_32f_I(scale, complexP, m_FFTSize); + + Ipp32f* realP = m_realData.data(); + Ipp32f* imagP = m_imagData.data(); + ippsCplxToReal_32fc(reinterpret_cast<Ipp32fc*>(complexP), realP, imagP, m_FFTSize >> 1); +} + +void FFTFrame::doInverseFFT(float* data) +{ + Ipp32f* complexP = getUpToDateComplexData(); + + // Compute inverse transform. + ippsDFTInv_PermToR_32f(complexP, reinterpret_cast<Ipp32f*>(data), m_DFTSpec, m_buffer); + + // Scale so that a forward then inverse FFT yields exactly the original data. + const float scale = 1.0 / (2 * m_FFTSize); + + ippsMulC_32f_I(scale, reinterpret_cast<Ipp32f*>(data), m_FFTSize); +} + +float* FFTFrame::realData() const +{ + return const_cast<float*>(m_realData.data()); +} + +float* FFTFrame::imagData() const +{ + return const_cast<float*>(m_imagData.data()); +} + +float* FFTFrame::getUpToDateComplexData() +{ + int len = m_FFTSize >> 1; + // Merge the real and imagimary vectors to complex vector. + Ipp32f* realP = m_realData.data(); + Ipp32f* imagP = m_imagData.data(); + Ipp32fc* complexP = reinterpret_cast<Ipp32fc*>(m_complexData.data()); + ippsRealToCplx_32f(realP, imagP, complexP, len); + + return const_cast<float*>(m_complexData.data()); +} + +} // namespace WebCore + +#endif // USE(WEBAUDIO_IPP) + +#endif // ENABLE(WEB_AUDIO) diff --git a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp index b2829c4e9..d26e55664 100644 --- a/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/PlatformScreenBlackBerry.cpp @@ -20,7 +20,6 @@ #include "PlatformScreen.h" #include "FloatRect.h" -#include "FrameView.h" #include "Widget.h" #include <BlackBerryPlatformScreen.h> @@ -42,12 +41,12 @@ int screenDepth(Widget*) return 24; } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::size()))); } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { return FloatRect(FloatPoint(), FloatSize(IntSize(BlackBerry::Platform::Graphics::Screen::size()))); } diff --git a/Source/WebCore/platform/blackberry/SystemTimeBlackBerry.cpp b/Source/WebCore/platform/blackberry/SystemTimeBlackBerry.cpp index 930b5011c..8e794f2b4 100644 --- a/Source/WebCore/platform/blackberry/SystemTimeBlackBerry.cpp +++ b/Source/WebCore/platform/blackberry/SystemTimeBlackBerry.cpp @@ -21,13 +21,15 @@ #include "SystemTime.h" #include "NotImplemented.h" +#include <limits> namespace WebCore { float userIdleTime() { notImplemented(); - return 0; + // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed. + return std::numeric_limits<float>::max(); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/FramelessScrollView.h b/Source/WebCore/platform/chromium/FramelessScrollView.h index b0e339b64..3498475dc 100644 --- a/Source/WebCore/platform/chromium/FramelessScrollView.h +++ b/Source/WebCore/platform/chromium/FramelessScrollView.h @@ -36,7 +36,7 @@ namespace WebCore { class FramelessScrollViewClient; -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) class PlatformGestureEvent; #endif class PlatformKeyboardEvent; @@ -69,7 +69,7 @@ namespace WebCore { #if ENABLE(TOUCH_EVENTS) virtual bool handleTouchEvent(const PlatformTouchEvent&) = 0; #endif -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) virtual bool handleGestureEvent(const PlatformGestureEvent&) = 0; #endif diff --git a/Source/WebCore/platform/chromium/GestureRecognizerChromium.cpp b/Source/WebCore/platform/chromium/GestureRecognizerChromium.cpp deleted file mode 100644 index f55455d96..000000000 --- a/Source/WebCore/platform/chromium/GestureRecognizerChromium.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * 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 "GestureRecognizerChromium.h" - -namespace WebCore { - -// FIXME: Make these configurable programmatically. -static const double maximumTouchDownDurationInSecondsForClick = 0.8; -static const double minimumTouchDownDurationInSecondsForClick = 0.01; -static const double maximumSecondsBetweenDoubleClick = 0.7; -static const int maximumTouchMoveInPixelsForClick = 20; -static const float minFlickSpeedSquared = 550.f * 550.f; - -GestureRecognizerChromium::GestureRecognizerChromium() - : m_firstTouchTime(0.0) - , m_state(GestureRecognizerChromium::NoGesture) - , m_lastTouchTime(0.0) - , m_lastClickTime(0.0) - , m_lastClickPosition() - , m_lastTouchPosition() - , m_lastTouchScreenPosition() - , m_xVelocity(0.0) - , m_yVelocity(0.0) - , m_ctrlKey(false) - , m_altKey(false) - , m_shiftKey(false) - , m_metaKey(false) -{ - const unsigned FirstFinger = 0; - const PlatformTouchPoint::State Released = PlatformTouchPoint::TouchReleased; - const PlatformTouchPoint::State Pressed = PlatformTouchPoint::TouchPressed; - const PlatformTouchPoint::State Moved = PlatformTouchPoint::TouchMoved; - const PlatformTouchPoint::State Stationary = PlatformTouchPoint::TouchStationary; - const PlatformTouchPoint::State Cancelled = PlatformTouchPoint::TouchCancelled; - - addEdgeFunction(NoGesture, FirstFinger, Pressed, false, &GestureRecognizerChromium::touchDown); - addEdgeFunction(PendingSyntheticClick, FirstFinger, Cancelled, false, &GestureRecognizerChromium::noGesture); - addEdgeFunction(PendingSyntheticClick, FirstFinger, Released, false, &GestureRecognizerChromium::click); - addEdgeFunction(PendingSyntheticClick, FirstFinger, Moved, false, &GestureRecognizerChromium::isClickOrScroll); - addEdgeFunction(PendingSyntheticClick, FirstFinger, Stationary, false, &GestureRecognizerChromium::isClickOrScroll); - addEdgeFunction(Scroll, FirstFinger, Moved, false, &GestureRecognizerChromium::inScroll); - addEdgeFunction(Scroll, FirstFinger, Released, false, &GestureRecognizerChromium::scrollEnd); - addEdgeFunction(Scroll, FirstFinger, Cancelled, false, &GestureRecognizerChromium::scrollEnd); -} - -void GestureRecognizerChromium::reset() -{ - m_firstTouchTime = 0.0; - m_state = GestureRecognizerChromium::NoGesture; - m_lastTouchTime = 0.0; - m_lastTouchPosition.setX(0); - m_lastTouchPosition.setY(0); - m_lastTouchScreenPosition.setX(0); - m_lastTouchScreenPosition.setY(0); - m_xVelocity = 0.0; - m_yVelocity = 0.0; -} - -GestureRecognizerChromium::~GestureRecognizerChromium() -{ -} - -void GestureRecognizerChromium::addEdgeFunction(State state, unsigned fingerId, PlatformTouchPoint::State touchType, bool touchHandledByJavaScript, GestureTransitionFunction transitionFunction) -{ - m_edgeFunctions.add(signature(state, fingerId, touchType, touchHandledByJavaScript), transitionFunction); -} - -bool GestureRecognizerChromium::isInClickTimeWindow() -{ - double duration(m_lastTouchTime - m_firstTouchTime); - return duration >= minimumTouchDownDurationInSecondsForClick && duration < maximumTouchDownDurationInSecondsForClick; -} - -bool GestureRecognizerChromium::isInSecondClickTimeWindow() -{ - double duration(m_lastTouchTime - m_lastClickTime); - return duration < maximumSecondsBetweenDoubleClick; -} - -bool GestureRecognizerChromium::isInsideManhattanSquare(const PlatformTouchPoint& point) -{ - int manhattanDistance = abs(point.pos().x() - m_firstTouchPosition.x()) + abs(point.pos().y() - m_firstTouchPosition.y()); - return manhattanDistance < maximumTouchMoveInPixelsForClick; -} - -bool GestureRecognizerChromium::isSecondClickInsideManhattanSquare(const PlatformTouchPoint& point) -{ - int manhattanDistance = abs(point.pos().x() - m_lastClickPosition.x()) + abs(point.pos().y() - m_lastClickPosition.y()); - return manhattanDistance < maximumTouchMoveInPixelsForClick; -} - -bool GestureRecognizerChromium::isOverMinFlickSpeed() -{ - return (m_xVelocity * m_xVelocity + m_yVelocity * m_yVelocity) > minFlickSpeedSquared; -} - -void GestureRecognizerChromium::appendTapDownGestureEvent(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - gestures->append(PlatformGestureEvent(PlatformEvent::GestureTapDown, m_firstTouchPosition, m_firstTouchScreenPosition, m_lastTouchTime, 0.f, 0.f, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); -} - -void GestureRecognizerChromium::appendClickGestureEvent(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - gestures->append(PlatformGestureEvent(PlatformEvent::GestureTap, m_firstTouchPosition, m_firstTouchScreenPosition, m_lastTouchTime, 0.f, 0.f, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); -} - -void GestureRecognizerChromium::appendDoubleClickGestureEvent(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - gestures->append(PlatformGestureEvent(PlatformEvent::GestureDoubleTap, m_firstTouchPosition, m_firstTouchScreenPosition, m_lastTouchTime, 0.f, 0.f, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); -} - -PlatformGestureRecognizer::PassGestures GestureRecognizerChromium::processTouchEventForGestures(const PlatformTouchEvent& event, bool defaultPrevented) -{ - m_ctrlKey = event.ctrlKey(); - m_altKey = event.altKey(); - m_shiftKey = event.shiftKey(); - m_metaKey = event.metaKey(); - - OwnPtr<Vector<PlatformGestureEvent> > gestures = adoptPtr(new Vector<PlatformGestureEvent>()); - const Vector<PlatformTouchPoint>& points = event.touchPoints(); - for (unsigned i = 0; i < points.size(); i++) { - const PlatformTouchPoint& p = points[i]; - updateValues(event.timestamp(), p); - - if (GestureTransitionFunction ef = m_edgeFunctions.get(signature(m_state, p.id(), p.state(), defaultPrevented))) - ((*this).*ef)(p, gestures.get()); - } - return gestures.release(); -} - -void GestureRecognizerChromium::appendScrollGestureBegin(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - gestures->append(PlatformGestureEvent(PlatformEvent::GestureScrollBegin, touchPoint.pos(), touchPoint.screenPos(), m_lastTouchTime, 0.f, 0.f, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); -} - -void GestureRecognizerChromium::appendScrollGestureEnd(const PlatformTouchPoint& touchPoint, Gestures gestures, float xVelocity, float yVelocity) -{ - gestures->append(PlatformGestureEvent(PlatformEvent::GestureScrollEnd, touchPoint.pos(), touchPoint.screenPos(), m_lastTouchTime, xVelocity, yVelocity, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); -} - -void GestureRecognizerChromium::appendScrollGestureUpdate(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - float deltaX(touchPoint.pos().x() - m_firstTouchPosition.x()); - float deltaY(touchPoint.pos().y() - m_firstTouchPosition.y()); - - gestures->append(PlatformGestureEvent(PlatformEvent::GestureScrollUpdate, touchPoint.pos(), touchPoint.screenPos(), m_lastTouchTime, deltaX, deltaY, m_shiftKey, m_ctrlKey, m_altKey, m_metaKey)); - m_firstTouchPosition = touchPoint.pos(); -} - -void GestureRecognizerChromium::updateValues(const double touchTime, const PlatformTouchPoint& touchPoint) -{ - if (m_state != NoGesture && touchPoint.state() == PlatformTouchPoint::TouchMoved) { - double interval(touchTime - m_lastTouchTime); - m_xVelocity = (touchPoint.pos().x() - m_lastTouchPosition.x()) / interval; - m_yVelocity = (touchPoint.pos().y() - m_lastTouchPosition.y()) / interval; - } - m_lastTouchTime = touchTime; - m_lastTouchPosition = touchPoint.pos(); - m_lastTouchScreenPosition = touchPoint.screenPos(); - if (state() == NoGesture) { - m_firstTouchTime = touchTime; - m_firstTouchPosition = touchPoint.pos(); - m_firstTouchScreenPosition = touchPoint.screenPos(); - m_xVelocity = 0.0; - m_yVelocity = 0.0; - } -} - -// Builds a signature. Signatures are assembled by joining together multiple bits. -// 1 LSB bit so that the computed signature is always greater than 0 -// 3 bits for the |touchType|. -// 1 bit for |handled| -// 12 bits for |id| -// 15 bits for the |gestureState|. -unsigned int GestureRecognizerChromium::signature(State gestureState, unsigned id, PlatformTouchPoint::State touchType, bool handled) -{ - ASSERT((id & 0xfff) == id); - return 1 + ((touchType & 0x7) << 1 | (handled ? 1 << 4 : 0) | ((id & 0xfff) << 5 ) | (gestureState << 17)); -} - -bool GestureRecognizerChromium::touchDown(const PlatformTouchPoint& touchPoint, Gestures gestures) -{ - appendTapDownGestureEvent(touchPoint, gestures); - setState(PendingSyntheticClick); - return false; -} - -bool GestureRecognizerChromium::scrollEnd(const PlatformTouchPoint& point, Gestures gestures) -{ - if (isOverMinFlickSpeed() && point.state() != PlatformTouchPoint::TouchCancelled) - appendScrollGestureEnd(point, gestures, m_xVelocity, m_yVelocity); - else - appendScrollGestureEnd(point, gestures, 0.f, 0.f); - setState(NoGesture); - reset(); - return false; -} - -bool GestureRecognizerChromium::noGesture(const PlatformTouchPoint&, Gestures) -{ - reset(); - return false; -} - -bool GestureRecognizerChromium::click(const PlatformTouchPoint& point, Gestures gestures) -{ - bool gestureAdded = false; - if (isInClickTimeWindow() && isInsideManhattanSquare(point)) { - gestureAdded = true; - appendClickGestureEvent(point, gestures); - if (isInSecondClickTimeWindow() && isSecondClickInsideManhattanSquare(point)) - appendDoubleClickGestureEvent(point, gestures); - m_lastClickTime = m_lastTouchTime; - m_lastClickPosition = m_lastTouchPosition; - } - reset(); - return gestureAdded; -} - -bool GestureRecognizerChromium::isClickOrScroll(const PlatformTouchPoint& point, Gestures gestures) -{ - if (isInClickTimeWindow() && isInsideManhattanSquare(point)) { - setState(GestureRecognizerChromium::PendingSyntheticClick); - return false; - } - - if (point.state() == PlatformTouchPoint::TouchMoved && !isInsideManhattanSquare(point)) { - appendScrollGestureBegin(point, gestures); - appendScrollGestureUpdate(point, gestures); - setState(Scroll); - return true; - } - return false; -} - -bool GestureRecognizerChromium::inScroll(const PlatformTouchPoint& point, Gestures gestures) -{ - appendScrollGestureUpdate(point, gestures); - return true; -} - -PassOwnPtr<PlatformGestureRecognizer> PlatformGestureRecognizer::create() -{ - GestureRecognizerChromium* gestureRecognizer = new GestureRecognizerChromium(); - return adoptPtr(gestureRecognizer); -} - -PlatformGestureRecognizer::PlatformGestureRecognizer() -{ -} - -PlatformGestureRecognizer::~PlatformGestureRecognizer() -{ -} - -} // namespace WebCore diff --git a/Source/WebCore/platform/chromium/GestureRecognizerChromium.h b/Source/WebCore/platform/chromium/GestureRecognizerChromium.h deleted file mode 100644 index 4889866f6..000000000 --- a/Source/WebCore/platform/chromium/GestureRecognizerChromium.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2011, Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * 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 GestureRecognizerChromium_h -#define GestureRecognizerChromium_h - -#include "PlatformGestureRecognizer.h" - -#include "PlatformTouchEvent.h" -#include "PlatformTouchPoint.h" -#include <wtf/HashMap.h> - -class InspectableGestureRecognizerChromium; - -namespace WebCore { - -class PlatformGestureEvent; - -class GestureRecognizerChromium : public PlatformGestureRecognizer { -public: - enum State { - NoGesture, - PendingSyntheticClick, - Scroll, - }; - - typedef Vector<PlatformGestureEvent>* Gestures; - typedef bool (GestureRecognizerChromium::*GestureTransitionFunction)(const PlatformTouchPoint&, Gestures); - - GestureRecognizerChromium(); - ~GestureRecognizerChromium(); - - virtual void reset(); - virtual PlatformGestureRecognizer::PassGestures processTouchEventForGestures(const PlatformTouchEvent&, bool defaultPrevented); - State state() { return m_state; } - -private: - friend class ::InspectableGestureRecognizerChromium; - - static unsigned int signature(State, unsigned, PlatformTouchPoint::State, bool); - void addEdgeFunction(State, unsigned finger, PlatformTouchPoint::State, bool touchHandledByJavaScript, GestureTransitionFunction); - void appendTapDownGestureEvent(const PlatformTouchPoint&, Gestures); - void appendClickGestureEvent(const PlatformTouchPoint&, Gestures); - void appendDoubleClickGestureEvent(const PlatformTouchPoint&, Gestures); - void appendScrollGestureBegin(const PlatformTouchPoint&, Gestures); - void appendScrollGestureEnd(const PlatformTouchPoint&, Gestures, float, float); - void appendScrollGestureUpdate(const PlatformTouchPoint&, Gestures); - bool isInClickTimeWindow(); - bool isInSecondClickTimeWindow(); - bool isInsideManhattanSquare(const PlatformTouchPoint&); - bool isSecondClickInsideManhattanSquare(const PlatformTouchPoint&); - bool isOverMinFlickSpeed(); - void setState(State value) { m_state = value; } - void updateValues(double touchTime, const PlatformTouchPoint&); - - bool click(const PlatformTouchPoint&, Gestures); - bool isClickOrScroll(const PlatformTouchPoint&, Gestures); - bool inScroll(const PlatformTouchPoint&, Gestures); - bool noGesture(const PlatformTouchPoint&, Gestures); - bool touchDown(const PlatformTouchPoint&, Gestures); - bool scrollEnd(const PlatformTouchPoint&, Gestures); - - WTF::HashMap<int, GestureTransitionFunction> m_edgeFunctions; - IntPoint m_firstTouchPosition; - IntPoint m_firstTouchScreenPosition; - double m_firstTouchTime; - State m_state; - double m_lastTouchTime; - double m_lastClickTime; - IntPoint m_lastClickPosition; - IntPoint m_lastTouchPosition; - IntPoint m_lastTouchScreenPosition; - float m_xVelocity; - float m_yVelocity; - - bool m_ctrlKey; - bool m_altKey; - bool m_shiftKey; - bool m_metaKey; -}; - -} // namespace WebCore - -#endif // GestureRecognizerChromium_h diff --git a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp index e0553b930..79b9dcd3c 100644 --- a/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp +++ b/Source/WebCore/platform/chromium/PlatformScreenChromium.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "PlatformScreen.h" -#include "FrameView.h" #include "IntRect.h" #include "PlatformSupport.h" @@ -62,14 +61,14 @@ bool screenIsMonochrome(Widget* widget) return PlatformSupport::screenIsMonochrome(widget); } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - return PlatformSupport::screenRect(frameView); + return PlatformSupport::screenRect(widget); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { - return PlatformSupport::screenAvailableRect(frameView); + return PlatformSupport::screenAvailableRect(widget); } } // namespace WebCore diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h index 1f396c5d3..170177507 100644 --- a/Source/WebCore/platform/chromium/PlatformSupport.h +++ b/Source/WebCore/platform/chromium/PlatformSupport.h @@ -71,7 +71,6 @@ class Color; class Cursor; class Document; class Frame; -class FrameView; class GamepadList; class GeolocationServiceBridge; class GeolocationServiceChromium; @@ -246,8 +245,8 @@ public: static int screenDepth(Widget*); static int screenDepthPerComponent(Widget*); static bool screenIsMonochrome(Widget*); - static IntRect screenRect(FrameView*); - static IntRect screenAvailableRect(FrameView*); + static IntRect screenRect(Widget*); + static IntRect screenAvailableRect(Widget*); // SharedTimers ------------------------------------------------------- static void setSharedTimerFiredFunction(void (*func)()); diff --git a/Source/WebCore/platform/chromium/PopupContainer.cpp b/Source/WebCore/platform/chromium/PopupContainer.cpp index 59a0f60ae..e231b8506 100644 --- a/Source/WebCore/platform/chromium/PopupContainer.cpp +++ b/Source/WebCore/platform/chromium/PopupContainer.cpp @@ -292,7 +292,7 @@ bool PopupContainer::handleTouchEvent(const PlatformTouchEvent&) } #endif -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) // FIXME: Refactor this code to share functionality with EventHandler::handleGestureEvent. bool PopupContainer::handleGestureEvent(const PlatformGestureEvent& gestureEvent) { diff --git a/Source/WebCore/platform/chromium/PopupContainer.h b/Source/WebCore/platform/chromium/PopupContainer.h index 452e1b425..d776663f4 100644 --- a/Source/WebCore/platform/chromium/PopupContainer.h +++ b/Source/WebCore/platform/chromium/PopupContainer.h @@ -65,7 +65,7 @@ public: #if ENABLE(TOUCH_EVENTS) virtual bool handleTouchEvent(const PlatformTouchEvent&); #endif -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) virtual bool handleGestureEvent(const PlatformGestureEvent&); #endif diff --git a/Source/WebCore/platform/chromium/PopupListBox.cpp b/Source/WebCore/platform/chromium/PopupListBox.cpp index bc00c70ed..11164ccc3 100644 --- a/Source/WebCore/platform/chromium/PopupListBox.cpp +++ b/Source/WebCore/platform/chromium/PopupListBox.cpp @@ -186,7 +186,7 @@ bool PopupListBox::handleTouchEvent(const PlatformTouchEvent&) } #endif -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) bool PopupListBox::handleGestureEvent(const PlatformGestureEvent&) { return false; diff --git a/Source/WebCore/platform/chromium/PopupListBox.h b/Source/WebCore/platform/chromium/PopupListBox.h index 4cec3a41a..dd2e58ded 100644 --- a/Source/WebCore/platform/chromium/PopupListBox.h +++ b/Source/WebCore/platform/chromium/PopupListBox.h @@ -123,7 +123,7 @@ public: #if ENABLE(TOUCH_EVENTS) virtual bool handleTouchEvent(const PlatformTouchEvent&); #endif -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) virtual bool handleGestureEvent(const PlatformGestureEvent&); #endif diff --git a/Source/WebCore/platform/efl/LanguageEfl.cpp b/Source/WebCore/platform/efl/LanguageEfl.cpp index e6c1a7259..2b0a13dd8 100644 --- a/Source/WebCore/platform/efl/LanguageEfl.cpp +++ b/Source/WebCore/platform/efl/LanguageEfl.cpp @@ -42,13 +42,8 @@ static String platformLanguage() if (!localeDefault) return String("c"); - - char* ptr = strchr(localeDefault, '_'); - if (ptr) - *ptr = '-'; - - return String(localeDefault); + return String(localeDefault).replace('_', '-'); } Vector<String> platformUserPreferredLanguages() diff --git a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp index f30d23da7..fac959723 100644 --- a/Source/WebCore/platform/efl/PlatformScreenEfl.cpp +++ b/Source/WebCore/platform/efl/PlatformScreenEfl.cpp @@ -34,7 +34,6 @@ #include "config.h" #include "PlatformScreen.h" -#include "FrameView.h" #include "NotImplemented.h" #include "PlatformString.h" #include "Widget.h" @@ -74,23 +73,23 @@ bool screenIsMonochrome(Widget*) return false; } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - if (!frameView) + if (!widget) return FloatRect(); int x, y, w, h; - Evas* e = frameView->evas(); + Evas* e = widget->evas(); ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(e), &x, &y, &w, &h); return FloatRect(x, y, w, h); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { notImplemented(); - return screenRect(frameView); + return screenRect(widget); } } diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.cpp b/Source/WebCore/platform/efl/RenderThemeEfl.cpp index ad662c4c2..2140fe8be 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.cpp +++ b/Source/WebCore/platform/efl/RenderThemeEfl.cpp @@ -822,7 +822,7 @@ bool RenderThemeEfl::controlSupportsTints(const RenderObject* object) const return isEnabled(object); } -int RenderThemeEfl::baselinePosition(const RenderObject* object) const +LayoutUnit RenderThemeEfl::baselinePosition(const RenderObject* object) const { if (!object->isBox()) return 0; diff --git a/Source/WebCore/platform/efl/RenderThemeEfl.h b/Source/WebCore/platform/efl/RenderThemeEfl.h index 30a0f0d5e..cef32b85f 100644 --- a/Source/WebCore/platform/efl/RenderThemeEfl.h +++ b/Source/WebCore/platform/efl/RenderThemeEfl.h @@ -91,7 +91,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual LayoutUnit baselinePosition(const RenderObject*) const; virtual Color platformActiveSelectionBackgroundColor() const { return m_activeSelectionBackgroundColor; } virtual Color platformInactiveSelectionBackgroundColor() const { return m_inactiveSelectionBackgroundColor; } diff --git a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h index 0f4bf7d00..c638bc0fc 100644 --- a/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h +++ b/Source/WebCore/platform/graphics/ANGLEWebKitBridge.h @@ -31,7 +31,7 @@ #if PLATFORM(QT) #include "ANGLE/include/GLSLANG/ShaderLang.h" -#elif !PLATFORM(GTK) +#elif !PLATFORM(GTK) && !PLATFORM(EFL) #include "ANGLE/ShaderLang.h" #else #include "ShaderLang.h" diff --git a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp index a8e969c20..ad1165fe4 100644 --- a/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp +++ b/Source/WebCore/platform/graphics/GeneratorGeneratedImage.cpp @@ -33,19 +33,19 @@ namespace WebCore { -void GeneratorGeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp) +void GeneratorGeneratedImage::draw(GraphicsContext* destContext, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp) { - GraphicsContextStateSaver stateSaver(*context); - context->setCompositeOperation(compositeOp); - context->clip(dstRect); - context->translate(dstRect.x(), dstRect.y()); - if (dstRect.size() != srcRect.size()) - context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); - context->translate(-srcRect.x(), -srcRect.y()); - context->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get()); + GraphicsContextStateSaver stateSaver(*destContext); + destContext->setCompositeOperation(compositeOp); + destContext->clip(destRect); + destContext->translate(destRect.x(), destRect.y()); + if (destRect.size() != srcRect.size()) + destContext->scale(FloatSize(destRect.width() / srcRect.width(), destRect.height() / srcRect.height())); + destContext->translate(-srcRect.x(), -srcRect.y()); + destContext->fillRect(FloatRect(FloatPoint(), m_size), *m_generator.get()); } -void GeneratorGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, +void GeneratorGeneratedImage::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect) { // Allow the generator to provide visually-equivalent tiling parameters for better performance. @@ -53,8 +53,16 @@ void GeneratorGeneratedImage::drawPattern(GraphicsContext* context, const FloatR FloatRect adjustedSrcRect = srcRect; m_generator->adjustParametersForTiledDrawing(adjustedSize, adjustedSrcRect); + // Factor in the destination context's scale to generate at the best resolution + AffineTransform destContextCTM = destContext->getCTM(); + double xScale = fabs(destContextCTM.xScale()); + double yScale = fabs(destContextCTM.yScale()); + AffineTransform adjustedPatternCTM = patternTransform; + adjustedPatternCTM.scale(1.0 / xScale, 1.0 / yScale); + adjustedSrcRect.scale(xScale, yScale); + // Create a BitmapImage and call drawPattern on it. - OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(adjustedSize, ColorSpaceDeviceRGB, context->isAcceleratedContext() ? Accelerated : Unaccelerated); + OwnPtr<ImageBuffer> imageBuffer = destContext->createCompatibleBuffer(adjustedSize); if (!imageBuffer) return; @@ -63,7 +71,7 @@ void GeneratorGeneratedImage::drawPattern(GraphicsContext* context, const FloatR graphicsContext->fillRect(FloatRect(FloatPoint(), adjustedSize), *m_generator.get()); // Tile the image buffer into the context. - imageBuffer->drawPattern(context, adjustedSrcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect); + imageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect); } void GeneratedImage::computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index 475fdb3ad..f77b8a138 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -754,7 +754,7 @@ PassOwnPtr<ImageBuffer> GraphicsContext::createCompatibleBuffer(const IntSize& s AffineTransform transform = getCTM(); IntSize scaledSize(static_cast<int>(ceil(size.width() * transform.xScale())), static_cast<int>(ceil(size.height() * transform.yScale()))); - OwnPtr<ImageBuffer> buffer = ImageBuffer::create(scaledSize); + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(scaledSize, ColorSpaceDeviceRGB, isAcceleratedContext() ? Accelerated : Unaccelerated); if (!buffer) return nullptr; diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index dea950b1d..f7bef4f95 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -124,6 +124,7 @@ namespace WebCore { class KURL; class GraphicsContext3D; class TextRun; + class TransformationMatrix; enum TextDrawingMode { TextModeInvisible = 0, @@ -409,6 +410,12 @@ namespace WebCore { void setCTM(const AffineTransform&); AffineTransform getCTM() const; +#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) + // This is needed when using accelerated-compositing in software mode, like in TextureMapper. + void concat3DTransform(const TransformationMatrix&); + void set3DTransform(const TransformationMatrix&); + TransformationMatrix get3DTransform() const; +#endif // Create an image buffer compatible with this context, with suitable resolution // for drawing into the buffer and then into this context. PassOwnPtr<ImageBuffer> createCompatibleBuffer(const IntSize&) const; diff --git a/Source/WebCore/platform/graphics/GraphicsContext3D.h b/Source/WebCore/platform/graphics/GraphicsContext3D.h index 34c549ab4..96e66ca33 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext3D.h +++ b/Source/WebCore/platform/graphics/GraphicsContext3D.h @@ -26,7 +26,6 @@ #ifndef GraphicsContext3D_h #define GraphicsContext3D_h -#include "IntSize.h" #include "GraphicsLayer.h" #include "GraphicsTypes3D.h" #include "PlatformString.h" @@ -43,7 +42,7 @@ #undef VERSION #endif -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) #include "ANGLEWebKitBridge.h" #endif @@ -57,7 +56,7 @@ QT_BEGIN_NAMESPACE class QPainter; class QRect; QT_END_NAMESPACE -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) typedef unsigned int GLuint; #endif @@ -83,7 +82,7 @@ namespace WebCore { class CanvasRenderingContext; class DrawingBuffer; class Extensions3D; -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) class Extensions3DOpenGL; #endif #if PLATFORM(QT) @@ -93,6 +92,8 @@ class HostWindow; class Image; class ImageBuffer; class ImageData; +class IntRect; +class IntSize; #if USE(CAIRO) class PlatformContextCairo; #endif @@ -493,6 +494,7 @@ public: #endif #elif PLATFORM(EFL) PlatformGraphicsContext3D platformGraphicsContext3D() const; + Platform3DObject platformTexture() const { return m_texture; } #if USE(ACCELERATED_COMPOSITING) PlatformLayer* platformLayer() const; #endif @@ -505,7 +507,7 @@ public: #endif bool makeContextCurrent(); -#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(GTK) || PLATFORM(QT) +#if PLATFORM(MAC) || PLATFORM(CHROMIUM) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) // With multisampling on, blit from multisampleFBO to regular FBO. void prepareTexture(); #endif @@ -784,7 +786,7 @@ public: #if USE(CG) static void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, CGContextRef); -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, int canvasWidth, int canvasHeight, PlatformContextCairo* context); #endif @@ -803,6 +805,8 @@ public: bool paintsIntoCanvasBuffer() const; #elif PLATFORM(GTK) bool paintsIntoCanvasBuffer() const { return true; } +#elif PLATFORM(EFL) + bool paintsIntoCanvasBuffer() const { return true; } #else bool paintsIntoCanvasBuffer() const { return false; } #endif @@ -893,7 +897,7 @@ public: AlphaOp alphaOp, void* destinationData); -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) // Take into account the user's requested context creation attributes, // in particular stencil and antialias, and determine which could or // could not be honored based on the capabilities of the OpenGL @@ -905,6 +909,9 @@ public: void readRenderingResults(unsigned char* pixels, int pixelsSize); #endif + bool reshapeFBOs(const IntSize&); + void resolveMultisamplingIfNecessary(const IntRect&); + int m_currentWidth, m_currentHeight; bool isResourceSafe(); @@ -913,7 +920,7 @@ public: RetainPtr<WebGLLayer> m_webGLLayer; #endif -#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) +#if PLATFORM(MAC) || PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL) typedef struct { String source; String log; @@ -939,6 +946,10 @@ public: GC3Duint m_depthBuffer; GC3Duint m_stencilBuffer; #else +#if USE(OPENGL_ES_2) + GC3Duint m_depthBuffer; + GC3Duint m_stencilBuffer; +#endif GC3Duint m_depthStencilBuffer; #endif bool m_layerComposited; diff --git a/Source/WebCore/platform/graphics/ImageBuffer.cpp b/Source/WebCore/platform/graphics/ImageBuffer.cpp index 176de7210..5391c3815 100644 --- a/Source/WebCore/platform/graphics/ImageBuffer.cpp +++ b/Source/WebCore/platform/graphics/ImageBuffer.cpp @@ -86,7 +86,7 @@ inline void ImageBuffer::genericConvertToLuminanceMask() double luma = (r * 0.2125 + g * 0.7154 + b * 0.0721) * ((double)a / 255.0); srcPixelArray->set(pixelOffset + 3, luma); } - putUnmultipliedImageData(srcPixelArray.get(), luminanceRect.size(), luminanceRect, IntPoint()); + putByteArray(Unmultiplied, srcPixelArray.get(), luminanceRect.size(), luminanceRect, IntPoint()); } void ImageBuffer::convertToLuminanceMask() diff --git a/Source/WebCore/platform/graphics/ImageBuffer.h b/Source/WebCore/platform/graphics/ImageBuffer.h index ebc5bfa52..f97dc7939 100644 --- a/Source/WebCore/platform/graphics/ImageBuffer.h +++ b/Source/WebCore/platform/graphics/ImageBuffer.h @@ -101,8 +101,7 @@ namespace WebCore { PassRefPtr<ByteArray> getUnmultipliedImageData(const IntRect&) const; PassRefPtr<ByteArray> getPremultipliedImageData(const IntRect&) const; - void putUnmultipliedImageData(ByteArray*, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint); - void putPremultipliedImageData(ByteArray*, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint); + void putByteArray(Multiply multiplied, ByteArray*, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint); void convertToLuminanceMask(); diff --git a/Source/WebCore/platform/graphics/Region.cpp b/Source/WebCore/platform/graphics/Region.cpp index 5427c6c91..584a3a5fd 100644 --- a/Source/WebCore/platform/graphics/Region.cpp +++ b/Source/WebCore/platform/graphics/Region.cpp @@ -65,6 +65,18 @@ Vector<IntRect> Region::rects() const return rects; } +bool Region::contains(const Region& region) const +{ + return WebCore::intersect(region, *this) == region; +} + +bool Region::contains(const IntPoint& point) const +{ + // FIXME: This is inefficient. We should be able to iterate over the spans and find + // out if the region contains the point. + return contains(IntRect(point, IntSize(1, 1))); +} + Region::Shape::Shape() { } @@ -279,7 +291,7 @@ Region::Shape Region::Shape::shapeOperation(const Shape& shape1, const Shape& sh SegmentIterator s1 = segments1; SegmentIterator s2 = segments2; - Vector<int> segments; + Vector<int, 32> segments; // Now iterate over the segments in each span and construct a new vector of segments. while (s1 != segments1End && s2 != segments2End) { diff --git a/Source/WebCore/platform/graphics/Region.h b/Source/WebCore/platform/graphics/Region.h index b5359bbe3..8bc839578 100644 --- a/Source/WebCore/platform/graphics/Region.h +++ b/Source/WebCore/platform/graphics/Region.h @@ -47,6 +47,11 @@ public: void translate(const IntSize&); + // Returns true if the query region is a subset of this region. + bool contains(const Region&) const; + + bool contains(const IntPoint&) const; + #ifndef NDEBUG void dump() const; #endif @@ -104,13 +109,18 @@ private: bool canCoalesce(SegmentIterator begin, SegmentIterator end); - // FIXME: These vectors should have inline sizes. Figure out a good optimal value. - Vector<int> m_segments; - Vector<Span> m_spans; + Vector<int, 32> m_segments; + Vector<Span, 16> m_spans; + + friend bool operator==(const Shape&, const Shape&); }; IntRect m_bounds; Shape m_shape; + + friend bool operator==(const Region&, const Region&); + friend bool operator==(const Shape&, const Shape&); + friend bool operator==(const Span&, const Span&); }; static inline Region intersect(const Region& a, const Region& b) @@ -137,6 +147,21 @@ static inline Region translate(const Region& region, const IntSize& offset) return result; } +inline bool operator==(const Region& a, const Region& b) +{ + return a.m_bounds == b.m_bounds && a.m_shape == b.m_shape; +} + +inline bool operator==(const Region::Shape& a, const Region::Shape& b) +{ + return a.m_spans == b.m_spans && a.m_segments == b.m_segments; +} + +inline bool operator==(const Region::Span& a, const Region::Span& b) +{ + return a.y == b.y && a.segmentIndex == b.segmentIndex; +} + } // namespace WebCore #endif // Region_h diff --git a/Source/WebCore/platform/graphics/ShadowBlur.cpp b/Source/WebCore/platform/graphics/ShadowBlur.cpp index 72fdffb4e..b00231215 100644 --- a/Source/WebCore/platform/graphics/ShadowBlur.cpp +++ b/Source/WebCore/platform/graphics/ShadowBlur.cpp @@ -828,7 +828,7 @@ void ShadowBlur::blurShadowBuffer(const IntSize& templateSize) IntRect blurRect(IntPoint(), templateSize); RefPtr<ByteArray> layerData = m_layerImage->getUnmultipliedImageData(blurRect); blurLayerImage(layerData->data(), blurRect.size(), blurRect.width() * 4); - m_layerImage->putUnmultipliedImageData(layerData.get(), blurRect.size(), blurRect, IntPoint()); + m_layerImage->putByteArray(Unmultiplied, layerData.get(), blurRect.size(), blurRect, IntPoint()); } void ShadowBlur::blurAndColorShadowBuffer(const IntSize& templateSize) diff --git a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp index 4a9a33599..47de3f871 100644 --- a/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp +++ b/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp @@ -566,6 +566,15 @@ void PlatformCALayer::setOpacity(float value) setNeedsCommit(); } +void PlatformCALayer::setFilters(const FilterOperations&) +{ +} + +bool PlatformCALayer::filtersCanBeComposited(const FilterOperations&) +{ + return false; +} + String PlatformCALayer::name() const { return CACFLayerGetName(m_layer.get()); diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index 4c3447b72..ba886a03c 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -1139,6 +1139,24 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const return platformContext()->imageInterpolationQuality(); } +#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) +TransformationMatrix GraphicsContext::get3DTransform() const +{ + notImplemented(); + return TransformationMatrix(); +} + +void GraphicsContext::concat3DTransform(const TransformationMatrix& transform) +{ + notImplemented(); +} + +void GraphicsContext::set3DTransform(const TransformationMatrix& transform) +{ + notImplemented(); +} +#endif + } // namespace WebCore #endif // USE(CAIRO) diff --git a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp index f4d2ea22c..7ae5024a6 100644 --- a/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp @@ -204,12 +204,11 @@ PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect return getImageData<Premultiplied>(rect, m_data, m_size); } -template <Multiply multiplied> -void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { - ASSERT(cairo_surface_get_type(data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); + ASSERT(cairo_surface_get_type(m_data.m_surface) == CAIRO_SURFACE_TYPE_IMAGE); - unsigned char* dataDst = cairo_image_surface_get_data(data.m_surface); + unsigned char* dataDst = cairo_image_surface_get_data(m_data.m_surface); ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -217,28 +216,28 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < size.width()); + ASSERT(destx < m_size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.maxX()); int endx = destPoint.x() + sourceRect.maxX(); - ASSERT(endx <= size.width()); + ASSERT(endx <= m_size.width()); int numColumns = endx - destx; int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); - ASSERT(desty < size.height()); + ASSERT(desty < m_size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.maxY()); int endy = destPoint.y() + sourceRect.maxY(); - ASSERT(endy <= size.height()); + ASSERT(endy <= m_size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * sourceSize.width(); - int stride = cairo_image_surface_get_stride(data.m_surface); + int stride = cairo_image_surface_get_stride(m_data.m_surface); unsigned char* srcRows = source->data() + originy * srcBytesPerRow + originx * 4; for (int y = 0; y < numRows; ++y) { @@ -257,21 +256,11 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& } srcRows += srcBytesPerRow; } - cairo_surface_mark_dirty_rectangle (data.m_surface, + cairo_surface_mark_dirty_rectangle(m_data.m_surface, destx, desty, numColumns, numRows); } -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, m_data, m_size); -} - -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, m_data, m_size); -} - #if !PLATFORM(GTK) static cairo_status_t writeFunction(void* closure, const unsigned char* data, unsigned int length) { diff --git a/Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp b/Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp index 61d8b205b..e72951195 100644 --- a/Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/TextureMapperCairo.cpp @@ -115,11 +115,6 @@ void TextureMapperCairo::drawTexture(const BitmapTexture& texture, const FloatRe notImplemented(); } -PassOwnPtr<TextureMapper> TextureMapper::create(GraphicsContext* context) -{ - return adoptPtr(new TextureMapperCairo); -} - PassRefPtr<BitmapTexture> TextureMapperCairo::createTexture() { return adoptRef(new BitmapTextureCairo()); diff --git a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp b/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp deleted file mode 100644 index 1371b6614..000000000 --- a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2011 ChangSeok Oh <shivamidow@gmail.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "TextureMapperGLCairo.h" - -#include "NotImplemented.h" - -namespace WebCore { - -BGRA32PremultimpliedBufferCairo::BGRA32PremultimpliedBufferCairo() - : m_context(0) - , m_cairoContext(0) - , m_cairoSurface(0) -{ - notImplemented(); -} - -BGRA32PremultimpliedBufferCairo::~BGRA32PremultimpliedBufferCairo() -{ - notImplemented(); -} - -PlatformGraphicsContext* BGRA32PremultimpliedBufferCairo::beginPaint(const IntRect& dirtyRect, bool opaque) -{ - notImplemented(); - return 0; -} - -void* BGRA32PremultimpliedBufferCairo::data() -{ - notImplemented(); - return 0; -} - -void BGRA32PremultimpliedBufferCairo::endPaint() -{ - notImplemented(); -} - -uint64_t uidForImage(Image* image) -{ - notImplemented(); - return 0; -} - -PassOwnPtr<BGRA32PremultimpliedBuffer> BGRA32PremultimpliedBuffer::create() -{ - notImplemented(); - return adoptPtr(new BGRA32PremultimpliedBufferCairo()); -} - -}; diff --git a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp index 02ba8cffd..e9f77f301 100644 --- a/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp +++ b/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp @@ -307,26 +307,38 @@ PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect return m_data.getData(rect, m_size, m_context->isAcceleratedContext(), false); } -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { - if (m_context->isAcceleratedContext()) { - CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) - m_data.m_lastFlushTime = currentTimeMS(); -#endif + if (!m_context->isAcceleratedContext()) { + m_data.putData(source, sourceSize, sourceRect, destPoint, m_size, m_context->isAcceleratedContext(), multiplied == Unmultiplied); + return; } - m_data.putData(source, sourceSize, sourceRect, destPoint, m_size, m_context->isAcceleratedContext(), true); -} -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - if (m_context->isAcceleratedContext()) { - CGContextFlush(context()->platformContext()); -#if defined(BUILDING_ON_LION) - m_data.m_lastFlushTime = currentTimeMS(); +#if USE(IOSURFACE_CANVAS_BACKING_STORE) + // Make a copy of the source to ensure the bits don't change before being drawn + IntSize sourceCopySize(sourceRect.width(), sourceRect.height()); + OwnPtr<ImageBuffer> sourceCopy = ImageBuffer::create(sourceCopySize, ColorSpaceDeviceRGB, Unaccelerated); + if (!sourceCopy) + return; + sourceCopy->m_data.putData(source, sourceSize, sourceRect, IntPoint(-sourceRect.x(), -sourceRect.y()), sourceCopy->size(), sourceCopy->context()->isAcceleratedContext(), multiplied == Unmultiplied); + + // Set up context for using drawImage as a direct bit copy + CGContextRef destContext = context()->platformContext(); + CGContextSaveGState(destContext); + CGContextConcatCTM(destContext, AffineTransform(CGContextGetCTM(destContext)).inverse()); + wkCGContextResetClip(destContext); + CGContextSetInterpolationQuality(destContext, kCGInterpolationNone); + CGContextSetAlpha(destContext, 1.0); + CGContextSetBlendMode(destContext, kCGBlendModeCopy); + CGContextSetShadowWithColor(destContext, CGSizeZero, 0, 0); + + // Draw the image in CG coordinate space + IntPoint destPointInCGCoords(destPoint.x() + sourceRect.x(), m_size.height() - (destPoint.y()+sourceRect.y()) - sourceRect.height()); + IntRect destRectInCGCoords(destPointInCGCoords, sourceCopySize); + RetainPtr<CGImageRef> sourceCopyImage(AdoptCF, sourceCopy->copyNativeImage()); + CGContextDrawImage(destContext, destRectInCGCoords, sourceCopyImage.get()); + CGContextRestoreGState(destContext); #endif - } - m_data.putData(source, sourceSize, sourceRect, destPoint, m_size, m_context->isAcceleratedContext(), false); } static inline CFStringRef jpegUTI() diff --git a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp index 0d97e52ae..00a3e463b 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapCanvasLayerTextureUpdater.cpp @@ -92,7 +92,7 @@ void BitmapCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect borderTexels ? PlatformCanvas::Painter::GrayscaleText : PlatformCanvas::Painter::SubpixelText; PlatformCanvas::Painter canvasPainter(&m_canvas, textOption); canvasPainter.skiaContext()->setTrackOpaqueRegion(!layerIsOpaque); - paintContents(*canvasPainter.context(), contentRect, contentsScale); + paintContents(*canvasPainter.context(), *canvasPainter.skiaContext(), contentRect, contentsScale); if (!layerIsOpaque) *resultingOpaqueRect = canvasPainter.skiaContext()->opaqueRegion().asRect(); diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp index e2ab79838..4cc6bcc90 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.cpp @@ -33,7 +33,7 @@ #include "LayerPainterChromium.h" #include "SkCanvas.h" -#include "skia/ext/platform_canvas.h" +#include "SkDevice.h" namespace WebCore { @@ -45,18 +45,21 @@ BitmapSkPictureCanvasLayerTextureUpdater::Texture::Texture(BitmapSkPictureCanvas void BitmapSkPictureCanvasLayerTextureUpdater::Texture::prepareRect(const IntRect& sourceRect) { - size_t bufferSize = TextureManager::memoryUseBytes(sourceRect.size(), texture()->format()); - m_pixelData = adoptArrayPtr(new uint8_t[bufferSize]); - OwnPtr<SkCanvas> canvas = adoptPtr(new skia::PlatformCanvas(sourceRect.width(), sourceRect.height(), false, m_pixelData.get())); + m_device = adoptPtr(new SkDevice(SkBitmap::kARGB_8888_Config, sourceRect.width(), sourceRect.height())); + OwnPtr<SkCanvas> canvas = adoptPtr(new SkCanvas(m_device.get())); textureUpdater()->paintContentsRect(canvas.get(), sourceRect); } void BitmapSkPictureCanvasLayerTextureUpdater::Texture::updateRect(GraphicsContext3D* context, TextureAllocator* allocator, const IntRect& sourceRect, const IntRect& destRect) { texture()->bindTexture(context, allocator); - ASSERT(m_pixelData.get()); - textureUpdater()->updateTextureRect(context, texture()->format(), destRect, m_pixelData.get()); - m_pixelData.clear(); + + ASSERT(m_device); + const SkBitmap* bitmap = &m_device->accessBitmap(false); + bitmap->lockPixels(); + textureUpdater()->updateTextureRect(context, texture()->format(), destRect, static_cast<uint8_t*>(bitmap->getPixels())); + bitmap->unlockPixels(); + m_device.clear(); } PassRefPtr<BitmapSkPictureCanvasLayerTextureUpdater> BitmapSkPictureCanvasLayerTextureUpdater::create(PassOwnPtr<LayerPainterChromium> painter, bool useMapTexSubImage) diff --git a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h index 1c564cdc1..8d52433d0 100644 --- a/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/BitmapSkPictureCanvasLayerTextureUpdater.h @@ -34,6 +34,8 @@ #include "PlatformColor.h" #include "SkPictureCanvasLayerTextureUpdater.h" +class SkDevice; + namespace WebCore { // This class records the contentRect into an SkPicture, then software rasterizes @@ -50,7 +52,7 @@ public: private: BitmapSkPictureCanvasLayerTextureUpdater* textureUpdater() { return m_textureUpdater; } - OwnArrayPtr<uint8_t> m_pixelData; + OwnPtr<SkDevice> m_device; BitmapSkPictureCanvasLayerTextureUpdater* m_textureUpdater; }; diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp index 6c778bf74..14fe35a58 100644 --- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.cpp @@ -41,9 +41,7 @@ #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" // For the GLC() macro -#include "GrContext.h" #include "SkCanvas.h" -#include "SkDevice.h" namespace WebCore { @@ -113,33 +111,26 @@ void Canvas2DLayerChromium::paintContentsIfDirty(const Region& /* occludedScreen bool success = m_context->makeContextCurrent(); ASSERT_UNUSED(success, success); - // FIXME: Replace this block of skia code with m_canvas->flush, when that - // API becomes available. - // https://bugs.webkit.org/show_bug.cgi?id=77463 if (m_canvas) - m_canvas->getDevice()->accessRenderTarget(); // Triggers execution of pending draw operations. - - GrContext* grContext = m_context->grContext(); - if (grContext) - grContext->flush(); + m_canvas->flush(); m_context->flush(); } void Canvas2DLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) { - if (layerTreeHost() != host) - setTextureManager(host ? host->contentsTextureManager() : 0); - CanvasLayerChromium::setLayerTreeHost(host); + + if (m_useDoubleBuffering && host) + setTextureManager(host->contentsTextureManager()); } void Canvas2DLayerChromium::setTextureManager(TextureManager* textureManager) { - if (textureManager && m_useDoubleBuffering) - m_frontTexture = ManagedTexture::create(textureManager); + if (m_frontTexture) + m_frontTexture->setTextureManager(textureManager); else - m_frontTexture.clear(); + m_frontTexture = ManagedTexture::create(textureManager); } void Canvas2DLayerChromium::updateCompositorResources(GraphicsContext3D* context, CCTextureUpdater& updater) @@ -175,12 +166,6 @@ void Canvas2DLayerChromium::unreserveContentsTexture() m_frontTexture->unreserve(); } -void Canvas2DLayerChromium::cleanupResources() -{ - if (m_useDoubleBuffering) - m_frontTexture.clear(); -} - } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h index 877224f41..11a1a9539 100644 --- a/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/Canvas2DLayerChromium.h @@ -61,14 +61,12 @@ public: virtual void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); virtual void pushPropertiesTo(CCLayerImpl*); virtual void unreserveContentsTexture(); - virtual void cleanupResources(); void setCanvas(SkCanvas*); private: Canvas2DLayerChromium(GraphicsContext3D*, const IntSize&); - // Visible for testing so we can bypass setLayerTreeHost. friend class Canvas2DLayerChromiumTest; void setTextureManager(TextureManager*); diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp index 5fa67854c..ea1930365 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.cpp @@ -32,6 +32,7 @@ #include "GraphicsContext.h" #include "LayerPainterChromium.h" +#include "PlatformContextSkia.h" #include "TraceEvent.h" namespace WebCore { @@ -45,7 +46,7 @@ CanvasLayerTextureUpdater::~CanvasLayerTextureUpdater() { } -void CanvasLayerTextureUpdater::paintContents(GraphicsContext& context, const IntRect& contentRect, float contentsScale) +void CanvasLayerTextureUpdater::paintContents(GraphicsContext& context, PlatformContextSkia& platformContext, const IntRect& contentRect, float contentsScale) { context.translate(-contentRect.x(), -contentRect.y()); { @@ -62,6 +63,10 @@ void CanvasLayerTextureUpdater::paintContents(GraphicsContext& context, const In scaledContentRect = enclosingIntRect(rect); } + // Transform tracked opaque paints back to our layer's content space. + ASSERT(context.getCTM().isInvertible()); + platformContext.setOpaqueRegionTransform(context.getCTM().inverse()); + m_painter->paint(context, scaledContentRect); if (contentsScale != 1.0) diff --git a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h index 4415f6986..d491348ee 100644 --- a/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/CanvasLayerTextureUpdater.h @@ -35,6 +35,7 @@ namespace WebCore { class GraphicsContext3D; class LayerPainterChromium; +class PlatformContextSkia; // Base class for BitmapCanvasLayerTextureUpdater and // SkPictureCanvasLayerTextureUpdater that reduces code duplication between @@ -46,7 +47,7 @@ public: protected: explicit CanvasLayerTextureUpdater(PassOwnPtr<LayerPainterChromium>); - void paintContents(GraphicsContext&, const IntRect& contentRect, float contentsScale); + void paintContents(GraphicsContext&, PlatformContextSkia&, const IntRect& contentRect, float contentsScale); const IntRect& contentRect() const { return m_contentRect; } private: diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index 34303110f..aa7fb5cf4 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -96,6 +96,7 @@ bool ContentLayerChromium::drawsContent() const void ContentLayerChromium::paintContentsIfDirty(const Region& /* occludedScreenSpace */) { updateTileSizeAndTilingOption(); + createTextureUpdaterIfNeeded(); IntRect layerRect; @@ -122,17 +123,23 @@ void ContentLayerChromium::idlePaintContentsIfDirty() setNeedsCommit(); } -void ContentLayerChromium::createTextureUpdater(const CCLayerTreeHost* host) +void ContentLayerChromium::createTextureUpdaterIfNeeded() { + if (m_textureUpdater) + return; #if USE(SKIA) - if (host->settings().acceleratePainting) + if (layerTreeHost()->settings().acceleratePainting) m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); - else if (host->settings().perTilePainting) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); + else if (layerTreeHost()->settings().perTilePainting) + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); else #endif // USE(SKIA) - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), host->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); m_textureUpdater->setOpaque(opaque()); + + GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + setTextureFormat(textureFormat); + setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); } void ContentLayerChromium::setOpaque(bool opaque) diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h index 5eff6a3d6..3e8686d0a 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h @@ -69,8 +69,8 @@ protected: private: - virtual void createTextureUpdater(const CCLayerTreeHost*); virtual LayerTextureUpdater* textureUpdater() const { return m_textureUpdater.get(); } + virtual void createTextureUpdaterIfNeeded(); ContentLayerDelegate* m_delegate; RefPtr<LayerTextureUpdater> m_textureUpdater; diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp index 831cbe809..1e44e8702 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp @@ -160,6 +160,7 @@ void ImageLayerChromium::setContents(Image* contents) void ImageLayerChromium::paintContentsIfDirty(const Region& /* occludedScreenSpace */) { + createTextureUpdaterIfNeeded(); if (m_needsDisplay) { m_textureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame()); updateTileSizeAndTilingOption(); @@ -170,6 +171,17 @@ void ImageLayerChromium::paintContentsIfDirty(const Region& /* occludedScreenSpa prepareToUpdate(visibleLayerRect()); } +void ImageLayerChromium::createTextureUpdaterIfNeeded() +{ + if (m_textureUpdater) + return; + + m_textureUpdater = ImageLayerTextureUpdater::create(layerTreeHost()->layerRendererCapabilities().usingMapSub); + GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; + setTextureFormat(textureFormat); + setSampledTexelFormat(textureUpdater()->sampledTexelFormat(textureFormat)); +} + LayerTextureUpdater* ImageLayerChromium::textureUpdater() const { return m_textureUpdater.get(); @@ -187,13 +199,6 @@ bool ImageLayerChromium::drawsContent() const return m_contents && TiledLayerChromium::drawsContent(); } -void ImageLayerChromium::createTextureUpdater(const CCLayerTreeHost* host) -{ - // Avoid creating a new texture updater which would not have a valid copy of the current image. - if (!m_textureUpdater) - m_textureUpdater = ImageLayerTextureUpdater::create(host->layerRendererCapabilities().usingMapSub); -} - bool ImageLayerChromium::needsContentsScale() const { // Contents scale is not need for image layer because this can be done in compositor more efficiently. diff --git a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h index ab5c1b27b..2127b857c 100644 --- a/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h @@ -62,10 +62,10 @@ public: private: ImageLayerChromium(); - virtual void createTextureUpdater(const CCLayerTreeHost*); void setTilingOption(TilingOption); virtual LayerTextureUpdater* textureUpdater() const; + virtual void createTextureUpdaterIfNeeded(); virtual IntSize contentBounds() const; NativeImagePtr m_imageForCurrentFrame; diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index b2f70141b..8d0fe03b6 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -92,10 +92,6 @@ LayerChromium::~LayerChromium() removeAllChildren(); } -void LayerChromium::cleanupResources() -{ -} - void LayerChromium::setIsNonCompositedContent(bool isNonCompositedContent) { m_isNonCompositedContent = isNonCompositedContent; @@ -106,11 +102,6 @@ void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) if (m_layerTreeHost == host) return; - // If we're changing hosts then we need to free up any resources - // allocated by the old host. - if (m_layerTreeHost) - cleanupResources(); - m_layerTreeHost = host; for (size_t i = 0; i < m_children.size(); ++i) diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.h b/Source/WebCore/platform/graphics/chromium/LayerChromium.h index 764f73015..a0758131f 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.h @@ -214,11 +214,6 @@ public: protected: LayerChromium(); - // This is called to clean up resources being held in the same context as - // layerRendererContext(). Subclasses should override this method if they - // hold context-dependent resources such as textures. - virtual void cleanupResources(); - bool isPaintedAxisAlignedInScreen() const; void setNeedsCommit(); diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp index 4f76dd9a9..1e5ee563f 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp @@ -66,7 +66,6 @@ #include "cc/CCVideoDrawQuad.h" #if USE(SKIA) #include "Extensions3D.h" -#include "GrContext.h" #include "NativeImageSkia.h" #include "PlatformContextSkia.h" #elif USE(CG) @@ -307,9 +306,9 @@ void LayerRendererChromium::viewportChanged() m_currentRenderSurface = 0; } -void LayerRendererChromium::clearSurfaceForDebug(CCRenderSurface* renderSurface, CCRenderSurface* rootRenderSurface, const FloatRect& surfaceDamageRect) +void LayerRendererChromium::clearRenderSurface(CCRenderSurface* renderSurface, CCRenderSurface* rootRenderSurface, const FloatRect& surfaceDamageRect) { - // Non-root layers should clear their entire contents to transparent. The root layer + // Non-root layers should clear their entire contents to transparent. On DEBUG builds, the root layer // is cleared to blue to easily see regions that were not drawn on the screen. If we // are using partial swap / scissor optimization, then the surface should only // clear the damaged region, so that we don't accidentally clear un-changed portions @@ -325,7 +324,11 @@ void LayerRendererChromium::clearSurfaceForDebug(CCRenderSurface* renderSurface, else GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST)); - m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); +#if defined(NDEBUG) + if (renderSurface != rootRenderSurface) +#endif + m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT); + GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST)); } @@ -375,8 +378,7 @@ void LayerRendererChromium::drawRenderPass(const CCRenderPass* renderPass) if (!useRenderSurface(renderSurface)) return; - // FIXME: eventually we should place this under a debug flag. - clearSurfaceForDebug(renderSurface, m_defaultRenderSurface, renderPass->surfaceDamageRect()); + clearRenderSurface(renderSurface, m_defaultRenderSurface, renderPass->surfaceDamageRect()); const CCQuadList& quadList = renderPass->quadList(); for (size_t i = 0; i < quadList.size(); ++i) @@ -698,10 +700,92 @@ void LayerRendererChromium::drawVideoQuad(const CCVideoDrawQuad* quad) layer->draw(this); } +struct PluginProgramBinding { + template<class Program> void set(Program* program) + { + ASSERT(program && program->initialized()); + programId = program->program(); + samplerLocation = program->fragmentShader().samplerLocation(); + matrixLocation = program->vertexShader().matrixLocation(); + alphaLocation = program->fragmentShader().alphaLocation(); + } + int programId; + int samplerLocation; + int matrixLocation; + int alphaLocation; +}; + +struct TexStretchPluginProgramBinding : PluginProgramBinding { + template<class Program> void set(Program* program) + { + PluginProgramBinding::set(program); + offsetLocation = program->vertexShader().offsetLocation(); + scaleLocation = program->vertexShader().scaleLocation(); + } + int offsetLocation; + int scaleLocation; +}; + +struct TexTransformPluginProgramBinding : PluginProgramBinding { + template<class Program> void set(Program* program) + { + PluginProgramBinding::set(program); + texTransformLocation = program->vertexShader().texTransformLocation(); + } + int texTransformLocation; +}; + void LayerRendererChromium::drawPluginQuad(const CCPluginDrawQuad* quad) { - CCLayerImpl* layer = quad->layer(); - layer->draw(this); + ASSERT(CCProxy::isImplThread()); + + if (quad->ioSurfaceTextureId()) { + TexTransformPluginProgramBinding binding; + if (quad->flipped()) + binding.set(pluginLayerTexRectProgramFlip()); + else + binding.set(pluginLayerTexRectProgram()); + + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, quad->ioSurfaceTextureId())); + + GLC(context(), context()->useProgram(binding.programId)); + GLC(context(), context()->uniform1i(binding.samplerLocation, 0)); + // Note: this code path ignores quad->uvRect(). + GLC(context(), context()->uniform4f(binding.texTransformLocation, 0, 0, quad->ioSurfaceWidth(), quad->ioSurfaceHeight())); + const IntSize& bounds = quad->quadRect().size(); + drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), + binding.matrixLocation, + binding.alphaLocation, + -1); + GLC(context(), context()->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); + } else { + TexStretchPluginProgramBinding binding; + if (quad->flipped()) + binding.set(pluginLayerProgramFlip()); + else + binding.set(pluginLayerProgram()); + + GLC(context(), context()->activeTexture(GraphicsContext3D::TEXTURE0)); + GLC(context(), context()->bindTexture(GraphicsContext3D::TEXTURE_2D, quad->textureId())); + + // FIXME: setting the texture parameters every time is redundant. Move this code somewhere + // where it will only happen once per texture. + GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); + GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); + GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); + GLC(context, context()->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); + + GLC(context, context()->useProgram(binding.programId)); + GLC(context, context()->uniform1i(binding.samplerLocation, 0)); + GLC(context, context()->uniform2f(binding.offsetLocation, quad->uvRect().x(), quad->uvRect().y())); + GLC(context, context()->uniform2f(binding.scaleLocation, quad->uvRect().width(), quad->uvRect().height())); + const IntSize& bounds = quad->quadRect().size(); + drawTexturedQuad(quad->layerTransform(), bounds.width(), bounds.height(), quad->opacity(), sharedGeometryQuad(), + binding.matrixLocation, + binding.alphaLocation, + -1); + } } void LayerRendererChromium::finishDrawingFrame() diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h index c896b1df2..bea4baa41 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h +++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h @@ -56,10 +56,6 @@ #include <wtf/RetainPtr.h> #endif -#if USE(SKIA) -class GrContext; -#endif - namespace WebCore { class CCHeadsUpDisplay; @@ -177,7 +173,7 @@ private: void setDrawViewportRect(const IntRect&, bool flipY); bool useRenderSurface(CCRenderSurface*); - void clearSurfaceForDebug(CCRenderSurface*, CCRenderSurface* rootRenderSurface, const FloatRect& surfaceDamageRect); + void clearRenderSurface(CCRenderSurface*, CCRenderSurface* rootRenderSurface, const FloatRect& surfaceDamageRect); void releaseRenderSurfaceTextures(); diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp b/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp index 5bb19fa87..9bc700dc9 100644 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp +++ b/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp @@ -39,6 +39,7 @@ ManagedTexture::ManagedTexture(TextureManager* manager) , m_format(0) , m_textureId(0) { + m_textureManager->registerTexture(this); } ManagedTexture::ManagedTexture(TextureManager* manager, TextureToken token, IntSize size, unsigned format, unsigned textureId) @@ -48,21 +49,41 @@ ManagedTexture::ManagedTexture(TextureManager* manager, TextureToken token, IntS , m_format(format) , m_textureId(textureId) { + m_textureManager->registerTexture(this); } ManagedTexture::~ManagedTexture() { + if (!m_textureManager) + return; + m_textureManager->unregisterTexture(this); if (m_token) m_textureManager->releaseToken(m_token); } +void ManagedTexture::setTextureManager(TextureManager* manager) +{ + if (manager == m_textureManager) + return; + + if (m_textureManager) + m_textureManager->unregisterTexture(this); + m_textureManager = manager; + clear(); + if (m_textureManager) + m_textureManager->registerTexture(this); +} + bool ManagedTexture::isValid(const IntSize& size, unsigned format) { - return m_token && size == m_size && format == m_format && m_textureManager->hasTexture(m_token); + return m_token && size == m_size && format == m_format && m_textureManager && m_textureManager->hasTexture(m_token); } bool ManagedTexture::reserve(const IntSize& size, unsigned format) { + if (!m_textureManager) + return false; + if (!m_token) m_token = m_textureManager->getToken(); @@ -71,7 +92,7 @@ bool ManagedTexture::reserve(const IntSize& size, unsigned format) m_textureManager->protectTexture(m_token); else { m_textureId = 0; - reserved = m_textureManager->requestTexture(m_token, size, format, m_textureId); + reserved = m_textureManager->requestTexture(m_token, size, format); if (reserved) { m_size = size; m_format = format; @@ -83,7 +104,7 @@ bool ManagedTexture::reserve(const IntSize& size, unsigned format) void ManagedTexture::unreserve() { - if (!m_token) + if (!m_token || !m_textureManager) return; m_textureManager->unprotectTexture(m_token); @@ -111,14 +132,18 @@ void ManagedTexture::framebufferTexture2D(GraphicsContext3D* context, TextureAll PassOwnPtr<ManagedTexture> ManagedTexture::steal() { OwnPtr<ManagedTexture> texture = adoptPtr(new ManagedTexture(m_textureManager, m_token, m_size, m_format, m_textureId)); + clear(); + return texture.release(); +} + +void ManagedTexture::clear() +{ m_token = 0; m_size = IntSize(); m_format = 0; m_textureId = 0; - return texture.release(); } - } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h b/Source/WebCore/platform/graphics/chromium/ManagedTexture.h index 76d62a8bb..ed4d450e9 100644 --- a/Source/WebCore/platform/graphics/chromium/ManagedTexture.h +++ b/Source/WebCore/platform/graphics/chromium/ManagedTexture.h @@ -46,13 +46,15 @@ public: } ~ManagedTexture(); + void setTextureManager(TextureManager*); + void clearManager() { m_textureManager = 0; } + bool isValid(const IntSize&, unsigned format); bool reserve(const IntSize&, unsigned format); void unreserve(); bool isReserved() { - ASSERT(m_textureManager); - return m_textureManager->isProtected(m_token); + return m_textureManager && m_textureManager->isProtected(m_token); } void allocate(TextureAllocator*); @@ -71,6 +73,8 @@ private: explicit ManagedTexture(TextureManager*); ManagedTexture(TextureManager*, TextureToken, IntSize, unsigned format, unsigned textureId); + void clear(); + TextureManager* m_textureManager; TextureToken m_token; IntSize m_size; diff --git a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h index bf4988c25..3c6f1649a 100644 --- a/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h +++ b/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.h @@ -51,7 +51,6 @@ public: bool prepareContentsTexture(); void releaseContentsTexture(); - void cleanupResources(); void draw(const IntRect& targetSurfaceRect); // Returns the rect that encloses the RenderSurface including any reflection. diff --git a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp index 0d974fa63..35cd35ad3 100644 --- a/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/SkPictureCanvasLayerTextureUpdater.cpp @@ -56,7 +56,7 @@ void SkPictureCanvasLayerTextureUpdater::prepareToUpdate(const IntRect& contentR platformContext.setDeferred(true); platformContext.setTrackOpaqueRegion(!m_layerIsOpaque); GraphicsContext graphicsContext(&platformContext); - paintContents(graphicsContext, contentRect, contentsScale); + paintContents(graphicsContext, platformContext, contentRect, contentsScale); m_picture.endRecording(); if (!m_layerIsOpaque) diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp index 516cea90a..131a9c70e 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.cpp +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.cpp @@ -29,6 +29,7 @@ #include "TextureManager.h" #include "LayerRendererChromium.h" +#include "ManagedTexture.h" using namespace std; @@ -103,6 +104,12 @@ TextureManager::TextureManager(size_t maxMemoryLimitBytes, size_t preferredMemor { } +TextureManager::~TextureManager() +{ + for (HashSet<ManagedTexture*>::iterator it = m_registeredTextures.begin(); it != m_registeredTextures.end(); ++it) + (*it)->clearManager(); +} + void TextureManager::setMaxMemoryLimitBytes(size_t memoryLimitBytes) { reduceMemoryToLimit(memoryLimitBytes); @@ -115,6 +122,22 @@ void TextureManager::setPreferredMemoryLimitBytes(size_t memoryLimitBytes) m_preferredMemoryLimitBytes = memoryLimitBytes; } +void TextureManager::registerTexture(ManagedTexture* texture) +{ + ASSERT(texture); + ASSERT(!m_registeredTextures.contains(texture)); + + m_registeredTextures.add(texture); +} + +void TextureManager::unregisterTexture(ManagedTexture* texture) +{ + ASSERT(texture); + ASSERT(m_registeredTextures.contains(texture)); + + m_registeredTextures.remove(texture); +} + TextureToken TextureManager::getToken() { return m_nextToken++; @@ -180,30 +203,6 @@ void TextureManager::reduceMemoryToLimit(size_t limit) } } -unsigned TextureManager::replaceTexture(TextureToken newToken, TextureInfo newInfo) -{ - for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) { - TextureToken token = *lruIt; - TextureInfo info = m_textures.get(token); - if (info.isProtected) - continue; - if (!info.textureId) - continue; - if (newInfo.size != info.size || newInfo.format != info.format) - continue; - newInfo.textureId = info.textureId; -#ifndef NDEBUG - newInfo.allocator = info.allocator; -#endif - m_textures.remove(token); - m_textureLRUSet.remove(token); - m_textures.set(newToken, newInfo); - m_textureLRUSet.add(newToken); - return info.textureId; - } - return 0; -} - void TextureManager::addTexture(TextureToken token, TextureInfo info) { ASSERT(!m_textureLRUSet.contains(token)); @@ -268,10 +267,8 @@ unsigned TextureManager::allocateTexture(TextureAllocator* allocator, TextureTok return textureId; } -bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format, unsigned& textureId) +bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format) { - textureId = 0; - if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) return false; @@ -297,13 +294,6 @@ bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned f #ifndef NDEBUG info.allocator = 0; #endif - // Avoid churning by reusing the texture if it is about to be reclaimed and - // it has the same size and format as the requesting texture. - if (m_memoryUseBytes + memoryRequiredBytes > m_preferredMemoryLimitBytes) { - textureId = replaceTexture(token, info); - if (textureId) - return true; - } addTexture(token, info); return true; } diff --git a/Source/WebCore/platform/graphics/chromium/TextureManager.h b/Source/WebCore/platform/graphics/chromium/TextureManager.h index a66e9d536..8259adb10 100644 --- a/Source/WebCore/platform/graphics/chromium/TextureManager.h +++ b/Source/WebCore/platform/graphics/chromium/TextureManager.h @@ -31,10 +31,13 @@ #include <wtf/FastAllocBase.h> #include <wtf/HashMap.h> +#include <wtf/HashSet.h> #include <wtf/ListHashSet.h> +#include <wtf/Vector.h> namespace WebCore { +class ManagedTexture; typedef int TextureToken; class TextureAllocator { @@ -53,6 +56,7 @@ public: { return adoptPtr(new TextureManager(maxMemoryLimitBytes, preferredMemoryLimitBytes, maxTextureSize)); } + ~TextureManager(); // Absolute maximum limit for texture allocations for this instance. static size_t highLimitBytes(const IntSize& viewportSize); @@ -68,11 +72,14 @@ public: void setPreferredMemoryLimitBytes(size_t); size_t preferredMemoryLimitBytes() { return m_preferredMemoryLimitBytes; } + void registerTexture(ManagedTexture*); + void unregisterTexture(ManagedTexture*); + TextureToken getToken(); void releaseToken(TextureToken); bool hasTexture(TextureToken); - bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat, unsigned& textureId); + bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat); void protectTexture(TextureToken); void unprotectTexture(TextureToken); @@ -102,7 +109,8 @@ private: void addTexture(TextureToken, TextureInfo); void removeTexture(TextureToken, TextureInfo); - unsigned replaceTexture(TextureToken, TextureInfo); + + HashSet<ManagedTexture*> m_registeredTextures; typedef HashMap<TextureToken, TextureInfo> TextureMap; TextureMap m_textures; diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 283aa8dd0..d9e2487d8 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -53,7 +53,11 @@ namespace WebCore { class UpdatableTile : public CCLayerTilingData::Tile { WTF_MAKE_NONCOPYABLE(UpdatableTile); public: - explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) : m_texture(texture) { } + explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) + : m_partialUpdate(false) + , m_texture(texture) + { + } LayerTextureUpdater::Texture* texture() { return m_texture.get(); } ManagedTexture* managedTexture() { return m_texture->texture(); } @@ -68,6 +72,7 @@ public: IntRect m_dirtyRect; IntRect m_updateRect; IntRect m_opaqueRect; + bool m_partialUpdate; private: OwnPtr<LayerTextureUpdater::Texture> m_texture; }; @@ -92,15 +97,6 @@ PassRefPtr<CCLayerImpl> TiledLayerChromium::createCCLayerImpl() return CCTiledLayerImpl::create(id()); } -void TiledLayerChromium::cleanupResources() -{ - LayerChromium::cleanupResources(); - - m_tiler->reset(); - m_paintRect = IntRect(); - m_requestedUpdateTilesRect = IntRect(); -} - void TiledLayerChromium::updateTileSizeAndTilingOption() { const IntSize tileSize(min(defaultTileSize, contentBounds().width()), min(defaultTileSize, contentBounds().height())); @@ -174,21 +170,6 @@ IntSize TiledLayerChromium::contentBounds() const return IntSize(lroundf(bounds().width() * contentsScale()), lroundf(bounds().height() * contentsScale())); } -void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) -{ - if (host == layerTreeHost()) - return; - - LayerChromium::setLayerTreeHost(host); - - if (!host) - return; - - createTextureUpdater(host); - setTextureFormat(host->layerRendererCapabilities().bestTextureFormat); - m_sampledTexelFormat = textureUpdater()->sampledTexelFormat(m_textureFormat); -} - void TiledLayerChromium::updateCompositorResources(GraphicsContext3D*, CCTextureUpdater& updater) { // Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update. @@ -234,7 +215,10 @@ void TiledLayerChromium::updateCompositorResources(GraphicsContext3D*, CCTexture if (paintOffset.y() + destRect.height() > m_paintRect.height()) CRASH(); - updater.append(tile->texture(), sourceRect, destRect); + if (tile->m_partialUpdate) + updater.appendPartial(tile->texture(), sourceRect, destRect); + else + updater.append(tile->texture(), sourceRect, destRect); } } @@ -264,18 +248,23 @@ void TiledLayerChromium::pushPropertiesTo(CCLayerImpl* layer) tiledLayer->setSkipsDraw(m_skipsDraw); tiledLayer->setContentsSwizzled(m_sampledTexelFormat != LayerTextureUpdater::SampledTexelFormatRGBA); tiledLayer->setTilingData(*m_tiler); + Vector<UpdatableTile*> invalidTiles; for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { int i = iter->first.first; int j = iter->first.second; UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); - if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) + if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) { + invalidTiles.append(tile); continue; + } if (tile->isDirty()) continue; tiledLayer->pushTileProperties(i, j, tile->managedTexture()->textureId(), tile->m_opaqueRect); } + for (Vector<UpdatableTile*>::const_iterator iter = invalidTiles.begin(); iter != invalidTiles.end(); ++iter) + m_tiler->takeTile((*iter)->i(), (*iter)->j()); } TextureManager* TiledLayerChromium::textureManager() const @@ -285,6 +274,17 @@ TextureManager* TiledLayerChromium::textureManager() const return layerTreeHost()->contentsTextureManager(); } +void TiledLayerChromium::setLayerTreeHost(CCLayerTreeHost* host) +{ + if (host && host != layerTreeHost()) { + for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); + tile->managedTexture()->setTextureManager(host->contentsTextureManager()); + } + } + LayerChromium::setLayerTreeHost(host); +} + UpdatableTile* TiledLayerChromium::tileAt(int i, int j) const { return static_cast<UpdatableTile*>(m_tiler->tileAt(i, j)); @@ -322,20 +322,16 @@ void TiledLayerChromium::setIsNonCompositedContent(bool isNonCompositedContent) void TiledLayerChromium::invalidateRect(const IntRect& layerRect) { + updateBounds(); if (m_tiler->isEmpty() || layerRect.isEmpty() || m_skipsDraw) return; - int left, top, right, bottom; - m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); - for (int j = top; j <= bottom; ++j) { - for (int i = left; i <= right; ++i) { - UpdatableTile* tile = tileAt(i, j); - if (!tile) - continue; - IntRect bound = m_tiler->tileRect(tile); - bound.intersect(layerRect); - tile->m_dirtyRect.unite(bound); - } + for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { + UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); + ASSERT(tile); + IntRect bound = m_tiler->tileRect(tile); + bound.intersect(layerRect); + tile->m_dirtyRect.unite(bound); } } @@ -363,14 +359,46 @@ void TiledLayerChromium::protectTileTextures(const IntRect& layerRect) } } +// Returns true if tile is dirty and only part of it needs to be updated. +bool TiledLayerChromium::tileOnlyNeedsPartialUpdate(UpdatableTile* tile) +{ + if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) + return false; + + if (!tile->isDirty()) + return false; + + return !tile->m_dirtyRect.contains(m_tiler->tileRect(tile)); +} + +// Dirty tiles with valid textures needs buffered update to guarantee that +// we don't modify textures currently used for drawing by the impl thread. +bool TiledLayerChromium::tileNeedsBufferedUpdate(UpdatableTile* tile) +{ + // No impl thread?. + if (!CCProxy::hasImplThread()) + return false; + + if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) + return false; + + if (!tile->isDirty()) + return false; + + return true; +} + void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom) { // Reset m_updateRect for all tiles. for (CCLayerTilingData::TileMap::const_iterator iter = m_tiler->tiles().begin(); iter != m_tiler->tiles().end(); ++iter) { UpdatableTile* tile = static_cast<UpdatableTile*>(iter->second.get()); tile->m_updateRect = IntRect(); + tile->m_partialUpdate = false; } + createTextureUpdaterIfNeeded(); + // Create tiles as needed, expanding a dirty rect to contain all // the dirty regions currently being drawn. All dirty tiles that are to be painted // get their m_updateRect set to m_dirtyRect and m_dirtyRect cleared. This way if @@ -382,9 +410,11 @@ void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int if (!tile) tile = createTile(i, j); - // Do post commit deletion of current texture when partial texture - // updates are not used. - if (tile->isDirty() && layerTreeHost() && !layerTreeHost()->settings().partialTextureUpdates) + // FIXME: Decide if partial update should be allowed based on cost + // of update. https://bugs.webkit.org/show_bug.cgi?id=77376 + if (tileOnlyNeedsPartialUpdate(tile) && layerTreeHost() && layerTreeHost()->requestPartialTextureUpdate()) + tile->m_partialUpdate = true; + else if (tileNeedsBufferedUpdate(tile) && layerTreeHost()) layerTreeHost()->deleteTextureAfterCommit(tile->managedTexture()->steal()); if (!tile->managedTexture()->isValid(m_tiler->tileSize(), m_textureFormat)) @@ -397,7 +427,9 @@ void TiledLayerChromium::prepareToUpdateTiles(bool idle, int left, int top, int // layer so that checkerboarded tiles will still draw. if (!backgroundCoversViewport()) m_skipsDraw = true; - cleanupResources(); + m_tiler->reset(); + m_paintRect = IntRect(); + m_requestedUpdateTilesRect = IntRect(); } return; } @@ -473,6 +505,7 @@ void TiledLayerChromium::reserveTextures() int left, top, right, bottom; m_tiler->layerRectToTileIndices(layerRect, left, top, right, bottom); + createTextureUpdaterIfNeeded(); for (int j = top; j <= bottom; ++j) { for (int i = left; i <= right; ++i) { UpdatableTile* tile = tileAt(i, j); diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index 3cbbbcbd7..2d9995367 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -58,6 +58,8 @@ public: virtual void setIsNonCompositedContent(bool); + virtual void setLayerTreeHost(CCLayerTreeHost*); + // Reserves all existing and valid tile textures to protect them from being // recycled by the texture manager. void protectTileTextures(const IntRect& layerRect); @@ -69,7 +71,6 @@ public: protected: TiledLayerChromium(); - virtual void cleanupResources(); void updateTileSizeAndTilingOption(); void updateBounds(); @@ -77,9 +78,10 @@ protected: void setTileSize(const IntSize&); void setTextureFormat(GC3Denum textureFormat) { m_textureFormat = textureFormat; } void setBorderTexelOption(CCLayerTilingData::BorderTexelOption); + void setSampledTexelFormat(LayerTextureUpdater::SampledTexelFormat sampledTexelFormat) { m_sampledTexelFormat = sampledTexelFormat; } - virtual void createTextureUpdater(const CCLayerTreeHost*) = 0; virtual LayerTextureUpdater* textureUpdater() const = 0; + virtual void createTextureUpdaterIfNeeded() = 0; // Set invalidations to be potentially repainted during update(). void invalidateRect(const IntRect& layerRect); @@ -102,11 +104,12 @@ protected: private: virtual PassRefPtr<CCLayerImpl> createCCLayerImpl(); - virtual void setLayerTreeHost(CCLayerTreeHost*); - void createTilerIfNeeded(); void setTilingOption(TilingOption); + bool tileOnlyNeedsPartialUpdate(UpdatableTile*); + bool tileNeedsBufferedUpdate(UpdatableTile*); + void prepareToUpdateTiles(bool idle, int left, int top, int right, int bottom); IntRect idlePaintRect(const IntRect& visibleLayerRect); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp index 17226aa82..2d6f43f31 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.cpp @@ -46,6 +46,7 @@ PassOwnPtr<CCDamageTracker> CCDamageTracker::create() } CCDamageTracker::CCDamageTracker() + : m_forceFullDamageNextUpdate(false) { m_currentRectHistory = adoptPtr(new RectMap); m_nextRectHistory = adoptPtr(new RectMap); @@ -55,13 +56,13 @@ CCDamageTracker::~CCDamageTracker() { } -void CCDamageTracker::updateDamageRectForNextFrame(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer) +void CCDamageTracker::updateDamageTrackingState(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer) { // - // This function computes the "damage rect" of a target surface. The damage - // rect is the region of the surface that may have changed and needs to be redrawn. - // This can be used to scissor what is actually drawn, to save GPU computation and - // bandwidth. + // This function computes the "damage rect" of a target surface, and updates the state + // that is used to correctly track damage across frames. The damage rect is the region + // of the surface that may have changed and needs to be redrawn. This can be used to + // scissor what is actually drawn, to save GPU computation and bandwidth. // // The surface's damage rect is computed as the union of all possible changes that // have happened to the surface since the last frame was drawn. This includes: @@ -120,21 +121,27 @@ void CCDamageTracker::updateDamageRectForNextFrame(const Vector<RefPtr<CCLayerIm // damage tracker is ready for the next frame. // + // These functions cannot be bypassed with early-exits, even if we know what the + // damage will be for this frame, because we need to update the damage tracker state + // to correctly track the next frame. + FloatRect damageFromActiveLayers = trackDamageFromActiveLayers(layerList, targetSurfaceLayerID); + FloatRect damageFromSurfaceMask = trackDamageFromSurfaceMask(targetSurfaceMaskLayer); + FloatRect damageFromLeftoverRects = trackDamageFromLeftoverRects(); + // If the target surface already knows its entire region is damaged, we can return early. // FIXME: this should go away, or will be cleaner, after refactoring into RenderPass/RenderSchedule. CCLayerImpl* layer = layerList[0].get(); - if (layer->targetRenderSurface()->surfacePropertyChangedOnlyFromDescendant()) { - m_currentDamageRect = FloatRect(layer->targetRenderSurface()->contentRect()); - return; - } - - FloatRect damageFromActiveLayers = computeDamageFromActiveLayers(layerList, targetSurfaceLayerID); - FloatRect damageFromSurfaceMask = computeDamageFromSurfaceMask(targetSurfaceMaskLayer); - FloatRect damageFromLeftoverRects = computeDamageFromLeftoverRects(); + CCRenderSurface* targetSurface = layer->targetRenderSurface(); - m_currentDamageRect = damageFromActiveLayers; - m_currentDamageRect.uniteIfNonZero(damageFromSurfaceMask); - m_currentDamageRect.uniteIfNonZero(damageFromLeftoverRects); + if (m_forceFullDamageNextUpdate || targetSurface->surfacePropertyChangedOnlyFromDescendant()) { + m_currentDamageRect = FloatRect(targetSurface->contentRect()); + m_forceFullDamageNextUpdate = false; + } else { + // FIXME: can we need to clamp this damage to the surface's content rect? (affects performance, but not correctness) + m_currentDamageRect = damageFromActiveLayers; + m_currentDamageRect.uniteIfNonZero(damageFromSurfaceMask); + m_currentDamageRect.uniteIfNonZero(damageFromLeftoverRects); + } // The next history map becomes the current map for the next frame. swap(m_currentRectHistory, m_nextRectHistory); @@ -154,7 +161,7 @@ void CCDamageTracker::saveRectForNextFrame(int layerID, const FloatRect& targetS m_nextRectHistory->set(layerID, targetSpaceRect); } -FloatRect CCDamageTracker::computeDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID) +FloatRect CCDamageTracker::trackDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID) { FloatRect damageRect = FloatRect(); @@ -170,7 +177,7 @@ FloatRect CCDamageTracker::computeDamageFromActiveLayers(const Vector<RefPtr<CCL return damageRect; } -FloatRect CCDamageTracker::computeDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer) +FloatRect CCDamageTracker::trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer) { FloatRect damageRect = FloatRect(); @@ -186,7 +193,7 @@ FloatRect CCDamageTracker::computeDamageFromSurfaceMask(CCLayerImpl* targetSurfa return damageRect; } -FloatRect CCDamageTracker::computeDamageFromLeftoverRects() +FloatRect CCDamageTracker::trackDamageFromLeftoverRects() { // After computing damage for all active layers, any leftover items in the current // rect history correspond to layers/surfaces that no longer exist. So, these regions diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h index 42eb448c0..d428f26d1 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCDamageTracker.h @@ -43,20 +43,21 @@ public: static PassOwnPtr<CCDamageTracker> create(); ~CCDamageTracker(); - void updateDamageRectForNextFrame(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer); + void forceFullDamageNextUpdate() { m_forceFullDamageNextUpdate = true; } + void updateDamageTrackingState(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID, CCLayerImpl* targetSurfaceMaskLayer); const FloatRect& currentDamageRect() { return m_currentDamageRect; } private: CCDamageTracker(); - FloatRect computeDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID); - FloatRect computeDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer); - FloatRect computeDamageFromLeftoverRects(); + FloatRect trackDamageFromActiveLayers(const Vector<RefPtr<CCLayerImpl> >& layerList, int targetSurfaceLayerID); + FloatRect trackDamageFromSurfaceMask(CCLayerImpl* targetSurfaceMaskLayer); + FloatRect trackDamageFromLeftoverRects(); FloatRect removeRectFromCurrentFrame(int layerID); void saveRectForNextFrame(int layerID, const FloatRect& targetSpaceRect); - // These helper functions are used only in computeDamageFromActiveLayers(). + // These helper functions are used only in trackDamageFromActiveLayers(). void extendDamageForLayer(CCLayerImpl*, FloatRect& targetDamageRect); void extendDamageForRenderSurface(CCLayerImpl*, FloatRect& targetDamageRect); @@ -68,6 +69,7 @@ private: OwnPtr<RectMap> m_nextRectHistory; FloatRect m_currentDamageRect; + bool m_forceFullDamageNextUpdate; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h index 00e0adf8a..7bae20174 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h @@ -72,6 +72,7 @@ public: #endif PassOwnPtr<CCSharedQuadState> createSharedQuadState() const; + virtual void willDraw(LayerRendererChromium*) { } virtual void appendQuads(CCQuadList&, const CCSharedQuadState*); void appendDebugBorderQuad(CCQuadList&, const CCSharedQuadState*) const; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp index 92637fc83..27705f324 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTilingData.cpp @@ -117,6 +117,17 @@ IntRect CCLayerTilingData::tileRect(const Tile* tile) const void CCLayerTilingData::setBounds(const IntSize& size) { m_tilingData.setTotalSize(size.width(), size.height()); + + // Any tiles completely outside our new bounds are invalid and should be dropped. + int left, top, right, bottom; + layerRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom); + Vector<TileMapKey> invalidTileKeys; + for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) { + if (it->first.first > right || it->first.second > bottom) + invalidTileKeys.append(it->first); + } + for (size_t i = 0; i < invalidTileKeys.size(); ++i) + m_tiles.remove(invalidTileKeys[i]); } IntSize CCLayerTilingData::bounds() const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp index 4ff8434b2..15a3074eb 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp @@ -39,6 +39,8 @@ #include "cc/CCThread.h" #include "cc/CCThreadProxy.h" +using namespace std; + namespace { static int numLayerTreeInstances; } @@ -63,6 +65,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings , m_animating(false) , m_client(client) , m_frameNumber(0) + , m_layerRendererInitialized(false) , m_settings(settings) , m_visible(true) , m_haveWheelEventHandlers(false) @@ -70,6 +73,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings , m_minPageScale(1) , m_maxPageScale(1) , m_triggerIdlePaints(true) + , m_partialTextureUpdateRequests(0) { ASSERT(CCProxy::isMainThread()); numLayerTreeInstances++; @@ -88,20 +92,10 @@ bool CCLayerTreeHost::initialize() m_proxy = CCSingleThreadProxy::create(this); m_proxy->start(); - if (!m_proxy->initializeLayerRenderer()) + if (!m_proxy->initializeContext()) return false; m_compositorIdentifier = m_proxy->compositorIdentifier(); - - // Update m_settings based on capabilities that we got back from the renderer. - m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; - - // Update m_settings based on partial update capability. - m_settings.partialTextureUpdates = m_settings.partialTextureUpdates && m_proxy->partialTextureUpdateCapability(); - - m_contentsTextureManager = TextureManager::create(TextureManager::highLimitBytes(viewportSize()), - TextureManager::reclaimLimitBytes(viewportSize()), - m_proxy->layerRendererCapabilities().maxTextureSize); return true; } @@ -116,6 +110,29 @@ CCLayerTreeHost::~CCLayerTreeHost() numLayerTreeInstances--; } +void CCLayerTreeHost::initializeLayerRenderer() +{ + TRACE_EVENT("CCLayerTreeHost::initializeLayerRenderer", this, 0); + if (!m_proxy->initializeLayerRenderer()) { + // Uh oh, better tell the client that we can't do anything with this context. + m_client->didRecreateGraphicsContext(false); + return; + } + + // Update m_settings based on capabilities that we got back from the renderer. + m_settings.acceleratePainting = m_proxy->layerRendererCapabilities().usingAcceleratedPainting; + + // Update m_settings based on partial update capability. + m_settings.maxPartialTextureUpdates = min(m_settings.maxPartialTextureUpdates, m_proxy->maxPartialTextureUpdates()); + + m_contentsTextureManager = TextureManager::create(TextureManager::highLimitBytes(viewportSize()), + TextureManager::reclaimLimitBytes(viewportSize()), + m_proxy->layerRendererCapabilities().maxTextureSize); + + m_layerRendererInitialized = true; +} + + void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator) { ASSERT(CCProxy::isImplThread()); @@ -140,8 +157,8 @@ void CCLayerTreeHost::beginCommitOnImplThread(CCLayerTreeHostImpl* hostImpl) ASSERT(CCProxy::isImplThread()); TRACE_EVENT("CCLayerTreeHost::commitTo", this, 0); - contentsTextureManager()->reduceMemoryToLimit(TextureManager::reclaimLimitBytes(viewportSize())); - contentsTextureManager()->deleteEvictedTextures(hostImpl->contentsTextureAllocator()); + m_contentsTextureManager->reduceMemoryToLimit(TextureManager::reclaimLimitBytes(viewportSize())); + m_contentsTextureManager->deleteEvictedTextures(hostImpl->contentsTextureAllocator()); } // This function commits the CCLayerTreeHost to an impl tree. When modifying @@ -198,6 +215,11 @@ GraphicsContext3D* CCLayerTreeHost::context() bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) { + if (!m_layerRendererInitialized) { + initializeLayerRenderer(); + if (!m_layerRendererInitialized) + return false; + } m_triggerIdlePaints = false; bool ret = m_proxy->compositeAndReadback(pixels, rect); m_triggerIdlePaints = true; @@ -206,6 +228,8 @@ bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect) void CCLayerTreeHost::finishAllRendering() { + if (!m_layerRendererInitialized) + return; m_proxy->finishAllRendering(); } @@ -254,8 +278,10 @@ void CCLayerTreeHost::setViewportSize(const IntSize& viewportSize) if (viewportSize == m_viewportSize) return; - contentsTextureManager()->setMaxMemoryLimitBytes(TextureManager::highLimitBytes(viewportSize)); - contentsTextureManager()->setPreferredMemoryLimitBytes(TextureManager::reclaimLimitBytes(viewportSize)); + if (m_contentsTextureManager) { + m_contentsTextureManager->setMaxMemoryLimitBytes(TextureManager::highLimitBytes(viewportSize)); + m_contentsTextureManager->setPreferredMemoryLimitBytes(TextureManager::reclaimLimitBytes(viewportSize)); + } m_viewportSize = viewportSize; setNeedsCommit(); } @@ -285,6 +311,10 @@ void CCLayerTreeHost::setVisible(bool visible) return; m_visible = visible; + + if (!m_layerRendererInitialized) + return; + if (!visible) { m_contentsTextureManager->reduceMemoryToLimit(TextureManager::lowLimitBytes(viewportSize())); m_contentsTextureManager->unprotectAllTextures(); @@ -344,15 +374,23 @@ void CCLayerTreeHost::composite() static_cast<CCSingleThreadProxy*>(m_proxy.get())->compositeImmediately(); } -void CCLayerTreeHost::updateLayers() +bool CCLayerTreeHost::updateLayers() { + if (!m_layerRendererInitialized) { + initializeLayerRenderer(); + // If we couldn't initialize, then bail since we're returning to software mode. + if (!m_layerRendererInitialized) + return false; + } + if (!rootLayer()) - return; + return true; if (viewportSize().isEmpty()) - return; + return true; updateLayers(rootLayer()); + return true; } void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer) @@ -380,6 +418,9 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer) CCLayerTreeHostCommon::calculateDrawTransformsAndVisibility(rootLayer, rootLayer, identityMatrix, identityMatrix, m_updateList, rootRenderSurface->layerList(), layerRendererCapabilities().maxTextureSize); } + // Reset partial texture update requests. + m_partialTextureUpdateRequests = 0; + reserveTextures(); paintLayerContents(m_updateList, PaintVisible); @@ -388,8 +429,8 @@ void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer) size_t preferredLimitBytes = TextureManager::reclaimLimitBytes(m_viewportSize); size_t maxLimitBytes = TextureManager::highLimitBytes(m_viewportSize); - contentsTextureManager()->reduceMemoryToLimit(preferredLimitBytes); - if (contentsTextureManager()->currentMemoryUseBytes() >= preferredLimitBytes) + m_contentsTextureManager->reduceMemoryToLimit(preferredLimitBytes); + if (m_contentsTextureManager->currentMemoryUseBytes() >= preferredLimitBytes) return; // Idle painting should fail when we hit the preferred memory limit, @@ -461,10 +502,10 @@ static void enterTargetRenderSurface(Vector<RenderSurfaceRegion>& stack, RenderS stack.append(RenderSurfaceRegion()); stack.last().surface = newTarget; } else if (stack.last().surface != newTarget) { - const RenderSurfaceRegion& previous = stack.last(); stack.append(RenderSurfaceRegion()); stack.last().surface = newTarget; - stack.last().occludedInScreen = previous.occludedInScreen; + int lastIndex = stack.size() - 1; + stack[lastIndex].occludedInScreen = stack[lastIndex - 1].occludedInScreen; } } @@ -588,6 +629,15 @@ void CCLayerTreeHost::stopRateLimiter(GraphicsContext3D* context) } } +bool CCLayerTreeHost::requestPartialTextureUpdate() +{ + if (m_partialTextureUpdateRequests >= m_settings.maxPartialTextureUpdates) + return false; + + m_partialTextureUpdateRequests++; + return true; +} + void CCLayerTreeHost::deleteTextureAfterCommit(PassOwnPtr<ManagedTexture> texture) { m_deleteTextureAfterCommitList.append(texture); diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index f58203d15..e82f29830 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -33,15 +33,12 @@ #include "cc/CCLayerTreeHostCommon.h" #include "cc/CCProxy.h" +#include <limits> #include <wtf/HashMap.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/RefCounted.h> -#if USE(SKIA) -class GrContext; -#endif - namespace WebCore { class CCLayerTreeHostImpl; @@ -78,7 +75,7 @@ struct CCSettings { , refreshRate(0) , perTilePainting(false) , partialSwapEnabled(false) - , partialTextureUpdates(true) { } + , maxPartialTextureUpdates(std::numeric_limits<size_t>::max()) { } bool acceleratePainting; bool compositeOffscreen; @@ -87,7 +84,7 @@ struct CCSettings { double refreshRate; bool perTilePainting; bool partialSwapEnabled; - bool partialTextureUpdates; + size_t maxPartialTextureUpdates; }; // Provides information on an Impl's rendering capabilities back to the CCLayerTreeHost @@ -158,7 +155,7 @@ public: const LayerRendererCapabilities& layerRendererCapabilities() const; - // Test-only hook + // Test only hook void loseCompositorContext(int numTimes); void setNeedsAnimate(); @@ -188,13 +185,15 @@ public: void setHaveWheelEventHandlers(bool); - void updateLayers(); + // Returns false if we should abort this frame due to initialization failure. + bool updateLayers(); void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&); void applyScrollAndScale(const CCScrollAndScaleSet&); void startRateLimiter(GraphicsContext3D*); void stopRateLimiter(GraphicsContext3D*); + bool requestPartialTextureUpdate(); void deleteTextureAfterCommit(PassOwnPtr<ManagedTexture>); protected: @@ -205,6 +204,8 @@ private: typedef Vector<RefPtr<LayerChromium> > LayerList; typedef Vector<OwnPtr<ManagedTexture> > TextureList; + void initializeLayerRenderer(); + enum PaintType { PaintVisible, PaintIdle }; static void paintContentsIfDirty(LayerChromium*, PaintType, const Region& occludedScreenSpace); void paintLayerContents(const LayerList&, PaintType); @@ -224,6 +225,7 @@ private: int m_frameNumber; OwnPtr<CCProxy> m_proxy; + bool m_layerRendererInitialized; RefPtr<LayerChromium> m_rootLayer; OwnPtr<TextureManager> m_contentsTextureManager; @@ -243,6 +245,7 @@ private: bool m_triggerIdlePaints; TextureList m_deleteTextureAfterCommitList; + size_t m_partialTextureUpdateRequests; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp index 1846d6c2e..088377cdd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp @@ -148,7 +148,7 @@ void CCLayerTreeHostImpl::trackDamageForAllSurfaces(CCLayerImpl* rootDrawLayer, CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get(); CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface(); ASSERT(renderSurface); - renderSurface->damageTracker()->updateDamageRectForNextFrame(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurfaceLayer->maskLayer()); + renderSurface->damageTracker()->updateDamageTrackingState(renderSurface->layerList(), renderSurfaceLayer->id(), renderSurfaceLayer->maskLayer()); } } @@ -231,6 +231,7 @@ void CCLayerTreeHostImpl::calculateRenderPasses(CCRenderPassList& passes) continue; } + layer->willDraw(m_layerRenderer.get()); pass->appendQuadsForLayer(layer); } @@ -284,8 +285,7 @@ void CCLayerTreeHostImpl::finishAllRendering() bool CCLayerTreeHostImpl::isContextLost() { - ASSERT(m_layerRenderer); - return m_layerRenderer->isContextLost(); + return m_layerRenderer && m_layerRenderer->isContextLost(); } const LayerRendererCapabilities& CCLayerTreeHostImpl::layerRendererCapabilities() const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h index a71adae67..569d69fa3 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h @@ -32,10 +32,6 @@ #include "cc/CCRenderPass.h" #include <wtf/RefPtr.h> -#if USE(SKIA) -class GrContext; -#endif - namespace WebCore { class CCCompletionEvent; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp index fd2ae4b86..85289141d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.cpp @@ -29,16 +29,20 @@ namespace WebCore { -PassOwnPtr<CCPluginDrawQuad> CCPluginDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) +PassOwnPtr<CCPluginDrawQuad> CCPluginDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const FloatRect& uvRect, unsigned textureId, bool flipped, int ioSurfaceWidth, int ioSurfaceHeight, unsigned ioSurfaceTextureId) { - return adoptPtr(new CCPluginDrawQuad(sharedQuadState, quadRect, layer)); + return adoptPtr(new CCPluginDrawQuad(sharedQuadState, quadRect, uvRect, textureId, flipped, ioSurfaceWidth, ioSurfaceHeight, ioSurfaceTextureId)); } -CCPluginDrawQuad::CCPluginDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, CCLayerImpl* layer) +CCPluginDrawQuad::CCPluginDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const FloatRect& uvRect, unsigned textureId, bool flipped, int ioSurfaceWidth, int ioSurfaceHeight, unsigned ioSurfaceTextureId) : CCDrawQuad(sharedQuadState, CCDrawQuad::PluginContent, quadRect) - , m_layer(layer) + , m_uvRect(uvRect) + , m_textureId(textureId) + , m_flipped(flipped) + , m_ioSurfaceWidth(ioSurfaceWidth) + , m_ioSurfaceHeight(ioSurfaceHeight) + , m_ioSurfaceTextureId(ioSurfaceTextureId) { - ASSERT(m_layer); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h index ca52abef4..31a260d43 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginDrawQuad.h @@ -36,14 +36,25 @@ class CCLayerImpl; class CCPluginDrawQuad : public CCDrawQuad { WTF_MAKE_NONCOPYABLE(CCPluginDrawQuad); public: - static PassOwnPtr<CCPluginDrawQuad> create(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); + static PassOwnPtr<CCPluginDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const FloatRect& uvRect, unsigned textureId, bool flipped, int ioSurfaceWidth, int ioSurfaceHeight, unsigned m_ioSurfaceTextureId); - CCLayerImpl* layer() const { return m_layer; } + FloatRect uvRect() const { return m_uvRect; } + unsigned textureId() const { return m_textureId; } + bool flipped() const { return m_flipped; } + int ioSurfaceWidth() const { return m_ioSurfaceWidth; } + int ioSurfaceHeight() const { return m_ioSurfaceHeight; } + unsigned ioSurfaceTextureId() const { return m_ioSurfaceTextureId; } + private: - CCPluginDrawQuad(const CCSharedQuadState*, const IntRect&, CCLayerImpl*); - - CCLayerImpl* m_layer; + CCPluginDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const FloatRect& uvRect, unsigned textureId, bool flipped, int ioSurfaceWidth, int ioSurfaceHeight, unsigned ioSurfaceTextureId); + + FloatRect m_uvRect; + unsigned m_textureId; + bool m_flipped; + int m_ioSurfaceWidth; + int m_ioSurfaceHeight; + unsigned m_ioSurfaceTextureId; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp index b20a2f518..5e4aca6d9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp @@ -36,45 +36,6 @@ #include "cc/CCProxy.h" #include <wtf/text/WTFString.h> -namespace { - -struct PluginProgramBinding { - template<class Program> void set(Program* program) - { - ASSERT(program && program->initialized()); - programId = program->program(); - samplerLocation = program->fragmentShader().samplerLocation(); - matrixLocation = program->vertexShader().matrixLocation(); - alphaLocation = program->fragmentShader().alphaLocation(); - } - int programId; - int samplerLocation; - int matrixLocation; - int alphaLocation; -}; - -struct TexStretchPluginProgramBinding : PluginProgramBinding { - template<class Program> void set(Program* program) - { - PluginProgramBinding::set(program); - offsetLocation = program->vertexShader().offsetLocation(); - scaleLocation = program->vertexShader().scaleLocation(); - } - int offsetLocation; - int scaleLocation; -}; - -struct TexTransformPluginProgramBinding : PluginProgramBinding { - template<class Program> void set(Program* program) - { - PluginProgramBinding::set(program); - texTransformLocation = program->vertexShader().texTransformLocation(); - } - int texTransformLocation; -}; - -} // anonymous namespace - namespace WebCore { CCPluginLayerImpl::CCPluginLayerImpl(int id) @@ -95,10 +56,8 @@ CCPluginLayerImpl::~CCPluginLayerImpl() cleanupResources(); } -void CCPluginLayerImpl::draw(LayerRendererChromium* layerRenderer) +void CCPluginLayerImpl::willDraw(LayerRendererChromium* layerRenderer) { - ASSERT(CCProxy::isImplThread()); - if (m_ioSurfaceChanged) { GraphicsContext3D* context = layerRenderer->context(); Extensions3DChromium* extensions = static_cast<Extensions3DChromium*>(context->getExtensions()); @@ -127,60 +86,12 @@ void CCPluginLayerImpl::draw(LayerRendererChromium* layerRenderer) // allocated. m_ioSurfaceChanged = false; } - - if (m_ioSurfaceTextureId) { - TexTransformPluginProgramBinding binding; - if (m_flipped) - binding.set(layerRenderer->pluginLayerTexRectProgramFlip()); - else - binding.set(layerRenderer->pluginLayerTexRectProgram()); - - GraphicsContext3D* context = layerRenderer->context(); - GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context, context->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, m_ioSurfaceTextureId)); - - GLC(context, context->useProgram(binding.programId)); - GLC(context, context->uniform1i(binding.samplerLocation, 0)); - // Note: this code path ignores m_uvRect. - GLC(context, context->uniform4f(binding.texTransformLocation, 0, 0, m_ioSurfaceWidth, m_ioSurfaceHeight)); - layerRenderer->drawTexturedQuad(drawTransform(), bounds().width(), bounds().height(), drawOpacity(), layerRenderer->sharedGeometryQuad(), - binding.matrixLocation, - binding.alphaLocation, - -1); - GLC(context, context->bindTexture(Extensions3D::TEXTURE_RECTANGLE_ARB, 0)); - } else { - TexStretchPluginProgramBinding binding; - if (m_flipped) - binding.set(layerRenderer->pluginLayerProgramFlip()); - else - binding.set(layerRenderer->pluginLayerProgram()); - - GraphicsContext3D* context = layerRenderer->context(); - GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); - GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId)); - - // FIXME: setting the texture parameters every time is redundant. Move this code somewhere - // where it will only happen once per texture. - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE)); - GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE)); - - GLC(context, context->useProgram(binding.programId)); - GLC(context, context->uniform1i(binding.samplerLocation, 0)); - GLC(context, context->uniform2f(binding.offsetLocation, m_uvRect.x(), m_uvRect.y())); - GLC(context, context->uniform2f(binding.scaleLocation, m_uvRect.width(), m_uvRect.height())); - layerRenderer->drawTexturedQuad(drawTransform(), bounds().width(), bounds().height(), drawOpacity(), layerRenderer->sharedGeometryQuad(), - binding.matrixLocation, - binding.alphaLocation, - -1); - } } void CCPluginLayerImpl::appendQuads(CCQuadList& quadList, const CCSharedQuadState* sharedQuadState) { IntRect quadRect(IntPoint(), bounds()); - quadList.append(CCPluginDrawQuad::create(sharedQuadState, quadRect, this)); + quadList.append(CCPluginDrawQuad::create(sharedQuadState, quadRect, m_uvRect, m_textureId, m_flipped, m_ioSurfaceWidth, m_ioSurfaceHeight, m_ioSurfaceTextureId)); } void CCPluginLayerImpl::dumpLayerProperties(TextStream& ts, int indent) const diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h index 9b4d5a4d3..39a95951d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h @@ -41,6 +41,7 @@ public: } virtual ~CCPluginLayerImpl(); + virtual void willDraw(LayerRendererChromium*); virtual void appendQuads(CCQuadList&, const CCSharedQuadState*); typedef ProgramBinding<VertexShaderPosTexStretch, FragmentShaderRGBATexAlpha> Program; @@ -48,8 +49,6 @@ public: typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectAlpha> TexRectProgram; typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexRectFlipAlpha> TexRectProgramFlip; - virtual void draw(LayerRendererChromium*); - virtual void dumpLayerProperties(TextStream&, int indent) const; void setTextureId(unsigned id) { m_textureId = id; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h index 937c154ff..44aacceb0 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h @@ -31,10 +31,6 @@ #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> -#if USE(SKIA) -class GrContext; -#endif - namespace WebCore { class CCThread; @@ -65,6 +61,11 @@ public: virtual bool isStarted() const = 0; + // Attempts to initialize a context to use for rendering. Returns false if the context could not be created. + // The context will not be used and no frames may be produced until initializeLayerRenderer() is called. + virtual bool initializeContext() = 0; + + // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing. virtual bool initializeLayerRenderer() = 0; virtual int compositorIdentifier() const = 0; @@ -79,9 +80,8 @@ public: virtual void start() = 0; // Must be called before using the proxy. virtual void stop() = 0; // Must be called before deleting the proxy. - // Whether sub-regions of textures can be updated or if complete texture - // updates are required. - virtual bool partialTextureUpdateCapability() const = 0; + // Maximum number of sub-region texture updates supported for each commit. + virtual size_t maxPartialTextureUpdates() const = 0; // Debug hooks #ifndef NDEBUG diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp index 72bec2a71..2e48e10f5 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp @@ -33,6 +33,7 @@ #include "cc/CCTextureUpdater.h" #include <wtf/CurrentTime.h> +using namespace std; using namespace WTF; namespace WebCore { @@ -45,6 +46,7 @@ PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost) : m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) + , m_layerRendererInitialized(false) , m_numFailedRecreateAttempts(0) , m_graphicsContextLost(false) , m_timesRecreateShouldFail(0) @@ -69,12 +71,16 @@ CCSingleThreadProxy::~CCSingleThreadProxy() bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) { + TRACE_EVENT("CCSingleThreadProxy::compositeAndReadback", this, 0); ASSERT(CCProxy::isMainThread()); - if (!recreateContextIfNeeded()) + if (!recreateContextIfNeeded()) { + TRACE_EVENT("compositeAndReadback_EarlyOut_ContextLost", this, 0); return false; + } - commitIfNeeded(); + if (!commitIfNeeded()) + return false; if (!doComposite()) return false; @@ -90,6 +96,8 @@ bool CCSingleThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect GraphicsContext3D* CCSingleThreadProxy::context() { ASSERT(CCProxy::isMainThread()); + if (m_contextBeforeInitialization) + return m_contextBeforeInitialization.get(); DebugScopedSetImplThread impl; return m_layerTreeHostImpl->context(); } @@ -109,25 +117,35 @@ bool CCSingleThreadProxy::isStarted() const return m_layerTreeHostImpl; } -bool CCSingleThreadProxy::initializeLayerRenderer() +bool CCSingleThreadProxy::initializeContext() { ASSERT(CCProxy::isMainThread()); RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D(); if (!context) return false; ASSERT(context->hasOneRef()); + m_contextBeforeInitialization = context; + return true; +} +bool CCSingleThreadProxy::initializeLayerRenderer() +{ + ASSERT(CCProxy::isMainThread()); + ASSERT(m_contextBeforeInitialization); { DebugScopedSetImplThread impl; - bool ok = m_layerTreeHostImpl->initializeLayerRenderer(context); - if (ok) + bool ok = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitialization.release()); + if (ok) { + m_layerRendererInitialized = true; m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities(); + } return ok; } } const LayerRendererCapabilities& CCSingleThreadProxy::layerRendererCapabilities() const { + ASSERT(m_layerRendererInitialized); // Note: this gets called during the commit by the "impl" thread return m_layerRendererCapabilitiesForMainThread; } @@ -155,7 +173,8 @@ void CCSingleThreadProxy::doCommit() m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get()); CCTextureUpdater updater(m_layerTreeHostImpl->contentsTextureAllocator()); m_layerTreeHost->updateCompositorResources(m_layerTreeHostImpl->context(), updater); - while (updater.update(m_layerTreeHostImpl->context(), 1)) { } + updater.update(m_layerTreeHostImpl->context(), numeric_limits<size_t>::max()); + ASSERT(!updater.hasMoreUpdates()); m_layerTreeHostImpl->setVisible(m_layerTreeHost->visible()); m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get()); @@ -214,7 +233,8 @@ void CCSingleThreadProxy::compositeImmediately() if (!recreateContextIfNeeded()) return; - commitIfNeeded(); + if (!commitIfNeeded()) + return; if (doComposite()) m_layerTreeHostImpl->swapBuffers(); @@ -268,13 +288,15 @@ bool CCSingleThreadProxy::recreateContextIfNeeded() return false; } -void CCSingleThreadProxy::commitIfNeeded() +bool CCSingleThreadProxy::commitIfNeeded() { ASSERT(CCProxy::isMainThread()); - m_layerTreeHost->updateLayers(); + if (!m_layerTreeHost->updateLayers()) + return false; doCommit(); + return true; } bool CCSingleThreadProxy::doComposite() diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h index 4faa22999..a94405f3d 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h @@ -28,6 +28,7 @@ #include "cc/CCCompletionEvent.h" #include "cc/CCLayerTreeHostImpl.h" #include "cc/CCProxy.h" +#include <limits> #include <wtf/OwnPtr.h> namespace WebCore { @@ -44,6 +45,7 @@ public: virtual GraphicsContext3D* context(); virtual void finishAllRendering(); virtual bool isStarted() const; + virtual bool initializeContext(); virtual bool initializeLayerRenderer(); virtual int compositorIdentifier() const { return m_compositorIdentifier; } virtual const LayerRendererCapabilities& layerRendererCapabilities() const; @@ -54,7 +56,7 @@ public: virtual void setVisible(bool); virtual void start(); virtual void stop(); - virtual bool partialTextureUpdateCapability() const { return true; } + virtual size_t maxPartialTextureUpdates() const { return std::numeric_limits<size_t>::max(); } // CCLayerTreeHostImplClient implementation virtual void onSwapBuffersCompleteOnImplThread() { ASSERT_NOT_REACHED(); } @@ -67,7 +69,7 @@ public: private: explicit CCSingleThreadProxy(CCLayerTreeHost*); bool recreateContextIfNeeded(); - void commitIfNeeded(); + bool commitIfNeeded(); void doCommit(); bool doComposite(); @@ -75,8 +77,13 @@ private: CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; + // Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't + // be used for anything else. + RefPtr<GraphicsContext3D> m_contextBeforeInitialization; + // Used on the CCThread, but checked on main thread during initialization/shutdown. OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; + bool m_layerRendererInitialized; LayerRendererCapabilities m_layerRendererCapabilitiesForMainThread; int m_numFailedRecreateAttempts; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp index 8745c4ea0..66e08c8bd 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.cpp @@ -48,7 +48,7 @@ CCTextureUpdater::~CCTextureUpdater() { } -void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) +void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect, Vector<UpdateEntry>& entries) { ASSERT(texture); @@ -56,24 +56,50 @@ void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRe entry.m_texture = texture; entry.m_sourceRect = sourceRect; entry.m_destRect = destRect; - m_entries.append(entry); + entries.append(entry); +} + +void CCTextureUpdater::append(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) +{ + append(texture, sourceRect, destRect, m_entries); +} + +void CCTextureUpdater::appendPartial(LayerTextureUpdater::Texture* texture, const IntRect& sourceRect, const IntRect& destRect) +{ + append(texture, sourceRect, destRect, m_partialEntries); } bool CCTextureUpdater::hasMoreUpdates() const { - return m_entries.size(); + return m_entries.size() || m_partialEntries.size(); } bool CCTextureUpdater::update(GraphicsContext3D* context, size_t count) { + size_t index; size_t maxIndex = min(m_entryIndex + count, m_entries.size()); - for (; m_entryIndex < maxIndex; ++m_entryIndex) { - UpdateEntry& entry = m_entries[m_entryIndex]; + for (index = m_entryIndex; index < maxIndex; ++index) { + UpdateEntry& entry = m_entries[index]; entry.m_texture->updateRect(context, m_allocator, entry.m_sourceRect, entry.m_destRect); } - if (maxIndex < m_entries.size()) + bool moreUpdates = maxIndex < m_entries.size(); + + ASSERT(m_partialEntries.size() <= count); + // Make sure the number of updates including partial updates are not more + // than |count|. + if ((count - (index - m_entryIndex)) < m_partialEntries.size()) + moreUpdates = true; + + if (moreUpdates) { + m_entryIndex = index; return true; + } + + for (index = 0; index < m_partialEntries.size(); ++index) { + UpdateEntry& entry = m_partialEntries[index]; + entry.m_texture->updateRect(context, m_allocator, entry.m_sourceRect, entry.m_destRect); + } // If no entries left to process, auto-clear. clear(); @@ -84,6 +110,7 @@ void CCTextureUpdater::clear() { m_entryIndex = 0; m_entries.clear(); + m_partialEntries.clear(); } } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h index bf79ac9c2..dbb52c9ba 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCTextureUpdater.h @@ -41,6 +41,7 @@ public: ~CCTextureUpdater(); void append(LayerTextureUpdater::Texture*, const IntRect& sourceRect, const IntRect& destRect); + void appendPartial(LayerTextureUpdater::Texture*, const IntRect& sourceRect, const IntRect& destRect); bool hasMoreUpdates() const; @@ -58,9 +59,12 @@ private: IntRect m_destRect; }; + static void append(LayerTextureUpdater::Texture*, const IntRect& sourceRect, const IntRect& destRect, Vector<UpdateEntry>&); + TextureAllocator* m_allocator; size_t m_entryIndex; Vector<UpdateEntry> m_entries; + Vector<UpdateEntry> m_partialEntries; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp index 5e6a8f862..8ca852dda 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp @@ -43,7 +43,9 @@ using namespace WTF; namespace { -static const size_t textureUpdatesPerFrame = 0; +// Number of textures to update with each call to +// scheduledActionUpdateMoreResources(). +static const size_t textureUpdatesPerFrame = 5; } // anonymous namespace @@ -59,6 +61,7 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) , m_commitRequested(false) , m_layerTreeHost(layerTreeHost) , m_compositorIdentifier(-1) + , m_layerRendererInitialized(false) , m_started(false) , m_lastExecutedBeginFrameAndCommitSequenceNumber(-1) , m_numBeginFrameAndCommitsIssuedOnImplThread(0) @@ -85,6 +88,11 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) ASSERT(isMainThread()); ASSERT(m_layerTreeHost); + if (!m_layerRendererInitialized) { + TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0); + return false; + } + // If a commit is pending, perform the commit first. if (m_commitRequested) { // This bit of code is uglier than it should be because returning @@ -146,9 +154,9 @@ bool CCThreadProxy::isStarted() const return m_started; } -bool CCThreadProxy::initializeLayerRenderer() +bool CCThreadProxy::initializeContext() { - TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); + TRACE_EVENT("CCThreadProxy::initializeContext", this, 0); RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D(); if (!context) return false; @@ -158,19 +166,29 @@ bool CCThreadProxy::initializeLayerRenderer() GraphicsContext3D* contextPtr = context.release().leakRef(); ASSERT(contextPtr->hasOneRef()); + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeContextOnImplThread, + AllowCrossThreadAccess(contextPtr))); + return true; +} + +bool CCThreadProxy::initializeLayerRenderer() +{ + TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0); // Make a blocking call to initializeLayerRendererOnImplThread. The results of that call // are pushed into the initializeSucceeded and capabilities local variables. CCCompletionEvent completion; bool initializeSucceeded = false; LayerRendererCapabilities capabilities; CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::initializeLayerRendererOnImplThread, - AllowCrossThreadAccess(contextPtr), AllowCrossThreadAccess(&completion), - AllowCrossThreadAccess(&initializeSucceeded), AllowCrossThreadAccess(&capabilities), - AllowCrossThreadAccess(&m_compositorIdentifier))); + AllowCrossThreadAccess(&completion), + AllowCrossThreadAccess(&initializeSucceeded), + AllowCrossThreadAccess(&capabilities))); completion.wait(); - if (initializeSucceeded) + if (initializeSucceeded) { + m_layerRendererInitialized = true; m_layerRendererCapabilitiesMainThreadCopy = capabilities; + } return initializeSucceeded; } @@ -182,6 +200,7 @@ int CCThreadProxy::compositorIdentifier() const const LayerRendererCapabilities& CCThreadProxy::layerRendererCapabilities() const { + ASSERT(m_layerRendererInitialized); return m_layerRendererCapabilitiesMainThreadCopy; } @@ -380,7 +399,8 @@ void CCThreadProxy::beginFrameAndCommit(int sequenceNumber, double frameBeginTim // updateLayers. m_commitRequested = false; - m_layerTreeHost->updateLayers(); + if (!m_layerTreeHost->updateLayers()) + return; // Before applying scrolls and calling animate, we set m_animateRequested to false. // If it is true now, it means setNeedAnimate was called again. Call setNeedsCommit @@ -444,7 +464,7 @@ void CCThreadProxy::scheduledActionUpdateMoreResources() { TRACE_EVENT("CCThreadProxy::scheduledActionUpdateMoreResources", this, 0); ASSERT(m_currentTextureUpdaterOnImplThread); - m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->context(), textureUpdatesPerFrame > 0 ? textureUpdatesPerFrame : 99999); + m_currentTextureUpdaterOnImplThread->update(m_layerTreeHostImpl->context(), textureUpdatesPerFrame); } void CCThreadProxy::scheduledActionCommit() @@ -537,22 +557,30 @@ void CCThreadProxy::initializeImplOnImplThread(CCCompletionEvent* completion) OwnPtr<CCFrameRateController> frameRateController = adoptPtr(new CCFrameRateController(CCDelayBasedTimeSource::create(displayRefreshIntervalMs, CCProxy::implThread()))); m_schedulerOnImplThread = CCScheduler::create(this, frameRateController.release()); m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); + + m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get()); + m_compositorIdentifier = m_inputHandlerOnImplThread->identifier(); + completion->signal(); } -void CCThreadProxy::initializeLayerRendererOnImplThread(GraphicsContext3D* contextPtr, CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities, int* compositorIdentifier) +void CCThreadProxy::initializeContextOnImplThread(GraphicsContext3D* context) +{ + TRACE_EVENT("CCThreadProxy::initializeContextOnImplThread", this, 0); + ASSERT(isImplThread()); + m_contextBeforeInitializationOnImplThread = adoptRef(context); +} + +void CCThreadProxy::initializeLayerRendererOnImplThread(CCCompletionEvent* completion, bool* initializeSucceeded, LayerRendererCapabilities* capabilities) { TRACE_EVENT("CCThreadProxy::initializeLayerRendererOnImplThread", this, 0); ASSERT(isImplThread()); - RefPtr<GraphicsContext3D> context(adoptRef(contextPtr)); - *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(context); + ASSERT(m_contextBeforeInitializationOnImplThread); + *initializeSucceeded = m_layerTreeHostImpl->initializeLayerRenderer(m_contextBeforeInitializationOnImplThread.release()); if (*initializeSucceeded) { *capabilities = m_layerTreeHostImpl->layerRendererCapabilities(); if (capabilities->usingSwapCompleteCallback) m_schedulerOnImplThread->setMaxFramesPending(2); - - m_inputHandlerOnImplThread = CCInputHandler::create(m_layerTreeHostImpl.get()); - *compositorIdentifier = m_inputHandlerOnImplThread->identifier(); } completion->signal(); @@ -569,9 +597,9 @@ void CCThreadProxy::layerTreeHostClosedOnImplThread(CCCompletionEvent* completio completion->signal(); } -bool CCThreadProxy::partialTextureUpdateCapability() const +size_t CCThreadProxy::maxPartialTextureUpdates() const { - return !textureUpdatesPerFrame; + return textureUpdatesPerFrame; } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h index a11b52785..d304acd96 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h @@ -52,6 +52,7 @@ public: virtual GraphicsContext3D* context(); virtual void finishAllRendering(); virtual bool isStarted() const; + virtual bool initializeContext(); virtual bool initializeLayerRenderer(); virtual int compositorIdentifier() const; virtual const LayerRendererCapabilities& layerRendererCapabilities() const; @@ -62,7 +63,7 @@ public: virtual void setVisible(bool); virtual void start(); virtual void stop(); - virtual bool partialTextureUpdateCapability() const; + virtual size_t maxPartialTextureUpdates() const; // CCLayerTreeHostImplClient implementation virtual void onSwapBuffersCompleteOnImplThread(); @@ -98,7 +99,8 @@ private: void requestReadbackOnImplThread(ReadbackRequest*); void finishAllRenderingOnImplThread(CCCompletionEvent*); void initializeImplOnImplThread(CCCompletionEvent*); - void initializeLayerRendererOnImplThread(GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*, int* compositorIdentifier); + void initializeContextOnImplThread(GraphicsContext3D*); + void initializeLayerRendererOnImplThread(CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*); void setVisibleOnImplThread(CCCompletionEvent*, bool visible); void layerTreeHostClosedOnImplThread(CCCompletionEvent*); @@ -107,6 +109,7 @@ private: bool m_commitRequested; CCLayerTreeHost* m_layerTreeHost; int m_compositorIdentifier; + bool m_layerRendererInitialized; LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; bool m_started; int m_lastExecutedBeginFrameAndCommitSequenceNumber; @@ -121,6 +124,10 @@ private: RefPtr<CCScopedThreadProxy> m_mainThreadProxy; + // Holds on to the GraphicsContext3D we might use for compositing in between initializeContext() + // and initializeLayerRenderer() calls. + RefPtr<GraphicsContext3D> m_contextBeforeInitializationOnImplThread; + // Set when the main thread is waiing on a readback. ReadbackRequest* m_readbackRequestOnImplThread; diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp index 09afb08d3..eef0ca3e9 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp @@ -246,10 +246,15 @@ bool CCVideoLayerImpl::reserveTextures(const VideoFrameChromium* frame, GC3Denum if (!m_textures[plane].m_texture) return false; m_textures[plane].m_visibleSize = IntSize(); + } else { + // The renderSurfaceTextureManager may have been destroyed and recreated since the last frame, so pass the new one. + // This is a no-op if the TextureManager is still around. + m_textures[plane].m_texture->setTextureManager(layerRenderer->renderSurfaceTextureManager()); } if (m_textures[plane].m_texture->size() != requiredTextureSize) m_textures[plane].m_visibleSize = computeVisibleSize(frame, plane); - m_textures[plane].m_texture->reserve(requiredTextureSize, format); + if (!m_textures[plane].m_texture->reserve(requiredTextureSize, format)) + return false; } return true; } diff --git a/Source/WebCore/platform/graphics/efl/DrawingBufferEfl.cpp b/Source/WebCore/platform/graphics/efl/DrawingBufferEfl.cpp new file mode 100644 index 000000000..babe5e42a --- /dev/null +++ b/Source/WebCore/platform/graphics/efl/DrawingBufferEfl.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(WEBGL) + +#include "DrawingBuffer.h" + +#include "Extensions3D.h" + +namespace WebCore { + +DrawingBuffer::DrawingBuffer(GraphicsContext3D* context, const IntSize& size, bool multisampleExtensionSupported, bool packedDepthStencilExtensionSupported, bool separateBackingTexture) + : m_separateBackingTexture(separateBackingTexture) + , m_scissorEnabled(false) + , m_texture2DBinding(0) + , m_activeTextureUnit(GraphicsContext3D::TEXTURE0) + , m_context(context) + , m_size(-1, -1) + , m_multisampleExtensionSupported(multisampleExtensionSupported) + , m_packedDepthStencilExtensionSupported(packedDepthStencilExtensionSupported) + , m_fbo(context->createFramebuffer()) + , m_colorBuffer(0) + , m_depthStencilBuffer(0) + , m_depthBuffer(0) + , m_stencilBuffer(0) + , m_multisampleFBO(0) + , m_multisampleColorBuffer(0) +{ + // Support for a separate backing texture has only been enabled for + // the chromium port. + ASSERT(!m_separateBackingTexture); + ASSERT(m_fbo); + if (!m_fbo) { + clear(); + return; + } + + // Create a texture to render into. + m_colorBuffer = context->createTexture(); + context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); + context->texParameterf(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); + context->texParameterf(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); + context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); + context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); + context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); + + createSecondaryBuffers(); + reset(size); +} + +DrawingBuffer::~DrawingBuffer() +{ + clear(); +} + +Platform3DObject DrawingBuffer::platformColorBuffer() const +{ + return m_colorBuffer; +} + +#if USE(ACCELERATED_COMPOSITING) +void DrawingBuffer::paintCompositedResultsToCanvas(CanvasRenderingContext* context) +{ +} +#endif + +} + +#endif diff --git a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp index e3e82f998..1f1eda21c 100644 --- a/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp +++ b/Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp @@ -1,850 +1,147 @@ /* - Copyright (C) 2011 Samsung Electronics - - 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. -*/ + * Copyright (C) 2011, 2012 Samsung Electronics + * + * 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 "GraphicsContext3D.h" #if ENABLE(WEBGL) - -#include "GraphicsContext3DInternal.h" - -#include "ImageData.h" -#include "NotImplemented.h" +#include "Extensions3DOpenGL.h" +#include "GraphicsContext3DPrivate.h" +#include "OpenGLShims.h" +#include "ShaderLang.h" namespace WebCore { -PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, RenderStyle renderStyle) +PassRefPtr<GraphicsContext3D> GraphicsContext3D::create(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle) { - bool renderDirectlyToEvasGLObject = (renderStyle == RenderDirectlyToHostWindow); + bool renderDirectlyToHostWindow = (renderStyle == RenderDirectlyToHostWindow); + // This implementation doesn't currently support rendering directly to the HostWindow. + if (renderDirectlyToHostWindow) + return 0; - OwnPtr<GraphicsContext3DInternal> internal = GraphicsContext3DInternal::create(attrs, hostWindow, renderDirectlyToEvasGLObject); - if (!internal) + OwnPtr<GraphicsContext3DPrivate> priv = GraphicsContext3DPrivate::create(); + if (!priv) return 0; - RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attrs, hostWindow, renderDirectlyToEvasGLObject)); - context->m_internal = internal.release(); + RefPtr<GraphicsContext3D> context = adoptRef(new GraphicsContext3D(attributes, hostWindow, renderDirectlyToHostWindow)); + context->m_private = priv.release(); return context.release(); } -GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attrs, HostWindow* hostWindow, bool renderDirectlyToHostWindow) +GraphicsContext3D::GraphicsContext3D(GraphicsContext3D::Attributes attributes, HostWindow* hostWindow, bool renderDirectlyToHostWindow) : m_currentWidth(0) , m_currentHeight(0) - , m_isResourceSafe(false) -{ + , m_attrs(attributes) + , m_texture(0) + , m_fbo(0) + , m_depthStencilBuffer(0) + , m_boundFBO(0) + , m_multisampleFBO(0) + , m_multisampleDepthStencilBuffer(0) + , m_multisampleColorBuffer(0) +{ + GraphicsContext3DPrivate::addActiveGraphicsContext(this); + + validateAttributes(); + + // Create a texture to render into. + ::glGenTextures(1, &m_texture); + ::glBindTexture(GL_TEXTURE_2D, m_texture); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + ::glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + ::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + ::glBindTexture(GL_TEXTURE_2D, 0); + + // Create an FBO. + ::glGenFramebuffersEXT(1, &m_fbo); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + + m_boundFBO = m_fbo; + if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth)) + ::glGenRenderbuffersEXT(1, &m_depthStencilBuffer); + + // Create a multisample FBO. + if (m_attrs.antialias) { + ::glGenFramebuffersEXT(1, &m_multisampleFBO); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + m_boundFBO = m_multisampleFBO; + ::glGenRenderbuffersEXT(1, &m_multisampleColorBuffer); + if (m_attrs.stencil || m_attrs.depth) + ::glGenRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer); + } + + // ANGLE initialization. + ShBuiltInResources ANGLEResources; + ShInitBuiltInResources(&ANGLEResources); + + getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &ANGLEResources.MaxVertexAttribs); + getIntegerv(GraphicsContext3D::MAX_VERTEX_UNIFORM_VECTORS, &ANGLEResources.MaxVertexUniformVectors); + getIntegerv(GraphicsContext3D::MAX_VARYING_VECTORS, &ANGLEResources.MaxVaryingVectors); + getIntegerv(GraphicsContext3D::MAX_VERTEX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxVertexTextureImageUnits); + getIntegerv(GraphicsContext3D::MAX_COMBINED_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxCombinedTextureImageUnits); + getIntegerv(GraphicsContext3D::MAX_TEXTURE_IMAGE_UNITS, &ANGLEResources.MaxTextureImageUnits); + getIntegerv(GraphicsContext3D::MAX_FRAGMENT_UNIFORM_VECTORS, &ANGLEResources.MaxFragmentUniformVectors); + + // Always set to 1 for OpenGL ES. + ANGLEResources.MaxDrawBuffers = 1; + m_compiler.setResources(ANGLEResources); + + ::glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); + ::glEnable(GL_POINT_SPRITE); + ::glClearColor(0, 0, 0, 0); } GraphicsContext3D::~GraphicsContext3D() { -} + GraphicsContext3DPrivate::removeActiveGraphicsContext(this); + if (!m_private->m_context) + return; -PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const -{ - return m_internal->platformGraphicsContext3D(); + makeContextCurrent(); + ::glDeleteTextures(1, &m_texture); + if (m_attrs.antialias) { + ::glDeleteRenderbuffersEXT(1, &m_multisampleColorBuffer); + if (m_attrs.stencil || m_attrs.depth) + ::glDeleteRenderbuffersEXT(1, &m_multisampleDepthStencilBuffer); + ::glDeleteFramebuffersEXT(1, &m_multisampleFBO); + } else { + if (m_attrs.stencil || m_attrs.depth) + ::glDeleteRenderbuffersEXT(1, &m_depthStencilBuffer); + } + ::glDeleteFramebuffersEXT(1, &m_fbo); } -#if USE(ACCELERATED_COMPOSITING) -PlatformLayer* GraphicsContext3D::platformLayer() const -{ - notImplemented(); - return 0; -} -#endif - bool GraphicsContext3D::makeContextCurrent() { - m_internal->makeContextCurrent(); - return true; -} - -bool GraphicsContext3D::isGLES2Compliant() const -{ - return m_internal->isGLES2Compliant(); -} - -void GraphicsContext3D::activeTexture(GC3Denum texture) -{ - m_internal->activeTexture(texture); -} - -void GraphicsContext3D::attachShader(Platform3DObject program, Platform3DObject shader) -{ - m_internal->attachShader(program, shader); -} - -void GraphicsContext3D::bindAttribLocation(Platform3DObject program, GC3Duint index, const String& name) -{ - m_internal->bindAttribLocation(program, index, name); -} - -void GraphicsContext3D::bindBuffer(GC3Denum target, Platform3DObject buffer) -{ - m_internal->bindBuffer(target, buffer); -} - -void GraphicsContext3D::bindFramebuffer(GC3Denum target, Platform3DObject buffer) -{ - m_internal->bindFramebuffer(target, buffer); -} - -void GraphicsContext3D::bindRenderbuffer(GC3Denum target, Platform3DObject renderbuffer) -{ - m_internal->bindRenderbuffer(target, renderbuffer); -} - -void GraphicsContext3D::bindTexture(GC3Denum target, Platform3DObject texture) -{ - m_internal->bindTexture(target, texture); -} - -void GraphicsContext3D::blendColor(GC3Dclampf red, GC3Dclampf green, GC3Dclampf blue, GC3Dclampf alpha) -{ - m_internal->blendColor(red, green, blue, alpha); -} - -void GraphicsContext3D::blendEquation(GC3Denum mode) -{ - m_internal->blendEquation(mode); -} - -void GraphicsContext3D::blendEquationSeparate(GC3Denum modeRGB, GC3Denum modeAlpha) -{ - m_internal->blendEquationSeparate(modeRGB, modeAlpha); -} - -void GraphicsContext3D::blendFunc(GC3Denum srcFactor, GC3Denum dstFactor) -{ - m_internal->blendFunc(srcFactor, dstFactor); -} - -void GraphicsContext3D::blendFuncSeparate(GC3Denum srcRGB, GC3Denum dstRGB, GC3Denum srcAlpha, GC3Denum dstAlpha) -{ - m_internal->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); -} - -void GraphicsContext3D::bufferData(GC3Denum target, GC3Dsizeiptr size, GC3Denum usage) -{ - m_internal->bufferData(target, size, 0, usage); -} - -void GraphicsContext3D::bufferData(GC3Denum target, GC3Dsizeiptr size, const void* data, GC3Denum usage) -{ - m_internal->bufferData(target, size, data, usage); -} - -void GraphicsContext3D::bufferSubData(GC3Denum target, GC3Dintptr offset, GC3Dsizeiptr size, const void* data) -{ - m_internal->bufferSubData(target, offset, size, data); -} - -GC3Denum GraphicsContext3D::checkFramebufferStatus(GC3Denum target) -{ - return m_internal->checkFramebufferStatus(target); -} - -void GraphicsContext3D::clear(GC3Dbitfield mask) -{ - m_internal->clear(mask); -} - -void GraphicsContext3D::clearColor(GC3Dclampf red, GC3Dclampf green, GC3Dclampf blue, GC3Dclampf alpha) -{ - m_internal->clearColor(red, green, blue, alpha); -} - -void GraphicsContext3D::clearDepth(GC3Dclampf depth) -{ - m_internal->clearDepth(depth); -} - -void GraphicsContext3D::clearStencil(GC3Dint clearValue) -{ - m_internal->clearStencil(clearValue); -} - -void GraphicsContext3D::colorMask(GC3Dboolean red, GC3Dboolean green, GC3Dboolean blue, GC3Dboolean alpha) -{ - m_internal->colorMask(red, green, blue, alpha); -} - -void GraphicsContext3D::compileShader(Platform3DObject shader) -{ - m_internal->compileShader(shader); -} - -void GraphicsContext3D::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) -{ - m_internal->copyTexImage2D(target, level, internalformat, x, y, width, height, border); -} - -void GraphicsContext3D::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xOffset, GC3Dint yOffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) -{ - m_internal->copyTexSubImage2D(target, level, xOffset, yOffset, x, y, width, height); -} - -void GraphicsContext3D::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Dsizei imageSize, const void* data) -{ - // FIXME: Add support for compressedTexImage2D. - // m_internal->compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); -} - -void GraphicsContext3D::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Dsizei imageSize, const void* data) -{ - // FIXME: Add support for compressedTexSubImage2D. - // m_internal->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); -} - -void GraphicsContext3D::cullFace(GC3Denum mode) -{ - m_internal->cullFace(mode); -} - -void GraphicsContext3D::depthFunc(GC3Denum func) -{ - m_internal->depthFunc(func); -} - -void GraphicsContext3D::depthMask(GC3Dboolean flag) -{ - m_internal->depthMask(flag); -} - -void GraphicsContext3D::depthRange(GC3Dclampf zNear, GC3Dclampf zFar) -{ - m_internal->depthRange(zNear, zFar); -} - -void GraphicsContext3D::detachShader(Platform3DObject program, Platform3DObject shader) -{ - m_internal->detachShader(program, shader); -} - -void GraphicsContext3D::disable(GC3Denum cap) -{ - m_internal->disable(cap); -} - -void GraphicsContext3D::disableVertexAttribArray(GC3Duint index) -{ - m_internal->disableVertexAttribArray(index); -} - -void GraphicsContext3D::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count) -{ - m_internal->drawArrays(mode, first, count); -} - -void GraphicsContext3D::drawElements(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dintptr offset) -{ - m_internal->drawElements(mode, count, type, offset); -} - -void GraphicsContext3D::enable(GC3Denum cap) -{ - m_internal->enable(cap); -} - -void GraphicsContext3D::enableVertexAttribArray(GC3Duint index) -{ - m_internal->enableVertexAttribArray(index); -} - -void GraphicsContext3D::finish() -{ - m_internal->finish(); -} - -void GraphicsContext3D::flush() -{ - m_internal->flush(); -} - -void GraphicsContext3D::framebufferRenderbuffer(GC3Denum target, GC3Denum attachment, GC3Denum renderbufferTarget, Platform3DObject buffer) -{ - m_internal->framebufferRenderbuffer(target, attachment, renderbufferTarget, buffer); -} - -void GraphicsContext3D::framebufferTexture2D(GC3Denum target, GC3Denum attachment, GC3Denum texTarget, Platform3DObject texture, GC3Dint level) -{ - m_internal->framebufferTexture2D(target, attachment, texTarget, texture, level); -} - -void GraphicsContext3D::frontFace(GC3Denum mode) -{ - m_internal->frontFace(mode); -} - -void GraphicsContext3D::generateMipmap(GC3Denum target) -{ - m_internal->generateMipmap(target); -} - -bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, GC3Duint index, ActiveInfo& info) -{ - return m_internal->getActiveAttrib(program, index, info); -} - -bool GraphicsContext3D::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info) -{ - return m_internal->getActiveUniform(program, index, info); -} - -void GraphicsContext3D::getAttachedShaders(Platform3DObject program, GC3Dsizei maxCount, GC3Dsizei* count, Platform3DObject* shaders) -{ - m_internal->getAttachedShaders(program, maxCount, count, shaders); -} - -int GraphicsContext3D::getAttribLocation(Platform3DObject program, const String& name) -{ - return m_internal->getAttribLocation(program, name); -} - -void GraphicsContext3D::getBooleanv(GC3Denum paramName, GC3Dboolean* value) -{ - m_internal->getBooleanv(paramName, value); -} - -void GraphicsContext3D::getBufferParameteriv(GC3Denum target, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getBufferParameteriv(target, paramName, value); -} - -GraphicsContext3D::Attributes GraphicsContext3D::getContextAttributes() -{ - return m_internal->getContextAttributes(); -} - -GC3Denum GraphicsContext3D::getError() -{ - return m_internal->getError(); -} - -void GraphicsContext3D::getFloatv(GC3Denum paramName, GC3Dfloat* value) -{ - m_internal->getFloatv(paramName, value); -} - -void GraphicsContext3D::getFramebufferAttachmentParameteriv(GC3Denum target, GC3Denum attachment, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getFramebufferAttachmentParameteriv(target, attachment, paramName, value); -} - -void GraphicsContext3D::getIntegerv(GC3Denum paramName, GC3Dint* value) -{ - m_internal->getIntegerv(paramName, value); -} - -void GraphicsContext3D::getProgramiv(Platform3DObject program, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getProgramiv(program, paramName, value); -} - -String GraphicsContext3D::getProgramInfoLog(Platform3DObject program) -{ - return m_internal->getProgramInfoLog(program); -} - -void GraphicsContext3D::getRenderbufferParameteriv(GC3Denum target, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getRenderbufferParameteriv(target, paramName, value); -} - -void GraphicsContext3D::getShaderiv(Platform3DObject shader, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getShaderiv(shader, paramName, value); -} - -String GraphicsContext3D::getShaderInfoLog(Platform3DObject shader) -{ - return m_internal->getShaderInfoLog(shader); -} - -String GraphicsContext3D::getShaderSource(Platform3DObject shader) -{ - return m_internal->getShaderSource(shader); -} - -String GraphicsContext3D::getString(GC3Denum name) -{ - return m_internal->getString(name); -} - -void GraphicsContext3D::getTexParameterfv(GC3Denum target, GC3Denum paramName, GC3Dfloat* value) -{ - m_internal->getTexParameterfv(target, paramName, value); -} - -void GraphicsContext3D::getTexParameteriv(GC3Denum target, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getTexParameteriv(target, paramName, value); -} - -void GraphicsContext3D::getUniformfv(Platform3DObject program, GC3Dint location, GC3Dfloat* value) -{ - m_internal->getUniformfv(program, location, value); -} - -void GraphicsContext3D::getUniformiv(Platform3DObject program, GC3Dint location, GC3Dint* value) -{ - m_internal->getUniformiv(program, location, value); -} - -GC3Dint GraphicsContext3D::getUniformLocation(Platform3DObject program, const String& name) -{ - return m_internal->getUniformLocation(program, name); -} - -void GraphicsContext3D::getVertexAttribfv(GC3Duint index, GC3Denum paramName, GC3Dfloat* value) -{ - m_internal->getVertexAttribfv(index, paramName, value); -} - -void GraphicsContext3D::getVertexAttribiv(GC3Duint index, GC3Denum paramName, GC3Dint* value) -{ - m_internal->getVertexAttribiv(index, paramName, value); -} - -long GraphicsContext3D::getVertexAttribOffset(GC3Duint index, GC3Denum paramName) -{ - return m_internal->getVertexAttribOffset(index, paramName); -} - -void GraphicsContext3D::hint(GC3Denum target, GC3Denum mode) -{ - m_internal->hint(target, mode); -} - -GC3Dboolean GraphicsContext3D::isBuffer(Platform3DObject obj) -{ - return m_internal->isBuffer(obj); -} - -GC3Dboolean GraphicsContext3D::isEnabled(GC3Denum cap) -{ - return m_internal->isEnabled(cap); -} - -GC3Dboolean GraphicsContext3D::isFramebuffer(Platform3DObject obj) -{ - return m_internal->isFramebuffer(obj); -} - -GC3Dboolean GraphicsContext3D::isProgram(Platform3DObject obj) -{ - return m_internal->isProgram(obj); -} - -GC3Dboolean GraphicsContext3D::isRenderbuffer(Platform3DObject obj) -{ - return m_internal->isRenderbuffer(obj); -} - -GC3Dboolean GraphicsContext3D::isShader(Platform3DObject obj) -{ - return m_internal->isShader(obj); -} - -GC3Dboolean GraphicsContext3D::isTexture(Platform3DObject obj) -{ - return m_internal->isTexture(obj); -} - -void GraphicsContext3D::lineWidth(GC3Dfloat width) -{ - m_internal->lineWidth(width); -} - -void GraphicsContext3D::linkProgram(Platform3DObject program) -{ - m_internal->linkProgram(program); -} - -void GraphicsContext3D::pixelStorei(GC3Denum paramName, GC3Dint param) -{ - m_internal->pixelStorei(paramName, param); -} - -void GraphicsContext3D::polygonOffset(GC3Dfloat factor, GC3Dfloat units) -{ - m_internal->polygonOffset(factor, units); -} - -void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data) -{ - m_internal->readPixels(x, y, width, height, format, type, data); -} - -void GraphicsContext3D::releaseShaderCompiler() -{ - notImplemented(); -} - -void GraphicsContext3D::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) -{ - m_internal->renderbufferStorage(target, internalformat, width, height); -} - -void GraphicsContext3D::sampleCoverage(GC3Dclampf value, GC3Dboolean invert) -{ - m_internal->sampleCoverage(value, invert); -} - -void GraphicsContext3D::scissor(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) -{ - m_internal->scissor(x, y, width, height); -} - -void GraphicsContext3D::shaderSource(Platform3DObject program, const String& string) -{ - m_internal->shaderSource(program, string); -} - -void GraphicsContext3D::stencilFunc(GC3Denum func, GC3Dint ref, GC3Duint mask) -{ - m_internal->stencilFunc(func, ref, mask); -} - -void GraphicsContext3D::stencilFuncSeparate(GC3Denum face, GC3Denum func, GC3Dint ref, GC3Duint mask) -{ - m_internal->stencilFuncSeparate(face, func, ref, mask); -} - -void GraphicsContext3D::stencilMask(GC3Duint mask) -{ - m_internal->stencilMask(mask); -} - -void GraphicsContext3D::stencilMaskSeparate(GC3Denum face, GC3Duint mask) -{ - m_internal->stencilMaskSeparate(face, mask); -} - -void GraphicsContext3D::stencilOp(GC3Denum fail, GC3Denum zfail, GC3Denum zpass) -{ - m_internal->stencilOp(fail, zfail, zpass); -} - -void GraphicsContext3D::stencilOpSeparate(GC3Denum face, GC3Denum fail, GC3Denum zfail, GC3Denum zpass) -{ - m_internal->stencilOpSeparate(face, fail, zfail, zpass); -} - -bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) -{ - return m_internal->texImage2D(target, level, internalformat, width, height, border, format, type, pixels); -} - -void GraphicsContext3D::texParameterf(GC3Denum target, GC3Denum paramName, GC3Dfloat param) -{ - m_internal->texParameterf(target, paramName, param); -} - -void GraphicsContext3D::texParameteri(GC3Denum target, GC3Denum paramName, GC3Dint param) -{ - m_internal->texParameteri(target, paramName, param); -} - -void GraphicsContext3D::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xOffset, GC3Dint yOffset, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, const void* pixels) -{ - m_internal->texSubImage2D(target, level, xOffset, yOffset, width, height, format, type, pixels); -} - -void GraphicsContext3D::uniform1f(GC3Dint location, GC3Dfloat x) -{ - m_internal->uniform1f(location, x); -} - -void GraphicsContext3D::uniform1fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) -{ - m_internal->uniform1fv(location, size, v); -} - -void GraphicsContext3D::uniform1i(GC3Dint location, GC3Dint x) -{ - m_internal->uniform1i(location, x); -} - -void GraphicsContext3D::uniform1iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) -{ - m_internal->uniform1iv(location, size, v); -} - -void GraphicsContext3D::uniform2f(GC3Dint location, GC3Dfloat x, float y) -{ - m_internal->uniform2f(location, x, y); -} - -void GraphicsContext3D::uniform2fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) -{ - m_internal->uniform2fv(location, size, v); -} - -void GraphicsContext3D::uniform2i(GC3Dint location, GC3Dint x, GC3Dint y) -{ - m_internal->uniform2i(location, x, y); -} - -void GraphicsContext3D::uniform2iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) -{ - m_internal->uniform2iv(location, size, v); -} - -void GraphicsContext3D::uniform3f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z) -{ - m_internal->uniform3f(location, x, y, z); -} - -void GraphicsContext3D::uniform3fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) -{ - m_internal->uniform3fv(location, size, v); -} - -void GraphicsContext3D::uniform3i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z) -{ - m_internal->uniform3i(location, x, y, z); -} - -void GraphicsContext3D::uniform3iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) -{ - m_internal->uniform3iv(location, size, v); -} - -void GraphicsContext3D::uniform4f(GC3Dint location, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w) -{ - m_internal->uniform4f(location, x, y, z, w); -} - -void GraphicsContext3D::uniform4fv(GC3Dint location, GC3Dfloat* v, GC3Dsizei size) -{ - m_internal->uniform4fv(location, size, v); -} - -void GraphicsContext3D::uniform4i(GC3Dint location, GC3Dint x, GC3Dint y, GC3Dint z, GC3Dint w) -{ - m_internal->uniform4i(location, x, y, z, w); + if (!m_private) + return false; + return m_private->makeContextCurrent(); } -void GraphicsContext3D::uniform4iv(GC3Dint location, GC3Dint* v, GC3Dsizei size) -{ - m_internal->uniform4iv(location, size, v); -} - -void GraphicsContext3D::uniformMatrix2fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) -{ - m_internal->uniformMatrix2fv(location, size, transpose, value); -} - -void GraphicsContext3D::uniformMatrix3fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) -{ - m_internal->uniformMatrix3fv(location, size, transpose, value); -} - -void GraphicsContext3D::uniformMatrix4fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* value, GC3Dsizei size) -{ - m_internal->uniformMatrix4fv(location, size, transpose, value); -} - -void GraphicsContext3D::useProgram(Platform3DObject program) -{ - m_internal->useProgram(program); -} - -void GraphicsContext3D::validateProgram(Platform3DObject program) -{ - m_internal->validateProgram(program); -} - -void GraphicsContext3D::vertexAttrib1f(GC3Duint index, GC3Dfloat x) -{ - m_internal->vertexAttrib1f(index, x); -} - -void GraphicsContext3D::vertexAttrib1fv(GC3Duint index, GC3Dfloat* values) -{ - m_internal->vertexAttrib1fv(index, values); -} - -void GraphicsContext3D::vertexAttrib2f(GC3Duint index, GC3Dfloat x, GC3Dfloat y) -{ - m_internal->vertexAttrib2f(index, x, y); -} - -void GraphicsContext3D::vertexAttrib2fv(GC3Duint index, GC3Dfloat* values) -{ - m_internal->vertexAttrib2fv(index, values); -} - -void GraphicsContext3D::vertexAttrib3f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z) -{ - m_internal->vertexAttrib3f(index, x, y, z); -} - -void GraphicsContext3D::vertexAttrib3fv(GC3Duint index, GC3Dfloat* values) -{ - m_internal->vertexAttrib3fv(index, values); -} - -void GraphicsContext3D::vertexAttrib4f(GC3Duint index, GC3Dfloat x, GC3Dfloat y, GC3Dfloat z, GC3Dfloat w) -{ - m_internal->vertexAttrib4f(index, x, y, z, w); -} - -void GraphicsContext3D::vertexAttrib4fv(GC3Duint index, GC3Dfloat* values) -{ - m_internal->vertexAttrib4fv(index, values); -} - -void GraphicsContext3D::vertexAttribPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, GC3Dintptr offset) -{ - m_internal->vertexAttribPointer(index, size, type, normalized, stride, offset); -} - -void GraphicsContext3D::viewport(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) -{ - m_internal->viewport(x, y, width, height); -} - -void GraphicsContext3D::reshape(int width, int height) -{ - notImplemented(); -} - -void GraphicsContext3D::markContextChanged() -{ - notImplemented(); -} - -void GraphicsContext3D::markLayerComposited() -{ - notImplemented(); -} - -bool GraphicsContext3D::layerComposited() const -{ - notImplemented(); - return false; -} - -void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* context, DrawingBuffer* drawingBuffer) -{ - // DrawingBuffer support only implemented in Chromium ports. - ASSERT(!drawingBuffer); - notImplemented(); -} - -PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(DrawingBuffer* drawingBuffer) -{ - // DrawingBuffer support only implemented in Chromium ports. - ASSERT(!drawingBuffer); - notImplemented(); - RefPtr<ImageData> imageData = ImageData::create(IntSize(1, 1)); - return imageData.release(); -} - -Platform3DObject GraphicsContext3D::createBuffer() -{ - return m_internal->createBuffer(); -} - -Platform3DObject GraphicsContext3D::createFramebuffer() -{ - return m_internal->createFramebuffer(); -} - -Platform3DObject GraphicsContext3D::createProgram() -{ - return m_internal->createProgram(); -} - -Platform3DObject GraphicsContext3D::createRenderbuffer() -{ - return m_internal->createRenderbuffer(); -} - -Platform3DObject GraphicsContext3D::createShader(GC3Denum type) -{ - return m_internal->createShader(type); -} - -Platform3DObject GraphicsContext3D::createTexture() -{ - return m_internal->createTexture(); -} - -void GraphicsContext3D::deleteBuffer(Platform3DObject buffer) -{ - m_internal->deleteBuffer(buffer); -} - -void GraphicsContext3D::deleteFramebuffer(Platform3DObject buffer) -{ - m_internal->deleteFramebuffer(buffer); -} - -void GraphicsContext3D::deleteProgram(Platform3DObject program) -{ - m_internal->deleteProgram(program); -} - -void GraphicsContext3D::deleteRenderbuffer(Platform3DObject buffer) -{ - m_internal->deleteRenderbuffer(buffer); -} - -void GraphicsContext3D::deleteShader(Platform3DObject shader) -{ - m_internal->deleteShader(shader); -} - -void GraphicsContext3D::deleteTexture(Platform3DObject texture) -{ - m_internal->deleteTexture(texture); -} - -void GraphicsContext3D::synthesizeGLError(GC3Denum error) -{ - m_internal->synthesizeGLError(error); -} - -Extensions3D* GraphicsContext3D::getExtensions() -{ - return m_internal->getExtensions(); -} - -IntSize GraphicsContext3D::getInternalFramebufferSize() -{ - notImplemented(); - return IntSize(); -} - -void GraphicsContext3D::setContextLostCallback(PassOwnPtr<ContextLostCallback>) -{ - notImplemented(); -} - -void GraphicsContext3D::setErrorMessageCallback(PassOwnPtr<ErrorMessageCallback>) +PlatformGraphicsContext3D GraphicsContext3D::platformGraphicsContext3D() const { - notImplemented(); + return m_private->m_context; } -bool GraphicsContext3D::getImageData(Image* image, GC3Denum format, GC3Denum type, bool premultiplyAlpha, - bool ignoreGammaAndColorProfile, Vector<uint8_t>& outputVector) +bool GraphicsContext3D::isGLES2Compliant() const { - notImplemented(); return false; } diff --git a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp index ed6cb90dc..00b600abd 100644 --- a/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp +++ b/Source/WebCore/platform/graphics/filters/FEColorMatrix.cpp @@ -187,7 +187,7 @@ void FEColorMatrix::platformApplySoftware() break; } - resultImage->putUnmultipliedImageData(pixelArray.get(), imageRect.size(), imageRect, IntPoint()); + resultImage->putByteArray(Unmultiplied, pixelArray.get(), imageRect.size(), imageRect, IntPoint()); } void FEColorMatrix::dump() diff --git a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp index 5d807785b..5944feca5 100644 --- a/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp +++ b/Source/WebCore/platform/graphics/filters/FEDropShadow.cpp @@ -108,7 +108,7 @@ void FEDropShadow::platformApplySoftware() contextShadow.blurLayerImage(srcPixelArray->data(), shadowArea.size(), 4 * shadowArea.size().width()); - resultImage->putPremultipliedImageData(srcPixelArray.get(), shadowArea.size(), shadowArea, IntPoint()); + resultImage->putByteArray(Premultiplied, srcPixelArray.get(), shadowArea.size(), shadowArea, IntPoint()); resultContext->setCompositeOperation(CompositeSourceIn); resultContext->fillRect(FloatRect(FloatPoint(), absolutePaintRect().size()), m_shadowColor, ColorSpaceDeviceRGB); diff --git a/Source/WebCore/platform/graphics/filters/FilterEffect.cpp b/Source/WebCore/platform/graphics/filters/FilterEffect.cpp index fbeb4bbcb..f972c98a4 100644 --- a/Source/WebCore/platform/graphics/filters/FilterEffect.cpp +++ b/Source/WebCore/platform/graphics/filters/FilterEffect.cpp @@ -130,9 +130,9 @@ ImageBuffer* FilterEffect::asImageBuffer() m_imageBufferResult = ImageBuffer::create(m_absolutePaintRect.size(), ColorSpaceLinearRGB, m_filter->renderingMode()); IntRect destinationRect(IntPoint(), m_absolutePaintRect.size()); if (m_premultipliedImageResult) - m_imageBufferResult->putPremultipliedImageData(m_premultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint()); + m_imageBufferResult->putByteArray(Premultiplied, m_premultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint()); else - m_imageBufferResult->putUnmultipliedImageData(m_unmultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint()); + m_imageBufferResult->putByteArray(Unmultiplied, m_unmultipliedImageResult.get(), destinationRect.size(), destinationRect, IntPoint()); return m_imageBufferResult.get(); } diff --git a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp index 9dd3b9de5..d37d604cf 100644 --- a/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp +++ b/Source/WebCore/platform/graphics/gpu/DrawingBuffer.cpp @@ -49,6 +49,7 @@ static int s_maximumResourceUsePixels = 16 * 1024 * 1024; static int s_maximumResourceUsePixels = 0; #endif static int s_currentResourceUsePixels = 0; +static const float s_resourceAdjustedRatio = 0.5; PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size, bool separateBackingTexture) { @@ -236,19 +237,28 @@ bool DrawingBuffer::reset(const IntSize& newSize) } int pixelDelta = newSize.width() * newSize.height(); - if (!m_size.isEmpty()) - pixelDelta -= m_size.width() * m_size.height(); - - if (s_maximumResourceUsePixels && (s_currentResourceUsePixels + pixelDelta) > s_maximumResourceUsePixels) { - clear(); - return false; + int oldSize = 0; + if (!m_size.isEmpty()) { + oldSize = m_size.width() * m_size.height(); + pixelDelta -= oldSize; } - s_currentResourceUsePixels += pixelDelta; + + IntSize adjustedSize = newSize; + if (s_maximumResourceUsePixels) { + while ((s_currentResourceUsePixels + pixelDelta) > s_maximumResourceUsePixels) { + adjustedSize.scale(s_resourceAdjustedRatio); + if (adjustedSize.isEmpty()) { + clear(); + return false; + } + pixelDelta = adjustedSize.width() * adjustedSize.height(); + pixelDelta -= oldSize; + } + } const GraphicsContext3D::Attributes& attributes = m_context->getContextAttributes(); - if (newSize != m_size) { - m_size = newSize; + if (adjustedSize != m_size) { unsigned internalColorFormat, colorFormat, internalRenderbufferFormat; if (attributes.alpha) { @@ -262,46 +272,56 @@ bool DrawingBuffer::reset(const IntSize& newSize) } - // resize multisample FBO - if (multisample()) { - int maxSampleCount = 0; - - m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); - int sampleCount = std::min(4, maxSampleCount); + do { + m_size = adjustedSize; + // resize multisample FBO + if (multisample()) { + int maxSampleCount = 0; - m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); + m_context->getIntegerv(Extensions3D::MAX_SAMPLES, &maxSampleCount); + int sampleCount = std::min(4, maxSampleCount); - m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); - m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height()); - m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); - resizeDepthStencil(sampleCount); - if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { - // Cleanup - clear(); - return false; + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_multisampleFBO); + + m_context->bindRenderbuffer(GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); + m_context->getExtensions()->renderbufferStorageMultisample(GraphicsContext3D::RENDERBUFFER, sampleCount, internalRenderbufferFormat, m_size.width(), m_size.height()); + m_context->framebufferRenderbuffer(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::RENDERBUFFER, m_multisampleColorBuffer); + resizeDepthStencil(sampleCount); + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { + adjustedSize.scale(s_resourceAdjustedRatio); + continue; + } } - } - // resize regular FBO - m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); + // resize regular FBO + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); - m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_colorBuffer); + m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); - m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); + m_context->framebufferTexture2D(GraphicsContext3D::FRAMEBUFFER, GraphicsContext3D::COLOR_ATTACHMENT0, GraphicsContext3D::TEXTURE_2D, m_colorBuffer, 0); - // resize the backing color buffer - if (m_separateBackingTexture) { - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_backingColorBuffer); - m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); - } + // resize the backing color buffer + if (m_separateBackingTexture) { + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, m_backingColorBuffer); + m_context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0, internalColorFormat, m_size.width(), m_size.height(), 0, colorFormat, GraphicsContext3D::UNSIGNED_BYTE, 0); + } + + m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); + + if (!multisample()) + resizeDepthStencil(0); + if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) == GraphicsContext3D::FRAMEBUFFER_COMPLETE) + break; + adjustedSize.scale(s_resourceAdjustedRatio); + + } while (!adjustedSize.isEmpty()); - m_context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0); + pixelDelta = m_size.width() * m_size.height(); + pixelDelta -= oldSize; + s_currentResourceUsePixels += pixelDelta; - if (!multisample()) - resizeDepthStencil(0); - if (m_context->checkFramebufferStatus(GraphicsContext3D::FRAMEBUFFER) != GraphicsContext3D::FRAMEBUFFER_COMPLETE) { - // Cleanup + if (!newSize.isEmpty() && adjustedSize.isEmpty()) { clear(); return false; } diff --git a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp index e96591df6..a77345caa 100644 --- a/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp +++ b/Source/WebCore/platform/graphics/gpu/SharedGraphicsContext3D.cpp @@ -39,6 +39,8 @@ GraphicsContext3D* SharedGraphicsContext3D::get() attributes.canRecoverFromContextLoss = false; // Canvas contexts can not handle lost contexts. attributes.shareResources = true; static GraphicsContext3D* context = GraphicsContext3D::create(attributes, 0).leakRef(); + if (context && !context->makeContextCurrent()) + context = 0; return context; } diff --git a/Source/WebCore/platform/graphics/gtk/WindowGLContext.h b/Source/WebCore/platform/graphics/gtk/WindowGLContext.h new file mode 100644 index 000000000..962356835 --- /dev/null +++ b/Source/WebCore/platform/graphics/gtk/WindowGLContext.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef WindowGLContext_h +#define WindowGLContext_h + +#include <wtf/Noncopyable.h> +#include <wtf/PassOwnPtr.h> + +#if defined(XP_UNIX) +typedef struct __GLXcontextRec* GLXContext; +typedef struct _XDisplay Display; +#endif + +namespace WebCore { + +class WindowGLContext { + WTF_MAKE_NONCOPYABLE(WindowGLContext); +public: + static PassOwnPtr<WindowGLContext> createContextWithGdkWindow(GdkWindow*); + virtual ~WindowGLContext(); + void startDrawing(); + void finishDrawing(); + +private: + WindowGLContext(GdkWindow*); + GdkWindow* m_window; + +#if defined(XP_UNIX) + GLXContext m_context; + Display* m_display; + bool m_needToCloseDisplay; +#endif +}; + +} + +#endif // WindowGLContext_h diff --git a/Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp b/Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp new file mode 100644 index 000000000..c16a4f41b --- /dev/null +++ b/Source/WebCore/platform/graphics/gtk/WindowGLContextGLX.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2012 Igalia, S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "WindowGLContext.h" + +#include <GL/glx.h> +#include <gdk/gdk.h> +#include <gdk/gdkx.h> +#include <wtf/OwnPtr.h> + +namespace WebCore { + +PassOwnPtr<WindowGLContext> WindowGLContext::createContextWithGdkWindow(GdkWindow* window) +{ + OwnPtr<WindowGLContext> context = adoptPtr(new WindowGLContext(window)); + if (!context->m_context) + return nullptr; + return context.release(); +} + +WindowGLContext::WindowGLContext(GdkWindow* window) + : m_window(window) + , m_context(0) + , m_display(0) + , m_needToCloseDisplay(0) +{ + GdkDisplay* gdkDisplay = gdk_window_get_display(m_window); + if (gdkDisplay) + m_display = GDK_DISPLAY_XDISPLAY(gdkDisplay); + else { + m_display = XOpenDisplay(0); + m_needToCloseDisplay = true; + } + + XWindowAttributes attributes; + if (!XGetWindowAttributes(m_display, GDK_WINDOW_XID(m_window), &attributes)) + return; + + XVisualInfo visualInfo; + visualInfo.visualid = XVisualIDFromVisual(attributes.visual); + + int numReturned = 0; + XVisualInfo* visualInfoList = XGetVisualInfo(m_display, VisualIDMask, &visualInfo, &numReturned); + m_context = glXCreateContext(m_display, visualInfoList, 0, True); + XFree(visualInfoList); +} + +WindowGLContext::~WindowGLContext() +{ + if (!m_context) + return; + glXMakeCurrent(m_display, None, None); + glXDestroyContext(m_display, m_context); + + if (m_needToCloseDisplay) + XCloseDisplay(m_display); +} + +void WindowGLContext::startDrawing() +{ + glXMakeCurrent(m_display, GDK_WINDOW_XID(m_window), m_context); +} + +void WindowGLContext::finishDrawing() +{ + glXSwapBuffers(m_display, GDK_WINDOW_XID(m_window)); +} + +} // namespace WebCore diff --git a/Source/WebCore/platform/graphics/mac/FontMac.mm b/Source/WebCore/platform/graphics/mac/FontMac.mm index 8e23339f7..4afb5fbdb 100644 --- a/Source/WebCore/platform/graphics/mac/FontMac.mm +++ b/Source/WebCore/platform/graphics/mac/FontMac.mm @@ -222,7 +222,16 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons ColorSpace fillColorSpace = context->fillColorSpace(); context->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); - bool hasSimpleShadow = context->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context->shadowsIgnoreTransforms() || context->getCTM().isIdentityOrTranslationOrFlipped()) && !context->isInTransparencyLayer(); + AffineTransform contextCTM = context->getCTM(); + float syntheticBoldOffset = font->syntheticBoldOffset(); + if (syntheticBoldOffset && !contextCTM.isIdentityOrTranslationOrFlipped()) { + FloatSize horizontalUnitSizeInDevicePixels = contextCTM.mapSize(FloatSize(1, 0)); + float horizontalUnitLengthInDevicePixels = sqrtf(horizontalUnitSizeInDevicePixels.width() * horizontalUnitSizeInDevicePixels.width() + horizontalUnitSizeInDevicePixels.height() * horizontalUnitSizeInDevicePixels.height()); + if (horizontalUnitLengthInDevicePixels) + syntheticBoldOffset /= horizontalUnitLengthInDevicePixels; + }; + + bool hasSimpleShadow = context->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont() && (!context->shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) && !context->isInTransparencyLayer(); if (hasSimpleShadow) { // Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing. context->clearShadow(); @@ -233,14 +242,14 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative. float shadowTextY = point.y() + shadowOffset.height() * (context->shadowsIgnoreTransforms() ? -1 : 1); showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); - if (font->syntheticBoldOffset()) - showGlyphsWithAdvances(FloatPoint(shadowTextX + font->syntheticBoldOffset(), shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); + if (syntheticBoldOffset) + showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); context->setFillColor(fillColor, fillColorSpace); } showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); - if (font->syntheticBoldOffset()) - showGlyphsWithAdvances(FloatPoint(point.x() + font->syntheticBoldOffset(), point.y()), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); + if (syntheticBoldOffset) + showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), glyphBuffer.advances(from), numGlyphs); if (hasSimpleShadow) context->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); diff --git a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm index 36132cd7b..8ab06eb77 100644 --- a/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm +++ b/Source/WebCore/platform/graphics/mac/MediaPlayerPrivateQTKit.mm @@ -259,7 +259,8 @@ NSMutableDictionary *MediaPlayerPrivateQTKit::commonMovieAttributes() void MediaPlayerPrivateQTKit::createQTMovie(const String& url) { - NSURL *cocoaURL = KURL(ParsedURLString, url); + KURL kURL(ParsedURLString, url); + NSURL *cocoaURL = kURL; NSMutableDictionary *movieAttributes = commonMovieAttributes(); [movieAttributes setValue:cocoaURL forKey:QTMovieURLAttribute]; @@ -282,9 +283,9 @@ void MediaPlayerPrivateQTKit::createQTMovie(const String& url) willUseProxy = NO; } - if (!willUseProxy) { + if (!willUseProxy && !kURL.protocolIsData()) { // Only pass the QTMovieOpenForPlaybackAttribute flag if there are no proxy servers, due - // to rdar://problem/7531776. + // to rdar://problem/7531776, or if not loading a data:// url due to rdar://problem/8103801. [movieAttributes setObject:[NSNumber numberWithBool:YES] forKey:@"QTMovieOpenForPlaybackAttribute"]; } diff --git a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp index 73320d187..67d42ba86 100644 --- a/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp @@ -35,7 +35,7 @@ #if PLATFORM(MAC) #include "ANGLE/ShaderLang.h" #include <OpenGL/gl.h> -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) #include "OpenGLShims.h" #elif PLATFORM(QT) #include <cairo/OpenGLShims.h> @@ -149,7 +149,7 @@ void Extensions3DOpenGL::renderbufferStorageMultisample(unsigned long target, un Platform3DObject Extensions3DOpenGL::createVertexArrayOES() { m_context->makeContextCurrent(); -#if !PLATFORM(GTK) && !PLATFORM(QT) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object +#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object GLuint array = 0; glGenVertexArraysAPPLE(1, &array); return array; @@ -164,7 +164,7 @@ void Extensions3DOpenGL::deleteVertexArrayOES(Platform3DObject array) return; m_context->makeContextCurrent(); -#if !PLATFORM(GTK) && !PLATFORM(QT) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object +#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object glDeleteVertexArraysAPPLE(1, &array); #endif } @@ -175,7 +175,7 @@ GC3Dboolean Extensions3DOpenGL::isVertexArrayOES(Platform3DObject array) return GL_FALSE; m_context->makeContextCurrent(); -#if !PLATFORM(GTK) && !PLATFORM(QT) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object +#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object return glIsVertexArrayAPPLE(array); #else return GL_FALSE; @@ -188,7 +188,7 @@ void Extensions3DOpenGL::bindVertexArrayOES(Platform3DObject array) return; m_context->makeContextCurrent(); -#if !PLATFORM(GTK) && !PLATFORM(QT) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object +#if !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL) && defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object glBindVertexArrayAPPLE(array); #endif } diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp index 47a41c6d0..8b4d9d49a 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp @@ -30,11 +30,13 @@ #include "GraphicsContext3D.h" #include "Extensions3DOpenGL.h" +#include "IntRect.h" +#include "IntSize.h" #include "NotImplemented.h" #if PLATFORM(MAC) #include <OpenGL/gl.h> -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) #include "OpenGLShims.h" #elif PLATFORM(QT) #include <QtGlobal> @@ -43,58 +45,10 @@ namespace WebCore { -void GraphicsContext3D::readRenderingResults(unsigned char *pixels, int pixelsSize) +bool GraphicsContext3D::reshapeFBOs(const IntSize& size) { - if (pixelsSize < m_currentWidth * m_currentHeight * 4) - return; - - makeContextCurrent(); - - bool mustRestoreFBO = false; - if (m_attrs.antialias) { - ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); - ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); - ::glBlitFramebufferEXT(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - mustRestoreFBO = true; - } else { - if (m_boundFBO != m_fbo) { - mustRestoreFBO = true; - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - } - } - - GLint packAlignment = 4; - bool mustRestorePackAlignment = false; - ::glGetIntegerv(GL_PACK_ALIGNMENT, &packAlignment); - if (packAlignment > 4) { - ::glPixelStorei(GL_PACK_ALIGNMENT, 4); - mustRestorePackAlignment = true; - } - - ::glReadPixels(0, 0, m_currentWidth, m_currentHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels); - - if (mustRestorePackAlignment) - ::glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); - - if (mustRestoreFBO) - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); -} - -void GraphicsContext3D::reshape(int width, int height) -{ - if (!platformGraphicsContext3D()) - return; - - if (width == m_currentWidth && height == m_currentHeight) - return; - - m_currentWidth = width; - m_currentHeight = height; - - makeContextCurrent(); - validateAttributes(); - + const int width = size.width(); + const int height = size.height(); GLuint colorFormat, internalDepthStencilFormat = 0; if (m_attrs.alpha) { m_internalColorFormat = GL_RGBA8; @@ -108,7 +62,7 @@ void GraphicsContext3D::reshape(int width, int height) // See GraphicsContext3D::validateAttributes. Extensions3D* extensions = getExtensions(); - // Use a 24 bit depth buffer where we know we have it + // Use a 24 bit depth buffer where we know we have it. if (extensions->supports("GL_EXT_packed_depth_stencil")) internalDepthStencilFormat = GL_DEPTH24_STENCIL8_EXT; else @@ -117,7 +71,7 @@ void GraphicsContext3D::reshape(int width, int height) bool mustRestoreFBO = false; - // resize multisample FBO + // Resize multisample FBO. if (m_attrs.antialias) { GLint maxSampleCount; ::glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSampleCount); @@ -177,166 +131,14 @@ void GraphicsContext3D::reshape(int width, int height) mustRestoreFBO = false; } - // Initialize renderbuffers to 0. - GLfloat clearColor[] = {0, 0, 0, 0}, clearDepth = 0; - GLint clearStencil = 0; - GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE; - GLuint stencilMask = 0xffffffff; - GLboolean isScissorEnabled = GL_FALSE; - GLboolean isDitherEnabled = GL_FALSE; - GLbitfield clearMask = GL_COLOR_BUFFER_BIT; - ::glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor); - ::glClearColor(0, 0, 0, 0); - ::glGetBooleanv(GL_COLOR_WRITEMASK, colorMask); - ::glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - if (m_attrs.depth) { - ::glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth); - ::glClearDepth(1); - ::glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask); - ::glDepthMask(GL_TRUE); - clearMask |= GL_DEPTH_BUFFER_BIT; - } - if (m_attrs.stencil) { - ::glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil); - ::glClearStencil(0); - ::glGetIntegerv(GL_STENCIL_WRITEMASK, reinterpret_cast<GLint*>(&stencilMask)); - ::glStencilMaskSeparate(GL_FRONT, 0xffffffff); - clearMask |= GL_STENCIL_BUFFER_BIT; - } - isScissorEnabled = ::glIsEnabled(GL_SCISSOR_TEST); - ::glDisable(GL_SCISSOR_TEST); - isDitherEnabled = ::glIsEnabled(GL_DITHER); - ::glDisable(GL_DITHER); - - ::glClear(clearMask); - - ::glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); - ::glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]); - if (m_attrs.depth) { - ::glClearDepth(clearDepth); - ::glDepthMask(depthMask); - } - if (m_attrs.stencil) { - ::glClearStencil(clearStencil); - ::glStencilMaskSeparate(GL_FRONT, stencilMask); - } - if (isScissorEnabled) - ::glEnable(GL_SCISSOR_TEST); - else - ::glDisable(GL_SCISSOR_TEST); - if (isDitherEnabled) - ::glEnable(GL_DITHER); - else - ::glDisable(GL_DITHER); - - if (mustRestoreFBO) - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); - - ::glFlush(); -} - -void GraphicsContext3D::prepareTexture() -{ - if (m_layerComposited) - return; - makeContextCurrent(); - if (m_attrs.antialias) { - ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); - ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); - ::glBlitFramebufferEXT(0, 0, m_currentWidth, m_currentHeight, 0, 0, m_currentWidth, m_currentHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR); - } - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - ::glActiveTexture(GL_TEXTURE0); - ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture); - ::glCopyTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, 0, 0, m_currentWidth, m_currentHeight, 0); - ::glBindTexture(GL_TEXTURE_2D, m_boundTexture0); - ::glActiveTexture(m_activeTexture); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); - ::glFinish(); - m_layerComposited = true; -} - -void GraphicsContext3D::bindFramebuffer(GC3Denum target, Platform3DObject buffer) -{ - makeContextCurrent(); - GLuint fbo; - if (buffer) - fbo = buffer; - else - fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo); - if (fbo != m_boundFBO) { - ::glBindFramebufferEXT(target, fbo); - m_boundFBO = fbo; - } -} - -void GraphicsContext3D::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) -{ - makeContextCurrent(); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { - ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); - ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); - ::glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - } - ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + return mustRestoreFBO; } -void GraphicsContext3D::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) +void GraphicsContext3D::resolveMultisamplingIfNecessary(const IntRect& rect) { - makeContextCurrent(); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { - ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); - ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); - ::glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - } - ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); -} - -bool GraphicsContext3D::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info) -{ - if (!program) { - synthesizeGLError(INVALID_VALUE); - return false; - } - makeContextCurrent(); - GLint maxUniformSize = 0; - ::glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize); - GLchar name[maxUniformSize]; // GL_ACTIVE_UNIFORM_MAX_LENGTH includes null termination - GLsizei nameLength = 0; - GLint size = 0; - GLenum type = 0; - ::glGetActiveUniform(program, index, maxUniformSize, &nameLength, &size, &type, name); - if (!nameLength) - return false; - info.name = String(name, nameLength); - info.type = type; - info.size = size; - return true; -} - - -void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data) -{ - // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., - // all previous rendering calls should be done before reading pixels. - makeContextCurrent(); - ::glFlush(); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { - ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); - ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); - ::glBlitFramebufferEXT(x, y, x + width, y + height, x, y, x + width, y + height, GL_COLOR_BUFFER_BIT, GL_LINEAR); - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); - ::glFlush(); - } - ::glReadPixels(x, y, width, height, format, type, data); - if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) - ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); + ::glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, m_multisampleFBO); + ::glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, m_fbo); + ::glBlitFramebufferEXT(rect.x(), rect.y(), rect.maxX(), rect.maxY(), rect.x(), rect.y(), rect.maxX(), rect.maxY(), GL_COLOR_BUFFER_BIT, GL_LINEAR); } void GraphicsContext3D::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp index e68bba7fd..cf9d8f615 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 ChangSeok Oh <shivamidow@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -35,6 +36,8 @@ #include "HTMLCanvasElement.h" #include "ImageBuffer.h" #include "ImageData.h" +#include "IntRect.h" +#include "IntSize.h" #include "NotImplemented.h" #include "WebGLObject.h" #include <cstring> @@ -48,7 +51,7 @@ #if PLATFORM(MAC) #include <OpenGL/gl.h> -#elif PLATFORM(GTK) +#elif PLATFORM(GTK) || PLATFORM(EFL) #include "OpenGLShims.h" #elif PLATFORM(QT) #include <QtGlobal> @@ -57,12 +60,33 @@ namespace WebCore { +static bool systemAllowsMultisamplingOnATICards() +{ +#if PLATFORM(MAC) +#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) + return true; +#else + ASSERT(isMainThread()); + static SInt32 version; + if (!version) { + if (Gestalt(gestaltSystemVersion, &version) != noErr) + return false; + } + // See https://bugs.webkit.org/show_bug.cgi?id=77922 for more details + return version >= 0x1072; +#endif // SNOW_LEOPARD and LION +#else + return false; +#endif // PLATFORM(MAC) +} + void GraphicsContext3D::validateAttributes() { Extensions3D* extensions = getExtensions(); if (m_attrs.stencil) { - if (extensions->supports("GL_EXT_packed_depth_stencil")) { - extensions->ensureEnabled("GL_EXT_packed_depth_stencil"); + const char* packedDepthStencilExtension = isGLES2Compliant() ? "GL_OES_packed_depth_stencil" : "GL_EXT_packed_depth_stencil"; + if (extensions->supports(packedDepthStencilExtension)) { + extensions->ensureEnabled(packedDepthStencilExtension); // Force depth if stencil is true. m_attrs.depth = true; } else @@ -70,11 +94,12 @@ void GraphicsContext3D::validateAttributes() } if (m_attrs.antialias) { bool isValidVendor = true; - // Currently in Mac we only turn on antialias if vendor is NVIDIA. + // Currently in Mac we only turn on antialias if vendor is NVIDIA, + // or if ATI and on 10.7.2 and above. const char* vendor = reinterpret_cast<const char*>(::glGetString(GL_VENDOR)); - if (!std::strstr(vendor, "NVIDIA")) + if (!std::strstr(vendor, "NVIDIA") && !(std::strstr(vendor, "ATI") && systemAllowsMultisamplingOnATICards())) isValidVendor = false; - if (!isValidVendor || !extensions->supports("GL_ANGLE_framebuffer_multisample")) + if (!isValidVendor || !extensions->supports("GL_ANGLE_framebuffer_multisample") || isGLES2Compliant()) m_attrs.antialias = false; else extensions->ensureEnabled("GL_ANGLE_framebuffer_multisample"); @@ -103,7 +128,7 @@ void GraphicsContext3D::paintRenderingResultsToCanvas(CanvasRenderingContext* co if (!m_attrs.premultipliedAlpha) { for (int i = 0; i < totalBytes; i += 4) { - // Premultiply alpha + // Premultiply alpha. pixels[i + 0] = std::min(255, pixels[i + 0] * pixels[i + 3] / 255); pixels[i + 1] = std::min(255, pixels[i + 1] * pixels[i + 3] / 255); pixels[i + 2] = std::min(255, pixels[i + 2] * pixels[i + 3] / 255); @@ -124,7 +149,7 @@ bool GraphicsContext3D::paintCompositedResultsToCanvas(CanvasRenderingContext*) PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(DrawingBuffer*) { // Reading premultiplied alpha would involve unpremultiplying, which is - // lossy + // lossy. if (m_attrs.premultipliedAlpha) return 0; @@ -134,13 +159,148 @@ PassRefPtr<ImageData> GraphicsContext3D::paintRenderingResultsToImageData(Drawin readRenderingResults(pixels, totalBytes); - // Convert to RGBA + // Convert to RGBA. for (int i = 0; i < totalBytes; i += 4) std::swap(pixels[i], pixels[i + 2]); return imageData.release(); } +void GraphicsContext3D::prepareTexture() +{ + if (m_layerComposited) + return; + + makeContextCurrent(); + if (m_attrs.antialias) + resolveMultisamplingIfNecessary(IntRect(0, 0, m_currentWidth, m_currentHeight)); + + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + ::glActiveTexture(GL_TEXTURE0); + ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture); + ::glCopyTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, 0, 0, m_currentWidth, m_currentHeight, 0); + ::glBindTexture(GL_TEXTURE_2D, m_boundTexture0); + ::glActiveTexture(m_activeTexture); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + ::glFinish(); + m_layerComposited = true; +} + +void GraphicsContext3D::readRenderingResults(unsigned char *pixels, int pixelsSize) +{ + int totalBytes = m_currentWidth * m_currentHeight * 4; + if (pixelsSize < totalBytes) + return; + + makeContextCurrent(); + + bool mustRestoreFBO = false; + if (m_attrs.antialias) { + resolveMultisamplingIfNecessary(IntRect(0, 0, m_currentWidth, m_currentHeight)); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + mustRestoreFBO = true; + } else { + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + } + } + + GLint packAlignment = 4; + bool mustRestorePackAlignment = false; + ::glGetIntegerv(GL_PACK_ALIGNMENT, &packAlignment); + if (packAlignment > 4) { + ::glPixelStorei(GL_PACK_ALIGNMENT, 4); + mustRestorePackAlignment = true; + } + + ::glReadPixels(0, 0, m_currentWidth, m_currentHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pixels); + if (isGLES2Compliant()) { + for (int i = 0; i < totalBytes; i += 4) + std::swap(pixels[i], pixels[i + 2]); // Convert to BGRA. + } + + if (mustRestorePackAlignment) + ::glPixelStorei(GL_PACK_ALIGNMENT, packAlignment); + + if (mustRestoreFBO) + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); +} + +void GraphicsContext3D::reshape(int width, int height) +{ + if (!platformGraphicsContext3D()) + return; + + if (width == m_currentWidth && height == m_currentHeight) + return; + + m_currentWidth = width; + m_currentHeight = height; + + makeContextCurrent(); + validateAttributes(); + + bool mustRestoreFBO = reshapeFBOs(IntSize(width, height)); + + // Initialize renderbuffers to 0. + GLfloat clearColor[] = {0, 0, 0, 0}, clearDepth = 0; + GLint clearStencil = 0; + GLboolean colorMask[] = {GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE}, depthMask = GL_TRUE; + GLuint stencilMask = 0xffffffff; + GLboolean isScissorEnabled = GL_FALSE; + GLboolean isDitherEnabled = GL_FALSE; + GLbitfield clearMask = GL_COLOR_BUFFER_BIT; + ::glGetFloatv(GL_COLOR_CLEAR_VALUE, clearColor); + ::glClearColor(0, 0, 0, 0); + ::glGetBooleanv(GL_COLOR_WRITEMASK, colorMask); + ::glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + if (m_attrs.depth) { + ::glGetFloatv(GL_DEPTH_CLEAR_VALUE, &clearDepth); + ::glClearDepth(1); + ::glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask); + ::glDepthMask(GL_TRUE); + clearMask |= GL_DEPTH_BUFFER_BIT; + } + if (m_attrs.stencil) { + ::glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &clearStencil); + ::glClearStencil(0); + ::glGetIntegerv(GL_STENCIL_WRITEMASK, reinterpret_cast<GLint*>(&stencilMask)); + ::glStencilMaskSeparate(GL_FRONT, 0xffffffff); + clearMask |= GL_STENCIL_BUFFER_BIT; + } + isScissorEnabled = ::glIsEnabled(GL_SCISSOR_TEST); + ::glDisable(GL_SCISSOR_TEST); + isDitherEnabled = ::glIsEnabled(GL_DITHER); + ::glDisable(GL_DITHER); + + ::glClear(clearMask); + + ::glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]); + ::glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]); + if (m_attrs.depth) { + ::glClearDepth(clearDepth); + ::glDepthMask(depthMask); + } + if (m_attrs.stencil) { + ::glClearStencil(clearStencil); + ::glStencilMaskSeparate(GL_FRONT, stencilMask); + } + if (isScissorEnabled) + ::glEnable(GL_SCISSOR_TEST); + else + ::glDisable(GL_SCISSOR_TEST); + if (isDitherEnabled) + ::glEnable(GL_DITHER); + else + ::glDisable(GL_DITHER); + + if (mustRestoreFBO) + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_boundFBO); + + ::glFlush(); +} + IntSize GraphicsContext3D::getInternalFramebufferSize() const { return IntSize(m_currentWidth, m_currentHeight); @@ -174,6 +334,20 @@ void GraphicsContext3D::bindBuffer(GC3Denum target, Platform3DObject buffer) ::glBindBuffer(target, buffer); } +void GraphicsContext3D::bindFramebuffer(GC3Denum target, Platform3DObject buffer) +{ + makeContextCurrent(); + GLuint fbo; + if (buffer) + fbo = buffer; + else + fbo = (m_attrs.antialias ? m_multisampleFBO : m_fbo); + if (fbo != m_boundFBO) { + ::glBindFramebufferEXT(target, fbo); + m_boundFBO = fbo; + } +} + void GraphicsContext3D::bindRenderbuffer(GC3Denum target, Platform3DObject renderbuffer) { makeContextCurrent(); @@ -307,7 +481,7 @@ void GraphicsContext3D::compileShader(Platform3DObject shader) entry.isValid = isValid; if (!isValid) - return; // Shader didn't validate, don't move forward with compiling translated source + return; // Shader didn't validate, don't move forward with compiling translated source. int translatedShaderLength = translatedShaderSource.length(); @@ -322,10 +496,34 @@ void GraphicsContext3D::compileShader(Platform3DObject shader) ::glGetShaderiv(shader, COMPILE_STATUS, &GLCompileSuccess); - // ASSERT that ANGLE generated GLSL will be accepted by OpenGL + // ASSERT that ANGLE generated GLSL will be accepted by OpenGL. ASSERT(GLCompileSuccess == GL_TRUE); } +void GraphicsContext3D::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) +{ + makeContextCurrent(); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { + resolveMultisamplingIfNecessary(IntRect(x, y, width, height)); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + } + ::glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); +} + +void GraphicsContext3D::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) +{ + makeContextCurrent(); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { + resolveMultisamplingIfNecessary(IntRect(x, y, width, height)); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + } + ::glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); +} + void GraphicsContext3D::cullFace(GC3Denum mode) { makeContextCurrent(); @@ -439,7 +637,7 @@ bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, GC3Duint index makeContextCurrent(); GLint maxAttributeSize = 0; ::glGetProgramiv(program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &maxAttributeSize); - GLchar name[maxAttributeSize]; // GL_ACTIVE_ATTRIBUTE_MAX_LENGTH includes null termination + GLchar name[maxAttributeSize]; // GL_ACTIVE_ATTRIBUTE_MAX_LENGTH includes null termination. GLsizei nameLength = 0; GLint size = 0; GLenum type = 0; @@ -451,6 +649,32 @@ bool GraphicsContext3D::getActiveAttrib(Platform3DObject program, GC3Duint index info.size = size; return true; } + +bool GraphicsContext3D::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info) +{ + if (!program) { + synthesizeGLError(INVALID_VALUE); + return false; + } + + makeContextCurrent(); + GLint maxUniformSize = 0; + ::glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxUniformSize); + + OwnArrayPtr<GLchar> name = adoptArrayPtr(new GLchar[maxUniformSize]); // GL_ACTIVE_UNIFORM_MAX_LENGTH includes null termination. + GLsizei nameLength = 0; + GLint size = 0; + GLenum type = 0; + ::glGetActiveUniform(program, index, maxUniformSize, &nameLength, &size, &type, name.get()); + if (!nameLength) + return false; + + info.name = String(name.get(), nameLength); + info.type = type; + info.size = size; + + return true; +} void GraphicsContext3D::getAttachedShaders(Platform3DObject program, GC3Dsizei maxCount, GC3Dsizei* count, Platform3DObject* shaders) { @@ -586,6 +810,22 @@ void GraphicsContext3D::polygonOffset(GC3Dfloat factor, GC3Dfloat units) ::glPolygonOffset(factor, units); } +void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data) +{ + // FIXME: remove the two glFlush calls when the driver bug is fixed, i.e., + // all previous rendering calls should be done before reading pixels. + makeContextCurrent(); + ::glFlush(); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) { + resolveMultisamplingIfNecessary(IntRect(x, y, width, height)); + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + ::glFlush(); + } + ::glReadPixels(x, y, width, height, format, type, data); + if (m_attrs.antialias && m_boundFBO == m_multisampleFBO) + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_multisampleFBO); +} + void GraphicsContext3D::releaseShaderCompiler() { // FIXME: This is not implemented on desktop OpenGL. We need to have ifdefs for the different GL variants. @@ -686,7 +926,7 @@ void GraphicsContext3D::uniform2f(GC3Dint location, GC3Dfloat v0, GC3Dfloat v1) void GraphicsContext3D::uniform2fv(GC3Dint location, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 2 + // FIXME: length needs to be a multiple of 2. makeContextCurrent(); ::glUniform2fv(location, size, array); } @@ -699,7 +939,7 @@ void GraphicsContext3D::uniform3f(GC3Dint location, GC3Dfloat v0, GC3Dfloat v1, void GraphicsContext3D::uniform3fv(GC3Dint location, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 3 + // FIXME: length needs to be a multiple of 3. makeContextCurrent(); ::glUniform3fv(location, size, array); } @@ -712,7 +952,7 @@ void GraphicsContext3D::uniform4f(GC3Dint location, GC3Dfloat v0, GC3Dfloat v1, void GraphicsContext3D::uniform4fv(GC3Dint location, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 4 + // FIXME: length needs to be a multiple of 4. makeContextCurrent(); ::glUniform4fv(location, size, array); } @@ -737,7 +977,7 @@ void GraphicsContext3D::uniform2i(GC3Dint location, GC3Dint v0, GC3Dint v1) void GraphicsContext3D::uniform2iv(GC3Dint location, GC3Dint* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 2 + // FIXME: length needs to be a multiple of 2. makeContextCurrent(); ::glUniform2iv(location, size, array); } @@ -750,7 +990,7 @@ void GraphicsContext3D::uniform3i(GC3Dint location, GC3Dint v0, GC3Dint v1, GC3D void GraphicsContext3D::uniform3iv(GC3Dint location, GC3Dint* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 3 + // FIXME: length needs to be a multiple of 3. makeContextCurrent(); ::glUniform3iv(location, size, array); } @@ -763,28 +1003,28 @@ void GraphicsContext3D::uniform4i(GC3Dint location, GC3Dint v0, GC3Dint v1, GC3D void GraphicsContext3D::uniform4iv(GC3Dint location, GC3Dint* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 4 + // FIXME: length needs to be a multiple of 4. makeContextCurrent(); ::glUniform4iv(location, size, array); } void GraphicsContext3D::uniformMatrix2fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 4 + // FIXME: length needs to be a multiple of 4. makeContextCurrent(); ::glUniformMatrix2fv(location, size, transpose, array); } void GraphicsContext3D::uniformMatrix3fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 9 + // FIXME: length needs to be a multiple of 9. makeContextCurrent(); ::glUniformMatrix3fv(location, size, transpose, array); } void GraphicsContext3D::uniformMatrix4fv(GC3Dint location, GC3Dboolean transpose, GC3Dfloat* array, GC3Dsizei size) { - // FIXME: length needs to be a multiple of 16 + // FIXME: length needs to be a multiple of 16. makeContextCurrent(); ::glUniformMatrix4fv(location, size, transpose, array); } @@ -1050,7 +1290,7 @@ void GraphicsContext3D::texSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xo { makeContextCurrent(); - // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size + // FIXME: we will need to deal with PixelStore params when dealing with image buffers that differ from the subimage size. ::glTexSubImage2D(target, level, xoff, yoff, width, height, format, type, pixels); } diff --git a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp index 90ff5a0a3..4faa6630f 100644 --- a/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp +++ b/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp @@ -30,6 +30,8 @@ #include "GraphicsContext3D.h" +#include "IntRect.h" +#include "IntSize.h" #include "NotImplemented.h" #if PLATFORM(GTK) @@ -38,63 +40,102 @@ namespace WebCore { -void GraphicsContext3D::readRenderingResults(unsigned char *pixels, int pixelsSize) +bool GraphicsContext3D::reshapeFBOs(const IntSize& size) { - notImplemented(); -} - -void GraphicsContext3D::reshape(int width, int height) -{ - notImplemented(); -} - -void GraphicsContext3D::prepareTexture() -{ - notImplemented(); -} - -void GraphicsContext3D::bindFramebuffer(GC3Denum target, Platform3DObject buffer) -{ - notImplemented(); + const int width = size.width(); + const int height = size.height(); + GLuint colorFormat = 0, pixelDataType = 0; + if (m_attrs.alpha) { + m_internalColorFormat = GL_RGBA; + colorFormat = GL_RGBA; + pixelDataType = GL_UNSIGNED_BYTE; + } else { + m_internalColorFormat = GL_RGB; + colorFormat = GL_RGB; + pixelDataType = GL_UNSIGNED_SHORT_5_6_5; + } + + // We don't allow the logic where stencil is required and depth is not. + // See GraphicsContext3D::validateAttributes. + bool supportPackedDepthStencilBuffer = (m_attrs.stencil || m_attrs.depth) && getExtensions()->supports("GL_OES_packed_depth_stencil"); + + // Resize regular FBO. + bool mustRestoreFBO = false; + if (m_boundFBO != m_fbo) { + mustRestoreFBO = true; + ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo); + } + + ::glBindTexture(GL_TEXTURE_2D, m_texture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0); + ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0); + + ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture); + ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + + // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes. + ASSERT(!m_attrs.antialias); + + if (m_attrs.stencil || m_attrs.depth) { + // Use a 24 bit depth buffer where we know we have it. + if (supportPackedDepthStencilBuffer) { + ::glBindTexture(GL_TEXTURE_2D, m_depthStencilBuffr); + ::glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_STENCIL_OES, width, height, 0, GL_DEPTH_STENCIL_OES, GL_UNSIGNED_INT_24_8_OES, 0); + if (m_attrs.stencil) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + if (m_attrs.depth) + ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, m_depthStencilBuffer, 0); + ::glBindTexture(GL_TEXTURE_2D, 0); + } else { + if (m_attributes.stencil) { + ::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_stencilBuffer); + ::glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_STENCIL_INDEX8, width, height); + ::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_stencilBuffer); + } + if (m_attributes.depth) { + ::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthBuffer); + ::glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, width, height); + ::glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, m_depthBuffer); + } + ::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0); + } + } + if (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE_EXT) { + // FIXME: cleanup + notImplemented(); + } + + return mustRestoreFBO; } -void GraphicsContext3D::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) -{ - notImplemented(); -} - -void GraphicsContext3D::copyTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height) -{ - notImplemented(); -} - -bool GraphicsContext3D::getActiveUniform(Platform3DObject program, GC3Duint index, ActiveInfo& info) -{ - notImplemented(); -} - - -void GraphicsContext3D::readPixels(GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Denum format, GC3Denum type, void* data) +void GraphicsContext3D::resolveMultisamplingIfNecessary(IntRect& rect) { + // FIXME: We don't support antialiasing yet. notImplemented(); } void GraphicsContext3D::renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) { - notImplemented(); + makeContextCurrent(); + ::glRenderbufferStorageEXT(target, internalformat, width, height); } void GraphicsContext3D::getIntegerv(GC3Denum pname, GC3Dint* value) { - notImplemented(); + makeContextCurrent(); + ::glGetIntegerv(pname, value); } bool GraphicsContext3D::texImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height, GC3Dint border, GC3Denum format, GC3Denum type, const void* pixels) { - notImplemented(); - return false; -} - + if (width && height && !pixels) { + synthesizeGLError(INVALID_VALUE); + return false; + } + makeContextCurrent(); + ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); + return true; } #endif // ENABLE(WEBGL) diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp index ddff6051c..9e69ce698 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp @@ -18,7 +18,6 @@ */ #include "config.h" - #include "TextureMapperGL.h" #include "GraphicsContext.h" @@ -31,6 +30,12 @@ #include <wtf/RefCounted.h> #if PLATFORM(QT) +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +#include <QPlatformPixmap> +#endif +#endif + +#if PLATFORM(QT) || USE(CAIRO) #include <cairo/OpenGLShims.h> #elif defined(TEXMAP_OPENGL_ES_2) #include <GLES2/gl2.h> @@ -51,7 +56,14 @@ #include <GL/glx.h> #endif -#if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT) +#if USE(CAIRO) +#include "CairoUtilities.h" +#include "RefPtrCairo.h" +#include <cairo.h> +#include <wtf/ByteArray.h> +#endif + +#if !defined(TEXMAP_OPENGL_ES_2) && !PLATFORM(QT) && !PLATFORM(GTK) extern "C" { void glUniform1f(GLint, GLfloat); void glUniform1i(GLint, GLint); @@ -265,57 +277,6 @@ struct TextureMapperGLData { }; - struct DirectlyCompositedImageRepository { - struct Entry { - GLuint texture; - int refCount; - }; - typedef HashMap<ImageUID, Entry> ImageTextureMap; - ImageTextureMap imageToTexture; - - GLuint findOrCreate(ImageUID image, bool& found) - { - ImageTextureMap::iterator it = imageToTexture.find(image); - found = false; - if (it != imageToTexture.end()) { - it->second.refCount++; - found = true; - return it->second.texture; - } - Entry entry; - GL_CMD(glGenTextures(1, &entry.texture)); - entry.refCount = 1; - imageToTexture.add(image, entry); - return entry.texture; - } - - bool deref(ImageUID image) - { - HashMap<ImageUID, Entry>::iterator it = imageToTexture.find(image); - if (it != imageToTexture.end()) { - if (it->second.refCount < 2) { - imageToTexture.remove(it); - return false; - } - } - return true; - } - - DirectlyCompositedImageRepository() - { - } - - ~DirectlyCompositedImageRepository() - { - for (ImageTextureMap::iterator it = imageToTexture.begin(); it != imageToTexture.end(); ++it) { - GLuint texture = it->second.texture; - if (texture) - GL_CMD(glDeleteTextures(1, &texture)); - } - - } - } directlyCompositedImages; - SharedGLData& sharedGLData() const { return *(m_sharedGLData.get()); @@ -332,6 +293,7 @@ struct TextureMapperGLData { int currentProgram; GLint previousProgram; GLint previousScissorState; + GLint viewport[4]; RefPtr<SharedGLData> m_sharedGLData; }; @@ -342,56 +304,25 @@ public: virtual bool isValid() const; virtual void reset(const IntSize&, bool opaque); void bind(); - virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect); - virtual void endPaint(); - virtual void setContentsToImage(Image*); ~BitmapTextureGL() { destroy(); } virtual uint32_t id() const { return m_id; } - inline bool isOpaque() const { return m_opaque; } inline FloatSize relativeSize() const { return m_relativeSize; } void setTextureMapper(TextureMapperGL* texmap) { m_textureMapper = texmap; } - - void updateContents(PixelFormat, const IntRect&, void*); - void updateRawContents(const IntRect&, const void*); - void pack() - { - // This is currently a stub. - if (isPacked()) - return; - m_isPacked = true; - } - - void unpack() - { - // This is currently a stub. - if (!isPacked()) - return; - m_isPacked = false; - } - - bool isPacked() const - { - return m_isPacked; - } + void updateContents(Image*, const IntRect&, const IntRect&, PixelFormat); + void updateContents(const void*, const IntRect&); private: GLuint m_id; - ImageUID m_imageUID; FloatSize m_relativeSize; - bool m_opaque; IntSize m_textureSize; - OwnPtr<BGRA32PremultimpliedBuffer> m_buffer; IntRect m_dirtyRect; GLuint m_fbo; GLuint m_rbo; IntSize m_actualSize; bool m_surfaceNeedsReset; - bool m_isPacked; TextureMapperGL* m_textureMapper; BitmapTextureGL() : m_id(0) - , m_imageUID(0) - , m_opaque(false) , m_fbo(0) , m_rbo(0) , m_surfaceNeedsReset(true) @@ -544,6 +475,7 @@ void TextureMapperGL::beginPainting() #endif glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); + glGetIntegerv(GL_VIEWPORT, data().viewport); bindSurface(0); } @@ -663,7 +595,6 @@ static void texImage2DResourceSafe(size_t width, size_t height) void BitmapTextureGL::reset(const IntSize& newSize, bool opaque) { BitmapTexture::reset(newSize, opaque); - m_imageUID = 0; IntSize newTextureSize = nextPowerOfTwo(newSize); bool justCreated = false; if (!m_id) { @@ -682,28 +613,10 @@ void BitmapTextureGL::reset(const IntSize& newSize, bool opaque) } m_actualSize = newSize; m_relativeSize = FloatSize(float(newSize.width()) / m_textureSize.width(), float(newSize.height()) / m_textureSize.height()); - m_opaque = opaque; m_surfaceNeedsReset = true; } -PlatformGraphicsContext* BitmapTextureGL::beginPaint(const IntRect& dirtyRect) -{ - m_buffer = BGRA32PremultimpliedBuffer::create(); - m_dirtyRect = dirtyRect; - return m_buffer->beginPaint(dirtyRect, m_opaque); -} - -void BitmapTextureGL::endPaint() -{ - if (!m_buffer) - return; - m_buffer->endPaint(); - updateContents(BGRAFormat, m_dirtyRect, m_buffer->data()); - GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) - m_buffer.clear(); -} - -#ifdef TEXMAP_OPENGL_ES_2 +#if PLATFORM(QT) || (USE(CAIRO) && defined(TEXMAP_OPENGL_ES_2)) static void swizzleBGRAToRGBA(uint32_t* data, const IntSize& size) { int width = size.width(); @@ -716,77 +629,62 @@ static void swizzleBGRAToRGBA(uint32_t* data, const IntSize& size) } #endif -void BitmapTextureGL::updateContents(PixelFormat pixelFormat, const IntRect& rect, void* bits) +void BitmapTextureGL::updateContents(const void* data, const IntRect& targetRect) { GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) -#ifdef TEXMAP_OPENGL_ES_2 - bool shouldSwizzle = false; -#endif - - GLint glFormat = GL_RGBA; - switch (pixelFormat) { - case RGBAFormat: - glFormat = GL_RGBA; - break; - case RGBFormat: - glFormat = GL_RGB; - break; - case BGRAFormat: -#ifdef TEXMAP_OPENGL_ES_2 - shouldSwizzle = true; - glFormat = GL_RGBA; -#else - glFormat = GL_BGRA; -#endif - break; - case BGRFormat: -#ifdef TEXMAP_OPENGL_ES_2 - shouldSwizzle = true; - glFormat = GL_RGB; -#else - glFormat = GL_BGR; -#endif - break; - } - -#ifdef TEXMAP_OPENGL_ES_2 - if (shouldSwizzle) - swizzleBGRAToRGBA(static_cast<uint32_t*>(bits), rect.size()); -#endif - GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), glFormat, GL_UNSIGNED_BYTE, bits)) + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), GL_RGBA, GL_UNSIGNED_BYTE, data)) } -void BitmapTextureGL::updateRawContents(const IntRect& rect, const void* bits) +void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, const IntRect& sourceRect, BitmapTexture::PixelFormat format) { + if (!image) + return; GL_CMD(glBindTexture(GL_TEXTURE_2D, m_id)) GLuint glFormat = isOpaque() ? GL_RGB : GL_RGBA; - GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), glFormat, GL_UNSIGNED_BYTE, bits)) -} - -void BitmapTextureGL::setContentsToImage(Image* image) -{ - ImageUID uid = image ? uidForImage(image) : 0; - if (!image || !uid) { - if (m_imageUID) - destroy(); + NativeImagePtr frameImage = image->nativeImageForCurrentFrame(); + if (!frameImage) return; - } - if (uid == m_imageUID) - return; - bool found = false; - GLuint newTextureID = m_textureMapper->data().directlyCompositedImages.findOrCreate(uid, found); - if (newTextureID != m_id) { - m_imageUID = uid; - destroy(); - m_id = newTextureID; - reset(image->size(), false); - if (!found) { - GraphicsContext context(beginPaint(IntRect(0, 0, m_textureSize.width(), m_textureSize.height()))); - context.drawImage(image, ColorSpaceDeviceRGB, IntPoint(0, 0), CompositeCopy); - endPaint(); - } - } +#if PLATFORM(QT) + QImage qtImage; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + // With QPA, we can avoid a deep copy. + qtImage = *frameImage->handle()->buffer(); +#else + // This might be a deep copy, depending on other references to the pixmap. + qtImage = frameImage->toImage(); +#endif + + if (IntSize(qtImage.size()) != sourceRect.size()) + qtImage = qtImage.copy(sourceRect); + if (format == BGRAFormat || format == BGRFormat) + swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(qtImage.bits()), qtImage.size()); + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(), glFormat, GL_UNSIGNED_BYTE, qtImage.constBits())) + +#elif USE(CAIRO) + +#if !CPU(BIG_ENDIAN) +#if defined(TEXMAP_OPENGL_ES_2) + swizzleBGRAToRGBA(reinterpret_cast<uint32_t*>(cairo_image_surface_get_data(frameImage)), + cairo_image_surface_get_stride(frameImage) * cairo_image_surface_get_height(frameImage)); +#else + glFormat = isOpaque() ? GL_BGR : GL_BGRA; +#endif +#endif + + glPixelStorei(GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride(frameImage) / 4); + glPixelStorei(GL_UNPACK_SKIP_ROWS, sourceRect.y()); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, sourceRect.x()); + GL_CMD(glTexSubImage2D(GL_TEXTURE_2D, 0, + targetRect.x(), targetRect.y(), + targetRect.width(), targetRect.height(), + glFormat, GL_UNSIGNED_BYTE, + cairo_image_surface_get_data(frameImage))); + glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); + glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); + glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); +#endif } static inline TransformationMatrix createProjectionMatrix(const IntSize& size, bool flip) @@ -837,7 +735,7 @@ void BitmapTextureGL::bind() void BitmapTextureGL::destroy() { - if (m_id && (!m_imageUID || !m_textureMapper->data().directlyCompositedImages.deref(m_imageUID))) + if (m_id) GL_CMD(glDeleteTextures(1, &m_id)) if (m_fbo) @@ -872,12 +770,13 @@ void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer) BitmapTextureGL* surface = static_cast<BitmapTextureGL*>(surfacePointer); if (!surface) { + IntSize viewportSize(data().viewport[2], data().viewport[3]); GL_CMD(glBindFramebuffer(GL_FRAMEBUFFER, 0)) - data().projectionMatrix = createProjectionMatrix(viewportSize(), true).multiply(transform()); + data().projectionMatrix = createProjectionMatrix(viewportSize, true); GL_CMD(glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1)) GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)) - GL_CMD(glViewport(0, 0, viewportSize().width(), viewportSize().height())) - data().sharedGLData().clipStack.append(IntRect(IntPoint::zero(), viewportSize())); + GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height())) + data().sharedGLData().clipStack.append(IntRect(data().viewport[0], data().viewport[1], data().viewport[2], data().viewport[3])); return; } @@ -985,4 +884,9 @@ PassRefPtr<BitmapTexture> TextureMapperGL::createTexture() return adoptRef(texture); } +PassOwnPtr<TextureMapper> TextureMapper::platformCreateAccelerated() +{ + return TextureMapperGL::create(); +} + }; diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h index 1b411857c..08fa0adef 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.h @@ -43,16 +43,17 @@ public: virtual void drawTexture(uint32_t texture, bool opaque, const FloatSize&, const FloatRect&, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture, bool flip); virtual void bindSurface(BitmapTexture* surface); virtual void beginClip(const TransformationMatrix&, const FloatRect&); + virtual void beginPainting(); + virtual void endPainting(); virtual void endClip(); - virtual bool allowSurfaceForRoot() const { return false; } virtual PassRefPtr<BitmapTexture> createTexture(); virtual const char* type() const; static PassOwnPtr<TextureMapperGL> create() { return adoptPtr(new TextureMapperGL); } - void beginPainting(); - void endPainting(); void setGraphicsContext(GraphicsContext* context) { m_context = context; } GraphicsContext* graphicsContext() { return m_context; } virtual bool isOpenGLBacked() const { return true; } + void platformUpdateContents(NativeImagePtr, const IntRect&, const IntRect&, BitmapTexture::PixelFormat); + virtual AccelerationMode accelerationMode() const { return OpenGLMode; } private: bool beginScissorClip(const TransformationMatrix&, const FloatRect&); @@ -64,16 +65,6 @@ private: }; // An offscreen buffer to be rendered by software. -class BGRA32PremultimpliedBuffer { - WTF_MAKE_FAST_ALLOCATED; -public: - virtual ~BGRA32PremultimpliedBuffer() { } - virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque) = 0; - virtual void endPaint() = 0; - virtual void* data() = 0; - static PassOwnPtr<BGRA32PremultimpliedBuffer> create(); -}; - static inline int nextPowerOfTwo(int num) { for (int i = 0x10000000; i > 0; i >>= 1) { diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp index 495bcadd3..66bc76e81 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp @@ -146,7 +146,7 @@ void GraphicsContext3DPrivate::paintToTextureMapper(TextureMapper* textureMapper { blitMultisampleFramebufferAndRestoreContext(); - if (textureMapper->isOpenGLBacked()) { + if (textureMapper->accelerationMode() == TextureMapper::OpenGLMode) { TextureMapperGL* texmapGL = static_cast<TextureMapperGL*>(textureMapper); texmapGL->drawTexture(m_context->m_texture, !m_context->m_attrs.alpha, FloatSize(1, 1), targetRect, matrix, opacity, mask, true /* flip */); return; diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index ec73c3feb..90079ee30 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -1335,6 +1335,32 @@ void GraphicsContext::setCTM(const AffineTransform& transform) m_data->p()->setWorldTransform(transform); } +#if ENABLE(3D_RENDERING) && USE(TEXTURE_MAPPER) +TransformationMatrix GraphicsContext::get3DTransform() const +{ + if (paintingDisabled()) + return TransformationMatrix(); + + return platformContext()->combinedTransform(); +} + +void GraphicsContext::concat3DTransform(const TransformationMatrix& transform) +{ + if (paintingDisabled()) + return; + + m_data->p()->setWorldTransform(transform, true); +} + +void GraphicsContext::set3DTransform(const TransformationMatrix& transform) +{ + if (paintingDisabled()) + return; + + m_data->p()->setWorldTransform(transform, false); +} +#endif + void GraphicsContext::setURLForRect(const KURL&, const IntRect&) { notImplemented(); diff --git a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp index e36ff85b1..15f89b7ae 100644 --- a/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp +++ b/Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp @@ -123,8 +123,10 @@ GraphicsContext* ImageBuffer::context() const PassRefPtr<Image> ImageBuffer::copyImage(BackingStoreCopy copyBehavior) const { - ASSERT(copyBehavior == CopyBackingStore); - return StillImage::create(m_data.m_pixmap); + if (copyBehavior == CopyBackingStore) + return StillImage::create(m_data.m_pixmap); + + return StillImage::createForRendering(&m_data.m_pixmap); } void ImageBuffer::draw(GraphicsContext* destContext, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, @@ -299,8 +301,7 @@ static inline unsigned int premultiplyABGRtoARGB(unsigned int x) return x; } -template <Multiply multiplied> -void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, ImageBufferData& data, const IntSize& size) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); @@ -308,24 +309,24 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& int originx = sourceRect.x(); int destx = destPoint.x() + sourceRect.x(); ASSERT(destx >= 0); - ASSERT(destx < size.width()); + ASSERT(destx < m_size.width()); ASSERT(originx >= 0); ASSERT(originx <= sourceRect.maxX()); int endx = destPoint.x() + sourceRect.maxX(); - ASSERT(endx <= size.width()); + ASSERT(endx <= m_size.width()); int numColumns = endx - destx; int originy = sourceRect.y(); int desty = destPoint.y() + sourceRect.y(); ASSERT(desty >= 0); - ASSERT(desty < size.height()); + ASSERT(desty < m_size.height()); ASSERT(originy >= 0); ASSERT(originy <= sourceRect.maxY()); int endy = destPoint.y() + sourceRect.maxY(); - ASSERT(endy <= size.height()); + ASSERT(endy <= m_size.height()); int numRows = endy - desty; unsigned srcBytesPerRow = 4 * sourceSize.width(); @@ -359,35 +360,25 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& } } - bool isPainting = data.m_painter->isActive(); + bool isPainting = m_data.m_painter->isActive(); if (!isPainting) - data.m_painter->begin(&data.m_pixmap); + m_data.m_painter->begin(&m_data.m_pixmap); else { - data.m_painter->save(); + m_data.m_painter->save(); // putImageData() should be unaffected by painter state - data.m_painter->resetTransform(); - data.m_painter->setOpacity(1.0); - data.m_painter->setClipping(false); + m_data.m_painter->resetTransform(); + m_data.m_painter->setOpacity(1.0); + m_data.m_painter->setClipping(false); } - data.m_painter->setCompositionMode(QPainter::CompositionMode_Source); - data.m_painter->drawImage(destx, desty, image); + m_data.m_painter->setCompositionMode(QPainter::CompositionMode_Source); + m_data.m_painter->drawImage(destx, desty, image); if (!isPainting) - data.m_painter->end(); + m_data.m_painter->end(); else - data.m_painter->restore(); -} - -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, m_data, m_size); -} - -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, m_data, m_size); + m_data.m_painter->restore(); } // We get a mimeType here but QImageWriter does not support mimetypes but diff --git a/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp b/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp deleted file mode 100644 index 44641ce63..000000000 --- a/Source/WebCore/platform/graphics/qt/TextureMapperQt.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* - Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "TextureMapperQt.h" - -#include <QtCore/qdebug.h> -#include <QtGui/qpaintengine.h> -#include <QtGui/qpixmap.h> - -#if USE(TEXTURE_MAPPER_GL) -# include "opengl/TextureMapperGL.h" -#endif - -namespace WebCore { - -void BitmapTextureQt::destroy() -{ - if (m_pixmap.paintingActive()) - qFatal("Destroying an active pixmap"); - m_pixmap = QPixmap(); -} - -void BitmapTextureQt::reset(const IntSize& size, bool isOpaque) -{ - BitmapTexture::reset(size, isOpaque); - - if (size.width() > m_pixmap.size().width() || size.height() > m_pixmap.size().height() || m_pixmap.isNull()) - m_pixmap = QPixmap(size.width(), size.height()); - if (!isOpaque) - m_pixmap.fill(Qt::transparent); -} - -PlatformGraphicsContext* BitmapTextureQt::beginPaint(const IntRect& dirtyRect) -{ - m_painter.begin(&m_pixmap); - TextureMapperQt::initialize(&m_painter); - m_painter.setCompositionMode(QPainter::CompositionMode_Clear); - m_painter.fillRect(QRect(dirtyRect), Qt::transparent); - m_painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - return &m_painter; -} - -void BitmapTextureQt::endPaint() -{ - m_painter.end(); -} - -void BitmapTextureQt::updateContents(PixelFormat pixelFormat, const IntRect& rect, void* bits) -{ - m_painter.begin(&m_pixmap); - QImage::Format qtFormat = QImage::Format_ARGB32_Premultiplied; - if (pixelFormat == BGRFormat || pixelFormat == RGBFormat) - qtFormat = QImage::Format_RGB32; - QImage image(static_cast<uchar*>(bits), rect.width(), rect.height(), qtFormat); - if (pixelFormat == BGRFormat || pixelFormat == BGRAFormat) - image = image.rgbSwapped(); - m_painter.setCompositionMode(QPainter::CompositionMode_Source); - m_painter.drawImage(rect, image); - m_painter.end(); -} - -bool BitmapTextureQt::save(const String& path) -{ - return m_pixmap.save(path, "PNG"); -} - -void BitmapTextureQt::setContentsToImage(Image* image) -{ - if (!image) - return; - const QPixmap* pixmap = image->nativeImageForCurrentFrame(); - if (!pixmap) - return; - BitmapTexture::reset(pixmap->size(), !pixmap->hasAlphaChannel()); - m_pixmap = *pixmap; -} - -void BitmapTextureQt::pack() -{ - if (m_pixmap.isNull()) - return; - - m_image = m_pixmap.toImage(); - m_pixmap = QPixmap(); - m_isPacked = true; -} - -void BitmapTextureQt::unpack() -{ - m_isPacked = false; - if (m_image.isNull()) - return; - - m_pixmap = QPixmap::fromImage(m_image); - m_image = QImage(); -} - -void TextureMapperQt::beginClip(const TransformationMatrix& matrix, const FloatRect& rect) -{ - QPainter* painter = currentPainter(); - painter->save(); - QTransform prevTransform = painter->transform(); - painter->setTransform(matrix, false); - painter->setClipRect(rect); - painter->setTransform(prevTransform, false); -} - -void TextureMapperQt::endClip() -{ - currentPainter()->restore(); -} - -IntSize TextureMapperQt::viewportSize() const -{ - return IntSize(m_painter->device()->width(), m_painter->device()->height()); -} - - -TextureMapperQt::TextureMapperQt() - : m_currentSurface(0) -{ -} - -void TextureMapperQt::setGraphicsContext(GraphicsContext* context) -{ - m_context = context; - m_painter = context ? context->platformContext() : 0; - initialize(m_painter); -} - -GraphicsContext* TextureMapperQt::graphicsContext() -{ - return m_context; -} - -void TextureMapperQt::bindSurface(BitmapTexture* surface) -{ - if (m_currentSurface == surface) - return; - if (m_currentSurface) - m_currentSurface->m_painter.end(); - if (!surface) { - m_currentSurface = 0; - return; - } - BitmapTextureQt* surfaceQt = static_cast<BitmapTextureQt*>(surface); - if (!surfaceQt->m_painter.isActive()) - surfaceQt->m_painter.begin(&surfaceQt->m_pixmap); - m_currentSurface = surfaceQt; -} - - -void TextureMapperQt::drawTexture(const BitmapTexture& texture, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity, const BitmapTexture* maskTexture) -{ - const BitmapTextureQt& textureQt = static_cast<const BitmapTextureQt&>(texture); - QPainter* painter = m_painter; - QPixmap pixmap = textureQt.m_pixmap; - if (m_currentSurface) - painter = &m_currentSurface->m_painter; - - if (maskTexture && maskTexture->isValid()) { - const BitmapTextureQt* mask = static_cast<const BitmapTextureQt*>(maskTexture); - QPixmap intermediatePixmap(pixmap.size()); - intermediatePixmap.fill(Qt::transparent); - QPainter maskPainter(&intermediatePixmap); - maskPainter.setCompositionMode(QPainter::CompositionMode_Source); - maskPainter.drawPixmap(0, 0, pixmap); - maskPainter.setCompositionMode(QPainter::CompositionMode_DestinationIn); - maskPainter.drawPixmap(QRect(0, 0, pixmap.width(), pixmap.height()), mask->m_pixmap, mask->sourceRect()); - maskPainter.end(); - pixmap = intermediatePixmap; - } - - const qreal prevOpacity = painter->opacity(); - const QTransform prevTransform = painter->transform(); - painter->setOpacity(opacity); - painter->setTransform(matrix, true); - painter->drawPixmap(targetRect, pixmap, FloatRect(textureQt.sourceRect())); - painter->setTransform(prevTransform); - painter->setOpacity(prevOpacity); -} - -PassOwnPtr<TextureMapper> TextureMapper::create(GraphicsContext* context) -{ -#if USE(TEXTURE_MAPPER_GL) - if (context && context->platformContext()->paintEngine()->type() == QPaintEngine::OpenGL2) - return adoptPtr(new TextureMapperGL); -#endif - return adoptPtr(new TextureMapperQt); -} - -PassRefPtr<BitmapTexture> TextureMapperQt::createTexture() -{ - return adoptRef(new BitmapTextureQt()); -} - -BitmapTextureQt::BitmapTextureQt() - : m_isPacked(false) -{ - -} - -void TextureMapperQt::beginPainting() -{ - m_painter->save(); -} - -void TextureMapperQt::endPainting() -{ - m_painter->restore(); -} - -#if USE(TEXTURE_MAPPER_GL) -class BGRA32PremultimpliedBufferQt : public BGRA32PremultimpliedBuffer { -public: - virtual PlatformGraphicsContext* beginPaint(const IntRect& rect, bool opaque) - { - // m_image is only using during paint, it's safe to override it. - m_image = QImage(rect.size().width(), rect.size().height(), opaque ? QImage::Format_RGB32 : QImage::Format_ARGB32_Premultiplied); - if (!opaque) - m_image.fill(0); - m_painter.begin(&m_image); - TextureMapperQt::initialize(&m_painter); - m_painter.translate(-rect.x(), -rect.y()); - return &m_painter; - } - - virtual void endPaint() { m_painter.end(); } - virtual void* data() { return m_image.bits(); } - -private: - QPainter m_painter; - QImage m_image; -}; - -PassOwnPtr<BGRA32PremultimpliedBuffer> BGRA32PremultimpliedBuffer::create() -{ - return adoptPtr(new BGRA32PremultimpliedBufferQt()); -} - -uint64_t uidForImage(Image* image) -{ - return image->nativeImageForCurrentFrame()->serialNumber(); -} -#endif -}; diff --git a/Source/WebCore/platform/graphics/qt/TextureMapperQt.h b/Source/WebCore/platform/graphics/qt/TextureMapperQt.h deleted file mode 100644 index 08fee03f1..000000000 --- a/Source/WebCore/platform/graphics/qt/TextureMapperQt.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. - */ - -#include "texmap/TextureMapper.h" - -#ifndef TextureMapperQt_h -#define TextureMapperQt_h - -namespace WebCore { - -class BitmapTextureQt : public BitmapTexture { - friend class TextureMapperQt; -public: - BitmapTextureQt(); - ~BitmapTextureQt() { destroy(); } - virtual void destroy(); - virtual IntSize size() const { return IntSize(m_pixmap.width(), m_pixmap.height()); } - virtual void reset(const IntSize&, bool opaque); - virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect); - virtual void endPaint(); - virtual void setContentsToImage(Image*); - virtual bool save(const String& path); - virtual bool isValid() const { return !m_pixmap.isNull() || !m_image.isNull(); } - IntRect sourceRect() const { return IntRect(0, 0, contentSize().width(), contentSize().height()); } - virtual void pack(); - virtual void unpack(); - virtual bool isPacked() const { return m_isPacked; } - virtual void updateContents(PixelFormat, const IntRect&, void* bits); - - QPainter* painter() { return &m_painter; } - -private: - QPainter m_painter; - QPixmap m_pixmap; - QImage m_image; - bool m_isPacked; -}; - -class TextureMapperQt : public TextureMapper { -public: - TextureMapperQt(); - - virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture); - virtual void bindSurface(BitmapTexture* surface); - virtual void beginClip(const TransformationMatrix&, const FloatRect&); - virtual void endClip(); - virtual void setGraphicsContext(GraphicsContext*); - virtual GraphicsContext* graphicsContext(); - virtual bool allowSurfaceForRoot() const { return false; } - virtual PassRefPtr<BitmapTexture> createTexture(); - virtual IntSize viewportSize() const; - virtual void beginPainting(); - virtual void endPainting(); - - static void initialize(QPainter* painter) - { - if (painter) - painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, false); - } - - static PassOwnPtr<TextureMapper> create() { return adoptPtr(new TextureMapperQt); } -private: - inline QPainter* currentPainter() { return m_currentSurface ? m_currentSurface->painter() : m_painter; } - - QPainter* m_painter; - GraphicsContext* m_context; - RefPtr<BitmapTextureQt> m_currentSurface; -}; - -} -#endif diff --git a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp index 355a6b5ef..4f79cfb0b 100644 --- a/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp @@ -721,6 +721,11 @@ void GraphicsContext::drawLineForTextChecking(const FloatPoint& pt, float width, SkScalar originX = WebCoreFloatToSkScalar(pt.x()); #if PLATFORM(CHROMIUM) && OS(DARWIN) SkScalar originY = WebCoreFloatToSkScalar(pt.y()); + // Make sure to draw only complete dots. + int rowPixels = misspellBitmap->width(); + float widthMod = fmodf(width, rowPixels); + if (rowPixels - widthMod > 1) + width -= widthMod; #else // Offset it vertically by 1 so that there's some space under the text. SkScalar originY = WebCoreFloatToSkScalar(pt.y()) + 1; diff --git a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp index eaa1d77b4..e0b52a318 100644 --- a/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp @@ -79,11 +79,6 @@ public: m_context3D->makeContextCurrent(); } - virtual void flush() - { - m_context3D->flush(); - } - private: GraphicsContext3D* m_context3D; }; @@ -280,34 +275,33 @@ PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect return getImageData<Premultiplied>(rect, context()->platformContext()->canvas(), m_size); } -template <Multiply multiplied> -void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, - SkCanvas* canvas, const IntSize& size) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { + SkCanvas* canvas = context()->platformContext()->canvas(); ASSERT(sourceRect.width() > 0); ASSERT(sourceRect.height() > 0); int originX = sourceRect.x(); int destX = destPoint.x() + sourceRect.x(); ASSERT(destX >= 0); - ASSERT(destX < size.width()); + ASSERT(destX < m_size.width()); ASSERT(originX >= 0); ASSERT(originX < sourceRect.maxX()); int endX = destPoint.x() + sourceRect.maxX(); - ASSERT(endX <= size.width()); + ASSERT(endX <= m_size.width()); int numColumns = endX - destX; int originY = sourceRect.y(); int destY = destPoint.y() + sourceRect.y(); ASSERT(destY >= 0); - ASSERT(destY < size.height()); + ASSERT(destY < m_size.height()); ASSERT(originY >= 0); ASSERT(originY < sourceRect.maxY()); int endY = destPoint.y() + sourceRect.maxY(); - ASSERT(endY <= size.height()); + ASSERT(endY <= m_size.height()); int numRows = endY - destY; unsigned srcBytesPerRow = 4 * sourceSize.width(); @@ -324,16 +318,6 @@ void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& canvas->writePixels(srcBitmap, destX, destY, config8888); } -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); -} - -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); -} - template <typename T> static bool encodeImage(T& source, const String& mimeType, const double* quality, Vector<char>* output) { diff --git a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp index 64a4ee4f3..30b8a3805 100644 --- a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp @@ -34,6 +34,8 @@ #include "PlatformContextSkia.h" +#include "SkCanvas.h" +#include "SkColorFilter.h" #include "SkShader.h" namespace WebCore { @@ -133,10 +135,19 @@ static inline bool paintIsOpaque(const SkPaint& paint, const SkBitmap* bitmap = return false; if (bitmap && !bitmap->isOpaque()) return false; + if (paint.getLooper()) + return false; + if (paint.getImageFilter()) + return false; + if (paint.getMaskFilter()) + return false; + SkColorFilter* colorFilter = paint.getColorFilter(); + if (colorFilter && !(colorFilter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag)) + return false; return true; } -void OpaqueRegionSkia::didDrawRect(const PlatformContextSkia* context, const SkRect& fillRect, const SkPaint& paint, const SkBitmap* bitmap) +void OpaqueRegionSkia::didDrawRect(const PlatformContextSkia* context, const AffineTransform& transform, const SkRect& fillRect, const SkPaint& paint, const SkBitmap* bitmap) { // Any stroking may put alpha in pixels even if the filling part does not. if (paint.getStyle() != SkPaint::kFill_Style) { @@ -148,21 +159,21 @@ void OpaqueRegionSkia::didDrawRect(const PlatformContextSkia* context, const SkR else { SkRect strokeRect; strokeRect = paint.computeFastBounds(fillRect, &strokeRect); - didDraw(context, strokeRect, paint, opaque, fillsBounds); + didDraw(context, transform, strokeRect, paint, opaque, fillsBounds); } } bool checkFillOnly = true; bool opaque = paintIsOpaque(paint, bitmap, checkFillOnly); bool fillsBounds = paint.getStyle() != SkPaint::kStroke_Style; - didDraw(context, fillRect, paint, opaque, fillsBounds); + didDraw(context, transform, fillRect, paint, opaque, fillsBounds); } -void OpaqueRegionSkia::didDrawPath(const PlatformContextSkia* context, const SkPath& path, const SkPaint& paint) +void OpaqueRegionSkia::didDrawPath(const PlatformContextSkia* context, const AffineTransform& transform, const SkPath& path, const SkPaint& paint) { SkRect rect; if (path.isRect(&rect)) { - didDrawRect(context, rect, paint, 0); + didDrawRect(context, transform, rect, paint, 0); return; } @@ -173,11 +184,11 @@ void OpaqueRegionSkia::didDrawPath(const PlatformContextSkia* context, const SkP didDrawUnbounded(paint, opaque); else { rect = paint.computeFastBounds(path.getBounds(), &rect); - didDraw(context, rect, paint, opaque, fillsBounds); + didDraw(context, transform, rect, paint, opaque, fillsBounds); } } -void OpaqueRegionSkia::didDrawPoints(const PlatformContextSkia* context, SkCanvas::PointMode mode, int numPoints, const SkPoint points[], const SkPaint& paint) +void OpaqueRegionSkia::didDrawPoints(const PlatformContextSkia* context, const AffineTransform& transform, SkCanvas::PointMode mode, int numPoints, const SkPoint points[], const SkPaint& paint) { if (!numPoints) return; @@ -202,11 +213,11 @@ void OpaqueRegionSkia::didDrawPoints(const PlatformContextSkia* context, SkCanva didDrawUnbounded(paint, opaque); else { rect = paint.computeFastBounds(rect, &rect); - didDraw(context, rect, paint, opaque, fillsBounds); + didDraw(context, transform, rect, paint, opaque, fillsBounds); } } -void OpaqueRegionSkia::didDrawBounded(const PlatformContextSkia* context, const SkRect& bounds, const SkPaint& paint) +void OpaqueRegionSkia::didDrawBounded(const PlatformContextSkia* context, const AffineTransform& transform, const SkRect& bounds, const SkPaint& paint) { bool opaque = paintIsOpaque(paint); bool fillsBounds = false; @@ -216,16 +227,38 @@ void OpaqueRegionSkia::didDrawBounded(const PlatformContextSkia* context, const else { SkRect rect; rect = paint.computeFastBounds(bounds, &rect); - didDraw(context, rect, paint, opaque, fillsBounds); + didDraw(context, transform, rect, paint, opaque, fillsBounds); } } -void OpaqueRegionSkia::didDraw(const PlatformContextSkia* context, const SkRect& rect, const SkPaint& paint, bool drawsOpaque, bool fillsBounds) +void OpaqueRegionSkia::didDraw(const PlatformContextSkia* context, const AffineTransform& transform, const SkRect& rect, const SkPaint& paint, bool drawsOpaque, bool fillsBounds) { + SkRect targetRect = rect; + + // Apply the current clip. + if (context->canvas()->getClipType() != SkCanvas::kRect_ClipType) + fillsBounds = false; + else { + SkIRect deviceClip; + context->canvas()->getClipDeviceBounds(&deviceClip); + if (!targetRect.intersect(SkIntToScalar(deviceClip.fLeft), SkIntToScalar(deviceClip.fTop), SkIntToScalar(deviceClip.fRight), SkIntToScalar(deviceClip.fBottom))) + return; + } + if (!context->clippedToImage().isOpaque()) + fillsBounds = false; + + // Apply the transforms. + SkMatrix canvasTransform = context->canvas()->getTotalMatrix(); + if (!canvasTransform.mapRect(&targetRect)) + fillsBounds = false; + SkMatrix canvasToTargetTransform = transform; + if (!canvasToTargetTransform.mapRect(&targetRect)) + fillsBounds = false; + if (fillsBounds && xfermodeIsOpaque(paint, drawsOpaque)) - markRectAsOpaque(context, rect); - else if (SkRect::Intersects(rect, m_opaqueRect) && !xfermodePreservesOpaque(paint, drawsOpaque)) - markRectAsNonOpaque(rect); + markRectAsOpaque(targetRect); + else if (SkRect::Intersects(targetRect, m_opaqueRect) && !xfermodePreservesOpaque(paint, drawsOpaque)) + markRectAsNonOpaque(targetRect); } void OpaqueRegionSkia::didDrawUnbounded(const SkPaint& paint, bool drawsOpaque) @@ -236,7 +269,7 @@ void OpaqueRegionSkia::didDrawUnbounded(const SkPaint& paint, bool drawsOpaque) } } -void OpaqueRegionSkia::markRectAsOpaque(const PlatformContextSkia* context, const SkRect& rect) +void OpaqueRegionSkia::markRectAsOpaque(const SkRect& rect) { // We want to keep track of an opaque region but bound its complexity at a constant size. // We keep track of the largest rectangle seen by area. If we can add the new rect to this @@ -245,8 +278,6 @@ void OpaqueRegionSkia::markRectAsOpaque(const PlatformContextSkia* context, cons if (rect.isEmpty()) return; - if (!context->clippedToImage().isOpaque()) - return; if (m_opaqueRect.contains(rect)) return; if (rect.contains(m_opaqueRect)) { diff --git a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h index 93f2c5a1b..45b069004 100644 --- a/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h +++ b/Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.h @@ -40,6 +40,7 @@ #include "SkRect.h" namespace WebCore { +class AffineTransform; class PlatformContextSkia; // This class is an encapsulation of functionality for PlatformContextSkia, and its methods are mirrored @@ -52,15 +53,15 @@ public: // The resulting opaque region as a single rect. IntRect asRect() const; - void didDrawRect(const PlatformContextSkia*, const SkRect&, const SkPaint&, const SkBitmap*); - void didDrawPath(const PlatformContextSkia*, const SkPath&, const SkPaint&); - void didDrawPoints(const PlatformContextSkia*, SkCanvas::PointMode, int numPoints, const SkPoint[], const SkPaint&); - void didDrawBounded(const PlatformContextSkia*, const SkRect&, const SkPaint&); + void didDrawRect(const PlatformContextSkia*, const AffineTransform&, const SkRect&, const SkPaint&, const SkBitmap*); + void didDrawPath(const PlatformContextSkia*, const AffineTransform&, const SkPath&, const SkPaint&); + void didDrawPoints(const PlatformContextSkia*, const AffineTransform&, SkCanvas::PointMode, int numPoints, const SkPoint[], const SkPaint&); + void didDrawBounded(const PlatformContextSkia*, const AffineTransform&, const SkRect&, const SkPaint&); private: - void didDraw(const PlatformContextSkia*, const SkRect&, const SkPaint&, bool drawsOpaque, bool fillsBounds); + void didDraw(const PlatformContextSkia*, const AffineTransform&, const SkRect&, const SkPaint&, bool drawsOpaque, bool fillsBounds); void didDrawUnbounded(const SkPaint&, bool drawsOpaque); - void markRectAsOpaque(const PlatformContextSkia*, const SkRect&); + void markRectAsOpaque(const SkRect&); void markRectAsNonOpaque(const SkRect&); SkRect m_opaqueRect; diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp index 034c3319e..c323a0d7e 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp @@ -32,7 +32,6 @@ #include "PlatformContextSkia.h" -#include "AffineTransform.h" #include "Extensions3D.h" #include "GraphicsContext.h" #include "GraphicsContext3D.h" @@ -50,9 +49,6 @@ #include "SkDashPathEffect.h" #include "SkShader.h" -#include "GrContext.h" -#include "SkGpuDevice.h" - #include <wtf/MathExtras.h> #include <wtf/Vector.h> @@ -612,25 +608,25 @@ void PlatformContextSkia::setGraphicsContext3D(GraphicsContext3D* context) void PlatformContextSkia::didDrawRect(const SkRect& rect, const SkPaint& paint, const SkBitmap* bitmap) { if (m_trackOpaqueRegion) - m_opaqueRegion.didDrawRect(this, rect, paint, bitmap); + m_opaqueRegion.didDrawRect(this, m_opaqueRegionTransform, rect, paint, bitmap); } void PlatformContextSkia::didDrawPath(const SkPath& path, const SkPaint& paint) { if (m_trackOpaqueRegion) - m_opaqueRegion.didDrawPath(this, path, paint); + m_opaqueRegion.didDrawPath(this, m_opaqueRegionTransform, path, paint); } void PlatformContextSkia::didDrawPoints(SkCanvas::PointMode mode, int numPoints, const SkPoint points[], const SkPaint& paint) { if (m_trackOpaqueRegion) - m_opaqueRegion.didDrawPoints(this, mode, numPoints, points, paint); + m_opaqueRegion.didDrawPoints(this, m_opaqueRegionTransform, mode, numPoints, points, paint); } void PlatformContextSkia::didDrawBounded(const SkRect& rect, const SkPaint& paint) { if (m_trackOpaqueRegion) - m_opaqueRegion.didDrawBounded(this, rect, paint); + m_opaqueRegion.didDrawBounded(this, m_opaqueRegionTransform, rect, paint); } } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h index fe3abb6f5..b306450cb 100644 --- a/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h +++ b/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h @@ -31,6 +31,7 @@ #ifndef PlatformContextSkia_h #define PlatformContextSkia_h +#include "AffineTransform.h" #include "GraphicsContext.h" #include "Noncopyable.h" #include "OpaqueRegionSkia.h" @@ -152,6 +153,7 @@ public: // Returns the canvas used for painting, NOT guaranteed to be non-null. SkCanvas* canvas() { return m_canvas; } + const SkCanvas* canvas() const { return m_canvas; } InterpolationQuality interpolationQuality() const; void setInterpolationQuality(InterpolationQuality interpolationQuality); @@ -191,6 +193,8 @@ public: void setDeferred(bool deferred) { m_deferred = deferred; } void setTrackOpaqueRegion(bool track) { m_trackOpaqueRegion = track; } + // A transform applied to all tracked opaque paints. This is applied at the time the painting is done. + void setOpaqueRegionTransform(const AffineTransform& transform) { m_opaqueRegionTransform = transform; } // This will be an empty region unless tracking is enabled. const OpaqueRegionSkia& opaqueRegion() const { return m_opaqueRegion; } @@ -228,6 +232,7 @@ private: // Tracks the region painted opaque via the GraphicsContext. OpaqueRegionSkia m_opaqueRegion; bool m_trackOpaqueRegion; + AffineTransform m_opaqueRegionTransform; // Stores image sizes for a hint to compute image resampling modes. // Values are used in ImageSkia.cpp diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp index dd33f0d2a..5e528d46b 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.cpp @@ -20,6 +20,8 @@ #include "config.h" #include "TextureMapper.h" +#include "TextureMapperImageBuffer.h" + #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) namespace WebCore { @@ -71,5 +73,13 @@ PassRefPtr<BitmapTexture> TextureMapper::acquireTextureFromPool(const IntSize& s return selectedTexture; } + +PassOwnPtr<TextureMapper> TextureMapper::create(AccelerationMode mode) +{ + if (mode == SoftwareMode) + return TextureMapperImageBuffer::create(); + return platformCreateAccelerated(); +} + } #endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapper.h b/Source/WebCore/platform/graphics/texmap/TextureMapper.h index d66fe2fb4..f25ce0bc1 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapper.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapper.h @@ -47,46 +47,31 @@ class TextureMapper; class BitmapTexture : public RefCounted<BitmapTexture> { public: enum PixelFormat { BGRAFormat, RGBAFormat, BGRFormat, RGBFormat }; - BitmapTexture() : m_lockCount(0) {} + BitmapTexture() + : m_isOpaque(true) + { + } + virtual ~BitmapTexture() { } virtual void destroy() { } - virtual bool allowOfflineTextureUpload() const { return false; } virtual IntSize size() const = 0; - virtual int bpp() const { return 32; } + virtual void updateContents(Image*, const IntRect&, const IntRect&, BitmapTexture::PixelFormat) = 0; + virtual void updateContents(const void*, const IntRect&) = 0; virtual bool isValid() const = 0; + + virtual int bpp() const { return 32; } virtual void reset(const IntSize& size, bool opaque = false) { m_isOpaque = opaque; m_contentSize = size; } - virtual void pack() { } - virtual void unpack() { } - virtual bool isPacked() const { return false; } - - virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect) = 0; - virtual void endPaint() = 0; - - // For performance reasons, BitmapTexture might modify the bits directly (swizzle). - // Thus, this method is only recommended for buffer update, such as used by WebKit2. - virtual void updateContents(PixelFormat, const IntRect&, void* bits) = 0; - virtual void updateRawContents(const IntRect&, const void* bits) { } - virtual PlatformGraphicsContext* beginPaintMedia() - { - return beginPaint(IntRect(0, 0, size().width(), size().height())); - } - virtual void setContentsToImage(Image*) = 0; - virtual bool save(const String&) { return false; } - - inline void lock() { ++m_lockCount; } - inline void unlock() { --m_lockCount; } - inline bool isLocked() { return m_lockCount; } inline IntSize contentSize() const { return m_contentSize; } inline int numberOfBytes() const { return size().width() * size().height() * bpp() >> 3; } + inline bool isOpaque() const { return m_isOpaque; } protected: - int m_lockCount; IntSize m_contentSize; bool m_isOpaque; }; @@ -97,32 +82,26 @@ class TextureMapper { friend class BitmapTexture; public: - static PassOwnPtr<TextureMapper> create(GraphicsContext* graphicsContext = 0); + enum AccelerationMode { SoftwareMode, OpenGLMode }; + static PassOwnPtr<TextureMapper> create(AccelerationMode newMode = SoftwareMode); virtual ~TextureMapper() { } virtual void drawTexture(const BitmapTexture&, const FloatRect& target, const TransformationMatrix& modelViewMatrix = TransformationMatrix(), float opacity = 1.0f, const BitmapTexture* maskTexture = 0) = 0; // makes a surface the target for the following drawTexture calls. virtual void bindSurface(BitmapTexture* surface) = 0; - virtual void setGraphicsContext(GraphicsContext*) = 0; - virtual GraphicsContext* graphicsContext() = 0; + virtual void setGraphicsContext(GraphicsContext* context) { m_context = context; } + virtual GraphicsContext* graphicsContext() { return m_context; } virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0; virtual void endClip() = 0; - virtual bool allowSurfaceForRoot() const = 0; virtual PassRefPtr<BitmapTexture> createTexture() = 0; - IntSize viewportSize() const { return m_viewportSize; } - void setViewportSize(const IntSize& s) { m_viewportSize = s; } void setImageInterpolationQuality(InterpolationQuality quality) { m_interpolationQuality = quality; } void setTextDrawingMode(TextDrawingModeFlags mode) { m_textDrawingMode = mode; } InterpolationQuality imageInterpolationQuality() const { return m_interpolationQuality; } TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; } - virtual bool allowPartialUpdates() const { return false; } - virtual bool isOpenGLBacked() const { return false; } - - void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; } - TransformationMatrix transform() const { return m_transform; } + virtual AccelerationMode accelerationMode() const = 0; virtual void beginPainting() { } virtual void endPainting() { } @@ -130,7 +109,6 @@ public: // A surface is released implicitly when dereferenced. virtual PassRefPtr<BitmapTexture> acquireTextureFromPool(const IntSize&); - protected: TextureMapper() : m_interpolationQuality(InterpolationDefault) @@ -138,14 +116,21 @@ protected: {} private: +#if USE(TEXTURE_MAPPER_GL) + static PassOwnPtr<TextureMapper> platformCreateAccelerated(); +#else + static PassOwnPtr<TextureMapper> platformCreateAccelerated() + { + return PassOwnPtr<TextureMapper>(); + } +#endif InterpolationQuality m_interpolationQuality; TextDrawingModeFlags m_textDrawingMode; - TransformationMatrix m_transform; - IntSize m_viewportSize; Vector<RefPtr<BitmapTexture> > m_texturePool; + GraphicsContext* m_context; }; -}; +} #endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp index 09714d909..6be518a8b 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp @@ -26,7 +26,17 @@ #if USE(TEXTURE_MAPPER) namespace WebCore { -static double normalizedAnimationValue(double runningTime, double duration, bool alternate) + +static bool shouldReverseAnimationValue(Animation::AnimationDirection direction, int loopCount) +{ + if (((direction == Animation::AnimationDirectionAlternate) && (loopCount & 1)) + || ((direction == Animation::AnimationDirectionAlternateReverse) && !(loopCount & 1)) + || direction == Animation::AnimationDirectionReverse) + return true; + return false; +} + +static double normalizedAnimationValue(double runningTime, double duration, Animation::AnimationDirection direction) { if (!duration) return 0; @@ -35,7 +45,8 @@ static double normalizedAnimationValue(double runningTime, double duration, bool const double lastFullLoop = duration * double(loopCount); const double remainder = runningTime - lastFullLoop; const double normalized = remainder / duration; - return (loopCount % 2 && alternate) ? (1 - normalized) : normalized; + + return shouldReverseAnimationValue(direction, loopCount) ? 1 - normalized : normalized; } static float applyOpacityAnimation(float fromOpacity, float toOpacity, double progress) diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp new file mode 100644 index 000000000..783b03bf7 --- /dev/null +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp @@ -0,0 +1,105 @@ +/* + Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "TextureMapperImageBuffer.h" + +#if USE(TEXTURE_MAPPER) +namespace WebCore { + +void BitmapTextureImageBuffer::updateContents(const void* data, const IntRect& targetRect) +{ +#if PLATFORM(QT) + QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), targetRect.width() * 4, QImage::Format_ARGB32_Premultiplied); + QPainter* painter = m_image->context()->platformContext(); + painter->save(); + painter->setCompositionMode(QPainter::CompositionMode_Source); + painter->drawImage(targetRect, image); + painter->restore(); +#endif +} + +void BitmapTextureImageBuffer::updateContents(Image* image, const IntRect& targetRect, const IntRect& sourceRect, PixelFormat) +{ + m_image->context()->drawImage(image, ColorSpaceDeviceRGB, targetRect, sourceRect, CompositeCopy); +} + +void TextureMapperImageBuffer::beginClip(const TransformationMatrix& matrix, const FloatRect& rect) +{ + GraphicsContext* context = currentContext(); + if (!context) + return; +#if ENABLE(3D_RENDERING) + TransformationMatrix previousTransform = context->get3DTransform(); +#else + AffineTransform previousTransform = context->getCTM(); +#endif + context->save(); + +#if ENABLE(3D_RENDERING) + context->concat3DTransform(matrix); +#else + context->concatCTM(matrix.toAffineTransform()); +#endif + + context->clip(rect); + +#if ENABLE(3D_RENDERING) + context->set3DTransform(previousTransform); +#else + context->setCTM(previousTransform); +#endif +} + +void TextureMapperImageBuffer::drawTexture(const BitmapTexture& texture, const FloatRect& targetRect, const TransformationMatrix& matrix, float opacity, const BitmapTexture* maskTexture) +{ + GraphicsContext* context = currentContext(); + if (!context) + return; + + const BitmapTextureImageBuffer& textureImageBuffer = static_cast<const BitmapTextureImageBuffer&>(texture); + ImageBuffer* image = textureImageBuffer.m_image.get(); + OwnPtr<ImageBuffer> maskedImage; + + if (maskTexture && maskTexture->isValid()) { + const BitmapTextureImageBuffer* mask = static_cast<const BitmapTextureImageBuffer*>(maskTexture); + maskedImage = ImageBuffer::create(maskTexture->contentSize()); + GraphicsContext* maskContext = maskedImage->context(); + maskContext->drawImageBuffer(image, ColorSpaceDeviceRGB, IntPoint::zero(), CompositeCopy); + if (opacity < 1) { + maskContext->setAlpha(opacity); + opacity = 1; + } + maskContext->drawImageBuffer(mask->m_image.get(), ColorSpaceDeviceRGB, IntPoint::zero(), CompositeDestinationIn); + image = maskedImage.get(); + } + + context->save(); + context->setAlpha(opacity); +#if ENABLE(3D_RENDERING) + context->concat3DTransform(matrix); +#else + context->concatCTM(matrix.toAffineTransform()); +#endif + context->drawImageBuffer(image, ColorSpaceDeviceRGB, targetRect); + context->restore(); +} + +} +#endif diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h new file mode 100644 index 000000000..8411206cf --- /dev/null +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h @@ -0,0 +1,74 @@ +/* + Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + */ + +#ifndef TextureMapperImageBuffer_h +#define TextureMapperImageBuffer_h + +#include "ImageBuffer.h" +#include "TextureMapper.h" + +#if USE(TEXTURE_MAPPER) +namespace WebCore { + +class BitmapTextureImageBuffer : public BitmapTexture { + friend class TextureMapperImageBuffer; +public: + static PassRefPtr<BitmapTexture> create() { return adoptRef(new BitmapTextureImageBuffer); } + ~BitmapTextureImageBuffer() { destroy(); } + virtual void destroy() { m_image.clear(); } + virtual IntSize size() const { return m_image->size(); } + virtual void reset(const IntSize& size, bool opaque) + { + BitmapTexture::reset(size, opaque); + m_image = ImageBuffer::create(size); + } + + virtual bool isValid() const { return m_image; } + inline GraphicsContext* graphicsContext() { return m_image ? m_image->context() : 0; } + virtual void updateContents(Image*, const IntRect&, const IntRect&, PixelFormat); + void updateContents(const void* data, const IntRect& targetRect); +private: + BitmapTextureImageBuffer() { } + OwnPtr<ImageBuffer> m_image; +}; + + +class TextureMapperImageBuffer : public TextureMapper { +public: + virtual void drawTexture(const BitmapTexture&, const FloatRect& targetRect, const TransformationMatrix&, float opacity, const BitmapTexture* maskTexture); + virtual void beginClip(const TransformationMatrix&, const FloatRect&); + virtual void bindSurface(BitmapTexture* surface) { m_currentSurface = surface;} + virtual void endClip() { graphicsContext()->restore(); } + static PassOwnPtr<TextureMapper> create() { return adoptPtr(new TextureMapperImageBuffer); } + PassRefPtr<BitmapTexture> createTexture() { return BitmapTextureImageBuffer::create(); } + inline GraphicsContext* currentContext() + { + return m_currentSurface ? static_cast<BitmapTextureImageBuffer*>(m_currentSurface.get())->graphicsContext() : graphicsContext(); + } + + virtual AccelerationMode accelerationMode() const { return SoftwareMode; } + +private: + RefPtr<BitmapTexture> m_currentSurface; +}; + +} +#endif // USE(TEXTURE_MAPPER) + +#endif // TextureMapperImageBuffer_h diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp index ccf49bc98..45b94bd91 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.cpp @@ -23,6 +23,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "GraphicsLayerTextureMapper.h" +#include "ImageBuffer.h" #include "MathExtras.h" namespace { @@ -156,12 +157,10 @@ void TextureMapperNode::renderContent(TextureMapper* textureMapper, GraphicsLaye if (!textureMapper) return; - // FIXME: Add directly composited images. - FloatRect dirtyRect = m_currentContent.needsDisplay ? entireRect() : m_currentContent.needsDisplayRect; + IntRect dirtyRect = enclosingIntRect(m_currentContent.needsDisplay ? entireRect() : m_currentContent.needsDisplayRect); for (size_t tileIndex = 0; tileIndex < m_ownedTiles.size(); ++tileIndex) { OwnedTile& tile = m_ownedTiles[tileIndex]; - FloatRect rect = dirtyRect; if (!tile.texture) tile.texture = textureMapper->createTexture(); RefPtr<BitmapTexture>& texture = tile.texture; @@ -169,31 +168,48 @@ void TextureMapperNode::renderContent(TextureMapper* textureMapper, GraphicsLaye if (tile.needsReset || texture->contentSize() != tileSize || !texture->isValid()) { tile.needsReset = false; - texture->reset(tileSize, m_currentContent.contentType == DirectImageContentType ? false : m_state.contentsOpaque); - rect = tile.rect; + texture->reset(tileSize, m_state.contentsOpaque); + dirtyRect.unite(enclosingIntRect(tile.rect)); } + } + + if (dirtyRect.isEmpty()) + return; + + // Paint the entire dirty rect into an image buffer. This ensures we only paint once. + OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(dirtyRect.size()); + GraphicsContext* context = imageBuffer->context(); + context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); + context->setTextDrawingMode(textureMapper->textDrawingMode()); + context->translate(-dirtyRect.x(), -dirtyRect.y()); + layer->paintGraphicsLayerContents(*context, dirtyRect); + if (m_currentContent.contentType == DirectImageContentType) + context->drawImage(m_currentContent.image.get(), ColorSpaceDeviceRGB, m_state.contentsRect); + + RefPtr<Image> image; + +#if PLATFORM(QT) + image = imageBuffer->copyImage(DontCopyBackingStore); +#else + // FIXME: support DontCopyBackingStore in non-Qt ports that use TextureMapper. + image = imageBuffer->copyImage(CopyBackingStore); +#endif - IntRect contentRect = enclosingIntRect(tile.rect); - contentRect.intersect(enclosingIntRect(rect)); - if (contentRect.isEmpty()) + // Divide the image to tiles. + for (size_t tileIndex = 0; tileIndex < m_ownedTiles.size(); ++tileIndex) { + OwnedTile& tile = m_ownedTiles[tileIndex]; + IntRect targetRect = enclosingIntRect(tile.rect); + targetRect.intersect(dirtyRect); + if (targetRect.isEmpty()) continue; + IntRect sourceRect = targetRect; - FloatRect contentRectInTileCoordinates = contentRect; - FloatPoint offset(-tile.rect.x(), -tile.rect.y()); - contentRectInTileCoordinates.move(offset.x(), offset.y()); - - { - GraphicsContext context(texture->beginPaint(enclosingIntRect(contentRectInTileCoordinates))); - context.setImageInterpolationQuality(textureMapper->imageInterpolationQuality()); - context.setTextDrawingMode(textureMapper->textDrawingMode()); - context.translate(offset.x(), offset.y()); - FloatRect scaledContentRect(contentRect); - if (m_currentContent.contentType == DirectImageContentType) - context.drawImage(m_currentContent.image.get(), ColorSpaceDeviceRGB, IntPoint(0, 0)); - else - layer->paintGraphicsLayerContents(context, enclosingIntRect(scaledContentRect)); - texture->endPaint(); - } + // Normalize sourceRect to the buffer's coordinates. + sourceRect.move(-dirtyRect.x(), -dirtyRect.y()); + + // Normalize targetRect to the texture's coordinqates. + targetRect.move(-tile.rect.x(), -tile.rect.y()); + tile.texture->updateContents(image.get(), targetRect, sourceRect, BitmapTexture::RGBAFormat); } m_currentContent.needsDisplay = false; @@ -481,7 +497,7 @@ void TextureMapperNode::clearAllDirectlyCompositedImageTiles() } } -void TextureMapperNode::setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* bits) +void TextureMapperNode::setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* data) { ASSERT(m_textureMapper); @@ -498,7 +514,7 @@ void TextureMapperNode::setContentsTileBackBuffer(int id, const IntRect& sourceR if (!tile.backBuffer.texture) tile.backBuffer.texture = m_textureMapper->createTexture(); tile.backBuffer.texture->reset(sourceRect.size(), false); - tile.backBuffer.texture->updateRawContents(sourceRect, bits); + tile.backBuffer.texture->updateContents(data, sourceRect); tile.isBackBufferUpdated = true; } diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h index fe4b14c73..230c9e0e0 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperNode.h @@ -148,7 +148,7 @@ public: void setTileOwnership(TileOwnership ownership) { m_state.tileOwnership = ownership; } int createContentsTile(float scale); void removeContentsTile(int id); - void setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void* bits); + void setContentsTileBackBuffer(int id, const IntRect& sourceRect, const IntRect& targetRect, const void*); void setTileBackBufferTextureForDirectlyCompositedImage(int id, const IntRect& sourceRect, const FloatRect& targetRect, BitmapTexture*); void clearAllDirectlyCompositedImageTiles(); void purgeNodeTexturesRecursive(); diff --git a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp index 39ef15503..0d4e0ba60 100644 --- a/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp +++ b/Source/WebCore/platform/graphics/wince/ImageBufferWinCE.cpp @@ -183,9 +183,9 @@ PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect return getImageData<true>(rect, m_data.m_bitmap.get()); } -template <bool premultiplied> -static void putImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, SharedBitmap* bitmap) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { + SharedBitmap* bitmap = m_data.m_bitmap.get(); unsigned char* dst = (unsigned char*)bitmap->bytes(); if (!dst) return; @@ -211,7 +211,7 @@ static void putImageData(ByteArray* source, const IntSize& sourceSize, const Int int green = *src++; int blue = *src++; int alpha = *src++; - if (premultiplied) { + if (multiplied == Premultiplied) { *dst++ = static_cast<unsigned char>(blue * 255 / alpha); *dst++ = static_cast<unsigned char>(green * 255 / alpha); *dst++ = static_cast<unsigned char>(red * 255 / alpha); @@ -228,16 +228,6 @@ static void putImageData(ByteArray* source, const IntSize& sourceSize, const Int } } -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<false>(source, sourceSize, sourceRect, destPoint, m_data.m_bitmap.get()); -} - -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - putImageData<true>(source, sourceSize, sourceRect, destPoint, m_data.m_bitmap.get()); -} - void ImageBuffer::platformTransformColorSpace(const Vector<int>& lookUpTable) { UNUSED_PARAM(lookUpTable); diff --git a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp index 7c909b54d..2dbb1961d 100644 --- a/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp +++ b/Source/WebCore/platform/graphics/wx/ImageBufferWx.cpp @@ -72,12 +72,7 @@ PassRefPtr<ByteArray> ImageBuffer::getPremultipliedImageData(const IntRect& rect return 0; } -void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) -{ - notImplemented(); -} - -void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) +void ImageBuffer::putByteArray(Multiply multiplied, ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) { notImplemented(); } diff --git a/Source/WebCore/platform/gtk/GtkUtilities.cpp b/Source/WebCore/platform/gtk/GtkUtilities.cpp index 246687958..c98b5ba36 100644 --- a/Source/WebCore/platform/gtk/GtkUtilities.cpp +++ b/Source/WebCore/platform/gtk/GtkUtilities.cpp @@ -34,10 +34,15 @@ IntPoint convertWidgetPointToScreenPoint(GtkWidget* widget, const IntPoint& poin if (!toplevelWidget || !gtk_widget_is_toplevel(toplevelWidget) || !GTK_IS_WINDOW(toplevelWidget)) return point; + GdkWindow* gdkWindow = gtk_widget_get_window(toplevelWidget); + if (!gdkWindow) + return point; + int xInWindow, yInWindow; gtk_widget_translate_coordinates(widget, toplevelWidget, point.x(), point.y(), &xInWindow, &yInWindow); + int windowOriginX, windowOriginY; - gdk_window_get_origin(gtk_widget_get_window(toplevelWidget), &windowOriginX, &windowOriginY); + gdk_window_get_origin(gdkWindow, &windowOriginX, &windowOriginY); return IntPoint(windowOriginX + xInWindow, windowOriginY + yInWindow); } diff --git a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp index 74e4f18ca..0a3b486dc 100644 --- a/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp +++ b/Source/WebCore/platform/gtk/PlatformScreenGtk.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "PlatformScreen.h" -#include "FrameView.h" #include "GtkVersioning.h" #include "HostWindow.h" #include "NotImplemented.h" @@ -101,9 +100,9 @@ static GdkScreen* getScreen(GtkWidget* widget) return gtk_widget_has_screen(widget) ? gtk_widget_get_screen(widget) : gdk_screen_get_default(); } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - GtkWidget* container = frameView ? GTK_WIDGET(frameView->root()->hostWindow()->platformPageClient()) : 0; + GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0; if (container) container = getToplevel(container); @@ -119,11 +118,11 @@ FloatRect screenRect(FrameView* frameView) return FloatRect(geometry.x, geometry.y, geometry.width, geometry.height); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { - GtkWidget* container = frameView ? GTK_WIDGET(frameView->root()->hostWindow()->platformPageClient()) : 0; + GtkWidget* container = widget ? GTK_WIDGET(widget->root()->hostWindow()->platformPageClient()) : 0; if (container && !gtk_widget_get_realized(container)) - return screenRect(frameView); + return screenRect(widget); GdkScreen* screen = container ? getScreen(container) : gdk_screen_get_default(); if (!screen) diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp index ca34e14c3..f1620a794 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.cpp +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.cpp @@ -161,7 +161,7 @@ bool RenderThemeGtk::controlSupportsTints(const RenderObject* o) const return isEnabled(o); } -int RenderThemeGtk::baselinePosition(const RenderObject* o) const +LayoutUnit RenderThemeGtk::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/platform/gtk/RenderThemeGtk.h b/Source/WebCore/platform/gtk/RenderThemeGtk.h index ea61674f4..ad7990ed2 100644 --- a/Source/WebCore/platform/gtk/RenderThemeGtk.h +++ b/Source/WebCore/platform/gtk/RenderThemeGtk.h @@ -60,7 +60,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual LayoutUnit baselinePosition(const RenderObject*) const; // The platform selection color. virtual Color platformActiveSelectionBackgroundColor() const; diff --git a/Source/WebCore/platform/mac/ClipboardMac.mm b/Source/WebCore/platform/mac/ClipboardMac.mm index 2806fc625..d37c5f3f3 100644 --- a/Source/WebCore/platform/mac/ClipboardMac.mm +++ b/Source/WebCore/platform/mac/ClipboardMac.mm @@ -368,7 +368,7 @@ void ClipboardMac::writeRange(Range* range, Frame* frame) ASSERT(range); ASSERT(frame); Pasteboard pasteboard([m_pasteboard.get() name]); - pasteboard.writeSelectionForTypes(nil, range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame); + pasteboard.writeSelection(range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame); } void ClipboardMac::writePlainText(const String& text) @@ -382,7 +382,7 @@ void ClipboardMac::writeURL(const KURL& url, const String& title, Frame* frame) ASSERT(frame); ASSERT(m_pasteboard); Pasteboard pasteboard([m_pasteboard.get() name]); - pasteboard.writeURLForTypes(nil, url, title, frame); + pasteboard.writeURL(url, title, frame); } #if ENABLE(DRAG_SUPPORT) diff --git a/Source/WebCore/platform/mac/DragDataMac.mm b/Source/WebCore/platform/mac/DragDataMac.mm index d6f4155c5..bec007bd4 100644 --- a/Source/WebCore/platform/mac/DragDataMac.mm +++ b/Source/WebCore/platform/mac/DragDataMac.mm @@ -31,6 +31,9 @@ #import "DocumentFragment.h" #import "DOMDocumentFragment.h" #import "DOMDocumentFragmentInternal.h" +#import "Editor.h" +#import "EditorClient.h" +#import "Frame.h" #import "MIMETypeRegistry.h" #import "Pasteboard.h" #import "Range.h" @@ -147,7 +150,7 @@ bool DragData::containsURL(Frame* frame, FilenameConversionPolicy filenamePolicy { return !asURL(frame, filenamePolicy).isEmpty(); } - + String DragData::asURL(Frame* frame, FilenameConversionPolicy filenamePolicy, String* title) const { // FIXME: Use filenamePolicy. @@ -157,8 +160,40 @@ String DragData::asURL(Frame* frame, FilenameConversionPolicy filenamePolicy, St if (NSString *URLTitleString = [m_pasteboard.get() stringForType:WebURLNamePboardType]) *title = URLTitleString; } - Pasteboard pasteboard([m_pasteboard.get() name]); - return pasteboard.asURL(frame); + + NSArray *types = [m_pasteboard.get() types]; + + // FIXME: using the editorClient to call into WebKit, for now, since + // calling webkit_canonicalize from WebCore involves migrating a sizable amount of + // helper code that should either be done in a separate patch or figured out in another way. + + if ([types containsObject:NSURLPboardType]) { + NSURL *URLFromPasteboard = [NSURL URLFromPasteboard:m_pasteboard.get()]; + NSString *scheme = [URLFromPasteboard scheme]; + if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) { + return [frame->editor()->client()->canonicalizeURL(URLFromPasteboard) absoluteString]; + } + } + + if ([types containsObject:NSStringPboardType]) { + NSString *URLString = [m_pasteboard.get() stringForType:NSStringPboardType]; + NSURL *URL = frame->editor()->client()->canonicalizeURLString(URLString); + if (URL) + return [URL absoluteString]; + } + + if ([types containsObject:NSFilenamesPboardType]) { + NSArray *files = [m_pasteboard.get() propertyListForType:NSFilenamesPboardType]; + if ([files count] == 1) { + NSString *file = [files objectAtIndex:0]; + BOOL isDirectory; + if ([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && isDirectory) + return String(); + return [frame->editor()->client()->canonicalizeURL([NSURL fileURLWithPath:file]) absoluteString]; + } + } + + return String(); } PassRefPtr<DocumentFragment> DragData::asFragment(Frame* frame, PassRefPtr<Range> range, bool allowPlainText, bool& chosePlainText) const diff --git a/Source/WebCore/platform/mac/PasteboardMac.mm b/Source/WebCore/platform/mac/PasteboardMac.mm index cb501e512..877e0a6f7 100644 --- a/Source/WebCore/platform/mac/PasteboardMac.mm +++ b/Source/WebCore/platform/mac/PasteboardMac.mm @@ -210,15 +210,9 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, writeSelectionForTypes(nil, selectedRange, canSmartCopyOrDelete, frame); } -void Pasteboard::writeURLForTypes(NSArray* types, const KURL& url, const String& titleStr, Frame* frame) +static void writeURLForTypes(NSArray* types, NSPasteboard* pasteboard, const KURL& url, const String& titleStr, Frame* frame) { - if (!WebArchivePboardType) - Pasteboard::generalPasteboard(); // Initializes pasteboard types. - - if (!types) { - types = writableTypesForURL(); - [m_pasteboard.get() declareTypes:types owner:nil]; - } + [pasteboard declareTypes:types owner:nil]; ASSERT(!url.isEmpty()); @@ -233,23 +227,23 @@ void Pasteboard::writeURLForTypes(NSArray* types, const KURL& url, const String& } if ([types containsObject:WebURLsWithTitlesPboardType]) - [m_pasteboard.get() setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:userVisibleString], + [pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:userVisibleString], [NSArray arrayWithObject:(NSString*)titleStr.stripWhiteSpace()], nil] forType:WebURLsWithTitlesPboardType]; if ([types containsObject:NSURLPboardType]) - [cocoaURL writeToPasteboard:m_pasteboard.get()]; + [cocoaURL writeToPasteboard:pasteboard]; if ([types containsObject:WebURLPboardType]) - [m_pasteboard.get() setString:userVisibleString forType:WebURLPboardType]; + [pasteboard setString:userVisibleString forType:WebURLPboardType]; if ([types containsObject:WebURLNamePboardType]) - [m_pasteboard.get() setString:title forType:WebURLNamePboardType]; + [pasteboard setString:title forType:WebURLNamePboardType]; if ([types containsObject:NSStringPboardType]) - [m_pasteboard.get() setString:userVisibleString forType:NSStringPboardType]; + [pasteboard setString:userVisibleString forType:NSStringPboardType]; } void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) { - writeURLForTypes(nil, url, titleStr, frame); + writeURLForTypes(writableTypesForURL(), m_pasteboard.get(), url, titleStr, frame); } static NSFileWrapper* fileWrapperForImage(CachedResource* resource, NSURL *url) @@ -265,7 +259,7 @@ static NSFileWrapper* fileWrapperForImage(CachedResource* resource, NSURL *url) return wrapper; } -void Pasteboard::writeFileWrapperAsRTFDAttachment(NSFileWrapper* wrapper) +static void writeFileWrapperAsRTFDAttachment(NSFileWrapper* wrapper, NSPasteboard* pasteboard) { NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:wrapper]; @@ -273,7 +267,7 @@ void Pasteboard::writeFileWrapperAsRTFDAttachment(NSFileWrapper* wrapper) [attachment release]; NSData *RTFDData = [string RTFDFromRange:NSMakeRange(0, [string length]) documentAttributes:nil]; - [m_pasteboard.get() setData:RTFDData forType:NSRTFDPboardType]; + [pasteboard setData:RTFDData forType:NSRTFDPboardType]; } void Pasteboard::writeImage(Node* node, const KURL& url, const String& title) @@ -293,9 +287,7 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title) if (!cachedImage || cachedImage->errorOccurred()) return; - NSArray* types = writableTypesForImage(); - [m_pasteboard.get() declareTypes:types owner:nil]; - writeURLForTypes(types, cocoaURL, nsStringNilIfEmpty(title), frame); + writeURLForTypes(writableTypesForImage(), m_pasteboard.get(), cocoaURL, nsStringNilIfEmpty(title), frame); Image* image = cachedImage->imageForRenderer(renderer); ASSERT(image); @@ -305,7 +297,7 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title) String MIMEType = cachedImage->response().mimeType(); ASSERT(MIMETypeRegistry::isSupportedImageResourceMIMEType(MIMEType)); - writeFileWrapperAsRTFDAttachment(fileWrapperForImage(cachedImage, cocoaURL)); + writeFileWrapperAsRTFDAttachment(fileWrapperForImage(cachedImage, cocoaURL), m_pasteboard.get()); } void Pasteboard::writeClipboard(Clipboard* clipboard) @@ -365,7 +357,7 @@ String Pasteboard::plainText(Frame* frame) return String(); } -PassRefPtr<DocumentFragment> Pasteboard::documentFragmentWithImageResource(Frame* frame, PassRefPtr<ArchiveResource> resource) +static PassRefPtr<DocumentFragment> documentFragmentWithImageResource(Frame* frame, PassRefPtr<ArchiveResource> resource) { if (DocumentLoader* loader = frame->loader()->documentLoader()) loader->addArchiveResource(resource.get()); @@ -385,16 +377,16 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragmentWithImageResource(Frame return 0; } -PassRefPtr<DocumentFragment> Pasteboard::documentFragmentWithRtf(Frame* frame, NSString* pboardType) +static PassRefPtr<DocumentFragment> documentFragmentWithRTF(Frame* frame, NSString *pasteboardType, NSPasteboard *pasteboard) { if (!frame || !frame->document() || !frame->document()->isHTMLDocument()) return 0; NSAttributedString *string = nil; - if (pboardType == NSRTFDPboardType) - string = [[NSAttributedString alloc] initWithRTFD:[m_pasteboard.get() dataForType:NSRTFDPboardType] documentAttributes:NULL]; + if (pasteboardType == NSRTFDPboardType) + string = [[NSAttributedString alloc] initWithRTFD:[pasteboard dataForType:NSRTFDPboardType] documentAttributes:NULL]; if (string == nil) - string = [[NSAttributedString alloc] initWithRTF:[m_pasteboard.get() dataForType:NSRTFPboardType] documentAttributes:NULL]; + string = [[NSAttributedString alloc] initWithRTF:[pasteboard dataForType:NSRTFPboardType] documentAttributes:NULL]; if (string == nil) return nil; @@ -432,49 +424,6 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) return URL; } -NSURL *Pasteboard::getBestURL(Frame* frame) -{ - NSArray *types = [m_pasteboard.get() types]; - - // FIXME: using the editorClient to call into webkit, for now, since - // calling webkit_canonicalize from WebCore involves migrating a sizable amount of - // helper code that should either be done in a separate patch or figured out in another way. - - if ([types containsObject:NSURLPboardType]) { - NSURL *URLFromPasteboard = [NSURL URLFromPasteboard:m_pasteboard.get()]; - NSString *scheme = [URLFromPasteboard scheme]; - if ([scheme isEqualToString:@"http"] || [scheme isEqualToString:@"https"]) { - return frame->editor()->client()->canonicalizeURL(URLFromPasteboard); - } - } - - if ([types containsObject:NSStringPboardType]) { - NSString *URLString = [m_pasteboard.get() stringForType:NSStringPboardType]; - NSURL *URL = frame->editor()->client()->canonicalizeURLString(URLString); - if (URL) - return URL; - } - - if ([types containsObject:NSFilenamesPboardType]) { - NSArray *files = [m_pasteboard.get() propertyListForType:NSFilenamesPboardType]; - // FIXME: Maybe it makes more sense to allow multiple files and only use the first one? - if ([files count] == 1) { - NSString *file = [files objectAtIndex:0]; - BOOL isDirectory; - if ([[NSFileManager defaultManager] fileExistsAtPath:file isDirectory:&isDirectory] && isDirectory) - return nil; - return frame->editor()->client()->canonicalizeURL([NSURL fileURLWithPath:file]); - } - } - - return nil; -} - -String Pasteboard::asURL(Frame* frame) -{ - return [getBestURL(frame) absoluteString]; -} - PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) { NSArray *types = [m_pasteboard.get() types]; @@ -540,11 +489,11 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP } if ([types containsObject:NSRTFDPboardType] && - (fragment = documentFragmentWithRtf(frame, NSRTFDPboardType))) + (fragment = documentFragmentWithRTF(frame, NSRTFDPboardType, m_pasteboard.get()))) return fragment.release(); if ([types containsObject:NSRTFPboardType] && - (fragment = documentFragmentWithRtf(frame, NSRTFPboardType))) + (fragment = documentFragmentWithRTF(frame, NSRTFPboardType, m_pasteboard.get()))) return fragment.release(); if ([types containsObject:NSTIFFPboardType] && diff --git a/Source/WebCore/platform/mac/PlatformClockCM.h b/Source/WebCore/platform/mac/PlatformClockCM.h new file mode 100644 index 000000000..e03491530 --- /dev/null +++ b/Source/WebCore/platform/mac/PlatformClockCM.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 PlatformClockCM_h +#define PlatformClockCM_h + +#if USE(COREMEDIA) + +#include "Clock.h" +#include <wtf/RetainPtr.h> + +typedef struct OpaqueCMTimebase* CMTimebaseRef; +typedef struct OpaqueCMClock* CMClockRef; + +namespace WebCore { + +class PlatformClockCM : public Clock { +public: + PlatformClockCM(); + PlatformClockCM(CMClockRef); + +private: + void initializeWithTimingSource(CMClockRef); + + virtual void setCurrentTime(float); + virtual float currentTime() const; + + virtual void setPlayRate(float); + virtual float playRate() const { return m_rate; } + + virtual void start(); + virtual void stop(); + virtual bool isRunning() const { return m_running; } + + RetainPtr<CMTimebaseRef> m_timebase; + float m_rate; + bool m_running; +}; + +} + +#endif + +#endif diff --git a/Source/WebCore/platform/mac/PlatformClockCM.mm b/Source/WebCore/platform/mac/PlatformClockCM.mm new file mode 100644 index 000000000..adc4d68f8 --- /dev/null +++ b/Source/WebCore/platform/mac/PlatformClockCM.mm @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2012 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "config.h" + +#if USE(COREMEDIA) + +#import "PlatformClockCM.h" + +#import "FloatConversion.h" +#import "SoftLinking.h" +#import <CoreMedia/CMAudioDeviceClock.h> + +SOFT_LINK_FRAMEWORK_OPTIONAL(CoreMedia) + +SOFT_LINK(CoreMedia, CMAudioDeviceClockCreate, OSStatus, (CFAllocatorRef allocator, CFStringRef deviceUID, CMClockRef *clockOut), (allocator, deviceUID, clockOut)) +SOFT_LINK(CoreMedia, CMTimebaseCreateWithMasterClock, OSStatus, (CFAllocatorRef allocator, CMClockRef masterClock, CMTimebaseRef *timebaseOut), (allocator, masterClock, timebaseOut)) +SOFT_LINK(CoreMedia, CMTimebaseSetTime, OSStatus, (CMTimebaseRef timebase, CMTime time), (timebase, time)) +SOFT_LINK(CoreMedia, CMTimebaseGetTime, CMTime, (CMTimebaseRef timebase), (timebase)) +SOFT_LINK(CoreMedia, CMTimebaseSetRate, OSStatus, (CMTimebaseRef timebase, Float64 rate), (timebase, rate)) +SOFT_LINK(CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale)) +SOFT_LINK(CoreMedia, CMTimeGetSeconds, Float64, (CMTime time), (time)) + +using namespace WebCore; + +// A default time scale of 1000 allows milli-second CMTime precision without scaling the timebase. +static const int32_t DefaultTimeScale = 1000; + +PlatformClockCM::PlatformClockCM() + : m_timebase(0) + , m_running(false) +{ + CMClockRef rawClockPtr = 0; + CMAudioDeviceClockCreate(kCFAllocatorDefault, NULL, &rawClockPtr); + RetainPtr<CMClockRef> clock(AdoptCF, rawClockPtr); + initializeWithTimingSource(clock.get()); +} + +PlatformClockCM::PlatformClockCM(CMClockRef clock) + : m_timebase(0) + , m_running(false) +{ + initializeWithTimingSource(clock); +} + +void PlatformClockCM::initializeWithTimingSource(CMClockRef clock) +{ + CMTimebaseRef rawTimebasePtr = 0; + CMTimebaseCreateWithMasterClock(kCFAllocatorDefault, clock, &rawTimebasePtr); + m_timebase.adoptCF(rawTimebasePtr); +} + +void PlatformClockCM::setCurrentTime(float time) +{ + CMTime cmTime = CMTimeMakeWithSeconds(time, DefaultTimeScale); + CMTimebaseSetTime(m_timebase.get(), cmTime); +} + +float PlatformClockCM::currentTime() const +{ + CMTime cmTime = CMTimebaseGetTime(m_timebase.get()); + return narrowPrecisionToFloat(CMTimeGetSeconds(cmTime)); +} + +void PlatformClockCM::setPlayRate(float rate) +{ + if (m_rate == rate) + return; + + m_rate = rate; + if (m_running) + CMTimebaseSetRate(m_timebase.get(), rate); +} + +void PlatformClockCM::start() +{ + if (m_running) + return; + m_running = true; + CMTimebaseSetRate(m_timebase.get(), m_rate); +} + +void PlatformClockCM::stop() +{ + if (!m_running) + return; + m_running = false; + CMTimebaseSetRate(m_timebase.get(), 0); +} + +#endif diff --git a/Source/WebCore/platform/mac/PlatformScreenMac.mm b/Source/WebCore/platform/mac/PlatformScreenMac.mm index f14f1e2e3..71e3cb137 100644 --- a/Source/WebCore/platform/mac/PlatformScreenMac.mm +++ b/Source/WebCore/platform/mac/PlatformScreenMac.mm @@ -28,8 +28,8 @@ #import "FloatRect.h" #import "Frame.h" -#import "FrameView.h" #import "Page.h" +#import "Widget.h" #import "NotImplemented.h" namespace WebCore { @@ -64,16 +64,16 @@ bool screenIsMonochrome(Widget*) // These functions scale between screen and page coordinates because JavaScript/DOM operations // assume that the screen and the page share the same coordinate system. -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - NSWindow *window = frameView ? [frameView->platformWidget() window] : nil; - return toUserSpace([screenForWindow(window) frame], window, WebCore::deviceScaleFactor(frameView->frame())); + NSWindow *window = widget ? [widget->platformWidget() window] : nil; + return toUserSpace([screenForWindow(window) frame], window); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { - NSWindow *window = frameView ? [frameView->platformWidget() window] : nil; - return toUserSpace([screenForWindow(window) visibleFrame], window, WebCore::deviceScaleFactor(frameView->frame())); + NSWindow *window = widget ? [widget->platformWidget() window] : nil; + return toUserSpace([screenForWindow(window) visibleFrame], window); } NSScreen *screenForWindow(NSWindow *window) @@ -89,18 +89,16 @@ NSScreen *screenForWindow(NSWindow *window) return nil; } -FloatRect toUserSpace(const NSRect& rect, NSWindow *destination, float deviceScaleFactor) +FloatRect toUserSpace(const NSRect& rect, NSWindow *destination) { FloatRect userRect = rect; userRect.setY(NSMaxY([screenForWindow(destination) frame]) - (userRect.y() + userRect.height())); // flip - userRect.scale(1 / deviceScaleFactor); // scale down return userRect; } -NSRect toDeviceSpace(const FloatRect& rect, NSWindow *source, float deviceScaleFactor) +NSRect toDeviceSpace(const FloatRect& rect, NSWindow *source) { FloatRect deviceRect = rect; - deviceRect.scale(deviceScaleFactor); // scale up deviceRect.setY(NSMaxY([screenForWindow(source) frame]) - (deviceRect.y() + deviceRect.height())); // flip return deviceRect; } diff --git a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm index 7bed38f1b..63c247770 100644 --- a/Source/WebCore/platform/mac/ScrollAnimatorMac.mm +++ b/Source/WebCore/platform/mac/ScrollAnimatorMac.mm @@ -253,6 +253,14 @@ static NSSize abs(NSSize size) { UNUSED_PARAM(scrollerImpPair); UNUSED_PARAM(rect); + + if (!_scrollableArea) + return; + + if (!_scrollableArea->isOnActivePage()) + return; + + _scrollableArea->scrollAnimator()->contentAreaWillPaint(); } - (void)scrollerImpPair:(id)scrollerImpPair updateScrollerStyleForNewRecommendedScrollerStyle:(NSScrollerStyle)newRecommendedScrollerStyle diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.h b/Source/WebCore/platform/mac/ScrollbarThemeMac.h index a74a75977..13d44c23d 100644 --- a/Source/WebCore/platform/mac/ScrollbarThemeMac.h +++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.h @@ -80,6 +80,11 @@ protected: virtual bool shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent&); virtual bool shouldDragDocumentInsteadOfThumb(Scrollbar*, const PlatformMouseEvent&); int scrollbarPartToHIPressedState(ScrollbarPart); + +#if !PLATFORM(CHROMIUM) && USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) + virtual void setUpOverhangAreasLayerContents(GraphicsLayer*) OVERRIDE; + virtual void setUpContentShadowLayer(GraphicsLayer*) OVERRIDE; +#endif }; } diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm index 85809244d..cc7482457 100644 --- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm +++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm @@ -44,6 +44,10 @@ using namespace std; using namespace WebCore; +@interface NSColor (WebNSColorDetails) ++ (NSImage *)_linenPatternImage; +@end + namespace WebCore { typedef HashMap<Scrollbar*, RetainPtr<ScrollbarPainter> > ScrollbarPainterMap; @@ -598,5 +602,49 @@ bool ScrollbarThemeMac::paint(Scrollbar* scrollbar, GraphicsContext* context, co } #endif +#if !PLATFORM(CHROMIUM) && USE(ACCELERATED_COMPOSITING) && ENABLE(RUBBER_BANDING) +static RetainPtr<CGColorRef> linenBackgroundColor() +{ + NSImage *image = [NSColor _linenPatternImage]; + CGImageRef cgImage = [image CGImageForProposedRect:NULL context:NULL hints:nil]; + + RetainPtr<CGPatternRef> pattern = adoptCF(wkCGPatternCreateWithImageAndTransform(cgImage, CGAffineTransformIdentity, wkPatternTilingNoDistortion)); + RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreatePattern(0)); + + const CGFloat alpha = 1.0; + return adoptCF(CGColorCreateWithPattern(colorSpace.get(), pattern.get(), &alpha)); +} + +void ScrollbarThemeMac::setUpOverhangAreasLayerContents(GraphicsLayer* graphicsLayer) +{ + static CGColorRef cachedLinenBackgroundColor = linenBackgroundColor().leakRef(); + + // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept + // of pattern images, and we know that WebCore won't touch this layer. + graphicsLayer->platformLayer().backgroundColor = cachedLinenBackgroundColor; } +void ScrollbarThemeMac::setUpContentShadowLayer(GraphicsLayer* graphicsLayer) +{ + // We operate on the CALayer directly here, since GraphicsLayer doesn't have the concept + // of shadows, and we know that WebCore won't touch this layer. + CALayer *contentShadowLayer = graphicsLayer->platformLayer(); + + static const CGFloat shadowOpacity = 0.66; + static const CGFloat shadowRadius = 3; + + // We only need to set these shadow properties once. + if (!contentShadowLayer.shadowOpacity) { + contentShadowLayer.shadowColor = CGColorGetConstantColor(kCGColorBlack); + contentShadowLayer.shadowOffset = CGSizeZero; + contentShadowLayer.shadowOpacity = shadowOpacity; + contentShadowLayer.shadowRadius = shadowRadius; + } + + RetainPtr<CGPathRef> shadowPath = adoptCF(CGPathCreateWithRect(CGRectMake(0, 0, graphicsLayer->size().width(), graphicsLayer->size().height()), NULL)); + contentShadowLayer.shadowPath = shadowPath.get(); +} + +#endif + +} // namespace WebCore diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.h b/Source/WebCore/platform/mac/WebCoreSystemInterface.h index 21eb94a18..e632e2a9a 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.h +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.h @@ -112,6 +112,7 @@ typedef enum { wkPatternTilingConstantSpacingMinimalDistortion, wkPatternTilingConstantSpacing } wkPatternTiling; +extern void (*wkCGContextResetClip)(CGContextRef); extern CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int); extern CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRef, void *), void (*formFinalize)(CFReadStreamRef, void *), diff --git a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm index f01747d5f..a046a892b 100644 --- a/Source/WebCore/platform/mac/WebCoreSystemInterface.mm +++ b/Source/WebCore/platform/mac/WebCoreSystemInterface.mm @@ -29,6 +29,7 @@ void (*wkAdvanceDefaultButtonPulseAnimation)(NSButtonCell *); BOOL (*wkCGContextGetShouldSmoothFonts)(CGContextRef); +void (*wkCGContextResetClip)(CGContextRef); CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int); CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef); NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*); diff --git a/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp b/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp index 9203ce3ac..abccf5b9b 100644 --- a/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp +++ b/Source/WebCore/platform/mediastream/MediaStreamCenter.cpp @@ -55,8 +55,9 @@ void MediaStreamCenter::endLocalMediaStream(MediaStreamDescriptor* streamDescrip streamDescriptor->setEnded(); } -// FIXME: remove when real implementations are available -// Empty implementations for ports that build with MEDIA_STREAM enabled by default. +#if !PLATFORM(CHROMIUM) + +// Empty implementations for ports that build with MEDIA_STREAM enabled by default, but haven't yet implemented MediaStreamCenter. MediaStreamCenter::MediaStreamCenter() { @@ -69,7 +70,7 @@ MediaStreamCenter::~MediaStreamCenter() void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) { MediaStreamSourceVector audioSources, videoSources; - client->mediaStreamSourcesQueryCompleted(audioSources, videoSources); + client->didCompleteQuery(audioSources, videoSources); } void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) @@ -84,6 +85,8 @@ void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor*) { } +#endif // !PLATFORM(CHROMIUM) + } // namespace WebCore #endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebCore/platform/mediastream/MediaStreamCenter.h b/Source/WebCore/platform/mediastream/MediaStreamCenter.h index 7d98fc52d..a37d66a26 100644 --- a/Source/WebCore/platform/mediastream/MediaStreamCenter.h +++ b/Source/WebCore/platform/mediastream/MediaStreamCenter.h @@ -38,6 +38,10 @@ namespace WebCore { +#if PLATFORM(CHROMIUM) +class MediaStreamCenterInternal; +#endif + class MediaStreamComponent; class MediaStreamDescriptor; @@ -47,8 +51,10 @@ public: virtual bool audio() const = 0; virtual bool video() const = 0; + virtual bool cameraPreferenceUser() const = 0; + virtual bool cameraPreferenceEnvironment() const = 0; - virtual void mediaStreamSourcesQueryCompleted(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0; + virtual void didCompleteQuery(const MediaStreamSourceVector& audioSources, const MediaStreamSourceVector& videoSources) = 0; }; class MediaStreamCenter { @@ -73,6 +79,10 @@ public: private: MediaStreamCenter(); + +#if PLATFORM(CHROMIUM) + OwnPtr<MediaStreamCenterInternal> m_private; +#endif }; } // namespace WebCore diff --git a/Source/WebCore/platform/mediastream/PeerConnectionHandlerClient.h b/Source/WebCore/platform/mediastream/PeerConnectionHandlerClient.h index 7d77b5f0b..e67ef3a55 100644 --- a/Source/WebCore/platform/mediastream/PeerConnectionHandlerClient.h +++ b/Source/WebCore/platform/mediastream/PeerConnectionHandlerClient.h @@ -42,6 +42,14 @@ class MediaStreamDescriptor; class PeerConnectionHandlerClient { public: + // Name and values of the enum must match the corressponding constants in the PeerConnection.idl file. + enum ReadyState { + NEW = 0, + NEGOTIATING = 1, + ACTIVE = 2, + CLOSED = 3 + }; + virtual ~PeerConnectionHandlerClient() { } virtual void didCompleteICEProcessing() = 0; @@ -49,6 +57,7 @@ public: virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0; virtual void didAddRemoteStream(PassRefPtr<MediaStreamDescriptor>) = 0; virtual void didRemoveRemoteStream(MediaStreamDescriptor*) = 0; + virtual void didChangeState(ReadyState) = 0; }; } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp index fc7c416ee..6be4cff08 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.cpp @@ -97,7 +97,9 @@ NetworkJob::NetworkJob() , m_isAbout(false) , m_isFTP(false) , m_isFTPDir(true) +#ifndef NDEBUG , m_isRunning(true) // Always started immediately after creation. +#endif , m_cancelled(false) , m_statusReceived(false) , m_dataReceived(false) @@ -157,30 +159,9 @@ bool NetworkJob::initialize(int playerId, return true; } -bool NetworkJob::loadAboutURL() +void NetworkJob::loadAboutURL() { - // First 6 chars are "about:". - String aboutWhat(m_response.url().string().substring(6)); - - if (!aboutWhat.isEmpty() - && !equalIgnoringCase(aboutWhat, "blank") - && !equalIgnoringCase(aboutWhat, "credits") -#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - && !aboutWhat.startsWith("cache?query=", false) - && !equalIgnoringCase(aboutWhat, "cache") - && !equalIgnoringCase(aboutWhat, "cache/enable") - && !equalIgnoringCase(aboutWhat, "cache/disable") - && !equalIgnoringCase(aboutWhat, "version") - && (!BlackBerry::Platform::debugSetting() - || (!equalIgnoringCase(aboutWhat, "config") - && !equalIgnoringCase(aboutWhat, "build") - && !equalIgnoringCase(aboutWhat, "memory"))) -#endif - ) - return false; - m_loadAboutTimer.startOneShot(0); - return true; } int NetworkJob::cancelJob() @@ -400,7 +381,7 @@ void NetworkJob::handleNotifyDataReceived(const char* buf, size_t len) if (shouldSendClientData()) { sendResponseIfNeeded(); sendMultipartResponseIfNeeded(); - if (clientIsOk()) { + if (isClientAvailable()) { RecursionGuard guard(m_callingClient); m_handle->client()->didReceiveData(m_handle.get(), buf, len, len); } @@ -425,7 +406,7 @@ void NetworkJob::handleNotifyDataSent(unsigned long long bytesSent, unsigned lon // Protect against reentrancy. updateDeferLoadingCount(1); - if (clientIsOk()) { + if (isClientAvailable()) { RecursionGuard guard(m_callingClient); m_handle->client()->didSendData(m_handle.get(), bytesSent, totalBytesToBeSent); } @@ -443,8 +424,9 @@ void NetworkJob::notifyClose(int status) void NetworkJob::handleNotifyClose(int status) { +#ifndef NDEBUG m_isRunning = false; - +#endif if (!m_cancelled) { if (!m_statusReceived) { // Connection failed before sending notifyStatusReceived: use generic NetworkError. @@ -464,7 +446,7 @@ void NetworkJob::handleNotifyClose(int status) m_extendedStatusCode = BlackBerry::Platform::FilterStream::StatusTooManyRedirects; sendResponseIfNeeded(); - if (clientIsOk()) { + if (isClientAvailable()) { RecursionGuard guard(m_callingClient); if (isError(m_extendedStatusCode) && !m_dataReceived) { @@ -519,12 +501,13 @@ bool NetworkJob::retryAsFTPDirectory() bool NetworkJob::startNewJobWithRequest(ResourceRequest& newRequest, bool increasRedirectCount) { - if (clientIsOk()) { + if (isClientAvailable()) { RecursionGuard guard(m_callingClient); m_handle->client()->willSendRequest(m_handle.get(), newRequest, m_response); // m_cancelled can become true if the url fails the policy check. - if (m_cancelled) + // newRequest can be cleared when the redirect is rejected. + if (m_cancelled || newRequest.isEmpty()) return false; } @@ -610,12 +593,26 @@ void NetworkJob::sendResponseIfNeeded() if (!contentLength.isNull()) m_response.setExpectedContentLength(contentLength.toInt64()); - // Set suggested filename for downloads from the Content-Disposition header; if this fails, fill it in from the url - // skip this for data url's, because they have no Content-Disposition header and the format is wrong to be a filename. + // Set suggested filename for downloads from the Content-Disposition header; if this fails, + // fill it in from the url and sniffed mime type;Skip this for data and about URLs, + // because they have no Content-Disposition header and the format is wrong to be a filename. if (!m_isData && !m_isAbout) { String suggestedFilename = filenameFromHTTPContentDisposition(m_contentDisposition); - if (suggestedFilename.isNull()) - suggestedFilename = urlFilename; + if (suggestedFilename.isEmpty()) { + // Check and see if an extension already exists. + String mimeExtension = MIMETypeRegistry::getPreferredExtensionForMIMEType(mimeType); + if (urlFilename.isEmpty()) { + if (mimeExtension.isEmpty()) // No extension found for the mimeType. + suggestedFilename = String("Untitled"); + else + suggestedFilename = String("Untitled") + "." + mimeExtension; + } else { + if (urlFilename.reverseFind('.') == notFound && !mimeExtension.isEmpty()) + suggestedFilename = urlFilename + '.' + mimeExtension; + else + suggestedFilename = urlFilename; + } + } m_response.setSuggestedFilename(suggestedFilename); } @@ -623,7 +620,7 @@ void NetworkJob::sendResponseIfNeeded() if (m_isFile || m_isData || m_isAbout) m_response.setHTTPHeaderField("Cache-Control", "no-cache"); - if (clientIsOk()) { + if (isClientAvailable()) { RecursionGuard guard(m_callingClient); m_handle->client()->didReceiveResponse(m_handle.get(), m_response); } @@ -631,7 +628,7 @@ void NetworkJob::sendResponseIfNeeded() void NetworkJob::sendMultipartResponseIfNeeded() { - if (m_multipartResponse && clientIsOk()) { + if (m_multipartResponse && isClientAvailable()) { m_handle->client()->didReceiveResponse(m_handle.get(), *m_multipartResponse); m_multipartResponse = nullptr; } @@ -965,13 +962,18 @@ void NetworkJob::handleAbout() #endif } - CString resultString = result.utf8(); - - notifyStatusReceived(handled ? 404 : 200, 0); - notifyStringHeaderReceived("Content-Length", String::number(resultString.length())); - notifyStringHeaderReceived("Content-Type", "text/html"); - notifyDataReceivedPlain(resultString.data(), resultString.length()); - notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess); + if (handled) { + CString resultString = result.utf8(); + notifyStatusReceived(404, 0); + notifyStringHeaderReceived("Content-Length", String::number(resultString.length())); + notifyStringHeaderReceived("Content-Type", "text/html"); + notifyDataReceivedPlain(resultString.data(), resultString.length()); + notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess); + } else { + // If we can not handle it, we take it as an error of invalid URL. + notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl, 0); + notifyClose(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl); + } } } // namespace WebCore diff --git a/Source/WebCore/platform/network/blackberry/NetworkJob.h b/Source/WebCore/platform/network/blackberry/NetworkJob.h index 4d60a6aed..447a6442e 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkJob.h +++ b/Source/WebCore/platform/network/blackberry/NetworkJob.h @@ -56,11 +56,12 @@ public: int deferLoadingCount, int redirectCount); PassRefPtr<ResourceHandle> handle() const { return m_handle; } +#ifndef NDEBUG bool isRunning() const { return m_isRunning; } +#endif bool isCancelled() const { return m_cancelled; } - bool clientIsOk() const { return !m_cancelled && m_handle && m_handle->client(); } void loadDataURL() { m_loadDataTimer.startOneShot(0); } - bool loadAboutURL(); + void loadAboutURL(); int cancelJob(); bool isDeferringLoading() const { return m_deferLoadingCount > 0; } void updateDeferLoadingCount(int delta); @@ -81,12 +82,15 @@ public: void handleNotifyDataSent(unsigned long long bytesSent, unsigned long long totalBytesToBeSent); virtual void notifyClose(int status); void handleNotifyClose(int status); + +private: + bool isClientAvailable() const { return !m_cancelled && m_handle && m_handle->client(); } + virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer* buffer) { notifyDataReceivedPlain(BlackBerry::Platform::networkBufferData(buffer), BlackBerry::Platform::networkBufferDataLength(buffer)); } -private: virtual void setWasDiskCached(bool value) { m_response.setWasCached(value); @@ -161,7 +165,9 @@ private: bool m_isAbout; bool m_isFTP; bool m_isFTPDir; +#ifndef NDEBUG bool m_isRunning; +#endif bool m_cancelled; bool m_statusReceived; bool m_dataReceived; diff --git a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp index 077b4c219..388d6d8fd 100644 --- a/Source/WebCore/platform/network/blackberry/NetworkManager.cpp +++ b/Source/WebCore/platform/network/blackberry/NetworkManager.cpp @@ -150,9 +150,9 @@ bool NetworkManager::startJob(int playerId, const String& pageGroupName, PassRef } if (url.protocolIs("about")) { - // Try to handle the url internally; if it isn't recognized, continue and pass it to the client. - if (networkJob->loadAboutURL()) - return true; + // If the protocol matches "about", loadAboutURL should recognize and handle it. + networkJob->loadAboutURL(); + return true; } int result = networkJob->streamOpen(); diff --git a/Source/WebCore/platform/network/blackberry/ResourceRequest.h b/Source/WebCore/platform/network/blackberry/ResourceRequest.h index 8ad547395..cd9760db4 100644 --- a/Source/WebCore/platform/network/blackberry/ResourceRequest.h +++ b/Source/WebCore/platform/network/blackberry/ResourceRequest.h @@ -31,6 +31,26 @@ namespace WebCore { class ResourceRequest : public ResourceRequestBase { public: + // The type of this ResourceRequest, based on how the resource will be used. + enum TargetType { + TargetIsMainFrame, + TargetIsSubframe, + TargetIsSubresource, // Resource is a generic subresource. (Generally a specific type should be specified) + TargetIsStyleSheet, + TargetIsScript, + TargetIsFontResource, + TargetIsImage, + TargetIsObject, + TargetIsMedia, + TargetIsWorker, + TargetIsSharedWorker, + TargetIsPrefetch, + TargetIsPrerender, + TargetIsFavicon, + TargetIsXHR, + TargetIsTextTrack, + TargetIsUnspecified, + }; ResourceRequest(const String& url) : ResourceRequestBase(KURL(ParsedURLString, url), UseProtocolCachePolicy) , m_isXMLHTTPRequest(false) @@ -94,6 +114,10 @@ public: void setForceDownload(bool forceDownload) { m_forceDownload = true; } bool forceDownload() const { return m_forceDownload; } + // What this request is for. + TargetType targetType() const { return m_targetType; } + void setTargetType(TargetType type) { m_targetType = type; } + private: friend class ResourceRequestBase; @@ -104,6 +128,7 @@ private: bool m_mustHandleInternally; bool m_isRequestedByPlugin; bool m_forceDownload; + TargetType m_targetType; void doUpdatePlatformRequest() { } void doUpdateResourceRequest() { } diff --git a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp index 3ec325444..fbfb902c8 100644 --- a/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp +++ b/Source/WebCore/platform/network/cf/ResourceHandleCFNet.cpp @@ -604,7 +604,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall KURL urlToStore; if (challenge.failureResponse().httpStatusCode() == 401) - urlToStore = firstRequest().url(); + urlToStore = challenge.failureResponse().url(); CredentialStorage::set(core(credential.get()), challenge.protectionSpace(), urlToStore); CFURLConnectionUseCredential(d->m_connection.get(), credential.get(), challenge.cfURLAuthChallengeRef()); @@ -628,7 +628,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall ASSERT(credential.persistence() == CredentialPersistenceNone); if (challenge.failureResponse().httpStatusCode() == 401) { // Store the credential back, possibly adding it as a default for this directory. - CredentialStorage::set(credential, challenge.protectionSpace(), firstRequest().url()); + CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url()); } RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(credential)); CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef()); @@ -675,7 +675,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge KURL urlToStore; if (challenge.failureResponse().httpStatusCode() == 401) - urlToStore = firstRequest().url(); + urlToStore = challenge.failureResponse().url(); CredentialStorage::set(webCredential, challenge.protectionSpace(), urlToStore); CFURLConnectionUseCredential(d->m_connection.get(), cfCredential.get(), challenge.cfURLAuthChallengeRef()); diff --git a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm index d22162ea2..06a81c59a 100644 --- a/Source/WebCore/platform/network/mac/ResourceHandleMac.mm +++ b/Source/WebCore/platform/network/mac/ResourceHandleMac.mm @@ -562,7 +562,7 @@ void ResourceHandle::didReceiveAuthenticationChallenge(const AuthenticationChall ASSERT(credential.persistence() == CredentialPersistenceNone); if (challenge.failureResponse().httpStatusCode() == 401) { // Store the credential back, possibly adding it as a default for this directory. - CredentialStorage::set(credential, challenge.protectionSpace(), firstRequest().url()); + CredentialStorage::set(credential, challenge.protectionSpace(), challenge.failureResponse().url()); } [challenge.sender() useCredential:mac(credential) forAuthenticationChallenge:mac(challenge)]; return; @@ -620,7 +620,7 @@ void ResourceHandle::receivedCredential(const AuthenticationChallenge& challenge Credential webCredential(credential, CredentialPersistenceNone); KURL urlToStore; if (challenge.failureResponse().httpStatusCode() == 401) - urlToStore = firstRequest().url(); + urlToStore = challenge.failureResponse().url(); CredentialStorage::set(webCredential, core([d->m_currentMacChallenge protectionSpace]), urlToStore); [[d->m_currentMacChallenge sender] useCredential:mac(webCredential) forAuthenticationChallenge:d->m_currentMacChallenge]; } else diff --git a/Source/WebCore/platform/qt/PlatformScreenQt.cpp b/Source/WebCore/platform/qt/PlatformScreenQt.cpp index 846f0b8a4..3c1329ba3 100644 --- a/Source/WebCore/platform/qt/PlatformScreenQt.cpp +++ b/Source/WebCore/platform/qt/PlatformScreenQt.cpp @@ -102,15 +102,15 @@ bool screenIsMonochrome(Widget* w) return QApplication::desktop()->screen(screenNumber(w))->colorCount() == 2; } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - QRect r = QApplication::desktop()->screenGeometry(screenNumber(frameView)); + QRect r = QApplication::desktop()->screenGeometry(screenNumber(widget)); return FloatRect(r.x(), r.y(), r.width(), r.height()); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { - QRect r = QApplication::desktop()->availableGeometry(screenNumber(frameView)); + QRect r = QApplication::desktop()->availableGeometry(screenNumber(widget)); return FloatRect(r.x(), r.y(), r.width(), r.height()); } diff --git a/Source/WebCore/platform/qt/RenderThemeQt.cpp b/Source/WebCore/platform/qt/RenderThemeQt.cpp index 5c6c18763..18df290db 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.cpp +++ b/Source/WebCore/platform/qt/RenderThemeQt.cpp @@ -156,7 +156,7 @@ bool RenderThemeQt::supportsFocusRing(const RenderStyle* style) const } } -int RenderThemeQt::baselinePosition(const RenderObject* o) const +LayoutUnit RenderThemeQt::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/platform/qt/RenderThemeQt.h b/Source/WebCore/platform/qt/RenderThemeQt.h index 618fad391..1393536b3 100644 --- a/Source/WebCore/platform/qt/RenderThemeQt.h +++ b/Source/WebCore/platform/qt/RenderThemeQt.h @@ -53,7 +53,7 @@ public: virtual bool supportsHover(const RenderStyle*) const; virtual bool supportsFocusRing(const RenderStyle*) const; - virtual int baselinePosition(const RenderObject*) const; + virtual LayoutUnit baselinePosition(const RenderObject*) const; // A method asking if the control changes its tint when the window has focus or not. virtual bool controlSupportsTints(const RenderObject*) const; diff --git a/Source/WebCore/platform/text/UnicodeBidi.h b/Source/WebCore/platform/text/UnicodeBidi.h index 867c58b17..08f054525 100644 --- a/Source/WebCore/platform/text/UnicodeBidi.h +++ b/Source/WebCore/platform/text/UnicodeBidi.h @@ -34,7 +34,12 @@ enum EUnicodeBidi { Override, Isolate, Plaintext -}; +}; + +inline bool isIsolated(const EUnicodeBidi& unicodeBidi) +{ + return unicodeBidi == Isolate || unicodeBidi == Plaintext; +} } diff --git a/Source/WebCore/platform/win/PlatformScreenWin.cpp b/Source/WebCore/platform/win/PlatformScreenWin.cpp index 936f8a747..caadde943 100644 --- a/Source/WebCore/platform/win/PlatformScreenWin.cpp +++ b/Source/WebCore/platform/win/PlatformScreenWin.cpp @@ -106,15 +106,15 @@ bool screenIsMonochrome(Widget* widget) #endif } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { - MONITORINFOEX monitorInfo = monitorInfoForWidget(frameView); + MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); return monitorInfo.rcMonitor; } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { - MONITORINFOEX monitorInfo = monitorInfoForWidget(frameView); + MONITORINFOEX monitorInfo = monitorInfoForWidget(widget); return monitorInfo.rcWork; } diff --git a/Source/WebCore/platform/wx/ScreenWx.cpp b/Source/WebCore/platform/wx/ScreenWx.cpp index 779d4fdf5..41edf1561 100644 --- a/Source/WebCore/platform/wx/ScreenWx.cpp +++ b/Source/WebCore/platform/wx/ScreenWx.cpp @@ -28,7 +28,6 @@ #include "Screen.h" #include "IntRect.h" #include "FloatRect.h" -#include "FrameView.h" #include "NotImplemented.h" #include "Widget.h" @@ -49,7 +48,7 @@ int screenVerticalDPI(Widget*) return 0; } -FloatRect screenRect(FrameView* frameView) +FloatRect screenRect(Widget* widget) { /* int displayNum; @@ -78,7 +77,7 @@ bool screenIsMonochrome(Widget* widget) return wxColourDisplay(); } -FloatRect screenAvailableRect(FrameView* frameView) +FloatRect screenAvailableRect(Widget* widget) { /* Widget* widget = widget->widget(); diff --git a/Source/WebCore/plugins/DOMMimeTypeArray.idl b/Source/WebCore/plugins/DOMMimeTypeArray.idl index ba4460fb7..3e2eff2de 100644 --- a/Source/WebCore/plugins/DOMMimeTypeArray.idl +++ b/Source/WebCore/plugins/DOMMimeTypeArray.idl @@ -21,9 +21,9 @@ module window { interface [ - GenerateIsReachable=ImplFrame, - HasNameGetter, - HasIndexGetter + JSGenerateIsReachable=ImplFrame, + NamedGetter, + IndexedGetter ] DOMMimeTypeArray { readonly attribute unsigned long length; DOMMimeType item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/plugins/DOMPlugin.idl b/Source/WebCore/plugins/DOMPlugin.idl index 259ada6ab..bf3542d0c 100644 --- a/Source/WebCore/plugins/DOMPlugin.idl +++ b/Source/WebCore/plugins/DOMPlugin.idl @@ -21,8 +21,8 @@ module window { interface [ - HasNameGetter, - HasIndexGetter + NamedGetter, + IndexedGetter ] DOMPlugin { readonly attribute DOMString name; readonly attribute DOMString filename; diff --git a/Source/WebCore/plugins/DOMPluginArray.idl b/Source/WebCore/plugins/DOMPluginArray.idl index 15163f037..32aa34263 100644 --- a/Source/WebCore/plugins/DOMPluginArray.idl +++ b/Source/WebCore/plugins/DOMPluginArray.idl @@ -21,9 +21,9 @@ module window { interface [ - GenerateIsReachable=ImplFrame, - HasNameGetter, - HasIndexGetter + JSGenerateIsReachable=ImplFrame, + NamedGetter, + IndexedGetter ] DOMPluginArray { readonly attribute unsigned long length; DOMPlugin item(in [Optional=CallWithDefaultValue] unsigned long index); diff --git a/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp b/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp index 5b4c8eae4..6518025cb 100644 --- a/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp +++ b/Source/WebCore/plugins/blackberry/PluginViewBlackBerry.cpp @@ -113,7 +113,6 @@ void PluginView::updatePluginWidget() m_windowRect.move(root()->scrollOffset()); m_clipRect = calculateClipRect(); - IntRect f = frameRect(); // Notify the plugin if it may or may not be on/offscreen. handleScrollEvent(); diff --git a/Source/WebCore/rendering/ColumnInfo.h b/Source/WebCore/rendering/ColumnInfo.h index 94b130d3f..c8191cf1d 100644 --- a/Source/WebCore/rendering/ColumnInfo.h +++ b/Source/WebCore/rendering/ColumnInfo.h @@ -75,8 +75,8 @@ public: LayoutUnit minimumColumnHeight() const { return m_minimumColumnHeight; } int forcedBreaks() const { return m_forcedBreaks; } - int forcedBreakOffset() const { return m_forcedBreakOffset; } - int maximumDistanceBetweenForcedBreaks() const { return m_maximumDistanceBetweenForcedBreaks; } + LayoutUnit forcedBreakOffset() const { return m_forcedBreakOffset; } + LayoutUnit maximumDistanceBetweenForcedBreaks() const { return m_maximumDistanceBetweenForcedBreaks; } void clearForcedBreaks() { m_forcedBreaks = 0; @@ -107,8 +107,8 @@ private: LayoutUnit m_columnHeight; LayoutUnit m_minimumColumnHeight; int m_forcedBreaks; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly. - int m_maximumDistanceBetweenForcedBreaks; - int m_forcedBreakOffset; + LayoutUnit m_maximumDistanceBetweenForcedBreaks; + LayoutUnit m_forcedBreakOffset; PaginationUnit m_paginationUnit; }; diff --git a/Source/WebCore/rendering/HitTestResult.cpp b/Source/WebCore/rendering/HitTestResult.cpp index 2292a8844..dc987c802 100644 --- a/Source/WebCore/rendering/HitTestResult.cpp +++ b/Source/WebCore/rendering/HitTestResult.cpp @@ -552,7 +552,7 @@ bool HitTestResult::isContentEditable() const if (!m_innerNonSharedNode) return false; - if (m_innerNonSharedNode->hasTagName(textareaTag) || m_innerNonSharedNode->hasTagName(isindexTag)) + if (m_innerNonSharedNode->hasTagName(textareaTag)) return true; if (m_innerNonSharedNode->hasTagName(inputTag)) diff --git a/Source/WebCore/rendering/InlineIterator.h b/Source/WebCore/rendering/InlineIterator.h index 8e8912d21..446174e02 100755 --- a/Source/WebCore/rendering/InlineIterator.h +++ b/Source/WebCore/rendering/InlineIterator.h @@ -131,14 +131,13 @@ static inline void notifyObserverEnteredObject(Observer* observer, RenderObject* // Thus we ignore any possible dir= attribute on the span. return; } - if (unicodeBidi == Isolate) { + if (isIsolated(unicodeBidi)) { observer->enterIsolate(); // Embedding/Override characters implied by dir= are handled when // we process the isolated span, not when laying out the "parent" run. return; } - // FIXME: Should unicode-bidi: plaintext really be embedding override/embed characters here? if (!observer->inIsolate()) observer->embed(embedCharFromDirection(style->direction(), unicodeBidi), FromStyleOrDOM); } @@ -152,7 +151,7 @@ static inline void notifyObserverWillExitObject(Observer* observer, RenderObject EUnicodeBidi unicodeBidi = object->style()->unicodeBidi(); if (unicodeBidi == UBNormal) return; // Nothing to do for unicode-bidi: normal - if (unicodeBidi == Isolate) { + if (isIsolated(unicodeBidi)) { observer->exitIsolate(); return; } @@ -255,9 +254,8 @@ static inline RenderObject* bidiNextIncludingEmptyInlines(RenderObject* root, Re return bidiNextShared(root, current, observer, IncludeEmptyInlines, endOfInlinePtr); } -static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderObject* root, InlineBidiResolver* resolver) +static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderObject* root, InlineBidiResolver* resolver = 0) { - ASSERT(resolver); RenderObject* o = root->firstChild(); if (!o) return 0; @@ -278,7 +276,8 @@ static inline RenderObject* bidiFirstSkippingEmptyInlines(RenderObject* root, In if (o && !isIteratorTarget(o)) o = bidiNextSkippingEmptyInlines(root, o, resolver); - resolver->commitExplicitEmbedding(); + if (resolver) + resolver->commitExplicitEmbedding(); return o; } @@ -392,7 +391,7 @@ inline void InlineBidiResolver::increment() static inline bool isIsolatedInline(RenderObject* object) { ASSERT(object); - return object->isRenderInline() && object->style()->unicodeBidi() == Isolate; + return object->isRenderInline() && isIsolated(object->style()->unicodeBidi()); } static inline RenderObject* containingIsolate(RenderObject* object, RenderObject* root) diff --git a/Source/WebCore/rendering/LayoutState.cpp b/Source/WebCore/rendering/LayoutState.cpp index c59e97002..c9018c599 100644 --- a/Source/WebCore/rendering/LayoutState.cpp +++ b/Source/WebCore/rendering/LayoutState.cpp @@ -37,7 +37,7 @@ namespace WebCore { LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo) : m_columnInfo(columnInfo) - , m_currentLineGrid(0) + , m_lineGrid(0) , m_next(prev) #ifndef NDEBUG , m_renderer(renderer) @@ -102,6 +102,9 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz m_pageLogicalHeight = 0; } + // Propagate line grid information. + propagateLineGridInfo(renderer); + if (!m_columnInfo) m_columnInfo = m_next->m_columnInfo; @@ -109,8 +112,8 @@ LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSiz m_isPaginated = m_pageLogicalHeight || m_columnInfo; - // Propagate line grid information. - propagateLineGridInfo(renderer); + if (lineGrid() && renderer->hasColumns() && renderer->style()->hasInlineColumnAxis()) + computeLineGridPaginationOrigin(renderer); // If we have a new grid to track, then add it to our set. if (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow()) @@ -125,7 +128,7 @@ LayoutState::LayoutState(LayoutState* prev, RenderFlowThread* flowThread, bool r , m_pageLogicalHeight(1) // Use a fake height here. That value is not important, just needs to be non-zero. , m_pageLogicalHeightChanged(regionsChanged) , m_columnInfo(0) - , m_currentLineGrid(0) + , m_lineGrid(0) , m_next(prev) #ifndef NDEBUG , m_renderer(flowThread) @@ -142,7 +145,7 @@ LayoutState::LayoutState(RenderObject* root) , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) - , m_currentLineGrid(0) + , m_lineGrid(0) , m_next(0) #ifndef NDEBUG , m_renderer(root) @@ -213,34 +216,77 @@ void LayoutState::propagateLineGridInfo(RenderBox* renderer) if (!m_next || renderer->isUnsplittableForPagination()) return; - m_currentLineGrid = m_next->m_currentLineGrid; - m_currentLineGridOffset = m_next->m_currentLineGridOffset; + m_lineGrid = m_next->m_lineGrid; + m_lineGridOffset = m_next->m_lineGridOffset; + m_lineGridPaginationOrigin = m_next->m_lineGridPaginationOrigin; } void LayoutState::establishLineGrid(RenderBlock* block) { // First check to see if this grid has been established already. - if (m_currentLineGrid) { - if (m_currentLineGrid->style()->lineGrid() == block->style()->lineGrid()) + if (m_lineGrid) { + if (m_lineGrid->style()->lineGrid() == block->style()->lineGrid()) return; - RenderBlock* currentGrid = m_currentLineGrid; + RenderBlock* currentGrid = m_lineGrid; for (LayoutState* currentState = m_next; currentState; currentState = currentState->m_next) { - if (currentState->m_currentLineGrid == currentGrid) + if (currentState->m_lineGrid == currentGrid) continue; - currentGrid = currentState->m_currentLineGrid; + currentGrid = currentState->m_lineGrid; if (!currentGrid) break; if (currentGrid->style()->lineGrid() == block->style()->lineGrid()) { - m_currentLineGrid = currentGrid; - m_currentLineGridOffset = currentState->m_currentLineGridOffset; + m_lineGrid = currentGrid; + m_lineGridOffset = currentState->m_lineGridOffset; return; } } } // We didn't find an already-established grid with this identifier. Our render object establishes the grid. - m_currentLineGrid = block; - m_currentLineGridOffset = m_layoutOffset; + m_lineGrid = block; + m_lineGridOffset = m_layoutOffset; +} + +void LayoutState::computeLineGridPaginationOrigin(RenderBox* renderer) +{ + // We need to cache a line grid pagination origin so that we understand how to reset the line grid + // at the top of each column. + // Get the current line grid and offset. + if (!lineGrid() || lineGrid()->style()->writingMode() != renderer->style()->writingMode()) + return; + + // Get the hypothetical line box used to establish the grid. + RootInlineBox* lineGridBox = lineGrid()->lineGridBox(); + if (!lineGridBox) + return; + + bool isHorizontalWritingMode = lineGrid()->isHorizontalWritingMode(); + + LayoutUnit lineGridBlockOffset = isHorizontalWritingMode ? lineGridOffset().height() : lineGridOffset().width(); + + // Now determine our position on the grid. Our baseline needs to be adjusted to the nearest baseline multiple + // as established by the line box. + // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume + // the grid should honor line-box-contain. + LayoutUnit gridLineHeight = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading(); + if (!gridLineHeight) + return; + + LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading(); + + if (isPaginated() && pageLogicalHeight()) { + LayoutUnit pageLogicalTop = renderer->isHorizontalWritingMode() ? m_pageOffset.height() : m_pageOffset.width(); + if (pageLogicalTop > firstLineTopWithLeading) { + // Shift to the next highest line grid multiple past the page logical top. Cache the delta + // between this new value and the page logical top as the pagination origin. + LayoutUnit remainder = (pageLogicalTop - firstLineTopWithLeading) % gridLineHeight; + LayoutUnit paginationDelta = gridLineHeight - remainder; + if (isHorizontalWritingMode) + m_lineGridPaginationOrigin.setHeight(paginationDelta); + else + m_lineGridPaginationOrigin.setWidth(paginationDelta); + } + } } } // namespace WebCore diff --git a/Source/WebCore/rendering/LayoutState.h b/Source/WebCore/rendering/LayoutState.h index 951be3f7b..e1df24b4e 100644 --- a/Source/WebCore/rendering/LayoutState.h +++ b/Source/WebCore/rendering/LayoutState.h @@ -48,7 +48,7 @@ public: , m_pageLogicalHeight(0) , m_pageLogicalHeightChanged(false) , m_columnInfo(0) - , m_currentLineGrid(0) + , m_lineGrid(0) , m_next(0) #ifndef NDEBUG , m_renderer(0) @@ -81,12 +81,13 @@ public: LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; } bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; } - RenderBlock* currentLineGrid() const { return m_currentLineGrid; } - LayoutSize currentLineGridOffset() const { return m_currentLineGridOffset; } + RenderBlock* lineGrid() const { return m_lineGrid; } + LayoutSize lineGridOffset() const { return m_lineGridOffset; } + LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOrigin; } LayoutSize layoutOffset() const { return m_layoutOffset; } - bool needsBlockDirectionLocationSetBeforeLayout() const { return m_currentLineGrid || (m_isPaginated && m_pageLogicalHeight); } + bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); } private: // The normal operator new is disallowed. @@ -95,6 +96,8 @@ private: void propagateLineGridInfo(RenderBox*); void establishLineGrid(RenderBlock*); + void computeLineGridPaginationOrigin(RenderBox*); + public: bool m_clipped; bool m_isPaginated; @@ -119,9 +122,10 @@ public: ColumnInfo* m_columnInfo; // The current line grid that we're snapping to and the offset of the start of the grid. - RenderBlock* m_currentLineGrid; - LayoutSize m_currentLineGridOffset; - + RenderBlock* m_lineGrid; + LayoutSize m_lineGridOffset; + LayoutSize m_lineGridPaginationOrigin; + LayoutState* m_next; #ifndef NDEBUG RenderObject* m_renderer; diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index d9cadadb8..9b2bca5a9 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -1024,8 +1024,9 @@ void RenderBlock::collapseAnonymousBoxChild(RenderBlock* parent, RenderObject* c { parent->setNeedsLayoutAndPrefWidthsRecalc(); parent->setChildrenInline(child->childrenInline()); + RenderObject* nextSibling = child->nextSibling(); RenderBlock* anonBlock = toRenderBlock(parent->children()->removeChildNode(parent, child, child->hasLayer())); - anonBlock->moveAllChildrenTo(parent, child->hasLayer()); + anonBlock->moveAllChildrenTo(parent, nextSibling, child->hasLayer()); // Delete the now-empty block's lines and nuke it. if (!parent->documentBeingDestroyed()) anonBlock->deleteLineBoxTree(); @@ -1089,7 +1090,7 @@ void RenderBlock::removeChild(RenderObject* oldChild) // box. We can go ahead and pull the content right back up into our // box. collapseAnonymousBoxChild(this, child); - } else if ((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) { + } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) && !isFlexibleBoxIncludingDeprecated()) { // It's possible that the removal has knocked us down to a single anonymous // block with pseudo-style element siblings (e.g. first-letter). If these // are floating, then we need to pull the content up also. @@ -1207,6 +1208,27 @@ void RenderBlock::layout() clearLayoutOverflow(); } +void RenderBlock::computeInitialRegionRangeForBlock() +{ + if (inRenderFlowThread()) { + // Set our start and end regions. No regions above or below us will be considered by our children. They are + // effectively clamped to our region range. + LayoutUnit oldHeight = logicalHeight(); + LayoutUnit oldLogicalTop = logicalTop(); + setLogicalHeight(numeric_limits<LayoutUnit>::max() / 2); + computeLogicalHeight(); + enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); + setLogicalHeight(oldHeight); + setLogicalTop(oldLogicalTop); + } +} + +void RenderBlock::computeRegionRangeForBlock() +{ + if (inRenderFlowThread()) + enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); +} + void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight, BlockLayoutPass layoutPass) { ASSERT(needsLayout()); @@ -1268,22 +1290,13 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh RenderView* renderView = view(); RenderStyle* styleToUse = style(); LayoutStateMaintainer statePusher(renderView, this, locationOffset(), hasColumns() || hasTransform() || hasReflection() || styleToUse->isFlippedBlocksWritingMode(), pageLogicalHeight, pageLogicalHeightChanged, colInfo); - + if (inRenderFlowThread()) { // Regions changing widths can force us to relayout our children. if (logicalWidthChangedInRegions()) relayoutChildren = true; - - // Set our start and end regions. No regions above or below us will be considered by our children. They are - // effectively clamped to our region range. - LayoutUnit oldHeight = logicalHeight(); - LayoutUnit oldLogicalTop = logicalTop(); - setLogicalHeight(numeric_limits<LayoutUnit>::max() / 2); - computeLogicalHeight(); - enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); - setLogicalHeight(oldHeight); - setLogicalTop(oldLogicalTop); } + computeInitialRegionRangeForBlock(); // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track // our current maximal positive and negative margins. These values are used when we @@ -1313,7 +1326,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh } // For overflow:scroll blocks, ensure we have both scrollbars in place always. - if (scrollsOverflow()) { + if (scrollsOverflow() && style()->appearance() != ListboxPart) { if (styleToUse->overflowX() == OSCROLL) layer()->setHasHorizontalScrollbar(true); if (styleToUse->overflowY() == OSCROLL) @@ -1361,8 +1374,7 @@ void RenderBlock::layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeigh bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isRoot()); - if (inRenderFlowThread()) - enclosingRenderFlowThread()->setRegionRangeForBox(this, offsetFromLogicalTopOfFirstPage()); + computeRegionRangeForBlock(); // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). computeOverflow(oldClientAfterEdge); @@ -2010,7 +2022,7 @@ void RenderBlock::layoutBlockChildren(bool relayoutChildren, LayoutUnit& maxFloa setLogicalHeight(beforeEdge); // Lay out our hypothetical grid line as though it occurs at the top of the block. - if (view()->layoutState()->currentLineGrid() == this) + if (view()->layoutState()->lineGrid() == this) layoutLineGridBox(); // The margin struct caches all our current margin collapsing state. The compact struct caches state when we encounter compacts, @@ -3661,7 +3673,7 @@ inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe const FloatingObject* r = interval.data(); if (r->type() == FloatTypeValue && interval.low() <= m_value && m_value < interval.high()) { // All the objects returned from the tree should be already placed. - ASSERT(r->isPlaced() && m_renderer->logicalTopForFloat(r) <= m_value && m_renderer->logicalBottomForFloat(r) > m_value); + ASSERT(r->isPlaced() && m_renderer->pixelSnappedLogicalTopForFloat(r) <= m_value && m_renderer->pixelSnappedLogicalBottomForFloat(r) > m_value); if (FloatTypeValue == FloatingObject::FloatLeft && m_renderer->logicalRightForFloat(r) > m_offset) { @@ -3909,9 +3921,17 @@ void RenderBlock::clearFloats(BlockLayoutPass layoutPass) if (logicalWidthForFloat(f) != logicalWidthForFloat(oldFloatingObject) || logicalLeftForFloat(f) != logicalLeftForFloat(oldFloatingObject)) { changeLogicalTop = 0; changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); - } else if (logicalBottom != oldLogicalBottom) { - changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom)); - changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); + } else { + if (logicalBottom != oldLogicalBottom) { + changeLogicalTop = min(changeLogicalTop, min(logicalBottom, oldLogicalBottom)); + changeLogicalBottom = max(changeLogicalBottom, max(logicalBottom, oldLogicalBottom)); + } + LayoutUnit logicalTop = logicalTopForFloat(f); + LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject); + if (logicalTop != oldLogicalTop) { + changeLogicalTop = min(changeLogicalTop, min(logicalTop, oldLogicalTop)); + changeLogicalBottom = max(changeLogicalBottom, max(logicalTop, oldLogicalTop)); + } } floatMap.remove(f->m_renderer); diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index 2d47374d3..2ccf0aa25 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -163,6 +163,17 @@ public: return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalWidth() - logicalRightOffsetForLine(position, firstLine); } + + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + int pixelSnappedLogicalRightOffsetForLine(LayoutUnit position, bool firstLine) const + { + return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine, 0); + } + + int pixelSnappedLogicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const + { + return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine, 0); + } LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine); LayoutUnit textIndentOffset() const; @@ -448,6 +459,8 @@ protected: } #endif + void computeInitialRegionRangeForBlock(); + void computeRegionRangeForBlock(); private: virtual RenderObjectChildList* virtualChildren() { return children(); } virtual const RenderObjectChildList* virtualChildren() const { return children(); } @@ -468,6 +481,7 @@ private: void addChildToContinuation(RenderObject* newChild, RenderObject* beforeChild); void addChildIgnoringContinuation(RenderObject* newChild, RenderObject* beforeChild); void addChildToAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild); + virtual void addChildIgnoringAnonymousColumnBlocks(RenderObject* newChild, RenderObject* beforeChild = 0); virtual bool isSelfCollapsingBlock() const; @@ -558,6 +572,14 @@ private: LayoutUnit width() const { return m_frameRect.width(); } LayoutUnit height() const { return m_frameRect.height(); } + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + int pixelSnappedX() const { return x(); } + int pixelSnappedMaxX() const { return maxX(); } + int pixelSnappedY() const { return y(); } + int pixelSnappedMaxY() const { return maxY(); } + int pixelSnappedWidth() const { return width(); } + int pixelSnappedHeight() const { return height(); } + void setX(LayoutUnit x) { ASSERT(!isInPlacedTree()); m_frameRect.setX(x); } void setY(LayoutUnit y) { ASSERT(!isInPlacedTree()); m_frameRect.setY(y); } void setWidth(LayoutUnit width) { ASSERT(!isInPlacedTree()); m_frameRect.setWidth(width); } @@ -592,6 +614,12 @@ private: LayoutUnit logicalRightForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->maxX() : child->maxY(); } LayoutUnit logicalWidthForFloat(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->width() : child->height(); } + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + int pixelSnappedLogicalTopForFloat(const FloatingObject* child) const { return logicalTopForFloat(child); } + int pixelSnappedLogicalBottomForFloat(const FloatingObject* child) const { return logicalBottomForFloat(child); } + int pixelSnappedLogicalLeftForFloat(const FloatingObject* child) const { return logicalLeftForFloat(child); } + int pixelSnappedLogicalRightForFloat(const FloatingObject* child) const { return logicalRightForFloat(child); } + void setLogicalTopForFloat(FloatingObject* child, LayoutUnit logicalTop) { if (isHorizontalWritingMode()) diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp index da74ea6c3..406930fc1 100755 --- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp +++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp @@ -128,11 +128,11 @@ inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa return; if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { - m_left = m_block->logicalRightForFloat(newFloat); + m_left = m_block->pixelSnappedLogicalRightForFloat(newFloat); if (m_isFirstLine && m_block->style()->isLeftToRightDirection()) m_left += m_block->textIndentOffset(); } else { - m_right = m_block->logicalLeftForFloat(newFloat); + m_right = m_block->pixelSnappedLogicalLeftForFloat(newFloat); if (m_isFirstLine && !m_block->style()->isLeftToRightDirection()) m_right -= m_block->textIndentOffset(); } @@ -258,7 +258,7 @@ static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, boo return extraWidth; } -static void determineParagraphDirection(TextDirection& dir, InlineIterator iter) +static void determineDirectionality(TextDirection& dir, InlineIterator iter) { while (!iter.atEnd()) { if (iter.atParagraphSeparator()) @@ -970,18 +970,27 @@ static inline void constructBidiRuns(InlineBidiResolver& topResolver, BidiRunLis // tree to see which parent inline is the isolate. We could change enterIsolate // to take a RenderObject and do this logic there, but that would be a layering // violation for BidiResolver (which knows nothing about RenderObject). - RenderInline* isolatedSpan = toRenderInline(containingIsolate(startObj, currentRoot)); + RenderInline* isolatedInline = toRenderInline(containingIsolate(startObj, currentRoot)); InlineBidiResolver isolatedResolver; - isolatedResolver.setStatus(statusWithDirection(isolatedSpan->style()->direction())); + EUnicodeBidi unicodeBidi = isolatedInline->style()->unicodeBidi(); + TextDirection direction; + if (unicodeBidi == Plaintext) + determineDirectionality(direction, InlineIterator(isolatedInline, isolatedRun->object(), 0)); + else { + ASSERT(unicodeBidi == Isolate); + direction = isolatedInline->style()->direction(); + } + isolatedResolver.setStatus(statusWithDirection(direction)); // FIXME: The fact that we have to construct an Iterator here // currently prevents this code from moving into BidiResolver. - if (!bidiFirstSkippingEmptyInlines(isolatedSpan, &isolatedResolver)) + if (!bidiFirstSkippingEmptyInlines(isolatedInline, &isolatedResolver)) continue; + // The starting position is the beginning of the first run within the isolate that was identified // during the earlier call to createBidiRunsForLine. This can be but is not necessarily the // first run within the isolate. - InlineIterator iter = InlineIterator(isolatedSpan, startObj, isolatedRun->m_start); + InlineIterator iter = InlineIterator(isolatedInline, startObj, isolatedRun->m_start); isolatedResolver.setPositionIgnoringNestedIsolates(iter); // We stop at the next end of line; we may re-enter this isolate in the next call to constructBidiRuns(). @@ -1240,7 +1249,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0; end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), lineBreakIteratorInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines); if (resolver.position().atEnd()) { - // FIXME: We shouldn't be creating any runs in findNextLineBreak to begin with! + // FIXME: We shouldn't be creating any runs in nextLineBreak to begin with! // Once BidiRunList is separated from BidiResolver this will not be needed. resolver.runs().deleteRuns(); resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed). @@ -1259,7 +1268,7 @@ void RenderBlock::layoutRunsAndFloatsInRange(LineLayoutState& layoutState, Inlin if (isNewUBAParagraph && styleToUse->unicodeBidi() == Plaintext && !resolver.context()->parent()) { TextDirection direction = styleToUse->direction(); - determineParagraphDirection(direction, resolver.position()); + determineDirectionality(direction, resolver.position()); resolver.setStatus(BidiStatus(direction, styleToUse->unicodeBidi() == Override)); } // FIXME: This ownership is reversed. We should own the BidiRunList and pass it to createBidiRunsForLine. @@ -1441,7 +1450,7 @@ void RenderBlock::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repain setLogicalHeight(borderBefore() + paddingBefore()); // Lay out our hypothetical grid line as though it occurs at the top of the block. - if (view()->layoutState() && view()->layoutState()->currentLineGrid() == this) + if (view()->layoutState() && view()->layoutState()->lineGrid() == this) layoutLineGridBox(); // Figure out if we should clear out our line boxes. @@ -1668,10 +1677,8 @@ RootInlineBox* RenderBlock::determineStartPosition(LineLayoutState& layoutState, resolver.setStatus(last->lineBreakBidiStatus()); } else { TextDirection direction = style()->direction(); - if (style()->unicodeBidi() == Plaintext) { - // FIXME: Why does "unicode-bidi: plaintext" bidiFirstIncludingEmptyInlines when all other line layout code uses bidiFirstSkippingEmptyInlines? - determineParagraphDirection(direction, InlineIterator(this, bidiFirstIncludingEmptyInlines(this), 0)); - } + if (style()->unicodeBidi() == Plaintext) + determineDirectionality(direction, InlineIterator(this, bidiFirstSkippingEmptyInlines(this), 0)); resolver.setStatus(BidiStatus(direction, style()->unicodeBidi() == Override)); InlineIterator iter = InlineIterator(this, bidiFirstSkippingEmptyInlines(this, &resolver), 0); resolver.setPosition(iter, numberOfIsolateAncestors(iter)); diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 63fd6f807..f3ca0b1d1 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -478,6 +478,16 @@ LayoutUnit RenderBox::clientHeight() const return height() - borderTop() - borderBottom() - horizontalScrollbarHeight(); } +int RenderBox::pixelSnappedClientWidth() const +{ + return clientWidth(); +} + +int RenderBox::pixelSnappedClientHeight() const +{ + return clientHeight(); +} + int RenderBox::scrollWidth() const { if (hasOverflowClip()) @@ -495,7 +505,7 @@ int RenderBox::scrollHeight() const return layer()->scrollHeight(); // For objects with visible overflow, this matches IE. // FIXME: Need to work right with writing modes. - return max(clientHeight(), maxYLayoutOverflow() - borderTop()); + return max(pixelSnappedClientHeight(), maxYLayoutOverflow() - borderTop()); } int RenderBox::scrollLeft() const diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index d1637faa2..f9b852c54 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -51,6 +51,10 @@ public: LayoutUnit width() const { return m_frameRect.width(); } LayoutUnit height() const { return m_frameRect.height(); } + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + int pixelSnappedWidth() const { return m_frameRect.width(); } + int pixelSnappedHeight() const { return m_frameRect.height(); } + // These represent your location relative to your container as a physical offset. // In layout related methods you almost always want the logical location (e.g. x() and y()). LayoutUnit top() const { return topLeftLocation().y(); } @@ -183,17 +187,24 @@ public: virtual LayoutUnit offsetWidth() const { return width(); } virtual LayoutUnit offsetHeight() const { return height(); } + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + virtual int pixelSnappedOffsetWidth() const { return pixelSnappedWidth(); } + virtual int pixelSnappedOffsetHeight() const { return pixelSnappedHeight(); } + // More IE extensions. clientWidth and clientHeight represent the interior of an object // excluding border and scrollbar. clientLeft/Top are just the borderLeftWidth and borderTopWidth. LayoutUnit clientLeft() const { return borderLeft(); } LayoutUnit clientTop() const { return borderTop(); } LayoutUnit clientWidth() const; LayoutUnit clientHeight() const; - LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? clientWidth() : clientHeight(); } - LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? clientHeight() : clientWidth(); } + LayoutUnit clientLogicalWidth() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientWidth() : pixelSnappedClientHeight(); } + LayoutUnit clientLogicalHeight() const { return style()->isHorizontalWritingMode() ? pixelSnappedClientHeight() : pixelSnappedClientWidth(); } LayoutUnit clientLogicalBottom() const { return borderBefore() + clientLogicalHeight(); } LayoutRect clientBoxRect() const { return LayoutRect(clientLeft(), clientTop(), clientWidth(), clientHeight()); } + int pixelSnappedClientWidth() const; + int pixelSnappedClientHeight() const; + // scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the // object has overflow:hidden/scroll/auto specified and also has overflow. // scrollLeft/Top return the current scroll position. These methods are virtual so that objects like diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index 37eedf4fe..3aadee902 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -512,6 +512,16 @@ LayoutUnit RenderBoxModelObject::offsetTop() const return yPos; } +int RenderBoxModelObject::pixelSnappedOffsetWidth() const +{ + return offsetWidth(); +} + +int RenderBoxModelObject::pixelSnappedOffsetHeight() const +{ + return offsetHeight(); +} + LayoutUnit RenderBoxModelObject::paddingTop(bool) const { LayoutUnit w = 0; diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index bb81bd3be..027b1fb89 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -60,6 +60,12 @@ public: virtual LayoutUnit offsetWidth() const = 0; virtual LayoutUnit offsetHeight() const = 0; + // FIXME: The implementation for these functions will change once we move to subpixel layout. See bug 60318. + int pixelSnappedOffsetLeft() const { return offsetLeft(); } + int pixelSnappedOffsetTop() const { return offsetTop(); } + int pixelSnappedOffsetWidth() const; + int pixelSnappedOffsetHeight() const; + virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); virtual void updateBoxModelInfoFromStyle(); diff --git a/Source/WebCore/rendering/RenderCounter.cpp b/Source/WebCore/rendering/RenderCounter.cpp index 399da930a..0807ea9dd 100644 --- a/Source/WebCore/rendering/RenderCounter.cpp +++ b/Source/WebCore/rendering/RenderCounter.cpp @@ -301,7 +301,7 @@ static bool planCounter(RenderObject* object, const AtomicString& identifier, bo // reset node. // - Non-reset CounterNodes cannot have descendants. -static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString& identifier, bool isReset, CounterNode*& parent, CounterNode*& previousSibling) +static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString& identifier, bool isReset, RefPtr<CounterNode>& parent, RefPtr<CounterNode>& previousSibling) { // We cannot stop searching for counters with the same identifier before we also // check this renderer, because it may affect the positioning in the tree of our counter. @@ -346,7 +346,9 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString& if (!isReset || !areRenderersElementsSiblings(currentRenderer, counterOwner)) { // If the node we are placing is not reset or we have found a counter that is attached // to an ancestor of the placed counter's owner renderer we know we are a sibling of that node. - ASSERT(currentCounter->parent() == previousSiblingProtector->parent()); + if (currentCounter->parent() != previousSiblingProtector->parent()) + return false; + parent = currentCounter->parent(); previousSibling = previousSiblingProtector.get(); return true; @@ -428,11 +430,11 @@ static CounterNode* makeCounterNode(RenderObject* object, const AtomicString& id if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter) return 0; - CounterNode* newParent = 0; - CounterNode* newPreviousSibling = 0; + RefPtr<CounterNode> newParent = 0; + RefPtr<CounterNode> newPreviousSibling = 0; RefPtr<CounterNode> newNode = CounterNode::create(object, isReset, value); if (findPlaceForCounter(object, identifier, isReset, newParent, newPreviousSibling)) - newParent->insertAfter(newNode.get(), newPreviousSibling, identifier); + newParent->insertAfter(newNode.get(), newPreviousSibling.get(), identifier); CounterMap* nodeMap; if (object->hasCounterNodeMap()) nodeMap = counterMaps().get(object); @@ -628,8 +630,8 @@ static void updateCounters(RenderObject* renderer) makeCounterNode(renderer, AtomicString(it->first.get()), false); continue; } - CounterNode* newParent = 0; - CounterNode* newPreviousSibling; + RefPtr<CounterNode> newParent = 0; + RefPtr<CounterNode> newPreviousSibling = 0; findPlaceForCounter(renderer, AtomicString(it->first.get()), node->hasResetType(), newParent, newPreviousSibling); if (node != counterMap->get(it->first.get())) @@ -640,7 +642,7 @@ static void updateCounters(RenderObject* renderer) if (parent) parent->removeChild(node.get()); if (newParent) - newParent->insertAfter(node.get(), newPreviousSibling, it->first.get()); + newParent->insertAfter(node.get(), newPreviousSibling.get(), it->first.get()); } } diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp index 3342fc590..4e88d5c6b 100644 --- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp @@ -228,6 +228,13 @@ void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); + if (inRenderFlowThread()) { + // Regions changing widths can force us to relayout our children. + if (logicalWidthChangedInRegions()) + relayoutChildren = true; + } + computeInitialRegionRangeForBlock(); + LayoutSize previousSize = size(); computeLogicalWidth(); @@ -267,6 +274,8 @@ void RenderDeprecatedFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit bool needAnotherLayoutPass = layoutPositionedObjects(relayoutChildren || isRoot()); + computeRegionRangeForBlock(); + if (!isFloatingOrPositioned() && height() == 0) { // We are a block with no border and padding and a computed height // of 0. The CSS spec states that zero-height blocks collapse their margins diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 45543fe90..b025cd317 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -166,6 +166,13 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int, BlockLayoutPass) LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); LayoutStateMaintainer statePusher(view(), this, IntSize(x(), y()), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode()); + if (inRenderFlowThread()) { + // Regions changing widths can force us to relayout our children. + if (logicalWidthChangedInRegions()) + relayoutChildren = true; + } + computeInitialRegionRangeForBlock(); + IntSize previousSize = size(); setLogicalHeight(0); @@ -193,6 +200,8 @@ void RenderFlexibleBox::layoutBlock(bool relayoutChildren, int, BlockLayoutPass) layoutPositionedObjects(relayoutChildren || isRoot()); + computeRegionRangeForBlock(); + // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflow than it needs to. computeOverflow(oldClientAfterEdge); statePusher.pop(); @@ -444,7 +453,7 @@ LayoutUnit RenderFlexibleBox::mainAxisScrollbarExtentForChild(RenderBox* child) return isHorizontalFlow() ? child->verticalScrollbarWidth() : child->horizontalScrollbarHeight(); } -LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForFlexItem(RenderBox* child) const +LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child) const { Length mainAxisLength = mainAxisLengthForChild(child); if (mainAxisLength.isAuto()) { @@ -456,12 +465,15 @@ LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForFlexItem(RenderBo void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren) { - LayoutUnit preferredMainAxisExtent; float totalPositiveFlexibility; float totalNegativeFlexibility; TreeOrderIterator treeIterator(this); - computePreferredMainAxisExtent(relayoutChildren, treeIterator, preferredMainAxisExtent, totalPositiveFlexibility, totalNegativeFlexibility); + WTF::Vector<LayoutUnit> preferredSizes; + computeMainAxisPreferredSizes(relayoutChildren, treeIterator, preferredSizes, totalPositiveFlexibility, totalNegativeFlexibility); + LayoutUnit preferredMainAxisExtent = 0; + for (size_t i = 0; i < preferredSizes.size(); ++i) + preferredMainAxisExtent += preferredSizes[i]; LayoutUnit availableFreeSpace = mainAxisContentExtent() - preferredMainAxisExtent; FlexOrderIterator flexIterator(this, treeIterator.flexOrderValues()); @@ -500,15 +512,16 @@ LayoutUnit RenderFlexibleBox::marginBoxAscent(RenderBox* child) return ascent + flowAwareMarginBeforeForChild(child); } -void RenderFlexibleBox::computePreferredMainAxisExtent(bool relayoutChildren, TreeOrderIterator& iterator, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility) +void RenderFlexibleBox::computeMainAxisPreferredSizes(bool relayoutChildren, TreeOrderIterator& iterator, WTF::Vector<LayoutUnit>& preferredSizes, float& totalPositiveFlexibility, float& totalNegativeFlexibility) { - preferredMainAxisExtent = 0; totalPositiveFlexibility = totalNegativeFlexibility = 0; LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); for (RenderBox* child = iterator.first(); child; child = iterator.next()) { - if (child->isPositioned()) + if (child->isPositioned()) { + preferredSizes.append(0); continue; + } child->clearOverrideSize(); if (mainAxisLengthForChild(child).isAuto()) { @@ -517,21 +530,22 @@ void RenderFlexibleBox::computePreferredMainAxisExtent(bool relayoutChildren, Tr child->layoutIfNeeded(); } + LayoutUnit preferredSize = mainAxisBorderAndPaddingExtentForChild(child) + preferredMainAxisContentExtentForChild(child); + // We set the margins because we want to make sure 'auto' has a margin // of 0 and because if we're not auto sizing, we don't do a layout that // computes the start/end margins. if (isHorizontalFlow()) { child->setMarginLeft(child->style()->marginLeft().calcMinValue(flexboxAvailableContentExtent)); child->setMarginRight(child->style()->marginRight().calcMinValue(flexboxAvailableContentExtent)); - preferredMainAxisExtent += child->marginLeft() + child->marginRight(); + preferredSize += child->marginLeft() + child->marginRight(); } else { child->setMarginTop(child->style()->marginTop().calcMinValue(flexboxAvailableContentExtent)); child->setMarginBottom(child->style()->marginBottom().calcMinValue(flexboxAvailableContentExtent)); - preferredMainAxisExtent += child->marginTop() + child->marginBottom(); + preferredSize += child->marginTop() + child->marginBottom(); } - preferredMainAxisExtent += mainAxisBorderAndPaddingExtentForChild(child); - preferredMainAxisExtent += preferredMainAxisContentExtentForFlexItem(child); + preferredSizes.append(preferredSize); totalPositiveFlexibility += positiveFlexForChild(child); totalNegativeFlexibility += negativeFlexForChild(child); @@ -554,14 +568,14 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithm(FlexOrderIterator& itera if (inflexibleItems.contains(child)) childPreferredSize = inflexibleItems.get(child); else { - childPreferredSize = preferredMainAxisContentExtentForFlexItem(child); + childPreferredSize = preferredMainAxisContentExtentForChild(child); if (availableFreeSpace > 0 && totalPositiveFlexibility > 0) { childPreferredSize += lroundf(availableFreeSpace * positiveFlexForChild(child) / totalPositiveFlexibility); Length childLogicalMaxWidth = isHorizontalFlow() ? child->style()->maxWidth() : child->style()->maxHeight(); if (!childLogicalMaxWidth.isUndefined() && childLogicalMaxWidth.isSpecified() && childPreferredSize > childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent)) { childPreferredSize = childLogicalMaxWidth.calcValue(flexboxAvailableContentExtent); - availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForFlexItem(child); + availableFreeSpace -= childPreferredSize - preferredMainAxisContentExtentForChild(child); totalPositiveFlexibility -= positiveFlexForChild(child); inflexibleItems.set(child, childPreferredSize); @@ -573,7 +587,7 @@ bool RenderFlexibleBox::runFreeSpaceAllocationAlgorithm(FlexOrderIterator& itera Length childLogicalMinWidth = isHorizontalFlow() ? child->style()->minWidth() : child->style()->minHeight(); if (!childLogicalMinWidth.isUndefined() && childLogicalMinWidth.isSpecified() && childPreferredSize < childLogicalMinWidth.calcValue(flexboxAvailableContentExtent)) { childPreferredSize = childLogicalMinWidth.calcValue(flexboxAvailableContentExtent); - availableFreeSpace += preferredMainAxisContentExtentForFlexItem(child) - childPreferredSize; + availableFreeSpace += preferredMainAxisContentExtentForChild(child) - childPreferredSize; totalNegativeFlexibility -= negativeFlexForChild(child); inflexibleItems.set(child, childPreferredSize); diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 3ec4c2a6b..0833217b6 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -85,7 +85,7 @@ private: void adjustAlignmentForChild(RenderBox* child, LayoutUnit); LayoutUnit mainAxisBorderAndPaddingExtentForChild(RenderBox* child) const; LayoutUnit mainAxisScrollbarExtentForChild(RenderBox* child) const; - LayoutUnit preferredMainAxisContentExtentForFlexItem(RenderBox* child) const; + LayoutUnit preferredMainAxisContentExtentForChild(RenderBox* child) const; void layoutFlexItems(bool relayoutChildren); @@ -95,7 +95,7 @@ private: LayoutUnit availableAlignmentSpaceForChild(RenderBox*); LayoutUnit marginBoxAscent(RenderBox*); - void computePreferredMainAxisExtent(bool relayoutChildren, TreeOrderIterator&, LayoutUnit&, float& totalPositiveFlexibility, float& totalNegativeFlexibility); + void computeMainAxisPreferredSizes(bool relayoutChildren, TreeOrderIterator&, WTF::Vector<LayoutUnit>&, float& totalPositiveFlexibility, float& totalNegativeFlexibility); bool runFreeSpaceAllocationAlgorithm(FlexOrderIterator&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize); void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset); diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp index 8539a1208..9e39d9607 100644 --- a/Source/WebCore/rendering/RenderFlowThread.cpp +++ b/Source/WebCore/rendering/RenderFlowThread.cpp @@ -204,6 +204,7 @@ void RenderFlowThread::addRegionToThread(RenderRegion* renderRegion) void RenderFlowThread::removeRegionFromThread(RenderRegion* renderRegion) { ASSERT(renderRegion); + m_regionRangeMap.clear(); m_regionList.remove(renderRegion); @@ -653,7 +654,7 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box) RenderRegion* startRegion; RenderRegion* endRegion; getRegionRangeForBox(box, startRegion, endRegion); - + for (RenderRegionList::iterator iter = m_regionList.find(startRegion); iter != m_regionList.end(); ++iter) { RenderRegion* region = *iter; if (!region->isValid()) @@ -662,7 +663,17 @@ void RenderFlowThread::removeRenderBoxRegionInfo(RenderBox* box) if (region == endRegion) break; } - + +#ifndef NDEBUG + // We have to make sure we did not left any boxes with region info attached in regions. + for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { + RenderRegion* region = *iter; + if (!region->isValid()) + continue; + ASSERT(!region->renderBoxRegionInfo(box)); + } +#endif + m_regionRangeMap.remove(box); } diff --git a/Source/WebCore/rendering/RenderFrameSet.cpp b/Source/WebCore/rendering/RenderFrameSet.cpp index 6b6d23981..fc2c97f17 100644 --- a/Source/WebCore/rendering/RenderFrameSet.cpp +++ b/Source/WebCore/rendering/RenderFrameSet.cpp @@ -80,7 +80,7 @@ static Color borderFillColor() return Color(208, 208, 208); } -void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const IntRect& borderRect) +void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const LayoutRect& borderRect) { if (!paintInfo.rect.intersects(borderRect)) return; @@ -100,7 +100,7 @@ void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const IntRect } } -void RenderFrameSet::paintRowBorder(const PaintInfo& paintInfo, const IntRect& borderRect) +void RenderFrameSet::paintRowBorder(const PaintInfo& paintInfo, const LayoutRect& borderRect) { if (!paintInfo.rect.intersects(borderRect)) return; diff --git a/Source/WebCore/rendering/RenderFrameSet.h b/Source/WebCore/rendering/RenderFrameSet.h index 63ae2a824..373d0d02c 100644 --- a/Source/WebCore/rendering/RenderFrameSet.h +++ b/Source/WebCore/rendering/RenderFrameSet.h @@ -119,8 +119,8 @@ private: void startResizing(GridAxis&, int position); void continueResizing(GridAxis&, int position); - void paintRowBorder(const PaintInfo&, const IntRect&); - void paintColumnBorder(const PaintInfo&, const IntRect&); + void paintRowBorder(const PaintInfo&, const LayoutRect&); + void paintColumnBorder(const PaintInfo&, const LayoutRect&); RenderObjectChildList m_children; diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 12a9dfcf8..a4d95c003 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -383,7 +383,7 @@ void RenderInline::splitFlow(RenderObject* beforeChild, RenderBlock* newBlockBox madeNewBeforeBlock = true; } - RenderBlock* post = block->createAnonymousBlock(); + RenderBlock* post = block->createAnonymousBlockWithSameTypeAs(pre); RenderObject* boxFirst = madeNewBeforeBlock ? block->firstChild() : pre->nextSibling(); if (madeNewBeforeBlock) diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index d06b30d7d..ee6e8beea 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -45,7 +45,6 @@ #include "RenderLayer.h" #include "ColumnInfo.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSPropertyNames.h" #include "CSSStyleSelector.h" #include "Chrome.h" @@ -67,6 +66,7 @@ #include "FrameView.h" #include "Gradient.h" #include "GraphicsContext.h" +#include "HTMLFrameElement.h" #include "HTMLFrameOwnerElement.h" #include "HTMLNames.h" #include "HitTestingTransformState.h" @@ -90,6 +90,7 @@ #include "ScrollbarTheme.h" #include "Settings.h" #include "SourceGraphic.h" +#include "StylePropertySet.h" #include "TextStream.h" #include "TransformationMatrix.h" #include "TranslateTransformOperation.h" @@ -184,7 +185,6 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer) , m_reflection(0) , m_scrollCorner(0) , m_resizer(0) - , m_scrollableAreaPage(0) { m_isNormalFlowOnly = shouldBeNormalFlowOnly(); @@ -203,8 +203,10 @@ RenderLayer::~RenderLayer() frame->eventHandler()->resizeLayerDestroyed(); } - if (m_scrollableAreaPage) - m_scrollableAreaPage->removeScrollableArea(this); + if (Frame* frame = renderer()->frame()) { + if (FrameView* frameView = frame->view()) + frameView->removeScrollableArea(this); + } destroyScrollbar(HorizontalScrollbar); destroyScrollbar(VerticalScrollbar); @@ -884,6 +886,11 @@ RenderLayer* RenderLayer::enclosingScrollableLayer() const return 0; } +IntRect RenderLayer::scrollableAreaBoundingBox() const +{ + return renderer()->absoluteBoundingBoxRect(); +} + RenderLayer* RenderLayer::enclosingTransformedAncestor() const { RenderLayer* curr = parent(); @@ -1542,20 +1549,31 @@ void RenderLayer::scrollRectToVisible(const LayoutRect& rect, const ScrollAlignm } } else if (!parentLayer && renderer()->isBox() && renderBox()->canBeProgramaticallyScrolled()) { if (frameView) { - if (renderer()->document() && renderer()->document()->ownerElement() && renderer()->document()->ownerElement()->renderer()) { - LayoutRect viewRect = frameView->visibleContentRect(); - LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); - - LayoutUnit xOffset = r.x(); - LayoutUnit yOffset = r.y(); - // Adjust offsets if they're outside of the allowable range. - xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset)); - yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset)); - - frameView->setScrollPosition(IntPoint(xOffset, yOffset)); - parentLayer = renderer()->document()->ownerElement()->renderer()->enclosingLayer(); - newRect.setX(rect.x() - frameView->scrollX() + frameView->x()); - newRect.setY(rect.y() - frameView->scrollY() + frameView->y()); + Element* ownerElement = 0; + if (renderer()->document()) + ownerElement = renderer()->document()->ownerElement(); + + if (ownerElement && ownerElement->renderer()) { + HTMLFrameElement* frameElement = 0; + + if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) + frameElement = static_cast<HTMLFrameElement*>(ownerElement); + + if (frameElement && frameElement->scrollingMode() != ScrollbarAlwaysOff) { + LayoutRect viewRect = frameView->visibleContentRect(); + LayoutRect exposeRect = getRectToExpose(viewRect, rect, alignX, alignY); + + LayoutUnit xOffset = exposeRect.x(); + LayoutUnit yOffset = exposeRect.y(); + // Adjust offsets if they're outside of the allowable range. + xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset)); + yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset)); + + frameView->setScrollPosition(IntPoint(xOffset, yOffset)); + parentLayer = ownerElement->renderer()->enclosingLayer(); + newRect.setX(rect.x() - frameView->scrollX() + frameView->x()); + newRect.setY(rect.y() - frameView->scrollY() + frameView->y()); + } } else { LayoutRect viewRect = frameView->visibleContentRect(); LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); @@ -1707,7 +1725,7 @@ void RenderLayer::resize(const PlatformMouseEvent& evt, const LayoutSize& oldOff LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize; ASSERT(element->isStyledElement()); - CSSMutableStyleDeclaration* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); + StylePropertySet* styleDeclaration = static_cast<StyledElement*>(element)->ensureInlineStyleDecl(); bool isBoxSizingBorder = renderer->style()->boxSizing() == BORDER_BOX; if (resize != RESIZE_VERTICAL && difference.width()) { @@ -2043,19 +2061,6 @@ bool RenderLayer::allowsScrolling() const return (m_hBar && m_hBar->enabled()) || (m_vBar && m_vBar->enabled()); } -void RenderLayer::didAddHorizontalScrollbar(Scrollbar* scrollbar) -{ - m_renderer->document()->didAddWheelEventHandler(); - ScrollableArea::didAddHorizontalScrollbar(scrollbar); -} - -void RenderLayer::willRemoveHorizontalScrollbar(Scrollbar* scrollbar) -{ - ScrollableArea::willRemoveHorizontalScrollbar(scrollbar); - // FIXME: maybe need a separate ScrollableArea::didRemoveHorizontalScrollbar callback? - m_renderer->document()->didRemoveWheelEventHandler(); -} - void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar) { if (hasScrollbar == (m_hBar != 0)) @@ -2208,6 +2213,16 @@ LayoutUnit RenderLayer::scrollHeight() return m_scrollSize.height(); } +int RenderLayer::pixelSnappedScrollWidth() +{ + return scrollWidth(); +} + +int RenderLayer::pixelSnappedScrollHeight() +{ + return scrollHeight(); +} + LayoutUnit RenderLayer::overflowTop() const { RenderBox* box = renderBox(); @@ -2256,9 +2271,9 @@ void RenderLayer::computeScrollDimensions(bool* needHBar, bool* needVBar) setScrollOrigin(IntPoint(-m_scrollOverflow.width(), -m_scrollOverflow.height())); if (needHBar) - *needHBar = m_scrollSize.width() > box->clientWidth(); + *needHBar = pixelSnappedScrollWidth() > box->pixelSnappedClientWidth(); if (needVBar) - *needVBar = m_scrollSize.height() > box->clientHeight(); + *needVBar = pixelSnappedScrollHeight() > box->pixelSnappedClientHeight(); } void RenderLayer::updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow) @@ -2309,9 +2324,9 @@ void RenderLayer::updateScrollInfoAfterLayout() bool haveVerticalBar = m_vBar; // overflow:scroll should just enable/disable. - if (renderer()->style()->overflowX() == OSCROLL) + if (m_hBar && renderer()->style()->overflowX() == OSCROLL) m_hBar->setEnabled(horizontalOverflow); - if (renderer()->style()->overflowY() == OSCROLL) + if (m_vBar && renderer()->style()->overflowY() == OSCROLL) m_vBar->setEnabled(verticalOverflow); // A dynamic change from a scrolling overflow to overflow:hidden means we need to get rid of any @@ -2363,14 +2378,14 @@ void RenderLayer::updateScrollInfoAfterLayout() // Set up the range (and page step/line step). if (m_hBar) { - LayoutUnit clientWidth = box->clientWidth(); - LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); + int clientWidth = box->pixelSnappedClientWidth(); + int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_hBar->setProportion(clientWidth, m_scrollSize.width()); } if (m_vBar) { - LayoutUnit clientHeight = box->clientHeight(); - LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); + int clientHeight = box->pixelSnappedClientHeight(); + int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); m_vBar->setProportion(clientHeight, m_scrollSize.height()); } @@ -4334,19 +4349,14 @@ void RenderLayer::styleChanged(StyleDifference, const RenderStyle* oldStyle) #if ENABLE(CSS_FILTERS) updateOrRemoveFilterEffect(); #endif - - if (scrollsOverflow()) { - if (!m_scrollableAreaPage) { - if (Frame* frame = renderer()->frame()) { - if (Page* page = frame->page()) { - m_scrollableAreaPage = page; - m_scrollableAreaPage->addScrollableArea(this); - } - } + + if (Frame* frame = renderer()->frame()) { + if (FrameView* frameView = frame->view()) { + if (scrollsOverflow()) + frameView->addScrollableArea(this); + else + frameView->removeScrollableArea(this); } - } else if (m_scrollableAreaPage) { - m_scrollableAreaPage->removeScrollableArea(this); - m_scrollableAreaPage = 0; } // FIXME: Need to detect a swap from custom to native scrollbars (and vice versa). diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index de75f245d..bb4797bb2 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -282,6 +282,8 @@ public: LayoutUnit scrollWidth(); LayoutUnit scrollHeight(); + int pixelSnappedScrollWidth(); + int pixelSnappedScrollHeight(); void panScrollFromPoint(const LayoutPoint&); @@ -310,8 +312,6 @@ public: bool scrollsOverflow() const; bool allowsScrolling() const; // Returns true if at least one scrollbar is visible and enabled. bool hasScrollbars() const { return m_hBar || m_vBar; } - virtual void didAddHorizontalScrollbar(Scrollbar*); - virtual void willRemoveHorizontalScrollbar(Scrollbar*); void setHasHorizontalScrollbar(bool); void setHasVerticalScrollbar(bool); @@ -664,12 +664,11 @@ private: virtual IntPoint currentMousePosition() const; virtual bool shouldSuspendScrollAnimations() const; virtual bool isOnActivePage() const; + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // Rectangle encompassing the scroll corner and resizer rect. IntRect scrollCornerAndResizerRect() const; - virtual void disconnectFromPage() { m_scrollableAreaPage = 0; } - // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. void scrollTo(int, int); @@ -868,8 +867,6 @@ private: #if USE(ACCELERATED_COMPOSITING) OwnPtr<RenderLayerBacking> m_backing; #endif - - Page* m_scrollableAreaPage; // Page on which this is registered as a scrollable area. }; inline void RenderLayer::updateZOrderLists() diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index b85b807f1..5c0ab779f 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -50,6 +50,7 @@ #include "RenderReplica.h" #include "RenderVideo.h" #include "RenderView.h" +#include "ScrollbarTheme.h" #include "Settings.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) @@ -971,11 +972,6 @@ void RenderLayerCompositor::frameViewDidChangeSize() if (m_layerForOverhangAreas) m_layerForOverhangAreas->setSize(frameView->frameRect().size()); #endif - -#if ENABLE(THREADED_SCROLLING) - if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) - scrollingCoordinator->syncFrameViewGeometry(frameView); -#endif } } @@ -1236,9 +1232,16 @@ void RenderLayerCompositor::updateRootLayerPosition() m_clipLayer->setSize(frameView->visibleContentRect(false /* exclude scrollbars */).size()); } -#if ENABLE(THREADED_SCROLLING) - if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) - scrollingCoordinator->syncFrameViewGeometry(m_renderView->frameView()); +#if ENABLE(RUBBER_BANDING) + if (m_contentShadowLayer) { + m_contentShadowLayer->setPosition(m_rootContentLayer->position()); + + FloatSize rootContentLayerSize = m_rootContentLayer->size(); + if (m_contentShadowLayer->size() != rootContentLayerSize) { + m_contentShadowLayer->setSize(rootContentLayerSize); + ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get()); + } + } #endif } @@ -1270,7 +1273,7 @@ bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame() const // Parent document content needs to be able to render on top of a composited frame, so correct behavior // is to have the parent document become composited too. However, this can cause problems on platforms that // use native views for frames (like Mac), so disable that behavior on those platforms for now. - HTMLFrameOwnerElement* ownerElement = enclosingFrameElement(); + HTMLFrameOwnerElement* ownerElement = m_renderView->document()->ownerElement(); RenderObject* renderer = ownerElement ? ownerElement->renderer() : 0; // If we are the top-level frame, don't propagate. @@ -1301,14 +1304,6 @@ bool RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame() const return false; } -HTMLFrameOwnerElement* RenderLayerCompositor::enclosingFrameElement() const -{ - if (HTMLFrameOwnerElement* ownerElement = m_renderView->document()->ownerElement()) - return (ownerElement->hasTagName(iframeTag) || ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(objectTag)) ? ownerElement : 0; - - return 0; -} - bool RenderLayerCompositor::needsToBeComposited(const RenderLayer* layer) const { if (!canBeComposited(layer)) @@ -1739,6 +1734,21 @@ bool RenderLayerCompositor::requiresOverhangAreasLayer() const return false; } + +bool RenderLayerCompositor::requiresContentShadowLayer() const +{ + // We don't want a layer if this is a subframe. + if (m_renderView->document()->ownerElement()) + return false; + +#if PLATFORM(MAC) && ENABLE(THREADED_SCROLLING) + // On Mac, we want a content shadow layer if we have a scrolling coordinator. + if (scrollingCoordinator()) + return true; +#endif + + return false; +} #endif void RenderLayerCompositor::updateOverflowControlsLayers() @@ -1753,6 +1763,8 @@ void RenderLayerCompositor::updateOverflowControlsLayers() m_layerForOverhangAreas->setDrawsContent(false); m_layerForOverhangAreas->setSize(m_renderView->frameView()->frameRect().size()); + ScrollbarTheme::theme()->setUpOverhangAreasLayerContents(m_layerForOverhangAreas.get()); + // We want the overhang areas layer to be positioned below the frame contents, // so insert it below the clip layer. m_overflowControlsHostLayer->addChildBelow(m_layerForOverhangAreas.get(), m_clipLayer.get()); @@ -1761,6 +1773,23 @@ void RenderLayerCompositor::updateOverflowControlsLayers() m_layerForOverhangAreas->removeFromParent(); m_layerForOverhangAreas = nullptr; } + + if (requiresContentShadowLayer()) { + if (!m_contentShadowLayer) { + m_contentShadowLayer = GraphicsLayer::create(this); +#ifndef NDEBUG + m_contentShadowLayer->setName("content shadow"); +#endif + m_contentShadowLayer->setSize(m_rootContentLayer->size()); + m_contentShadowLayer->setPosition(m_rootContentLayer->position()); + ScrollbarTheme::theme()->setUpContentShadowLayer(m_contentShadowLayer.get()); + + m_scrollLayer->addChildBelow(m_contentShadowLayer.get(), m_rootContentLayer.get()); + } + } else if (m_contentShadowLayer) { + m_contentShadowLayer->removeFromParent(); + m_contentShadowLayer = nullptr; + } #endif if (requiresHorizontalScrollbarLayer()) { diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index 167d5a875..00518f3df 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -178,8 +178,6 @@ public: static bool allowsIndependentlyCompositedFrames(const FrameView*); bool shouldPropagateCompositingToEnclosingFrame() const; - HTMLFrameOwnerElement* enclosingFrameElement() const; - static RenderLayerCompositor* frameContentsCompositor(RenderPart*); // Return true if the layers changed. static bool parentFrameContentLayers(RenderPart*); @@ -293,6 +291,7 @@ private: bool requiresScrollCornerLayer() const; #if ENABLE(RUBBER_BANDING) bool requiresOverhangAreasLayer() const; + bool requiresContentShadowLayer() const; #endif #if ENABLE(THREADED_SCROLLING) @@ -339,6 +338,7 @@ private: OwnPtr<GraphicsLayer> m_layerForScrollCorner; #if ENABLE(RUBBER_BANDING) OwnPtr<GraphicsLayer> m_layerForOverhangAreas; + OwnPtr<GraphicsLayer> m_contentShadowLayer; #endif #if PROFILE_LAYER_REBUILD int m_rootLayerUpdateCount; diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp index 1c001eddd..d47a1801e 100644 --- a/Source/WebCore/rendering/RenderListBox.cpp +++ b/Source/WebCore/rendering/RenderListBox.cpp @@ -92,17 +92,17 @@ RenderListBox::RenderListBox(Element* element) ASSERT(element); ASSERT(element->isHTMLElement()); ASSERT(element->hasTagName(HTMLNames::selectTag)); - if (Page* page = frame()->page()) { - m_page = page; - m_page->addScrollableArea(this); - } + + if (FrameView* frameView = frame()->view()) + frameView->addScrollableArea(this); } RenderListBox::~RenderListBox() { setHasVerticalScrollbar(false); - if (m_page) - m_page->removeScrollableArea(this); + + if (FrameView* frameView = frame()->view()) + frameView->removeScrollableArea(this); } void RenderListBox::updateFromElement() @@ -651,7 +651,7 @@ LayoutUnit RenderListBox::scrollWidth() const int RenderListBox::scrollHeight() const { - return max(clientHeight(), listHeight()); + return max(pixelSnappedClientHeight(), listHeight()); } int RenderListBox::scrollLeft() const @@ -821,6 +821,11 @@ ScrollableArea* RenderListBox::enclosingScrollableArea() const return 0; } +IntRect RenderListBox::scrollableAreaBoundingBox() const +{ + return absoluteBoundingBoxRect(); +} + PassRefPtr<Scrollbar> RenderListBox::createScrollbar() { RefPtr<Scrollbar> widget; diff --git a/Source/WebCore/rendering/RenderListBox.h b/Source/WebCore/rendering/RenderListBox.h index 4d8b35faf..e63e00386 100644 --- a/Source/WebCore/rendering/RenderListBox.h +++ b/Source/WebCore/rendering/RenderListBox.h @@ -120,8 +120,7 @@ private: virtual bool isOnActivePage() const; virtual ScrollableArea* enclosingScrollableArea() const; - - virtual void disconnectFromPage() { m_page = 0; } + virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea. void scrollTo(int newOffset); @@ -147,8 +146,6 @@ private: int m_indexOffset; RefPtr<Scrollbar> m_vBar; - - Page* m_page; }; inline RenderListBox* toRenderListBox(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderListMarker.cpp b/Source/WebCore/rendering/RenderListMarker.cpp index 13dad9814..e7f85283a 100644 --- a/Source/WebCore/rendering/RenderListMarker.cpp +++ b/Source/WebCore/rendering/RenderListMarker.cpp @@ -1534,14 +1534,14 @@ void RenderListMarker::updateMargins() style()->setMarginEnd(Length(marginEnd, Fixed)); } -int RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +LayoutUnit RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { if (!isImage()) return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLineBoxes); return RenderBox::lineHeight(firstLine, direction, linePositionMode); } -int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +LayoutUnit RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { if (!isImage()) return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes); diff --git a/Source/WebCore/rendering/RenderListMarker.h b/Source/WebCore/rendering/RenderListMarker.h index 00a2c5a12..50e666dbf 100644 --- a/Source/WebCore/rendering/RenderListMarker.h +++ b/Source/WebCore/rendering/RenderListMarker.h @@ -58,8 +58,8 @@ private: virtual InlineBox* createInlineBox(); - virtual int lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; bool isImage() const; bool isText() const { return !isImage(); } diff --git a/Source/WebCore/rendering/RenderMenuList.h b/Source/WebCore/rendering/RenderMenuList.h index d06a9c919..b6f44364f 100644 --- a/Source/WebCore/rendering/RenderMenuList.h +++ b/Source/WebCore/rendering/RenderMenuList.h @@ -91,8 +91,8 @@ private: virtual PopupMenuStyle menuStyle() const OVERRIDE; virtual int clientInsetLeft() const OVERRIDE; virtual int clientInsetRight() const OVERRIDE; - virtual int clientPaddingLeft() const OVERRIDE; - virtual int clientPaddingRight() const OVERRIDE; + virtual LayoutUnit clientPaddingLeft() const OVERRIDE; + virtual LayoutUnit clientPaddingRight() const OVERRIDE; virtual int listSize() const OVERRIDE; virtual int selectedIndex() const OVERRIDE; virtual void popupDidHide() OVERRIDE; diff --git a/Source/WebCore/rendering/RenderRegion.cpp b/Source/WebCore/rendering/RenderRegion.cpp index b1abd83bd..8df1ced4c 100644 --- a/Source/WebCore/rendering/RenderRegion.cpp +++ b/Source/WebCore/rendering/RenderRegion.cpp @@ -13,7 +13,7 @@ * disclaimer in the documentation and/or other materials * provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS†AND ANY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "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 HOLDER BE @@ -47,9 +47,6 @@ RenderRegion::RenderRegion(Node* node, RenderFlowThread* flowThread) , m_parentFlowThread(0) , m_isValid(false) , m_hasCustomRegionStyle(false) -#ifndef NDEBUG - , m_insideRegionPaint(false) -#endif { } @@ -145,17 +142,9 @@ void RenderRegion::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintO page->addRelevantRepaintedObject(this, paintInfo.rect); } -#ifndef NDEBUG - m_insideRegionPaint = true; -#endif - setRegionBoxesRegionStyle(); m_flowThread->paintIntoRegion(paintInfo, this, LayoutPoint(paintOffset.x() + borderLeft() + paddingLeft(), paintOffset.y() + borderTop() + paddingTop())); restoreRegionBoxesOriginalStyle(); - -#ifndef NDEBUG - m_insideRegionPaint = false; -#endif } // Hit Testing diff --git a/Source/WebCore/rendering/RenderRegion.h b/Source/WebCore/rendering/RenderRegion.h index 913c42e09..6bdcdf672 100644 --- a/Source/WebCore/rendering/RenderRegion.h +++ b/Source/WebCore/rendering/RenderRegion.h @@ -109,10 +109,6 @@ private: bool m_isValid; bool m_hasCustomRegionStyle; - -#ifndef NDEBUG - bool m_insideRegionPaint; -#endif }; inline RenderRegion* toRenderRegion(RenderObject* object) diff --git a/Source/WebCore/rendering/RenderSlider.cpp b/Source/WebCore/rendering/RenderSlider.cpp index 07395f98b..e1d6ccc52 100644 --- a/Source/WebCore/rendering/RenderSlider.cpp +++ b/Source/WebCore/rendering/RenderSlider.cpp @@ -59,7 +59,7 @@ RenderSlider::~RenderSlider() { } -int RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const +LayoutUnit RenderSlider::baselinePosition(FontBaseline, bool /*firstLine*/, LineDirectionMode, LinePositionMode) const { // FIXME: Patch this function for writing-mode. return height() + marginTop(); diff --git a/Source/WebCore/rendering/RenderSlider.h b/Source/WebCore/rendering/RenderSlider.h index c1261bb26..5709e2d13 100644 --- a/Source/WebCore/rendering/RenderSlider.h +++ b/Source/WebCore/rendering/RenderSlider.h @@ -40,7 +40,7 @@ namespace WebCore { virtual const char* renderName() const { return "RenderSlider"; } virtual bool isSlider() const { return true; } - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void computePreferredLogicalWidths(); virtual bool requiresForcedStyleRecalcPropagation() const { return true; } virtual void layout(); diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 1557c3f16..fd55a6321 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -277,7 +277,7 @@ void RenderTableSection::addCell(RenderTableCell* cell, RenderTableRow* row) void RenderTableSection::setCellLogicalWidths() { - Vector<LayoutUnit>& columnPos = table()->columnPositions(); + Vector<int>& columnPos = table()->columnPositions(); LayoutStateMaintainer statePusher(view()); @@ -296,8 +296,8 @@ void RenderTableSection::setCellLogicalWidths() cspan -= table()->columns()[endCol].span; endCol++; } - LayoutUnit w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing(); - LayoutUnit oldLogicalWidth = cell->logicalWidth(); + int w = columnPos[endCol] - columnPos[j] - table()->hBorderSpacing(); + int oldLogicalWidth = cell->logicalWidth(); if (w != oldLogicalWidth) { cell->setNeedsLayout(true); if (!table()->selfNeedsLayout() && cell->checkForRepaintDuringLayout()) { @@ -316,7 +316,7 @@ void RenderTableSection::setCellLogicalWidths() statePusher.pop(); // only pops if we pushed } -LayoutUnit RenderTableSection::calcRowLogicalHeight() +int RenderTableSection::calcRowLogicalHeight() { #ifndef NDEBUG setNeedsLayoutIsForbidden(true); @@ -326,7 +326,7 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight() RenderTableCell* cell; - LayoutUnit spacing = table()->vBorderSpacing(); + int spacing = table()->vBorderSpacing(); LayoutStateMaintainer statePusher(view()); @@ -337,9 +337,9 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight() m_rowPos[r + 1] = 0; m_grid[r].baseline = 0; LayoutUnit baseline = 0; - LayoutUnit bdesc = 0; - LayoutUnit ch = m_grid[r].logicalHeight.calcMinValue(0); - LayoutUnit pos = m_rowPos[r] + ch + (m_grid[r].rowRenderer ? spacing : 0); + int bdesc = 0; + int ch = m_grid[r].logicalHeight.calcMinValue(0); + int pos = m_rowPos[r] + ch + (m_grid[r].rowRenderer ? spacing : 0); m_rowPos[r + 1] = max(m_rowPos[r + 1], pos); @@ -370,7 +370,7 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight() cell->layoutIfNeeded(); } - LayoutUnit adjustedLogicalHeight = cell->logicalHeight() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter()); + int adjustedLogicalHeight = cell->logicalHeight() - (cell->intrinsicPaddingBefore() + cell->intrinsicPaddingAfter()); ch = cell->style()->logicalHeight().calcValue(0); if (document()->inQuirksMode() || cell->style()->boxSizing() == BORDER_BOX) { @@ -379,8 +379,8 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight() } else { // In strict mode, box-sizing: content-box do the right // thing and actually add in the border and padding. - LayoutUnit adjustedPaddingBefore = cell->paddingBefore() - cell->intrinsicPaddingBefore(); - LayoutUnit adjustedPaddingAfter = cell->paddingAfter() - cell->intrinsicPaddingAfter(); + int adjustedPaddingBefore = cell->paddingBefore() - cell->intrinsicPaddingBefore(); + int adjustedPaddingAfter = cell->paddingAfter() - cell->intrinsicPaddingAfter(); ch += adjustedPaddingBefore + adjustedPaddingAfter + cell->borderBefore() + cell->borderAfter(); } ch = max(ch, adjustedLogicalHeight); @@ -392,9 +392,9 @@ LayoutUnit RenderTableSection::calcRowLogicalHeight() // find out the baseline EVerticalAlign va = cell->style()->verticalAlign(); if (va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SUPER || va == SUB) { - LayoutUnit b = cell->cellBaselinePosition(); + int b = cell->cellBaselinePosition(); if (b > cell->borderBefore() + cell->paddingBefore()) { - baseline = max(baseline, b - cell->intrinsicPaddingBefore()); + baseline = max<LayoutUnit>(baseline, b - cell->intrinsicPaddingBefore()); bdesc = max(bdesc, m_rowPos[indx] + ch - (b - cell->intrinsicPaddingBefore())); } } @@ -436,7 +436,7 @@ void RenderTableSection::layout() setNeedsLayout(false); } -LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) +int RenderTableSection::layoutRows(int toAdd) { #ifndef NDEBUG setNeedsLayoutIsForbidden(true); @@ -444,7 +444,7 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) ASSERT(!needsLayout()); - LayoutUnit rHeight; + int rHeight; unsigned rindx; unsigned totalRows = m_grid.size(); @@ -455,9 +455,9 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) m_forceSlowPaintPathWithOverflowingCell = false; if (toAdd && totalRows && (m_rowPos[totalRows] || !nextSibling())) { - LayoutUnit totalHeight = m_rowPos[totalRows] + toAdd; + int totalHeight = m_rowPos[totalRows] + toAdd; - LayoutUnit dh = toAdd; + int dh = toAdd; int totalPercent = 0; int numAuto = 0; for (unsigned r = 0; r < totalRows; r++) { @@ -468,15 +468,15 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) } if (totalPercent) { // try to satisfy percent - LayoutUnit add = 0; + int add = 0; totalPercent = min(totalPercent, 100); - LayoutUnit rh = m_rowPos[1] - m_rowPos[0]; + int rh = m_rowPos[1] - m_rowPos[0]; for (unsigned r = 0; r < totalRows; r++) { if (totalPercent > 0 && m_grid[r].logicalHeight.isPercent()) { - LayoutUnit toAdd = min<LayoutUnit>(dh, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh); + int toAdd = min<int>(dh, (totalHeight * m_grid[r].logicalHeight.percent() / 100) - rh); // If toAdd is negative, then we don't want to shrink the row (this bug // affected Outlook Web Access). - toAdd = max<LayoutUnit>(0, toAdd); + toAdd = max(0, toAdd); add += toAdd; dh -= toAdd; totalPercent -= m_grid[r].logicalHeight.percent(); @@ -489,10 +489,10 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) } if (numAuto) { // distribute over variable cols - LayoutUnit add = 0; + int add = 0; for (unsigned r = 0; r < totalRows; r++) { if (numAuto > 0 && m_grid[r].logicalHeight.isAuto()) { - LayoutUnit toAdd = dh / numAuto; + int toAdd = dh / numAuto; add += toAdd; dh -= toAdd; numAuto--; @@ -502,9 +502,9 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) } if (dh > 0 && m_rowPos[totalRows]) { // if some left overs, distribute equally. - LayoutUnit tot = m_rowPos[totalRows]; - LayoutUnit add = 0; - LayoutUnit prev = m_rowPos[0]; + int tot = m_rowPos[totalRows]; + int add = 0; + int prev = m_rowPos[0]; for (unsigned r = 0; r < totalRows; r++) { // weight with the original height add += dh * (m_rowPos[r + 1] - prev) / tot; @@ -514,8 +514,8 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) } } - LayoutUnit hspacing = table()->hBorderSpacing(); - LayoutUnit vspacing = table()->vBorderSpacing(); + int hspacing = table()->hBorderSpacing(); + int vspacing = table()->vBorderSpacing(); unsigned nEffCols = table()->numEffCols(); LayoutStateMaintainer statePusher(view(), this, LayoutSize(x(), y()), style()->isFlippedBlocksWritingMode()); @@ -603,18 +603,18 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) } } - LayoutUnit oldIntrinsicPaddingBefore = cell->intrinsicPaddingBefore(); - LayoutUnit oldIntrinsicPaddingAfter = cell->intrinsicPaddingAfter(); - LayoutUnit logicalHeightWithoutIntrinsicPadding = cell->logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter; + int oldIntrinsicPaddingBefore = cell->intrinsicPaddingBefore(); + int oldIntrinsicPaddingAfter = cell->intrinsicPaddingAfter(); + int logicalHeightWithoutIntrinsicPadding = cell->logicalHeight() - oldIntrinsicPaddingBefore - oldIntrinsicPaddingAfter; - LayoutUnit intrinsicPaddingBefore = 0; + int intrinsicPaddingBefore = 0; switch (cell->style()->verticalAlign()) { case SUB: case SUPER: case TEXT_TOP: case TEXT_BOTTOM: case BASELINE: { - LayoutUnit b = cell->cellBaselinePosition(); + int b = cell->cellBaselinePosition(); if (b > cell->borderBefore() + cell->paddingBefore()) intrinsicPaddingBefore = getBaseline(r) - (b - oldIntrinsicPaddingBefore); break; @@ -631,7 +631,7 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) break; } - LayoutUnit intrinsicPaddingAfter = rHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore; + int intrinsicPaddingAfter = rHeight - logicalHeightWithoutIntrinsicPadding - intrinsicPaddingBefore; cell->setIntrinsicPaddingBefore(intrinsicPaddingBefore); cell->setIntrinsicPaddingAfter(intrinsicPaddingAfter); @@ -715,7 +715,7 @@ LayoutUnit RenderTableSection::layoutRows(LayoutUnit toAdd) return height(); } -LayoutUnit RenderTableSection::calcOuterBorderBefore() const +int RenderTableSection::calcOuterBorderBefore() const { unsigned totalCols = table()->numEffCols(); if (!m_grid.size() || !totalCols) @@ -766,7 +766,7 @@ LayoutUnit RenderTableSection::calcOuterBorderBefore() const return borderWidth / 2; } -LayoutUnit RenderTableSection::calcOuterBorderAfter() const +int RenderTableSection::calcOuterBorderAfter() const { unsigned totalCols = table()->numEffCols(); if (!m_grid.size() || !totalCols) @@ -817,7 +817,7 @@ LayoutUnit RenderTableSection::calcOuterBorderAfter() const return (borderWidth + 1) / 2; } -LayoutUnit RenderTableSection::calcOuterBorderStart() const +int RenderTableSection::calcOuterBorderStart() const { unsigned totalCols = table()->numEffCols(); if (!m_grid.size() || !totalCols) @@ -861,7 +861,7 @@ LayoutUnit RenderTableSection::calcOuterBorderStart() const return (borderWidth + (table()->style()->isLeftToRightDirection() ? 0 : 1)) / 2; } -LayoutUnit RenderTableSection::calcOuterBorderEnd() const +int RenderTableSection::calcOuterBorderEnd() const { unsigned totalCols = table()->numEffCols(); if (!m_grid.size() || !totalCols) @@ -1055,7 +1055,7 @@ void RenderTableSection::paintObject(PaintInfo& paintInfo, const LayoutPoint& pa // FIXME: Implement RTL. if (!m_forceSlowPaintPathWithOverflowingCell && style()->isLeftToRightDirection()) { LayoutUnit start = (style()->isHorizontalWritingMode() ? localRepaintRect.x() : localRepaintRect.y()) - os; - Vector<LayoutUnit>& columnPos = table()->columnPositions(); + Vector<int>& columnPos = table()->columnPositions(); startcol = std::lower_bound(columnPos.begin(), columnPos.end(), start) - columnPos.begin(); if ((startcol == columnPos.size()) || (startcol > 0 && (columnPos[startcol] > start))) --startcol; @@ -1313,7 +1313,7 @@ bool RenderTableSection::nodeAtPoint(const HitTestRequest& request, HitTestResul // Now set hitRow to the index of the hit row, or 0. unsigned hitRow = nextRow > 0 ? nextRow - 1 : 0; - Vector<LayoutUnit>& columnPos = table()->columnPositions(); + Vector<int>& columnPos = table()->columnPositions(); LayoutUnit offsetInRowDirection = style()->isHorizontalWritingMode() ? location.x() : location.y(); if (!style()->isLeftToRightDirection()) offsetInRowDirection = columnPos[columnPos.size() - 1] - offsetInRowDirection; diff --git a/Source/WebCore/rendering/RenderTableSection.h b/Source/WebCore/rendering/RenderTableSection.h index 7517a0ac0..d12c87041 100644 --- a/Source/WebCore/rendering/RenderTableSection.h +++ b/Source/WebCore/rendering/RenderTableSection.h @@ -55,8 +55,8 @@ public: void addCell(RenderTableCell*, RenderTableRow* row); void setCellLogicalWidths(); - LayoutUnit calcRowLogicalHeight(); - LayoutUnit layoutRows(LayoutUnit logicalHeight); + int calcRowLogicalHeight(); + int layoutRows(int logicalHeight); RenderTable* table() const { return toRenderTable(parent()); } @@ -87,7 +87,7 @@ public: struct RowStruct { RowStruct() : rowRenderer(0) - , baseline(0) + , baseline() { } @@ -108,16 +108,16 @@ public: void appendColumn(unsigned pos); void splitColumn(unsigned pos, unsigned first); - LayoutUnit calcOuterBorderBefore() const; - LayoutUnit calcOuterBorderAfter() const; - LayoutUnit calcOuterBorderStart() const; - LayoutUnit calcOuterBorderEnd() const; + int calcOuterBorderBefore() const; + int calcOuterBorderAfter() const; + int calcOuterBorderStart() const; + int calcOuterBorderEnd() const; void recalcOuterBorder(); - LayoutUnit outerBorderBefore() const { return m_outerBorderBefore; } - LayoutUnit outerBorderAfter() const { return m_outerBorderAfter; } - LayoutUnit outerBorderStart() const { return m_outerBorderStart; } - LayoutUnit outerBorderEnd() const { return m_outerBorderEnd; } + int outerBorderBefore() const { return m_outerBorderBefore; } + int outerBorderAfter() const { return m_outerBorderAfter; } + int outerBorderStart() const { return m_outerBorderStart; } + int outerBorderEnd() const { return m_outerBorderEnd; } unsigned numRows() const { return m_grid.size(); } unsigned numColumns() const; @@ -173,16 +173,16 @@ private: RenderObjectChildList m_children; Vector<RowStruct> m_grid; - Vector<LayoutUnit> m_rowPos; + Vector<int> m_rowPos; // the current insertion position unsigned m_cCol; unsigned m_cRow; - LayoutUnit m_outerBorderStart; - LayoutUnit m_outerBorderEnd; - LayoutUnit m_outerBorderBefore; - LayoutUnit m_outerBorderAfter; + int m_outerBorderStart; + int m_outerBorderEnd; + int m_outerBorderBefore; + int m_outerBorderAfter; bool m_needsCellRecalc; diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp index 912ee0c33..a86850ce4 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.cpp +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.cpp @@ -638,9 +638,9 @@ int RenderTextControlSingleLine::clientInsetRight() const return height() / 2; } -int RenderTextControlSingleLine::clientPaddingLeft() const +LayoutUnit RenderTextControlSingleLine::clientPaddingLeft() const { - int padding = paddingLeft(); + LayoutUnit padding = paddingLeft(); HTMLElement* resultsButton = resultsButtonElement(); if (RenderBox* resultsRenderer = resultsButton ? resultsButton->renderBox() : 0) @@ -649,9 +649,9 @@ int RenderTextControlSingleLine::clientPaddingLeft() const return padding; } -int RenderTextControlSingleLine::clientPaddingRight() const +LayoutUnit RenderTextControlSingleLine::clientPaddingRight() const { - int padding = paddingRight(); + LayoutUnit padding = paddingRight(); HTMLElement* cancelButton = cancelButtonElement(); if (RenderBox* cancelRenderer = cancelButton ? cancelButton->renderBox() : 0) diff --git a/Source/WebCore/rendering/RenderTextControlSingleLine.h b/Source/WebCore/rendering/RenderTextControlSingleLine.h index 2175c8ae7..45d19ee99 100644 --- a/Source/WebCore/rendering/RenderTextControlSingleLine.h +++ b/Source/WebCore/rendering/RenderTextControlSingleLine.h @@ -103,8 +103,8 @@ private: virtual PopupMenuStyle menuStyle() const OVERRIDE; virtual int clientInsetLeft() const OVERRIDE; virtual int clientInsetRight() const OVERRIDE; - virtual int clientPaddingLeft() const OVERRIDE; - virtual int clientPaddingRight() const OVERRIDE; + virtual LayoutUnit clientPaddingLeft() const OVERRIDE; + virtual LayoutUnit clientPaddingRight() const OVERRIDE; virtual int listSize() const OVERRIDE; virtual int selectedIndex() const OVERRIDE; virtual void popupDidHide() OVERRIDE; diff --git a/Source/WebCore/rendering/RenderTheme.cpp b/Source/WebCore/rendering/RenderTheme.cpp index 6ea025c5d..d93a27e25 100644 --- a/Source/WebCore/rendering/RenderTheme.cpp +++ b/Source/WebCore/rendering/RenderTheme.cpp @@ -242,7 +242,7 @@ void RenderTheme::adjustStyle(CSSStyleSelector* selector, RenderStyle* style, El } } -bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) +bool RenderTheme::paint(RenderObject* o, const PaintInfo& paintInfo, const LayoutRect& r) { // If painting is disabled, but we aren't updating control tints, then just bail. // If we are updating control tints, just schedule a repaint if the theme supports tinting @@ -500,13 +500,13 @@ String RenderTheme::formatMediaControlsRemainingTime(float currentTime, float du return formatMediaControlsTime(currentTime - duration); } -IntPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const +LayoutPoint RenderTheme::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const { - int y = -size.height(); - FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->offsetLeft(), y), true, true); + LayoutUnit y = -size.height(); + FloatPoint absPoint = muteButtonBox->localToAbsolute(FloatPoint(muteButtonBox->pixelSnappedOffsetLeft(), y), true, true); if (absPoint.y() < 0) y = muteButtonBox->height(); - return IntPoint(0, y); + return LayoutPoint(0, y); } #endif @@ -612,7 +612,7 @@ Color RenderTheme::platformInactiveListBoxSelectionForegroundColor() const return platformInactiveSelectionForegroundColor(); } -int RenderTheme::baselinePosition(const RenderObject* o) const +LayoutUnit RenderTheme::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; @@ -662,7 +662,7 @@ bool RenderTheme::isControlStyled(const RenderStyle* style, const BorderData& bo } } -void RenderTheme::adjustRepaintRect(const RenderObject* o, IntRect& r) +void RenderTheme::adjustRepaintRect(const RenderObject* o, LayoutRect& r) { #if USE(NEW_THEME) m_theme->inflateControlPaintRect(o->style()->appearance(), controlStatesForRenderer(o), r, o->style()->effectiveZoom()); @@ -919,7 +919,7 @@ void RenderTheme::adjustMeterStyle(CSSStyleSelector*, RenderStyle* style, Elemen style->setBoxShadow(nullptr); } -IntSize RenderTheme::meterSizeForBounds(const RenderMeter*, const IntRect& bounds) const +LayoutSize RenderTheme::meterSizeForBounds(const RenderMeter*, const LayoutRect& bounds) const { return bounds.size(); } diff --git a/Source/WebCore/rendering/RenderTheme.h b/Source/WebCore/rendering/RenderTheme.h index 19273eb02..c243b78a5 100644 --- a/Source/WebCore/rendering/RenderTheme.h +++ b/Source/WebCore/rendering/RenderTheme.h @@ -97,7 +97,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual LayoutUnit baselinePosition(const RenderObject*) const; // A method for asking if a control is a container or not. Leaf controls have to have some special behavior (like // the baseline position API above). @@ -114,7 +114,7 @@ public: // Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint, // the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control. - virtual void adjustRepaintRect(const RenderObject*, IntRect&); + virtual void adjustRepaintRect(const RenderObject*, LayoutRect&); // This method is called whenever a relevant state changes on a particular themed object, e.g., the mouse becomes pressed // or a control becomes disabled. @@ -176,7 +176,7 @@ public: virtual ScrollbarControlSize scrollbarControlSizeForPart(ControlPart) { return RegularScrollbar; } // Method for painting the caps lock indicator - virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&) { return 0; }; + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&) { return 0; }; #if ENABLE(PROGRESS_TAG) // Returns the repeat interval of the animation for the progress bar. @@ -198,11 +198,11 @@ public: virtual String formatMediaControlsRemainingTime(float currentTime, float duration) const; // Returns the media volume slider container's offset from the mute button. - virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; + virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const; #endif #if ENABLE(METER_TAG) - virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; + virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const; virtual bool supportsMeter(ControlPart) const; #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.h b/Source/WebCore/rendering/RenderThemeChromiumMac.h index 8d4e52e56..232e0f66c 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.h +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.h @@ -49,7 +49,7 @@ protected: virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); - virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; + virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const; virtual bool usesMediaControlStatusDisplay() { return false; } virtual bool hasOwnDisabledStateHandlingFor(ControlPart) const { return true; } #endif diff --git a/Source/WebCore/rendering/RenderThemeChromiumMac.mm b/Source/WebCore/rendering/RenderThemeChromiumMac.mm index 5d4c9539e..82f2de1c3 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumMac.mm +++ b/Source/WebCore/rendering/RenderThemeChromiumMac.mm @@ -211,7 +211,7 @@ bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const P return RenderMediaControlsChromium::paintMediaControlsPart(MediaSliderThumb, object, paintInfo, rect); } -IntPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const +LayoutPoint RenderThemeChromiumMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const { return RenderTheme::volumeSliderOffsetFromMuteButton(muteButtonBox, size); } diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp index 030ac35ae..5715b6684 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp @@ -260,10 +260,10 @@ void RenderThemeChromiumSkia::adjustSearchFieldCancelButtonStyle(CSSStyleSelecto style->setHeight(Length(cancelButtonSize, Fixed)); } -IntRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const +LayoutRect RenderThemeChromiumSkia::convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const { // Compute an offset between the part renderer and the input renderer. - IntSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer)); + LayoutSize offsetFromInputRenderer = -(partRenderer->offsetFromAncestorContainer(inputRenderer)); // Move the rect into partRenderer's coords. partRect.move(offsetFromInputRenderer); // Account for the local drawing offset. @@ -279,17 +279,17 @@ bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* cancelB if (!input->renderer()->isBox()) return false; RenderBox* inputRenderBox = toRenderBox(input->renderer()); - IntRect inputContentBox = inputRenderBox->contentBoxRect(); + LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); // Make sure the scaled button stays square and will fit in its parent's box. - int cancelButtonSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height())); + LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height())); // Calculate cancel button's coordinates relative to the input element. // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will // be one pixel closer to the bottom of the field. This tends to look better with the text. - IntRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(), - inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, - cancelButtonSize, cancelButtonSize); - IntRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r); + LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(inputRenderBox).width(), + inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, + cancelButtonSize, cancelButtonSize); + LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, cancelButtonObject, cancelButtonRect, r); static Image* cancelImage = Image::loadPlatformResource("searchCancel").leakRef(); static Image* cancelPressedImage = Image::loadPlatformResource("searchCancelPressed").leakRef(); @@ -322,17 +322,17 @@ bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* ma if (!input->renderer()->isBox()) return false; RenderBox* inputRenderBox = toRenderBox(input->renderer()); - IntRect inputContentBox = inputRenderBox->contentBoxRect(); + LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); // Make sure the scaled decoration stays square and will fit in its parent's box. - int magnifierSize = std::min(inputContentBox.width(), std::min(inputContentBox.height(), r.height())); + LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<LayoutUnit>(inputContentBox.height(), r.height())); // Calculate decoration's coordinates relative to the input element. // Center the decoration vertically. Round up though, so if it has to be one pixel off-center, it will // be one pixel closer to the bottom of the field. This tends to look better with the text. - IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(), - inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2, - magnifierSize, magnifierSize); - IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); + LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(), + inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2, + magnifierSize, magnifierSize); + LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); static Image* magnifierImage = Image::loadPlatformResource("searchMagnifier").leakRef(); paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect); @@ -357,15 +357,15 @@ bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* magnif if (!input->renderer()->isBox()) return false; RenderBox* inputRenderBox = toRenderBox(input->renderer()); - IntRect inputContentBox = inputRenderBox->contentBoxRect(); + LayoutRect inputContentBox = inputRenderBox->contentBoxRect(); // Make sure the scaled decoration will fit in its parent's box. - int magnifierHeight = std::min(inputContentBox.height(), r.height()); - int magnifierWidth = std::min(inputContentBox.width(), static_cast<int>(magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize)); - IntRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(), - inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2, - magnifierWidth, magnifierHeight); - IntRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); + LayoutUnit magnifierHeight = std::min<LayoutUnit>(inputContentBox.height(), r.height()); + LayoutUnit magnifierWidth = std::min<LayoutUnit>(inputContentBox.width(), magnifierHeight * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize); + LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputRenderBox).width(), + inputContentBox.y() + (inputContentBox.height() - magnifierHeight + 1) / 2, + magnifierWidth, magnifierHeight); + LayoutRect paintingRect = convertToPaintingRect(inputRenderBox, magnifierObject, magnifierRect, r); static Image* magnifierImage = Image::loadPlatformResource("searchMagnifierResults").leakRef(); paintInfo.context->drawImage(magnifierImage, magnifierObject->style()->colorSpace(), paintingRect); diff --git a/Source/WebCore/rendering/RenderThemeChromiumSkia.h b/Source/WebCore/rendering/RenderThemeChromiumSkia.h index eed810b68..05b48be3b 100644 --- a/Source/WebCore/rendering/RenderThemeChromiumSkia.h +++ b/Source/WebCore/rendering/RenderThemeChromiumSkia.h @@ -157,7 +157,7 @@ private: int menuListInternalPadding(RenderStyle*, int paddingType) const; bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*); - IntRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, IntRect partRect, const IntRect& localOffset) const; + LayoutRect convertToPaintingRect(RenderObject* inputRenderer, const RenderObject* partRenderer, LayoutRect partRect, const IntRect& localOffset) const; }; } // namespace WebCore diff --git a/Source/WebCore/rendering/RenderThemeMac.h b/Source/WebCore/rendering/RenderThemeMac.h index 6451d3cf5..dc1af04d0 100644 --- a/Source/WebCore/rendering/RenderThemeMac.h +++ b/Source/WebCore/rendering/RenderThemeMac.h @@ -45,7 +45,7 @@ public: // A general method asking if any control tinting is supported at all. virtual bool supportsControlTints() const { return true; } - virtual void adjustRepaintRect(const RenderObject*, IntRect&); + virtual void adjustRepaintRect(const RenderObject*, LayoutRect&); virtual bool isControlStyled(const RenderStyle*, const BorderData&, const FillLayer&, const Color& backgroundColor) const; @@ -74,12 +74,12 @@ public: virtual int popupInternalPaddingTop(RenderStyle*) const; virtual int popupInternalPaddingBottom(RenderStyle*) const; - virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const IntRect&); + virtual bool paintCapsLockIndicator(RenderObject*, const PaintInfo&, const LayoutRect&); virtual bool popsMenuByArrowKeys() const OVERRIDE { return true; } #if ENABLE(METER_TAG) - virtual IntSize meterSizeForBounds(const RenderMeter*, const IntRect&) const; + virtual LayoutSize meterSizeForBounds(const RenderMeter*, const LayoutRect&) const; virtual bool paintMeter(RenderObject*, const PaintInfo&, const IntRect&); virtual bool supportsMeter(ControlPart) const; #endif @@ -169,7 +169,7 @@ protected: virtual bool usesMediaControlStatusDisplay(); virtual bool usesMediaControlVolumeSlider() const; virtual void adjustMediaSliderThumbSize(RenderStyle*) const; - virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; + virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const; #endif virtual bool shouldShowPlaceholderWhenFocused() const; @@ -177,14 +177,14 @@ protected: private: virtual String fileListNameForWidth(const Vector<String>& filenames, const Font&, int width, bool multipleFilesAllowed); - IntRect inflateRect(const IntRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; + LayoutRect inflateRect(const LayoutRect&, const IntSize&, const int* margins, float zoomLevel = 1.0f) const; FloatRect convertToPaintingRect(const RenderObject* inputRenderer, const RenderObject* partRenderer, const FloatRect& inputRect, const IntRect& r) const; // Get the control size based off the font. Used by some of the controls (like buttons). NSControlSize controlSizeForFont(RenderStyle*) const; NSControlSize controlSizeForSystemFont(RenderStyle*) const; - void setControlSize(NSCell*, const IntSize* sizes, const IntSize& minSize, float zoomLevel = 1.0f); + void setControlSize(NSCell*, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel = 1.0f); void setSizeFromFont(RenderStyle*, const IntSize* sizes) const; IntSize sizeForFont(RenderStyle*, const IntSize* sizes) const; IntSize sizeForSystemFont(RenderStyle*, const IntSize* sizes) const; @@ -199,7 +199,7 @@ private: // Helpers for adjusting appearance and for painting - void setPopupButtonCellState(const RenderObject*, const IntRect&); + void setPopupButtonCellState(const RenderObject*, const LayoutRect&); const IntSize* popupButtonSizes() const; const int* popupButtonMargins() const; const int* popupButtonPadding(NSControlSize) const; diff --git a/Source/WebCore/rendering/RenderThemeMac.mm b/Source/WebCore/rendering/RenderThemeMac.mm index 48a04cf94..e405f6ceb 100644 --- a/Source/WebCore/rendering/RenderThemeMac.mm +++ b/Source/WebCore/rendering/RenderThemeMac.mm @@ -500,7 +500,7 @@ bool RenderThemeMac::isControlStyled(const RenderStyle* style, const BorderData& return RenderTheme::isControlStyled(style, border, background, backgroundColor); } -void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r) +void RenderThemeMac::adjustRepaintRect(const RenderObject* o, LayoutRect& r) { ControlPart part = o->style()->appearance(); @@ -531,13 +531,13 @@ void RenderThemeMac::adjustRepaintRect(const RenderObject* o, IntRect& r) } } -IntRect RenderThemeMac::inflateRect(const IntRect& r, const IntSize& size, const int* margins, float zoomLevel) const +LayoutRect RenderThemeMac::inflateRect(const LayoutRect& r, const IntSize& size, const int* margins, float zoomLevel) const { // Only do the inflation if the available width/height are too small. Otherwise try to // fit the glow/check space into the available box's width/height. - int widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel); - int heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel); - IntRect result(r); + LayoutUnit widthDelta = r.width() - (size.width() + margins[leftMargin] * zoomLevel + margins[rightMargin] * zoomLevel); + LayoutUnit heightDelta = r.height() - (size.height() + margins[topMargin] * zoomLevel + margins[bottomMargin] * zoomLevel); + LayoutRect result(r); if (widthDelta < 0) { result.setX(result.x() - margins[leftMargin] * zoomLevel); result.setWidth(result.width() - widthDelta); @@ -639,14 +639,14 @@ NSControlSize RenderThemeMac::controlSizeForFont(RenderStyle* style) const return NSMiniControlSize; } -void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const IntSize& minSize, float zoomLevel) +void RenderThemeMac::setControlSize(NSCell* cell, const IntSize* sizes, const LayoutSize& minSize, float zoomLevel) { NSControlSize size; - if (minSize.width() >= static_cast<int>(sizes[NSRegularControlSize].width() * zoomLevel) && - minSize.height() >= static_cast<int>(sizes[NSRegularControlSize].height() * zoomLevel)) + if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].width() * zoomLevel) && + minSize.height() >= static_cast<LayoutUnit>(sizes[NSRegularControlSize].height() * zoomLevel)) size = NSRegularControlSize; - else if (minSize.width() >= static_cast<int>(sizes[NSSmallControlSize].width() * zoomLevel) && - minSize.height() >= static_cast<int>(sizes[NSSmallControlSize].height() * zoomLevel)) + else if (minSize.width() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].width() * zoomLevel) && + minSize.height() >= static_cast<LayoutUnit>(sizes[NSSmallControlSize].height() * zoomLevel)) size = NSSmallControlSize; else size = NSMiniControlSize; @@ -729,7 +729,7 @@ void RenderThemeMac::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Eleme { } -bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const IntRect& r) +bool RenderThemeMac::paintCapsLockIndicator(RenderObject*, const PaintInfo& paintInfo, const LayoutRect& r) { if (paintInfo.context->paintingDisabled()) return true; @@ -792,7 +792,7 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const PaintInfo& paintInfo, size.setWidth(r.width()); // Now inflate it to account for the shadow. - IntRect inflatedRect = r; + LayoutRect inflatedRect = r; if (r.width() >= minimumMenuListSize(o->style())) inflatedRect = inflateRect(inflatedRect, size, popupButtonMargins(), zoomLevel); @@ -817,16 +817,16 @@ bool RenderThemeMac::paintMenuList(RenderObject* o, const PaintInfo& paintInfo, #if ENABLE(METER_TAG) -IntSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const IntRect& bounds) const +LayoutSize RenderThemeMac::meterSizeForBounds(const RenderMeter* renderMeter, const LayoutRect& bounds) const { if (NoControlPart == renderMeter->style()->appearance()) return bounds.size(); NSLevelIndicatorCell* cell = levelIndicatorFor(renderMeter); // Makes enough room for cell's intrinsic size. - NSSize cellSize = [cell cellSizeForBounds:IntRect(IntPoint(), bounds.size())]; - return IntSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(), - bounds.height() < cellSize.height ? cellSize.height : bounds.height()); + NSSize cellSize = [cell cellSizeForBounds:LayoutRect(LayoutPoint(), bounds.size())]; + return LayoutSize(bounds.width() < cellSize.width ? cellSize.width : bounds.width(), + bounds.height() < cellSize.height ? cellSize.height : bounds.height()); } bool RenderThemeMac::paintMeter(RenderObject* renderObject, const PaintInfo& paintInfo, const IntRect& rect) @@ -1106,7 +1106,7 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn { GraphicsContextStateSaver stateSaver(*paintInfo.context); CGContextClipToRect(context, topGradient); - paintInfo.context->addRoundedRectClip(RoundedRect(enclosingLayoutRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize())); + paintInfo.context->addRoundedRectClip(RoundedRect(enclosingIntRect(topGradient), border.radii().topLeft(), border.radii().topRight(), IntSize(), IntSize())); context = cgContextContainer.context(); CGContextDrawShading(context, topShading.get()); } @@ -1114,7 +1114,7 @@ void RenderThemeMac::paintMenuListButtonGradients(RenderObject* o, const PaintIn if (!bottomGradient.isEmpty()) { GraphicsContextStateSaver stateSaver(*paintInfo.context); CGContextClipToRect(context, bottomGradient); - paintInfo.context->addRoundedRectClip(RoundedRect(enclosingLayoutRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight())); + paintInfo.context->addRoundedRectClip(RoundedRect(enclosingIntRect(bottomGradient), IntSize(), IntSize(), border.radii().bottomLeft(), border.radii().bottomRight())); context = cgContextContainer.context(); CGContextDrawShading(context, bottomShading.get()); } @@ -1276,7 +1276,7 @@ void RenderThemeMac::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle* s style->setLineHeight(RenderStyle::initialLineHeight()); } -void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const IntRect& r) +void RenderThemeMac::setPopupButtonCellState(const RenderObject* o, const LayoutRect& r) { NSPopUpButtonCell* popupButton = this->popupButton(); @@ -1538,9 +1538,9 @@ bool RenderThemeMac::paintSearchFieldCancelButton(RenderObject* o, const PaintIn #if ENABLE(INPUT_SPEECH) // Take care of cases where the cancel button was not aligned with the right border of the input element (for e.g. // when speech input is enabled for the input element. - IntRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect(); - int absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight(); - int spaceToRightOfCancelButton = absRight - (r.x() + r.width()); + LayoutRect absBoundingBox = input->renderer()->absoluteBoundingBoxRect(); + LayoutUnit absRight = absBoundingBox.x() + absBoundingBox.width() - input->renderBox()->paddingRight() - input->renderBox()->borderRight(); + LayoutUnit spaceToRightOfCancelButton = absRight - (r.x() + r.width()); localBounds.setX(localBounds.x() - spaceToRightOfCancelButton); #endif @@ -2024,7 +2024,7 @@ bool RenderThemeMac::usesMediaControlVolumeSlider() const return mediaControllerTheme() == MediaControllerThemeQuickTime; } -IntPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const +LayoutPoint RenderThemeMac::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const { return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size); } diff --git a/Source/WebCore/rendering/RenderThemeSafari.cpp b/Source/WebCore/rendering/RenderThemeSafari.cpp index 999f2f73d..771f19426 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.cpp +++ b/Source/WebCore/rendering/RenderThemeSafari.cpp @@ -312,7 +312,7 @@ IntRect RenderThemeSafari::inflateRect(const IntRect& r, const IntSize& size, co return result; } -int RenderThemeSafari::baselinePosition(const RenderObject* o) const +LayoutUnit RenderThemeSafari::baselinePosition(const RenderObject* o) const { if (!o->isBox()) return 0; diff --git a/Source/WebCore/rendering/RenderThemeSafari.h b/Source/WebCore/rendering/RenderThemeSafari.h index 9ffe2fa0c..85ddb4d50 100644 --- a/Source/WebCore/rendering/RenderThemeSafari.h +++ b/Source/WebCore/rendering/RenderThemeSafari.h @@ -52,7 +52,7 @@ public: // A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of // controls that need to do this. - virtual int baselinePosition(const RenderObject*) const; + virtual LayoutUnit baselinePosition(const RenderObject*) const; // A method asking if the control changes its tint when the window has focus or not. virtual bool controlSupportsTints(const RenderObject*) const; diff --git a/Source/WebCore/rendering/RenderThemeWin.cpp b/Source/WebCore/rendering/RenderThemeWin.cpp index 0b79e40f9..64b5c8a95 100644 --- a/Source/WebCore/rendering/RenderThemeWin.cpp +++ b/Source/WebCore/rendering/RenderThemeWin.cpp @@ -874,14 +874,14 @@ void RenderThemeWin::adjustSearchFieldStyle(CSSStyleSelector* selector, RenderSt bool RenderThemeWin::paintSearchFieldCancelButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - IntRect bounds = r; + LayoutRect bounds = r; ASSERT(o->parent()); if (!o->parent() || !o->parent()->isBox()) return false; RenderBox* parentRenderBox = toRenderBox(o->parent()); - IntRect parentBox = parentRenderBox->absoluteContentBox(); + LayoutRect parentBox = parentRenderBox->absoluteContentBox(); // Make sure the scaled button stays square and will fit in its parent's box bounds.setHeight(min(parentBox.width(), min(parentBox.height(), bounds.height()))); @@ -925,13 +925,13 @@ void RenderThemeWin::adjustSearchFieldResultsDecorationStyle(CSSStyleSelector* s bool RenderThemeWin::paintSearchFieldResultsDecoration(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - IntRect bounds = r; + LayoutRect bounds = r; ASSERT(o->parent()); if (!o->parent() || !o->parent()->isBox()) return false; RenderBox* parentRenderBox = toRenderBox(o->parent()); - IntRect parentBox = parentRenderBox->absoluteContentBox(); + LayoutRect parentBox = parentRenderBox->absoluteContentBox(); // Make sure the scaled decoration stays square and will fit in its parent's box bounds.setHeight(min(parentBox.width(), min(parentBox.height(), bounds.height()))); @@ -959,7 +959,7 @@ void RenderThemeWin::adjustSearchFieldResultsButtonStyle(CSSStyleSelector* selec bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintInfo& paintInfo, const IntRect& r) { - IntRect bounds = r; + LayoutRect bounds = r; ASSERT(o->parent()); if (!o->parent()) return false; @@ -967,11 +967,11 @@ bool RenderThemeWin::paintSearchFieldResultsButton(RenderObject* o, const PaintI return false; RenderBox* parentRenderBox = toRenderBox(o->parent()); - IntRect parentBox = parentRenderBox->absoluteContentBox(); + LayoutRect parentBox = parentRenderBox->absoluteContentBox(); // Make sure the scaled decoration will fit in its parent's box bounds.setHeight(min(parentBox.height(), bounds.height())); - bounds.setWidth(min(parentBox.width(), static_cast<int>(bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize))); + bounds.setWidth(min<LayoutUnit>(parentBox.width(), bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize)); // Center the button vertically. Round up though, so if it has to be one pixel off-center, it will // be one pixel closer to the bottom of the field. This tends to look better with the text. @@ -1117,7 +1117,7 @@ bool RenderThemeWin::paintMediaVolumeSliderThumb(RenderObject* o, const PaintInf return RenderMediaControls::paintMediaControlsPart(MediaVolumeSliderThumb, o, paintInfo, r); } -IntPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const IntSize& size) const +LayoutPoint RenderThemeWin::volumeSliderOffsetFromMuteButton(RenderBox* muteButtonBox, const LayoutSize& size) const { return RenderMediaControls::volumeSliderOffsetFromMuteButton(muteButtonBox, size); } diff --git a/Source/WebCore/rendering/RenderThemeWin.h b/Source/WebCore/rendering/RenderThemeWin.h index 4b7f8283b..293796c90 100644 --- a/Source/WebCore/rendering/RenderThemeWin.h +++ b/Source/WebCore/rendering/RenderThemeWin.h @@ -141,7 +141,7 @@ public: virtual bool paintMediaVolumeSliderContainer(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderTrack(RenderObject*, const PaintInfo&, const IntRect&); virtual bool paintMediaVolumeSliderThumb(RenderObject*, const PaintInfo&, const IntRect&); - virtual IntPoint volumeSliderOffsetFromMuteButton(RenderBox*, const IntSize&) const; + virtual LayoutPoint volumeSliderOffsetFromMuteButton(RenderBox*, const LayoutSize&) const; #endif virtual bool shouldShowPlaceholderWhenFocused() const { return true; } diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index 88ad4ac35..06e0fe98e 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -26,7 +26,6 @@ #include "config.h" #include "RenderTreeAsText.h" -#include "CSSMutableStyleDeclaration.h" #include "Document.h" #include "Frame.h" #include "FrameSelection.h" @@ -48,6 +47,7 @@ #include "RenderTableCell.h" #include "RenderView.h" #include "RenderWidget.h" +#include "StylePropertySet.h" #include <wtf/HexNumber.h> #include <wtf/UnusedParam.h> #include <wtf/Vector.h> @@ -183,7 +183,7 @@ static bool isEmptyOrUnstyledAppleStyleSpan(const Node* node) if (!node->hasChildNodes()) return true; - CSSMutableStyleDeclaration* inlineStyleDecl = elem->inlineStyleDecl(); + StylePropertySet* inlineStyleDecl = elem->inlineStyleDecl(); return (!inlineStyleDecl || inlineStyleDecl->isEmpty()); } @@ -617,10 +617,10 @@ static void write(TextStream& ts, RenderLayer& l, ts << " scrollX " << l.scrollXOffset(); if (l.scrollYOffset()) ts << " scrollY " << l.scrollYOffset(); - if (l.renderBox() && l.renderBox()->clientWidth() != l.scrollWidth()) - ts << " scrollWidth " << l.scrollWidth(); - if (l.renderBox() && l.renderBox()->clientHeight() != l.scrollHeight()) - ts << " scrollHeight " << l.scrollHeight(); + if (l.renderBox() && l.renderBox()->pixelSnappedClientWidth() != l.pixelSnappedScrollWidth()) + ts << " scrollWidth " << l.pixelSnappedScrollWidth(); + if (l.renderBox() && l.renderBox()->pixelSnappedClientHeight() != l.pixelSnappedScrollHeight()) + ts << " scrollHeight " << l.pixelSnappedScrollHeight(); } if (paintPhase == LayerPaintPhaseBackground) diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 5307c3f51..9ee7a1d6d 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -208,7 +208,7 @@ private: { // We push LayoutState even if layoutState is disabled because it stores layoutDelta too. if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer->hasColumns() || renderer->inRenderFlowThread() - || m_layoutState->currentLineGrid() || (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow())) { + || m_layoutState->lineGrid() || (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow())) { m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, pageHeightChanged, colInfo); return true; } diff --git a/Source/WebCore/rendering/RootInlineBox.cpp b/Source/WebCore/rendering/RootInlineBox.cpp index 081b3b75e..2acfaf02c 100644 --- a/Source/WebCore/rendering/RootInlineBox.cpp +++ b/Source/WebCore/rendering/RootInlineBox.cpp @@ -330,13 +330,13 @@ LayoutUnit RootInlineBox::lineGridSnapAdjustment(LayoutUnit delta) const { // If our block doesn't have snapping turned on, do nothing. // FIXME: Implement bounds snapping. - if (block()->style()->lineGridSnap() != LineGridSnapBaseline) + if (block()->style()->lineGridSnap() == LineGridSnapNone) return 0; // Get the current line grid and offset. LayoutState* layoutState = block()->view()->layoutState(); - RenderBlock* lineGrid = layoutState->currentLineGrid(); - LayoutSize lineGridOffset = layoutState->currentLineGridOffset(); + RenderBlock* lineGrid = layoutState->lineGrid(); + LayoutSize lineGridOffset = layoutState->lineGridOffset(); if (!lineGrid || lineGrid->style()->writingMode() != block()->style()->writingMode()) return 0; @@ -352,45 +352,69 @@ LayoutUnit RootInlineBox::lineGridSnapAdjustment(LayoutUnit delta) const // as established by the line box. // FIXME: Need to handle crazy line-box-contain values that cause the root line box to not be considered. I assume // the grid should honor line-box-contain. - LayoutUnit baselineMultiple = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading(); - if (!baselineMultiple) + LayoutUnit gridLineHeight = lineGridBox->lineBottomWithLeading() - lineGridBox->lineTopWithLeading(); + if (!gridLineHeight) return 0; - LayoutUnit lineGridAscent = lineGrid->style()->fontMetrics().ascent(baselineType()); - LayoutUnit firstBaselinePosition = lineGridBlockOffset + lineGridAscent + lineGridBox->logicalTop(); - LayoutUnit currentBaselinePosition = blockOffset + logicalTop() + delta + block()->style()->fontMetrics().ascent(baselineType()); + LayoutUnit lineGridFontAscent = lineGrid->style()->fontMetrics().ascent(baselineType()); + LayoutUnit lineGridFontHeight = lineGridBox->logicalHeight(); + LayoutUnit firstTextTop = lineGridBlockOffset + lineGridBox->logicalTop(); + LayoutUnit firstLineTopWithLeading = lineGridBlockOffset + lineGridBox->lineTopWithLeading(); + LayoutUnit firstBaselinePosition = firstTextTop + lineGridFontAscent; + + LayoutUnit currentTextTop = blockOffset + logicalTop() + delta; + LayoutUnit currentFontAscent = block()->style()->fontMetrics().ascent(baselineType()); + LayoutUnit currentBaselinePosition = currentTextTop + currentFontAscent; + + LayoutUnit lineGridPaginationOrigin = isHorizontal() ? layoutState->lineGridPaginationOrigin().height() : layoutState->lineGridPaginationOrigin().width(); // If we're paginated, see if we're on a page after the first one. If so, the grid resets on subsequent pages. // FIXME: If the grid is an ancestor of the pagination establisher, then this is incorrect. LayoutUnit pageLogicalTop = 0; if (layoutState->isPaginated() && layoutState->pageLogicalHeight()) { - pageLogicalTop = block()->pageLogicalTopForOffset(logicalTop() + delta); - if (pageLogicalTop > lineGridBlockOffset + lineGridBox->logicalTop()) - firstBaselinePosition = lineGridAscent + pageLogicalTop + lineGridBox->logicalTop() - lineGrid->borderBefore() - lineGrid->paddingBefore(); + pageLogicalTop = block()->pageLogicalTopForOffset(lineTopWithLeading() + delta); + if (pageLogicalTop > firstLineTopWithLeading) + firstTextTop = pageLogicalTop + lineGridBox->logicalTop() - lineGrid->borderBefore() - lineGrid->paddingBefore() + lineGridPaginationOrigin; } - + + if (block()->style()->lineGridSnap() == LineGridSnapContain) { + // Compute the desired offset from the text-top of a grid line. + // Look at our height (logicalHeight()). + // Look at the total available height. It's going to be (textBottom - textTop) + (n-1)*(multiple with leading) + // where n is number of grid lines required to enclose us. + if (logicalHeight() <= lineGridFontHeight) + firstTextTop += (lineGridFontHeight - logicalHeight()) / 2; + else { + LayoutUnit numberOfLinesWithLeading = ceilf(static_cast<float>(logicalHeight() - lineGridFontHeight) / gridLineHeight); + LayoutUnit totalHeight = lineGridFontHeight + numberOfLinesWithLeading * gridLineHeight; + firstTextTop += (totalHeight - logicalHeight()) / 2; + } + firstBaselinePosition = firstTextTop + currentFontAscent; + } else + firstBaselinePosition = firstTextTop + lineGridFontAscent; + // If we're above the first line, just push to the first line. if (currentBaselinePosition < firstBaselinePosition) return delta + firstBaselinePosition - currentBaselinePosition; // Otherwise we're in the middle of the grid somewhere. Just push to the next line. LayoutUnit baselineOffset = currentBaselinePosition - firstBaselinePosition; - LayoutUnit remainder = baselineOffset % baselineMultiple; + LayoutUnit remainder = baselineOffset % gridLineHeight; LayoutUnit result = delta; if (remainder) - result += baselineMultiple - remainder; + result += gridLineHeight - remainder; // If we aren't paginated we can return the result. if (!layoutState->isPaginated() || !layoutState->pageLogicalHeight() || result == delta) return result; - // We may have shifted to a new page. We need to do a re-snap when that happens. - LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(logicalTop() + result); + // We may end up shifted to a new page. We need to do a re-snap when that happens. + LayoutUnit newPageLogicalTop = block()->pageLogicalTopForOffset(lineBottomWithLeading() + result); if (newPageLogicalTop == pageLogicalTop) return result; // Put ourselves at the top of the next page to force a snap onto the new grid established by that page. - return lineGridSnapAdjustment(newPageLogicalTop - (blockOffset + logicalTop())); + return lineGridSnapAdjustment(newPageLogicalTop - (blockOffset + lineTopWithLeading())); } GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, diff --git a/Source/WebCore/rendering/RootInlineBox.h b/Source/WebCore/rendering/RootInlineBox.h index b7487ae5d..fef7ced22 100644 --- a/Source/WebCore/rendering/RootInlineBox.h +++ b/Source/WebCore/rendering/RootInlineBox.h @@ -101,8 +101,8 @@ public: bool isHyphenated() const; - virtual int baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); } - virtual int lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); } + virtual LayoutUnit baselinePosition(FontBaseline baselineType) const { return boxModelObject()->baselinePosition(baselineType, m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); } + virtual LayoutUnit lineHeight() const { return boxModelObject()->lineHeight(m_firstLine, isHorizontal() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); } #if PLATFORM(MAC) void addHighlightOverflow(); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp index e2491f0a1..2bdccec2c 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp @@ -109,7 +109,6 @@ void RenderMathMLBlock::paint(PaintInfo& info, const LayoutPoint& paintOffset) } #endif // ENABLE(DEBUG_MATH_LAYOUT) - } #endif diff --git a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h index d11bf78e4..4d8184bcf 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLBlock.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLBlock.h @@ -52,16 +52,7 @@ public: #endif protected: - int getBoxModelObjectHeight(RenderObject* object) - { - if (object && object->isBoxModelObject()) { - RenderBoxModelObject* box = toRenderBoxModelObject(object); - return box->offsetHeight(); - } - - return 0; - } - int getBoxModelObjectHeight(const RenderObject* object) + static LayoutUnit getBoxModelObjectHeight(const RenderObject* object) { if (object && object->isBoxModelObject()) { const RenderBoxModelObject* box = toRenderBoxModelObject(object); @@ -70,16 +61,7 @@ protected: return 0; } - int getBoxModelObjectWidth(RenderObject* object) - { - if (object && object->isBoxModelObject()) { - RenderBoxModelObject* box = toRenderBoxModelObject(object); - return box->offsetWidth(); - } - - return 0; - } - int getBoxModelObjectWidth(const RenderObject* object) + static LayoutUnit getBoxModelObjectWidth(const RenderObject* object) { if (object && object->isBoxModelObject()) { const RenderBoxModelObject* box = toRenderBoxModelObject(object); @@ -106,8 +88,10 @@ inline const RenderMathMLBlock* toRenderMathMLBlock(const RenderObject* object) return static_cast<const RenderMathMLBlock*>(object); } -} +// This will catch anyone doing an unnecessary cast. +void toRenderMathMLBlock(const RenderMathMLBlock*); +} #endif // ENABLE(MATHML) #endif // RenderMathMLBlock_h diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp index e2eddcbd8..aeaab20f7 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp @@ -165,7 +165,7 @@ void RenderMathMLFraction::paint(PaintInfo& info, const LayoutPoint& paintOffset info.context->drawLine(adjustedPaintOffset, IntPoint(adjustedPaintOffset.x() + offsetWidth(), adjustedPaintOffset.y())); } -int RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const { if (firstChild() && firstChild()->isRenderMathMLBlock()) { RenderMathMLBlock* numerator = toRenderMathMLBlock(firstChild()); @@ -182,5 +182,4 @@ int RenderMathMLFraction::baselinePosition(FontBaseline, bool firstLine, LineDir } - #endif // ENABLE(MATHML) diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index d9f624762..3971a1e13 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -38,7 +38,7 @@ public: RenderMathMLFraction(Element* fraction); virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual void updateFromElement(); - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void paint(PaintInfo&, const LayoutPoint&); protected: virtual void layout(); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp b/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp index 2b65f69a4..006fea31c 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLMath.cpp @@ -43,4 +43,3 @@ RenderMathMLMath::RenderMathMLMath(Node* math) } #endif // ENABLE(MATHML) - diff --git a/Source/WebCore/rendering/mathml/RenderMathMLMath.h b/Source/WebCore/rendering/mathml/RenderMathMLMath.h index 443fc7a2e..a81d5a890 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLMath.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLMath.h @@ -43,6 +43,5 @@ private: } - #endif // ENABLE(MATHML) #endif // RenderMathMLMath_h diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp index 4734b2a01..2702c0656 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp @@ -334,7 +334,7 @@ RenderBlock* RenderMathMLOperator::createGlyph(UChar glyph, int size, int charRe return container; } -int RenderMathMLOperator::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLOperator::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode lineDirection, LinePositionMode linePositionMode) const { if (m_isStacked) return m_stretchHeight * 2 / 3 - (m_stretchHeight - static_cast<int>(m_stretchHeight / gOperatorExpansion)) / 2; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h index 26423238f..5ee0660f5 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLOperator.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLOperator.h @@ -41,7 +41,7 @@ public: virtual void stretchToHeight(int pixelHeight); virtual void updateFromElement(); virtual bool isChildAllowed(RenderObject*, RenderStyle*) const; - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; protected: virtual void layout(); @@ -68,6 +68,9 @@ inline const RenderMathMLOperator* toRenderMathMLOperator(const RenderMathMLBloc return static_cast<const RenderMathMLOperator*>(block); } +// This will catch anyone doing an unnecessary cast. +void toRenderMathMLOperator(const RenderMathMLOperator*); + inline UChar convertHyphenMinusToMinusSign(UChar glyph) { // When rendered as a mathematical operator, minus glyph should be larger. diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp index dbfe5e22d..24e79ba7e 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp @@ -252,5 +252,3 @@ void RenderMathMLRoot::layout() } #endif // ENABLE(MATHML) - - diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp index a615e521c..922fa9245 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp @@ -119,7 +119,7 @@ void RenderMathMLRow::layout() } -int RenderMathMLRow::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLRow::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { if (firstChild() && firstChild()->isRenderMathMLBlock()) { RenderMathMLBlock* block = toRenderMathMLBlock(firstChild()); @@ -133,4 +133,3 @@ int RenderMathMLRow::baselinePosition(FontBaseline, bool firstLine, LineDirectio } #endif // ENABLE(MATHML) - diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRow.h b/Source/WebCore/rendering/mathml/RenderMathMLRow.h index f9573e23a..73c5a26e5 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLRow.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLRow.h @@ -37,7 +37,7 @@ public: RenderMathMLRow(Node* container); virtual bool isRenderMathMLRow() const { return true; } virtual int nonOperatorHeight() const; - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void stretchToHeight(int) {} protected: virtual void layout(); @@ -48,6 +48,5 @@ private: } - #endif // ENABLE(MATHML) #endif // RenderMathMLRow_h diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp b/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp index 736c6d900..38ab1c1c0 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.cpp @@ -189,5 +189,3 @@ void RenderMathMLSquareRoot::layout() } #endif // ENABLE(MATHML) - - diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h b/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h index f6c4feb80..c8e41cdfb 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLSquareRoot.h @@ -48,6 +48,3 @@ private: #endif // ENABLE(MATHML) #endif // RenderMathMLSquareRoot_h - - - diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp index 76e92c89c..9a06b0236 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp @@ -29,14 +29,7 @@ #include "RenderMathMLSubSup.h" -#include "FontSelector.h" #include "MathMLNames.h" -#include "RenderInline.h" -#include "RenderTable.h" -#include "RenderTableCell.h" -#include "RenderTableRow.h" -#include "RenderTableSection.h" -#include "RenderText.h" namespace WebCore { @@ -181,13 +174,13 @@ void RenderMathMLSubSup::layout() } } -int RenderMathMLSubSup::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLSubSup::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { RenderObject* base = firstChild(); if (!base) return offsetHeight(); - int baseline = offsetHeight(); + LayoutUnit baseline = offsetHeight(); if (!base || !base->isBoxModelObject()) return baseline; diff --git a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h index db72716fe..2ba466cb4 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLSubSup.h @@ -23,14 +23,12 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #ifndef RenderMathMLSubSup_h #define RenderMathMLSubSup_h #if ENABLE(MATHML) #include "RenderMathMLBlock.h" -#include "RenderTable.h" namespace WebCore { @@ -41,7 +39,7 @@ public: virtual bool hasBase() const { return true; } virtual int nonOperatorHeight() const; virtual void stretchToHeight(int pixelHeight); - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; protected: virtual void layout(); diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp index da1e975bf..75911036a 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp @@ -244,13 +244,13 @@ void RenderMathMLUnderOver::layout() RenderBlock::layout(); } -int RenderMathMLUnderOver::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const +LayoutUnit RenderMathMLUnderOver::baselinePosition(FontBaseline, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const { RenderObject* current = firstChild(); if (!current || linePositionMode == PositionOfInteriorLineBoxes) return RenderBlock::baselinePosition(AlphabeticBaseline, firstLine, direction, linePositionMode); - int baseline = 0; + LayoutUnit baseline = 0; switch (m_kind) { case UnderOver: case Over: @@ -292,5 +292,4 @@ int RenderMathMLUnderOver::nonOperatorHeight() const } - #endif // ENABLE(MATHML) diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h index 2708429a7..2fe619821 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.h @@ -23,7 +23,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #ifndef RenderMathMLUnderOver_h #define RenderMathMLUnderOver_h @@ -40,7 +39,7 @@ public: virtual void layout(); virtual bool hasBase() const { return true; } virtual int nonOperatorHeight() const; - virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; + virtual LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const; virtual void stretchToHeight(int pixelHeight); private: virtual const char* renderName() const { return "RenderMathMLUnderOver"; } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 334ce233a..0ce3d8886 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -28,14 +28,6 @@ namespace WebCore { -/* - * WARNING: - * -------- - * - * The order of the values in the enums have to agree with the order specified - * in CSSValueKeywords.in, otherwise some optimizations in the parser will fail, - * and produce invalid results. - */ static const size_t PrintColorAdjustBits = 1; enum PrintColorAdjust { PrintColorAdjustEconomy, @@ -93,7 +85,7 @@ enum ColumnSpan { ColumnSpanOne = 0, ColumnSpanAll}; enum EBorderCollapse { BSEPARATE = 0, BCOLLAPSE = 1 }; // These have been defined in the order of their precedence for border-collapsing. Do -// not change this order! +// not change this order! This order also must match the order in CSSValueKeywords.in. enum EBorderStyle { BNONE, BHIDDEN, INSET, GROOVE, OUTSET, RIDGE, DOTTED, DASHED, SOLID, DOUBLE }; enum EBorderPrecedence { BOFF, BTABLE, BCOLGROUP, BCOL, BROWGROUP, BROW, BCELL }; @@ -229,7 +221,7 @@ enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; -// The order of this enum must match the order of the list style types in CSSValueKeywords.in. +// The order of this enum must match the order of the list style types in CSSValueKeywords.in. enum EListStyleType { Disc, Circle, @@ -335,6 +327,7 @@ enum EWhiteSpace { NORMAL, PRE, PRE_WRAP, PRE_LINE, NOWRAP, KHTML_NOWRAP }; +// The order of this enum must match the order of the text align values in CSSValueKeywords.in. enum ETextAlign { TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND, }; @@ -408,6 +401,7 @@ enum ECursor { CURSOR_NONE }; +// The order of this enum must match the order of the display values in CSSValueKeywords.in. enum EDisplay { INLINE, BLOCK, LIST_ITEM, RUN_IN, COMPACT, INLINE_BLOCK, TABLE, INLINE_TABLE, TABLE_ROW_GROUP, diff --git a/Source/WebCore/rendering/svg/RenderSVGContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGContainer.cpp index cffa755b7..515565521 100644 --- a/Source/WebCore/rendering/svg/RenderSVGContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGContainer.cpp @@ -63,6 +63,9 @@ void RenderSVGContainer::layout() // Allow RenderSVGTransformableContainer to update its transform. bool updatedTransform = calculateLocalTransform(); + // RenderSVGViewportContainer needs to set the 'layout size changed' flag. + determineIfLayoutSizeChanged(); + SVGRenderSupport::layoutChildren(this, selfNeedsLayout() || SVGRenderSupport::filtersForceContainerLayout(this)); // Invalidate all resources of this client if our layout changed. diff --git a/Source/WebCore/rendering/svg/RenderSVGContainer.h b/Source/WebCore/rendering/svg/RenderSVGContainer.h index 60b91e14c..c7d9f205f 100644 --- a/Source/WebCore/rendering/svg/RenderSVGContainer.h +++ b/Source/WebCore/rendering/svg/RenderSVGContainer.h @@ -67,6 +67,8 @@ protected: virtual void applyViewportClip(PaintInfo&) { } virtual bool pointIsInsideViewportClip(const FloatPoint& /*pointInParent*/) { return true; } + virtual void determineIfLayoutSizeChanged() { } + bool selfWillPaint(); void updateCachedBoundaries(); diff --git a/Source/WebCore/rendering/svg/RenderSVGResource.cpp b/Source/WebCore/rendering/svg/RenderSVGResource.cpp index 24adf5bf4..4fc5e2376 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResource.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResource.cpp @@ -161,37 +161,42 @@ RenderSVGResourceSolidColor* RenderSVGResource::sharedSolidPaintingResource() return s_sharedSolidPaintingResource; } -void RenderSVGResource::removeFromFilterCache(RenderObject* object) +static inline void removeFromFilterCacheAndInvalidateDependencies(RenderObject* object, bool needsLayout) { -#if ENABLE(FILTERS) ASSERT(object); - - SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object); - if (!resources) +#if ENABLE(FILTERS) + if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(object)) { + if (RenderSVGResourceFilter* filter = resources->filter()) + filter->removeClientFromCache(object); + } +#endif + if (!object->node() || !object->node()->isSVGElement()) return; - - RenderSVGResourceFilter* filter = resources->filter(); - if (!filter) + HashSet<SVGElement*>* dependencies = object->document()->accessSVGExtensions()->setOfElementsReferencingTarget(static_cast<SVGElement*>(object->node())); + if (!dependencies) return; - - filter->removeClientFromCache(object); -#else - UNUSED_PARAM(object); -#endif + HashSet<SVGElement*>::iterator end = dependencies->end(); + for (HashSet<SVGElement*>::iterator it = dependencies->begin(); it != end; ++it) { + if (RenderObject* renderer = (*it)->renderer()) + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, needsLayout); + } } void RenderSVGResource::markForLayoutAndParentResourceInvalidation(RenderObject* object, bool needsLayout) { ASSERT(object); + ASSERT(object->document()); + ASSERT(object->node()); + if (needsLayout) object->setNeedsLayout(true); - removeFromFilterCache(object); + removeFromFilterCacheAndInvalidateDependencies(object, needsLayout); // Invalidate resources in ancestor chain, if needed. RenderObject* current = object->parent(); while (current) { - removeFromFilterCache(current); + removeFromFilterCacheAndInvalidateDependencies(current, needsLayout); if (current->isSVGResourceContainer()) { // This will process the rest of the ancestors. diff --git a/Source/WebCore/rendering/svg/RenderSVGResource.h b/Source/WebCore/rendering/svg/RenderSVGResource.h index 8ff552bb1..e02015410 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResource.h +++ b/Source/WebCore/rendering/svg/RenderSVGResource.h @@ -82,9 +82,6 @@ public: static RenderSVGResourceSolidColor* sharedSolidPaintingResource(); static void markForLayoutAndParentResourceInvalidation(RenderObject*, bool needsLayout = true); - -private: - static void removeFromFilterCache(RenderObject*); }; } diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index 507f38324..ba821cca2 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -214,7 +214,6 @@ void RenderSVGRoot::layout() SVGSVGElement* svg = static_cast<SVGSVGElement*>(node()); m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filtersForceContainerLayout(this)); - m_isLayoutSizeChanged = false; // At this point LayoutRepainter already grabbed the old bounds, // recalculate them now so repaintAfterLayout() uses the new bounds. diff --git a/Source/WebCore/rendering/svg/RenderSVGShape.cpp b/Source/WebCore/rendering/svg/RenderSVGShape.cpp index 136a53cf9..31f15251b 100755 --- a/Source/WebCore/rendering/svg/RenderSVGShape.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGShape.cpp @@ -136,13 +136,21 @@ bool RenderSVGShape::strokeContains(const FloatPoint& point, bool requiresStroke if (requiresStroke && !RenderSVGResource::strokePaintingResource(this, style(), fallbackColor)) return false; - // FIXME: This is not correct for round linecaps. https://bugs.webkit.org/show_bug.cgi?id=76931 + const SVGRenderStyle* svgStyle = style()->svgStyle(); for (size_t i = 0; i < m_zeroLengthLinecapLocations.size(); ++i) { - if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], this->strokeWidth()).contains(point)) - return true; + ASSERT(style()->svgStyle()->hasStroke()); + float strokeWidth = this->strokeWidth(); + if (style()->svgStyle()->capStyle() == SquareCap) { + if (zeroLengthSubpathRect(m_zeroLengthLinecapLocations[i], strokeWidth).contains(point)) + return true; + } else { + ASSERT(style()->svgStyle()->capStyle() == RoundCap); + FloatPoint radiusVector(point.x() - m_zeroLengthLinecapLocations[i].x(), point.y() - m_zeroLengthLinecapLocations[i].y()); + if (radiusVector.lengthSquared() < strokeWidth * strokeWidth * .25f) + return true; + } } - const SVGRenderStyle* svgStyle = style()->svgStyle(); if (!svgStyle->strokeDashArray().isEmpty() || svgStyle->strokeMiterLimit() != svgStyle->initialStrokeMiterLimit() || svgStyle->joinStyle() != svgStyle->initialJoinStyle() || svgStyle->capStyle() != svgStyle->initialCapStyle() || static_cast<SVGElement*>(node())->isStyled()) { if (!m_path) diff --git a/Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp index 8b7e65b65..1021aff00 100644 --- a/Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGViewportContainer.cpp @@ -34,9 +34,18 @@ namespace WebCore { RenderSVGViewportContainer::RenderSVGViewportContainer(SVGStyledElement* node) : RenderSVGContainer(node) + , m_isLayoutSizeChanged(false) { } +void RenderSVGViewportContainer::determineIfLayoutSizeChanged() +{ + if (!node()->hasTagName(SVGNames::svgTag)) + return; + + m_isLayoutSizeChanged = static_cast<SVGSVGElement*>(node())->hasRelativeLengths() && selfNeedsLayout(); +} + void RenderSVGViewportContainer::applyViewportClip(PaintInfo& paintInfo) { if (SVGRenderSupport::isOverflowHidden(this)) diff --git a/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h b/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h index 07be7eb9a..808d6727b 100644 --- a/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h +++ b/Source/WebCore/rendering/svg/RenderSVGViewportContainer.h @@ -35,6 +35,10 @@ public: explicit RenderSVGViewportContainer(SVGStyledElement*); FloatRect viewport() const { return m_viewport; } + bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; } + + virtual void determineIfLayoutSizeChanged(); + private: virtual bool isSVGContainer() const { return true; } virtual bool isSVGViewportContainer() const { return true; } @@ -50,6 +54,7 @@ private: FloatRect m_viewport; mutable AffineTransform m_localToParentTransform; + bool m_isLayoutSizeChanged : 1; }; inline RenderSVGViewportContainer* toRenderSVGViewportContainer(RenderObject* object) @@ -58,6 +63,12 @@ inline RenderSVGViewportContainer* toRenderSVGViewportContainer(RenderObject* ob return static_cast<RenderSVGViewportContainer*>(object); } +inline const RenderSVGViewportContainer* toRenderSVGViewportContainer(const RenderObject* object) +{ + ASSERT(!object || !strcmp(object->renderName(), "RenderSVGViewportContainer")); + return static_cast<const RenderSVGViewportContainer*>(object); +} + // This will catch anyone doing an unnecessary cast. void toRenderSVGViewportContainer(const RenderSVGViewportContainer*); diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp index 2a3801bb2..6457ac006 100644 --- a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp @@ -39,6 +39,7 @@ #include "RenderSVGResourceMarker.h" #include "RenderSVGResourceMasker.h" #include "RenderSVGRoot.h" +#include "RenderSVGViewportContainer.h" #include "SVGResources.h" #include "SVGResourcesCache.h" #include "SVGStyledElement.h" @@ -231,9 +232,22 @@ static inline void invalidateResourcesOfChildren(RenderObject* start) invalidateResourcesOfChildren(child); } +static inline bool layoutSizeOfNearestViewportChanged(const RenderObject* start) +{ + while (start && !start->isSVGRoot() && !start->isSVGViewportContainer()) + start = start->parent(); + + ASSERT(start); + ASSERT(start->isSVGRoot() || start->isSVGViewportContainer()); + if (start->isSVGViewportContainer()) + return toRenderSVGViewportContainer(start)->isLayoutSizeChanged(); + + return toRenderSVGRoot(start)->isLayoutSizeChanged(); +} + void SVGRenderSupport::layoutChildren(RenderObject* start, bool selfNeedsLayout) { - bool layoutSizeChanged = findTreeRootObject(start)->isLayoutSizeChanged(); + bool layoutSizeChanged = layoutSizeOfNearestViewportChanged(start); HashSet<RenderObject*> notlayoutedObjects; for (RenderObject* child = start->firstChild(); child; child = child->nextSibling()) { diff --git a/Source/WebCore/storage/DOMWindowSQLDatabase.idl b/Source/WebCore/storage/DOMWindowSQLDatabase.idl index a4b3e0d65..025116202 100644 --- a/Source/WebCore/storage/DOMWindowSQLDatabase.idl +++ b/Source/WebCore/storage/DOMWindowSQLDatabase.idl @@ -34,7 +34,7 @@ module window { Conditional=SQL_DATABASE, Supplemental=DOMWindow ] DOMWindowSQLDatabase { - [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) + [V8EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) raises(DOMException); #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute SQLExceptionConstructor SQLException; diff --git a/Source/WebCore/storage/Database.idl b/Source/WebCore/storage/Database.idl index 7bf5a3a64..ddc544a86 100644 --- a/Source/WebCore/storage/Database.idl +++ b/Source/WebCore/storage/Database.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] Database { readonly attribute DOMString version; void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback); diff --git a/Source/WebCore/storage/DatabaseSync.idl b/Source/WebCore/storage/DatabaseSync.idl index 340d2ec07..cfb0b590c 100644 --- a/Source/WebCore/storage/DatabaseSync.idl +++ b/Source/WebCore/storage/DatabaseSync.idl @@ -33,7 +33,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] DatabaseSync { readonly attribute DOMString version; readonly attribute DOMString lastErrorMessage; diff --git a/Source/WebCore/storage/IDBAny.idl b/Source/WebCore/storage/IDBAny.idl index 19d8424e5..66a5c2042 100644 --- a/Source/WebCore/storage/IDBAny.idl +++ b/Source/WebCore/storage/IDBAny.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE, - CustomToJS + JSCustomToJS ] IDBAny { // This space is intentionally left blank. }; diff --git a/Source/WebCore/storage/IDBCursor.idl b/Source/WebCore/storage/IDBCursor.idl index e13f65808..41540e2f2 100644 --- a/Source/WebCore/storage/IDBCursor.idl +++ b/Source/WebCore/storage/IDBCursor.idl @@ -40,9 +40,9 @@ module storage { [CallWith=ScriptExecutionContext] IDBRequest update(in SerializedScriptValue value) raises (IDBDatabaseException); - [ImplementationFunction=continueFunction] void continue(in [Optional] IDBKey key) + [ImplementedAs=continueFunction] void continue(in [Optional] IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext, ImplementationFunction=deleteFunction] IDBRequest delete() + [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete() raises (IDBDatabaseException); }; } diff --git a/Source/WebCore/storage/IDBDatabaseException.idl b/Source/WebCore/storage/IDBDatabaseException.idl index 1ade37d6d..c8e1b3536 100644 --- a/Source/WebCore/storage/IDBDatabaseException.idl +++ b/Source/WebCore/storage/IDBDatabaseException.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE, - DontCheckEnums + DoNotCheckConstants ] IDBDatabaseException { readonly attribute unsigned short code; @@ -36,7 +36,7 @@ module storage { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif const unsigned short NO_ERR = 0; diff --git a/Source/WebCore/storage/IDBKey.idl b/Source/WebCore/storage/IDBKey.idl index 04995f33e..a213d721a 100644 --- a/Source/WebCore/storage/IDBKey.idl +++ b/Source/WebCore/storage/IDBKey.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=INDEXED_DATABASE, - CustomToJS + JSCustomToJS ] IDBKey { // This space is intentionally left blank. }; diff --git a/Source/WebCore/storage/IDBObjectStore.idl b/Source/WebCore/storage/IDBObjectStore.idl index eae0bece3..0a91253b8 100644 --- a/Source/WebCore/storage/IDBObjectStore.idl +++ b/Source/WebCore/storage/IDBObjectStore.idl @@ -37,7 +37,7 @@ module storage { raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest add(in SerializedScriptValue value, in [Optional] IDBKey key) raises (IDBDatabaseException); - [CallWith=ScriptExecutionContext, ImplementationFunction=deleteFunction] IDBRequest delete(in IDBKey key) + [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction] IDBRequest delete(in IDBKey key) raises (IDBDatabaseException); [CallWith=ScriptExecutionContext] IDBRequest clear() raises (IDBDatabaseException); diff --git a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp index ce042beb6..f07ea3eeb 100644 --- a/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp +++ b/Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp @@ -153,6 +153,14 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, ec = IDBDatabaseException::DATA_ERR; return; } + if (autoIncrement && !keyPathKey) { + RefPtr<IDBKey> dummyKey = IDBKey::createNumber(-1); + RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(dummyKey, value, objectStore->m_keyPath); + if (!valueAfterInjection) { + ec = IDBDatabaseException::DATA_ERR; + return; + } + } } if (key && !key->valid()) { ec = IDBDatabaseException::DATA_ERR; @@ -178,10 +186,18 @@ void IDBObjectStoreBackendImpl::put(PassRefPtr<SerializedScriptValue> prpValue, } } - if (!transaction->scheduleTask(createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction))) + if (!transaction->scheduleTask( + createCallbackTask(&IDBObjectStoreBackendImpl::putInternal, objectStore, value, key, putMode, callbacks, transaction), + // FIXME: One of these per put() is overkill, since it's simply a cache invalidation. + createCallbackTask(&IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache, objectStore))) ec = IDBDatabaseException::TRANSACTION_INACTIVE_ERR; } +void IDBObjectStoreBackendImpl::revertAutoIncrementKeyCache(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore) +{ + objectStore->resetAutoIncrementKeyCache(); +} + void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl> objectStore, PassRefPtr<SerializedScriptValue> prpValue, PassRefPtr<IDBKey> prpKey, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBTransactionBackendInterface> transaction) { RefPtr<SerializedScriptValue> value = prpValue; @@ -200,11 +216,13 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< if (!key) { RefPtr<IDBKey> autoIncKey = objectStore->genAutoIncrementKey(); if (hasKeyPath) { - // FIXME: Add checks in put() to ensure this will always succeed (apart from I/O errors). - // https://bugs.webkit.org/show_bug.cgi?id=77374 RefPtr<SerializedScriptValue> valueAfterInjection = injectKeyIntoKeyPath(autoIncKey, value, objectStore->m_keyPath); + ASSERT(valueAfterInjection); if (!valueAfterInjection) { - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "The generated key could not be inserted into the object using the keyPath.")); + objectStore->resetAutoIncrementKeyCache(); + // Checks in put() ensure this should only happen if I/O error occurs. + // FIXME: The Indexed Database specification does not have an error code dedicated to I/O errors. + callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::UNKNOWN_ERR, "Internal error inserting generated key into the object.")); return; } value = valueAfterInjection; @@ -221,6 +239,7 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< RefPtr<IDBBackingStore::ObjectStoreRecordIdentifier> recordIdentifier = objectStore->m_backingStore->createInvalidRecordIdentifier(); if (putMode == AddOnly && objectStore->m_backingStore->keyExistsInObjectStore(objectStore->m_databaseId, objectStore->id(), *key, recordIdentifier.get())) { + objectStore->resetAutoIncrementKeyCache(); callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "Key already exists in the object store.")); return; } @@ -237,13 +256,15 @@ void IDBObjectStoreBackendImpl::putInternal(ScriptExecutionContext*, PassRefPtr< ASSERT(indexKey->valid()); if ((!index->multiEntry() || indexKey->type() != IDBKey::ArrayType) && !index->addingKeyAllowed(indexKey.get(), key.get())) { + objectStore->resetAutoIncrementKeyCache(); callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); return; } - if (index->multiEntry() && indexKey->type() == IDBKey::ArrayType) { + if (index->multiEntry() && indexKey->type() == IDBKey::ArrayType) { for (size_t j = 0; j < indexKey->array().size(); ++j) { if (!index->addingKeyAllowed(indexKey->array()[j].get(), key.get())) { + objectStore->resetAutoIncrementKeyCache(); callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::CONSTRAINT_ERR, "One of the derived (from a keyPath) keys for an index does not satisfy its uniqueness requirements.")); return; } diff --git a/Source/WebCore/storage/IDBObjectStoreBackendImpl.h b/Source/WebCore/storage/IDBObjectStoreBackendImpl.h index 7c12d8472..bdbf1f16a 100644 --- a/Source/WebCore/storage/IDBObjectStoreBackendImpl.h +++ b/Source/WebCore/storage/IDBObjectStoreBackendImpl.h @@ -100,6 +100,7 @@ private: // These are used as setVersion transaction abort tasks. static void removeIndexFromMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); static void addIndexToMap(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>, PassRefPtr<IDBIndexBackendImpl>); + static void revertAutoIncrementKeyCache(ScriptExecutionContext*, PassRefPtr<IDBObjectStoreBackendImpl>); RefPtr<IDBBackingStore> m_backingStore; diff --git a/Source/WebCore/storage/SQLError.idl b/Source/WebCore/storage/SQLError.idl index 5c998f2af..ad847598a 100644 --- a/Source/WebCore/storage/SQLError.idl +++ b/Source/WebCore/storage/SQLError.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] SQLError { readonly attribute unsigned long code; readonly attribute DOMString message; diff --git a/Source/WebCore/storage/SQLException.idl b/Source/WebCore/storage/SQLException.idl index 60815dc34..39e58d68e 100644 --- a/Source/WebCore/storage/SQLException.idl +++ b/Source/WebCore/storage/SQLException.idl @@ -32,8 +32,8 @@ module storage { interface [ Conditional=SQL_DATABASE, - NoStaticTables, - DontCheckEnums + JSNoStaticTables, + DoNotCheckConstants ] SQLException { readonly attribute unsigned long code; readonly attribute DOMString message; diff --git a/Source/WebCore/storage/SQLResultSet.idl b/Source/WebCore/storage/SQLResultSet.idl index 1b4865897..60692cbea 100644 --- a/Source/WebCore/storage/SQLResultSet.idl +++ b/Source/WebCore/storage/SQLResultSet.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] SQLResultSet { readonly attribute SQLResultSetRowList rows; diff --git a/Source/WebCore/storage/SQLResultSetRowList.idl b/Source/WebCore/storage/SQLResultSetRowList.idl index 44db52321..ba0cb4cf7 100644 --- a/Source/WebCore/storage/SQLResultSetRowList.idl +++ b/Source/WebCore/storage/SQLResultSetRowList.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] SQLResultSetRowList { readonly attribute unsigned long length; [Custom] DOMObject item(in unsigned long index); diff --git a/Source/WebCore/storage/SQLTransaction.idl b/Source/WebCore/storage/SQLTransaction.idl index f410ca422..f0994a1f8 100644 --- a/Source/WebCore/storage/SQLTransaction.idl +++ b/Source/WebCore/storage/SQLTransaction.idl @@ -31,7 +31,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] SQLTransaction { [Custom] void executeSql(in DOMString sqlStatement, in ObjectArray arguments, diff --git a/Source/WebCore/storage/SQLTransactionSync.idl b/Source/WebCore/storage/SQLTransactionSync.idl index 0ada59d9c..e5bdedf01 100644 --- a/Source/WebCore/storage/SQLTransactionSync.idl +++ b/Source/WebCore/storage/SQLTransactionSync.idl @@ -33,7 +33,7 @@ module storage { interface [ Conditional=SQL_DATABASE, OmitConstructor, - NoStaticTables + JSNoStaticTables ] SQLTransactionSync { [Custom] SQLResultSet executeSql(in DOMString sqlStatement, in ObjectArray arguments); }; diff --git a/Source/WebCore/storage/Storage.idl b/Source/WebCore/storage/Storage.idl index 7ad6bdfd0..e656d52fd 100644 --- a/Source/WebCore/storage/Storage.idl +++ b/Source/WebCore/storage/Storage.idl @@ -26,19 +26,19 @@ module storage { interface [ - HasNameGetter, - GenerateIsReachable=ImplFrame, + NamedGetter, + JSGenerateIsReachable=ImplFrame, CustomDeleteProperty, CustomGetPropertyNames, - DelegatingPutFunction, + CustomNamedSetter, ] Storage { - readonly attribute [DontEnum] unsigned long length; - [DontEnum, ConvertNullStringTo=Null] DOMString key(in unsigned long index); - [DontEnum, ConvertNullStringTo=Null] DOMString getItem(in DOMString key); - [DontEnum] void setItem(in DOMString key, in DOMString data) + readonly attribute [NotEnumerable] unsigned long length; + [NotEnumerable, ConvertNullStringTo=Null] DOMString key(in unsigned long index); + [NotEnumerable, ConvertNullStringTo=Null] DOMString getItem(in DOMString key); + [NotEnumerable] void setItem(in DOMString key, in DOMString data) raises(DOMException); - [DontEnum] void removeItem(in DOMString key); - [DontEnum] void clear(); + [NotEnumerable] void removeItem(in DOMString key); + [NotEnumerable] void clear(); }; } diff --git a/Source/WebCore/storage/StorageEvent.idl b/Source/WebCore/storage/StorageEvent.idl index ff548fea4..6414fcf11 100644 --- a/Source/WebCore/storage/StorageEvent.idl +++ b/Source/WebCore/storage/StorageEvent.idl @@ -28,18 +28,18 @@ module storage { interface [ ConstructorTemplate=Event ] StorageEvent : Event { - readonly attribute [InitializedByConstructor] DOMString key; - readonly attribute [InitializedByConstructor, ConvertNullStringTo=Null] DOMString oldValue; - readonly attribute [InitializedByConstructor, ConvertNullStringTo=Null] DOMString newValue; - readonly attribute [InitializedByConstructor] DOMString url; - readonly attribute [InitializedByConstructor] Storage storageArea; + readonly attribute [InitializedByEventConstructor] DOMString key; + readonly attribute [InitializedByEventConstructor, ConvertNullStringTo=Null] DOMString oldValue; + readonly attribute [InitializedByEventConstructor, ConvertNullStringTo=Null] DOMString newValue; + readonly attribute [InitializedByEventConstructor] DOMString url; + readonly attribute [InitializedByEventConstructor] Storage storageArea; void initStorageEvent(in [Optional=CallWithDefaultValue] DOMString typeArg, in [Optional=CallWithDefaultValue] boolean canBubbleArg, in [Optional=CallWithDefaultValue] boolean cancelableArg, in [Optional=CallWithDefaultValue] DOMString keyArg, - in [Optional=CallWithDefaultValue,TreatNullAs=EmptyString] DOMString oldValueArg, - in [Optional=CallWithDefaultValue,TreatNullAs=EmptyString] DOMString newValueArg, + in [Optional=CallWithDefaultValue,TreatNullAs=NullString] DOMString oldValueArg, + in [Optional=CallWithDefaultValue,TreatNullAs=NullString] DOMString newValueArg, in [Optional=CallWithDefaultValue] DOMString urlArg, in [Optional=CallWithDefaultValue] Storage storageAreaArg); diff --git a/Source/WebCore/storage/StorageInfo.idl b/Source/WebCore/storage/StorageInfo.idl index 16af440df..eb8b9a111 100644 --- a/Source/WebCore/storage/StorageInfo.idl +++ b/Source/WebCore/storage/StorageInfo.idl @@ -27,7 +27,7 @@ module storage { interface [ Conditional=QUOTA, OmitConstructor, - GenerateNativeConverter + JSGenerateToNativeObject ] StorageInfo { const unsigned short TEMPORARY = 0; const unsigned short PERSISTENT = 1; diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp index cea3cb83e..b3e0f8511 100644 --- a/Source/WebCore/svg/SVGAElement.cpp +++ b/Source/WebCore/svg/SVGAElement.cpp @@ -97,10 +97,10 @@ bool SVGAElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGAElement::parseMappedAttribute(Attribute* attr) +void SVGAElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); return; } @@ -109,13 +109,13 @@ void SVGAElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGAElement.h b/Source/WebCore/svg/SVGAElement.h index fb644617d..f2af9a828 100644 --- a/Source/WebCore/svg/SVGAElement.h +++ b/Source/WebCore/svg/SVGAElement.h @@ -49,7 +49,7 @@ private: virtual String target() const { return svgTarget(); } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGAngle.idl b/Source/WebCore/svg/SVGAngle.idl index 61ec6348c..24ab62f89 100644 --- a/Source/WebCore/svg/SVGAngle.idl +++ b/Source/WebCore/svg/SVGAngle.idl @@ -36,7 +36,7 @@ module svg { attribute [StrictTypeChecking] float value; attribute [StrictTypeChecking] float valueInSpecifiedUnits; - attribute [TreatNullAs=EmptyString] DOMString valueAsString + attribute [TreatNullAs=NullString] DOMString valueAsString setter raises(DOMException); [StrictTypeChecking] void newValueSpecifiedUnits(in unsigned short unitType, in float valueInSpecifiedUnits) diff --git a/Source/WebCore/svg/SVGAnimateMotionElement.cpp b/Source/WebCore/svg/SVGAnimateMotionElement.cpp index 79566119c..610c73837 100644 --- a/Source/WebCore/svg/SVGAnimateMotionElement.cpp +++ b/Source/WebCore/svg/SVGAnimateMotionElement.cpp @@ -96,10 +96,10 @@ bool SVGAnimateMotionElement::isSupportedAttribute(const QualifiedName& attrName return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGAnimateMotionElement::parseMappedAttribute(Attribute* attr) +void SVGAnimateMotionElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGAnimationElement::parseMappedAttribute(attr); + SVGAnimationElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGAnimateMotionElement.h b/Source/WebCore/svg/SVGAnimateMotionElement.h index fe787ef14..89ced7683 100644 --- a/Source/WebCore/svg/SVGAnimateMotionElement.h +++ b/Source/WebCore/svg/SVGAnimateMotionElement.h @@ -37,7 +37,7 @@ private: virtual bool hasValidAttributeType(); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void resetToBaseValue(const String&); virtual bool calculateFromAndToValues(const String& fromString, const String& toString); diff --git a/Source/WebCore/svg/SVGAnimateTransformElement.cpp b/Source/WebCore/svg/SVGAnimateTransformElement.cpp index 255fa1e55..7a3e28eb3 100644 --- a/Source/WebCore/svg/SVGAnimateTransformElement.cpp +++ b/Source/WebCore/svg/SVGAnimateTransformElement.cpp @@ -92,10 +92,10 @@ bool SVGAnimateTransformElement::isSupportedAttribute(const QualifiedName& attrN return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGAnimateTransformElement::parseMappedAttribute(Attribute* attr) +void SVGAnimateTransformElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGAnimationElement::parseMappedAttribute(attr); + SVGAnimationElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGAnimateTransformElement.h b/Source/WebCore/svg/SVGAnimateTransformElement.h index 411e7a8ee..a3d7f7957 100644 --- a/Source/WebCore/svg/SVGAnimateTransformElement.h +++ b/Source/WebCore/svg/SVGAnimateTransformElement.h @@ -43,7 +43,7 @@ private: AnimatedPropertyType determineAnimatedPropertyType(SVGElement*) const; bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void resetToBaseValue(const String&); virtual bool calculateFromAndToValues(const String& fromString, const String& toString); diff --git a/Source/WebCore/svg/SVGAnimatedColor.cpp b/Source/WebCore/svg/SVGAnimatedColor.cpp index f20f68922..774264d73 100644 --- a/Source/WebCore/svg/SVGAnimatedColor.cpp +++ b/Source/WebCore/svg/SVGAnimatedColor.cpp @@ -60,6 +60,8 @@ void SVGAnimatedColorAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from = constructFromString(fromString); to = constructFromString(byString); + + to->color() = ColorDistance::addColorsAndClamp(from->color(), to->color()); } void SVGAnimatedColorAnimator::calculateAnimatedValue(float percentage, unsigned, diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp index 97fbad7b5..bced2016d 100644 --- a/Source/WebCore/svg/SVGAnimationElement.cpp +++ b/Source/WebCore/svg/SVGAnimationElement.cpp @@ -157,10 +157,10 @@ bool SVGAnimationElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGAnimationElement::parseMappedAttribute(Attribute* attr) +void SVGAnimationElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGSMILElement::parseMappedAttribute(attr); + SVGSMILElement::parseAttribute(attr); return; } @@ -193,20 +193,20 @@ void SVGAnimationElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); } -void SVGAnimationElement::attributeChanged(Attribute* attr, bool preserveDecls) +void SVGAnimationElement::attributeChanged(Attribute* attr) { // Assumptions may not hold after an attribute change. m_animationValid = false; setInactive(); - SVGSMILElement::attributeChanged(attr, preserveDecls); + SVGSMILElement::attributeChanged(attr); } float SVGAnimationElement::getStartTime() const diff --git a/Source/WebCore/svg/SVGAnimationElement.h b/Source/WebCore/svg/SVGAnimationElement.h index 2e109f027..66c10d99e 100644 --- a/Source/WebCore/svg/SVGAnimationElement.h +++ b/Source/WebCore/svg/SVGAnimationElement.h @@ -85,7 +85,7 @@ protected: SVGAnimationElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; enum AttributeType { AttributeTypeCSS, @@ -107,7 +107,7 @@ protected: virtual void endedActiveInterval(); private: - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool calculateFromAndToValues(const String& fromString, const String& toString) = 0; virtual bool calculateFromAndByValues(const String& fromString, const String& byString) = 0; diff --git a/Source/WebCore/svg/SVGCircleElement.cpp b/Source/WebCore/svg/SVGCircleElement.cpp index a6c26aa18..6997b2f27 100644 --- a/Source/WebCore/svg/SVGCircleElement.cpp +++ b/Source/WebCore/svg/SVGCircleElement.cpp @@ -79,21 +79,21 @@ bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGCircleElement::parseMappedAttribute(Attribute* attr) +void SVGCircleElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::cxAttr) setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::cyAttr) setCyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError)); else if (attr->name() == SVGNames::rAttr) setRBaseValue(SVGLength::construct(LengthModeOther, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGCircleElement.h b/Source/WebCore/svg/SVGCircleElement.h index 9439c5c31..74f604772 100644 --- a/Source/WebCore/svg/SVGCircleElement.h +++ b/Source/WebCore/svg/SVGCircleElement.h @@ -45,7 +45,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool selfHasRelativeLengths() const; diff --git a/Source/WebCore/svg/SVGClipPathElement.cpp b/Source/WebCore/svg/SVGClipPathElement.cpp index b21439217..4bacf77ce 100644 --- a/Source/WebCore/svg/SVGClipPathElement.cpp +++ b/Source/WebCore/svg/SVGClipPathElement.cpp @@ -70,10 +70,10 @@ bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGClipPathElement::parseMappedAttribute(Attribute* attr) +void SVGClipPathElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); return; } @@ -84,11 +84,11 @@ void SVGClipPathElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGClipPathElement.h b/Source/WebCore/svg/SVGClipPathElement.h index fa3dc551a..10b609b39 100644 --- a/Source/WebCore/svg/SVGClipPathElement.h +++ b/Source/WebCore/svg/SVGClipPathElement.h @@ -48,7 +48,7 @@ private: virtual bool needsPendingResourceHandling() const { return false; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp index 8d511be6f..6ffee35be 100644 --- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp +++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp @@ -75,10 +75,10 @@ bool SVGComponentTransferFunctionElement::isSupportedAttribute(const QualifiedNa return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGComponentTransferFunctionElement::parseMappedAttribute(Attribute* attr) +void SVGComponentTransferFunctionElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h index f333c65cf..ec6e3d2b8 100644 --- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h +++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h @@ -78,7 +78,7 @@ protected: SVGComponentTransferFunctionElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); private: diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.idl b/Source/WebCore/svg/SVGComponentTransferFunctionElement.idl index e4a2596b3..1edd5cfb2 100644 --- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.idl +++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGComponentTransferFunctionElement : SVGElement { // Component Transfer Types const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0; diff --git a/Source/WebCore/svg/SVGCursorElement.cpp b/Source/WebCore/svg/SVGCursorElement.cpp index 7ca6b6b53..a964616ba 100644 --- a/Source/WebCore/svg/SVGCursorElement.cpp +++ b/Source/WebCore/svg/SVGCursorElement.cpp @@ -78,19 +78,19 @@ bool SVGCursorElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGCursorElement::parseMappedAttribute(Attribute* attr) +void SVGCursorElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::yAttr) setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGURIReference::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGURIReference::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGCursorElement.h b/Source/WebCore/svg/SVGCursorElement.h index 078936b5c..486d241c8 100644 --- a/Source/WebCore/svg/SVGCursorElement.h +++ b/Source/WebCore/svg/SVGCursorElement.h @@ -51,7 +51,7 @@ private: virtual bool isValid() const { return SVGTests::isValid(); } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; diff --git a/Source/WebCore/svg/SVGDocumentExtensions.cpp b/Source/WebCore/svg/SVGDocumentExtensions.cpp index 1dd61608c..6f19d800b 100644 --- a/Source/WebCore/svg/SVGDocumentExtensions.cpp +++ b/Source/WebCore/svg/SVGDocumentExtensions.cpp @@ -37,6 +37,7 @@ #include "SVGSMILElement.h" #include "SVGSVGElement.h" #include "ScriptableDocumentParser.h" +#include "XLinkNames.h" #include <wtf/text/AtomicString.h> namespace WebCore { @@ -117,6 +118,20 @@ void SVGDocumentExtensions::unpauseAnimations() (*itr)->unpauseAnimations(); } +void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements() +{ + Vector<RefPtr<SVGSVGElement> > timeContainers; + timeContainers.appendRange(m_timeContainers.begin(), m_timeContainers.end()); + + Vector<RefPtr<SVGSVGElement> >::iterator end = timeContainers.end(); + for (Vector<RefPtr<SVGSVGElement> >::iterator it = timeContainers.begin(); it != end; ++it) { + SVGSVGElement* outerSVG = (*it).get(); + if (!outerSVG->isOutermostSVGSVGElement()) + continue; + outerSVG->sendSVGLoadEventIfPossible(); + } +} + bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time) { ASSERT(element); @@ -276,8 +291,8 @@ void SVGDocumentExtensions::removeElementFromPendingResources(SVGStyledElement* element->clearHasPendingResourcesIfPossible(); // We use the removePendingResource function here because it deals with set lifetime correctly. - Vector<AtomicString>::iterator endVector = toBeRemoved.end(); - for (Vector<AtomicString>::iterator it = toBeRemoved.begin(); it != endVector; ++it) + Vector<AtomicString>::iterator vectorEnd = toBeRemoved.end(); + for (Vector<AtomicString>::iterator it = toBeRemoved.begin(); it != vectorEnd; ++it) removePendingResource(*it); } @@ -300,6 +315,74 @@ void SVGDocumentExtensions::removePendingResourceForElement(const AtomicString& element->clearHasPendingResourcesIfPossible(); } +HashSet<SVGElement*>* SVGDocumentExtensions::setOfElementsReferencingTarget(SVGElement* referencedElement) const +{ + ASSERT(referencedElement); + const HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::const_iterator it = m_elementDependencies.find(referencedElement); + if (it == m_elementDependencies.end()) + return 0; + return it->second.get(); +} + +void SVGDocumentExtensions::addElementReferencingTarget(SVGElement* referencingElement, SVGElement* referencedElement) +{ + ASSERT(referencingElement); + ASSERT(referencedElement); + + if (HashSet<SVGElement*>* elements = m_elementDependencies.get(referencedElement)) { + elements->add(referencingElement); + return; + } + + OwnPtr<HashSet<SVGElement*> > elements = adoptPtr(new HashSet<SVGElement*>); + elements->add(referencingElement); + m_elementDependencies.set(referencedElement, elements.release()); +} + +void SVGDocumentExtensions::removeAllTargetReferencesForElement(SVGElement* referencingElement) +{ + Vector<SVGElement*> toBeRemoved; + + HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator end = m_elementDependencies.end(); + for (HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elementDependencies.begin(); it != end; ++it) { + SVGElement* referencedElement = it->first; + HashSet<SVGElement*>* referencingElements = it->second.get(); + HashSet<SVGElement*>::iterator setIt = referencingElements->find(referencingElement); + if (setIt == referencingElements->end()) + continue; + + referencingElements->remove(setIt); + if (referencingElements->isEmpty()) + toBeRemoved.append(referencedElement); + } + + Vector<SVGElement*>::iterator vectorEnd = toBeRemoved.end(); + for (Vector<SVGElement*>::iterator it = toBeRemoved.begin(); it != vectorEnd; ++it) + m_elementDependencies.remove(*it); +} + +void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* referencedElement) +{ + ASSERT(referencedElement); + HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > >::iterator it = m_elementDependencies.find(referencedElement); + if (it == m_elementDependencies.end()) + return; + ASSERT(it->first == referencedElement); + Vector<SVGElement*> toBeNotified; + + HashSet<SVGElement*>* referencingElements = it->second.get(); + HashSet<SVGElement*>::iterator setEnd = referencingElements->end(); + for (HashSet<SVGElement*>::iterator setIt = referencingElements->begin(); setIt != setEnd; ++setIt) + toBeNotified.append(*setIt); + + m_elementDependencies.remove(it); + + // Force rebuilding the referencingElement so it knows about this change. + Vector<SVGElement*>::iterator vectorEnd = toBeNotified.end(); + for (Vector<SVGElement*>::iterator vectorIt = toBeNotified.begin(); vectorIt != vectorEnd; ++vectorIt) + (*vectorIt)->svgAttributeChanged(XLinkNames::hrefAttr); +} + } #endif diff --git a/Source/WebCore/svg/SVGDocumentExtensions.h b/Source/WebCore/svg/SVGDocumentExtensions.h index 459ff0647..36664c32c 100644 --- a/Source/WebCore/svg/SVGDocumentExtensions.h +++ b/Source/WebCore/svg/SVGDocumentExtensions.h @@ -57,6 +57,7 @@ public: void pauseAnimations(); void unpauseAnimations(); bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time); + void dispatchSVGLoadEventToOutermostSVGElements(); void addAnimationElementToTarget(SVGSMILElement*, SVGElement*); void removeAnimationElementFromTarget(SVGSMILElement*, SVGElement*); @@ -67,12 +68,18 @@ public: SVGResourcesCache* resourcesCache() const { return m_resourcesCache.get(); } + HashSet<SVGElement*>* setOfElementsReferencingTarget(SVGElement* referencedElement) const; + void addElementReferencingTarget(SVGElement* referencingElement, SVGElement* referencedElement); + void removeAllTargetReferencesForElement(SVGElement* referencingElement); + void removeAllElementReferencesForTarget(SVGElement* referencedElement); + private: Document* m_document; // weak reference HashSet<SVGSVGElement*> m_timeContainers; // For SVG 1.2 support this will need to be made more general. HashMap<SVGElement*, HashSet<SVGSMILElement*>* > m_animatedElements; HashMap<AtomicString, RenderSVGResourceContainer*> m_resources; HashMap<AtomicString, SVGPendingElements*> m_pendingResources; + HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > > m_elementDependencies; OwnPtr<SVGResourcesCache> m_resourcesCache; public: diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp index 6e160f076..f3d5874f3 100644 --- a/Source/WebCore/svg/SVGElement.cpp +++ b/Source/WebCore/svg/SVGElement.cpp @@ -85,6 +85,7 @@ SVGElement::~SVGElement() rareDataMap.remove(it); } document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); + document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); } SVGElementRareData* SVGElement::rareSVGData() const @@ -105,6 +106,20 @@ SVGElementRareData* SVGElement::ensureRareSVGData() return data; } +bool SVGElement::isOutermostSVGSVGElement() const +{ + // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc. + if (!parentNode()) + return true; + + // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element. + if (parentNode()->hasTagName(SVGNames::foreignObjectTag)) + return true; + + // This is true whenever this is the outermost SVG, even if there are HTML elements outside it + return !parentNode()->isSVGElement(); +} + void SVGElement::reportAttributeParsingError(SVGParsingError error, Attribute* attribute) { if (error == NoError) @@ -145,6 +160,7 @@ void SVGElement::setXmlbase(const String& value, ExceptionCode&) void SVGElement::removedFromDocument() { document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); + document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); StyledElement::removedFromDocument(); } @@ -271,7 +287,7 @@ void SVGElement::setCorrespondingElement(SVGElement* correspondingElement) ensureRareSVGData()->setCorrespondingElement(correspondingElement); } -void SVGElement::parseMappedAttribute(Attribute* attr) +void SVGElement::parseAttribute(Attribute* attr) { // standard events if (attr->name() == onloadAttr) @@ -295,7 +311,7 @@ void SVGElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == SVGNames::onactivateAttr) setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, attr)); else - StyledElement::parseMappedAttribute(attr); + StyledElement::parseAttribute(attr); } void SVGElement::animatedPropertyTypeForAttribute(const QualifiedName& attributeName, Vector<AnimatedPropertyType>& propertyTypes) @@ -340,6 +356,20 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents) if (hasLoadListener(currentTarget.get())) currentTarget->dispatchEvent(Event::create(eventNames().loadEvent, false, false)); currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>(); + SVGElement* element = static_cast<SVGElement*>(currentTarget.get()); + if (!element || !element->isOutermostSVGSVGElement()) + continue; + + // Consider <svg onload="foo()"><image xlink:href="foo.png" externalResourcesRequired="true"/></svg>. + // If foo.png is not yet loaded, the first SVGLoad event will go to the <svg> element, sent through + // Document::implicitClose(). Then the SVGLoad event will fire for <image>, once its loaded. + ASSERT(sendParentLoadEvents); + + // If the load event was not sent yet by Document::implicitClose(), but the <image> from the example + // above, just appeared, don't send the SVGLoad event to the outermost <svg>, but wait for the document + // to be "ready to render", first. + if (!document()->loadEventFinished()) + break; } } @@ -347,6 +377,10 @@ void SVGElement::finishParsingChildren() { StyledElement::finishParsingChildren(); + // The outermost SVGSVGElement SVGLoad event is fired through Document::dispatchWindowLoadEvent. + if (isOutermostSVGSVGElement()) + return; + // finishParsingChildren() is called when the close tag is reached for an element (e.g. </svg>) // we send SVGLoad events here if we can, otherwise they'll be sent when any required loads finish sendSVGLoadEventIfPossible(); @@ -359,13 +393,13 @@ bool SVGElement::childShouldCreateRenderer(Node* child) const return false; } -void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) +void SVGElement::attributeChanged(Attribute* attr) { ASSERT(attr); if (!attr) return; - StyledElement::attributeChanged(attr, preserveDecls); + StyledElement::attributeChanged(attr); // When an animated SVG property changes through SVG DOM, svgAttributeChanged() is called, not attributeChanged(). // Next time someone tries to access the XML attributes, the synchronization code starts. During that synchronization @@ -375,8 +409,10 @@ void SVGElement::attributeChanged(Attribute* attr, bool preserveDecls) if (isSynchronizingSVGAttributes()) return; - if (isIdAttributeName(attr->name())) + if (isIdAttributeName(attr->name())) { document()->accessSVGExtensions()->removeAllAnimationElementsFromTarget(this); + document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this); + } // Changes to the style attribute are processed lazily (see Element::getAttribute() and related methods), // so we don't want changes to the style attribute to result in extra work here. diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h index e4872d890..c5c5ac55f 100644 --- a/Source/WebCore/svg/SVGElement.h +++ b/Source/WebCore/svg/SVGElement.h @@ -46,6 +46,8 @@ public: static PassRefPtr<SVGElement> create(const QualifiedName&, Document*); virtual ~SVGElement(); + bool isOutermostSVGSVGElement() const; + String xmlbase() const; void setXmlbase(const String&, ExceptionCode&); @@ -108,10 +110,10 @@ public: protected: SVGElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void finishParsingChildren(); - virtual void attributeChanged(Attribute*, bool preserveDecls = false); + virtual void attributeChanged(Attribute*) OVERRIDE; virtual bool childShouldCreateRenderer(Node*) const; virtual void removedFromDocument(); diff --git a/Source/WebCore/svg/SVGElement.idl b/Source/WebCore/svg/SVGElement.idl index 21c700cb5..5e9b8312c 100644 --- a/Source/WebCore/svg/SVGElement.idl +++ b/Source/WebCore/svg/SVGElement.idl @@ -23,11 +23,11 @@ module svg { interface [ - GenerateNativeConverter, + JSGenerateToNativeObject, Conditional=SVG ] SVGElement : Element { attribute [Reflect] DOMString id; - attribute [TreatNullAs=EmptyString] DOMString xmlbase setter raises(DOMException); + attribute [TreatNullAs=NullString] DOMString xmlbase setter raises(DOMException); readonly attribute SVGSVGElement ownerSVGElement; readonly attribute SVGElement viewportElement; }; diff --git a/Source/WebCore/svg/SVGElementInstance.idl b/Source/WebCore/svg/SVGElementInstance.idl index 1c11d79a5..9c7175c7b 100644 --- a/Source/WebCore/svg/SVGElementInstance.idl +++ b/Source/WebCore/svg/SVGElementInstance.idl @@ -28,8 +28,8 @@ module svg { interface [ Conditional=SVG, - CustomMarkFunction, - GenerateNativeConverter + JSCustomMarkFunction, + JSGenerateToNativeObject ] SVGElementInstance #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C : Object, EventTarget @@ -46,46 +46,46 @@ module svg { // EventTarget #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C - attribute [DontEnum] EventListener onabort; - attribute [DontEnum] EventListener onblur; - attribute [DontEnum] EventListener onchange; - attribute [DontEnum] EventListener onclick; - attribute [DontEnum] EventListener oncontextmenu; - attribute [DontEnum] EventListener ondblclick; - attribute [DontEnum] EventListener onerror; - attribute [DontEnum] EventListener onfocus; - attribute [DontEnum] EventListener oninput; - attribute [DontEnum] EventListener onkeydown; - attribute [DontEnum] EventListener onkeypress; - attribute [DontEnum] EventListener onkeyup; - attribute [DontEnum] EventListener onload; - attribute [DontEnum] EventListener onmousedown; - attribute [DontEnum] EventListener onmousemove; - attribute [DontEnum] EventListener onmouseout; - attribute [DontEnum] EventListener onmouseover; - attribute [DontEnum] EventListener onmouseup; - attribute [DontEnum] EventListener onmousewheel; - attribute [DontEnum] EventListener onbeforecut; - attribute [DontEnum] EventListener oncut; - attribute [DontEnum] EventListener onbeforecopy; - attribute [DontEnum] EventListener oncopy; - attribute [DontEnum] EventListener onbeforepaste; - attribute [DontEnum] EventListener onpaste; - attribute [DontEnum] EventListener ondragenter; - attribute [DontEnum] EventListener ondragover; - attribute [DontEnum] EventListener ondragleave; - attribute [DontEnum] EventListener ondrop; - attribute [DontEnum] EventListener ondragstart; - attribute [DontEnum] EventListener ondrag; - attribute [DontEnum] EventListener ondragend; - attribute [DontEnum] EventListener onreset; - attribute [DontEnum] EventListener onresize; - attribute [DontEnum] EventListener onscroll; - attribute [DontEnum] EventListener onsearch; - attribute [DontEnum] EventListener onselect; - attribute [DontEnum] EventListener onselectstart; - attribute [DontEnum] EventListener onsubmit; - attribute [DontEnum] EventListener onunload; + attribute [NotEnumerable] EventListener onabort; + attribute [NotEnumerable] EventListener onblur; + attribute [NotEnumerable] EventListener onchange; + attribute [NotEnumerable] EventListener onclick; + attribute [NotEnumerable] EventListener oncontextmenu; + attribute [NotEnumerable] EventListener ondblclick; + attribute [NotEnumerable] EventListener onerror; + attribute [NotEnumerable] EventListener onfocus; + attribute [NotEnumerable] EventListener oninput; + attribute [NotEnumerable] EventListener onkeydown; + attribute [NotEnumerable] EventListener onkeypress; + attribute [NotEnumerable] EventListener onkeyup; + attribute [NotEnumerable] EventListener onload; + attribute [NotEnumerable] EventListener onmousedown; + attribute [NotEnumerable] EventListener onmousemove; + attribute [NotEnumerable] EventListener onmouseout; + attribute [NotEnumerable] EventListener onmouseover; + attribute [NotEnumerable] EventListener onmouseup; + attribute [NotEnumerable] EventListener onmousewheel; + attribute [NotEnumerable] EventListener onbeforecut; + attribute [NotEnumerable] EventListener oncut; + attribute [NotEnumerable] EventListener onbeforecopy; + attribute [NotEnumerable] EventListener oncopy; + attribute [NotEnumerable] EventListener onbeforepaste; + attribute [NotEnumerable] EventListener onpaste; + attribute [NotEnumerable] EventListener ondragenter; + attribute [NotEnumerable] EventListener ondragover; + attribute [NotEnumerable] EventListener ondragleave; + attribute [NotEnumerable] EventListener ondrop; + attribute [NotEnumerable] EventListener ondragstart; + attribute [NotEnumerable] EventListener ondrag; + attribute [NotEnumerable] EventListener ondragend; + attribute [NotEnumerable] EventListener onreset; + attribute [NotEnumerable] EventListener onresize; + attribute [NotEnumerable] EventListener onscroll; + attribute [NotEnumerable] EventListener onsearch; + attribute [NotEnumerable] EventListener onselect; + attribute [NotEnumerable] EventListener onselectstart; + attribute [NotEnumerable] EventListener onsubmit; + attribute [NotEnumerable] EventListener onunload; void addEventListener(in DOMString type, in EventListener listener, diff --git a/Source/WebCore/svg/SVGEllipseElement.cpp b/Source/WebCore/svg/SVGEllipseElement.cpp index 76ee9acd4..68808248f 100644 --- a/Source/WebCore/svg/SVGEllipseElement.cpp +++ b/Source/WebCore/svg/SVGEllipseElement.cpp @@ -81,12 +81,12 @@ bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGEllipseElement::parseMappedAttribute(Attribute* attr) +void SVGEllipseElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::cxAttr) setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::cyAttr) @@ -95,9 +95,9 @@ void SVGEllipseElement::parseMappedAttribute(Attribute* attr) setRxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); else if (attr->name() == SVGNames::ryAttr) setRyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGEllipseElement.h b/Source/WebCore/svg/SVGEllipseElement.h index 454111afc..5ff1aa5ee 100644 --- a/Source/WebCore/svg/SVGEllipseElement.h +++ b/Source/WebCore/svg/SVGEllipseElement.h @@ -45,7 +45,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool selfHasRelativeLengths() const; diff --git a/Source/WebCore/svg/SVGException.idl b/Source/WebCore/svg/SVGException.idl index 3f1f8ec5b..9b3a6a8ca 100644 --- a/Source/WebCore/svg/SVGException.idl +++ b/Source/WebCore/svg/SVGException.idl @@ -22,7 +22,7 @@ module svg { interface [ Conditional=SVG, - DontCheckEnums + DoNotCheckConstants ] SVGException { readonly attribute unsigned short code; @@ -31,7 +31,7 @@ module svg { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // SVGExceptionCode diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp index 61c574317..498566f68 100644 --- a/Source/WebCore/svg/SVGExternalResourcesRequired.cpp +++ b/Source/WebCore/svg/SVGExternalResourcesRequired.cpp @@ -28,7 +28,7 @@ namespace WebCore { -bool SVGExternalResourcesRequired::parseMappedAttribute(Attribute* attr) +bool SVGExternalResourcesRequired::parseAttribute(Attribute* attr) { if (attr->name() == SVGNames::externalResourcesRequiredAttr) { setExternalResourcesRequiredBaseValue(attr->value() == "true"); diff --git a/Source/WebCore/svg/SVGExternalResourcesRequired.h b/Source/WebCore/svg/SVGExternalResourcesRequired.h index 3959b18b1..8b11ebb0e 100644 --- a/Source/WebCore/svg/SVGExternalResourcesRequired.h +++ b/Source/WebCore/svg/SVGExternalResourcesRequired.h @@ -39,7 +39,7 @@ class SVGExternalResourcesRequired { public: virtual ~SVGExternalResourcesRequired() { } - bool parseMappedAttribute(Attribute*); + bool parseAttribute(Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/SVGFEBlendElement.cpp b/Source/WebCore/svg/SVGFEBlendElement.cpp index aa0c4bab3..f1fc9fba2 100644 --- a/Source/WebCore/svg/SVGFEBlendElement.cpp +++ b/Source/WebCore/svg/SVGFEBlendElement.cpp @@ -67,10 +67,10 @@ bool SVGFEBlendElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEBlendElement::parseMappedAttribute(Attribute* attr) +void SVGFEBlendElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEBlendElement.h b/Source/WebCore/svg/SVGFEBlendElement.h index d50c73b27..feb9135d9 100644 --- a/Source/WebCore/svg/SVGFEBlendElement.h +++ b/Source/WebCore/svg/SVGFEBlendElement.h @@ -77,7 +77,7 @@ private: SVGFEBlendElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEBlendElement.idl b/Source/WebCore/svg/SVGFEBlendElement.idl index 03a5543f1..288059c41 100644 --- a/Source/WebCore/svg/SVGFEBlendElement.idl +++ b/Source/WebCore/svg/SVGFEBlendElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFEBlendElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Blend Mode Types diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.cpp b/Source/WebCore/svg/SVGFEColorMatrixElement.cpp index 4d3d75459..269d6d38f 100644 --- a/Source/WebCore/svg/SVGFEColorMatrixElement.cpp +++ b/Source/WebCore/svg/SVGFEColorMatrixElement.cpp @@ -67,10 +67,10 @@ bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEColorMatrixElement::parseMappedAttribute(Attribute* attr) +void SVGFEColorMatrixElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.h b/Source/WebCore/svg/SVGFEColorMatrixElement.h index 09b4db03e..e556470dd 100644 --- a/Source/WebCore/svg/SVGFEColorMatrixElement.h +++ b/Source/WebCore/svg/SVGFEColorMatrixElement.h @@ -74,7 +74,7 @@ private: SVGFEColorMatrixElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.idl b/Source/WebCore/svg/SVGFEColorMatrixElement.idl index 01f57fdbe..6b18061e2 100644 --- a/Source/WebCore/svg/SVGFEColorMatrixElement.idl +++ b/Source/WebCore/svg/SVGFEColorMatrixElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFEColorMatrixElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Color Matrix Types diff --git a/Source/WebCore/svg/SVGFEComponentTransferElement.cpp b/Source/WebCore/svg/SVGFEComponentTransferElement.cpp index f2a97aded..fc69dfc49 100644 --- a/Source/WebCore/svg/SVGFEComponentTransferElement.cpp +++ b/Source/WebCore/svg/SVGFEComponentTransferElement.cpp @@ -62,10 +62,10 @@ bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& at return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEComponentTransferElement::parseMappedAttribute(Attribute* attr) +void SVGFEComponentTransferElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEComponentTransferElement.h b/Source/WebCore/svg/SVGFEComponentTransferElement.h index f88735c74..edafcaa5d 100644 --- a/Source/WebCore/svg/SVGFEComponentTransferElement.h +++ b/Source/WebCore/svg/SVGFEComponentTransferElement.h @@ -36,7 +36,7 @@ private: // FIXME: svgAttributeChanged missing. bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) diff --git a/Source/WebCore/svg/SVGFECompositeElement.cpp b/Source/WebCore/svg/SVGFECompositeElement.cpp index 93d88d142..5108bfc3b 100644 --- a/Source/WebCore/svg/SVGFECompositeElement.cpp +++ b/Source/WebCore/svg/SVGFECompositeElement.cpp @@ -79,10 +79,10 @@ bool SVGFECompositeElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFECompositeElement::parseMappedAttribute(Attribute* attr) +void SVGFECompositeElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFECompositeElement.h b/Source/WebCore/svg/SVGFECompositeElement.h index 41053158b..09be4167d 100644 --- a/Source/WebCore/svg/SVGFECompositeElement.h +++ b/Source/WebCore/svg/SVGFECompositeElement.h @@ -82,7 +82,7 @@ private: SVGFECompositeElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFECompositeElement.idl b/Source/WebCore/svg/SVGFECompositeElement.idl index dc7fd8d7a..76840e57f 100644 --- a/Source/WebCore/svg/SVGFECompositeElement.idl +++ b/Source/WebCore/svg/SVGFECompositeElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFECompositeElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Composite Operators diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp index 2b57fbc7e..a58b8ef8e 100644 --- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp +++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp @@ -119,10 +119,10 @@ bool SVGFEConvolveMatrixElement::isSupportedAttribute(const QualifiedName& attrN return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEConvolveMatrixElement::parseMappedAttribute(Attribute* attr) +void SVGFEConvolveMatrixElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h index 171aaf055..9176fce28 100644 --- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.h +++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.h @@ -75,7 +75,7 @@ private: SVGFEConvolveMatrixElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl b/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl index d880aa77e..e78219d8a 100644 --- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl +++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFEConvolveMatrixElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Edge Mode Values diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp index 19516cb14..3f4993cd1 100644 --- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp +++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.cpp @@ -90,10 +90,10 @@ bool SVGFEDiffuseLightingElement::isSupportedAttribute(const QualifiedName& attr return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEDiffuseLightingElement::parseMappedAttribute(Attribute* attr) +void SVGFEDiffuseLightingElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name()) || attr->name() == SVGNames::lighting_colorAttr) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h index c0397efe4..57078d60d 100644 --- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.h +++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.h @@ -40,7 +40,7 @@ private: SVGFEDiffuseLightingElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp index 4d3241696..cff8dc76e 100644 --- a/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp +++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.cpp @@ -73,10 +73,10 @@ bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attr return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEDisplacementMapElement::parseMappedAttribute(Attribute* attr) +void SVGFEDisplacementMapElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.h b/Source/WebCore/svg/SVGFEDisplacementMapElement.h index 17e563d7a..b3df62a64 100644 --- a/Source/WebCore/svg/SVGFEDisplacementMapElement.h +++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.h @@ -75,7 +75,7 @@ private: SVGFEDisplacementMapElement(const QualifiedName& tagName, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.idl b/Source/WebCore/svg/SVGFEDisplacementMapElement.idl index 0fb4e631d..0729586da 100644 --- a/Source/WebCore/svg/SVGFEDisplacementMapElement.idl +++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFEDisplacementMapElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Channel Selectors diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.cpp b/Source/WebCore/svg/SVGFEDropShadowElement.cpp index d2259dd8f..de2d10931 100644 --- a/Source/WebCore/svg/SVGFEDropShadowElement.cpp +++ b/Source/WebCore/svg/SVGFEDropShadowElement.cpp @@ -95,10 +95,10 @@ bool SVGFEDropShadowElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEDropShadowElement::parseMappedAttribute(Attribute* attr) +void SVGFEDropShadowElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.h b/Source/WebCore/svg/SVGFEDropShadowElement.h index 50723a57d..bf0fb1b81 100644 --- a/Source/WebCore/svg/SVGFEDropShadowElement.h +++ b/Source/WebCore/svg/SVGFEDropShadowElement.h @@ -37,7 +37,7 @@ private: SVGFEDropShadowElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp index a63fea3ca..c967e94c5 100644 --- a/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp +++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.cpp @@ -85,10 +85,10 @@ bool SVGFEGaussianBlurElement::isSupportedAttribute(const QualifiedName& attrNam return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEGaussianBlurElement::parseMappedAttribute(Attribute* attr) +void SVGFEGaussianBlurElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.h b/Source/WebCore/svg/SVGFEGaussianBlurElement.h index cfc283c2d..5f4146034 100644 --- a/Source/WebCore/svg/SVGFEGaussianBlurElement.h +++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.h @@ -38,7 +38,7 @@ private: SVGFEGaussianBlurElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEImageElement.cpp b/Source/WebCore/svg/SVGFEImageElement.cpp index 7050c25c2..8d5d19789 100644 --- a/Source/WebCore/svg/SVGFEImageElement.cpp +++ b/Source/WebCore/svg/SVGFEImageElement.cpp @@ -73,6 +73,9 @@ void SVGFEImageElement::clearResourceReferences() m_cachedImage->removeClient(this); m_cachedImage = 0; } + + ASSERT(document()); + document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this); } void SVGFEImageElement::requestImageResource() @@ -102,6 +105,10 @@ void SVGFEImageElement::buildPendingResource() document()->accessSVGExtensions()->addPendingResource(id, this); ASSERT(hasPendingResources()); } + } else if (target->isSVGElement()) { + // Register us with the target in the dependencies map. Any change of hrefElement + // that leads to relayout/repainting now informs us, so we can react to it. + document()->accessSVGExtensions()->addElementReferencingTarget(this, static_cast<SVGElement*>(target)); } invalidate(); @@ -119,10 +126,10 @@ bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEImageElement::parseMappedAttribute(Attribute* attr) +void SVGFEImageElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } @@ -132,11 +139,11 @@ void SVGFEImageElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGFEImageElement.h b/Source/WebCore/svg/SVGFEImageElement.h index 112ef25cd..f438c6f0a 100644 --- a/Source/WebCore/svg/SVGFEImageElement.h +++ b/Source/WebCore/svg/SVGFEImageElement.h @@ -49,7 +49,7 @@ private: SVGFEImageElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void notifyFinished(CachedResource*); diff --git a/Source/WebCore/svg/SVGFELightElement.cpp b/Source/WebCore/svg/SVGFELightElement.cpp index dca889005..b818a050f 100644 --- a/Source/WebCore/svg/SVGFELightElement.cpp +++ b/Source/WebCore/svg/SVGFELightElement.cpp @@ -106,10 +106,10 @@ bool SVGFELightElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFELightElement::parseMappedAttribute(Attribute* attr) +void SVGFELightElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFELightElement.h b/Source/WebCore/svg/SVGFELightElement.h index 1a81f5dba..39ece3fa3 100644 --- a/Source/WebCore/svg/SVGFELightElement.h +++ b/Source/WebCore/svg/SVGFELightElement.h @@ -40,7 +40,7 @@ protected: private: bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGFEMergeNodeElement.cpp b/Source/WebCore/svg/SVGFEMergeNodeElement.cpp index d5f37f118..b5b5cc513 100644 --- a/Source/WebCore/svg/SVGFEMergeNodeElement.cpp +++ b/Source/WebCore/svg/SVGFEMergeNodeElement.cpp @@ -60,10 +60,10 @@ bool SVGFEMergeNodeElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEMergeNodeElement::parseMappedAttribute(Attribute* attr) +void SVGFEMergeNodeElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEMergeNodeElement.h b/Source/WebCore/svg/SVGFEMergeNodeElement.h index dcd82a575..e4eab7636 100644 --- a/Source/WebCore/svg/SVGFEMergeNodeElement.h +++ b/Source/WebCore/svg/SVGFEMergeNodeElement.h @@ -35,7 +35,7 @@ private: SVGFEMergeNodeElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMergeNodeElement) diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.cpp b/Source/WebCore/svg/SVGFEMorphologyElement.cpp index 84b409688..13c6ce663 100644 --- a/Source/WebCore/svg/SVGFEMorphologyElement.cpp +++ b/Source/WebCore/svg/SVGFEMorphologyElement.cpp @@ -88,10 +88,10 @@ bool SVGFEMorphologyElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEMorphologyElement::parseMappedAttribute(Attribute* attr) +void SVGFEMorphologyElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.h b/Source/WebCore/svg/SVGFEMorphologyElement.h index 36008a518..7e63d0dbd 100644 --- a/Source/WebCore/svg/SVGFEMorphologyElement.h +++ b/Source/WebCore/svg/SVGFEMorphologyElement.h @@ -67,7 +67,7 @@ private: SVGFEMorphologyElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.idl b/Source/WebCore/svg/SVGFEMorphologyElement.idl index 37de35398..b31d74fb6 100644 --- a/Source/WebCore/svg/SVGFEMorphologyElement.idl +++ b/Source/WebCore/svg/SVGFEMorphologyElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFEMorphologyElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Morphology Operators diff --git a/Source/WebCore/svg/SVGFEOffsetElement.cpp b/Source/WebCore/svg/SVGFEOffsetElement.cpp index fe9c371cc..0bd4ccb21 100644 --- a/Source/WebCore/svg/SVGFEOffsetElement.cpp +++ b/Source/WebCore/svg/SVGFEOffsetElement.cpp @@ -66,10 +66,10 @@ bool SVGFEOffsetElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFEOffsetElement::parseMappedAttribute(Attribute* attr) +void SVGFEOffsetElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFEOffsetElement.h b/Source/WebCore/svg/SVGFEOffsetElement.h index b42c571c9..20c6ae190 100644 --- a/Source/WebCore/svg/SVGFEOffsetElement.h +++ b/Source/WebCore/svg/SVGFEOffsetElement.h @@ -36,7 +36,7 @@ private: SVGFEOffsetElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp index 827155cf2..5fab21490 100644 --- a/Source/WebCore/svg/SVGFESpecularLightingElement.cpp +++ b/Source/WebCore/svg/SVGFESpecularLightingElement.cpp @@ -94,10 +94,10 @@ bool SVGFESpecularLightingElement::isSupportedAttribute(const QualifiedName& att return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFESpecularLightingElement::parseMappedAttribute(Attribute* attr) +void SVGFESpecularLightingElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.h b/Source/WebCore/svg/SVGFESpecularLightingElement.h index 632e7cf76..c67fddcaa 100644 --- a/Source/WebCore/svg/SVGFESpecularLightingElement.h +++ b/Source/WebCore/svg/SVGFESpecularLightingElement.h @@ -39,7 +39,7 @@ private: SVGFESpecularLightingElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName&); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFETileElement.cpp b/Source/WebCore/svg/SVGFETileElement.cpp index 1cbe258a7..8162eaa9b 100644 --- a/Source/WebCore/svg/SVGFETileElement.cpp +++ b/Source/WebCore/svg/SVGFETileElement.cpp @@ -60,10 +60,10 @@ bool SVGFETileElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFETileElement::parseMappedAttribute(Attribute* attr) +void SVGFETileElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFETileElement.h b/Source/WebCore/svg/SVGFETileElement.h index f479f101a..9094eb338 100644 --- a/Source/WebCore/svg/SVGFETileElement.h +++ b/Source/WebCore/svg/SVGFETileElement.h @@ -35,7 +35,7 @@ private: SVGFETileElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.cpp b/Source/WebCore/svg/SVGFETurbulenceElement.cpp index 8912606ab..02756fe7d 100644 --- a/Source/WebCore/svg/SVGFETurbulenceElement.cpp +++ b/Source/WebCore/svg/SVGFETurbulenceElement.cpp @@ -88,10 +88,10 @@ bool SVGFETurbulenceElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFETurbulenceElement::parseMappedAttribute(Attribute* attr) +void SVGFETurbulenceElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(attr); + SVGFilterPrimitiveStandardAttributes::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.h b/Source/WebCore/svg/SVGFETurbulenceElement.h index 9c4804f67..2c1e9ca4b 100644 --- a/Source/WebCore/svg/SVGFETurbulenceElement.h +++ b/Source/WebCore/svg/SVGFETurbulenceElement.h @@ -102,7 +102,7 @@ private: SVGFETurbulenceElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName); virtual void svgAttributeChanged(const QualifiedName&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.idl b/Source/WebCore/svg/SVGFETurbulenceElement.idl index bd538bdae..0060fbf92 100644 --- a/Source/WebCore/svg/SVGFETurbulenceElement.idl +++ b/Source/WebCore/svg/SVGFETurbulenceElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG&FILTERS, - DontCheckEnums + DoNotCheckConstants ] SVGFETurbulenceElement : SVGElement, SVGFilterPrimitiveStandardAttributes { // Turbulence Types diff --git a/Source/WebCore/svg/SVGFilterElement.cpp b/Source/WebCore/svg/SVGFilterElement.cpp index 7f5b0b639..99550a37f 100644 --- a/Source/WebCore/svg/SVGFilterElement.cpp +++ b/Source/WebCore/svg/SVGFilterElement.cpp @@ -120,13 +120,13 @@ bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFilterElement::parseMappedAttribute(Attribute* attr) +void SVGFilterElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; const AtomicString& value = attr->value(); if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::filterUnitsAttr) { SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value); if (propertyValue > 0) @@ -149,9 +149,9 @@ void SVGFilterElement::parseMappedAttribute(Attribute* attr) setFilterResXBaseValue(x); setFilterResYBaseValue(y); } - } else if (SVGURIReference::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + } else if (SVGURIReference::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGFilterElement.h b/Source/WebCore/svg/SVGFilterElement.h index 2997eb207..48b67664e 100644 --- a/Source/WebCore/svg/SVGFilterElement.h +++ b/Source/WebCore/svg/SVGFilterElement.h @@ -51,7 +51,7 @@ private: virtual bool needsPendingResourceHandling() const { return false; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp index 9aff25c3c..1c9714364 100644 --- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -77,13 +77,13 @@ bool SVGFilterPrimitiveStandardAttributes::isSupportedAttribute(const QualifiedN return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(Attribute* attr) +void SVGFilterPrimitiveStandardAttributes::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; const AtomicString& value = attr->value(); if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (attr->name() == SVGNames::yAttr) diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h index 6c5f30ddd..58dc09237 100644 --- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h +++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h @@ -49,7 +49,7 @@ protected: SVGFilterPrimitiveStandardAttributes(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGFitToViewBox.cpp b/Source/WebCore/svg/SVGFitToViewBox.cpp index 6ea3aa9cd..b548c54b8 100644 --- a/Source/WebCore/svg/SVGFitToViewBox.cpp +++ b/Source/WebCore/svg/SVGFitToViewBox.cpp @@ -88,7 +88,7 @@ AffineTransform SVGFitToViewBox::viewBoxToViewTransform(const FloatRect& viewBox return preserveAspectRatio.getCTM(viewBoxRect.x(), viewBoxRect.y(), viewBoxRect.width(), viewBoxRect.height(), viewWidth, viewHeight); } -bool SVGFitToViewBox::parseMappedAttribute(Document* document, Attribute* attr) +bool SVGFitToViewBox::parseAttribute(Document* document, Attribute* attr) { if (attr->name() == SVGNames::viewBoxAttr) { FloatRect viewBox; diff --git a/Source/WebCore/svg/SVGFitToViewBox.h b/Source/WebCore/svg/SVGFitToViewBox.h index 3c8cebc92..8ce5e9acf 100644 --- a/Source/WebCore/svg/SVGFitToViewBox.h +++ b/Source/WebCore/svg/SVGFitToViewBox.h @@ -40,7 +40,7 @@ public: bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true); static AffineTransform viewBoxToViewTransform(const FloatRect& viewBoxRect, const SVGPreserveAspectRatio&, float viewWidth, float viewHeight); - bool parseMappedAttribute(Document*, Attribute*); + bool parseAttribute(Document*, Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp index 06e500120..51fbc4447 100644 --- a/Source/WebCore/svg/SVGFontFaceElement.cpp +++ b/Source/WebCore/svg/SVGFontFaceElement.cpp @@ -51,7 +51,7 @@ inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Docu , m_fontFaceRule(CSSFontFaceRule::create()) { ASSERT(hasTagName(font_faceTag)); - RefPtr<CSSMutableStyleDeclaration> styleDeclaration = CSSMutableStyleDeclaration::create(m_fontFaceRule.get()); + RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(m_fontFaceRule.get()); styleDeclaration->setStrictParsing(true); m_fontFaceRule->setDeclaration(styleDeclaration.release()); } @@ -109,7 +109,7 @@ static int cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) return propertyNameToIdMap->get(attrName.localName().impl()); } -void SVGFontFaceElement::parseMappedAttribute(Attribute* attr) +void SVGFontFaceElement::parseAttribute(Attribute* attr) { int propId = cssPropertyIdForSVGAttributeName(attr->name()); if (propId > 0) { @@ -118,7 +118,7 @@ void SVGFontFaceElement::parseMappedAttribute(Attribute* attr) return; } - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); } unsigned SVGFontFaceElement::unitsPerEm() const diff --git a/Source/WebCore/svg/SVGFontFaceElement.h b/Source/WebCore/svg/SVGFontFaceElement.h index a137c10dd..6754d1708 100644 --- a/Source/WebCore/svg/SVGFontFaceElement.h +++ b/Source/WebCore/svg/SVGFontFaceElement.h @@ -28,7 +28,6 @@ namespace WebCore { class CSSFontFaceRule; -class CSSMutableStyleDeclaration; class SVGFontElement; class SVGFontFaceElement : public SVGElement { @@ -54,7 +53,7 @@ public: private: SVGFontFaceElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.cpp b/Source/WebCore/svg/SVGFontFaceUriElement.cpp index b2d7ba614..005c643e4 100644 --- a/Source/WebCore/svg/SVGFontFaceUriElement.cpp +++ b/Source/WebCore/svg/SVGFontFaceUriElement.cpp @@ -61,13 +61,13 @@ PassRefPtr<CSSFontFaceSrcValue> SVGFontFaceUriElement::srcValue() const return src.release(); } -void SVGFontFaceUriElement::parseMappedAttribute(Attribute* attr) +void SVGFontFaceUriElement::parseAttribute(Attribute* attr) { const QualifiedName& attrName = attr->name(); if (attrName == XLinkNames::hrefAttr) loadFont(); else - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); } void SVGFontFaceUriElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.h b/Source/WebCore/svg/SVGFontFaceUriElement.h index 0f2727862..d999b3aea 100644 --- a/Source/WebCore/svg/SVGFontFaceUriElement.h +++ b/Source/WebCore/svg/SVGFontFaceUriElement.h @@ -40,7 +40,7 @@ public: private: SVGFontFaceUriElement(const QualifiedName&, Document*); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual void insertedIntoDocument(); diff --git a/Source/WebCore/svg/SVGForeignObjectElement.cpp b/Source/WebCore/svg/SVGForeignObjectElement.cpp index e2faeff74..d792c47a1 100644 --- a/Source/WebCore/svg/SVGForeignObjectElement.cpp +++ b/Source/WebCore/svg/SVGForeignObjectElement.cpp @@ -84,13 +84,13 @@ bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGForeignObjectElement::parseMappedAttribute(Attribute* attr) +void SVGForeignObjectElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; const AtomicString& value = attr->value(); if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (attr->name() == SVGNames::yAttr) @@ -99,9 +99,9 @@ void SVGForeignObjectElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGForeignObjectElement.h b/Source/WebCore/svg/SVGForeignObjectElement.h index 369f5190a..67266d5da 100644 --- a/Source/WebCore/svg/SVGForeignObjectElement.h +++ b/Source/WebCore/svg/SVGForeignObjectElement.h @@ -43,7 +43,7 @@ private: virtual bool isValid() const { return SVGTests::isValid(); } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool childShouldCreateRenderer(Node*) const; diff --git a/Source/WebCore/svg/SVGGElement.cpp b/Source/WebCore/svg/SVGGElement.cpp index 4b235944c..4f539f26f 100644 --- a/Source/WebCore/svg/SVGGElement.cpp +++ b/Source/WebCore/svg/SVGGElement.cpp @@ -63,18 +63,18 @@ bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGGElement::parseMappedAttribute(Attribute* attr) +void SVGGElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); return; } - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGGElement.h b/Source/WebCore/svg/SVGGElement.h index 551ac0984..6520fa6dd 100644 --- a/Source/WebCore/svg/SVGGElement.h +++ b/Source/WebCore/svg/SVGGElement.h @@ -49,7 +49,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool rendererIsNeeded(const NodeRenderingContext&); diff --git a/Source/WebCore/svg/SVGGlyphElement.cpp b/Source/WebCore/svg/SVGGlyphElement.cpp index 09000bb74..3f3c8f5ba 100644 --- a/Source/WebCore/svg/SVGGlyphElement.cpp +++ b/Source/WebCore/svg/SVGGlyphElement.cpp @@ -53,12 +53,12 @@ void SVGGlyphElement::invalidateGlyphCache() } } -void SVGGlyphElement::parseMappedAttribute(Attribute* attr) +void SVGGlyphElement::parseAttribute(Attribute* attr) { if (attr->name() == SVGNames::dAttr) invalidateGlyphCache(); else - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); } void SVGGlyphElement::insertedIntoDocument() diff --git a/Source/WebCore/svg/SVGGlyphElement.h b/Source/WebCore/svg/SVGGlyphElement.h index 60be413e5..c7b99d990 100644 --- a/Source/WebCore/svg/SVGGlyphElement.h +++ b/Source/WebCore/svg/SVGGlyphElement.h @@ -47,7 +47,7 @@ private: SVGGlyphElement(const QualifiedName&, Document*); // FIXME: svgAttributeChanged missing. - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/svg/SVGGlyphRefElement.cpp b/Source/WebCore/svg/SVGGlyphRefElement.cpp index 1c3d49471..cba83f235 100644 --- a/Source/WebCore/svg/SVGGlyphRefElement.cpp +++ b/Source/WebCore/svg/SVGGlyphRefElement.cpp @@ -64,7 +64,7 @@ bool SVGGlyphRefElement::hasValidGlyphElement(String& glyphName) const return true; } -void SVGGlyphRefElement::parseMappedAttribute(Attribute* attr) +void SVGGlyphRefElement::parseAttribute(Attribute* attr) { const UChar* startPtr = attr->value().characters(); const UChar* endPtr = startPtr + attr->value().length(); @@ -79,9 +79,9 @@ void SVGGlyphRefElement::parseMappedAttribute(Attribute* attr) else if (attr->name() == SVGNames::dyAttr) parseNumber(startPtr, endPtr, m_dy); else { - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); } } diff --git a/Source/WebCore/svg/SVGGlyphRefElement.h b/Source/WebCore/svg/SVGGlyphRefElement.h index d709e01cd..f6641e3f4 100644 --- a/Source/WebCore/svg/SVGGlyphRefElement.h +++ b/Source/WebCore/svg/SVGGlyphRefElement.h @@ -32,7 +32,7 @@ public: static PassRefPtr<SVGGlyphRefElement> create(const QualifiedName&, Document*); bool hasValidGlyphElement(String& glyphName) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; // DOM interface const AtomicString& glyphRef() const; diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp index f3499805f..c959464ea 100644 --- a/Source/WebCore/svg/SVGGradientElement.cpp +++ b/Source/WebCore/svg/SVGGradientElement.cpp @@ -75,10 +75,10 @@ bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGGradientElement::parseMappedAttribute(Attribute* attr) +void SVGGradientElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); return; } @@ -106,9 +106,9 @@ void SVGGradientElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGGradientElement.h b/Source/WebCore/svg/SVGGradientElement.h index 1150959a8..feaeb3443 100644 --- a/Source/WebCore/svg/SVGGradientElement.h +++ b/Source/WebCore/svg/SVGGradientElement.h @@ -90,7 +90,7 @@ protected: SVGGradientElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); private: diff --git a/Source/WebCore/svg/SVGGradientElement.idl b/Source/WebCore/svg/SVGGradientElement.idl index 853081fda..6db27fbe4 100644 --- a/Source/WebCore/svg/SVGGradientElement.idl +++ b/Source/WebCore/svg/SVGGradientElement.idl @@ -27,7 +27,7 @@ module svg { interface [ Conditional=SVG, - DontCheckEnums + DoNotCheckConstants ] SVGGradientElement : SVGElement, SVGURIReference, SVGExternalResourcesRequired, diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp index 447d70f02..bf10a1ea9 100644 --- a/Source/WebCore/svg/SVGImageElement.cpp +++ b/Source/WebCore/svg/SVGImageElement.cpp @@ -91,12 +91,12 @@ bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGImageElement::parseMappedAttribute(Attribute* attr) +void SVGImageElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::yAttr) @@ -105,14 +105,14 @@ void SVGImageElement::parseMappedAttribute(Attribute* attr) SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value()); else if (attr->name() == SVGNames::widthAttr) { setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); - addCSSProperty(attr, CSSPropertyWidth, attr->value()); + addCSSProperty(CSSPropertyWidth, attr->value()); } else if (attr->name() == SVGNames::heightAttr) { setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - addCSSProperty(attr, CSSPropertyHeight, attr->value()); - } else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGURIReference::parseMappedAttribute(attr)) { + addCSSProperty(CSSPropertyHeight, attr->value()); + } else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGURIReference::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGImageElement.h b/Source/WebCore/svg/SVGImageElement.h index b5b03b0bd..1fbbb0fd7 100644 --- a/Source/WebCore/svg/SVGImageElement.h +++ b/Source/WebCore/svg/SVGImageElement.h @@ -49,7 +49,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void attach(); diff --git a/Source/WebCore/svg/SVGLangSpace.cpp b/Source/WebCore/svg/SVGLangSpace.cpp index 01695f032..58f18520b 100644 --- a/Source/WebCore/svg/SVGLangSpace.cpp +++ b/Source/WebCore/svg/SVGLangSpace.cpp @@ -50,7 +50,7 @@ void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) m_space = xmlSpace; } -bool SVGLangSpace::parseMappedAttribute(Attribute* attr) +bool SVGLangSpace::parseAttribute(Attribute* attr) { if (attr->name().matches(XMLNames::langAttr)) { setXmllang(attr->value()); diff --git a/Source/WebCore/svg/SVGLangSpace.h b/Source/WebCore/svg/SVGLangSpace.h index a5c9c0e8c..8a84b2f36 100644 --- a/Source/WebCore/svg/SVGLangSpace.h +++ b/Source/WebCore/svg/SVGLangSpace.h @@ -37,7 +37,7 @@ public: const AtomicString& xmlspace() const; void setXmlspace(const AtomicString& xmlSpace); - bool parseMappedAttribute(Attribute*); + bool parseAttribute(Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/SVGLength.idl b/Source/WebCore/svg/SVGLength.idl index f9af7de9c..a5c952dfc 100644 --- a/Source/WebCore/svg/SVGLength.idl +++ b/Source/WebCore/svg/SVGLength.idl @@ -44,7 +44,7 @@ module svg { getter raises(DOMException); attribute [StrictTypeChecking] float valueInSpecifiedUnits; - attribute [TreatNullAs=EmptyString, StrictTypeChecking] DOMString valueAsString + attribute [TreatNullAs=NullString, StrictTypeChecking] DOMString valueAsString setter raises(DOMException); [StrictTypeChecking] void newValueSpecifiedUnits(in unsigned short unitType, diff --git a/Source/WebCore/svg/SVGLineElement.cpp b/Source/WebCore/svg/SVGLineElement.cpp index 444267621..f057053ae 100644 --- a/Source/WebCore/svg/SVGLineElement.cpp +++ b/Source/WebCore/svg/SVGLineElement.cpp @@ -81,12 +81,12 @@ bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGLineElement::parseMappedAttribute(Attribute* attr) +void SVGLineElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::x1Attr) setX1BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::y1Attr) @@ -95,9 +95,9 @@ void SVGLineElement::parseMappedAttribute(Attribute* attr) setX2BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::y2Attr) setY2BaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGLineElement.h b/Source/WebCore/svg/SVGLineElement.h index 786e83b5d..d706f75ae 100644 --- a/Source/WebCore/svg/SVGLineElement.h +++ b/Source/WebCore/svg/SVGLineElement.h @@ -45,7 +45,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool supportsMarkers() const { return true; } diff --git a/Source/WebCore/svg/SVGLinearGradientElement.cpp b/Source/WebCore/svg/SVGLinearGradientElement.cpp index 1341e31c7..85022ca18 100644 --- a/Source/WebCore/svg/SVGLinearGradientElement.cpp +++ b/Source/WebCore/svg/SVGLinearGradientElement.cpp @@ -83,12 +83,12 @@ bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrNam return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGLinearGradientElement::parseMappedAttribute(Attribute* attr) +void SVGLinearGradientElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGGradientElement::parseMappedAttribute(attr); + SVGGradientElement::parseAttribute(attr); else if (attr->name() == SVGNames::x1Attr) setX1BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::y1Attr) diff --git a/Source/WebCore/svg/SVGLinearGradientElement.h b/Source/WebCore/svg/SVGLinearGradientElement.h index 137a72dad..d89891291 100644 --- a/Source/WebCore/svg/SVGLinearGradientElement.h +++ b/Source/WebCore/svg/SVGLinearGradientElement.h @@ -39,7 +39,7 @@ private: SVGLinearGradientElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGMPathElement.cpp b/Source/WebCore/svg/SVGMPathElement.cpp index b36cd52c5..eaea9814b 100644 --- a/Source/WebCore/svg/SVGMPathElement.cpp +++ b/Source/WebCore/svg/SVGMPathElement.cpp @@ -59,16 +59,16 @@ bool SVGMPathElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGMPathElement::parseMappedAttribute(Attribute* attr) +void SVGMPathElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGMPathElement.h b/Source/WebCore/svg/SVGMPathElement.h index eb5fc0ca9..1f3654a7c 100644 --- a/Source/WebCore/svg/SVGMPathElement.h +++ b/Source/WebCore/svg/SVGMPathElement.h @@ -43,7 +43,7 @@ private: // FIXME: svgAttributeChanged missing. bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement) DECLARE_ANIMATED_STRING(Href, href) diff --git a/Source/WebCore/svg/SVGMarkerElement.cpp b/Source/WebCore/svg/SVGMarkerElement.cpp index cbf1b74cf..5e1a854dd 100644 --- a/Source/WebCore/svg/SVGMarkerElement.cpp +++ b/Source/WebCore/svg/SVGMarkerElement.cpp @@ -125,13 +125,13 @@ bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGMarkerElement::parseMappedAttribute(Attribute* attr) +void SVGMarkerElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; const AtomicString& value = attr->value(); if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::markerUnitsAttr) { SVGMarkerUnitsType propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value); if (propertyValue > 0) @@ -151,9 +151,9 @@ void SVGMarkerElement::parseMappedAttribute(Attribute* attr) setOrientTypeBaseValue(orientType); if (orientType == SVGMarkerOrientAngle) setOrientAngleBaseValue(angle); - } else if (SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGFitToViewBox::parseMappedAttribute(document(), attr)) { + } else if (SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGFitToViewBox::parseAttribute(document(), attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGMarkerElement.h b/Source/WebCore/svg/SVGMarkerElement.h index 054cb87f8..6aa4d05c4 100644 --- a/Source/WebCore/svg/SVGMarkerElement.h +++ b/Source/WebCore/svg/SVGMarkerElement.h @@ -128,7 +128,7 @@ private: virtual bool needsPendingResourceHandling() const { return false; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGMaskElement.cpp b/Source/WebCore/svg/SVGMaskElement.cpp index a8089e3ff..d6ef40520 100644 --- a/Source/WebCore/svg/SVGMaskElement.cpp +++ b/Source/WebCore/svg/SVGMaskElement.cpp @@ -94,12 +94,12 @@ bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGMaskElement::parseMappedAttribute(Attribute* attr) +void SVGMaskElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::maskUnitsAttr) { SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); if (propertyValue > 0) @@ -118,9 +118,9 @@ void SVGMaskElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGMaskElement.h b/Source/WebCore/svg/SVGMaskElement.h index 0bf428ab1..c35c2897c 100644 --- a/Source/WebCore/svg/SVGMaskElement.h +++ b/Source/WebCore/svg/SVGMaskElement.h @@ -46,7 +46,7 @@ private: virtual bool needsPendingResourceHandling() const { return false; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGPathElement.cpp b/Source/WebCore/svg/SVGPathElement.cpp index 62b904a4d..ccf803614 100644 --- a/Source/WebCore/svg/SVGPathElement.cpp +++ b/Source/WebCore/svg/SVGPathElement.cpp @@ -216,10 +216,10 @@ bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGPathElement::parseMappedAttribute(Attribute* attr) +void SVGPathElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); return; } @@ -237,11 +237,11 @@ void SVGPathElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGPathElement.h b/Source/WebCore/svg/SVGPathElement.h index c6bf22025..0ade5bcc0 100644 --- a/Source/WebCore/svg/SVGPathElement.h +++ b/Source/WebCore/svg/SVGPathElement.h @@ -105,7 +105,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool supportsMarkers() const { return true; } diff --git a/Source/WebCore/svg/SVGPathSeg.idl b/Source/WebCore/svg/SVGPathSeg.idl index 4b6bddae8..5b967c2c9 100644 --- a/Source/WebCore/svg/SVGPathSeg.idl +++ b/Source/WebCore/svg/SVGPathSeg.idl @@ -28,8 +28,8 @@ module svg { interface [ Conditional=SVG, - CustomToJS, - Polymorphic + JSCustomToJS, + ObjCPolymorphic ] SVGPathSeg { // Path Segment Types const unsigned short PATHSEG_UNKNOWN = 0; diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp index e997c92ff..8bf97b358 100644 --- a/Source/WebCore/svg/SVGPatternElement.cpp +++ b/Source/WebCore/svg/SVGPatternElement.cpp @@ -109,12 +109,12 @@ bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGPatternElement::parseMappedAttribute(Attribute* attr) +void SVGPatternElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::patternUnitsAttr) { SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value()); if (propertyValue > 0) @@ -141,11 +141,11 @@ void SVGPatternElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGURIReference::parseMappedAttribute(attr) - || SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGFitToViewBox::parseMappedAttribute(document(), attr)) { + else if (SVGURIReference::parseAttribute(attr) + || SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGFitToViewBox::parseAttribute(document(), attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGPatternElement.h b/Source/WebCore/svg/SVGPatternElement.h index 0365b9679..a9cd40e4f 100644 --- a/Source/WebCore/svg/SVGPatternElement.h +++ b/Source/WebCore/svg/SVGPatternElement.h @@ -58,7 +58,7 @@ private: virtual bool needsPendingResourceHandling() const { return false; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGPolyElement.cpp b/Source/WebCore/svg/SVGPolyElement.cpp index a8b67c731..cae62514c 100644 --- a/Source/WebCore/svg/SVGPolyElement.cpp +++ b/Source/WebCore/svg/SVGPolyElement.cpp @@ -77,10 +77,10 @@ bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGPolyElement::parseMappedAttribute(Attribute* attr) +void SVGPolyElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); return; } @@ -97,11 +97,11 @@ void SVGPolyElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGTests::parseMappedAttribute(attr)) + if (SVGTests::parseAttribute(attr)) return; - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGPolyElement.h b/Source/WebCore/svg/SVGPolyElement.h index efcf1ab88..4cb79f4be 100644 --- a/Source/WebCore/svg/SVGPolyElement.h +++ b/Source/WebCore/svg/SVGPolyElement.h @@ -51,7 +51,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool supportsMarkers() const { return true; } diff --git a/Source/WebCore/svg/SVGRadialGradientElement.cpp b/Source/WebCore/svg/SVGRadialGradientElement.cpp index 62e24f593..a244ef001 100644 --- a/Source/WebCore/svg/SVGRadialGradientElement.cpp +++ b/Source/WebCore/svg/SVGRadialGradientElement.cpp @@ -87,12 +87,12 @@ bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrNam return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGRadialGradientElement::parseMappedAttribute(Attribute* attr) +void SVGRadialGradientElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGGradientElement::parseMappedAttribute(attr); + SVGGradientElement::parseAttribute(attr); else if (attr->name() == SVGNames::cxAttr) setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::cyAttr) diff --git a/Source/WebCore/svg/SVGRadialGradientElement.h b/Source/WebCore/svg/SVGRadialGradientElement.h index ac3c95984..1952d7b5e 100644 --- a/Source/WebCore/svg/SVGRadialGradientElement.h +++ b/Source/WebCore/svg/SVGRadialGradientElement.h @@ -39,7 +39,7 @@ private: SVGRadialGradientElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGRectElement.cpp b/Source/WebCore/svg/SVGRectElement.cpp index eca03dfa8..9797be739 100644 --- a/Source/WebCore/svg/SVGRectElement.cpp +++ b/Source/WebCore/svg/SVGRectElement.cpp @@ -91,12 +91,12 @@ bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGRectElement::parseMappedAttribute(Attribute* attr) +void SVGRectElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::yAttr) @@ -109,9 +109,9 @@ void SVGRectElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGRectElement.h b/Source/WebCore/svg/SVGRectElement.h index 2704689f2..f13c7c7b2 100644 --- a/Source/WebCore/svg/SVGRectElement.h +++ b/Source/WebCore/svg/SVGRectElement.h @@ -45,7 +45,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool selfHasRelativeLengths() const; diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp index ebce72794..8d6f1b03a 100644 --- a/Source/WebCore/svg/SVGSVGElement.cpp +++ b/Source/WebCore/svg/SVGSVGElement.cpp @@ -186,7 +186,7 @@ SVGViewSpec* SVGSVGElement::currentView() const float SVGSVGElement::currentScale() const { - if (!inDocument() || !isOutermostSVG()) + if (!inDocument() || !isOutermostSVGSVGElement()) return 1; Frame* frame = document()->frame(); @@ -204,7 +204,7 @@ float SVGSVGElement::currentScale() const void SVGSVGElement::setCurrentScale(float scale) { - if (!inDocument() || !isOutermostSVG()) + if (!inDocument() || !isOutermostSVGSVGElement()) return; Frame* frame = document()->frame(); @@ -238,7 +238,7 @@ void SVGSVGElement::updateCurrentTranslate() document()->renderer()->repaint(); } -void SVGSVGElement::parseMappedAttribute(Attribute* attr) +void SVGSVGElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; @@ -273,13 +273,13 @@ void SVGSVGElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGFitToViewBox::parseMappedAttribute(document(), attr) - || SVGZoomAndPan::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGFitToViewBox::parseAttribute(document(), attr) + || SVGZoomAndPan::parseAttribute(attr)) { } else - SVGStyledLocatableElement::parseMappedAttribute(attr); + SVGStyledLocatableElement::parseAttribute(attr); reportAttributeParsingError(parseError, attr); } @@ -303,7 +303,8 @@ void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) if (updateRelativeLengths || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) - || SVGZoomAndPan::isKnownAttribute(attrName)) { + || SVGZoomAndPan::isKnownAttribute(attrName) + || attrName == SVGNames::viewBoxAttr) { if (renderer()) RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer()); return; @@ -428,7 +429,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc } AffineTransform transform; - if (!isOutermostSVG()) { + if (!isOutermostSVGSVGElement()) { SVGLengthContext lengthContext(this); transform.translate(x().value(lengthContext), y().value(lengthContext)); } else if (mode == SVGLocatable::ScreenScope) { @@ -455,7 +456,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc RenderObject* SVGSVGElement::createRenderer(RenderArena* arena, RenderStyle*) { - if (isOutermostSVG()) + if (isOutermostSVGSVGElement()) return new (arena) RenderSVGRoot(this); return new (arena) RenderSVGViewportContainer(this); @@ -512,20 +513,6 @@ bool SVGSVGElement::selfHasRelativeLengths() const || hasAttribute(SVGNames::viewBoxAttr); } -bool SVGSVGElement::isOutermostSVG() const -{ - // Element may not be in the document, pretend we're outermost for viewport(), getCTM(), etc. - if (!parentNode()) - return true; - - // We act like an outermost SVG element, if we're a direct child of a <foreignObject> element. - if (parentNode()->hasTagName(SVGNames::foreignObjectTag)) - return true; - - // This is true whenever this is the outermost SVG, even if there are HTML elements outside it - return !parentNode()->isSVGElement(); -} - FloatRect SVGSVGElement::currentViewBoxRect() const { if (useCurrentView()) { diff --git a/Source/WebCore/svg/SVGSVGElement.h b/Source/WebCore/svg/SVGSVGElement.h index a1d449692..10c59c285 100644 --- a/Source/WebCore/svg/SVGSVGElement.h +++ b/Source/WebCore/svg/SVGSVGElement.h @@ -126,8 +126,6 @@ public: void setupInitialView(const String& fragmentIdentifier, Element* anchorNode); - bool isOutermostSVG() const; - Element* getElementById(const AtomicString&) const; bool widthAttributeEstablishesViewport() const; @@ -142,7 +140,7 @@ private: virtual bool isSVG() const { return true; } - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext& context) { return StyledElement::rendererIsNeeded(context); } virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGScriptElement.cpp b/Source/WebCore/svg/SVGScriptElement.cpp index 6f38dfa3a..39192e68a 100644 --- a/Source/WebCore/svg/SVGScriptElement.cpp +++ b/Source/WebCore/svg/SVGScriptElement.cpp @@ -69,10 +69,10 @@ bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGScriptElement::parseMappedAttribute(Attribute* attr) +void SVGScriptElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } @@ -86,9 +86,9 @@ void SVGScriptElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGURIReference::parseMappedAttribute(attr)) + if (SVGURIReference::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGScriptElement.h b/Source/WebCore/svg/SVGScriptElement.h index 4294e01cc..f7335d23c 100644 --- a/Source/WebCore/svg/SVGScriptElement.h +++ b/Source/WebCore/svg/SVGScriptElement.h @@ -45,7 +45,7 @@ private: SVGScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGScriptElement.idl b/Source/WebCore/svg/SVGScriptElement.idl index b5244e65c..111ee59af 100644 --- a/Source/WebCore/svg/SVGScriptElement.idl +++ b/Source/WebCore/svg/SVGScriptElement.idl @@ -30,7 +30,7 @@ module svg { ] SVGScriptElement : SVGElement, SVGURIReference, SVGExternalResourcesRequired { - attribute [TreatNullAs=EmptyString] DOMString type + attribute [TreatNullAs=NullString] DOMString type /*setter raises(DOMException)*/; }; diff --git a/Source/WebCore/svg/SVGStopElement.cpp b/Source/WebCore/svg/SVGStopElement.cpp index 92d0b9b19..7b973a3c0 100644 --- a/Source/WebCore/svg/SVGStopElement.cpp +++ b/Source/WebCore/svg/SVGStopElement.cpp @@ -62,10 +62,10 @@ bool SVGStopElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGStopElement::parseMappedAttribute(Attribute* attr) +void SVGStopElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGStopElement.h b/Source/WebCore/svg/SVGStopElement.h index e83709647..375553dd4 100644 --- a/Source/WebCore/svg/SVGStopElement.h +++ b/Source/WebCore/svg/SVGStopElement.h @@ -37,7 +37,7 @@ private: SVGStopElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool isGradientStop() const { return true; } diff --git a/Source/WebCore/svg/SVGStyleElement.cpp b/Source/WebCore/svg/SVGStyleElement.cpp index cec037822..e32e93225 100644 --- a/Source/WebCore/svg/SVGStyleElement.cpp +++ b/Source/WebCore/svg/SVGStyleElement.cpp @@ -51,6 +51,20 @@ PassRefPtr<SVGStyleElement> SVGStyleElement::create(const QualifiedName& tagName return adoptRef(new SVGStyleElement(tagName, document, createdByParser)); } +bool SVGStyleElement::disabled() const +{ + if (!m_sheet) + return false; + + return m_sheet->disabled(); +} + +void SVGStyleElement::setDisabled(bool setDisabled) +{ + if (CSSStyleSheet* styleSheet = sheet()) + styleSheet->setDisabled(setDisabled); +} + const AtomicString& SVGStyleElement::type() const { DEFINE_STATIC_LOCAL(const AtomicString, defaultValue, ("text/css")); @@ -95,10 +109,10 @@ bool SVGStyleElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGStyleElement::parseMappedAttribute(Attribute* attr) +void SVGStyleElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); return; } @@ -108,7 +122,7 @@ void SVGStyleElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGStyleElement.h b/Source/WebCore/svg/SVGStyleElement.h index e81c2c83b..0566501ae 100644 --- a/Source/WebCore/svg/SVGStyleElement.h +++ b/Source/WebCore/svg/SVGStyleElement.h @@ -37,6 +37,9 @@ public: using StyleElement::sheet; + bool disabled() const; + void setDisabled(bool); + virtual const AtomicString& type() const; void setType(const AtomicString&, ExceptionCode&); @@ -50,7 +53,7 @@ private: SVGStyleElement(const QualifiedName&, Document*, bool createdByParser); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGStyleElement.idl b/Source/WebCore/svg/SVGStyleElement.idl index ede2845c9..7fbe99955 100644 --- a/Source/WebCore/svg/SVGStyleElement.idl +++ b/Source/WebCore/svg/SVGStyleElement.idl @@ -30,6 +30,7 @@ module svg { Conditional=SVG ] SVGStyleElement : SVGElement, SVGLangSpace { + attribute boolean disabled; attribute DOMString type setter raises(DOMException); attribute DOMString media diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp index 62669c8ba..518b5b3ee 100644 --- a/Source/WebCore/svg/SVGStyledElement.cpp +++ b/Source/WebCore/svg/SVGStyledElement.cpp @@ -84,7 +84,7 @@ String SVGStyledElement::title() const // <title> elements are the title of the document, not a tooltip) so we instantly return. if (hasTagName(SVGNames::svgTag)) { const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(this); - if (svg->isOutermostSVG()) + if (svg->isOutermostSVGSVGElement()) return String(); } @@ -292,29 +292,18 @@ bool SVGStyledElement::isAnimatableCSSProperty(const QualifiedName& attrName) return cssPropertyToTypeMap().contains(attrName); } -bool SVGStyledElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const +void SVGStyledElement::parseAttribute(Attribute* attr) { - if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName) > 0) { - result = eSVG; - return false; - } - return SVGElement::mapToEntry(attrName, result); -} - -void SVGStyledElement::parseMappedAttribute(Attribute* attr) -{ - // NOTE: Any subclass which overrides parseMappedAttribute for a property handled by - // cssPropertyIdForSVGAttributeName will also have to override mapToEntry to disable the default eSVG mapping int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); if (propId > 0) { - addCSSProperty(attr, propId, attr->value()); + addCSSProperty(propId, attr->value()); setNeedsStyleRecalc(); return; } // SVG animation has currently requires special storage of values so we set // the className here. svgAttributeChanged actually causes the resulting - // style updates (instead of StyledElement::parseMappedAttribute). We don't + // style updates (instead of StyledElement::parseAttribute). We don't // tell StyledElement about the change to avoid parsing the class list twice if (attr->name() == HTMLNames::classAttr) { setClassNameBaseValue(attr->value()); @@ -322,7 +311,7 @@ void SVGStyledElement::parseMappedAttribute(Attribute* attr) } // id is handled by StyledElement which SVGElement inherits from - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); } bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName) @@ -417,27 +406,19 @@ void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& name) { - if (!attributeMap()) + if (!hasAttributesWithoutUpdate()) return 0; QualifiedName attributeName(nullAtom, name, nullAtom); - Attribute* attr = attributeMap()->getAttributeItem(attributeName); - if (!attr || !attr->isMappedAttribute() || !attr->mappedAttributeDeclaration()) + Attribute* attr = getAttributeItem(attributeName); + if (!attr) return 0; - Attribute* cssSVGAttr = attr; - // This function returns a pointer to a CSSValue which can be mutated from JavaScript. - // If the associated MappedAttribute uses the same CSSMappedAttributeDeclaration - // as StyledElement's mappedAttributeDecls cache, create a new CSSMappedAttributeDeclaration - // before returning so that any modifications to the CSSValue will not affect other attributes. - MappedAttributeEntry entry; - mapToEntry(attributeName, entry); - if (getMappedAttributeDecl(entry, cssSVGAttr) == cssSVGAttr->mappedAttributeDeclaration()) { - cssSVGAttr->setMappedAttributeDeclaration(0); - int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(cssSVGAttr->name()); - addCSSProperty(cssSVGAttr, propId, cssSVGAttr->value()); - } - return cssSVGAttr->decl()->getPropertyCSSValue(cssPropertyID(name)); + RefPtr<StylePropertySet> style = StylePropertySet::create(); + style->setStrictParsing(false); + int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()); + style->setProperty(propertyID, attr->value()); + return style->getPropertyCSSValue(propertyID); } bool SVGStyledElement::instanceUpdatesBlocked() const diff --git a/Source/WebCore/svg/SVGStyledElement.h b/Source/WebCore/svg/SVGStyledElement.h index 75771518d..3df4c93fc 100644 --- a/Source/WebCore/svg/SVGStyledElement.h +++ b/Source/WebCore/svg/SVGStyledElement.h @@ -65,8 +65,7 @@ protected: SVGStyledElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); virtual bool rendererIsNeeded(const NodeRenderingContext&); - virtual bool mapToEntry(const QualifiedName&, MappedAttributeEntry&) const; - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual void attach(); diff --git a/Source/WebCore/svg/SVGStyledTransformableElement.cpp b/Source/WebCore/svg/SVGStyledTransformableElement.cpp index 4bcc5b920..99c178175 100644 --- a/Source/WebCore/svg/SVGStyledTransformableElement.cpp +++ b/Source/WebCore/svg/SVGStyledTransformableElement.cpp @@ -97,10 +97,10 @@ bool SVGStyledTransformableElement::isSupportedAttribute(const QualifiedName& at return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGStyledTransformableElement::parseMappedAttribute(Attribute* attr) +void SVGStyledTransformableElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledLocatableElement::parseMappedAttribute(attr); + SVGStyledLocatableElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGStyledTransformableElement.h b/Source/WebCore/svg/SVGStyledTransformableElement.h index 598256036..0321f9b14 100644 --- a/Source/WebCore/svg/SVGStyledTransformableElement.h +++ b/Source/WebCore/svg/SVGStyledTransformableElement.h @@ -55,7 +55,7 @@ protected: SVGStyledTransformableElement(const QualifiedName&, Document*, ConstructionType = CreateSVGElement); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStyledTransformableElement) diff --git a/Source/WebCore/svg/SVGSymbolElement.cpp b/Source/WebCore/svg/SVGSymbolElement.cpp index 03bd4bf2a..8934b8a9a 100644 --- a/Source/WebCore/svg/SVGSymbolElement.cpp +++ b/Source/WebCore/svg/SVGSymbolElement.cpp @@ -64,18 +64,18 @@ bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGSymbolElement::parseMappedAttribute(Attribute* attr) +void SVGSymbolElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); return; } - if (SVGLangSpace::parseMappedAttribute(attr)) + if (SVGLangSpace::parseAttribute(attr)) return; - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) + if (SVGFitToViewBox::parseAttribute(document(), attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGSymbolElement.h b/Source/WebCore/svg/SVGSymbolElement.h index 35745a2bd..b6aa7667d 100644 --- a/Source/WebCore/svg/SVGSymbolElement.h +++ b/Source/WebCore/svg/SVGSymbolElement.h @@ -45,7 +45,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp index 81397b1b5..300b8c9fb 100644 --- a/Source/WebCore/svg/SVGTRefElement.cpp +++ b/Source/WebCore/svg/SVGTRefElement.cpp @@ -166,14 +166,14 @@ bool SVGTRefElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGTRefElement::parseMappedAttribute(Attribute* attr) +void SVGTRefElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGTextPositioningElement::parseMappedAttribute(attr); + SVGTextPositioningElement::parseAttribute(attr); return; } - if (SVGURIReference::parseMappedAttribute(attr)) { + if (SVGURIReference::parseAttribute(attr)) { return; } diff --git a/Source/WebCore/svg/SVGTRefElement.h b/Source/WebCore/svg/SVGTRefElement.h index aaa6dc5d8..17a8acd59 100644 --- a/Source/WebCore/svg/SVGTRefElement.h +++ b/Source/WebCore/svg/SVGTRefElement.h @@ -41,7 +41,7 @@ private: virtual ~SVGTRefElement(); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGTests.cpp b/Source/WebCore/svg/SVGTests.cpp index 84c5ade09..e527308f9 100644 --- a/Source/WebCore/svg/SVGTests.cpp +++ b/Source/WebCore/svg/SVGTests.cpp @@ -120,7 +120,7 @@ bool SVGTests::isValid() const return true; } -bool SVGTests::parseMappedAttribute(Attribute* attr) +bool SVGTests::parseAttribute(Attribute* attr) { if (attr->name() == SVGNames::requiredFeaturesAttr) { m_requiredFeatures.value.reset(attr->value()); diff --git a/Source/WebCore/svg/SVGTests.h b/Source/WebCore/svg/SVGTests.h index 4024cc221..4d7d829e7 100644 --- a/Source/WebCore/svg/SVGTests.h +++ b/Source/WebCore/svg/SVGTests.h @@ -41,7 +41,7 @@ public: bool hasExtension(const String&) const; bool isValid() const; - bool parseMappedAttribute(Attribute*); + bool parseAttribute(Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp index fba6780d1..c8dfdc5f1 100644 --- a/Source/WebCore/svg/SVGTextContentElement.cpp +++ b/Source/WebCore/svg/SVGTextContentElement.cpp @@ -228,28 +228,28 @@ bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGTextContentElement::parseMappedAttribute(Attribute* attr) +void SVGTextContentElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); else if (attr->name() == SVGNames::lengthAdjustAttr) { SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(attr->value()); if (propertyValue > 0) setLengthAdjustBaseValue(propertyValue); } else if (attr->name() == SVGNames::textLengthAttr) { m_textLength.value = SVGLength::construct(LengthModeOther, attr->value(), parseError, ForbidNegativeLengths); - } else if (SVGTests::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr)) { - } else if (SVGLangSpace::parseMappedAttribute(attr)) { + } else if (SVGTests::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr)) { + } else if (SVGLangSpace::parseAttribute(attr)) { if (attr->name().matches(XMLNames::spaceAttr)) { DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve")); if (attr->value() == preserveString) - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValuePre); + addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre); else - addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueNowrap); + addCSSProperty(CSSPropertyWhiteSpace, CSSValueNowrap); } } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGTextContentElement.h b/Source/WebCore/svg/SVGTextContentElement.h index 86d7754b2..d45bea6a1 100644 --- a/Source/WebCore/svg/SVGTextContentElement.h +++ b/Source/WebCore/svg/SVGTextContentElement.h @@ -103,7 +103,7 @@ protected: virtual bool isValid() const { return SVGTests::isValid(); } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool selfHasRelativeLengths() const; diff --git a/Source/WebCore/svg/SVGTextElement.cpp b/Source/WebCore/svg/SVGTextElement.cpp index ab92324c7..5d46d82b2 100644 --- a/Source/WebCore/svg/SVGTextElement.cpp +++ b/Source/WebCore/svg/SVGTextElement.cpp @@ -63,10 +63,10 @@ bool SVGTextElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGTextElement::parseMappedAttribute(Attribute* attr) +void SVGTextElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGTextPositioningElement::parseMappedAttribute(attr); + SVGTextPositioningElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGTextElement.h b/Source/WebCore/svg/SVGTextElement.h index f06f208ae..e8a419358 100644 --- a/Source/WebCore/svg/SVGTextElement.h +++ b/Source/WebCore/svg/SVGTextElement.h @@ -47,7 +47,7 @@ private: virtual bool supportsFocus() const { return true; } bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual AffineTransform* supplementalTransform(); virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); } diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp index 01817d5be..84c9a724a 100644 --- a/Source/WebCore/svg/SVGTextPathElement.cpp +++ b/Source/WebCore/svg/SVGTextPathElement.cpp @@ -72,13 +72,13 @@ bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGTextPathElement::parseMappedAttribute(Attribute* attr) +void SVGTextPathElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; const AtomicString& value = attr->value(); if (!isSupportedAttribute(attr->name())) - SVGTextContentElement::parseMappedAttribute(attr); + SVGTextContentElement::parseAttribute(attr); else if (attr->name() == SVGNames::startOffsetAttr) setStartOffsetBaseValue(SVGLength::construct(LengthModeOther, value, parseError)); else if (attr->name() == SVGNames::methodAttr) { @@ -89,7 +89,7 @@ void SVGTextPathElement::parseMappedAttribute(Attribute* attr) SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value); if (propertyValue > 0) setSpacingBaseValue(propertyValue); - } else if (SVGURIReference::parseMappedAttribute(attr)) { + } else if (SVGURIReference::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h index b033b1158..499c80d58 100644 --- a/Source/WebCore/svg/SVGTextPathElement.h +++ b/Source/WebCore/svg/SVGTextPathElement.h @@ -118,7 +118,7 @@ private: virtual void insertedIntoDocument(); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); diff --git a/Source/WebCore/svg/SVGTextPositioningElement.cpp b/Source/WebCore/svg/SVGTextPositioningElement.cpp index 3b9c93c96..746888ace 100644 --- a/Source/WebCore/svg/SVGTextPositioningElement.cpp +++ b/Source/WebCore/svg/SVGTextPositioningElement.cpp @@ -68,10 +68,10 @@ bool SVGTextPositioningElement::isSupportedAttribute(const QualifiedName& attrNa return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGTextPositioningElement::parseMappedAttribute(Attribute* attr) +void SVGTextPositioningElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGTextContentElement::parseMappedAttribute(attr); + SVGTextContentElement::parseAttribute(attr); return; } diff --git a/Source/WebCore/svg/SVGTextPositioningElement.h b/Source/WebCore/svg/SVGTextPositioningElement.h index 2774e5a8e..47b1a8af6 100644 --- a/Source/WebCore/svg/SVGTextPositioningElement.h +++ b/Source/WebCore/svg/SVGTextPositioningElement.h @@ -36,7 +36,7 @@ protected: SVGTextPositioningElement(const QualifiedName&, Document*); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTextPositioningElement) diff --git a/Source/WebCore/svg/SVGURIReference.cpp b/Source/WebCore/svg/SVGURIReference.cpp index 054b9997b..ee3c7733c 100644 --- a/Source/WebCore/svg/SVGURIReference.cpp +++ b/Source/WebCore/svg/SVGURIReference.cpp @@ -30,7 +30,7 @@ namespace WebCore { -bool SVGURIReference::parseMappedAttribute(Attribute* attr) +bool SVGURIReference::parseAttribute(Attribute* attr) { if (attr->name().matches(XLinkNames::hrefAttr)) { setHrefBaseValue(attr->value()); diff --git a/Source/WebCore/svg/SVGURIReference.h b/Source/WebCore/svg/SVGURIReference.h index 45816dd2c..ef041511e 100644 --- a/Source/WebCore/svg/SVGURIReference.h +++ b/Source/WebCore/svg/SVGURIReference.h @@ -35,7 +35,7 @@ class SVGURIReference { public: virtual ~SVGURIReference() { } - bool parseMappedAttribute(Attribute*); + bool parseAttribute(Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp index 272e01d38..fd7f2d217 100644 --- a/Source/WebCore/svg/SVGUseElement.cpp +++ b/Source/WebCore/svg/SVGUseElement.cpp @@ -130,12 +130,12 @@ bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGUseElement::parseMappedAttribute(Attribute* attr) +void SVGUseElement::parseAttribute(Attribute* attr) { SVGParsingError parseError = NoError; if (!isSupportedAttribute(attr->name())) - SVGStyledTransformableElement::parseMappedAttribute(attr); + SVGStyledTransformableElement::parseAttribute(attr); else if (attr->name() == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError)); else if (attr->name() == SVGNames::yAttr) @@ -144,10 +144,10 @@ void SVGUseElement::parseMappedAttribute(Attribute* attr) setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths)); else if (attr->name() == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths)); - else if (SVGTests::parseMappedAttribute(attr) - || SVGLangSpace::parseMappedAttribute(attr) - || SVGExternalResourcesRequired::parseMappedAttribute(attr) - || SVGURIReference::parseMappedAttribute(attr)) { + else if (SVGTests::parseAttribute(attr) + || SVGLangSpace::parseAttribute(attr) + || SVGExternalResourcesRequired::parseAttribute(attr) + || SVGURIReference::parseAttribute(attr)) { } else ASSERT_NOT_REACHED(); @@ -358,17 +358,12 @@ void SVGUseElement::didRecalcStyle(StyleChange change) if (!shadowRoot) return; - bool needsStyleUpdate = !m_needsShadowTreeRecreation; if (m_needsShadowTreeRecreation) { shadowRoot->markShadowTreeForRecreation(); m_needsShadowTreeRecreation = false; } shadowRoot->updateFromElement(); - - if (!needsStyleUpdate) - return; - shadowRoot->updateStyle(change); } diff --git a/Source/WebCore/svg/SVGUseElement.h b/Source/WebCore/svg/SVGUseElement.h index d0b274c2a..0d9c06e46 100644 --- a/Source/WebCore/svg/SVGUseElement.h +++ b/Source/WebCore/svg/SVGUseElement.h @@ -61,7 +61,7 @@ private: virtual void buildPendingResource(); bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); virtual bool willRecalcStyle(StyleChange); diff --git a/Source/WebCore/svg/SVGViewElement.cpp b/Source/WebCore/svg/SVGViewElement.cpp index 6c186008c..b0e9c5b6c 100644 --- a/Source/WebCore/svg/SVGViewElement.cpp +++ b/Source/WebCore/svg/SVGViewElement.cpp @@ -68,10 +68,10 @@ bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName); } -void SVGViewElement::parseMappedAttribute(Attribute* attr) +void SVGViewElement::parseAttribute(Attribute* attr) { if (!isSupportedAttribute(attr->name())) { - SVGStyledElement::parseMappedAttribute(attr); + SVGStyledElement::parseAttribute(attr); return; } @@ -80,11 +80,11 @@ void SVGViewElement::parseMappedAttribute(Attribute* attr) return; } - if (SVGExternalResourcesRequired::parseMappedAttribute(attr)) + if (SVGExternalResourcesRequired::parseAttribute(attr)) return; - if (SVGFitToViewBox::parseMappedAttribute(document(), attr)) + if (SVGFitToViewBox::parseAttribute(document(), attr)) return; - if (SVGZoomAndPan::parseMappedAttribute(attr)) + if (SVGZoomAndPan::parseAttribute(attr)) return; ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/svg/SVGViewElement.h b/Source/WebCore/svg/SVGViewElement.h index b16a2d405..624f4d910 100644 --- a/Source/WebCore/svg/SVGViewElement.h +++ b/Source/WebCore/svg/SVGViewElement.h @@ -47,7 +47,7 @@ private: // FIXME: svgAttributeChanged missing. bool isSupportedAttribute(const QualifiedName&); - virtual void parseMappedAttribute(Attribute*); + virtual void parseAttribute(Attribute*) OVERRIDE; virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; } diff --git a/Source/WebCore/svg/SVGZoomAndPan.cpp b/Source/WebCore/svg/SVGZoomAndPan.cpp index 2f70d4a8d..9b6cbf972 100644 --- a/Source/WebCore/svg/SVGZoomAndPan.cpp +++ b/Source/WebCore/svg/SVGZoomAndPan.cpp @@ -34,7 +34,7 @@ void SVGZoomAndPan::setZoomAndPan(unsigned short zoomAndPan) m_zoomAndPan = zoomAndPan; } -bool SVGZoomAndPan::parseMappedAttribute(Attribute* attr) +bool SVGZoomAndPan::parseAttribute(Attribute* attr) { if (attr->name() == SVGNames::zoomAndPanAttr) { const UChar* start = attr->value().characters(); diff --git a/Source/WebCore/svg/SVGZoomAndPan.h b/Source/WebCore/svg/SVGZoomAndPan.h index f5b4020ab..3e91d8e33 100644 --- a/Source/WebCore/svg/SVGZoomAndPan.h +++ b/Source/WebCore/svg/SVGZoomAndPan.h @@ -44,7 +44,7 @@ public: unsigned short zoomAndPan() const { return m_zoomAndPan; } virtual void setZoomAndPan(unsigned short zoomAndPan); - bool parseMappedAttribute(Attribute*); + bool parseAttribute(Attribute*); bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); diff --git a/Source/WebCore/svg/animation/SVGSMILElement.cpp b/Source/WebCore/svg/animation/SVGSMILElement.cpp index 977d80cfa..790e27d81 100644 --- a/Source/WebCore/svg/animation/SVGSMILElement.cpp +++ b/Source/WebCore/svg/animation/SVGSMILElement.cpp @@ -382,7 +382,7 @@ void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin sortTimeList(timeList); } -void SVGSMILElement::parseMappedAttribute(Attribute* attr) +void SVGSMILElement::parseAttribute(Attribute* attr) { if (attr->name() == SVGNames::beginAttr) { if (!m_conditions.isEmpty()) { @@ -403,13 +403,13 @@ void SVGSMILElement::parseMappedAttribute(Attribute* attr) if (inDocument()) connectConditions(); } else - SVGElement::parseMappedAttribute(attr); + SVGElement::parseAttribute(attr); } -void SVGSMILElement::attributeChanged(Attribute* attr, bool preserveDecls) +void SVGSMILElement::attributeChanged(Attribute* attr) { - SVGElement::attributeChanged(attr, preserveDecls); - + SVGElement::attributeChanged(attr); + const QualifiedName& attrName = attr->name(); if (attrName == SVGNames::durAttr) m_cachedDur = invalidCachedTime; diff --git a/Source/WebCore/svg/animation/SVGSMILElement.h b/Source/WebCore/svg/animation/SVGSMILElement.h index ee57460bd..334f97573 100644 --- a/Source/WebCore/svg/animation/SVGSMILElement.h +++ b/Source/WebCore/svg/animation/SVGSMILElement.h @@ -44,8 +44,8 @@ public: static bool isSMILElement(Node*); - virtual void parseMappedAttribute(Attribute*); - virtual void attributeChanged(Attribute*, bool preserveDecls); + virtual void parseAttribute(Attribute*) OVERRIDE; + virtual void attributeChanged(Attribute*) OVERRIDE; virtual void insertedIntoDocument(); virtual void removedFromDocument(); diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp index f4c41b7b1..bbcc91b52 100644 --- a/Source/WebCore/svg/graphics/SVGImage.cpp +++ b/Source/WebCore/svg/graphics/SVGImage.cpp @@ -75,7 +75,8 @@ private: virtual void invalidateContentsAndRootView(const IntRect& r, bool) { - if (m_image && m_image->imageObserver()) + // If m_image->m_page is null, we're being destructed, don't fire changedInRect() in that case. + if (m_image && m_image->imageObserver() && m_image->m_page) m_image->imageObserver()->changedInRect(m_image, r); } @@ -90,12 +91,9 @@ SVGImage::SVGImage(ImageObserver* observer) SVGImage::~SVGImage() { if (m_page) { - m_page->mainFrame()->loader()->frameDetached(); // Break both the loader and view references to the frame - - // Clear explicitly because we want to delete the page before the ChromeClient. - // FIXME: I believe that's already guaranteed by C++ object destruction rules, - // so this may matter only for the assertion below. - m_page.clear(); + // Store m_page in a local variable, clearing m_page, so that SVGImageChromeClient knows we're destructed. + OwnPtr<Page> currentPage = m_page.release(); + currentPage->mainFrame()->loader()->frameDetached(); // Break both the loader and view references to the frame } // Verify that page teardown destroyed the Chrome diff --git a/Source/WebCore/svg/graphics/SVGImage.h b/Source/WebCore/svg/graphics/SVGImage.h index 047b27fac..7e1604931 100644 --- a/Source/WebCore/svg/graphics/SVGImage.h +++ b/Source/WebCore/svg/graphics/SVGImage.h @@ -61,6 +61,7 @@ public: virtual bool hasRelativeHeight() const; private: + friend class SVGImageChromeClient; virtual ~SVGImage(); virtual String filenameExtension() const; diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index a4dbb44bf..c2b045dca 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -271,4 +271,15 @@ void InternalSettings::setPerTileDrawingEnabled(bool enabled, ExceptionCode& ec) settings()->setPerTileDrawingEnabled(enabled); } +void InternalSettings::setTouchEventEmulationEnabled(bool enabled, ExceptionCode& ec) +{ +#if ENABLE(TOUCH_EVENTS) + InternalSettingsGuardForSettings(); + settings()->setTouchEventEmulationEnabled(enabled); +#else + UNUSED_PARAM(enabled); + UNUSED_PARAM(ec); +#endif +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index be9328ee7..64800926c 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -64,6 +64,7 @@ public: float pageScaleFactor(ExceptionCode&); void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&); void setPerTileDrawingEnabled(bool enabled, ExceptionCode&); + void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&); private: InternalSettings(Frame*, InternalSettings* old); diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index c2f5b2ac7..036008384 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -44,6 +44,7 @@ module window { boolean unifiedTextCheckingEnabled() raises (DOMException); float pageScaleFactor() raises(DOMException); void setPageScaleFactor(in float scaleFactor, in long x, in long y) raises(DOMException); + void setTouchEventEmulationEnabled(in boolean enabled) raises(DOMException); }; } diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 16447fc60..06e34cd3c 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -193,7 +193,10 @@ Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::ensureShadowRoot(Eleme return 0; } - return host->ensureShadowRoot(); + if (ShadowRoot* root = host->shadowRoot()) + return root; + + return ShadowRoot::create(host, ec).get(); } Internals::ShadowRootIfShadowDOMEnabledOrNode* Internals::shadowRoot(Element* host, ExceptionCode& ec) @@ -278,7 +281,7 @@ unsigned Internals::markerCountForNode(Node* node, const String& markerType, Exc return node->document()->markers()->markersFor(node, markerTypes).size(); } -PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +DocumentMarker* Internals::markerAt(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) { if (!node) { ec = INVALID_ACCESS_ERR; @@ -294,7 +297,23 @@ PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& marker Vector<DocumentMarker*> markers = node->document()->markers()->markersFor(node, markerTypes); if (markers.size() <= index) return 0; - return Range::create(node->document(), node, markers[index]->startOffset(), node, markers[index]->endOffset()); + return markers[index]; +} + +PassRefPtr<Range> Internals::markerRangeForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +{ + DocumentMarker* marker = markerAt(node, markerType, index, ec); + if (!marker) + return 0; + return Range::create(node->document(), node, marker->startOffset(), node, marker->endOffset()); +} + +String Internals::markerDescriptionForNode(Node* node, const String& markerType, unsigned index, ExceptionCode& ec) +{ + DocumentMarker* marker = markerAt(node, markerType, index, ec); + if (!marker) + return String(); + return marker->description(); } void Internals::setScrollViewPosition(Document* document, long x, long y, ExceptionCode& ec) @@ -539,5 +558,15 @@ bool Internals::shouldDisplayTrackKind(Document* document, const String& kind, E return false; #endif } - + +unsigned Internals::wheelEventHandlerCount(Document* document, ExceptionCode& ec) +{ + if (!document) { + ec = INVALID_ACCESS_ERR; + return 0; + } + + return document->wheelEventHandlerCount(); +} + } diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index b87253106..439dc75c6 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -36,6 +36,7 @@ namespace WebCore { class ClientRect; class Document; +class DocumentMarker; class Element; class InternalSettings; class Node; @@ -79,7 +80,8 @@ public: PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&); unsigned markerCountForNode(Node*, const String&, ExceptionCode&); - PassRefPtr<Range> markerRangeForNode(Node*, const String&, unsigned, ExceptionCode&); + PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); + String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&); void setScrollViewPosition(Document*, long x, long y, ExceptionCode&); @@ -105,12 +107,15 @@ public: void setShouldDisplayTrackKind(Document*, const String& kind, bool, ExceptionCode&); bool shouldDisplayTrackKind(Document*, const String& kind, ExceptionCode&); + unsigned wheelEventHandlerCount(Document*, ExceptionCode&); + static const char* internalsId; InternalSettings* settings() const { return m_settings.get(); } private: explicit Internals(Document*); + DocumentMarker* markerAt(Node*, const String& markerType, unsigned index, ExceptionCode&); RefPtr<InternalSettings> m_settings; }; diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index da081f5aa..9bf05751d 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -53,6 +53,7 @@ module window { ClientRect boundingBox(in Element element) raises(DOMException); unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException); Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException); + DOMString markerDescriptionForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException); void setScrollViewPosition(in Document document, in long x, in long y) raises(DOMException); @@ -79,6 +80,8 @@ module window { #endif attribute [Custom] Array userPreferredLanguages; + unsigned long wheelEventHandlerCount(in Document document) raises (DOMException); + readonly attribute InternalSettings settings; }; } diff --git a/Source/WebCore/webaudio/AudioBufferCallback.idl b/Source/WebCore/webaudio/AudioBufferCallback.idl index f2d311b92..f4b8303a7 100644 --- a/Source/WebCore/webaudio/AudioBufferCallback.idl +++ b/Source/WebCore/webaudio/AudioBufferCallback.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS, + JSGenerateToJS, Callback ] AudioBufferCallback { boolean handleEvent(in AudioBuffer audioBuffer); diff --git a/Source/WebCore/webaudio/AudioBufferSourceNode.idl b/Source/WebCore/webaudio/AudioBufferSourceNode.idl index 26109b7bd..6f983afe3 100644 --- a/Source/WebCore/webaudio/AudioBufferSourceNode.idl +++ b/Source/WebCore/webaudio/AudioBufferSourceNode.idl @@ -26,7 +26,7 @@ module audio { // A cached (non-streamed), memory-resident audio source interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioBufferSourceNode : AudioSourceNode { attribute [CustomSetter] AudioBuffer buffer setter raises (DOMException); diff --git a/Source/WebCore/webaudio/AudioContext.idl b/Source/WebCore/webaudio/AudioContext.idl index 10f9c9062..ef6935526 100644 --- a/Source/WebCore/webaudio/AudioContext.idl +++ b/Source/WebCore/webaudio/AudioContext.idl @@ -28,7 +28,7 @@ module webaudio { Conditional=WEB_AUDIO, ActiveDOMObject, CustomConstructor, - CustomMarkFunction, + JSCustomMarkFunction, #if defined(V8_BINDING) && V8_BINDING EventTarget #endif diff --git a/Source/WebCore/webaudio/AudioDestinationNode.idl b/Source/WebCore/webaudio/AudioDestinationNode.idl index d7bf09f83..1266952df 100644 --- a/Source/WebCore/webaudio/AudioDestinationNode.idl +++ b/Source/WebCore/webaudio/AudioDestinationNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioDestinationNode : AudioNode { readonly attribute long numberOfChannels; }; diff --git a/Source/WebCore/webaudio/AudioGain.idl b/Source/WebCore/webaudio/AudioGain.idl index ead7c9ab5..6e70d160d 100644 --- a/Source/WebCore/webaudio/AudioGain.idl +++ b/Source/WebCore/webaudio/AudioGain.idl @@ -29,7 +29,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioGain : AudioParam { }; } diff --git a/Source/WebCore/webaudio/AudioGainNode.idl b/Source/WebCore/webaudio/AudioGainNode.idl index 3d4f40faa..6b365fdbe 100644 --- a/Source/WebCore/webaudio/AudioGainNode.idl +++ b/Source/WebCore/webaudio/AudioGainNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioGainNode : AudioNode { // FIXME: eventually it will be interesting to remove the readonly restriction, but need to properly deal with thread safety here. readonly attribute AudioGain gain; diff --git a/Source/WebCore/webaudio/AudioPannerNode.cpp b/Source/WebCore/webaudio/AudioPannerNode.cpp index d88aba4ea..7790b5ee5 100644 --- a/Source/WebCore/webaudio/AudioPannerNode.cpp +++ b/Source/WebCore/webaudio/AudioPannerNode.cpp @@ -33,6 +33,7 @@ #include "AudioContext.h" #include "AudioNodeInput.h" #include "AudioNodeOutput.h" +#include "ExceptionCode.h" #include "HRTFPanner.h" #include <wtf/MathExtras.h> @@ -150,20 +151,22 @@ AudioListener* AudioPannerNode::listener() return context()->listener(); } -void AudioPannerNode::setPanningModel(unsigned short model) +void AudioPannerNode::setPanningModel(unsigned short model, ExceptionCode& ec) { switch (model) { case EQUALPOWER: case HRTF: - case SOUNDFIELD: if (!m_panner.get() || model != m_panningModel) { OwnPtr<Panner> newPanner = Panner::create(model, sampleRate()); m_panner = newPanner.release(); m_panningModel = model; } break; + case SOUNDFIELD: + // FIXME: Implement sound field model. See // https://bugs.webkit.org/show_bug.cgi?id=77367. + // For now, fall through to throw an exception. default: - // FIXME: consider throwing an exception for illegal model values. + ec = NOT_SUPPORTED_ERR; break; } } diff --git a/Source/WebCore/webaudio/AudioPannerNode.h b/Source/WebCore/webaudio/AudioPannerNode.h index 98d27743e..18275f6eb 100644 --- a/Source/WebCore/webaudio/AudioPannerNode.h +++ b/Source/WebCore/webaudio/AudioPannerNode.h @@ -53,6 +53,14 @@ public: SOUNDFIELD = 2, }; + // These must be defined as in the .idl file and must match those + // in the DistanceEffect class. + enum { + LINEAR_DISTANCE = 0, + INVERSE_DISTANCE = 1, + EXPONENTIAL_DISTANCE = 2, + }; + static PassRefPtr<AudioPannerNode> create(AudioContext* context, float sampleRate) { return adoptRef(new AudioPannerNode(context, sampleRate)); @@ -72,7 +80,7 @@ public: // Panning model unsigned short panningModel() const { return m_panningModel; } - void setPanningModel(unsigned short); + void setPanningModel(unsigned short, ExceptionCode&); // Position FloatPoint3D position() const { return m_position; } diff --git a/Source/WebCore/webaudio/AudioPannerNode.idl b/Source/WebCore/webaudio/AudioPannerNode.idl index 2abe53a04..e15cb379e 100644 --- a/Source/WebCore/webaudio/AudioPannerNode.idl +++ b/Source/WebCore/webaudio/AudioPannerNode.idl @@ -25,15 +25,22 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioPannerNode : AudioNode { // Panning model const unsigned short EQUALPOWER = 0; const unsigned short HRTF = 1; const unsigned short SOUNDFIELD = 2; + // Distance model + const unsigned short LINEAR_DISTANCE = 0; + const unsigned short INVERSE_DISTANCE = 1; + const unsigned short EXPONENTIAL_DISTANCE = 2; + // Default model for stereo is HRTF - attribute unsigned long panningModel; // FIXME: use unsigned short when glue generation supports it + // FIXME: use unsigned short when glue generation supports it + attribute unsigned long panningModel + setter raises(DOMException); // Uses a 3D cartesian coordinate system void setPosition(in float x, in float y, in float z); diff --git a/Source/WebCore/webaudio/AudioProcessingEvent.idl b/Source/WebCore/webaudio/AudioProcessingEvent.idl index c2f8a8331..b963493bb 100644 --- a/Source/WebCore/webaudio/AudioProcessingEvent.idl +++ b/Source/WebCore/webaudio/AudioProcessingEvent.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] AudioProcessingEvent : Event { readonly attribute AudioBuffer inputBuffer; readonly attribute AudioBuffer outputBuffer; diff --git a/Source/WebCore/webaudio/BiquadFilterNode.idl b/Source/WebCore/webaudio/BiquadFilterNode.idl index 84e015aa3..c3f52a3b7 100644 --- a/Source/WebCore/webaudio/BiquadFilterNode.idl +++ b/Source/WebCore/webaudio/BiquadFilterNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] BiquadFilterNode : AudioNode { // Filter type. const unsigned short LOWPASS = 0; diff --git a/Source/WebCore/webaudio/ConvolverNode.idl b/Source/WebCore/webaudio/ConvolverNode.idl index c658bdc19..a91e3eb3d 100644 --- a/Source/WebCore/webaudio/ConvolverNode.idl +++ b/Source/WebCore/webaudio/ConvolverNode.idl @@ -26,9 +26,9 @@ module audio { // A linear convolution effect interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] ConvolverNode : AudioNode { - attribute [JSCCustomSetter] AudioBuffer buffer; + attribute [JSCustomSetter] AudioBuffer buffer; attribute boolean normalize; }; } diff --git a/Source/WebCore/webaudio/DOMWindowWebAudio.idl b/Source/WebCore/webaudio/DOMWindowWebAudio.idl index 190e4b507..f17198f4b 100644 --- a/Source/WebCore/webaudio/DOMWindowWebAudio.idl +++ b/Source/WebCore/webaudio/DOMWindowWebAudio.idl @@ -24,7 +24,7 @@ module window { Supplemental=DOMWindow ] DOMWindowWebAudio { #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP - attribute [JSCCustomGetter, EnabledAtRuntime] AudioContextConstructor webkitAudioContext; + attribute [JSCustomGetter, V8EnabledAtRuntime] AudioContextConstructor webkitAudioContext; attribute AudioPannerNodeConstructor webkitAudioPannerNode; attribute AudioProcessingEventConstructor AudioProcessingEvent; attribute OfflineAudioCompletionEventConstructor OfflineAudioCompletionEvent; diff --git a/Source/WebCore/webaudio/DelayNode.idl b/Source/WebCore/webaudio/DelayNode.idl index 77566270c..2ba529549 100644 --- a/Source/WebCore/webaudio/DelayNode.idl +++ b/Source/WebCore/webaudio/DelayNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] DelayNode : AudioNode { readonly attribute AudioParam delayTime; }; diff --git a/Source/WebCore/webaudio/DynamicsCompressorNode.idl b/Source/WebCore/webaudio/DynamicsCompressorNode.idl index 74997eae5..dd25f10ab 100644 --- a/Source/WebCore/webaudio/DynamicsCompressorNode.idl +++ b/Source/WebCore/webaudio/DynamicsCompressorNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] DynamicsCompressorNode : AudioNode { }; } diff --git a/Source/WebCore/webaudio/HighPass2FilterNode.idl b/Source/WebCore/webaudio/HighPass2FilterNode.idl index 399f9b500..fdd31d241 100644 --- a/Source/WebCore/webaudio/HighPass2FilterNode.idl +++ b/Source/WebCore/webaudio/HighPass2FilterNode.idl @@ -27,7 +27,7 @@ module audio { // FIXME: design BiquadNode and use instead of this interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] HighPass2FilterNode : AudioNode { readonly attribute AudioParam cutoff; readonly attribute AudioParam resonance; diff --git a/Source/WebCore/webaudio/JavaScriptAudioNode.idl b/Source/WebCore/webaudio/JavaScriptAudioNode.idl index ef5359b97..5f05a1189 100644 --- a/Source/WebCore/webaudio/JavaScriptAudioNode.idl +++ b/Source/WebCore/webaudio/JavaScriptAudioNode.idl @@ -26,8 +26,8 @@ module audio { // For real-time audio stream synthesis/processing in JavaScript interface [ Conditional=WEB_AUDIO, - GenerateToJS, - CustomMarkFunction, + JSGenerateToJS, + JSCustomMarkFunction, #if defined(V8_BINDING) && V8_BINDING EventTarget #endif diff --git a/Source/WebCore/webaudio/LowPass2FilterNode.idl b/Source/WebCore/webaudio/LowPass2FilterNode.idl index 310c21e47..c8d6c8899 100644 --- a/Source/WebCore/webaudio/LowPass2FilterNode.idl +++ b/Source/WebCore/webaudio/LowPass2FilterNode.idl @@ -27,7 +27,7 @@ module audio { // FIXME: design BiquadNode and use instead of this interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] LowPass2FilterNode : AudioNode { readonly attribute AudioParam cutoff; readonly attribute AudioParam resonance; diff --git a/Source/WebCore/webaudio/MediaElementAudioSourceNode.idl b/Source/WebCore/webaudio/MediaElementAudioSourceNode.idl index 27c67d3a3..3f459e1f6 100644 --- a/Source/WebCore/webaudio/MediaElementAudioSourceNode.idl +++ b/Source/WebCore/webaudio/MediaElementAudioSourceNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO&VIDEO, - GenerateToJS + JSGenerateToJS ] MediaElementAudioSourceNode : AudioSourceNode { readonly attribute HTMLMediaElement mediaElement; }; diff --git a/Source/WebCore/webaudio/OfflineAudioCompletionEvent.idl b/Source/WebCore/webaudio/OfflineAudioCompletionEvent.idl index cd5ccb091..54f454881 100644 --- a/Source/WebCore/webaudio/OfflineAudioCompletionEvent.idl +++ b/Source/WebCore/webaudio/OfflineAudioCompletionEvent.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] OfflineAudioCompletionEvent : Event { readonly attribute AudioBuffer renderedBuffer; }; diff --git a/Source/WebCore/webaudio/RealtimeAnalyserNode.idl b/Source/WebCore/webaudio/RealtimeAnalyserNode.idl index 1f7bf7a7d..73d55746b 100644 --- a/Source/WebCore/webaudio/RealtimeAnalyserNode.idl +++ b/Source/WebCore/webaudio/RealtimeAnalyserNode.idl @@ -25,7 +25,7 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] RealtimeAnalyserNode : AudioNode { attribute unsigned long fftSize; readonly attribute unsigned long frequencyBinCount; diff --git a/Source/WebCore/webaudio/WaveShaperNode.idl b/Source/WebCore/webaudio/WaveShaperNode.idl index 19c61a6d0..a33bc012d 100644 --- a/Source/WebCore/webaudio/WaveShaperNode.idl +++ b/Source/WebCore/webaudio/WaveShaperNode.idl @@ -25,8 +25,8 @@ module audio { interface [ Conditional=WEB_AUDIO, - GenerateToJS + JSGenerateToJS ] WaveShaperNode : AudioNode { - attribute [JSCCustomSetter] Float32Array curve; + attribute [JSCustomSetter] Float32Array curve; }; } diff --git a/Source/WebCore/websockets/CloseEvent.idl b/Source/WebCore/websockets/CloseEvent.idl index db7854453..e36c9494a 100644 --- a/Source/WebCore/websockets/CloseEvent.idl +++ b/Source/WebCore/websockets/CloseEvent.idl @@ -31,12 +31,12 @@ module events { interface [ - NoStaticTables, + JSNoStaticTables, ConstructorTemplate=Event ] CloseEvent : Event { - readonly attribute [InitializedByConstructor] boolean wasClean; - readonly attribute [InitializedByConstructor] unsigned short code; - readonly attribute [InitializedByConstructor, ConvertingNullStringTo=Undefined] DOMString reason; + readonly attribute [InitializedByEventConstructor] boolean wasClean; + readonly attribute [InitializedByEventConstructor] unsigned short code; + readonly attribute [InitializedByEventConstructor, ConvertingNullStringTo=Undefined] DOMString reason; }; } diff --git a/Source/WebCore/websockets/DOMWindowWebSocket.idl b/Source/WebCore/websockets/DOMWindowWebSocket.idl index 85b6ad115..fd9a18db4 100644 --- a/Source/WebCore/websockets/DOMWindowWebSocket.idl +++ b/Source/WebCore/websockets/DOMWindowWebSocket.idl @@ -36,7 +36,7 @@ module window { ] DOMWindowWebSocket { #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP attribute CloseEventConstructor CloseEvent; - attribute [JSCCustomGetter, EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator + attribute [JSCustomGetter, V8EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator #endif }; diff --git a/Source/WebCore/websockets/WebSocket.idl b/Source/WebCore/websockets/WebSocket.idl index b2b6779b4..b8dee1398 100644 --- a/Source/WebCore/websockets/WebSocket.idl +++ b/Source/WebCore/websockets/WebSocket.idl @@ -37,7 +37,7 @@ module websockets { CustomConstructor, ConstructorParameters=1, EventTarget, - NoStaticTables + JSNoStaticTables ] WebSocket { readonly attribute DOMString URL; // Lowercased .url is the one in the spec, but leaving .URL for compatibility reasons. readonly attribute DOMString url; diff --git a/Source/WebCore/workers/AbstractWorker.idl b/Source/WebCore/workers/AbstractWorker.idl index 46935d8ae..e11e34c10 100644 --- a/Source/WebCore/workers/AbstractWorker.idl +++ b/Source/WebCore/workers/AbstractWorker.idl @@ -34,7 +34,7 @@ module threads { interface [ Conditional=WORKERS, ActiveDOMObject, - CustomToJS, + JSCustomToJS, EventTarget ] AbstractWorker { diff --git a/Source/WebCore/workers/DedicatedWorkerContext.idl b/Source/WebCore/workers/DedicatedWorkerContext.idl index 9ebb0d178..48ecfdcae 100644 --- a/Source/WebCore/workers/DedicatedWorkerContext.idl +++ b/Source/WebCore/workers/DedicatedWorkerContext.idl @@ -34,8 +34,8 @@ module threads { Conditional=WORKERS, ExtendsDOMGlobalObject, IsWorkerContext, - GenerateNativeConverter, - NoStaticTables, + JSGenerateToNativeObject, + JSNoStaticTables, OmitConstructor ] DedicatedWorkerContext : WorkerContext { diff --git a/Source/WebCore/workers/SharedWorker.idl b/Source/WebCore/workers/SharedWorker.idl index 6061f64d2..5c7e47752 100644 --- a/Source/WebCore/workers/SharedWorker.idl +++ b/Source/WebCore/workers/SharedWorker.idl @@ -39,9 +39,9 @@ module threads { Constructor(in DOMString scriptURL, in [Optional=CallWithNullValue] DOMString name), CallWith=ScriptExecutionContext, ConstructorRaisesException, - CustomMarkFunction, - GenerateNativeConverter, - GenerateToJS + JSCustomMarkFunction, + JSGenerateToNativeObject, + JSGenerateToJS ] SharedWorker : AbstractWorker { readonly attribute MessagePort port; }; diff --git a/Source/WebCore/workers/SharedWorkerContext.idl b/Source/WebCore/workers/SharedWorkerContext.idl index 9d01f4f8c..676981122 100644 --- a/Source/WebCore/workers/SharedWorkerContext.idl +++ b/Source/WebCore/workers/SharedWorkerContext.idl @@ -34,8 +34,8 @@ module threads { Conditional=SHARED_WORKERS, ExtendsDOMGlobalObject, IsWorkerContext, - GenerateNativeConverter, - NoStaticTables, + JSGenerateToNativeObject, + JSNoStaticTables, OmitConstructor ] SharedWorkerContext : WorkerContext { diff --git a/Source/WebCore/workers/Worker.idl b/Source/WebCore/workers/Worker.idl index f0df628de..623f84727 100644 --- a/Source/WebCore/workers/Worker.idl +++ b/Source/WebCore/workers/Worker.idl @@ -35,8 +35,8 @@ module threads { Constructor(in DOMString scriptUrl), CallWith=ScriptExecutionContext, ConstructorRaisesException, - GenerateNativeConverter, - GenerateToJS + JSGenerateToNativeObject, + JSGenerateToJS ] Worker : AbstractWorker { attribute EventListener onmessage; diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp index fbed36b6e..0d68c4d65 100644 --- a/Source/WebCore/workers/WorkerContext.cpp +++ b/Source/WebCore/workers/WorkerContext.cpp @@ -377,15 +377,6 @@ EventTargetData* WorkerContext::ensureEventTargetData() return &m_eventTargetData; } -#if ENABLE(BLOB) -DOMURL* WorkerContext::webkitURL() const -{ - if (!m_domURL) - m_domURL = DOMURL::create(this->scriptExecutionContext()); - return m_domURL.get(); -} -#endif - #if ENABLE(FILE_SYSTEM) void WorkerContext::webkitRequestFileSystem(int type, long long size, PassRefPtr<FileSystemCallback> successCallback, PassRefPtr<ErrorCallback> errorCallback) { diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h index 43d2e2ec6..25ca63b8a 100644 --- a/Source/WebCore/workers/WorkerContext.h +++ b/Source/WebCore/workers/WorkerContext.h @@ -131,10 +131,6 @@ namespace WebCore { virtual bool isContextThread() const; virtual bool isJSExecutionForbidden() const; -#if ENABLE(BLOB) - DOMURL* webkitURL() const; -#endif - #if ENABLE(FILE_SYSTEM) enum FileSystemType { TEMPORARY, diff --git a/Source/WebCore/workers/WorkerContext.idl b/Source/WebCore/workers/WorkerContext.idl index d04f06b6d..a2cd2392e 100644 --- a/Source/WebCore/workers/WorkerContext.idl +++ b/Source/WebCore/workers/WorkerContext.idl @@ -28,13 +28,13 @@ module threads { interface [ Conditional=WORKERS, - CustomMarkFunction, - DelegatingGetOwnPropertySlot, + JSCustomMarkFunction, + JSCustomGetOwnPropertySlotDelegate, EventTarget, ExtendsDOMGlobalObject, IsWorkerContext, - LegacyParent=JSWorkerContextBase, - NoStaticTables, + JSLegacyParent=JSWorkerContextBase, + JSNoStaticTables, OmitConstructor ] WorkerContext { @@ -50,9 +50,9 @@ module threads { [Custom] void importScripts(/*[Variadic] in DOMString urls */); attribute [Replaceable] WorkerNavigator navigator; #if defined(ENABLE_SQL_DATABASE) && ENABLE_SQL_DATABASE - [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) + [V8EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) raises(DOMException); - [EnabledAtRuntime] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) + [V8EnabledAtRuntime] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) raises(DOMException); #endif @@ -77,7 +77,7 @@ module threads { #if defined(ENABLE_NOTIFICATIONS) && ENABLE_NOTIFICATIONS // Notification interface - readonly attribute [EnabledAtRuntime] NotificationCenter webkitNotifications; + readonly attribute [V8EnabledAtRuntime] NotificationCenter webkitNotifications; #endif #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP @@ -86,12 +86,12 @@ module threads { attribute WorkerLocationConstructor WorkerLocation; #if ENABLE_CHANNEL_MESSAGING - attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel; + attribute [JSCustomGetter] MessageChannelConstructor MessageChannel; #endif - attribute [JSCCustomGetter] EventSourceConstructor EventSource; - attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest; + attribute [JSCustomGetter] EventSourceConstructor EventSource; + attribute [JSCustomGetter] XMLHttpRequestConstructor XMLHttpRequest; #if defined(ENABLE_WEB_SOCKETS) && ENABLE_WEB_SOCKETS - attribute [JSCCustomGetter,EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator + attribute [JSCustomGetter,V8EnabledAtRuntime] WebSocketConstructor WebSocket; // Usable with the new operator #endif #endif @@ -101,18 +101,18 @@ module threads { attribute FileReaderSyncConstructor FileReaderSync; #endif - readonly attribute [Conditional=BLOB] DOMURL webkitURL; + attribute [Conditional=BLOB] DOMURLConstructor webkitURL; #if defined(ENABLE_FILE_SYSTEM) && ENABLE_FILE_SYSTEM const unsigned short TEMPORARY = 0; const unsigned short PERSISTENT = 1; - [EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [EnabledAtRuntime=FileSystem] DOMFileSystemSync webkitRequestFileSystemSync(in unsigned short type, in long long size) raises (FileException); - [EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); - [EnabledAtRuntime=FileSystem] EntrySync webkitResolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); + [V8EnabledAtRuntime=FileSystem] void webkitRequestFileSystem(in unsigned short type, in long long size, in [Callback, Optional] FileSystemCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [V8EnabledAtRuntime=FileSystem] DOMFileSystemSync webkitRequestFileSystemSync(in unsigned short type, in long long size) raises (FileException); + [V8EnabledAtRuntime=FileSystem] void webkitResolveLocalFileSystemURL(in DOMString url, in [Callback, Optional] EntryCallback successCallback, in [Callback, Optional] ErrorCallback errorCallback); + [V8EnabledAtRuntime=FileSystem] EntrySync webkitResolveLocalFileSystemSyncURL(in DOMString url) raises (FileException); - attribute [EnabledAtRuntime=FileSystem] FileErrorConstructor FileError; - attribute [EnabledAtRuntime=FileSystem] FileExceptionConstructor FileException; + attribute [V8EnabledAtRuntime=FileSystem] FileErrorConstructor FileError; + attribute [V8EnabledAtRuntime=FileSystem] FileExceptionConstructor FileException; #endif attribute ArrayBufferConstructor ArrayBuffer; // Usable with new operator @@ -127,18 +127,18 @@ module threads { attribute Float64ArrayConstructor Float64Array; // Usable with new operator attribute DataViewConstructor DataView; // Usable with new operator #if defined(ENABLE_INDEXED_DATABASE) && ENABLE_INDEXED_DATABASE - readonly attribute [EnabledAtRuntime] IDBFactory webkitIndexedDB; - - attribute [EnabledAtRuntime] IDBCursorConstructor webkitIDBCursor; - attribute [EnabledAtRuntime] IDBDatabaseConstructor webkitIDBDatabase; - attribute [EnabledAtRuntime] IDBDatabaseErrorConstructor webkitIDBDatabaseError; - attribute [EnabledAtRuntime] IDBDatabaseExceptionConstructor webkitIDBDatabaseException; - attribute [EnabledAtRuntime] IDBFactoryConstructor webkitIDBFactory; - attribute [EnabledAtRuntime] IDBIndexConstructor webkitIDBIndex; - attribute [EnabledAtRuntime] IDBKeyRangeConstructor webkitIDBKeyRange; - attribute [EnabledAtRuntime] IDBObjectStoreConstructor webkitIDBObjectStore; - attribute [EnabledAtRuntime] IDBRequestConstructor webkitIDBRequest; - attribute [EnabledAtRuntime] IDBTransactionConstructor webkitIDBTransaction; + readonly attribute [V8EnabledAtRuntime] IDBFactory webkitIndexedDB; + + attribute [V8EnabledAtRuntime] IDBCursorConstructor webkitIDBCursor; + attribute [V8EnabledAtRuntime] IDBDatabaseConstructor webkitIDBDatabase; + attribute [V8EnabledAtRuntime] IDBDatabaseErrorConstructor webkitIDBDatabaseError; + attribute [V8EnabledAtRuntime] IDBDatabaseExceptionConstructor webkitIDBDatabaseException; + attribute [V8EnabledAtRuntime] IDBFactoryConstructor webkitIDBFactory; + attribute [V8EnabledAtRuntime] IDBIndexConstructor webkitIDBIndex; + attribute [V8EnabledAtRuntime] IDBKeyRangeConstructor webkitIDBKeyRange; + attribute [V8EnabledAtRuntime] IDBObjectStoreConstructor webkitIDBObjectStore; + attribute [V8EnabledAtRuntime] IDBRequestConstructor webkitIDBRequest; + attribute [V8EnabledAtRuntime] IDBTransactionConstructor webkitIDBTransaction; #endif }; diff --git a/Source/WebCore/workers/WorkerLocation.idl b/Source/WebCore/workers/WorkerLocation.idl index 9a733fb00..3b302c493 100644 --- a/Source/WebCore/workers/WorkerLocation.idl +++ b/Source/WebCore/workers/WorkerLocation.idl @@ -30,8 +30,8 @@ module threads { interface [ Conditional=WORKERS, - GenerateIsReachable=Impl, - NoStaticTables + JSGenerateIsReachable=Impl, + JSNoStaticTables ] WorkerLocation { readonly attribute DOMString href; readonly attribute DOMString protocol; @@ -42,7 +42,7 @@ module threads { readonly attribute DOMString search; readonly attribute DOMString hash; - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); }; } diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index 6be58aacf..41f0621ec 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -667,7 +667,7 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec) ResourceRequest request(m_url); request.setHTTPMethod(m_method); -#if PLATFORM(CHROMIUM) +#if PLATFORM(CHROMIUM) || PLATFORM(BLACKBERRY) request.setTargetType(ResourceRequest::TargetIsXHR); #endif diff --git a/Source/WebCore/xml/XMLHttpRequest.idl b/Source/WebCore/xml/XMLHttpRequest.idl index 6fb4dfd72..b45baf2b1 100644 --- a/Source/WebCore/xml/XMLHttpRequest.idl +++ b/Source/WebCore/xml/XMLHttpRequest.idl @@ -33,9 +33,9 @@ module xml { Constructor, CallWith=ScriptExecutionContext, V8CustomConstructor, - CustomMarkFunction, + JSCustomMarkFunction, EventTarget, - NoStaticTables + JSNoStaticTables ] XMLHttpRequest { // From XMLHttpRequestEventTarget // event handler attributes @@ -59,7 +59,7 @@ module xml { readonly attribute unsigned short readyState; // request - attribute [Conditional=XHR_RESPONSE_BLOB, EnabledAtRuntime] boolean asBlob + attribute [Conditional=XHR_RESPONSE_BLOB, V8EnabledAtRuntime] boolean asBlob setter raises(DOMException); attribute boolean withCredentials @@ -97,7 +97,7 @@ module xml { getter raises(DOMException); readonly attribute Document responseXML getter raises(DOMException); - readonly attribute [Conditional=XHR_RESPONSE_BLOB, EnabledAtRuntime] Blob responseBlob + readonly attribute [Conditional=XHR_RESPONSE_BLOB, V8EnabledAtRuntime] Blob responseBlob getter raises(DOMException); attribute DOMString responseType diff --git a/Source/WebCore/xml/XMLHttpRequestException.idl b/Source/WebCore/xml/XMLHttpRequestException.idl index ffea73248..c448155ab 100644 --- a/Source/WebCore/xml/XMLHttpRequestException.idl +++ b/Source/WebCore/xml/XMLHttpRequestException.idl @@ -29,8 +29,8 @@ module xml { interface [ - NoStaticTables, - DontCheckEnums + JSNoStaticTables, + DoNotCheckConstants ] XMLHttpRequestException { readonly attribute unsigned short code; @@ -39,7 +39,7 @@ module xml { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // XMLHttpRequestExceptionCode diff --git a/Source/WebCore/xml/XMLHttpRequestProgressEvent.idl b/Source/WebCore/xml/XMLHttpRequestProgressEvent.idl index 05c984e99..b1ca35522 100644 --- a/Source/WebCore/xml/XMLHttpRequestProgressEvent.idl +++ b/Source/WebCore/xml/XMLHttpRequestProgressEvent.idl @@ -26,7 +26,7 @@ module events { interface [ - NoStaticTables + JSNoStaticTables // We should also inherit from LSProgressEvent when the idl is added. ] XMLHttpRequestProgressEvent : ProgressEvent { readonly attribute unsigned long long position; diff --git a/Source/WebCore/xml/XMLHttpRequestUpload.idl b/Source/WebCore/xml/XMLHttpRequestUpload.idl index 5f98cb77f..584c293b3 100644 --- a/Source/WebCore/xml/XMLHttpRequestUpload.idl +++ b/Source/WebCore/xml/XMLHttpRequestUpload.idl @@ -29,9 +29,9 @@ module xml { interface [ - GenerateIsReachable=Impl, + JSGenerateIsReachable=Impl, EventTarget, - NoStaticTables + JSNoStaticTables ] XMLHttpRequestUpload { // From XMLHttpRequestEventTarget // event handler attributes diff --git a/Source/WebCore/xml/XPathException.idl b/Source/WebCore/xml/XPathException.idl index d43c57ab9..8196cbe5a 100644 --- a/Source/WebCore/xml/XPathException.idl +++ b/Source/WebCore/xml/XPathException.idl @@ -29,7 +29,7 @@ module xpath { interface [ - DontCheckEnums + DoNotCheckConstants ] XPathException { readonly attribute unsigned short code; @@ -38,7 +38,7 @@ module xpath { #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT // Override in a Mozilla compatible format - [DontEnum] DOMString toString(); + [NotEnumerable] DOMString toString(); #endif // XPathExceptionCode diff --git a/Source/WebCore/xml/XPathExpression.idl b/Source/WebCore/xml/XPathExpression.idl index 3dc26146a..add53cff4 100644 --- a/Source/WebCore/xml/XPathExpression.idl +++ b/Source/WebCore/xml/XPathExpression.idl @@ -21,7 +21,7 @@ module xpath { interface XPathExpression { - [OldStyleObjC] XPathResult evaluate(in [Optional=CallWithDefaultValue] Node contextNode, + [ObjCLegacyUnnamedParameters] XPathResult evaluate(in [Optional=CallWithDefaultValue] Node contextNode, in [Optional=CallWithDefaultValue] unsigned short type, in [Optional=CallWithDefaultValue] XPathResult inResult) raises(DOMException); diff --git a/Source/WebCore/xml/XPathFunctions.cpp b/Source/WebCore/xml/XPathFunctions.cpp index 283583d78..154b67e92 100644 --- a/Source/WebCore/xml/XPathFunctions.cpp +++ b/Source/WebCore/xml/XPathFunctions.cpp @@ -29,7 +29,6 @@ #include "XPathFunctions.h" #include "Element.h" -#include "NamedNodeMap.h" #include "ProcessingInstruction.h" #include "TreeScope.h" #include "XMLNames.h" @@ -592,8 +591,9 @@ Value FunLang::evaluate() const Node* node = evaluationContext().node.get(); while (node) { if (node->isElementNode()) { - if (NamedNodeMap* attributes = toElement(node)->updatedAttributes()) - languageAttribute = attributes->getAttributeItem(XMLNames::langAttr); + Element* element = toElement(node); + if (element->hasAttributes()) + languageAttribute = element->getAttributeItem(XMLNames::langAttr); } if (languageAttribute) break; diff --git a/Source/WebCore/xml/XPathNodeSet.cpp b/Source/WebCore/xml/XPathNodeSet.cpp index 8eefc573f..f4e4d9aff 100644 --- a/Source/WebCore/xml/XPathNodeSet.cpp +++ b/Source/WebCore/xml/XPathNodeSet.cpp @@ -213,13 +213,13 @@ void NodeSet::traversalSort() const if (!containsAttributeNodes || !n->isElementNode()) continue; - NamedNodeMap* attributes = toElement(n)->updatedAttributes(); - if (!attributes) + Element* element = toElement(n); + if (!element->hasAttributes()) continue; - unsigned attributeCount = attributes->length(); + unsigned attributeCount = element->attributeCount(); for (unsigned i = 0; i < attributeCount; ++i) { - Attr* attribute = attributes->attributeItem(i)->attr(); + Attr* attribute = element->attributeItem(i)->attr(); if (attribute && nodes.contains(attribute)) sortedNodes.append(attribute); } diff --git a/Source/WebCore/xml/XPathResult.idl b/Source/WebCore/xml/XPathResult.idl index d87443ecc..cb5c92263 100644 --- a/Source/WebCore/xml/XPathResult.idl +++ b/Source/WebCore/xml/XPathResult.idl @@ -20,7 +20,7 @@ module xpath { interface [ - CustomMarkFunction + JSCustomMarkFunction ] XPathResult { const unsigned short ANY_TYPE = 0; const unsigned short NUMBER_TYPE = 1; diff --git a/Source/WebCore/xml/XPathStep.cpp b/Source/WebCore/xml/XPathStep.cpp index 12f394f2c..ff7e685d9 100644 --- a/Source/WebCore/xml/XPathStep.cpp +++ b/Source/WebCore/xml/XPathStep.cpp @@ -31,7 +31,6 @@ #include "Attr.h" #include "Document.h" #include "Element.h" -#include "NamedNodeMap.h" #include "XMLNSNames.h" #include "XPathParser.h" #include "XPathUtil.h" @@ -343,12 +342,11 @@ void Step::nodesInAxis(Node* context, NodeSet& nodes) const return; } - NamedNodeMap* attrs = contextElement->updatedAttributes(); - if (!attrs) + if (!contextElement->hasAttributes()) return; - for (unsigned i = 0; i < attrs->length(); ++i) { - RefPtr<Attr> attr = attrs->attributeItem(i)->createAttrIfNeeded(static_cast<Element*>(context)); + for (unsigned i = 0; i < contextElement->attributeCount(); ++i) { + RefPtr<Attr> attr = contextElement->attributeItem(i)->createAttrIfNeeded(static_cast<Element*>(context)); if (nodeMatches(attr.get(), AttributeAxis, m_nodeTest)) nodes.append(attr.release()); } diff --git a/Source/WebCore/xml/parser/MarkupTokenBase.h b/Source/WebCore/xml/parser/MarkupTokenBase.h index 0e91913a6..7a30ed604 100644 --- a/Source/WebCore/xml/parser/MarkupTokenBase.h +++ b/Source/WebCore/xml/parser/MarkupTokenBase.h @@ -541,7 +541,7 @@ inline void AtomicMarkupTokenBase<Token>::initializeAttributes(const typename To ASSERT(attribute.m_valueRange.m_end); String value(attribute.m_value.data(), attribute.m_value.size()); - m_attributes->insertAttribute(Attribute::createMapped(nameForAttribute(attribute), value), false); + m_attributes->insertAttribute(Attribute::create(nameForAttribute(attribute), value), false); } } diff --git a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp index 4e1d49eef..3a36d98e1 100644 --- a/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp +++ b/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp @@ -599,9 +599,9 @@ XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parent for (; !elemStack.isEmpty(); elemStack.removeLast()) { Element* element = elemStack.last(); - if (NamedNodeMap* attrs = element->updatedAttributes()) { - for (unsigned i = 0; i < attrs->length(); i++) { - Attribute* attr = attrs->attributeItem(i); + if (element->hasAttributes()) { + for (unsigned i = 0; i < element->attributeCount(); i++) { + Attribute* attr = element->attributeItem(i); if (attr->localName() == xmlnsAtom) m_defaultNamespaceURI = attr->value(); else if (attr->prefix() == xmlnsAtom) diff --git a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp index 8de1a0817..0c2b2d6a0 100644 --- a/Source/WebCore/xml/parser/XMLTreeBuilder.cpp +++ b/Source/WebCore/xml/parser/XMLTreeBuilder.cpp @@ -80,9 +80,9 @@ XMLTreeBuilder::XMLTreeBuilder(NewXMLDocumentParser* parser, DocumentFragment* f for (Element* element; !nodeStack.isEmpty(); nodeStack.removeLast()) { element = nodeStack.last(); - if (NamedNodeMap* attrs = element->updatedAttributes()) { - for (size_t i = 0; i < attrs->length(); ++i) { - Attribute* attr = attrs->attributeItem(i); + if (element->hasAttributes()) { + for (size_t i = 0; i < element->attributeCount(); ++i) { + Attribute* attr = element->attributeItem(i); if (attr->localName() == xmlnsAtom) stackItem.setNamespaceURI(attr->value()); else if (attr->prefix() == xmlnsAtom) diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 6fc9adf7a..678b840f5 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,177 @@ +2012-02-08 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] Upstream BlackBerry WebCoreSupport FrameNetworkingContextBlackBerry and IconDatabaseClientBlackBerry classes + https://bugs.webkit.org/show_bug.cgi?id=78049 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h: Added. + * blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h: Added. + +2012-02-08 Leo Yang <leo.yang@torchmobile.com.cn> + + [BlackBerry] Upstream InspectorClientBlackBerry.{h, cpp} + https://bugs.webkit.org/show_bug.cgi?id=78082 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/InspectorClientBlackBerry.h: Added. + +2012-02-08 Leo Yang <leo.yang@torchmobile.com.cn> + + [BlackBerry] Remove EditCommandBlackBerry.cpp from build system + https://bugs.webkit.org/show_bug.cgi?id=78078 + + Reviewed by Rob Buis. + + WebKit/blackberry/WebCoreSupport/EditCommandBlackBerry.cpp which hasn't + been upstreamed has been removed from the BlackBerry porting internally. + So we should remove it from the build system. + + * blackberry/CMakeListsBlackBerry.txt: + +2012-02-08 Rob Buis <rbuis@rim.com> + + [BlackBerry] Upstream DumpRenderTreeBlackBerry + https://bugs.webkit.org/show_bug.cgi?id=78042 + + Reviewed by Antonio Gomes. + + Add abstract interface for our DumpRenderTree solution. + + * blackberry/Api/DumpRenderTreeClient.h: Added. + +2012-02-08 Nima Ghanavatian <nghanavatian@rim.com> + + Initial upstreaming of input handling for BlackBerry port + https://bugs.webkit.org/show_bug.cgi?id=77992 + + Reviewed by Rob Buis. + + * blackberry/WebKitSupport/InputHandler.cpp: Added. + * blackberry/WebKitSupport/InputHandler.h: Added. + +2012-02-07 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Remove no longer necessary Chromium gesture recognizer code. + https://bugs.webkit.org/show_bug.cgi?id=77492 + + Reviewed by Adam Barth. + + * blackberry/WebCoreSupport/AboutDataEnableFeatures.in: + +2012-02-07 Leo Yang <leo.yang@torchmobile.com.cn> + + [BlackBerry] Upstream ChromeClientBlackBerry.{h, cpp} + https://bugs.webkit.org/show_bug.cgi?id=77843 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/ChromeClientBlackBerry.h: Added. + +2012-02-07 Rob Buis <rbuis@rim.com> + + [BlackBerry] Upstream DumpRenderTreeSupport + https://bugs.webkit.org/show_bug.cgi?id=77991 + + Reviewed by Antonio Gomes. + + No functionalities changed, no new tests. + + * blackberry/WebKitSupport/DumpRenderTreeSupport.cpp: Added. + (toGeolocationClientMock): + (DumpRenderTreeSupport::DumpRenderTreeSupport): + (DumpRenderTreeSupport::~DumpRenderTreeSupport): + (DumpRenderTreeSupport::javaScriptObjectsCount): + (DumpRenderTreeSupport::garbageCollectorCollect): + (DumpRenderTreeSupport::garbageCollectorCollectOnAlternateThread): + (DumpRenderTreeSupport::setLinksIncludedInFocusChain): + (DumpRenderTreeSupport::linksIncludedInFocusChain): + (DumpRenderTreeSupport::dumpConfigurationForViewport): + (DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests): + (DumpRenderTreeSupport::resetGeolocationMock): + (DumpRenderTreeSupport::setMockGeolocationError): + (DumpRenderTreeSupport::setMockGeolocationPermission): + (DumpRenderTreeSupport::setMockGeolocationPosition): + (DumpRenderTreeSupport::scalePageBy): + (DumpRenderTreeSupport::computedStyleIncludingVisitedInfo): + * blackberry/WebKitSupport/DumpRenderTreeSupport.h: Added. + (WebKit): + (WebCore): + (WTF): + (DumpRenderTreeSupport): + +2012-02-07 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] Upstream BlackBerry WebCoreSupport DeviceOrientationClientBlackBerry and DeviceMotionClientBlackBerry classes + https://bugs.webkit.org/show_bug.cgi?id=77993 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h: Added. + * blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h: Added. + +2012-02-06 Leo Yang <leo.yang@torchmobile.com.cn> + + [BlackBerry] Use WebPagePrivate instead of WebPage in GeolocationControllerClientBlackBerry + https://bugs.webkit.org/show_bug.cgi?id=77927 + + Reviewed by Antonio Gomes. + + WebKit/blackberry/Api/WebPage which has a d pointer is designed for public API. + GeolocationControllerClientBlackBerry in WebKit/blackberry/WebCoreSupport should + use the d pointer directly because the client is internal implementation. + + No functionalities changed, no new tests. + + * blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp: + (GeolocationControllerClientBlackBerry::GeolocationControllerClientBlackBerry): + (GeolocationControllerClientBlackBerry::requestPermission): + (GeolocationControllerClientBlackBerry::cancelPermissionRequest): + (GeolocationControllerClientBlackBerry::onLocationUpdate): + (GeolocationControllerClientBlackBerry::onLocationError): + * blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h: + (WebKit): + (GeolocationControllerClientBlackBerry): + +2012-02-06 Robin Cao <robin.cao@torchmobile.com.cn> + + [BlackBerry] Remove unused variable in BackingStore + https://bugs.webkit.org/show_bug.cgi?id=77851 + + Reviewed by Kentaro Hara. + + * blackberry/Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + +2012-02-04 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] Upstream BlackBerry WebCoreSupport ClientExtension and GeolocationControllerClientBlackBerry classes + https://bugs.webkit.org/show_bug.cgi?id=77751 + + Reviewed by Rob Buis. + + Initial upstream, no new tests. + + * blackberry/WebCoreSupport/ClientExtension.cpp: Added. + * blackberry/WebCoreSupport/ClientExtension.h: Added. + * blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp: Added. + * blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h: Added. + 2012-01-11 Jacky Jiang <zhajiang@rim.com> [BlackBerry] ASSERT failure in BackingStorePrivate::blitVisibleContents() diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 4bd0333e0..036c9bbc0 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -1337,8 +1337,6 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, TileRect wholeTileRect; wholeTileRect.first = index; wholeTileRect.second = this->tileRect(); - Platform::IntRect wholeRect - = mapFromTilesToTransformedContents(wholeTileRect, currentState->backingStoreRect()); bool committed = tile->isCommitted(); bool rendered = tileBuffer->isRendered(dirtyTileRect); diff --git a/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h new file mode 100644 index 000000000..03eb5bbc5 --- /dev/null +++ b/Source/WebKit/blackberry/Api/DumpRenderTreeClient.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DumpRenderTreeClient_h +#define DumpRenderTreeClient_h + +#include "BlackBerryGlobal.h" + +#include "PlatformString.h" +#include <JavaScriptCore/JSObjectRef.h> + +namespace WebCore { +class Frame; +class DOMWrapperWorld; +class NavigationAction; +class Node; +class Range; +class ResourceRequest; +class ResourceResponse; +class SecurityOrigin; +} + +namespace BlackBerry { +namespace WebKit { +class WebPage; + +class BLACKBERRY_EXPORT DumpRenderTreeClient { +public: + virtual void runTests() = 0; + + // FrameLoaderClient delegates + virtual void didStartProvisionalLoadForFrame(WebCore::Frame*) = 0; + virtual void didReceiveResponseForFrame(WebCore::Frame*, const WebCore::ResourceResponse&) = 0; + virtual void didCommitLoadForFrame(WebCore::Frame*) = 0; + virtual void didFailProvisionalLoadForFrame(WebCore::Frame*) = 0; + virtual void didFailLoadForFrame(WebCore::Frame*) = 0; + virtual void didFinishLoadForFrame(WebCore::Frame*) = 0; + virtual void didFinishDocumentLoadForFrame(WebCore::Frame*) = 0; + virtual void didClearWindowObjectInWorld(WebCore::DOMWrapperWorld*, JSGlobalContextRef, JSObjectRef windowObject) = 0; + virtual void didReceiveTitleForFrame(const WTF::String& title, WebCore::Frame*) = 0; + virtual void didDecidePolicyForNavigationAction(const WebCore::NavigationAction&, const WebCore::ResourceRequest&) = 0; + virtual void didDispatchWillPerformClientRedirect() = 0; + virtual void didHandleOnloadEventsForFrame(WebCore::Frame*) = 0; + + // ChromeClient delegates + virtual void addMessageToConsole(const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceID) = 0; + virtual void runJavaScriptAlert(const WTF::String& message) = 0; + virtual bool runJavaScriptConfirm(const WTF::String& message) = 0; + virtual WTF::String runJavaScriptPrompt(const WTF::String& message, const WTF::String& defaultValue) = 0; + virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message) = 0; + virtual void setStatusText(const WTF::String&) = 0; + virtual void exceededDatabaseQuota(WebCore::SecurityOrigin*, const WTF::String& name) = 0; + virtual bool allowsOpeningWindow() = 0; + virtual void windowCreated(WebPage*) = 0; + + // EditorClient delegates + virtual void setAcceptsEditing(bool) = 0; + virtual void didBeginEditing() = 0; + virtual void didEndEditing() = 0; + virtual void didChange() = 0; + virtual void didChangeSelection() = 0; + virtual bool shouldBeginEditingInDOMRange(WebCore::Range*) = 0; + virtual bool shouldEndEditingInDOMRange(WebCore::Range*) = 0; + virtual bool shouldDeleteDOMRange(WebCore::Range*) = 0; + virtual bool shouldChangeSelectedDOMRangeToDOMRangeAffinityStillSelecting(WebCore::Range* fromRange, WebCore::Range* toRange, int affinity, bool stillSelecting) = 0; + virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, int insertAction) = 0; + virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, int insertAction) = 0; + virtual bool isSelectTrailingWhitespaceEnabled() const = 0; + +}; +} +} + +#endif // DumpRenderTreeClient_h diff --git a/Source/WebKit/blackberry/CMakeListsBlackBerry.txt b/Source/WebKit/blackberry/CMakeListsBlackBerry.txt index 295f22ff2..d0e27cfd6 100644 --- a/Source/WebKit/blackberry/CMakeListsBlackBerry.txt +++ b/Source/WebKit/blackberry/CMakeListsBlackBerry.txt @@ -54,7 +54,6 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp blackberry/WebCoreSupport/DragClientBlackBerry.cpp - blackberry/WebCoreSupport/EditCommandBlackBerry.cpp blackberry/WebCoreSupport/EditorClientBlackBerry.cpp blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index de86ca2ee..44565db22 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -44,7 +44,6 @@ GC_LOGGING GC_VALIDATION GEOLOCATION GESTURE_EVENTS -GESTURE_RECOGNIZER GGC GLIB_SUPPORT GLOBAL_FASTMALLOC_NEW diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp new file mode 100644 index 000000000..0e9acffd8 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -0,0 +1,843 @@ +/* + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "ChromeClientBlackBerry.h" + +#include "BackingStore.h" +#include "BackingStoreClient.h" +#include "BackingStore_p.h" +#include "CString.h" +#include "DatabaseTracker.h" +#include "Document.h" +#include "DumpRenderTreeClient.h" +#include "DumpRenderTreeSupport.h" +#include "FileChooser.h" +#include "FileIconLoader.h" +#include "Frame.h" +#include "FrameLoadRequest.h" +#include "FrameLoader.h" +#include "Geolocation.h" +#include "GeolocationControllerClientBlackBerry.h" +#include "HTMLInputElement.h" +#include "HTMLNames.h" +#include "HitTestResult.h" +#include "Icon.h" +#include "InputHandler.h" +#include "KURL.h" +#include "Node.h" +#include "NotImplemented.h" +#include "NotificationPresenterImpl.h" +#include "Page.h" +#include "PageGroup.h" +#include "PageGroupLoadDeferrer.h" +#include "PlatformString.h" +#include "PopupMenuBlackBerry.h" +#include "RenderView.h" +#include "SVGZoomAndPan.h" +#include "SearchPopupMenuBlackBerry.h" +#include "SecurityOrigin.h" +#include "SharedPointer.h" +#include "ViewportArguments.h" +#include "WebPage.h" +#include "WebPageClient.h" +#include "WebPage_p.h" +#include "WebSettings.h" +#include "WebString.h" +#include "WindowFeatures.h" +#include <BlackBerryPlatformLog.h> +#include <BlackBerryPlatformSettings.h> + +#define DEBUG_OVERFLOW_DETECTION 0 + +using namespace BlackBerry::WebKit; + +namespace WebCore { + +static CString frameOrigin(Frame* frame) +{ + DOMWindow* window = frame->domWindow(); + SecurityOrigin* origin = window->securityOrigin(); + CString latinOrigin = origin->toString().latin1(); + return latinOrigin; +} + +ChromeClientBlackBerry::ChromeClientBlackBerry(WebPagePrivate* pagePrivate) + : m_webPagePrivate(pagePrivate) +{ +} + +void ChromeClientBlackBerry::addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + m_webPagePrivate->m_dumpRenderTree->addMessageToConsole(message, lineNumber, sourceID); +#endif + + m_webPagePrivate->m_client->addMessageToConsole(message.characters(), message.length(), sourceID.characters(), sourceID.length(), lineNumber); +} + +void ChromeClientBlackBerry::runJavaScriptAlert(Frame* frame, const String& message) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) { + m_webPagePrivate->m_dumpRenderTree->runJavaScriptAlert(message); + return; + } +#endif + + TimerBase::fireTimersInNestedEventLoop(); + CString latinOrigin = frameOrigin(frame); + m_webPagePrivate->m_client->runJavaScriptAlert(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length()); +} + +bool ChromeClientBlackBerry::runJavaScriptConfirm(Frame* frame, const String& message) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + return m_webPagePrivate->m_dumpRenderTree->runJavaScriptConfirm(message); +#endif + + TimerBase::fireTimersInNestedEventLoop(); + CString latinOrigin = frameOrigin(frame); + return m_webPagePrivate->m_client->runJavaScriptConfirm(message.characters(), message.length(), latinOrigin.data(), latinOrigin.length()); +} + +bool ChromeClientBlackBerry::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) { + result = m_webPagePrivate->m_dumpRenderTree->runJavaScriptPrompt(message, defaultValue); + return true; + } +#endif + + TimerBase::fireTimersInNestedEventLoop(); + CString latinOrigin = frameOrigin(frame); + WebString clientResult; + if (m_webPagePrivate->m_client->runJavaScriptPrompt(message.characters(), message.length(), defaultValue.characters(), defaultValue.length(), latinOrigin.data(), latinOrigin.length(), clientResult)) { + result = clientResult; + return true; + } + return false; +} + +void ChromeClientBlackBerry::chromeDestroyed() +{ + delete this; +} + +void ChromeClientBlackBerry::setWindowRect(const FloatRect&) +{ + // The window dimensions are fixed in the RIM port. +} + +FloatRect ChromeClientBlackBerry::windowRect() +{ + const IntSize windowSize = m_webPagePrivate->m_client->window()->windowSize(); + return FloatRect(0, 0, windowSize.width(), windowSize.height()); +} + +FloatRect ChromeClientBlackBerry::pageRect() +{ + notImplemented(); + return FloatRect(); +} + +float ChromeClientBlackBerry::scaleFactor() +{ + return 1; +} + +void ChromeClientBlackBerry::focus() +{ + notImplemented(); +} + +void ChromeClientBlackBerry::unfocus() +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::canTakeFocus(FocusDirection) +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::takeFocus(FocusDirection) +{ + notImplemented(); +} + +void ChromeClientBlackBerry::focusedNodeChanged(Node* node) +{ + WebPageClient::FocusType type = WebPageClient::FocusUnknown; + + if (!node) + type = WebPageClient::FocusNone; + else if (node->isSVGElement()) + type = WebPageClient::FocusSVGElement; + else if (node->isHTMLElement()) { + if (node->hasTagName(HTMLNames::aTag)) { + type = WebPageClient::FocusLink; + } else if (node->hasTagName(HTMLNames::inputTag)) { + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(node); + if (inputElement->hasTagName(HTMLNames::isindexTag) || inputElement->isInputTypeHidden()) + type = WebPageClient::FocusInputUnknown; + else if (inputElement->isTextButton()) + type = WebPageClient::FocusInputButton; + else if (inputElement->isCheckbox()) + type = WebPageClient::FocusInputCheckBox; +#if ENABLE(INPUT_COLOR) + else if (inputElement->isColorControl()) + type = WebPageClient::FocusInputColor; +#endif + else if (inputElement->isDateControl()) + type = WebPageClient::FocusInputDate; + else if (inputElement->isDateTimeControl()) + type = WebPageClient::FocusInputDateTime; + else if (inputElement->isDateTimeLocalControl()) + type = WebPageClient::FocusInputDateTimeLocal; + else if (inputElement->isEmailField()) + type = WebPageClient::FocusInputEmail; + else if (inputElement->isFileUpload()) + type = WebPageClient::FocusInputFile; + else if (inputElement->isImageButton()) + type = WebPageClient::FocusInputImage; + else if (inputElement->isMonthControl()) + type = WebPageClient::FocusInputMonth; + else if (inputElement->isNumberField()) + type = WebPageClient::FocusInputNumber; + else if (inputElement->isPasswordField()) + type = WebPageClient::FocusInputPassword; + else if (inputElement->isRadioButton()) + type = WebPageClient::FocusInputRadio; + else if (inputElement->isRangeControl()) + type = WebPageClient::FocusInputRange; + else if (inputElement->isResetButton()) + type = WebPageClient::FocusInputReset; + else if (inputElement->isSearchField()) + type = WebPageClient::FocusInputSearch; + else if (inputElement->isSubmitButton()) + type = WebPageClient::FocusInputSubmit; + else if (inputElement->isTelephoneField()) + type = WebPageClient::FocusInputTelephone; + else if (inputElement->isURLField()) + type = WebPageClient::FocusInputURL; + else if (inputElement->isTextField()) + type = WebPageClient::FocusInputText; + else if (inputElement->isTimeControl()) + type = WebPageClient::FocusInputTime; + // FIXME: missing WEEK popup selector + else + type = WebPageClient::FocusInputUnknown; + } else if (node->hasTagName(HTMLNames::imgTag)) + type = WebPageClient::FocusImage; + else if (node->hasTagName(HTMLNames::objectTag)) + type = WebPageClient::FocusObject; + else if (node->hasTagName(HTMLNames::videoTag)) + type = WebPageClient::FocusVideo; + else if (node->hasTagName(HTMLNames::selectTag)) + type = WebPageClient::FocusSelect; + else if (node->hasTagName(HTMLNames::textareaTag)) + type = WebPageClient::FocusTextArea; + else if (node->hasTagName(HTMLNames::canvasTag)) + type = WebPageClient::FocusCanvas; + } + + m_webPagePrivate->m_inputHandler->nodeFocused(node); + + m_webPagePrivate->m_client->focusChanged(type, reinterpret_cast<int>(node)); +} + +void ChromeClientBlackBerry::focusedFrameChanged(Frame*) +{ + // To be used by In-region backing store context switching. +} + +bool ChromeClientBlackBerry::shouldForceDocumentStyleSelectorUpdate() +{ + return !m_webPagePrivate->m_webSettings->isJavaScriptEnabled() && !m_webPagePrivate->m_inputHandler->processingChange(); +} + +Page* ChromeClientBlackBerry::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree && !m_webPagePrivate->m_dumpRenderTree->allowsOpeningWindow()) + return 0; +#endif + + PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true); + TimerBase::fireTimersInNestedEventLoop(); + + int x = features.xSet ? features.x : 0; + int y = features.ySet ? features.y : 0; + int width = features.widthSet? features.width : -1; + int height = features.heightSet ? features.height : -1; + unsigned flags = 0; + + if (features.menuBarVisible) + flags |= WebPageClient::FlagWindowHasMenuBar; + if (features.statusBarVisible) + flags |= WebPageClient::FlagWindowHasStatusBar; + if (features.toolBarVisible) + flags |= WebPageClient::FlagWindowHasToolBar; + if (features.locationBarVisible) + flags |= WebPageClient::FlagWindowHasLocationBar; + if (features.scrollbarsVisible) + flags |= WebPageClient::FlagWindowHasScrollBar; + if (features.resizable) + flags |= WebPageClient::FlagWindowIsResizable; + if (features.fullscreen) + flags |= WebPageClient::FlagWindowIsFullScreen; + if (features.dialog) + flags |= WebPageClient::FlagWindowIsDialog; + + WebPage* webPage = m_webPagePrivate->m_client->createWindow(x, y, width, height, flags, WebString(request.resourceRequest().url().string()), WebString(request.frameName())); + if (!webPage) + return 0; + +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + m_webPagePrivate->m_dumpRenderTree->windowCreated(webPage); +#endif + + return webPage->d->m_page; +} + +void ChromeClientBlackBerry::show() +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::canRunModal() +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::runModal() +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::selectItemWritingDirectionIsNatural() +{ + return false; +} + +bool ChromeClientBlackBerry::selectItemAlignmentFollowsMenuWritingDirection() +{ + return true; +} + +PassRefPtr<PopupMenu> ChromeClientBlackBerry::createPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new PopupMenuBlackBerry(client)); +} + +PassRefPtr<SearchPopupMenu> ChromeClientBlackBerry::createSearchPopupMenu(PopupMenuClient* client) const +{ + return adoptRef(new SearchPopupMenuBlackBerry(client)); +} + + +void ChromeClientBlackBerry::setToolbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::toolbarsVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::setStatusbarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::statusbarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::setScrollbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::scrollbarsVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::setMenubarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::menubarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::setResizable(bool) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::canRunBeforeUnloadConfirmPanel() +{ + notImplemented(); + return false; +} + +bool ChromeClientBlackBerry::runBeforeUnloadConfirmPanel(const String& message, Frame*) +{ +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + return m_webPagePrivate->m_dumpRenderTree->runBeforeUnloadConfirmPanel(message); +#endif + + notImplemented(); + return false; +} + +void ChromeClientBlackBerry::closeWindowSoon() +{ + m_webPagePrivate->m_client->scheduleCloseWindow(); +} + +void ChromeClientBlackBerry::setStatusbarText(const String& status) +{ + m_webPagePrivate->m_client->setStatus(status); + +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + m_webPagePrivate->m_dumpRenderTree->setStatusText(status); +#endif +} + +IntRect ChromeClientBlackBerry::windowResizerRect() const +{ + notImplemented(); + return IntRect(); +} + +IntPoint ChromeClientBlackBerry::screenToWindow(const IntPoint& screenPos) const +{ + IntPoint windowPoint = m_webPagePrivate->m_client->window()->windowLocation(); + windowPoint.move(-screenPos.x(), -screenPos.y()); + return windowPoint; +} + +IntRect ChromeClientBlackBerry::windowToScreen(const IntRect& windowRect) const +{ + IntRect windowPoint(windowRect); + IntPoint location(m_webPagePrivate->m_client->window()->windowLocation()); + windowPoint.move(location.x(), location.y()); + return windowPoint; +} + +void ChromeClientBlackBerry::mouseDidMoveOverElement(const HitTestResult& result, unsigned int modifierFlags) +{ + notImplemented(); +} + +void ChromeClientBlackBerry::setToolTip(const String& tooltip, TextDirection) +{ + m_webPagePrivate->m_client->setToolTip(tooltip); +} + +#if ENABLE(EVENT_MODE_METATAGS) +void ChromeClientBlackBerry::didReceiveCursorEventMode(Frame* frame, CursorEventMode mode) const +{ + if (m_webPagePrivate->m_mainFrame != frame) + return; + + m_webPagePrivate->didReceiveCursorEventMode(mode); +} + +void ChromeClientBlackBerry::didReceiveTouchEventMode(Frame* frame, TouchEventMode mode) const +{ + if (m_webPagePrivate->m_mainFrame != frame) + return; + + m_webPagePrivate->didReceiveTouchEventMode(mode); +} +#endif + +void ChromeClientBlackBerry::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const +{ + m_webPagePrivate->dispatchViewportPropertiesDidChange(arguments); +} + +void ChromeClientBlackBerry::print(Frame*) +{ + notImplemented(); +} + +void ChromeClientBlackBerry::exceededDatabaseQuota(Frame* frame, const String& name) +{ +#if ENABLE(SQL_DATABASE) + Document* document = frame->document(); + if (!document) + return; + + SecurityOrigin* origin = document->securityOrigin(); + +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) { + m_webPagePrivate->m_dumpRenderTree->exceededDatabaseQuota(origin, name); + return; + } +#endif + + DatabaseTracker& tracker = DatabaseTracker::tracker(); + + unsigned long long totalUsage = tracker.totalDatabaseUsage(); + unsigned long long originUsage = tracker.usageForOrigin(origin); + + DatabaseDetails details = tracker.detailsForNameAndOrigin(name, origin); + unsigned long long estimatedSize = details.expectedUsage(); + const String& nameStr = details.displayName(); + + String originStr = origin->databaseIdentifier(); + + unsigned long long quota = m_webPagePrivate->m_client->databaseQuota(originStr.characters(), originStr.length(), + nameStr.characters(), nameStr.length(), totalUsage, originUsage, estimatedSize); + + tracker.setQuota(origin, quota); +#endif +} + +void ChromeClientBlackBerry::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation) +{ + if (!m_webPagePrivate->m_webSettings->isGeolocationEnabled()) { + geolocation->setIsAllowed(false); + return; + } + DOMWindow* window = frame->domWindow(); + if (!window) + return; + + CString latinOrigin = frameOrigin(frame); + + m_webPagePrivate->m_client->requestGeolocationPermission(m_webPagePrivate->m_geolocationClient, geolocation, latinOrigin.data(), latinOrigin.length()); +} + +void ChromeClientBlackBerry::cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation* geolocation) +{ + m_webPagePrivate->m_client->cancelGeolocationPermission(m_webPagePrivate->m_geolocationClient, geolocation); +} + +void ChromeClientBlackBerry::runOpenPanel(Frame*, PassRefPtr<FileChooser> chooser) +{ + SharedArray<WebString> initialFiles; + unsigned int initialFileSize = chooser->settings().selectedFiles.size(); + if (initialFileSize > 0) + initialFiles.reset(new WebString[initialFileSize]); + for (unsigned i = 0; i < initialFileSize; ++i) + initialFiles[i] = chooser->settings().selectedFiles[i]; + + SharedArray<WebString> chosenFiles; + unsigned int chosenFileSize; + + { + PageGroupLoadDeferrer deferrer(m_webPagePrivate->m_page, true); + TimerBase::fireTimersInNestedEventLoop(); + + // FIXME: Use chooser->settings().acceptMIMETypes instead of WebString() for the second parameter. + if (!m_webPagePrivate->m_client->chooseFilenames(chooser->settings().allowsMultipleFiles, WebString(), initialFiles, initialFileSize, chosenFiles, chosenFileSize)) + return; + } + + Vector<String> files(chosenFileSize); + for (unsigned i = 0; i < chosenFileSize; ++i) + files[i] = chosenFiles[i]; + chooser->chooseFiles(files); +} + +void ChromeClientBlackBerry::loadIconForFiles(const Vector<String>& filenames, FileIconLoader* loader) +{ + loader->notifyFinished(Icon::createIconForFiles(filenames)); +} + +void ChromeClientBlackBerry::setCursor(const Cursor&) +{ + notImplemented(); +} + +void ChromeClientBlackBerry::formStateDidChange(const Node* node) +{ + m_webPagePrivate->m_inputHandler->nodeTextChanged(node); +} + +void ChromeClientBlackBerry::scrollbarsModeDidChange() const +{ + notImplemented(); +} + +void ChromeClientBlackBerry::contentsSizeChanged(Frame* frame, const IntSize& size) const +{ + if (frame != m_webPagePrivate->m_mainFrame) + return; + + m_webPagePrivate->contentsSizeChanged(size); +} + +void ChromeClientBlackBerry::invalidateWindow(const IntRect& updateRect, bool immediate) +{ + m_webPagePrivate->m_backingStore->d->repaint(updateRect, false /*contentChanged*/, immediate); +} + +void ChromeClientBlackBerry::invalidateContentsAndWindow(const IntRect& updateRect, bool immediate) +{ + m_webPagePrivate->m_backingStore->d->repaint(updateRect, true /*contentChanged*/, immediate); +} + +void ChromeClientBlackBerry::invalidateContentsForSlowScroll(const IntSize& delta, const IntRect& updateRect, bool immediate, const ScrollView* scrollView) +{ + if (scrollView != m_webPagePrivate->m_mainFrame->view()) + invalidateContentsAndWindow(updateRect, true /*immediate*/); + else { + BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame); + ASSERT(backingStoreClientForFrame); + backingStoreClientForFrame->checkOriginOfCurrentScrollOperation(); + + m_webPagePrivate->m_backingStore->d->slowScroll(delta, updateRect, immediate); + } +} + +void ChromeClientBlackBerry::scroll(const IntSize& delta, const IntRect& scrollViewRect, const IntRect& clipRect) +{ + // FIXME: There's a chance the function is called indirectly by FrameView's dtor + // when the Frame's view() is null. We probably want to fix it in another way, but + // at this moment let's do a quick fix. + if (!m_webPagePrivate->m_mainFrame->view()) + return; + + BackingStoreClient* backingStoreClientForFrame = m_webPagePrivate->backingStoreClientForFrame(m_webPagePrivate->m_mainFrame); + ASSERT(backingStoreClientForFrame); + backingStoreClientForFrame->checkOriginOfCurrentScrollOperation(); + + m_webPagePrivate->m_backingStore->d->scroll(delta, scrollViewRect, clipRect); +} + +void ChromeClientBlackBerry::scrollableAreasDidChange() +{ + typedef HashSet<ScrollableArea*> ScrollableAreaSet; + const ScrollableAreaSet* scrollableAreas = m_webPagePrivate->m_page->scrollableAreaSet(); + + bool hasAtLeastOneInRegionScrollableArea = false; + ScrollableAreaSet::iterator end = scrollableAreas->end(); + for (ScrollableAreaSet::iterator it = scrollableAreas->begin(); it != end; ++it) { + if ((*it) != m_webPagePrivate->m_page->mainFrame()->view()) { + hasAtLeastOneInRegionScrollableArea = true; + break; + } + } + + m_webPagePrivate->setHasInRegionScrollableAreas(hasAtLeastOneInRegionScrollableArea); +} + +void ChromeClientBlackBerry::scrollRectIntoView(const IntRect&, const ScrollView*) const +{ + m_webPagePrivate->notifyTransformedScrollChanged(); +} + +bool ChromeClientBlackBerry::shouldInterruptJavaScript() +{ + TimerBase::fireTimersInNestedEventLoop(); + return m_webPagePrivate->m_client->shouldInterruptJavaScript(); +} + +KeyboardUIMode ChromeClientBlackBerry::keyboardUIMode() +{ + bool tabsToLinks = true; + +#if ENABLE_DRT + if (m_webPagePrivate->m_dumpRenderTree) + tabsToLinks = DumpRenderTreeSupport::linksIncludedInFocusChain(); +#endif + + return tabsToLinks ? KeyboardAccessTabsToLinks : KeyboardAccessDefault; +} + +PlatformPageClient ChromeClientBlackBerry::platformPageClient() const +{ + return m_webPagePrivate; +} + +#if ENABLE(TOUCH_EVENTS) +void ChromeClientBlackBerry::needTouchEvents(bool value) +{ + m_webPagePrivate->setNeedTouchEvents(value); +} +#endif + +void ChromeClientBlackBerry::reachedMaxAppCacheSize(int64_t spaceNeeded) +{ + notImplemented(); +} + +void ChromeClientBlackBerry::layoutUpdated(Frame* frame) const +{ + if (frame != m_webPagePrivate->m_mainFrame) + return; + + m_webPagePrivate->layoutFinished(); +} + +void ChromeClientBlackBerry::overflowExceedsContentsSize(Frame* frame) const +{ + if (frame != m_webPagePrivate->m_mainFrame) + return; + +#if DEBUG_OVERFLOW_DETECTION + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "ChromeClientBlackBerry::overflowExceedsContentsSize contents=%dx%d overflow=%dx%d", + frame->contentRenderer()->rightLayoutOverflow(), + frame->contentRenderer()->bottomLayoutOverflow(), + frame->contentRenderer()->rightAbsoluteVisibleOverflow(), + frame->contentRenderer()->bottomAbsoluteVisibleOverflow()); +#endif + m_webPagePrivate->overflowExceedsContentsSize(); +} + +void ChromeClientBlackBerry::didDiscoverFrameSet(Frame* frame) const +{ + if (frame != m_webPagePrivate->m_mainFrame) + return; + + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "ChromeClientBlackBerry::didDiscoverFrameSet"); + if (m_webPagePrivate->loadState() == WebPagePrivate::Committed) { + m_webPagePrivate->setShouldUseFixedDesktopMode(true); + m_webPagePrivate->zoomToInitialScaleOnLoad(); + } +} + +int ChromeClientBlackBerry::reflowWidth() const +{ + return m_webPagePrivate->reflowWidth(); +} + +void ChromeClientBlackBerry::chooseIconForFiles(const Vector<String>&, FileChooser*) +{ + notImplemented(); +} + +bool ChromeClientBlackBerry::supportsFullscreenForNode(const Node* node) +{ + return node->hasTagName(HTMLNames::videoTag); +} + +void ChromeClientBlackBerry::enterFullscreenForNode(Node* node) +{ + if (!supportsFullscreenForNode(node)) + return; + + m_webPagePrivate->enterFullscreenForNode(node); +} + +void ChromeClientBlackBerry::exitFullscreenForNode(Node* node) +{ + m_webPagePrivate->exitFullscreenForNode(node); +} + +#if ENABLE(WEBGL) +void ChromeClientBlackBerry::requestWebGLPermission(Frame* frame) +{ + if (frame) { + CString latinOrigin = frameOrigin(frame); + m_webPagePrivate->m_client->requestWebGLPermission(latinOrigin.data()); + } +} +#endif + +#if ENABLE(SVG) +void ChromeClientBlackBerry::didSetSVGZoomAndPan(Frame* frame, unsigned short zoomAndPan) +{ + // For top-level SVG document, there is no viewport tag, we use viewport's user-scalable + // to enable/disable zoom when top-level SVG document's zoomAndPan changed. Because there is no viewport + // tag, other fields with default value in ViewportArguments are ok. + if (frame == m_webPagePrivate->m_page->mainFrame()) { + ViewportArguments arguments; + switch (zoomAndPan) { + case SVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE: + arguments.userScalable = 0; + break; + case SVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY: + arguments.userScalable = 1; + break; + default: + return; + } + didReceiveViewportArguments(frame, arguments); + } +} +#endif + +#if ENABLE(NOTIFICATIONS) +NotificationPresenter* ChromeClientBlackBerry::notificationPresenter() const +{ + return WebKit::NotificationPresenterImpl::instance(); +} +#endif + +#if USE(ACCELERATED_COMPOSITING) +void ChromeClientBlackBerry::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) +{ + // If the graphicsLayer parameter is 0, WebCore is actually + // trying to remove a previously attached layer. + m_webPagePrivate->setRootLayerWebKitThread(frame, graphicsLayer ? graphicsLayer->platformLayer() : 0); +} + +void ChromeClientBlackBerry::setNeedsOneShotDrawingSynchronization() +{ + m_webPagePrivate->setNeedsOneShotDrawingSynchronization(); +} + +void ChromeClientBlackBerry::scheduleCompositingLayerSync() +{ + m_webPagePrivate->scheduleRootLayerCommit(); +} + +bool ChromeClientBlackBerry::allowsAcceleratedCompositing() const +{ + return true; +} +#endif + +void* ChromeClientBlackBerry::platformWindow() const +{ + return m_webPagePrivate->m_client->window(); +} + +void* ChromeClientBlackBerry::platformCompositingWindow() const +{ + return m_webPagePrivate->m_client->compositingWindow(); +} + +} // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h new file mode 100644 index 000000000..76a715abe --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.h @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ChromeClientBlackBerry_h +#define ChromeClientBlackBerry_h + +#include "ChromeClient.h" + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { + +class ChromeClientBlackBerry : public ChromeClient { +public: + ChromeClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + + virtual void chromeDestroyed(); + virtual void* webView() const { return 0; }; + virtual void setWindowRect(const FloatRect&); + virtual FloatRect windowRect(); + virtual FloatRect pageRect(); + virtual float scaleFactor(); + virtual void focus(); + virtual void unfocus(); + virtual bool canTakeFocus(FocusDirection); + virtual void takeFocus(FocusDirection); + virtual void focusedNodeChanged(Node*); + virtual void focusedFrameChanged(Frame*); + virtual bool shouldForceDocumentStyleSelectorUpdate(); + virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&); + virtual void show(); + virtual bool canRunModal(); + virtual void runModal(); + virtual void setToolbarsVisible(bool); + virtual bool toolbarsVisible(); + virtual void setStatusbarVisible(bool); + virtual bool statusbarVisible(); + virtual void setScrollbarsVisible(bool); + virtual bool scrollbarsVisible(); + virtual void setMenubarVisible(bool); + virtual bool menubarVisible(); + virtual void setResizable(bool); + virtual void addMessageToConsole(MessageSource, MessageType, MessageLevel, const String& message, unsigned int lineNumber, const String& sourceID); + virtual bool canRunBeforeUnloadConfirmPanel(); + virtual bool runBeforeUnloadConfirmPanel(const String&, Frame*); + virtual void closeWindowSoon(); + virtual void runJavaScriptAlert(Frame*, const String&); + virtual bool runJavaScriptConfirm(Frame*, const String&); + virtual bool runJavaScriptPrompt(Frame*, const String&, const String&, String&); + virtual void setStatusbarText(const String&); + virtual bool shouldInterruptJavaScript(); + virtual KeyboardUIMode keyboardUIMode(); + virtual IntRect windowResizerRect() const; + virtual void invalidateWindow(const IntRect&, bool); + virtual void invalidateContentsAndWindow(const IntRect&, bool); + virtual void invalidateContentsForSlowScroll(const IntSize&, const IntRect&, bool, const ScrollView*); + virtual void scroll(const IntSize&, const IntRect&, const IntRect&); + virtual void scrollableAreasDidChange(); + virtual IntPoint screenToWindow(const IntPoint&) const; + virtual IntRect windowToScreen(const IntRect&) const; + virtual void contentsSizeChanged(Frame*, const IntSize&) const; + virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const; + virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned int); + virtual void setToolTip(const String&, TextDirection); +#if ENABLE(EVENT_MODE_METATAGS) + virtual void didReceiveCursorEventMode(Frame*, CursorEventMode) const; + virtual void didReceiveTouchEventMode(Frame*, TouchEventMode) const; +#endif + virtual void dispatchViewportPropertiesDidChange(const ViewportArguments&) const; + virtual bool shouldRubberBandInDirection(ScrollDirection) const { return true; } + virtual void numWheelEventHandlersChanged(unsigned) { } + virtual void print(Frame*); + virtual void exceededDatabaseQuota(Frame*, const String&); + virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*); + virtual void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*); + virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); + virtual void loadIconForFiles(const Vector<String>&, FileIconLoader*); + virtual void setCursor(const Cursor&); + virtual void setCursorHiddenUntilMouseMoves(bool) { } + virtual void formStateDidChange(const Node*); + virtual void scrollbarsModeDidChange() const; + virtual PlatformPageClient platformPageClient() const; + +#if ENABLE(TOUCH_EVENTS) + virtual void needTouchEvents(bool); +#endif + +#if ENABLE(INPUT_COLOR) + void openColorChooser(ColorChooser*, const Color&) { } + void cleanupColorChooser(ColorChooser*) { } + void setSelectedColorInColorChooser(ColorChooser*, const Color&) { } +#endif + + virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); + virtual void reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t) { } + + virtual void layoutUpdated(Frame*) const; + virtual void overflowExceedsContentsSize(Frame*) const; + virtual void didDiscoverFrameSet(Frame*) const; + + virtual int reflowWidth() const; + + virtual void chooseIconForFiles(const Vector<String>&, FileChooser*); + + virtual bool supportsFullscreenForNode(const Node*); + virtual void enterFullscreenForNode(Node*); + virtual void exitFullscreenForNode(Node*); +#if ENABLE(WEBGL) + virtual void requestWebGLPermission(Frame*); +#endif + +#if ENABLE(NOTIFICATIONS) + virtual NotificationPresenter* notificationPresenter() const; +#endif + +#if ENABLE(SVG) + virtual void didSetSVGZoomAndPan(Frame*, unsigned short zoomAndPan); +#endif + virtual bool selectItemWritingDirectionIsNatural(); + virtual bool selectItemAlignmentFollowsMenuWritingDirection(); + virtual PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const; + virtual PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const; + virtual void showContextMenu() { } + +#if USE(ACCELERATED_COMPOSITING) + virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*); + virtual void setNeedsOneShotDrawingSynchronization(); + virtual void scheduleCompositingLayerSync(); + virtual bool allowsAcceleratedCompositing() const; +#endif + + virtual void* platformWindow() const; + virtual void* platformCompositingWindow() const; + + BlackBerry::WebKit::WebPagePrivate* webPagePrivate() const { return m_webPagePrivate; } + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; +}; + +} // WebCore + +#endif // ChromeClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp new file mode 100644 index 000000000..d3d7b62b9 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.cpp @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "ClientExtension.h" + +#include "Frame.h" +#include "WebPageClient.h" +#include <JavaScriptCore/API/JSCallbackObject.h> +#include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSValueRef.h> +#include <JavaScriptCore/JavaScript.h> +#include <string> + +using namespace WebCore; +using namespace BlackBerry::WebKit; +using namespace std; + +static JSValueRef clientExtensionMethod( + JSContextRef ctx, JSObjectRef functionObject, JSObjectRef thisObject, + size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + JSValueRef jsRetVal = JSValueMakeUndefined(ctx); + if (argumentCount <= 0) + return jsRetVal; + + char** strArgs = new char*[argumentCount]; + for (unsigned i = 0; i < argumentCount; ++i) { + JSStringRef string = JSValueToStringCopy(ctx, arguments[i], 0); + size_t sizeUTF8 = JSStringGetMaximumUTF8CStringSize(string); + strArgs[i] = new char[sizeUTF8]; + JSStringGetUTF8CString(string, strArgs[i], sizeUTF8); + JSStringRelease(string); + } + + WebPageClient* client = reinterpret_cast<WebPageClient*>(JSObjectGetPrivate(thisObject)); + string retVal = client->invokeClientJavaScriptCallback(strArgs, argumentCount).utf8(); + if (!retVal.empty()) + jsRetVal = JSValueMakeString(ctx, JSStringCreateWithUTF8CString(retVal.c_str())); + + for (unsigned i = 0; i < argumentCount; ++i) + delete[] strArgs[i]; + delete[] strArgs; + + return jsRetVal; +} + +static void clientExtensionInitialize(JSContextRef context, JSObjectRef object) +{ + UNUSED_PARAM(context); + UNUSED_PARAM(object); +} + +static void clientExtensionFinalize(JSObjectRef object) +{ + UNUSED_PARAM(object); +} + +static JSStaticFunction clientExtensionStaticFunctions[] = { + { "callExtensionMethod", clientExtensionMethod, kJSPropertyAttributeNone }, + { 0, 0, 0 } +}; + +static JSStaticValue clientExtensionStaticValues[] = { + { 0, 0, 0, 0 } +}; + +// FIXME: Revisit the creation of this class and make sure this is the best way to approach it. +void attachExtensionObjectToFrame(Frame* frame, WebPageClient* client) +{ + JSC::JSLock lock(JSC::SilenceAssertionsOnly); + + JSDOMWindow* window = frame->script()->windowShell(mainThreadNormalWorld())->window(); + + JSC::ExecState* exec = window->globalExec(); + JSContextRef scriptCtx = toRef(exec); + + JSClassDefinition definition = kJSClassDefinitionEmpty; + definition.staticValues = clientExtensionStaticValues; + definition.staticFunctions = clientExtensionStaticFunctions; + definition.initialize = clientExtensionInitialize; + definition.finalize = clientExtensionFinalize; + JSClassRef clientClass = JSClassCreate(&definition); + + JSObjectRef clientClassObject = JSObjectMake(scriptCtx, clientClass, 0); + JSObjectSetPrivate(clientClassObject, reinterpret_cast<void*>(client)); + + JSC::UString name("qnx"); + + JSC::PutPropertySlot slot; + window->put(window, exec, JSC::Identifier(exec, name), toJS(clientClassObject), slot); + + JSClassRelease(clientClass); +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h new file mode 100644 index 000000000..3a75616a8 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/ClientExtension.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef ClientExtension_h +#define ClientExtension_h + +namespace WebCore { +class Frame; +} + +namespace BlackBerry { +namespace WebKit { +class WebPageClient; +} +} + +void attachExtensionObjectToFrame(WebCore::Frame*, BlackBerry::WebKit::WebPageClient*); + +#endif // ClientExtension_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp new file mode 100644 index 000000000..93f24ff11 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DeviceMotionClientBlackBerry.h" + +#include "DeviceMotionController.h" +#include "DeviceMotionData.h" +#include "WebPage_p.h" +#include <BlackBerryPlatformDeviceMotionTracker.h> + +using namespace WebCore; + +DeviceMotionClientBlackBerry::DeviceMotionClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) + , m_tracker(0) + , m_controller(0) + , m_lastEventTime(0) +{ +} + +DeviceMotionClientBlackBerry::~DeviceMotionClientBlackBerry() +{ + if (m_tracker) + m_tracker->destroy(); +} + +void DeviceMotionClientBlackBerry::setController(DeviceMotionController* controller) +{ + m_controller = controller; +} + +void DeviceMotionClientBlackBerry::deviceMotionControllerDestroyed() +{ + delete this; +} + +void DeviceMotionClientBlackBerry::startUpdating() +{ + if (m_tracker) + m_tracker->resume(); + else + m_tracker = BlackBerry::Platform::DeviceMotionTracker::create(this); +} + +void DeviceMotionClientBlackBerry::stopUpdating() +{ + if (m_tracker) + m_tracker->suspend(); +} + +DeviceMotionData* DeviceMotionClientBlackBerry::currentDeviceMotion() const +{ + return m_currentMotion.get(); +} + +void DeviceMotionClientBlackBerry::onMotion(const BlackBerry::Platform::DeviceMotionEvent* event) +{ + RefPtr<DeviceMotionData::Acceleration> accel = DeviceMotionData::Acceleration::create( + true, event->x, true, event->y, true, event->z); + + double now = WTF::currentTimeMS(); + m_currentMotion = DeviceMotionData::create(0, accel, 0, m_lastEventTime, m_lastEventTime - now); + m_lastEventTime = now; + + if (!m_controller) + return; + + m_controller->didChangeDeviceMotion(currentDeviceMotion()); +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h new file mode 100644 index 000000000..76ac42966 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DeviceMotionClientBlackBerry_h +#define DeviceMotionClientBlackBerry_h + +#include "DeviceMotionClient.h" +#include "DeviceMotionData.h" + +#include <BlackBerryPlatformDeviceMotionTrackerListener.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace BlackBerry { +namespace Platform { +class DeviceMotionTracker; +} +} + +namespace WebCore { + +class DeviceMotionClientBlackBerry : public DeviceMotionClient, public BlackBerry::Platform::DeviceMotionTrackerListener { +public: + DeviceMotionClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + ~DeviceMotionClientBlackBerry(); + + virtual void setController(DeviceMotionController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceMotionData* currentDeviceMotion() const; + virtual void deviceMotionControllerDestroyed(); + virtual void onMotion(const BlackBerry::Platform::DeviceMotionEvent*); + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + BlackBerry::Platform::DeviceMotionTracker* m_tracker; + DeviceMotionController* m_controller; + RefPtr<DeviceMotionData> m_currentMotion; + double m_lastEventTime; +}; +} + +#endif // DeviceMotionClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp new file mode 100644 index 000000000..2970a4f5b --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DeviceOrientationClientBlackBerry.h" + +#include "DeviceOrientationController.h" +#include "WebPage_p.h" +#include <BlackBerryPlatformDeviceOrientationTracker.h> + +using namespace WebCore; + +DeviceOrientationClientBlackBerry::DeviceOrientationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) + , m_tracker(0) + , m_controller(0) +{ +} + +DeviceOrientationClientBlackBerry::~DeviceOrientationClientBlackBerry() +{ + if (m_tracker) + m_tracker->destroy(); +} + +void DeviceOrientationClientBlackBerry::setController(DeviceOrientationController* controller) +{ + m_controller = controller; +} + +void DeviceOrientationClientBlackBerry::deviceOrientationControllerDestroyed() +{ + delete this; +} + +void DeviceOrientationClientBlackBerry::startUpdating() +{ + if (m_tracker) + m_tracker->resume(); + else + m_tracker = BlackBerry::Platform::DeviceOrientationTracker::create(this); +} + +void DeviceOrientationClientBlackBerry::stopUpdating() +{ + if (m_tracker) + m_tracker->suspend(); +} + +DeviceOrientation* DeviceOrientationClientBlackBerry::lastOrientation() const +{ + return m_currentOrientation.get(); +} + +void DeviceOrientationClientBlackBerry::onOrientation(const BlackBerry::Platform::DeviceOrientationEvent* event) +{ + m_currentOrientation = DeviceOrientation::create(true, event->alpha, true, event->beta, true, event->gamma); + if (!m_controller) + return; + + m_controller->didChangeDeviceOrientation(lastOrientation()); +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h new file mode 100644 index 000000000..7610fb1d4 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceOrientationClientBlackBerry.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DeviceOrientationClientBlackBerry_h +#define DeviceOrientationClientBlackBerry_h + +#include "DeviceOrientation.h" +#include "DeviceOrientationClient.h" + +#include <BlackBerryPlatformDeviceOrientationTrackerListener.h> +#include <wtf/RefPtr.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace BlackBerry { +namespace Platform { +class DeviceOrientationTracker; +} +} + +namespace WebCore { + +class DeviceOrientationClientBlackBerry : public DeviceOrientationClient, public BlackBerry::Platform::DeviceOrientationTrackerListener { +public: + DeviceOrientationClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + virtual ~DeviceOrientationClientBlackBerry(); + + virtual void setController(DeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual DeviceOrientation* lastOrientation() const; + virtual void deviceOrientationControllerDestroyed(); + virtual void onOrientation(const BlackBerry::Platform::DeviceOrientationEvent*); + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + BlackBerry::Platform::DeviceOrientationTracker* m_tracker; + DeviceOrientationController* m_controller; + RefPtr<DeviceOrientation> m_currentOrientation; +}; +} + +#endif // DeviceOrientationClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp new file mode 100644 index 000000000..f6cdbceb7 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "FrameNetworkingContextBlackBerry.h" + +namespace WebCore { + +FrameNetworkingContextBlackBerry::FrameNetworkingContextBlackBerry(Frame* frame) + : FrameNetworkingContext(frame) +{ +} + +PassRefPtr<FrameNetworkingContextBlackBerry> FrameNetworkingContextBlackBerry::create(Frame* frame) +{ + return adoptRef(new FrameNetworkingContextBlackBerry(frame)); +} + +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h new file mode 100644 index 000000000..408b1ee0d --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameNetworkingContextBlackBerry.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef FrameNetworkingContextBlackBerry_h +#define FrameNetworkingContextBlackBerry_h + +#include "FrameNetworkingContext.h" + +namespace WebCore { + +class FrameNetworkingContextBlackBerry : public FrameNetworkingContext { +public: + static PassRefPtr<FrameNetworkingContextBlackBerry> create(Frame*); + using FrameNetworkingContext::frame; + +private: + FrameNetworkingContextBlackBerry(Frame*); +}; + +} + +#endif // FrameNetworkingContextBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp new file mode 100644 index 000000000..fd59f2e41 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "GeolocationControllerClientBlackBerry.h" + +#include "Chrome.h" +#include "Geolocation.h" +#include "GeolocationController.h" +#include "GeolocationError.h" +#include "Page.h" +#include "WebPage_p.h" + +using namespace WebCore; + +GeolocationControllerClientBlackBerry::GeolocationControllerClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) + , m_tracker(0) + , m_accuracy(false) +{ +} + +void GeolocationControllerClientBlackBerry::geolocationDestroyed() +{ + if (m_tracker) + m_tracker->destroy(); + delete this; +} + +void GeolocationControllerClientBlackBerry::startUpdating() +{ + if (m_tracker) + m_tracker->resume(); + else + m_tracker = BlackBerry::Platform::GeoTracker::create(this, 0, m_accuracy, -1, -1); +} + +void GeolocationControllerClientBlackBerry::stopUpdating() +{ + if (m_tracker) + m_tracker->suspend(); +} + +GeolocationPosition* GeolocationControllerClientBlackBerry::lastPosition() +{ + return m_lastPosition.get(); +} + +void GeolocationControllerClientBlackBerry::requestPermission(Geolocation* location) +{ + Frame* frame = location->frame(); + if (!frame) + return; + m_webPagePrivate->m_page->chrome()->requestGeolocationPermissionForFrame(frame, location); +} + +void GeolocationControllerClientBlackBerry::cancelPermissionRequest(Geolocation* location) +{ + Frame* frame = location->frame(); + if (!frame) + return; + m_webPagePrivate->m_page->chrome()->cancelGeolocationPermissionRequestForFrame(frame, location); +} + +void GeolocationControllerClientBlackBerry::onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid, + double altitudeAccuracy, bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid) +{ + m_lastPosition = GeolocationPosition::create(timestamp, latitude, longitude, accuracy, altitudeValid, altitude, altitudeAccuracyValid, + altitudeAccuracy, headingValid, heading, speedValid, speed); + m_webPagePrivate->m_page->geolocationController()->positionChanged(m_lastPosition.get()); +} + +void GeolocationControllerClientBlackBerry::onLocationError(const char* errorStr) +{ + RefPtr<GeolocationError> error = GeolocationError::create(GeolocationError::PositionUnavailable, String::fromUTF8(errorStr)); + m_webPagePrivate->m_page->geolocationController()->errorOccurred(error.get()); +} + +void GeolocationControllerClientBlackBerry::onPermission(void* context, bool isAllowed) +{ + Geolocation* position = static_cast<Geolocation*>(context); + position->setIsAllowed(isAllowed); +} + +void GeolocationControllerClientBlackBerry::setEnableHighAccuracy(bool newAccuracy) +{ + if (m_accuracy == newAccuracy) + return; + if (m_tracker) { + m_tracker->destroy(); + m_tracker = BlackBerry::Platform::GeoTracker::create(this, 0, newAccuracy, -1, -1); + } +} + diff --git a/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h new file mode 100644 index 000000000..ea634bb97 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/GeolocationControllerClientBlackBerry.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef GeolocationControllerClientBlackBerry_h +#define GeolocationControllerClientBlackBerry_h + +#include <BlackBerryPlatformGeoTracker.h> +#include <BlackBerryPlatformGeoTrackerListener.h> +#include <GeolocationClient.h> +#include <GeolocationPosition.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { + +class GeolocationControllerClientBlackBerry : public GeolocationClient, public BlackBerry::Platform::GeoTrackerListener { +public: + GeolocationControllerClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + + virtual void geolocationDestroyed(); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual GeolocationPosition* lastPosition(); + virtual void setEnableHighAccuracy(bool); + virtual void requestPermission(Geolocation*); + virtual void cancelPermissionRequest(Geolocation*); + + virtual void onLocationUpdate(double timestamp, double latitude, double longitude, double accuracy, double altitude, bool altitudeValid, double altitudeAccuracy, + bool altitudeAccuracyValid, double speed, bool speedValid, double heading, bool headingValid); + virtual void onLocationError(const char* error); + virtual void onPermission(void* context, bool isAllowed); + BlackBerry::Platform::GeoTracker* tracker() const { return m_tracker; } + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + BlackBerry::Platform::GeoTracker* m_tracker; + RefPtr<GeolocationPosition> m_lastPosition; + bool m_accuracy; +}; +} + +#endif // GeolocationControllerClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp new file mode 100644 index 000000000..174de15b7 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "IconDatabaseClientBlackBerry.h" + +#include "IconDatabase.h" +#include "WebSettings.h" +#include "WebString.h" + +namespace WebCore { + +IconDatabaseClientBlackBerry* IconDatabaseClientBlackBerry::getInstance() +{ + static IconDatabaseClientBlackBerry* instance = 0; + if (!instance) + instance = new IconDatabaseClientBlackBerry(); + return instance; +} + +bool IconDatabaseClientBlackBerry::initIconDatabase(const BlackBerry::WebKit::WebSettings* settings) +{ + bool enable = !settings->isPrivateBrowsingEnabled() && settings->isDatabasesEnabled(); + iconDatabase().setEnabled(enable); + if (!enable) { + m_initState = NotInitialized; + return false; + } + + if (m_initState == InitializeFailed) + return false; + + if (m_initState == InitializeSucceeded) + return true; + + iconDatabase().setClient(this); + + BlackBerry::WebKit::WebString path = settings->databasePath(); + + if (path.isEmpty()) + path = settings->localStoragePath(); + + m_initState = iconDatabase().open(path, IconDatabase::defaultDatabaseFilename()) ? InitializeSucceeded : InitializeFailed; + + return m_initState == InitializeSucceeded; +} + +bool IconDatabaseClientBlackBerry::performImport() +{ + return true; +} + +void IconDatabaseClientBlackBerry::didRemoveAllIcons() +{ +} + +void IconDatabaseClientBlackBerry::didImportIconURLForPageURL(const String&) +{ +} + +void IconDatabaseClientBlackBerry::didImportIconDataForPageURL(const String&) +{ +} + +void IconDatabaseClientBlackBerry::didChangeIconForPageURL(const String&) +{ +} + +void IconDatabaseClientBlackBerry::didFinishURLImport() +{ +} + +} // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h new file mode 100644 index 000000000..c72a450bc --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/IconDatabaseClientBlackBerry.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IconDatabaseClientBlackBerry_h +#define IconDatabaseClientBlackBerry_h + +#include "IconDatabaseClient.h" + +namespace BlackBerry { +namespace WebKit { +class WebSettings; +} +} + +namespace WebCore { + +class IconDatabaseClientBlackBerry : public IconDatabaseClient { +public: + static IconDatabaseClientBlackBerry* getInstance(); + bool initIconDatabase(const BlackBerry::WebKit::WebSettings*); + + virtual bool performImport(); + virtual void didRemoveAllIcons(); + virtual void didImportIconURLForPageURL(const String&); + virtual void didImportIconDataForPageURL(const String&); + virtual void didChangeIconForPageURL(const String&); + virtual void didFinishURLImport(); + +private: + IconDatabaseClientBlackBerry() + : m_initState(NotInitialized) + { + } + enum { NotInitialized, InitializeSucceeded, InitializeFailed } m_initState; +}; + +} + +#endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp new file mode 100644 index 000000000..73f887f30 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.cpp @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "InspectorClientBlackBerry.h" + +#include "BackingStore.h" +#include "Frame.h" +#include "NotImplemented.h" +#include "RenderObject.h" +#include "WebPageClient.h" +#include "WebPage_p.h" + +namespace WebCore { + +InspectorClientBlackBerry::InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate* webPagePrivate) + : m_webPagePrivate(webPagePrivate) +{ + m_inspectorSettingsMap = adoptPtr(new SettingsMap); +} + +void InspectorClientBlackBerry::inspectorDestroyed() +{ + delete this; +} + +Page* InspectorClientBlackBerry::createPage() +{ + notImplemented(); + return 0; +} + +String InspectorClientBlackBerry::localizedStringsURL() +{ + notImplemented(); + return String(); +} + +String InspectorClientBlackBerry::hiddenPanels() +{ + notImplemented(); + return String(); +} + +void InspectorClientBlackBerry::showWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::closeWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::attachWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::detachWindow() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::setAttachedWindowHeight(unsigned) +{ + notImplemented(); +} + +void InspectorClientBlackBerry::highlight() +{ + hideHighlight(); +} + +void InspectorClientBlackBerry::hideHighlight() +{ + if (!m_webPagePrivate->mainFrame() || !m_webPagePrivate->mainFrame()->document() || !m_webPagePrivate->mainFrame()->document()->documentElement() + || !m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()) + return; + + // FIXME: Potentially slow hack, but invalidating everything should work since the actual highlight is drawn by BackingStorePrivate::renderContents(). + m_webPagePrivate->mainFrame()->document()->documentElement()->renderer()->repaint(true); +} + +void InspectorClientBlackBerry::inspectedURLChanged(const String&) +{ + notImplemented(); +} + +void InspectorClientBlackBerry::populateSetting(const String& key, String* value) +{ + if (m_inspectorSettingsMap->contains(key)) + *value = m_inspectorSettingsMap->get(key); +} + +void InspectorClientBlackBerry::storeSetting(const String& key, const String& value) +{ + m_inspectorSettingsMap->set(key, value); +} + +void InspectorClientBlackBerry::inspectorWindowObjectCleared() +{ + notImplemented(); +} + +void InspectorClientBlackBerry::openInspectorFrontend(InspectorController*) +{ + notImplemented(); +} + +bool InspectorClientBlackBerry::sendMessageToFrontend(const String& message) +{ + CString utf8Message = message.utf8(); + m_webPagePrivate->m_client->handleWebInspectorMessageToFrontend(0, utf8Message.data(), utf8Message.length()); + return true; +} + +void InspectorClientBlackBerry::clearBrowserCache() +{ + m_webPagePrivate->m_client->clearCache(); +} + +void InspectorClientBlackBerry::clearBrowserCookies() +{ + m_webPagePrivate->m_client->clearCookies(); +} + +} // namespace WebCore diff --git a/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h new file mode 100644 index 000000000..f5cca1e87 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/InspectorClientBlackBerry.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ + * Copyright (C) 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef InspectorClientBlackBerry_h +#define InspectorClientBlackBerry_h + +#include "InspectorClient.h" +#include "PlatformString.h" +#include <wtf/HashMap.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +} +} + +namespace WebCore { + +class InspectorClientBlackBerry : public InspectorClient { +public: + InspectorClientBlackBerry(BlackBerry::WebKit::WebPagePrivate*); + virtual void inspectorDestroyed(); + virtual Page* createPage(); + virtual String localizedStringsURL(); + virtual String hiddenPanels(); + virtual void showWindow(); + virtual void closeWindow(); + virtual void attachWindow(); + virtual void detachWindow(); + virtual void setAttachedWindowHeight(unsigned); + virtual void highlight(); + virtual void hideHighlight(); + virtual void inspectedURLChanged(const String&); + virtual void populateSetting(const String& key, String* value); + virtual void storeSetting(const String& key, const String& value); + virtual void inspectorWindowObjectCleared(); + virtual void openInspectorFrontend(InspectorController*); + virtual bool sendMessageToFrontend(const String&); + virtual void clearBrowserCache(); + virtual void clearBrowserCookies(); + +private: + BlackBerry::WebKit::WebPagePrivate* m_webPagePrivate; + typedef HashMap<String, String> SettingsMap; + OwnPtr<SettingsMap> m_inspectorSettingsMap; +}; + +} // namespace WebCore + +#endif // InspectorClientBlackBerry_h diff --git a/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp new file mode 100644 index 000000000..a93005010 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.cpp @@ -0,0 +1,166 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DumpRenderTreeSupport.h" + +#include "CSSComputedStyleDeclaration.h" +#include "Frame.h" +#include "GeolocationClientMock.h" +#include "GeolocationController.h" +#include "GeolocationError.h" +#include "GeolocationPosition.h" +#include "JSCSSStyleDeclaration.h" +#include "JSElement.h" +#include "Page.h" +#include "ViewportArguments.h" +#include "WebPage.h" +#include "bindings/js/GCController.h" +#include <JavaScriptCore/APICast.h> +#include <wtf/CurrentTime.h> + +using namespace BlackBerry::WebKit; +using namespace WebCore; +using namespace JSC; + +bool DumpRenderTreeSupport::s_linksIncludedInTabChain = true; + +#if ENABLE(CLIENT_BASED_GEOLOCATION) +GeolocationClientMock* toGeolocationClientMock(GeolocationClient* client) +{ + ASSERT(getenv("drtRun")); + return static_cast<GeolocationClientMock*>(client); +} +#endif + +DumpRenderTreeSupport::DumpRenderTreeSupport() +{ +} + +DumpRenderTreeSupport::~DumpRenderTreeSupport() +{ +} + +int DumpRenderTreeSupport::javaScriptObjectsCount() +{ + return JSDOMWindowBase::commonJSGlobalData()->heap.globalObjectCount(); +} + +void DumpRenderTreeSupport::garbageCollectorCollect() +{ + gcController().garbageCollectNow(); +} + +void DumpRenderTreeSupport::garbageCollectorCollectOnAlternateThread(bool waitUntilDone) +{ + gcController().garbageCollectOnAlternateThreadForDebugging(waitUntilDone); +} + +void DumpRenderTreeSupport::setLinksIncludedInFocusChain(bool enabled) +{ + s_linksIncludedInTabChain = enabled; +} + +bool DumpRenderTreeSupport::linksIncludedInFocusChain() +{ + return s_linksIncludedInTabChain; +} + +void DumpRenderTreeSupport::dumpConfigurationForViewport(Frame* mainFrame, int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) +{ + ViewportArguments arguments = mainFrame->page()->viewportArguments(); + ViewportAttributes attrs = computeViewportAttributes(arguments, /* default layout width for non-mobile pages */ 980, deviceWidth, deviceHeight, deviceDPI, IntSize(availableWidth, availableHeight)); + restrictMinimumScaleFactorToViewportSize(attrs, IntSize(availableWidth, availableHeight)); + restrictScaleFactorToInitialScaleIfNotUserScalable(attrs); + + fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f] and userScalable %f\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale, attrs.userScalable); +} + +int DumpRenderTreeSupport::numberOfPendingGeolocationPermissionRequests(WebPage* webPage) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + GeolocationClientMock* mockClient = toGeolocationClientMock(webPage->mainFrame()->page()->geolocationController()->client()); + return mockClient->numberOfPendingPermissionRequests(); +#else + UNUSED_PARAM(webPage); + return -1; +#endif +} + +void DumpRenderTreeSupport::resetGeolocationMock(WebPage* webPage) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + GeolocationClientMock* mockClient = toGeolocationClientMock(webPage->mainFrame()->page()->geolocationController()->client()); + mockClient->reset(); +#endif +} + +void DumpRenderTreeSupport::setMockGeolocationError(WebPage* webPage, int errorCode, const String message) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + GeolocationError::ErrorCode code = GeolocationError::PositionUnavailable; + switch (errorCode) { + case PositionError::PERMISSION_DENIED: + code = GeolocationError::PermissionDenied; + break; + case PositionError::POSITION_UNAVAILABLE: + code = GeolocationError::PositionUnavailable; + break; + } + + GeolocationClientMock* mockClient = static_cast<GeolocationClientMock*>(webPage->mainFrame()->page()->geolocationController()->client()); + mockClient->setError(GeolocationError::create(code, message)); +#endif +} + +void DumpRenderTreeSupport::setMockGeolocationPermission(WebPage* webPage, bool allowed) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + GeolocationClientMock* mockClient = toGeolocationClientMock(webPage->mainFrame()->page()->geolocationController()->client()); + mockClient->setPermission(allowed); +#endif +} + +void DumpRenderTreeSupport::setMockGeolocationPosition(WebPage* webPage, double latitude, double longitude, double accuracy) +{ +#if ENABLE(CLIENT_BASED_GEOLOCATION) + GeolocationClientMock* mockClient = toGeolocationClientMock(webPage->mainFrame()->page()->geolocationController()->client()); + mockClient->setPosition(GeolocationPosition::create(currentTime(), latitude, longitude, accuracy)); +#endif +} + +void DumpRenderTreeSupport::scalePageBy(WebPage* webPage, float scaleFactor, float x, float y) +{ + webPage->mainFrame()->page()->setPageScaleFactor(scaleFactor, IntPoint(x, y)); +} + +JSValueRef DumpRenderTreeSupport::computedStyleIncludingVisitedInfo(JSContextRef context, JSValueRef value) +{ + JSLock lock(SilenceAssertionsOnly); + ExecState* exec = toJS(context); + if (!value) + return JSValueMakeUndefined(context); + JSValue jsValue = toJS(exec, value); + if (!jsValue.inherits(&JSElement::s_info)) + return JSValueMakeUndefined(context); + JSElement* jsElement = static_cast<JSElement*>(asObject(jsValue)); + Element* element = jsElement->impl(); + RefPtr<CSSComputedStyleDeclaration> style = computedStyle(element, true); + return toRef(exec, toJS(exec, jsElement->globalObject(), style.get())); +} + diff --git a/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.h b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.h new file mode 100644 index 000000000..3b140304b --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/DumpRenderTreeSupport.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DumpRenderTreeSupport_h +#define DumpRenderTreeSupport_h + +#include <JavaScriptCore/JSObjectRef.h> + +namespace BlackBerry { +namespace WebKit { +class WebPage; +} +} + +namespace WebCore { +class Frame; +} + +namespace WTF { +class String; +} + +class DumpRenderTreeSupport { +public: + DumpRenderTreeSupport(); + ~DumpRenderTreeSupport(); + + static void setLinksIncludedInFocusChain(bool); + static bool linksIncludedInFocusChain(); + + static int javaScriptObjectsCount(); + static void garbageCollectorCollect(); + static void garbageCollectorCollectOnAlternateThread(bool waitUntilDone); + + static void dumpConfigurationForViewport(WebCore::Frame* mainFrame, int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight); + + static int numberOfPendingGeolocationPermissionRequests(BlackBerry::WebKit::WebPage*); + static void resetGeolocationMock(BlackBerry::WebKit::WebPage*); + static void setMockGeolocationError(BlackBerry::WebKit::WebPage*, int errorCode, const WTF::String message); + static void setMockGeolocationPermission(BlackBerry::WebKit::WebPage*, bool allowed); + static void setMockGeolocationPosition(BlackBerry::WebKit::WebPage*, double latitude, double longitude, double accuracy); + static void scalePageBy(BlackBerry::WebKit::WebPage*, float, float, float); + static JSValueRef computedStyleIncludingVisitedInfo(JSContextRef, JSValueRef); + +private: + static bool s_linksIncludedInTabChain; +}; + +#endif diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp new file mode 100644 index 000000000..ad555dae7 --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -0,0 +1,1745 @@ +/* + * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "InputHandler.h" + +#include "BackingStore.h" +#include "BackingStoreClient.h" +#include "CSSStyleDeclaration.h" +#include "CString.h" +#include "Chrome.h" +#include "DOMSupport.h" +#include "Document.h" +#include "DocumentLoader.h" +#include "DocumentMarkerController.h" +#include "FocusController.h" +#include "Frame.h" +#include "FrameView.h" +#include "HTMLInputElement.h" +#include "HTMLNames.h" +#include "HTMLOptGroupElement.h" +#include "HTMLOptionElement.h" +#include "HTMLSelectElement.h" +#include "HTMLTextAreaElement.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" +#include "PluginView.h" +#include "Range.h" +#include "RenderLayer.h" +#include "RenderMenuList.h" +#include "RenderPart.h" +#include "RenderText.h" +#include "RenderTextControl.h" +#include "RenderWidget.h" +#include "ScopePointer.h" +#include "SelectionHandler.h" +#include "TextIterator.h" +#include "WebPageClient.h" +#include "WebPage_p.h" +#include "WebSettings.h" + +#include <BlackBerryPlatformKeyboardEvent.h> +#include <BlackBerryPlatformMisc.h> +#include <BlackBerryPlatformSettings.h> +#include <imf/events.h> +#include <sys/keycodes.h> + +#define ENABLE_INPUT_LOG 0 +#define ENABLE_FOCUS_LOG 0 + +#if ENABLE_INPUT_LOG +#define InputLog(severity, format, ...) BlackBerry::Platform::logAlways(severity, format, ## __VA_ARGS__) +#else +#define InputLog(severity, format, ...) +#endif // ENABLE_INPUT_LOG + +#if ENABLE_FOCUS_LOG +#define FocusLog(severity, format, ...) BlackBerry::Platform::logAlways(severity, format, ## __VA_ARGS__) +#else +#define FocusLog(severity, format, ...) +#endif // ENABLE_FOCUS_LOG + +static const int MaxLearnTextDataSize = 500; + +using namespace BlackBerry::Platform; +using namespace WebCore; + +namespace BlackBerry { +namespace WebKit { + +class ProcessingChangeGuard { +public: + ProcessingChangeGuard(InputHandler* inputHandler) + : m_inputHandler(inputHandler) + , m_savedProcessingChange(false) + { + ASSERT(m_inputHandler); + + m_savedProcessingChange = m_inputHandler->processingChange(); + m_inputHandler->setProcessingChange(true); + } + + ~ProcessingChangeGuard() + { + m_inputHandler->setProcessingChange(m_savedProcessingChange); + } + +private: + InputHandler* m_inputHandler; + bool m_savedProcessingChange; +}; + +InputHandler::InputHandler(WebPagePrivate* page) + : m_webPage(page) + , m_currentFocusElement(0) + , m_processingChange(false) + , m_navigationMode(false) + , m_currentFocusElementType(TextEdit) + , m_currentFocusElementTextEditMask(DEFAULT_STYLE) + , m_composingTextStart(0) + , m_composingTextEnd(0) +{ +} + +InputHandler::~InputHandler() +{ +} + +static BlackBerryInputType convertInputType(const HTMLInputElement* inputElement) +{ + if (inputElement->isPasswordField()) + return InputTypePassword; + if (inputElement->isSearchField()) + return InputTypeSearch; + if (inputElement->isEmailField()) + return InputTypeEmail; + if (inputElement->isMonthControl()) + return InputTypeMonth; + if (inputElement->isNumberField()) + return InputTypeNumber; + if (inputElement->isTelephoneField()) + return InputTypeTelephone; + if (inputElement->isURLField()) + return InputTypeURL; +#if ENABLE(INPUT_COLOR) + if (inputElement->isColorControl()) + return InputTypeColor; +#endif + if (inputElement->isDateControl()) + return InputTypeDate; + if (inputElement->isDateTimeControl()) + return InputTypeDateTime; + if (inputElement->isDateTimeLocalControl()) + return InputTypeDateTimeLocal; + if (inputElement->isTimeControl()) + return InputTypeTime; + // FIXME: missing WEEK popup selector + + return InputTypeText; +} + +static int inputStyle(BlackBerryInputType type, const Element* element) +{ + switch (type) { + case InputTypeText: + case InputTypeSearch: + { + // Regular input mode, disable help if autocomplete is off. + int imfMask = 0; + if (DOMSupport::elementSupportsAutocomplete(element) == DOMSupport::Off) + imfMask = NO_AUTO_TEXT | NO_PREDICTION; + else if (DOMSupport::elementSupportsAutocomplete(element) != DOMSupport::On + && DOMSupport::elementIdOrNameIndicatesNoAutocomplete(element)) + imfMask = NO_AUTO_TEXT | NO_PREDICTION; + + // Disable autocorrection if it's specifically off, of if it is in default mode + // and we have disabled auto text and prediction. + if (DOMSupport::elementSupportsAutocorrect(element) == DOMSupport::Off + || (imfMask && DOMSupport::elementSupportsAutocorrect(element) == DOMSupport::Default)) + imfMask |= NO_AUTO_CORRECTION; + + if (imfMask) + return imfMask; + break; + } + case InputTypeIsIndex: + case InputTypePassword: + case InputTypeEmail: + case InputTypeNumber: + case InputTypeTelephone: + case InputTypeURL: + // Disable special handling. + return NO_AUTO_TEXT | NO_PREDICTION | NO_AUTO_CORRECTION; + case InputTypeTextArea: + default: + break; + } + return DEFAULT_STYLE; +} + +WTF::String InputHandler::elementText() +{ + if (!isActiveTextEdit()) + return WTF::String(); + + return DOMSupport::inputElementText(m_currentFocusElement.get()); +} + +BlackBerryInputType InputHandler::elementType(Element* element) const +{ + // <isIndex> is bundled with input so we need to check the formControlName + // first to differentiate it from input which is essentially the same as + // isIndex has been deprecated. + if (element->formControlName() == HTMLNames::isindexTag) + return InputTypeIsIndex; + + if (const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(element->toInputElement())) + return convertInputType(inputElement); + + if (element->hasTagName(HTMLNames::textareaTag)) + return InputTypeTextArea; + + // Default to InputTypeTextArea for content editable fields. + return InputTypeTextArea; +} + +void InputHandler::nodeFocused(Node* node) +{ + if (isActiveTextEdit() && m_currentFocusElement == node) { + setNavigationMode(true); + return; + } + + if (node && node->isElementNode()) { + Element* element = static_cast<Element*>(node); + if (DOMSupport::isElementTypePlugin(element)) { + setPluginFocused(element); + return; + } + + if (DOMSupport::isTextBasedContentEditableElement(element)) { + // Focused node is a text based input field, textarea or content editable field. + setElementFocused(element); + return; + } + } + + if (isActiveTextEdit() && m_currentFocusElement->isContentEditable()) { + // This is a special handler for content editable fields. The focus node is the top most + // field that is content editable, however, by enabling / disabling designmode and + // content editable, it is possible through javascript or selection to trigger the focus node to + // change even while maintaining editing on the same selection point. If the focus element + // isn't contentEditable, but the current selection is, don't send a change notification. + + // When processing changes selection changes occur that may reset the focus element + // and could potentially cause a crash as m_currentFocusElement should not be + // changed during processing of an EditorCommand. + if (processingChange()) + return; + + Frame* frame = m_currentFocusElement->document()->frame(); + ASSERT(frame); + + // Test the current selection to make sure that the content in focus is still content + // editable. This may mean Javascript triggered a focus change by modifying the + // top level parent of this object's content editable state without actually modifying + // this particular object. + // Example site: html5demos.com/contentEditable - blur event triggers focus change. + if (frame == m_webPage->focusedOrMainFrame() && frame->selection()->start().anchorNode() + && frame->selection()->start().anchorNode()->isContentEditable()) + return; + } + + // No valid focus element found for handling. + setElementUnfocused(); +} + +void InputHandler::setPluginFocused(Element* element) +{ + ASSERT(DOMSupport::isElementTypePlugin(element)); + + if (isActiveTextEdit()) + setElementUnfocused(); + + m_currentFocusElementType = Plugin; + m_currentFocusElement = element; +} + +static bool convertStringToWchar(const String& string, wchar_t* dest, int destCapacity, int* destLength) +{ + ASSERT(dest); + + if (!string.length()) { + destLength = 0; + return true; + } + + UErrorCode ec = U_ZERO_ERROR; + // wchar_t strings sent to IMF are 32 bit so casting to UChar32 is safe. + u_strToUTF32(reinterpret_cast<UChar32*>(dest), destCapacity, destLength, string.characters(), string.length(), &ec); + if (ec) { + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::convertStringToWchar Error converting string ec (%d).", ec); + destLength = 0; + return false; + } + return true; +} + +static bool convertStringToWcharVector(const String& string, WTF::Vector<wchar_t>& wcharString) +{ + ASSERT(wcharString.isEmpty()); + + int length = string.length(); + if (!length) + return true; + + if (!wcharString.tryReserveCapacity(length + 1)) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelWarn, "InputHandler::convertStringToWcharVector Cannot allocate memory for string.\n"); + return false; + } + + int destLength = 0; + if (!convertStringToWchar(string, wcharString.data(), length + 1, &destLength)) + return false; + + wcharString.resize(destLength); + return true; +} + +static String convertSpannableStringToString(spannable_string_t* src) +{ + if (!src || !src->str || !src->length) + return String(); + + WTF::Vector<UChar> dest; + int destCapacity = (src->length * 2) + 1; + if (!dest.tryReserveCapacity(destCapacity)) { + BlackBerry::Platform::logAlways(BlackBerry::Platform::LogLevelWarn, "InputHandler::convertSpannableStringToString Cannot allocate memory for string.\n"); + return String(); + } + + int destLength = 0; + UErrorCode ec = U_ZERO_ERROR; + // wchar_t strings sent from IMF are 32 bit so casting to UChar32 is safe. + u_strFromUTF32(dest.data(), destCapacity, &destLength, reinterpret_cast<UChar32*>(src->str), src->length, &ec); + if (ec) { + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::convertSpannableStringToString Error converting string ec (%d).", ec); + return String(); + } + dest.resize(destLength); + return String(dest.data(), destLength); +} + +void InputHandler::sendLearnTextDetails(const WTF::String& string) +{ + Vector<wchar_t> wcharString; + if (!convertStringToWcharVector(string, wcharString) || wcharString.isEmpty()) + return; + + m_webPage->m_client->inputLearnText(wcharString.data(), wcharString.size()); +} + +void InputHandler::learnText() +{ + if (!isActiveTextEdit()) + return; + + // Do not send (or calculate) the text when the field is NO_PREDICTION or NO_AUTO_TEXT. + if (m_currentFocusElementTextEditMask & NO_PREDICTION || m_currentFocusElementTextEditMask & NO_AUTO_TEXT) + return; + + String textInField(elementText()); + textInField = textInField.substring(std::max(0, static_cast<int>(textInField.length()) - MaxLearnTextDataSize), textInField.length()); + textInField.remove(0, textInField.find(" ")); + + // Build up the 500 character strings in word chunks. + // Spec says 1000, but memory corruption has been observed. + ASSERT(textInField.length() <= MaxLearnTextDataSize); + + if (textInField.isEmpty()) + return; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::learnText %s", textInField.latin1().data()); + sendLearnTextDetails(textInField); +} + +void InputHandler::setElementUnfocused(bool refocusOccuring) +{ + if (isActiveTextEdit()) { + FocusLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setElementUnfocused"); + + // Pass any text into the field to IMF to learn. + learnText(); + + // End any composition that is in progress. + finishComposition(); + + // Send change notifications. Only cancel navigation mode if we are not + // refocusing to avoid flashing the keyboard when switching between two + // input fields. + setNavigationMode(false, !refocusOccuring); + m_webPage->m_client->inputFocusLost(); + m_webPage->m_selectionHandler->selectionPositionChanged(); + } + + // Clear the node details. + m_currentFocusElement = 0; + m_currentFocusElementType = TextEdit; +} + +bool InputHandler::shouldAcceptInputFocus() +{ + // If the DRT is running, always accept focus. + if (m_webPage->m_dumpRenderTree) + return true; + + if (BlackBerry::Platform::Settings::get()->alwaysShowKeyboardOnFocus()) + return true; + + Frame* mainFrame = m_webPage->m_page->mainFrame(); + Frame* focusedFrame = m_webPage->focusedOrMainFrame(); + if (mainFrame && mainFrame->document() && focusedFrame && focusedFrame->document()) { + // Any user action should be respected. Mouse will be down when touch is + // used to focus. + if (focusedFrame->eventHandler()->mousePressed()) + return true; + + // Make sure the main frame is not still loading. + if (mainFrame->loader()->isLoading()) + return false; + + // Make sure the focused frame is loaded. + if (!focusedFrame->loader()->frameHasLoaded()) + return false; + + // Make sure the focused frame is not processing load events. + return !focusedFrame->document()->processingLoadEvent(); + } + return false; +} + +void InputHandler::setElementFocused(Element* element) +{ + ASSERT(DOMSupport::isTextBasedContentEditableElement(element)); + ASSERT(element->document() && element->document()->frame()); + + if (!shouldAcceptInputFocus()) { + // Remove the focus from this element. + element->blur(); + return; + } + + // Clear the existing focus node details. + setElementUnfocused(true /*refocusOccuring*/); + + // Mark this element as active and add to frame set. + m_currentFocusElement = element; + m_currentFocusElementType = TextEdit; + + // Send details to the client about this element. + BlackBerryInputType type = elementType(element); + m_currentFocusElementTextEditMask = inputStyle(type, element); + + FocusLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d", type, m_currentFocusElementTextEditMask); + + m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask); + m_navigationMode = true; + + handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL()); +} + +bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType type) +{ + if (!element || element->disabled() || !DOMSupport::isDateTimeInputField(element)) + return false; + + if (isActiveTextEdit()) + clearCurrentFocusElement(); + + m_currentFocusElement = element; + m_currentFocusElementType = TextPopup; + + WTF::String value = element->value(); + WTF::String min = element->getAttribute(HTMLNames::minAttr).string(); + WTF::String max = element->getAttribute(HTMLNames::maxAttr).string(); + double step = element->getAttribute(HTMLNames::stepAttr).toDouble(); + m_webPage->m_client->openDateTimePopup(type, value, min, max, step); + return true; +} + +bool InputHandler::openColorPopup(HTMLInputElement* element) +{ + if (!element || element->disabled() || !DOMSupport::isColorInputField(element)) + return false; + + if (isActiveTextEdit()) + clearCurrentFocusElement(); + + m_currentFocusElement = element; + m_currentFocusElementType = TextPopup; + + m_webPage->m_client->openColorPopup(element->value()); + return true; +} + +void InputHandler::setInputValue(const WTF::String& value) +{ + if (!isActiveTextPopup()) + return; + + HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_currentFocusElement.get()); + inputElement->setValue(value); + clearCurrentFocusElement(); +} + +void InputHandler::nodeTextChanged(const Node* node) +{ + if (processingChange() || !node) + return; + + if (node != m_currentFocusElement) + return; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::nodeTextChanged"); + + m_webPage->m_client->inputTextChanged(); + + // Remove the attributed text markers as the previous call triggered an end to + // the composition. + removeAttributedTextMarker(); +} + +void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) +{ + if (!m_currentFocusElement || !m_navigationMode || !m_currentFocusElement->document()) + return; + + if (!BlackBerry::Platform::Settings::get()->allowCenterScrollAdjustmentForInputFields() && scrollType != EdgeIfNeeded) + return; + + Frame* elementFrame = m_currentFocusElement->document()->frame(); + if (!elementFrame) + return; + + Frame* mainFrame = m_webPage->mainFrame(); + if (!mainFrame) + return; + + FrameView* mainFrameView = mainFrame->view(); + if (!mainFrameView) + return; + + WebCore::IntRect selectionFocusRect; + switch (elementFrame->selection()->selectionType()) { + case VisibleSelection::CaretSelection: + selectionFocusRect = elementFrame->selection()->absoluteCaretBounds(); + break; + case VisibleSelection::RangeSelection: { + Position selectionPosition; + if (m_webPage->m_selectionHandler->lastUpdatedEndPointIsValid()) + selectionPosition = elementFrame->selection()->end(); + else + selectionPosition = elementFrame->selection()->start(); + selectionFocusRect = VisiblePosition(selectionPosition).absoluteCaretBounds(); + break; + } + case VisibleSelection::NoSelection: + return; + } + + int fontHeight = selectionFocusRect.height(); + + if (elementFrame != mainFrame) { // Element is in a subframe. + // Remove any scroll offset within the subframe to get the point relative to the main frame. + selectionFocusRect.move(-elementFrame->view()->scrollPosition().x(), -elementFrame->view()->scrollPosition().y()); + + // Adjust the selection rect based on the frame offset in relation to the main frame if it's a subframe. + if (elementFrame->ownerRenderer()) { + WebCore::IntPoint frameOffset = elementFrame->ownerRenderer()->absoluteContentBox().location(); + selectionFocusRect.move(frameOffset.x(), frameOffset.y()); + } + } + + Position start = elementFrame->selection()->start(); + if (start.anchorNode() && start.anchorNode()->renderer()) { + if (RenderLayer* layer = start.anchorNode()->renderer()->enclosingLayer()) { + WebCore::IntRect actualScreenRect = WebCore::IntRect(mainFrameView->scrollPosition(), m_webPage->actualVisibleSize()); + ScrollAlignment horizontalScrollAlignment = ScrollAlignment::alignToEdgeIfNeeded; + ScrollAlignment verticalScrollAlignment = ScrollAlignment::alignToEdgeIfNeeded; + + if (scrollType != EdgeIfNeeded) { + // Align the selection rect if possible so that we show the field's + // outline if the caret is at the edge of the field. + if (RenderObject* focusedRenderer = m_currentFocusElement->renderer()) { + WebCore::IntRect nodeOutlineBounds = focusedRenderer->absoluteOutlineBounds(); + WebCore::IntRect caretAtEdgeRect = rectForCaret(0); + int paddingX = abs(caretAtEdgeRect.x() - nodeOutlineBounds.x()); + int paddingY = abs(caretAtEdgeRect.y() - nodeOutlineBounds.y()); + + if (selectionFocusRect.x() - paddingX == nodeOutlineBounds.x()) + selectionFocusRect.setX(nodeOutlineBounds.x()); + else if (selectionFocusRect.maxX() + paddingX == nodeOutlineBounds.maxX()) + selectionFocusRect.setX(nodeOutlineBounds.maxX() - selectionFocusRect.width()); + if (selectionFocusRect.y() - paddingY == nodeOutlineBounds.y()) + selectionFocusRect.setY(nodeOutlineBounds.y() - selectionFocusRect.height()); + else if (selectionFocusRect.maxY() + paddingY == nodeOutlineBounds.maxY()) + selectionFocusRect.setY(nodeOutlineBounds.maxY() - selectionFocusRect.height()); + + // If the editing point is on the left hand side of the screen when the node's + // rect is edge aligned, edge align the node rect. + if (selectionFocusRect.x() - caretAtEdgeRect.x() < actualScreenRect.width() / 2) + selectionFocusRect.setX(nodeOutlineBounds.x()); + else + horizontalScrollAlignment = ScrollAlignment::alignCenterIfNeeded; + + } + verticalScrollAlignment = (scrollType == CenterAlways) ? ScrollAlignment::alignCenterAlways : ScrollAlignment::alignCenterIfNeeded; + } + + // Pad the rect to improve the visual appearance. + selectionFocusRect.inflate(4 /* padding in pixels */); + WebCore::IntRect revealRect = layer->getRectToExpose(actualScreenRect, selectionFocusRect, + horizontalScrollAlignment, + verticalScrollAlignment); + + mainFrameView->setScrollPosition(revealRect.location()); + } + } + + // If the text is too small, zoom in to make it a minimum size. + static const int s_minimumTextHeightInPixels = 6; + if (fontHeight && fontHeight < s_minimumTextHeightInPixels) + m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, m_webPage->centerOfVisibleContentsRect()); +} + +void InputHandler::ensureFocusPluginElementVisible() +{ + if (!isActivePlugin() || !m_currentFocusElement->document()) + return; + + Frame* elementFrame = m_currentFocusElement->document()->frame(); + if (!elementFrame) + return; + + Frame* mainFrame = m_webPage->mainFrame(); + if (!mainFrame) + return; + + FrameView* mainFrameView = mainFrame->view(); + if (!mainFrameView) + return; + + WebCore::IntRect selectionFocusRect; + + RenderWidget* renderWidget = static_cast<RenderWidget*>(m_currentFocusElement->renderer()); + if (renderWidget) { + PluginView* pluginView = static_cast<PluginView*>(renderWidget->widget()); + + if (pluginView) + selectionFocusRect = pluginView->ensureVisibleRect(); + } + + if (selectionFocusRect.isEmpty()) + return; + + // FIXME: We may need to scroll the subframe (recursively) in the future. Revisit this... + if (elementFrame != mainFrame) { // Element is in a subframe. + // Remove any scroll offset within the subframe to get the point relative to the main frame. + selectionFocusRect.move(-elementFrame->view()->scrollPosition().x(), -elementFrame->view()->scrollPosition().y()); + + // Adjust the selection rect based on the frame offset in relation to the main frame if it's a subframe. + if (elementFrame->ownerRenderer()) { + WebCore::IntPoint frameOffset = elementFrame->ownerRenderer()->absoluteContentBox().location(); + selectionFocusRect.move(frameOffset.x(), frameOffset.y()); + } + } + + WebCore::IntRect actualScreenRect = WebCore::IntRect(mainFrameView->scrollPosition(), m_webPage->actualVisibleSize()); + if (actualScreenRect.contains(selectionFocusRect)) + return; + + // Calculate a point such that the center of the requested rectangle + // is at the center of the screen. FIXME: If the element was partially on screen + // we might want to just bring the offscreen portion into view, someone needs + // to decide if that's the behavior we want or not. + WebCore::IntPoint pos(selectionFocusRect.center().x() - actualScreenRect.width() / 2, + selectionFocusRect.center().y() - actualScreenRect.height() / 2); + + mainFrameView->setScrollPosition(pos); +} + +void InputHandler::ensureFocusElementVisible(bool centerInView) +{ + if (isActivePlugin()) + ensureFocusPluginElementVisible(); + else + ensureFocusTextElementVisible(centerInView ? CenterAlways : CenterIfNeeded); +} + +void InputHandler::frameUnloaded(Frame* frame) +{ + if (!isActiveTextEdit()) + return; + + if (m_currentFocusElement->document()->frame() != frame) + return; + + FocusLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::frameUnloaded"); + + setElementUnfocused(false /*refocusOccuring*/); +} + +void InputHandler::setNavigationMode(bool active, bool sendMessage) +{ + if (active && !isActiveTextEdit()) { + if (!m_navigationMode) + return; + + // We can't be active if there is no element. Send out notification that we + // aren't in navigation mode. + active = false; + } + + // Don't send the change if it's setting the event setting navigationMode true + // if we are already in navigation mode and this is a navigation move event. + // We need to send the event when it's triggered by a touch event or mouse + // event to allow display of the VKB, but do not want to send it when it's + // triggered by a navigation event as it has no effect. + // Touch events are simulated as mouse events so mousePressed will be active + // when it is a re-entry event. + // See RIM Bugs #369 & #878. + if (active && active == m_navigationMode && !m_webPage->m_mainFrame->eventHandler()->mousePressed()) + return; + + m_navigationMode = active; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setNavigationMode %s, %s", active ? "true" : "false", sendMessage ? "message sent" : "message not sent"); + + if (sendMessage) + m_webPage->m_client->inputSetNavigationMode(active); +} + +bool InputHandler::selectionAtStartOfElement() +{ + if (!isActiveTextEdit()) + return false; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + if (!selectionStart()) + return true; + + return false; +} + +bool InputHandler::selectionAtEndOfElement() +{ + if (!isActiveTextEdit()) + return false; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + return selectionStart() == static_cast<int>(elementText().length()); +} + +int InputHandler::selectionStart() const +{ + return selectionPosition(true); +} + +int InputHandler::selectionEnd() const +{ + return selectionPosition(false); +} + +int InputHandler::selectionPosition(bool start) const +{ + if (!m_currentFocusElement->document() || !m_currentFocusElement->document()->frame()) + return 0; + + if (HTMLTextFormControlElement* controlElement = DOMSupport::toTextControlElement(m_currentFocusElement.get())) + return start ? controlElement->selectionStart() : controlElement->selectionEnd(); + + FrameSelection caretSelection; + caretSelection.setSelection(m_currentFocusElement->document()->frame()->selection()->selection()); + RefPtr<Range> rangeSelection = caretSelection.selection().toNormalizedRange(); + if (!rangeSelection) + return 0; + + int selectionPointInNode = start ? rangeSelection->startOffset() : rangeSelection->endOffset(); + Node* containerNode = start ? rangeSelection->startContainer() : rangeSelection->endContainer(); + + ExceptionCode ec; + RefPtr<Range> rangeForNode = rangeOfContents(m_currentFocusElement.get()); + rangeForNode->setEnd(containerNode, selectionPointInNode, ec); + ASSERT(!ec); + + return TextIterator::rangeLength(rangeForNode.get()); +} + +void InputHandler::selectionChanged() +{ + // This method can get called during WebPage shutdown process. + // If that is the case, just bail out since the client is not + // in a safe state of trust to request anything else from it. + if (!m_webPage->m_mainFrame) + return; + + if (!isActiveTextEdit()) + return; + + if (processingChange()) + return; + + // Scroll the field if necessary. This must be done even if we are processing + // a change as the text change may have moved the caret. IMF doesn't require + // the update, but the user needs to see the caret. + ensureFocusTextElementVisible(EdgeIfNeeded); + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + int newSelectionStart = selectionStart(); + int newSelectionEnd = selectionEnd(); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::selectionChanged selectionStart=%u, selectionEnd=%u", newSelectionStart, newSelectionEnd); + + m_webPage->m_client->inputSelectionChanged(newSelectionStart, newSelectionEnd); + + // Remove the attributed text markers as the previous call triggered an end to + // the composition. + removeAttributedTextMarker(); +} + +bool InputHandler::setCursorPosition(int location) +{ + return setSelection(location, location); +} + +bool InputHandler::setSelection(int start, int end, bool changeIsPartOfComposition) +{ + if (!isActiveTextEdit()) + return false; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + ProcessingChangeGuard guard(this); + + VisibleSelection newSelection = DOMSupport::visibleSelectionForRangeInputElement(m_currentFocusElement.get(), start, end); + m_currentFocusElement->document()->frame()->selection()->setSelection(newSelection, changeIsPartOfComposition ? 0 : FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setSelection selectionStart=%u, selectionEnd=%u", start, end); + + return start == selectionStart() && end == selectionEnd(); +} + +WebCore::IntRect InputHandler::rectForCaret(int index) +{ + if (!isActiveTextEdit()) + return WebCore::IntRect(); + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + if (index < 0 || index > elementText().length()) { + // Invalid request. + return WebCore::IntRect(); + } + + FrameSelection caretSelection; + caretSelection.setSelection(DOMSupport::visibleSelectionForRangeInputElement(m_currentFocusElement.get(), index, index).visibleStart()); + caretSelection.modify(FrameSelection::AlterationExtend, DirectionForward, CharacterGranularity); + return caretSelection.selection().visibleStart().absoluteCaretBounds(); +} + +void InputHandler::cancelSelection() +{ + if (!isActiveTextEdit()) + return; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + + int selectionStartPosition = selectionStart(); + ProcessingChangeGuard guard(this); + setCursorPosition(selectionStartPosition); +} + +bool InputHandler::handleKeyboardInput(const BlackBerry::Platform::KeyboardEvent& keyboardEvent, bool changeIsPartOfComposition) +{ + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::handleKeyboardInput received character=%lc, type=%d", keyboardEvent.character(), keyboardEvent.type()); + + // If we aren't specifically part of a composition, fail, IMF should never send key input + // while composing text. If IMF has failed, we should have already finished the + // composition manually. + if (!changeIsPartOfComposition && compositionActive()) + return false; + + ProcessingChangeGuard guard(this); + + unsigned adjustedModifiers = keyboardEvent.modifiers(); + if (WTF::isASCIIUpper(keyboardEvent.character())) + adjustedModifiers |= KEYMOD_SHIFT; + + ASSERT(m_webPage->m_page->focusController()); + bool keyboardEventHandled = false; + if (Frame* focusedFrame = m_webPage->m_page->focusController()->focusedFrame()) { + bool isKeyChar = keyboardEvent.type() == BlackBerry::Platform::KeyboardEvent::KeyChar; + BlackBerry::Platform::KeyboardEvent::Type type = keyboardEvent.type(); + + // If this is a KeyChar type then we handle it as a keydown followed by a key up. + if (isKeyChar) + type = BlackBerry::Platform::KeyboardEvent::KeyDown; + + BlackBerry::Platform::KeyboardEvent adjustedKeyboardEvent(keyboardEvent.character(), type, adjustedModifiers); + keyboardEventHandled = focusedFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(adjustedKeyboardEvent)); + + if (isKeyChar) { + type = BlackBerry::Platform::KeyboardEvent::KeyUp; + adjustedKeyboardEvent = BlackBerry::Platform::KeyboardEvent(keyboardEvent.character(), type, adjustedModifiers); + keyboardEventHandled = focusedFrame->eventHandler()->keyEvent(PlatformKeyboardEvent(adjustedKeyboardEvent)) || keyboardEventHandled; + } + + if (!changeIsPartOfComposition && type == BlackBerry::Platform::KeyboardEvent::KeyUp) + ensureFocusTextElementVisible(EdgeIfNeeded); + } + return keyboardEventHandled; +} + +bool InputHandler::handleNavigationMove(unsigned short character, bool shiftDown, bool altDown, bool canExitField) +{ + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::handleNavigationMove received character=%lc", character); + + bool eventHandled = false; + ASSERT(m_webPage->m_page->focusController()); + if (Frame* focusedFrame = m_webPage->m_page->focusController()->focusedFrame()) { + // If alt is down, do not break out of the field. + if (canExitField && !altDown) { + if ((character == KEYCODE_LEFT || character == KEYCODE_UP) && selectionAtStartOfElement() + || (character == KEYCODE_RIGHT || character == KEYCODE_DOWN) && selectionAtEndOfElement()) { + setNavigationMode(false); + return true; + } + } + + switch (character) { + case KEYCODE_LEFT: + if (altDown && shiftDown) + eventHandled = focusedFrame->editor()->command("MoveToBeginningOfLineAndModifySelection").execute(); + else if (altDown) + eventHandled = focusedFrame->editor()->command("MoveToBeginningOfLine").execute(); + else if (shiftDown) + eventHandled = focusedFrame->editor()->command("MoveLeftAndModifySelection").execute(); + else + eventHandled = focusedFrame->editor()->command("MoveLeft").execute(); + break; + case KEYCODE_RIGHT: + if (altDown && shiftDown) + eventHandled = focusedFrame->editor()->command("MoveToEndOfLineAndModifySelection").execute(); + else if (altDown) + eventHandled = focusedFrame->editor()->command("MoveToEndOfLine").execute(); + else if (shiftDown) + eventHandled = focusedFrame->editor()->command("MoveRightAndModifySelection").execute(); + else + eventHandled = focusedFrame->editor()->command("MoveRight").execute(); + break; + case KEYCODE_UP: + if (altDown && shiftDown) + eventHandled = focusedFrame->editor()->command("MoveToBeginningOfDocumentAndModifySelection").execute(); + else if (altDown) + eventHandled = focusedFrame->editor()->command("MoveToBeginningOfDocument").execute(); + else if (shiftDown) + eventHandled = focusedFrame->editor()->command("MoveUpAndModifySelection").execute(); + else + eventHandled = focusedFrame->editor()->command("MoveUp").execute(); + break; + case KEYCODE_DOWN: + if (altDown && shiftDown) + eventHandled = focusedFrame->editor()->command("MoveToEndOfDocumentAndModifySelection").execute(); + else if (altDown) + eventHandled = focusedFrame->editor()->command("MoveToEndOfDocument").execute(); + else if (shiftDown) + eventHandled = focusedFrame->editor()->command("MoveDownAndModifySelection").execute(); + else + eventHandled = focusedFrame->editor()->command("MoveDown").execute(); + break; + } + } + return eventHandled; +} + +bool InputHandler::deleteSelection() +{ + if (!isActiveTextEdit()) + return false; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + Frame* frame = m_currentFocusElement->document()->frame(); + + if (frame->selection()->selectionType() != VisibleSelection::RangeSelection) + return false; + + ASSERT(frame->editor()); + return frame->editor()->command("DeleteBackward").execute(); +} + +void InputHandler::insertText(const WTF::String& string) +{ + if (!isActiveTextEdit()) + return; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame() && m_currentFocusElement->document()->frame()->editor()); + Editor* editor = m_currentFocusElement->document()->frame()->editor(); + + editor->command("InsertText").execute(string); +} + +void InputHandler::clearField() +{ + if (!isActiveTextEdit()) + return; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame() && m_currentFocusElement->document()->frame()->editor()); + Editor* editor = m_currentFocusElement->document()->frame()->editor(); + + editor->command("SelectAll").execute(); + editor->command("DeleteBackward").execute(); +} + +bool InputHandler::executeTextEditCommand(const WTF::String& commandName) +{ + ASSERT(m_webPage->focusedOrMainFrame() && m_webPage->focusedOrMainFrame()->editor()); + Editor* editor = m_webPage->focusedOrMainFrame()->editor(); + + return editor->command(commandName).execute(); +} + +void InputHandler::cut() +{ + executeTextEditCommand("Cut"); +} + +void InputHandler::copy() +{ + executeTextEditCommand("Copy"); +} + +void InputHandler::paste() +{ + executeTextEditCommand("Paste"); +} + +void InputHandler::addAttributedTextMarker(int start, int end, const AttributeTextStyle& style) +{ + if ((end - start) < 1 || end > static_cast<int>(elementText().length())) + return; + + RefPtr<Range> markerRange = DOMSupport::visibleSelectionForRangeInputElement(m_currentFocusElement.get(), start, end).toNormalizedRange(); + m_currentFocusElement->document()->markers()->addMarker(markerRange.get(), DocumentMarker::AttributeText, WTF::String("Input Marker"), style); +} + +void InputHandler::removeAttributedTextMarker() +{ + // Remove all attribute text markers. + if (m_currentFocusElement && m_currentFocusElement->document()) + m_currentFocusElement->document()->markers()->removeMarkers(DocumentMarker::AttributeText); + + m_composingTextStart = 0; + m_composingTextEnd = 0; +} + +void InputHandler::handleInputLocaleChanged(bool isRTL) +{ + if (!isActiveTextEdit()) + return; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + RenderObject* renderer = m_currentFocusElement->renderer(); + if (!renderer) + return; + + Editor* editor = m_currentFocusElement->document()->frame()->editor(); + ASSERT(editor); + if ((renderer->style()->direction() == RTL) != isRTL) + editor->setBaseWritingDirection(isRTL ? RightToLeftWritingDirection : LeftToRightWritingDirection); +} + +void InputHandler::clearCurrentFocusElement() +{ + if (m_currentFocusElement) + m_currentFocusElement->blur(); +} + +bool InputHandler::willOpenPopupForNode(Node* node) +{ + // This method must be kept synchronized with InputHandler::didNodeOpenPopup. + if (!node) + return false; + + ASSERT(!node->isInShadowTree()); + + if (node->hasTagName(HTMLNames::selectTag) || node->hasTagName(HTMLNames::optionTag)) { + // We open list popups for options and selects. + return true; + } + + if (node->isElementNode()) { + Element* element = static_cast<Element*>(node); + if (DOMSupport::isPopupInputField(element)) + return true; + } + + return false; +} + +bool InputHandler::didNodeOpenPopup(Node* node) +{ + // This method must be kept synchronized with InputHandler::willOpenPopupForNode. + if (!node) + return false; + + ASSERT(!node->isInShadowTree()); + + if (node->hasTagName(HTMLNames::selectTag)) + return openSelectPopup(static_cast<HTMLSelectElement*>(node)); + + if (node->hasTagName(HTMLNames::optionTag)) { + HTMLOptionElement* optionElement = static_cast<HTMLOptionElement*>(node); + return openSelectPopup(optionElement->ownerSelectElement()); + } + + if (HTMLInputElement* element = node->toInputElement()) { + if (DOMSupport::isDateTimeInputField(element)) + return openDatePopup(element, elementType(element)); + + if (DOMSupport::isColorInputField(element)) + return openColorPopup(element); + } + return false; +} + +bool InputHandler::openSelectPopup(HTMLSelectElement* select) +{ + if (!select || select->disabled()) + return false; + + if (isActiveTextEdit()) + clearCurrentFocusElement(); + + m_currentFocusElement = select; + m_currentFocusElementType = SelectPopup; + const WTF::Vector<HTMLElement*>& listItems = select->listItems(); + int size = listItems.size(); + if (!size) { + ScopeArray<WebString> labels; + bool* enableds = 0; + int* itemTypes = 0; + bool* selecteds = 0; + m_webPage->m_client->openPopupList(false, size, labels, enableds, itemTypes, selecteds); + return true; + } + + bool multiple = select->multiple(); + + ScopeArray<WebString> labels; + labels.reset(new WebString[size]); + bool* enableds = new bool[size]; + int* itemTypes = new int[size]; + bool* selecteds = new bool[size]; + + for (int i = 0; i < size; i++) { + if (listItems[i]->hasTagName(HTMLNames::optionTag)) { + HTMLOptionElement* option = static_cast<HTMLOptionElement*>(listItems[i]); + labels[i] = option->textIndentedToRespectGroupLabel(); + enableds[i] = option->disabled() ? 0 : 1; + selecteds[i] = option->selected(); + itemTypes[i] = TypeOption; + } else if (listItems[i]->hasTagName(HTMLNames::optgroupTag)) { + HTMLOptGroupElement* optGroup = static_cast<HTMLOptGroupElement*>(listItems[i]); + labels[i] = optGroup->groupLabelText(); + enableds[i] = optGroup->disabled() ? 0 : 1; + selecteds[i] = false; + itemTypes[i] = TypeGroup; + } else if (listItems[i]->hasTagName(HTMLNames::hrTag)) { + enableds[i] = false; + selecteds[i] = false; + itemTypes[i] = TypeSeparator; + } + } + + m_webPage->m_client->openPopupList(multiple, size, labels, enableds, itemTypes, selecteds); + return true; +} + +void InputHandler::setPopupListIndex(int index) +{ + if (index == -2) // Abandon + return clearCurrentFocusElement(); + + if (!isActiveSelectPopup()) + return clearCurrentFocusElement(); + + RenderObject* renderer = m_currentFocusElement->renderer(); + if (renderer && renderer->isMenuList()) { + RenderMenuList* renderMenu = toRenderMenuList(renderer); + renderMenu->hidePopup(); + } + + HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_currentFocusElement.get()); + int optionIndex = selectElement->listToOptionIndex(index); + selectElement->optionSelectedByUser(optionIndex, true /* deselect = true */, true /* fireOnChangeNow = false */); + clearCurrentFocusElement(); +} + +void InputHandler::setPopupListIndexes(int size, bool* selecteds) +{ + if (!isActiveSelectPopup()) + return clearCurrentFocusElement(); + + if (size < 0) + return; + + HTMLSelectElement* selectElement = static_cast<HTMLSelectElement*>(m_currentFocusElement.get()); + const WTF::Vector<HTMLElement*>& items = selectElement->listItems(); + if (items.size() != static_cast<unsigned int>(size)) + return; + + HTMLOptionElement* option; + for (int i = 0; i < size; i++) { + if (items[i]->hasTagName(HTMLNames::optionTag)) { + option = static_cast<HTMLOptionElement*>(items[i]); + option->setSelectedState(selecteds[i]); + } + } + + // Force repaint because we do not send mouse events to the select element + // and the element doesn't automatically repaint itself. + selectElement->dispatchFormControlChangeEvent(); + selectElement->renderer()->repaint(); + clearCurrentFocusElement(); +} + +bool InputHandler::setBatchEditingActive(bool active) +{ + if (!isActiveTextEdit()) + return false; + + ASSERT(m_currentFocusElement->document()); + ASSERT(m_currentFocusElement->document()->frame()); + + // FIXME switch this to m_currentFocusElement->document()->frame() when we have separate + // backingstore for each frame. + BackingStoreClient* backingStoreClientForFrame = m_webPage->backingStoreClientForFrame(m_webPage->mainFrame()); + ASSERT(backingStoreClientForFrame); + + // Enable / Disable the backingstore to prevent visual updates. + if (!active) + backingStoreClientForFrame->backingStore()->resumeScreenAndBackingStoreUpdates(BackingStore::RenderAndBlit); + else + backingStoreClientForFrame->backingStore()->suspendScreenAndBackingStoreUpdates(); + + return true; +} + +int InputHandler::caretPosition() const +{ + if (!isActiveTextEdit()) + return -1; + + // NOTE: This function is expected to return the start of the selection if + // a selection is applied. + return selectionStart(); +} + +int relativeLeftOffset(int caretPosition, int leftOffset) +{ + ASSERT(caretPosition >= 0); + + return std::max(0, caretPosition - leftOffset); +} + +int relativeRightOffset(int caretPosition, unsigned totalLengthOfText, int rightOffset) +{ + ASSERT(caretPosition >= 0); + ASSERT(totalLengthOfText < INT_MAX); + + return std::min(caretPosition + rightOffset, static_cast<int>(totalLengthOfText)); +} + +bool InputHandler::deleteTextRelativeToCursor(int leftOffset, int rightOffset) +{ + if (!isActiveTextEdit() || compositionActive()) + return false; + + ProcessingChangeGuard guard(this); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::deleteTextRelativeToCursor left %d right %d", leftOffset, rightOffset); + + int caretOffset = caretPosition(); + int start = relativeLeftOffset(caretOffset, leftOffset); + int end = relativeRightOffset(caretOffset, elementText().length(), rightOffset); + if (!deleteText(start, end)) + return false; + + // Scroll the field if necessary. The automatic update is suppressed + // by the processing change guard. + ensureFocusTextElementVisible(EdgeIfNeeded); + + return true; +} + +bool InputHandler::deleteText(int start, int end) +{ + if (!isActiveTextEdit()) + return false; + + ProcessingChangeGuard guard(this); + + if (!setSelection(start, end, true /*changeIsPartOfComposition*/)) + return false; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::deleteText start %d end %d", start, end); + + return deleteSelection(); +} + +spannable_string_t* InputHandler::spannableTextInRange(int start, int end, int32_t flags) +{ + if (!isActiveTextEdit()) + return 0; + + if (start == end) + return 0; + + ASSERT(end > start); + int length = end - start; + + WTF::String textString = elementText().substring(start, length); + + spannable_string_t* pst = (spannable_string_t*)malloc(sizeof(spannable_string_t)); + if (!pst) { + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::spannableTextInRange error allocating spannable string."); + return 0; + } + + pst->str = (wchar_t*)malloc(sizeof(wchar_t) * (length + 1)); + if (!pst->str) { + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::spannableTextInRange Cannot allocate memory for string.\n"); + free(pst); + return 0; + } + + int stringLength = 0; + if (!convertStringToWchar(textString, pst->str, length + 1, &stringLength)) { + free(pst->str); + free(pst); + return 0; + } + + pst->length = stringLength; + pst->spans_count = 0; + pst->spans = 0; + return pst; +} + +spannable_string_t* InputHandler::selectedText(int32_t flags) +{ + if (!isActiveTextEdit()) + return 0; + + return spannableTextInRange(selectionStart(), selectionEnd(), flags); +} + +spannable_string_t* InputHandler::textBeforeCursor(int32_t length, int32_t flags) +{ + if (!isActiveTextEdit()) + return 0; + + int caretOffset = caretPosition(); + int start = relativeLeftOffset(caretOffset, length); + int end = caretOffset; + + return spannableTextInRange(start, end, flags); +} + +spannable_string_t* InputHandler::textAfterCursor(int32_t length, int32_t flags) +{ + if (!isActiveTextEdit()) + return 0; + + int caretOffset = caretPosition(); + int start = caretOffset; + int end = relativeRightOffset(caretOffset, elementText().length(), length); + + return spannableTextInRange(start, end, flags); +} + +extracted_text_t* InputHandler::extractedTextRequest(extracted_text_request_t* request, int32_t flags) +{ + if (!isActiveTextEdit()) + return 0; + + extracted_text_t* extractedText = (extracted_text_t *)malloc(sizeof(extracted_text_t)); + + // 'flags' indicates whether the text is being monitored. This is not currently used. + + // FIXME add smart limiting based on the hint sizes. Currently return all text. + + extractedText->text = spannableTextInRange(0, elementText().length(), flags); + + // FIXME confirm these should be 0 on this requested. Text changes will likely require + // the end be the length. + extractedText->partial_start_offset = 0; + extractedText->partial_end_offset = 0; + extractedText->start_offset = 0; + + // Adjust selection values relative to the start offset, which may be a subset + // of the text in the field. + extractedText->selection_start = selectionStart() - extractedText->start_offset; + extractedText->selection_end = selectionEnd() - extractedText->start_offset; + + // selectionActive is not limited to inside the extracted text. + bool selectionActive = extractedText->selection_start != extractedText->selection_end; + bool singleLine = m_currentFocusElement->hasTagName(HTMLNames::inputTag); + + // FIXME flags has two values in doc, enum not in header yet. + extractedText->flags = selectionActive & singleLine; + + return extractedText; +} + +static void addCompositionTextStyleToAttributeTextStyle(AttributeTextStyle& style) +{ + style.setUnderline(AttributeTextStyle::StandardUnderline); +} + +static void addActiveTextStyleToAttributeTextStyle(AttributeTextStyle& style) +{ + style.setBackgroundColor(Color("blue")); + style.setTextColor(Color("white")); +} + +static AttributeTextStyle compositionTextStyle() +{ + AttributeTextStyle style; + addCompositionTextStyleToAttributeTextStyle(style); + return style; +} + +static AttributeTextStyle textStyleFromMask(int64_t mask) +{ + AttributeTextStyle style; + if (mask & COMPOSED_TEXT_ATTRIB) + addCompositionTextStyleToAttributeTextStyle(style); + + if (mask & ACTIVE_REGION_ATTRIB) + addActiveTextStyleToAttributeTextStyle(style); + + return style; +} + +bool InputHandler::removeComposedText() +{ + if (compositionActive()) { + if (!deleteText(m_composingTextStart, m_composingTextEnd)) { + // Could not remove the existing composition region. + return false; + } + removeAttributedTextMarker(); + } + + return true; +} + +int32_t InputHandler::setComposingRegion(int32_t start, int32_t end) +{ + if (!isActiveTextEdit()) + return -1; + + if (!removeComposedText()) { + // Could not remove the existing composition region. + return -1; + } + + m_composingTextStart = start; + m_composingTextEnd = end; + + if (compositionActive()) + addAttributedTextMarker(start, end, compositionTextStyle()); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setComposingRegion start %d end %d", start, end); + + return 0; +} + +int32_t InputHandler::finishComposition() +{ + if (!isActiveTextEdit()) + return -1; + + // FIXME if no composition is active, should we return failure -1? + if (!compositionActive()) + return 0; + + // Remove all markers. + removeAttributedTextMarker(); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::finishComposition completed"); + + return 0; +} + +span_t* InputHandler::firstSpanInString(spannable_string_t* spannableString, SpannableStringAttribute attrib) +{ + span_t* span = spannableString->spans; + for (unsigned int i = 0; i < spannableString->spans_count; i++) { + if (span->attributes_mask & attrib) + return span; + span++; + } + + return 0; +} + +bool InputHandler::isTrailingSingleCharacter(span_t* span, unsigned stringLength, unsigned composingTextLength) +{ + // Make sure the new string is one character larger than the old. + if (composingTextLength != stringLength - 1) + return false; + + if (!span) + return false; + + // Has only 1 character changed? + if (span->start == span->end) { + // Is this character the last character in the string? + if (span->start == stringLength - 1) + return true; + } + // Return after the first changed_attrib is found. + return false; +} + +bool InputHandler::setText(spannable_string_t* spannableString) +{ + if (!isActiveTextEdit() || !spannableString) + return false; + + ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); + Frame* frame = m_currentFocusElement->document()->frame(); + + Editor* editor = frame->editor(); + ASSERT(editor); + + // Disable selectionHandler's active selection as we will be resetting and these + // changes should not be handled as notification event. + m_webPage->m_selectionHandler->setSelectionActive(false); + + String textToInsert = convertSpannableStringToString(spannableString); + int textLength = textToInsert.length(); + + span_t* changedSpan = firstSpanInString(spannableString, CHANGED_ATTRIB); + int composingTextStart = m_composingTextStart; + int composingTextEnd = m_composingTextEnd; + int composingTextLength = compositionLength(); + removeAttributedTextMarker(); + + if (isTrailingSingleCharacter(changedSpan, textLength, composingTextLength)) { + // Handle the case where text is being composed. + if (firstSpanInString(spannableString, COMPOSED_TEXT_ATTRIB)) + return editor->command("InsertText").execute(textToInsert.right(1)); + return handleKeyboardInput(BlackBerry::Platform::KeyboardEvent(textToInsert[textLength - 1], BlackBerry::Platform::KeyboardEvent::KeyChar, 0), false /* changeIsPartOfComposition */); + } + + // If no spans have changed, treat it as a delete operation. + if (!changedSpan) { + // If the composition length is the same as our string length, then we don't need to do anything. + if (composingTextLength == textLength) + return true; + + if (composingTextLength - textLength == 1) + return editor->command("DeleteBackward").execute(); + } + + if (composingTextLength && !setSelection(composingTextStart, composingTextEnd, true /* changeIsPartOfComposition */)) + return false; + + // If there is no text to add just delete. + if (!textLength) { + if (selectionActive()) + return editor->command("DeleteBackward").execute(); + + // Nothing to do. + return true; + } + + InputLog(BlackBerry::Platform::LogLevelInfo, "setText spannableString is %s, %d \n", textToInsert.latin1().data(), textLength); + + // Triggering an insert of the text with a space character trailing + // causes new text to adopt the previous text style. + // Remove it and apply it as a keypress later. + // Upstream Webkit bug created https://bugs.webkit.org/show_bug.cgi?id=70823 + bool requiresSpaceKeyPress = false; + if (textLength > 0 && textToInsert[textLength - 1] == 32 /* space */) { + requiresSpaceKeyPress = true; + textLength--; + textToInsert.remove(textLength, 1); + } + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setText Request being processed Text before %s", elementText().latin1().data()); + + if (textLength == 1 && !spannableString->spans_count) { + // Handle single key non-attributed entry as key press rather than insert to allow + // triggering of javascript events. + + return handleKeyboardInput(BlackBerry::Platform::KeyboardEvent(textToInsert[0], BlackBerry::Platform::KeyboardEvent::KeyChar, 0), true /* changeIsPartOfComposition */); + } + + // Perform the text change as a single command if there is one. + if (!textToInsert.isEmpty() && !editor->command("InsertText").execute(textToInsert)) { + InputLog(BlackBerry::Platform::LogLevelWarn, "InputHandler::setText Failed to insert text %s", textToInsert.latin1().data()); + return false; + } + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setText Request being processed Text after insert %s", elementText().latin1().data()); + + if (requiresSpaceKeyPress) + handleKeyboardInput(BlackBerry::Platform::KeyboardEvent(32 /* space */, BlackBerry::Platform::KeyboardEvent::KeyChar, 0), true /* changeIsPartOfComposition */); + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setText Text after %s", elementText().latin1().data()); + + return true; +} + +bool InputHandler::setTextAttributes(int insertionPoint, spannable_string_t* spannableString) +{ + // Apply the attributes to the field. + span_t* span = spannableString->spans; + for (unsigned int i = 0; i < spannableString->spans_count; i++) { + unsigned int startPosition = insertionPoint + span->start; + // The end point includes the character that it is before. Ie, 0, 0 + // applies to the first character as the end point includes the character + // at the position. This means the endPosition is always +1. + unsigned int endPosition = insertionPoint + span->end + 1; + if (endPosition < startPosition || endPosition > elementText().length()) + return false; + + if (!span->attributes_mask) + continue; // Nothing to do. + + // MISSPELLED_WORD_ATTRIB is present as an option, but it is not currently + // used by IMF. When they add support for on the fly spell checking we can + // use it to apply spelling markers and disable continuous spell checking. + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setTextAttributes adding marker %d to %d - %d", startPosition, endPosition, span->attributes_mask); + addAttributedTextMarker(startPosition, endPosition, textStyleFromMask(span->attributes_mask)); + + span++; + } + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setTextAttributes attribute count %d", spannableString->spans_count); + + return true; +} + +bool InputHandler::setRelativeCursorPosition(int insertionPoint, int relativeCursorPosition) +{ + if (!isActiveTextEdit()) + return false; + + // 1 place cursor at end of insertion text. + if (relativeCursorPosition == 1) { + m_currentFocusElement->document()->frame()->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded); + return true; + } + + int cursorPosition = 0; + if (relativeCursorPosition <= 0) { + // Zero = insertionPoint + // Negative value, move the cursor the requested number of characters before + // the start of the inserted text. + cursorPosition = insertionPoint + relativeCursorPosition; + } else { + // Positive value, move the cursor the requested number of characters after + // the end of the inserted text minus 1. + cursorPosition = caretPosition() + relativeCursorPosition - 1; + } + + if (cursorPosition < 0 || cursorPosition > (int)elementText().length()) + return false; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setRelativeCursorPosition cursor position %d", cursorPosition); + + return setCursorPosition(cursorPosition); +} + +bool InputHandler::setSpannableTextAndRelativeCursor(spannable_string_t* spannableString, int relativeCursorPosition, bool markTextAsComposing) +{ + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setSpannableTextAndRelativeCursor(%d, %d, %d)\n", spannableString->length, relativeCursorPosition, markTextAsComposing); + int insertionPoint = compositionActive() ? m_composingTextStart : selectionStart(); + + ProcessingChangeGuard guard(this); + + if (!setText(spannableString)) + return false; + + if (!setTextAttributes(insertionPoint, spannableString)) + return false; + + if (!setRelativeCursorPosition(insertionPoint, relativeCursorPosition)) + return false; + + if (markTextAsComposing) { + m_composingTextStart = insertionPoint; + m_composingTextEnd = insertionPoint + spannableString->length; + } + + // Scroll the field if necessary. The automatic update is suppressed + // by the processing change guard. + ensureFocusTextElementVisible(EdgeIfNeeded); + + return true; +} + +int32_t InputHandler::setComposingText(spannable_string_t* spannableString, int32_t relativeCursorPosition) +{ + if (!isActiveTextEdit()) + return -1; + + if (!spannableString) + return -1; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::setComposingText at relativeCursorPosition: %d", relativeCursorPosition); + + return setSpannableTextAndRelativeCursor(spannableString, relativeCursorPosition, true /* markTextAsComposing */) ? 0 : -1; +} + +int32_t InputHandler::commitText(spannable_string_t* spannableString, int32_t relativeCursorPosition) +{ + if (!isActiveTextEdit()) + return -1; + + if (!spannableString) + return -1; + + InputLog(BlackBerry::Platform::LogLevelInfo, "InputHandler::commitText"); + + return setSpannableTextAndRelativeCursor(spannableString, relativeCursorPosition, false /* markTextAsComposing */) ? 0 : -1; +} + +} +} diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.h b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h new file mode 100644 index 000000000..ba7eb3e7b --- /dev/null +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.h @@ -0,0 +1,189 @@ +/* + * Copyright (C) 2009, 2010, 2011, 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef InputHandler_h +#define InputHandler_h + +#include <BlackBerryPlatformInputEvents.h> + +#include <imf/input_data.h> + +#include <wtf/RefPtr.h> + +namespace WTF { +class String; +} + +namespace WebCore { +class AttributeTextStyle; +class Element; +class Frame; +class HTMLInputElement; +class HTMLSelectElement; +class IntRect; +class Node; +} + +namespace BlackBerry { + +namespace Platform { +class KeyboardEvent; +} + +namespace WebKit { + +class WebPagePrivate; + +class InputHandler { +public: + InputHandler(WebPagePrivate*); + ~InputHandler(); + + enum FocusElementType { TextEdit, TextPopup /* Date/Time & Color */, SelectPopup, Plugin }; + enum CaretScrollType { CenterAlways, CenterIfNeeded, EdgeIfNeeded }; + + void nodeFocused(WebCore::Node*); + void nodeTextChanged(const WebCore::Node*); + void selectionChanged(); + void frameUnloaded(WebCore::Frame*); + + bool handleKeyboardInput(const BlackBerry::Platform::KeyboardEvent&, bool changeIsPartOfComposition = false); + bool handleNavigationMove(const unsigned short character, bool shiftDown, bool altDown, bool canExitField = true); + + bool deleteSelection(); + void insertText(const WTF::String&); + void clearField(); + + void cut(); + void copy(); + void paste(); + + void cancelSelection(); + + void setInputValue(const WTF::String&); + + bool isInputMode() const { return isActiveTextEdit(); } + bool isMultilineInputMode() const { return isActiveTextEdit() && elementType(m_currentFocusElement.get()) == BlackBerry::Platform::InputTypeTextArea; } + + void setNavigationMode(bool active, bool sendMessage = true); + + void ensureFocusElementVisible(bool centerFieldInDisplay = true); + void handleInputLocaleChanged(bool isRTL); + + // PopupMenu methods. + bool willOpenPopupForNode(WebCore::Node*); + bool didNodeOpenPopup(WebCore::Node*); + bool openLineInputPopup(WebCore::HTMLInputElement*); + bool openSelectPopup(WebCore::HTMLSelectElement*); + void setPopupListIndex(int); + void setPopupListIndexes(int size, bool* selecteds); + + bool processingChange() const { return m_processingChange; } + void setProcessingChange(bool processingChange) { m_processingChange = processingChange; } + + WTF::String elementText(); + + // IMF driven calls. + bool setBatchEditingActive(bool); + bool setSelection(int start, int end, bool changeIsPartOfComposition = false); + int caretPosition() const; + bool deleteTextRelativeToCursor(int leftOffset, int rightOffset); + + spannable_string_t* selectedText(int32_t flags); + spannable_string_t* textBeforeCursor(int32_t length, int32_t flags); + spannable_string_t* textAfterCursor(int32_t length, int32_t flags); + extracted_text_t* extractedTextRequest(extracted_text_request_t*, int32_t flags); + + int32_t setComposingRegion(int32_t start, int32_t end); + int32_t finishComposition(); + int32_t setComposingText(spannable_string_t*, int32_t relativeCursorPosition); + int32_t commitText(spannable_string_t*, int32_t relativeCursorPosition); + + bool shouldAcceptInputFocus(); + +private: + void setElementFocused(WebCore::Element*); + void setPluginFocused(WebCore::Element*); + void setElementUnfocused(bool refocusOccuring = false); + + void ensureFocusTextElementVisible(CaretScrollType = CenterAlways); + void ensureFocusPluginElementVisible(); + + void clearCurrentFocusElement(); + + bool selectionAtStartOfElement(); + bool selectionAtEndOfElement(); + + WebCore::IntRect rectForCaret(int index); + + bool isActiveTextEdit() const { return m_currentFocusElement && m_currentFocusElementType == TextEdit; } + bool isActiveTextPopup() const { return m_currentFocusElement && m_currentFocusElementType == TextPopup; } + bool isActiveSelectPopup() const { return m_currentFocusElement && m_currentFocusElementType == SelectPopup; } + bool isActivePlugin() const { return m_currentFocusElement && m_currentFocusElementType == Plugin; } + + bool openDatePopup(WebCore::HTMLInputElement*, BlackBerry::Platform::BlackBerryInputType); + bool openColorPopup(WebCore::HTMLInputElement*); + + bool executeTextEditCommand(const WTF::String&); + + BlackBerry::Platform::BlackBerryInputType elementType(WebCore::Element*) const; + + int selectionStart() const; + int selectionEnd() const; + int selectionPosition(bool start) const; + bool selectionActive() const { return selectionStart() != selectionEnd(); } + + bool compositionActive() const { return compositionLength(); } + unsigned compositionLength() const { return m_composingTextEnd - m_composingTextStart; } + + spannable_string_t* spannableTextInRange(int start, int end, int32_t flags); + + void addAttributedTextMarker(int start, int end, const WebCore::AttributeTextStyle&); + void removeAttributedTextMarker(); + + bool deleteText(int start, int end); + bool setTextAttributes(int insertionPoint, spannable_string_t*); + bool setText(spannable_string_t*); + bool setSpannableTextAndRelativeCursor(spannable_string_t*, int relativeCursorPosition, bool markTextAsComposing); + bool removeComposedText(); + bool setRelativeCursorPosition(int insertionPoint, int relativeCursorPosition); + bool setCursorPosition(int location); + + span_t* firstSpanInString(spannable_string_t*, SpannableStringAttribute); + bool isTrailingSingleCharacter(span_t*, unsigned, unsigned); + + void learnText(); + void sendLearnTextDetails(const WTF::String&); + + WebPagePrivate* m_webPage; + + RefPtr<WebCore::Element> m_currentFocusElement; + + bool m_processingChange; + bool m_navigationMode; + FocusElementType m_currentFocusElementType; + int m_currentFocusElementTextEditMask; + + int m_composingTextStart; + int m_composingTextEnd; +}; + +} +} + +#endif // InputHandler_h diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index c47d6aed7..c3837d1cf 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,637 @@ +2012-02-08 Raymond Liu <raymond.liu@intel.com> + + Fix a typo for r107125 + https://bugs.webkit.org/show_bug.cgi?id=77804 + + Reviewed by James Robinson. + + * tests/WebCompositorInputHandlerImplTest.cpp: + +2012-02-08 David Reveman <reveman@chromium.org> + + [Chromium] Avoid unnecessary full tile updates without breaking atomicity of commits. + https://bugs.webkit.org/show_bug.cgi?id=76740 + + Reviewed by James Robinson. + + Add CCLayerTreeHostTestAtomicCommitWithPartialUpdate and + TiledLayerChromiumTest.partialUpdates tests that verifies + atomicity of commits with partial updates. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestAtomicCommit::CCLayerTreeHostTestAtomicCommit): + (WTF::CCLayerTreeHostTestAtomicCommit::beginTest): + (WTF::CCLayerTreeHostTestAtomicCommit::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommit::layout): + (CCLayerTreeHostTestAtomicCommit): + (CCLayerTreeHostTestAtomicCommitWithPartialUpdate): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::CCLayerTreeHostTestAtomicCommitWithPartialUpdate): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::beginTest): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::commitCompleteOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::drawLayersOnCCThread): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::layout): + (WTF::CCLayerTreeHostTestAtomicCommitWithPartialUpdate::afterTest): + (WTF): + (WTF::TEST_F): + * tests/TiledLayerChromiumTest.cpp: + (WTF::FakeLayerTextureUpdater::Texture::Texture): + (WTF::FakeLayerTextureUpdater::Texture::updateRect): + (Texture): + (WTF::FakeLayerTextureUpdater::FakeLayerTextureUpdater): + (FakeLayerTextureUpdater): + (WTF::FakeLayerTextureUpdater::updateCount): + (WTF::FakeLayerTextureUpdater::clearUpdateCount): + (WTF::FakeLayerTextureUpdater::updateRect): + (WTF::FakeLayerTextureUpdater::createTexture): + (FakeTiledLayerChromium): + (WTF::TEST): + (WTF): + +2012-02-07 MORITA Hajime <morrita@google.com> + + Replacement text should be available from the marker. + https://bugs.webkit.org/show_bug.cgi?id=77934 + + didFinishCheckingText() accidentally dropped the description text + given from the backend. Fixed to copy it on the API-to-Core + convertion. The test won't work without this fix. + + Reviewed by Kent Tamura. + + * src/WebTextCheckingCompletionImpl.cpp: + (WebKit::toCoreResults): + +2012-02-08 Dmitry Lomov <dslomov@chromium.org> + + [V8][Chromium] Race between worker accessing WebDatabase and frame closing down. + https://bugs.webkit.org/show_bug.cgi?id=78150 + Handle case when the frame is shut down under us gracefully. + + Reviewed by David Levin. + + * src/DatabaseObserver.cpp: + (WebCore::DatabaseObserver::canEstablishDatabase): Handle WebWorkerBase::view returning 0. + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::openFromWorker): Handle WebWorkerBase::view returning 0. + * src/WebWorkerClientImpl.cpp: + (WebKit::WebWorkerClientImpl::allowFileSystem): + (WebKit::WebWorkerClientImpl::allowDatabase): + (WebKit::WebWorkerClientImpl::view): + +2012-02-08 Adam Klein <adamk@chromium.org> + + DOM mutations should not be delivered on worker threads + https://bugs.webkit.org/show_bug.cgi?id=77898 + + Reviewed by Dmitry Titov. + + * src/WebDevToolsFrontendImpl.cpp: + (WebKit::WebDevToolsFrontendImpl::dispatchOnInspectorFrontend): + +2012-02-08 Scott Graham <scottmg@chromium.org> + + Roll Chromium DEPS + https://bugs.webkit.org/show_bug.cgi?id=78152 + + Reviewed by Adam Barth. + + * DEPS: + +2012-02-08 Dana Jansens <danakj@chromium.org> + + [Chromium] Fix opaque tracking for box shadows and non-composited child elements + https://bugs.webkit.org/show_bug.cgi?id=78073 + + Reviewed by Stephen White. + + * tests/PlatformContextSkiaTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-02-08 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Remove incorrect early exit in CCDamageTracker + https://bugs.webkit.org/show_bug.cgi?id=76924 + + Reviewed by James Robinson. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::emulateDrawingOneFrame): + (WebKitTests::TEST_F): + (WebKitTests): + +2012-02-08 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Add support for pinch gesture processing in the MT compositor. + https://bugs.webkit.org/show_bug.cgi?id=77804 + + Reviewed by James Robinson. + + * public/WebInputEvent.h: + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl): + (WebKit::WebCompositorInputHandlerImpl::handleInputEvent): + * src/WebCompositorInputHandlerImpl.h: + (WebCompositorInputHandlerImpl): + * src/WebInputEventConversion.cpp: + (WebKit::PlatformGestureEventBuilder::PlatformGestureEventBuilder): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::handleInputEvent): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::handleInputEvent): + * tests/WebCompositorInputHandlerImplTest.cpp: + +2012-02-08 Nico Weber <nicolasweber@gmx.de> + + [chromium] Make dependency on Accelerate.framework explicit. + https://bugs.webkit.org/show_bug.cgi?id=78131 + + It's used by platform/audio/mac/FFTFrameMac.cpp. The explicit + dependency is needed to build a libwebkit.dylib. + + Reviewed by Tony Chang. + + * WebKit.gyp: + +2012-02-08 Bernhard Bauer <bauerb@google.com> + + [Chromium] Don't add selection from password fields to context menu. + https://bugs.webkit.org/show_bug.cgi?id=77733 + + Reviewed by Adam Barth. + + * src/ContextMenuClientImpl.cpp: + (WebKit::ContextMenuClientImpl::getCustomMenuFromDefaultItems): + +2012-02-08 Nico Weber <nicolasweber@gmx.de> + + [chromium] Let -Wglobal-constructors hack in shared build metastasize to mac + https://bugs.webkit.org/show_bug.cgi?id=78130 + + Reviewed by Tony Chang. + + * WebKit.gyp: + +2012-02-08 Alexei Svitkine <asvitkine@chromium.org> + + Chromium: Fix Mac rubber band overhang drawing on composited pages and re-enable tests. + https://bugs.webkit.org/show_bug.cgi?id=78007 + + This got broken by: http://trac.webkit.org/changeset/105470 + And the tests were accidentally(?) disabled in: http://trac.webkit.org/changeset/95191 + + There is still three tests that fail from the set, but the cause for these is different, + which I'm still investigating. + + Reviewed by James Robinson. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::NonCompositedContentHost): + +2012-02-07 James Robinson <jamesr@chromium.org> + + [chromium] Move geometry headers in Platform API to Platform directory + https://bugs.webkit.org/show_bug.cgi?id=78067 + + Reviewed by Adam Barth. + + Add forwarding headers for several API types moved into Platform. + + * public/platform/WebFloatPoint.h: + * public/platform/WebFloatQuad.h: + * public/platform/WebFloatRect.h: + * public/platform/WebPoint.h: + * public/platform/WebRect.h: + * public/platform/WebSize.h: + +2012-02-07 MORITA Hajime <morrita@google.com> + + [Chromium] WebTextCheckingResult should have new default constructor + https://bugs.webkit.org/show_bug.cgi?id=78066 + + Reviewed by Ryosuke Niwa. + + Added a new default constructor. ex-default constructor will be removed + in an upcoming change. + + * public/WebTextCheckingResult.h: + (WebKit::WebTextCheckingResult::WebTextCheckingResult): + (WebTextCheckingResult): + +2012-02-07 Gregg Tavares <gman@google.com> + + Plumb through webGLErrorsToConsoleEnable in WebSettings + https://bugs.webkit.org/show_bug.cgi?id=78061 + + Reviewed by Kenneth Russell. + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setWebGLErrorsToConsoleEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-02-07 Robert Kroeger <rjkroege@chromium.org> + + [chromium] Remove no longer necessary Chromium gesture recognizer code. + https://bugs.webkit.org/show_bug.cgi?id=77492 + + Reviewed by Adam Barth. + + * WebKit.gypi: + * features.gypi: + * src/WebFrameImpl.cpp: + (WebKit::WebFrameImpl::createFrameView): + * src/WebPopupMenuImpl.cpp: + (WebKit::WebPopupMenuImpl::WebPopupMenuImpl): + (WebKit::WebPopupMenuImpl::handleTouchEvent): + * src/WebPopupMenuImpl.h: + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + (WebKit::WebViewImpl::touchEvent): + * src/WebViewImpl.h: + (WebCore): + (WebViewImpl): + * tests/InnerGestureRecognizerTest.cpp: Removed. + +2012-02-07 David Reveman <reveman@chromium.org> + + [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting. + https://bugs.webkit.org/show_bug.cgi?id=78020 + + Reviewed by James Robinson. + + Update TextureManagerTest.requestTextureExceedingPreferredLimit test. + + * tests/TextureManagerTest.cpp: + (WTF::TextureManagerTest::requestTexture): + (WTF::TEST_F): + +2012-02-07 Dana Jansens <danakj@chromium.org> + + [chromium] Unit test for bug #77996 + https://bugs.webkit.org/show_bug.cgi?id=78019 + + Reviewed by James Robinson. + + * tests/CCLayerTreeHostTest.cpp: + (CCLayerTreeHostTestManySurfaces): + (WTF::CCLayerTreeHostTestManySurfaces::CCLayerTreeHostTestManySurfaces): + (WTF::CCLayerTreeHostTestManySurfaces::beginTest): + (WTF::CCLayerTreeHostTestManySurfaces::afterTest): + (WTF): + +2012-02-07 Sadrul Habib Chowdhury <sadrul@chromium.org> + + Process Scroll-gesture events from the compositor. + https://bugs.webkit.org/show_bug.cgi?id=77477 + + Reviewed by James Robinson. + + * src/WebCompositorInputHandlerImpl.cpp: + (WebKit::WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl): + (WebKit::WebCompositorInputHandlerImpl::handleInputEvent): + * src/WebCompositorInputHandlerImpl.h: + (WebCompositorInputHandlerImpl): + +2012-02-07 Anders Carlsson <andersca@apple.com> + + ScrollableAreaSet should be moved from Page to FrameView + https://bugs.webkit.org/show_bug.cgi?id=62762 + + Reviewed by Beth Dakin. + + Update for changes to WebCore now that the scrollable area set is kept per frame view. + + * src/ScrollbarGroup.cpp: + (WebKit::ScrollbarGroup::ScrollbarGroup): + (WebKit::ScrollbarGroup::~ScrollbarGroup): + * src/ScrollbarGroup.h: + (WebCore): + (ScrollbarGroup): + * src/WebPluginContainerImpl.cpp: + (WebKit::WebPluginContainerImpl::scrollbarGroup): + +2012-02-07 Hans Wennborg <hans@chromium.org> + + Chromium: remove WebSpeechInputResult::set + https://bugs.webkit.org/show_bug.cgi?id=77977 + + Reviewed by Darin Fisher. + + It was renamed to assign() in r106475. + + * public/WebSpeechInputResult.h: + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106935. + http://trac.webkit.org/changeset/106935 + https://bugs.webkit.org/show_bug.cgi?id=77994 + + "Crashes runMultiThread webkit_unit_test" (Requested by tonyg- + cr on #webkit). + + * public/WebWidget.h: + (WebWidget): + * src/WebViewImpl.cpp: + * src/WebViewImpl.h: + (WebViewImpl): + +2012-02-07 Jonathan Backer <backer@chromium.org> + + [chromium] Add setNeedsRedraw to WebWidget + https://bugs.webkit.org/show_bug.cgi?id=77555 + + Reviewed by James Robinson. + + * public/WebWidget.h: + (WebWidget): + (WebKit::WebWidget::setNeedsRedraw): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::setNeedsRedraw): + (WebKit): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-02-07 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-02-06 James Robinson <jamesr@chromium.org> + + [chromium] canvas demo is slow due to unnecessary resource cleanups + https://bugs.webkit.org/show_bug.cgi?id=77135 + + Reviewed by Kenneth Russell. + + * tests/Canvas2DLayerChromiumTest.cpp: + (WebCore::Canvas2DLayerChromiumTest::fullLifecycleTest): + * tests/TextureManagerTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-02-06 Julien Chaffraix <jchaffraix@webkit.org> + + Unreviewed gardening. + + * DEPS: Rolling the DEPS to get the apple_webkit update + and fix the Chromium build. + +2012-02-06 Emil A Eklund <eae@chromium.org> + + Convert PopupMenuClient::clientPadding over to new layout abstraction + https://bugs.webkit.org/show_bug.cgi?id=77798 + + Reviewed by Eric Seidel. + + Change PopupMenuClient and all classes inheriting from it to use the new + layout types for padding. + + * src/AutofillPopupMenuClient.cpp: + (WebKit::AutofillPopupMenuClient::clientPaddingLeft): + (WebKit::AutofillPopupMenuClient::clientPaddingRight): + * src/AutofillPopupMenuClient.h: + (AutofillPopupMenuClient): + * tests/PopupMenuTest.cpp: + (WebKit::TestPopupMenuClient::clientPaddingLeft): + (WebKit::TestPopupMenuClient::clientPaddingRight): + +2012-02-06 James Robinson <jamesr@chromium.org> + + [chromium] Drop tiles completely outside of layer bounds when resizing to a smaller size + https://bugs.webkit.org/show_bug.cgi?id=77910 + + Reviewed by Kenneth Russell. + + Adds test for resizing a layer to cover fewer tiles. Test hits ASSERT()s without any code changes. + + * tests/TiledLayerChromiumTest.cpp: + (::TEST): + +2012-02-06 Ryosuke Niwa <rniwa@webkit.org> + + Revert r106859. It was completely bogus. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + +2012-02-06 Ryosuke Niwa <rniwa@webkit.org> + + Chromium build fix after r106836. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + +2012-02-06 Eric Uhrhane <ericu@chromium.org> + + [filesystem/Chromium] crackFileSystemURL needs to use innerURL + https://bugs.webkit.org/show_bug.cgi?id=77881 + + Reviewed by Adam Barth. + + * src/AsyncFileSystemChromium.cpp: + (WebCore::AsyncFileSystem::crackFileSystemURL): + Add the new code path, taken only if innerURL is present. + +2012-02-03 James Robinson <jamesr@chromium.org> + + [chromium] Support detaching TextureManager from ManagedTexture + https://bugs.webkit.org/show_bug.cgi?id=77655 + + Adds unit test for destroying a TextureManager while ManagedTextures are still alive referring to it. + + Reviewed by Kenneth Russell. + + * tests/TextureManagerTest.cpp: + +2012-02-06 Matthew Delaney <mdelaney@apple.com> + + toDataURL() uses stale data after putImageData() + https://bugs.webkit.org/show_bug.cgi?id=65767 + + Reviewed by Chris Marrin. + + * src/WebViewImpl.cpp: Updated method name. + (WebKit::WebViewImpl::doPixelReadbackToCanvas): + +2012-02-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Provide more attribute methods in Element + https://bugs.webkit.org/show_bug.cgi?id=77800 + + Reviewed by Ryosuke Niwa. + + * src/WebPageSerializerImpl.cpp: + (WebKit::WebPageSerializerImpl::openTagToString): access attributes via Element interface. + +2012-02-04 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Add support to force full damage in CCDamageTracker + https://bugs.webkit.org/show_bug.cgi?id=76805 + + Reviewed by James Robinson. + + * tests/CCDamageTrackerTest.cpp: + (WebKitTests::TEST_F): + (WebKitTests): + +2012-02-03 James Robinson <jamesr@chromium.org> + + [chromium] Defer makeContextCurrent in compositor until first frame + https://bugs.webkit.org/show_bug.cgi?id=77269 + + Reviewed by Kenneth Russell. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::CCLayerTreeHostTestSetViewportSize::beginTest): + * tests/TiledLayerChromiumTest.cpp: + (WTF::TEST): + +2012-02-03 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77691 + Fix PlatformScreen layering violation and PlatformScreenMac's incorrect use + of device scale + + Reviewed by Andy Estes. + + These two functions now take a Widget again rather than a FrameView. + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::screenRect): + (WebCore::PlatformSupport::screenAvailableRect): + +2012-02-03 John Knottenbelt <jknotten@chromium.org> + + [skia] Fix unit test PlatformContextSkiaTest.trackOpaqueOvalTest + https://bugs.webkit.org/show_bug.cgi?id=77738 + + We need to clear the bitmap before the test runs, otherwise the + contents of the bitmap will be uninitialised. This causes an + unpredicatable result as the canvas draw operations blend the + destination bitmap with the source colour. + + Similarly, valgrind discovered that + PlatformContextSkiaTest.trackOpaqueTest and + PlatformContextSkiaTest.trackOpaqueLineTest suffers from the same + problem. + + Also, re-enable WebFrameTest.FindInPage which was falsely + blamed for making this test fail. + + Reviewed by Stephen White. + + * tests/PlatformContextSkiaTest.cpp: + (WebCore::TEST): + * tests/WebFrameTest.cpp: + (WebKit::TEST_F): + +2012-02-03 Dana Jansens <danakj@chromium.org> + + [Chromium] Use the current clip when marking paints as opaque + https://bugs.webkit.org/show_bug.cgi?id=77582 + + Reviewed by Stephen White. + + * tests/PlatformContextSkiaTest.cpp: + (WebCore::TEST): + (WebCore): + +2012-02-03 Yury Semikhatsky <yurys@chromium.org> + + Unreviewed. Update Chromium deps. + + * DEPS: + +2012-02-02 Tommy Widenflycht <tommyw@google.com> + + [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter + https://bugs.webkit.org/show_bug.cgi?id=73130 + + Reviewed by Darin Fisher. + + * WebKit.gyp: + * bridge/MediaStreamCenter.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebCore): + (WebCore::MediaStreamCenter::MediaStreamCenter): + (WebCore::MediaStreamCenter::~MediaStreamCenter): + (WebCore::MediaStreamCenter::queryMediaStreamSources): + (WebCore::MediaStreamCenter::didSetMediaStreamTrackEnabled): + (WebCore::MediaStreamCenter::didStopLocalMediaStream): + (WebCore::MediaStreamCenter::didConstructMediaStream): + * bridge/MediaStreamCenterInternal.cpp: Added. + (WebCore): + (WebCore::MediaStreamCenterInternal::MediaStreamCenterInternal): + (WebCore::MediaStreamCenterInternal::~MediaStreamCenterInternal): + (WebCore::MediaStreamCenterInternal::queryMediaStreamSources): + (WebCore::MediaStreamCenterInternal::didSetMediaStreamTrackEnabled): + (WebCore::MediaStreamCenterInternal::didStopLocalMediaStream): + (WebCore::MediaStreamCenterInternal::didConstructMediaStream): + (WebCore::MediaStreamCenterInternal::stopLocalMediaStream): + * bridge/MediaStreamCenterInternal.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebKit): + (WebCore): + (MediaStreamCenterInternal): + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKit::WebKitPlatformSupport::createMediaStreamCenter): + * public/platform/WebMediaStreamCenter.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebKit): + (WebMediaStreamCenter): + (WebKit::WebMediaStreamCenter::~WebMediaStreamCenter): + * public/platform/WebMediaStreamCenterClient.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebKit): + (WebMediaStreamCenterClient): + (WebKit::WebMediaStreamCenterClient::~WebMediaStreamCenterClient): + * public/platform/WebMediaStreamComponent.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebCore): + (WebKit): + (WebMediaStreamComponent): + (WebKit::WebMediaStreamComponent::WebMediaStreamComponent): + (WebKit::WebMediaStreamComponent::~WebMediaStreamComponent): + (WebKit::WebMediaStreamComponent::isNull): + * public/platform/WebMediaStreamDescriptor.h: + (WebKit): + (WebMediaStreamDescriptor): + * public/platform/WebMediaStreamSourcesRequest.h: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebCore): + (WebKit): + (WebMediaStreamSourcesRequest): + (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest): + (WebKit::WebMediaStreamSourcesRequest::~WebMediaStreamSourcesRequest): + (WebKit::WebMediaStreamSourcesRequest::isNull): + * src/UserMediaClientImpl.h: + (UserMediaClientImpl): + * src/WebMediaStreamComponent.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebKit): + (WebKit::WebMediaStreamComponent::WebMediaStreamComponent): + (WebKit::WebMediaStreamComponent::operator=): + (WebKit::WebMediaStreamComponent::reset): + (WebKit::WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>): + (WebKit::WebMediaStreamComponent::operator MediaStreamComponent*): + (WebKit::WebMediaStreamComponent::isEnabled): + (WebKit::WebMediaStreamComponent::source): + * src/WebMediaStreamDescriptor.cpp: + (WebKit::WebMediaStreamDescriptor::WebMediaStreamDescriptor): + (WebKit): + (WebKit::WebMediaStreamDescriptor::audioSources): + (WebKit::WebMediaStreamDescriptor::videoSources): + * src/WebMediaStreamSourcesRequest.cpp: Copied from Source/WebKit/chromium/src/UserMediaClientImpl.h. + (WebKit): + (WebKit::WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest): + (WebKit::WebMediaStreamSourcesRequest::reset): + (WebKit::WebMediaStreamSourcesRequest::audio): + (WebKit::WebMediaStreamSourcesRequest::video): + (WebKit::WebMediaStreamSourcesRequest::didCompleteQuery): + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + 2012-02-02 Allan Sandfeld Jensen <allan.jensen@nokia.com> Update enum name for HitTestRequest::RequestType diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index b357b10dd..2e0adf6f0 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '119875' + 'chromium_rev': '121041' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 1dc295704..12ac1ab22 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -91,6 +91,9 @@ 'WEBKIT_IMPLEMENTATION=1', ], 'sources': [ + 'bridge/MediaStreamCenter.cpp', + 'bridge/MediaStreamCenterInternal.cpp', + 'bridge/MediaStreamCenterInternal.h', 'bridge/PeerConnectionHandler.cpp', 'bridge/PeerConnectionHandlerInternal.cpp', 'bridge/PeerConnectionHandlerInternal.h', @@ -312,8 +315,11 @@ 'public/platform/WebLayerTreeView.h', 'public/platform/WebLayerTreeViewClient.h', 'public/platform/WebLocalizedString.h', + 'public/platform/WebMediaStreamCenter.h', + 'public/platform/WebMediaStreamComponent.h', 'public/platform/WebMediaStreamDescriptor.h', 'public/platform/WebMediaStreamSource.h', + 'public/platform/WebMediaStreamSourcesRequest.h', 'public/platform/WebNonCopyable.h', 'public/platform/WebPeerConnectionHandler.h', 'public/platform/WebPeerConnectionHandlerClient.h', @@ -532,7 +538,6 @@ 'src/WebFileChooserCompletionImpl.h', 'src/WebFileSystemCallbacksImpl.cpp', 'src/WebFileSystemCallbacksImpl.h', - 'src/WebFloatQuad.cpp', 'src/WebFontCache.cpp', 'src/WebFontDescription.cpp', 'src/WebFontImpl.cpp', @@ -597,9 +602,11 @@ 'src/WebMediaElement.cpp', 'src/WebMediaPlayerClientImpl.cpp', 'src/WebMediaPlayerClientImpl.h', + 'src/WebMediaStreamComponent.cpp', 'src/WebMediaStreamDescriptor.cpp', 'src/WebMediaStreamRegistry.cpp', 'src/WebMediaStreamSource.cpp', + 'src/WebMediaStreamSourcesRequest.cpp', 'src/WebNamedNodeMap.cpp', 'src/WebNetworkStateNotifier.cpp', 'src/WebNode.cpp', @@ -755,6 +762,9 @@ # and we pull in the test files into the webkit target in the # shared build. 'cflags!': ['-Wglobal-constructors'], + 'xcode_settings': { + 'WARNING_CFLAGS!': ['-Wglobal-constructors'], + }, }], ], 'msvs_settings': { @@ -848,6 +858,7 @@ ['OS=="mac"', { 'link_settings': { 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Accelerate.framework', '$(SDKROOT)/System/Library/Frameworks/OpenGL.framework', ], }, diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index e15fbfcaa..c8502f573 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -96,7 +96,6 @@ 'tests/IDBBindingUtilitiesTest.cpp', 'tests/IDBKeyPathTest.cpp', 'tests/IDBLevelDBCodingTest.cpp', - 'tests/InnerGestureRecognizerTest.cpp', 'tests/KeyboardTest.cpp', 'tests/KURLTest.cpp', 'tests/LayerChromiumTest.cpp', diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp b/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp new file mode 100644 index 000000000..99f636d53 --- /dev/null +++ b/Source/WebKit/chromium/bridge/MediaStreamCenter.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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(MEDIA_STREAM) + +#include "MediaStreamCenter.h" + +#include "MediaStreamCenterInternal.h" +#include "MediaStreamDescriptor.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +MediaStreamCenter::MediaStreamCenter() + : m_private(adoptPtr(new MediaStreamCenterInternal(this))) +{ +} + +MediaStreamCenter::~MediaStreamCenter() +{ +} + +void MediaStreamCenter::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) +{ + m_private->queryMediaStreamSources(client); +} + +void MediaStreamCenter::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component) +{ + m_private->didSetMediaStreamTrackEnabled(stream, component); +} + +void MediaStreamCenter::didStopLocalMediaStream(MediaStreamDescriptor* stream) +{ + m_private->didStopLocalMediaStream(stream); +} + +void MediaStreamCenter::didConstructMediaStream(MediaStreamDescriptor* stream) +{ + m_private->didConstructMediaStream(stream); +} + +} // namespace WebCore + +#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp new file mode 100644 index 000000000..a8693b479 --- /dev/null +++ b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.cpp @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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(MEDIA_STREAM) + +#include "MediaStreamCenterInternal.h" + +#include "MediaStreamCenter.h" +#include "MediaStreamComponent.h" +#include "MediaStreamSource.h" +#include "WebKit.h" +#include "platform/WebKitPlatformSupport.h" +#include "platform/WebMediaStreamCenter.h" +#include "platform/WebMediaStreamComponent.h" +#include "platform/WebMediaStreamDescriptor.h" +#include "platform/WebMediaStreamSourcesRequest.h" +#include <wtf/PassOwnPtr.h> + +namespace WebCore { + +MediaStreamCenterInternal::MediaStreamCenterInternal(MediaStreamCenter* owner) + : m_private(adoptPtr(WebKit::webKitPlatformSupport()->createMediaStreamCenter(this))) + , m_owner(owner) +{ +} + +MediaStreamCenterInternal::~MediaStreamCenterInternal() +{ +} + +void MediaStreamCenterInternal::queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient> client) +{ + // FIXME: Remove this "short-circuit" and forward to m_private when Chrome has implemented WebMediaStreamCenter. + MediaStreamSourceVector audioSources, videoSources; + client->didCompleteQuery(audioSources, videoSources); +} + +void MediaStreamCenterInternal::didSetMediaStreamTrackEnabled(MediaStreamDescriptor* stream, MediaStreamComponent* component) +{ + if (m_private) { + if (component->enabled()) + m_private->didEnableMediaStreamTrack(stream, component); + else + m_private->didDisableMediaStreamTrack(stream, component); + } +} + +void MediaStreamCenterInternal::didStopLocalMediaStream(MediaStreamDescriptor* stream) +{ + if (m_private) + m_private->didStopLocalMediaStream(stream); +} + +void MediaStreamCenterInternal::didConstructMediaStream(MediaStreamDescriptor* stream) +{ + if (m_private) + m_private->didConstructMediaStream(stream); +} + +void MediaStreamCenterInternal::stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor& stream) +{ + m_owner->endLocalMediaStream(stream); +} + +} // namespace WebCore + +#endif // ENABLE(MEDIA_STREAM) diff --git a/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h new file mode 100644 index 000000000..f5c3d8ada --- /dev/null +++ b/Source/WebKit/chromium/bridge/MediaStreamCenterInternal.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 MediaStreamCenterInternal_h +#define MediaStreamCenterInternal_h + +#if ENABLE(MEDIA_STREAM) + +#include "platform/WebMediaStreamCenterClient.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassRefPtr.h> + +namespace WebKit { +class WebMediaStreamCenter; +} + +namespace WebCore { + +class MediaStreamCenter; +class MediaStreamComponent; +class MediaStreamDescriptor; +class MediaStreamSourcesQueryClient; + +class MediaStreamCenterInternal : public WebKit::WebMediaStreamCenterClient { +public: + explicit MediaStreamCenterInternal(MediaStreamCenter*); + ~MediaStreamCenterInternal(); + + void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>); + void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*); + void didStopLocalMediaStream(MediaStreamDescriptor*); + void didConstructMediaStream(MediaStreamDescriptor*); + + // From WebKit::WebMediaStreamCenterClient. + virtual void stopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&); + +private: + OwnPtr<WebKit::WebMediaStreamCenter> m_private; + MediaStreamCenter* m_owner; +}; + +} // namespace WebCore + +#endif // ENABLE(MEDIA_STREAM) + +#endif // MediaStreamCenterInternal_h diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index e7ef18f8d..4cca26795 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -50,7 +50,6 @@ 'ENABLE_GAMEPAD=1', 'ENABLE_GEOLOCATION=1', 'ENABLE_GESTURE_EVENTS=1', - 'ENABLE_GESTURE_RECOGNIZER=1', 'ENABLE_ICONDATABASE=0', 'ENABLE_INDEXED_DATABASE=1', 'ENABLE_INPUT_COLOR=0', diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h index 57b1f4b5c..e42e45134 100644 --- a/Source/WebKit/chromium/public/WebInputEvent.h +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -109,6 +109,9 @@ public: GestureTap, GestureTapDown, GestureDoubleTap, + GesturePinchBegin, + GesturePinchEnd, + GesturePinchUpdate, // WebTouchEvent TouchStart, @@ -351,6 +354,8 @@ public: int y; int globalX; int globalY; + + // NOTE: |deltaX| and |deltaY| represents the amount to scroll for Scroll gesture events. For Pinch gesture events, |deltaX| represents the scaling/magnification factor. float deltaX; float deltaY; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index b5da4e6ba..25ac07523 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -98,6 +98,7 @@ public: virtual void setExperimentalWebGLEnabled(bool) = 0; virtual void setOpenGLMultisamplingEnabled(bool) = 0; virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0; + virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; virtual void setShowDebugBorders(bool) = 0; virtual void setShowFPSCounter(bool) = 0; virtual bool showFPSCounter() const = 0; diff --git a/Source/WebKit/chromium/public/WebSpeechInputResult.h b/Source/WebKit/chromium/public/WebSpeechInputResult.h index 82eb74aaa..db4a7c677 100644 --- a/Source/WebKit/chromium/public/WebSpeechInputResult.h +++ b/Source/WebKit/chromium/public/WebSpeechInputResult.h @@ -45,9 +45,6 @@ public: WebSpeechInputResult(const WebSpeechInputResult& other) { assign(other); } ~WebSpeechInputResult() { reset(); } - // FIXME: Remove this when Chromium has been updated. - void set(const WebString& utterance, double confidence) { assign(utterance, confidence); } - WEBKIT_EXPORT void assign(const WebString& utterance, double confidence); WEBKIT_EXPORT void assign(const WebSpeechInputResult& other); WEBKIT_EXPORT void reset(); diff --git a/Source/WebKit/chromium/public/WebTextCheckingResult.h b/Source/WebKit/chromium/public/WebTextCheckingResult.h index dfd0181e5..8d0a745cc 100644 --- a/Source/WebKit/chromium/public/WebTextCheckingResult.h +++ b/Source/WebKit/chromium/public/WebTextCheckingResult.h @@ -50,7 +50,16 @@ struct WebTextCheckingResult { ErrorGrammar = 1 << 1 }; - explicit WebTextCheckingResult(Error e = ErrorSpelling, int p = 0, int l = 0) + WebTextCheckingResult() + : type(WebTextCheckingTypeSpelling) + , error(ErrorSpelling) + , position(0) + , location(0) + , length(0) + { + } + + explicit WebTextCheckingResult(Error e, int p = 0, int l = 0) : type(WebTextCheckingTypeSpelling) , error(e) , position(p) diff --git a/Source/WebKit/chromium/public/platform/WebFloatPoint.h b/Source/WebKit/chromium/public/platform/WebFloatPoint.h index 4afc16b9c..3fd4c6c86 100644 --- a/Source/WebKit/chromium/public/platform/WebFloatPoint.h +++ b/Source/WebKit/chromium/public/platform/WebFloatPoint.h @@ -1,91 +1,26 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFloatPoint_h -#define WebFloatPoint_h - -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include "FloatPoint.h" -#endif - -namespace WebKit { - -struct WebFloatPoint { - float x; - float y; - - WebFloatPoint() - : x(0.0f) - , y(0.0f) - { - } - - WebFloatPoint(float x, float y) - : x(x) - , y(y) - { - } - -#if WEBKIT_IMPLEMENTATION - WebFloatPoint(const WebCore::FloatPoint& p) - : x(p.x()) - , y(p.y()) - { - } - - WebFloatPoint& operator=(const WebCore::FloatPoint& p) - { - x = p.x(); - y = p.y(); - return *this; - } - - operator WebCore::FloatPoint() const - { - return WebCore::FloatPoint(x, y); - } -#endif -}; - -inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) -{ - return a.x == b.x && a.y == b.y; -} - -inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebFloatPoint.h" diff --git a/Source/WebKit/chromium/public/platform/WebFloatQuad.h b/Source/WebKit/chromium/public/platform/WebFloatQuad.h index da5eb0542..5d07f92b5 100644 --- a/Source/WebKit/chromium/public/platform/WebFloatQuad.h +++ b/Source/WebKit/chromium/public/platform/WebFloatQuad.h @@ -1,82 +1,26 @@ /* - * Copyright (C) 2011 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFloatQuad_h -#define WebFloatQuad_h - -#include "WebCommon.h" -#include "WebFloatPoint.h" -#include "WebRect.h" - -#include <algorithm> -#include <cmath> - -#if WEBKIT_IMPLEMENTATION -#include "FloatQuad.h" -#endif - -namespace WebKit { - -struct WebFloatQuad { - WebFloatPoint p[4]; - - WebFloatQuad() - { - } - - WebFloatQuad(const WebFloatPoint& p0, const WebFloatPoint& p1, const WebFloatPoint& p2, const WebFloatPoint& p3) - { - p[0] = p0; - p[1] = p1; - p[2] = p2; - p[3] = p3; - } - - WEBKIT_EXPORT WebRect enclosingRect() const; - -#if WEBKIT_IMPLEMENTATION - WebFloatQuad& operator=(const WebCore::FloatQuad& q) - { - p[0] = q.p1(); - p[1] = q.p2(); - p[2] = q.p3(); - p[3] = q.p4(); - return *this; - } - WebFloatQuad(const WebCore::FloatQuad& q) - { - *this = q; - } -#endif -}; - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebFloatQuad.h" diff --git a/Source/WebKit/chromium/public/platform/WebFloatRect.h b/Source/WebKit/chromium/public/platform/WebFloatRect.h index a883513fc..c6dd54fdb 100644 --- a/Source/WebKit/chromium/public/platform/WebFloatRect.h +++ b/Source/WebKit/chromium/public/platform/WebFloatRect.h @@ -1,103 +1,26 @@ /* - * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFloatRect_h -#define WebFloatRect_h - -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include "FloatRect.h" -#endif - -namespace WebKit { - -struct WebFloatRect { - float x; - float y; - float width; - float height; - - bool isEmpty() const { return width <= 0 || height <= 0; } - - WebFloatRect() - : x(0.0f) - , y(0.0f) - , width(0.0f) - , height(0.0f) - { - } - - WebFloatRect(float x, float y, float width, float height) - : x(x) - , y(y) - , width(width) - , height(height) - { - } - -#if WEBKIT_IMPLEMENTATION - WebFloatRect(const WebCore::FloatRect& r) - : x(r.x()) - , y(r.y()) - , width(r.width()) - , height(r.height()) - { - } - - WebFloatRect& operator=(const WebCore::FloatRect& r) - { - x = r.x(); - y = r.y(); - width = r.width(); - height = r.height(); - return *this; - } - - operator WebCore::FloatRect() const - { - return WebCore::FloatRect(x, y, width, height); - } -#endif -}; - -inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) -{ - return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; -} - -inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebFloatRect.h" diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 0acc9eafa..54795fa48 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -61,6 +61,8 @@ class WebFileUtilities; class WebGraphicsContext3D; class WebIDBFactory; // FIXME: Does this belong in platform? class WebIDBKey; // FIXME: Does this belong in platform? +class WebMediaStreamCenter; +class WebMediaStreamCenterClient; class WebMessagePortChannel; // FIXME: Does this belong in platform? class WebMimeRegistry; class WebPeerConnectionHandler; @@ -337,6 +339,7 @@ public: // May return null if WebRTC functionality is not avaliable or out of resources. virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; } + virtual WebMediaStreamCenter* createMediaStreamCenter(WebMediaStreamCenterClient*) { return 0; } virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { } diff --git a/Source/WebCore/platform/PlatformGestureRecognizer.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h index 0b86a9276..8381a9a4c 100644 --- a/Source/WebCore/platform/PlatformGestureRecognizer.h +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamCenter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -28,35 +28,27 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PlatformGestureRecognizer_h -#define PlatformGestureRecognizer_h +#ifndef WebMediaStreamCenter_h +#define WebMediaStreamCenter_h -#include "PlatformGestureEvent.h" -#include <wtf/PassOwnPtr.h> -#include <wtf/Vector.h> +namespace WebKit { -namespace WebCore { - -class EventHandler; -class PlatformTouchEvent; - -class PlatformGestureRecognizer { -protected: - PlatformGestureRecognizer(); +class WebMediaStreamComponent; +class WebMediaStreamDescriptor; +class WebMediaStreamSourcesRequest; +class WebMediaStreamCenter { public: - static PassOwnPtr<PlatformGestureRecognizer> create(); - virtual ~PlatformGestureRecognizer(); - - typedef PassOwnPtr<Vector<PlatformGestureEvent> > PassGestures; + virtual ~WebMediaStreamCenter() { } - // Invoked for each touch event and returns 0 or more resulting gestures. - virtual PassGestures processTouchEventForGestures(const PlatformTouchEvent&, bool defaultPrevented) = 0; - - // Clears the GestureRecognizer to its initial state. - virtual void reset() = 0; + virtual void queryMediaStreamSources(const WebMediaStreamSourcesRequest&) = 0; + virtual void didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0; + virtual void didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0; + virtual void didStopLocalMediaStream(const WebMediaStreamDescriptor&) = 0; + virtual void didConstructMediaStream(const WebMediaStreamDescriptor&) = 0; }; -} // namespace WebCore +} // namespace WebKit + +#endif // WebMediaStreamCenter_h -#endif // PlatformGestureRecognizer_h diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h b/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h new file mode 100644 index 000000000..8a0825f90 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamCenterClient.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 WebMediaStreamCenterClient_h +#define WebMediaStreamCenterClient_h + +namespace WebKit { + +class WebMediaStreamDescriptor; + +class WebMediaStreamCenterClient { +public: + virtual ~WebMediaStreamCenterClient() { } + + virtual void stopLocalMediaStream(const WebMediaStreamDescriptor&) = 0; +}; + +} // namespace WebKit + +#endif // WebMediaStreamCenterClient_h diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h b/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h new file mode 100644 index 000000000..bee18553f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamComponent.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 WebMediaStreamComponent_h +#define WebMediaStreamComponent_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class MediaStreamComponent; +} + +namespace WebKit { + +class WebMediaStreamSource; +class WebString; + +class WebMediaStreamComponent { +public: + WebMediaStreamComponent() { } + ~WebMediaStreamComponent() { reset(); } + + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebMediaStreamSource source() const; + WEBKIT_EXPORT bool isEnabled() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamComponent(WebCore::MediaStreamComponent*); + WebMediaStreamComponent& operator=(WebCore::MediaStreamComponent*); + operator WTF::PassRefPtr<WebCore::MediaStreamComponent>() const; + operator WebCore::MediaStreamComponent*() const; +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamComponent> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamComponent_h diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h index ff8bd19cb..4923c97b5 100644 --- a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h @@ -36,6 +36,7 @@ class MediaStreamDescriptor; namespace WebKit { +class WebMediaStreamComponent; class WebMediaStreamSource; class WebString; @@ -65,10 +66,11 @@ public: // DEPRECATED WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const; - WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamSource>&) const; - WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamSource>&) const; + WEBKIT_EXPORT void audioSources(WebVector<WebMediaStreamComponent>&) const; + WEBKIT_EXPORT void videoSources(WebVector<WebMediaStreamComponent>&) const; #if WEBKIT_IMPLEMENTATION + WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor*); WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const; operator WebCore::MediaStreamDescriptor*() const; diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h new file mode 100644 index 000000000..7fcc7c275 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSourcesRequest.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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 WebMediaStreamSourcesRequest_h +#define WebMediaStreamSourcesRequest_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class MediaStreamSourcesQueryClient; +} + +namespace WebKit { + +class WebMediaStreamSource; +template <typename T> class WebVector; + +class WebMediaStreamSourcesRequest { +public: + WebMediaStreamSourcesRequest() { } + ~WebMediaStreamSourcesRequest() { reset(); } + + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT bool audio() const; + WEBKIT_EXPORT bool video() const; + + WEBKIT_EXPORT void didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamSourcesRequest(const WTF::PassRefPtr<WebCore::MediaStreamSourcesQueryClient>&); +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamSourcesQueryClient> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamSourcesRequest_h diff --git a/Source/WebKit/chromium/public/platform/WebPoint.h b/Source/WebKit/chromium/public/platform/WebPoint.h index 766236398..3e64e43ce 100644 --- a/Source/WebKit/chromium/public/platform/WebPoint.h +++ b/Source/WebKit/chromium/public/platform/WebPoint.h @@ -1,111 +1,27 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebPoint_h -#define WebPoint_h +#include "../../../../Platform/chromium/public/WebPoint.h" -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include "IntPoint.h" -#else -#include <ui/gfx/point.h> -#endif - -namespace WebKit { - -struct WebPoint { - int x; - int y; - - WebPoint() - : x(0) - , y(0) - { - } - - WebPoint(int x, int y) - : x(x) - , y(y) - { - } - -#if WEBKIT_IMPLEMENTATION - WebPoint(const WebCore::IntPoint& p) - : x(p.x()) - , y(p.y()) - { - } - - WebPoint& operator=(const WebCore::IntPoint& p) - { - x = p.x(); - y = p.y(); - return *this; - } - - operator WebCore::IntPoint() const - { - return WebCore::IntPoint(x, y); - } -#else - WebPoint(const gfx::Point& p) - : x(p.x()) - , y(p.y()) - { - } - - WebPoint& operator=(const gfx::Point& p) - { - x = p.x(); - y = p.y(); - return *this; - } - - operator gfx::Point() const - { - return gfx::Point(x, y); - } -#endif -}; - -inline bool operator==(const WebPoint& a, const WebPoint& b) -{ - return a.x == b.x && a.y == b.y; -} - -inline bool operator!=(const WebPoint& a, const WebPoint& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif diff --git a/Source/WebKit/chromium/public/platform/WebRect.h b/Source/WebKit/chromium/public/platform/WebRect.h index 045b7a8eb..c1ced0071 100644 --- a/Source/WebKit/chromium/public/platform/WebRect.h +++ b/Source/WebKit/chromium/public/platform/WebRect.h @@ -1,127 +1,26 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebRect_h -#define WebRect_h - -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include "IntRect.h" -#else -#include <ui/gfx/rect.h> -#endif - -namespace WebKit { - -struct WebRect { - int x; - int y; - int width; - int height; - - bool isEmpty() const { return width <= 0 || height <= 0; } - - WebRect() - : x(0) - , y(0) - , width(0) - , height(0) - { - } - - WebRect(int x, int y, int width, int height) - : x(x) - , y(y) - , width(width) - , height(height) - { - } - -#if WEBKIT_IMPLEMENTATION - WebRect(const WebCore::IntRect& r) - : x(r.x()) - , y(r.y()) - , width(r.width()) - , height(r.height()) - { - } - - WebRect& operator=(const WebCore::IntRect& r) - { - x = r.x(); - y = r.y(); - width = r.width(); - height = r.height(); - return *this; - } - - operator WebCore::IntRect() const - { - return WebCore::IntRect(x, y, width, height); - } -#else - WebRect(const gfx::Rect& r) - : x(r.x()) - , y(r.y()) - , width(r.width()) - , height(r.height()) - { - } - - WebRect& operator=(const gfx::Rect& r) - { - x = r.x(); - y = r.y(); - width = r.width(); - height = r.height(); - return *this; - } - - operator gfx::Rect() const - { - return gfx::Rect(x, y, width, height); - } -#endif -}; - -inline bool operator==(const WebRect& a, const WebRect& b) -{ - return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; -} - -inline bool operator!=(const WebRect& a, const WebRect& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebRect.h" diff --git a/Source/WebKit/chromium/public/platform/WebSize.h b/Source/WebKit/chromium/public/platform/WebSize.h index 94a53654d..b8526a118 100644 --- a/Source/WebKit/chromium/public/platform/WebSize.h +++ b/Source/WebKit/chromium/public/platform/WebSize.h @@ -1,113 +1,26 @@ /* - * Copyright (C) 2009 Google Inc. All rights reserved. + * Copyright (C) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: + * 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. + * 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSize_h -#define WebSize_h - -#include "WebCommon.h" - -#if WEBKIT_IMPLEMENTATION -#include "IntSize.h" -#else -#include <ui/gfx/size.h> -#endif - -namespace WebKit { - -struct WebSize { - int width; - int height; - - bool isEmpty() const { return width <= 0 || height <= 0; } - - WebSize() - : width(0) - , height(0) - { - } - - WebSize(int width, int height) - : width(width) - , height(height) - { - } - -#if WEBKIT_IMPLEMENTATION - WebSize(const WebCore::IntSize& s) - : width(s.width()) - , height(s.height()) - { - } - - WebSize& operator=(const WebCore::IntSize& s) - { - width = s.width(); - height = s.height(); - return *this; - } - - operator WebCore::IntSize() const - { - return WebCore::IntSize(width, height); - } -#else - WebSize(const gfx::Size& s) - : width(s.width()) - , height(s.height()) - { - } - - WebSize& operator=(const gfx::Size& s) - { - width = s.width(); - height = s.height(); - return *this; - } - - operator gfx::Size() const - { - return gfx::Size(width, height); - } -#endif -}; - -inline bool operator==(const WebSize& a, const WebSize& b) -{ - return a.width == b.width && a.height == b.height; -} - -inline bool operator!=(const WebSize& a, const WebSize& b) -{ - return !(a == b); -} - -} // namespace WebKit - -#endif +#include "../../../../Platform/chromium/public/WebSize.h" diff --git a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp index 28712827d..1f93cf93e 100644 --- a/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileSystemChromium.cpp @@ -63,28 +63,44 @@ bool AsyncFileSystem::crackFileSystemURL(const KURL& url, AsyncFileSystem::Type& if (!url.protocolIs("filesystem")) return false; - KURL originURL(ParsedURLString, url.path()); - String path = decodeURLEscapeSequences(originURL.path()); - if (path.isEmpty() || path[0] != '/') - return false; - path = path.substring(1); - - if (path.startsWith(temporaryPathPrefix)) { - type = Temporary; - path = path.substring(temporaryPathPrefixLength); - } else if (path.startsWith(persistentPathPrefix)) { - type = Persistent; - path = path.substring(persistentPathPrefixLength); - } else if (path.startsWith(externalPathPrefix)) { - type = externalType; - path = path.substring(externalPathPrefixLength); - } else - return false; - - if (path.isEmpty() || path[0] != '/') - return false; - - filePath.swap(path); + if (url.innerURL()) { + String typeString = url.innerURL()->path().substring(1); + if (typeString == temporaryPathPrefix) + type = Temporary; + else if (typeString == persistentPathPrefix) + type = Persistent; + else if (typeString == externalPathPrefix) + type = externalType; + else + return false; + + filePath = decodeURLEscapeSequences(url.path()); + } else { + // FIXME: Remove this clause once http://codereview.chromium.org/7811006 + // lands, which makes this dead code. + KURL originURL(ParsedURLString, url.path()); + String path = decodeURLEscapeSequences(originURL.path()); + if (path.isEmpty() || path[0] != '/') + return false; + path = path.substring(1); + + if (path.startsWith(temporaryPathPrefix)) { + type = Temporary; + path = path.substring(temporaryPathPrefixLength); + } else if (path.startsWith(persistentPathPrefix)) { + type = Persistent; + path = path.substring(persistentPathPrefixLength); + } else if (path.startsWith(externalPathPrefix)) { + type = externalType; + path = path.substring(externalPathPrefixLength); + } else + return false; + + if (path.isEmpty() || path[0] != '/') + return false; + + filePath.swap(path); + } return true; } diff --git a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp index 72cccfcc2..c84ea12f6 100644 --- a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp +++ b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp @@ -196,7 +196,7 @@ PopupMenuStyle AutofillPopupMenuClient::menuStyle() const return *m_regularStyle; } -int AutofillPopupMenuClient::clientPaddingLeft() const +WebCore::LayoutUnit AutofillPopupMenuClient::clientPaddingLeft() const { // Bug http://crbug.com/7708 seems to indicate the style can be 0. RenderStyle* style = textFieldStyle(); @@ -206,7 +206,7 @@ int AutofillPopupMenuClient::clientPaddingLeft() const return RenderTheme::defaultTheme()->popupInternalPaddingLeft(style); } -int AutofillPopupMenuClient::clientPaddingRight() const +WebCore::LayoutUnit AutofillPopupMenuClient::clientPaddingRight() const { // Bug http://crbug.com/7708 seems to indicate the style can be 0. RenderStyle* style = textFieldStyle(); diff --git a/Source/WebKit/chromium/src/AutofillPopupMenuClient.h b/Source/WebKit/chromium/src/AutofillPopupMenuClient.h index 7d2b985a2..73cc180e0 100644 --- a/Source/WebKit/chromium/src/AutofillPopupMenuClient.h +++ b/Source/WebKit/chromium/src/AutofillPopupMenuClient.h @@ -84,8 +84,8 @@ public: virtual WebCore::PopupMenuStyle menuStyle() const; virtual int clientInsetLeft() const { return 0; } virtual int clientInsetRight() const { return 0; } - virtual int clientPaddingLeft() const; - virtual int clientPaddingRight() const; + virtual WebCore::LayoutUnit clientPaddingLeft() const; + virtual WebCore::LayoutUnit clientPaddingRight() const; virtual int listSize() const { return getSuggestionsCount(); } virtual int selectedIndex() const { return m_selectedIndex; } virtual void popupDidHide(); diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index cdceb0763..790a9c52b 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -259,8 +259,10 @@ PlatformMenuDescription ContextMenuClientImpl::getCustomMenuFromDefaultItems( data.frameHistoryItem = WebHistoryItem(historyItem); } - if (r.isSelected()) - data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace(); + if (r.isSelected()) { + if (!r.innerNonSharedNode()->hasTagName(HTMLNames::inputTag) || !static_cast<HTMLInputElement*>(r.innerNonSharedNode())->isPasswordField()) + data.selectedText = selectedFrame->editor()->selectedText().stripWhiteSpace(); + } if (r.isContentEditable()) { data.isEditable = true; diff --git a/Source/WebKit/chromium/src/DatabaseObserver.cpp b/Source/WebKit/chromium/src/DatabaseObserver.cpp index 40b504803..2196c9b44 100644 --- a/Source/WebKit/chromium/src/DatabaseObserver.cpp +++ b/Source/WebKit/chromium/src/DatabaseObserver.cpp @@ -165,7 +165,10 @@ bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecut WorkerContext* workerContext = static_cast<WorkerContext*>(scriptExecutionContext); WorkerLoaderProxy* workerLoaderProxy = &workerContext->thread()->workerLoaderProxy(); WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); - return allowDatabaseForWorker(webWorker->commonClient(), webWorker->view()->mainFrame(), name, displayName, estimatedSize); + WebView* view = webWorker->view(); + if (!view) + return false; + return allowDatabaseForWorker(webWorker->commonClient(), view->mainFrame(), name, displayName, estimatedSize); #else ASSERT_NOT_REACHED(); #endif diff --git a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp index 94958c94e..cbbf5c581 100644 --- a/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp +++ b/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp @@ -123,9 +123,6 @@ PassRefPtr<GraphicsContext3D> GraphicsContext3DPrivate::createGraphicsContextFro Chrome* chrome = static_cast<Chrome*>(hostWindow); WebKit::WebViewImpl* webViewImpl = chrome ? static_cast<WebKit::WebViewImpl*>(chrome->client()->webView()) : 0; - if (threadUsage == ForUseOnThisThread && !webContext->makeContextCurrent()) - return 0; - OwnPtr<GraphicsContext3DPrivate> priv = GraphicsContext3DPrivate::create(webViewImpl, webContext, attrs); if (!priv) return 0; diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 80b711a56..99a0afae4 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -183,7 +183,12 @@ void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* ca } WorkerLoaderProxy* workerLoaderProxy = &context->thread()->workerLoaderProxy(); WebWorkerBase* webWorker = static_cast<WebWorkerBase*>(workerLoaderProxy); - WebFrame* webFrame = webWorker->view()->mainFrame(); + WebView* webView = webWorker->view(); + if (!webView) { + // Frame is closed, worker is terminaring. + return; + } + WebFrame* webFrame = webView->mainFrame(); m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); #endif } diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 5f43a9ab3..c9be08a84 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -45,7 +45,9 @@ NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPain #endif m_graphicsLayer->setDrawsContent(true); m_graphicsLayer->platformLayer()->setIsNonCompositedContent(true); +#if !ENABLE(RUBBER_BANDING) m_graphicsLayer->platformLayer()->setBackgroundCoversViewport(true); +#endif m_graphicsLayer->platformLayer()->setOpaque(true); } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 7ed80bb24..b4d479ca6 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -1092,17 +1092,17 @@ bool PlatformSupport::screenIsMonochrome(Widget* widget) return client->screenInfo().isMonochrome; } -IntRect PlatformSupport::screenRect(FrameView* frameView) +IntRect PlatformSupport::screenRect(Widget* widget) { - WebWidgetClient* client = toWebWidgetClient(frameView); + WebWidgetClient* client = toWebWidgetClient(widget); if (!client) return IntRect(); return client->screenInfo().rect; } -IntRect PlatformSupport::screenAvailableRect(FrameView* frameView) +IntRect PlatformSupport::screenAvailableRect(Widget* widget) { - WebWidgetClient* client = toWebWidgetClient(frameView); + WebWidgetClient* client = toWebWidgetClient(widget); if (!client) return IntRect(); return client->screenInfo().availableRect; diff --git a/Source/WebKit/chromium/src/ScrollbarGroup.cpp b/Source/WebKit/chromium/src/ScrollbarGroup.cpp index ad4ef83cc..579dc7aa7 100644 --- a/Source/WebKit/chromium/src/ScrollbarGroup.cpp +++ b/Source/WebKit/chromium/src/ScrollbarGroup.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "ScrollbarGroup.h" -#include "Page.h" +#include "FrameView.h" #include "Scrollbar.h" #include "ScrollbarTheme.h" #include "platform/WebRect.h" @@ -36,20 +36,19 @@ using namespace WebCore; namespace WebKit { -ScrollbarGroup::ScrollbarGroup(Page* page) - : m_page(page) +ScrollbarGroup::ScrollbarGroup(FrameView* frameView) + : m_frameView(frameView) , m_horizontalScrollbar(0) , m_verticalScrollbar(0) { - m_page->addScrollableArea(this); + m_frameView->addScrollableArea(this); } ScrollbarGroup::~ScrollbarGroup() { ASSERT(!m_horizontalScrollbar); ASSERT(!m_verticalScrollbar); - if (m_page) - m_page->removeScrollableArea(this); + m_frameView->removeScrollableArea(this); } void ScrollbarGroup::scrollbarCreated(WebScrollbarImpl* scrollbar) @@ -249,9 +248,4 @@ bool ScrollbarGroup::isOnActivePage() const return true; } -void ScrollbarGroup::disconnectFromPage() -{ - m_page = 0; -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/ScrollbarGroup.h b/Source/WebKit/chromium/src/ScrollbarGroup.h index 9093f33dd..44be2cf51 100644 --- a/Source/WebKit/chromium/src/ScrollbarGroup.h +++ b/Source/WebKit/chromium/src/ScrollbarGroup.h @@ -31,7 +31,7 @@ #include <wtf/RefPtr.h> namespace WebCore { -class Page; +class FrameView; } namespace WebKit { @@ -40,7 +40,7 @@ class WebScrollbarImpl; class ScrollbarGroup : public WebCore::ScrollableArea { public: - explicit ScrollbarGroup(WebCore::Page*); + explicit ScrollbarGroup(WebCore::FrameView*); ~ScrollbarGroup(); void scrollbarCreated(WebScrollbarImpl*); @@ -72,10 +72,9 @@ public: virtual bool shouldSuspendScrollAnimations() const; virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); virtual bool isOnActivePage() const; - virtual void disconnectFromPage(); private: - WebCore::Page* m_page; + WebCore::FrameView* m_frameView; WebCore::IntPoint m_lastMousePosition; WebScrollbarImpl* m_horizontalScrollbar; WebScrollbarImpl* m_verticalScrollbar; diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.h b/Source/WebKit/chromium/src/UserMediaClientImpl.h index f0871236b..f6ab0416b 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.h +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.h @@ -50,7 +50,7 @@ public: // WebCore::UserMediaClient ---------------------------------------------- virtual void pageDestroyed(); - virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector&, const WebCore::MediaStreamSourceVector&); + virtual void requestUserMedia(PassRefPtr<WebCore::UserMediaRequest>, const WebCore::MediaStreamSourceVector& audioSources, const WebCore::MediaStreamSourceVector& videoSources); virtual void cancelUserMediaRequest(WebCore::UserMediaRequest*); private: diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 408f1264f..40c151dfd 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -81,6 +81,11 @@ WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl(CCInputHandlerClien : m_client(0) , m_identifier(s_nextAvailableIdentifier++) , m_inputHandlerClient(inputHandlerClient) +#ifndef NDEBUG + , m_expectScrollUpdateEnd(false) + , m_expectPinchUpdateEnd(false) +#endif + , m_scrollStarted(false) { ASSERT(CCProxy::isImplThread()); @@ -131,6 +136,66 @@ void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event) case CCInputHandlerClient::ScrollFailed: break; } + } else if (event.type == WebInputEvent::GestureScrollBegin) { + ASSERT(!m_scrollStarted); + ASSERT(!m_expectScrollUpdateEnd); +#ifndef NDEBUG + m_expectScrollUpdateEnd = true; +#endif + const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); + CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y)); + switch (scrollStatus) { + case CCInputHandlerClient::ScrollStarted: + m_scrollStarted = true; + m_client->didHandleInputEvent(); + return; + case CCInputHandlerClient::ScrollIgnored: + m_client->didNotHandleInputEvent(false /* sendToWidget */); + return; + case CCInputHandlerClient::ScrollFailed: + break; + } + } else if (event.type == WebInputEvent::GestureScrollUpdate) { + ASSERT(m_expectScrollUpdateEnd); + if (m_scrollStarted) { + const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); + m_inputHandlerClient->scrollBy(IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY)); + m_client->didHandleInputEvent(); + return; + } + } else if (event.type == WebInputEvent::GestureScrollEnd) { + ASSERT(m_expectScrollUpdateEnd); +#ifndef NDEBUG + m_expectScrollUpdateEnd = false; +#endif + if (m_scrollStarted) { + m_inputHandlerClient->scrollEnd(); + m_client->didHandleInputEvent(); + m_scrollStarted = false; + return; + } + } else if (event.type == WebInputEvent::GesturePinchBegin) { + ASSERT(!m_expectPinchUpdateEnd); +#ifndef NDEBUG + m_expectPinchUpdateEnd = true; +#endif + m_inputHandlerClient->pinchGestureBegin(); + m_client->didHandleInputEvent(); + return; + } else if (event.type == WebInputEvent::GesturePinchEnd) { + ASSERT(m_expectPinchUpdateEnd); +#ifndef NDEBUG + m_expectPinchUpdateEnd = false; +#endif + m_inputHandlerClient->pinchGestureEnd(); + m_client->didHandleInputEvent(); + return; + } else if (event.type == WebInputEvent::GesturePinchUpdate) { + ASSERT(m_expectPinchUpdateEnd); + const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); + m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y)); + m_client->didHandleInputEvent(); + return; } m_client->didNotHandleInputEvent(true /* sendToWidget */); } diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index 1ebc1e155..a2f13025d 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -70,6 +70,12 @@ private: int m_identifier; WebCore::CCInputHandlerClient* m_inputHandlerClient; +#ifndef NDEBUG + bool m_expectScrollUpdateEnd; + bool m_expectPinchUpdateEnd; +#endif + bool m_scrollStarted; + static int s_nextAvailableIdentifier; static HashSet<WebCompositorInputHandlerImpl*>* s_compositors; }; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index c658ca0ca..dc126f0f5 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -123,7 +123,7 @@ void WebDevToolsFrontendImpl::dispatchOnInspectorFrontend(const WebString& messa args.append(ToV8String(message)); v8::TryCatch tryCatch; tryCatch.SetVerbose(true); - V8Proxy::instrumentedCallFunction(frame->frame()->page(), function, inspectorBackend, args.size(), args.data()); + V8Proxy::instrumentedCallFunction(frame->frame(), function, inspectorBackend, args.size(), args.data()); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 2524cf45b..f8d2034fd 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -2105,10 +2105,6 @@ void WebFrameImpl::createFrameView() m_frame->createView(webView->size(), Color::white, webView->isTransparent(), webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0); if (webView->shouldAutoResize() && isMainFrame) m_frame->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize()); - -#if ENABLE(GESTURE_RECOGNIZER) - webView->resetGestureRecognizer(); -#endif } WebFrameImpl* WebFrameImpl::fromFrame(Frame* frame) diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index ddd4736ab..64ba31170 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -155,6 +155,11 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W case WebInputEvent::GestureDoubleTap: m_type = PlatformEvent::GestureDoubleTap; break; + case WebInputEvent::GesturePinchBegin: + case WebInputEvent::GesturePinchEnd: + case WebInputEvent::GesturePinchUpdate: + // FIXME: Once PlatformGestureEvent is updated to support pinch, this should set m_type to appropriate PlatformEvent type. + ASSERT_NOT_REACHED(); default: ASSERT_NOT_REACHED(); } diff --git a/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp b/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp new file mode 100644 index 000000000..644bcf77b --- /dev/null +++ b/Source/WebKit/chromium/src/WebMediaStreamComponent.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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(MEDIA_STREAM) + +#include "platform/WebMediaStreamComponent.h" + +#include "MediaStreamComponent.h" +#include "platform/WebMediaStreamSource.h" +#include "platform/WebString.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebMediaStreamComponent::WebMediaStreamComponent(WebCore::MediaStreamComponent* mediaStreamComponent) + : m_private(mediaStreamComponent) +{ +} + +WebMediaStreamComponent& WebMediaStreamComponent::operator=(WebCore::MediaStreamComponent* mediaStreamComponent) +{ + m_private = mediaStreamComponent; + return *this; +} + +void WebMediaStreamComponent::reset() +{ + m_private.reset(); +} + +WebMediaStreamComponent::operator PassRefPtr<MediaStreamComponent>() const +{ + return m_private.get(); +} + +WebMediaStreamComponent::operator MediaStreamComponent*() const +{ + return m_private.get(); +} + +bool WebMediaStreamComponent::isEnabled() const +{ + ASSERT(!m_private.isNull()); + return m_private.get()->enabled(); +} + +WebMediaStreamSource WebMediaStreamComponent::source() const +{ + ASSERT(!m_private.isNull()); + return WebMediaStreamSource(m_private.get()->source()); +} + +} // namespace WebKit + +#endif // ENABLE(MEDIA_STREAM) + diff --git a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp index 7daf329e5..9faa4fd85 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamDescriptor.cpp @@ -37,6 +37,7 @@ #include "MediaStreamComponent.h" #include "MediaStreamDescriptor.h" #include "MediaStreamSource.h" +#include "platform/WebMediaStreamComponent.h" #include "platform/WebMediaStreamSource.h" #include "platform/WebString.h" #include <wtf/Vector.h> @@ -50,6 +51,11 @@ WebMediaStreamDescriptor::WebMediaStreamDescriptor(const PassRefPtr<WebCore::Med { } +WebMediaStreamDescriptor::WebMediaStreamDescriptor(WebCore::MediaStreamDescriptor* mediaStreamDescriptor) + : m_private(mediaStreamDescriptor) +{ +} + void WebMediaStreamDescriptor::reset() { m_private.reset(); @@ -74,21 +80,21 @@ void WebMediaStreamDescriptor::sources(WebVector<WebMediaStreamSource>& webSourc webSources.swap(result); } -void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamSource>& webSources) const +void WebMediaStreamDescriptor::audioSources(WebVector<WebMediaStreamComponent>& webSources) const { size_t numberOfSources = m_private->numberOfAudioComponents(); - WebVector<WebMediaStreamSource> result(numberOfSources); + WebVector<WebMediaStreamComponent> result(numberOfSources); for (size_t i = 0; i < numberOfSources; ++i) - result[i] = m_private->audioComponent(i)->source(); + result[i] = m_private->audioComponent(i); webSources.swap(result); } -void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamSource>& webSources) const +void WebMediaStreamDescriptor::videoSources(WebVector<WebMediaStreamComponent>& webSources) const { size_t numberOfSources = m_private->numberOfVideoComponents(); - WebVector<WebMediaStreamSource> result(numberOfSources); + WebVector<WebMediaStreamComponent> result(numberOfSources); for (size_t i = 0; i < numberOfSources; ++i) - result[i] = m_private->videoComponent(i)->source(); + result[i] = m_private->videoComponent(i); webSources.swap(result); } diff --git a/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp b/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp new file mode 100644 index 000000000..ea8868009 --- /dev/null +++ b/Source/WebKit/chromium/src/WebMediaStreamSourcesRequest.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * 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(MEDIA_STREAM) + +#include "platform/WebMediaStreamSourcesRequest.h" + +#include "MediaStreamCenter.h" +#include "MediaStreamSource.h" +#include "platform/WebMediaStreamSource.h" +#include "platform/WebVector.h" +#include <wtf/Vector.h> + +using namespace WebCore; + +namespace WebKit { + +WebMediaStreamSourcesRequest::WebMediaStreamSourcesRequest(const PassRefPtr<WebCore::MediaStreamSourcesQueryClient>& queryClient) + : m_private(queryClient) +{ +} + +void WebMediaStreamSourcesRequest::reset() +{ + m_private.reset(); +} + +bool WebMediaStreamSourcesRequest::audio() const +{ + ASSERT(!isNull()); + return m_private->audio(); +} + +bool WebMediaStreamSourcesRequest::video() const +{ + ASSERT(!isNull()); + return m_private->video(); +} + +void WebMediaStreamSourcesRequest::didCompleteQuery(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources) const +{ + ASSERT(!isNull()); + MediaStreamSourceVector audio; + for (size_t i = 0; i < audioSources.size(); ++i) { + MediaStreamSource* curr = audioSources[i]; + audio.append(curr); + } + MediaStreamSourceVector video; + for (size_t i = 0; i < videoSources.size(); ++i) { + MediaStreamSource* curr = videoSources[i]; + video.append(curr); + } + m_private->didCompleteQuery(audio, video); +} + +} // namespace WebKit + +#endif // ENABLE(MEDIA_STREAM) + diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index da0e32555..ca0583488 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -307,13 +307,12 @@ void WebPageSerializerImpl::openTagToString(Element* element, // Add open tag result += "<" + element->nodeName().lower(); // Go through all attributes and serialize them. - const NamedNodeMap *attrMap = element->updatedAttributes(); - if (attrMap) { - unsigned numAttrs = attrMap->length(); + if (element->hasAttributes()) { + unsigned numAttrs = element->attributeCount(); for (unsigned i = 0; i < numAttrs; i++) { result += " "; // Add attribute pair - const Attribute *attribute = attrMap->attributeItem(i); + const Attribute *attribute = element->attributeItem(i); result += attribute->name().toString(); result += "=\""; if (!attribute->value().isEmpty()) { diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index a8f6d126b..129088ef4 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -493,7 +493,7 @@ WebCore::LayerChromium* WebPluginContainerImpl::platformLayer() const ScrollbarGroup* WebPluginContainerImpl::scrollbarGroup() { if (!m_scrollbarGroup) - m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->page())); + m_scrollbarGroup = adoptPtr(new ScrollbarGroup(m_element->document()->frame()->view())); return m_scrollbarGroup.get(); } diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 687b03360..3f328f55b 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -51,9 +51,8 @@ #include "platform/WebRect.h" #include <skia/ext/platform_canvas.h> -#if ENABLE(GESTURE_RECOGNIZER) +#if ENABLE(GESTURE_EVENTS) #include "PlatformGestureEvent.h" -#include "PlatformGestureRecognizer.h" #endif using namespace WebCore; @@ -73,9 +72,6 @@ WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) WebPopupMenuImpl::WebPopupMenuImpl(WebWidgetClient* client) : m_client(client) , m_widget(0) -#if ENABLE(GESTURE_RECOGNIZER) - , m_gestureRecognizer(WebCore::PlatformGestureRecognizer::create()) -#endif { // Set to impossible point so we always get the first mouse position. m_lastMousePosition = WebPoint(-1, -1); @@ -143,11 +139,6 @@ bool WebPopupMenuImpl::handleTouchEvent(const WebTouchEvent& event) PlatformTouchEventBuilder touchEventBuilder(m_widget, event); bool defaultPrevented(m_widget->handleTouchEvent(touchEventBuilder)); -#if ENABLE(GESTURE_RECOGNIZER) - OwnPtr<Vector<WebCore::PlatformGestureEvent> > gestureEvents(m_gestureRecognizer->processTouchEventForGestures(touchEventBuilder, defaultPrevented)); - for (unsigned int i = 0; i < gestureEvents->size(); i++) - m_widget->handleGestureEvent((*gestureEvents)[i]); -#endif return defaultPrevented; } #endif @@ -284,6 +275,12 @@ bool WebPopupMenuImpl::handleInputEvent(const WebInputEvent& inputEvent) case WebInputEvent::MouseEnter: case WebInputEvent::ContextMenu: return false; + + case WebInputEvent::GesturePinchBegin: + case WebInputEvent::GesturePinchEnd: + case WebInputEvent::GesturePinchUpdate: + // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll. + return false; } return false; } diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index 0ad03963a..a3fddb6d0 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -139,10 +139,6 @@ public: // This is a non-owning ref. The popup will notify us via popupClosed() // before it is destroyed. WebCore::FramelessScrollView* m_widget; - -#if ENABLE(GESTURE_RECOGNIZER) - OwnPtr<WebCore::PlatformGestureRecognizer> m_gestureRecognizer; -#endif }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 2723ca78b..11e9c337b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -298,6 +298,11 @@ void WebSettingsImpl::setPrivilegedWebGLExtensionsEnabled(bool enabled) m_settings->setPrivilegedWebGLExtensionsEnabled(enabled); } +void WebSettingsImpl::setWebGLErrorsToConsoleEnabled(bool enabled) +{ + m_settings->setWebGLErrorsToConsoleEnabled(enabled); +} + void WebSettingsImpl::setShowDebugBorders(bool show) { m_settings->setShowDebugBorders(show); diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 63a00a099..45e62db6f 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -90,6 +90,7 @@ public: virtual void setExperimentalWebGLEnabled(bool); virtual void setOpenGLMultisamplingEnabled(bool); virtual void setPrivilegedWebGLExtensionsEnabled(bool); + virtual void setWebGLErrorsToConsoleEnabled(bool); virtual void setShowDebugBorders(bool); virtual void setShowFPSCounter(bool); virtual bool showFPSCounter() const { return m_showFPSCounter; } diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index 0f59a93d0..0d6e4db78 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -41,25 +41,11 @@ using namespace WebCore; namespace WebKit { -static TextCheckingType toCoreCheckingType(WebTextCheckingResult::Error error) -{ - if (error == WebTextCheckingResult::ErrorSpelling) - return TextCheckingTypeSpelling; - ASSERT(error == WebTextCheckingResult::ErrorGrammar); - return TextCheckingTypeGrammar; -} - static Vector<TextCheckingResult> toCoreResults(const WebVector<WebTextCheckingResult>& results) { Vector<TextCheckingResult> coreResults; - for (size_t i = 0; i < results.size(); ++i) { - TextCheckingResult coreResult; - coreResult.type = toCoreCheckingType(results[i].error); - coreResult.location = results[i].position; - coreResult.length = results[i].length; - coreResults.append(coreResult); - } - + for (size_t i = 0; i < results.size(); ++i) + coreResults.append(results[i]); return coreResults; } diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 84de7729c..a05e98920 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -148,10 +148,6 @@ #include "PlatformGestureEvent.h" #endif -#if ENABLE(GESTURE_RECOGNIZER) -#include "PlatformGestureRecognizer.h" -#endif - #if USE(CG) #include <CoreGraphics/CGBitmapContext.h> #include <CoreGraphics/CGContext.h> @@ -375,9 +371,6 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #endif , m_deviceOrientationClientProxy(adoptPtr(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0))) , m_geolocationClientProxy(adoptPtr(new GeolocationClientProxy(client ? client->geolocationClient() : 0))) -#if ENABLE(GESTURE_RECOGNIZER) - , m_gestureRecognizer(WebCore::PlatformGestureRecognizer::create()) -#endif #if ENABLE(MEDIA_STREAM) , m_userMediaClientImpl(this) #endif @@ -800,13 +793,6 @@ bool WebViewImpl::touchEvent(const WebTouchEvent& event) PlatformTouchEventBuilder touchEventBuilder(mainFrameImpl()->frameView(), event); bool defaultPrevented = mainFrameImpl()->frame()->eventHandler()->handleTouchEvent(touchEventBuilder); - -#if ENABLE(GESTURE_RECOGNIZER) - OwnPtr<Vector<WebCore::PlatformGestureEvent> > gestureEvents(m_gestureRecognizer->processTouchEventForGestures(touchEventBuilder, defaultPrevented)); - for (unsigned int i = 0; i < gestureEvents->size(); i++) - mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(gestureEvents->at(i)); -#endif - return defaultPrevented; } #endif @@ -1206,7 +1192,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect RefPtr<ByteArray> pixelArray(ByteArray::create(rect.width() * rect.height() * 4)); if (imageBuffer && pixelArray) { m_layerTreeHost->compositeAndReadback(pixelArray->data(), invertRect); - imageBuffer->putPremultipliedImageData(pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint()); + imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint()); gc.save(); gc.translate(IntSize(0, bitmapHeight)); gc.scale(FloatSize(1.0f, -1.0f)); @@ -1430,6 +1416,15 @@ bool WebViewImpl::handleInputEvent(const WebInputEvent& inputEvent) break; #endif +#if ENABLE(GESTURE_EVENTS) + case WebInputEvent::GesturePinchBegin: + case WebInputEvent::GesturePinchEnd: + case WebInputEvent::GesturePinchUpdate: + // FIXME: Once PlatformGestureEvent is updated to support pinch, this should call handleGestureEvent, just like it currently does for gesture scroll. + handled = false; + break; +#endif + default: handled = false; } @@ -3180,13 +3175,6 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, #endif } -#if ENABLE(GESTURE_RECOGNIZER) -void WebViewImpl::resetGestureRecognizer() -{ - m_gestureRecognizer->reset(); -} -#endif - #if ENABLE(POINTER_LOCK) bool WebViewImpl::requestPointerLock() { diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index a039a09ce..800d18254 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -68,9 +68,6 @@ class PopupMenuClient; class Range; class RenderTheme; class Widget; -#if ENABLE(GESTURE_RECOGNIZER) -class PlatformGestureRecognizer; -#endif } namespace WebKit { @@ -458,10 +455,6 @@ public: // a plugin can update its own zoom, say because of its own UI. void fullFramePluginZoomLevelChanged(double zoomLevel); -#if ENABLE(GESTURE_RECOGNIZER) - void resetGestureRecognizer(); -#endif - void loseCompositorContext(int numTimes); void enterFullScreenForElement(WebCore::Element*); @@ -690,10 +683,6 @@ private: OwnPtr<DeviceOrientationClientProxy> m_deviceOrientationClientProxy; OwnPtr<GeolocationClientProxy> m_geolocationClientProxy; -#if ENABLE(GESTURE_RECOGNIZER) - OwnPtr<WebCore::PlatformGestureRecognizer> m_gestureRecognizer; -#endif - #if ENABLE(MEDIA_STREAM) UserMediaClientImpl m_userMediaClientImpl; #endif diff --git a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp index 799599ab3..796ab166d 100644 --- a/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebWorkerClientImpl.cpp @@ -187,8 +187,10 @@ void WebWorkerClientImpl::workerContextDestroyed() m_proxy->workerContextDestroyed(); } -bool WebWorkerClientImpl::allowFileSystem() +bool WebWorkerClientImpl::allowFileSystem() { + if (m_proxy->askedToTerminate()) + return false; WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); if (!webView) return false; @@ -203,6 +205,8 @@ void WebWorkerClientImpl::openFileSystem(WebFileSystem::Type type, long long siz bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) { + if (m_proxy->askedToTerminate()) + return false; WebKit::WebViewImpl* webView = m_webFrame->viewImpl(); if (!webView) return false; @@ -210,7 +214,9 @@ bool WebWorkerClientImpl::allowDatabase(WebFrame*, const WebString& name, const } WebView* WebWorkerClientImpl::view() const -{ +{ + if (m_proxy->askedToTerminate()) + return 0; return m_webFrame->view(); } diff --git a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp index 0f379d64e..a9f7b1c1a 100644 --- a/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCDamageTrackerTest.cpp @@ -70,7 +70,7 @@ void emulateDrawingOneFrame(CCLayerImpl* root) // Iterate back-to-front, so that damage correctly propagates from descendant surfaces to ancestors. for (int i = renderSurfaceLayerList.size() - 1; i >= 0; --i) { CCRenderSurface* targetSurface = renderSurfaceLayerList[i]->renderSurface(); - targetSurface->damageTracker()->updateDamageRectForNextFrame(targetSurface->layerList(), targetSurface->owningLayerId(), renderSurfaceLayerList[i]->maskLayer()); + targetSurface->damageTracker()->updateDamageTrackingState(targetSurface->layerList(), targetSurface->owningLayerId(), renderSurfaceLayerList[i]->maskLayer()); } root->resetAllChangeTrackingForSubtree(); @@ -748,4 +748,27 @@ TEST_F(CCDamageTrackerTest, verifyDamageForReplicaMask) EXPECT_FLOAT_RECT_EQ(FloatRect(194, 200, 6, 8), childDamageRect); } +TEST_F(CCDamageTrackerTest, verifyDamageWhenReset) +{ + RefPtr<CCLayerImpl> root = createAndSetUpTestTreeWithOneSurface(); + RefPtr<CCLayerImpl> child = root->children()[0]; + + // Case 1: This test ensures that when the tracker is forced to have full damage, that + // it takes priority over any other partial damage. + // + child->setUpdateRect(FloatRect(10, 11, 12, 13)); + root->renderSurface()->damageTracker()->forceFullDamageNextUpdate(); + emulateDrawingOneFrame(root.get()); + FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); + EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); + + // Case 2: An additional sanity check that forcing full damage works even when nothing + // on the layer tree changed. + // + root->renderSurface()->damageTracker()->forceFullDamageNextUpdate(); + emulateDrawingOneFrame(root.get()); + rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect(); + EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 500, 500), rootDamageRect); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 41fe4fb65..fc414f739 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -1102,6 +1102,9 @@ public: { IntSize viewportSize(10, 10); layerTreeHost()->setViewportSize(viewportSize); + + layerTreeHost()->updateLayers(); + EXPECT_EQ(viewportSize, layerTreeHost()->viewportSize()); EXPECT_EQ(TextureManager::highLimitBytes(viewportSize), layerTreeHost()->contentsTextureManager()->maxMemoryLimitBytes()); EXPECT_EQ(TextureManager::reclaimLimitBytes(viewportSize), layerTreeHost()->contentsTextureManager()->preferredMemoryLimitBytes()); @@ -1144,16 +1147,15 @@ public: class CCLayerTreeHostTestAtomicCommit : public CCLayerTreeHostTest { public: CCLayerTreeHostTestAtomicCommit() - : m_updateCheckLayer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) - , m_numCommits(0) + : m_layer(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) { // Make sure partial texture updates are turned off. - m_settings.partialTextureUpdates = false; + m_settings.maxPartialTextureUpdates = 0; } virtual void beginTest() { - m_layerTreeHost->setRootLayer(m_updateCheckLayer); + m_layerTreeHost->setRootLayer(m_layer); m_layerTreeHost->setViewportSize(IntSize(10, 10)); postSetNeedsCommitToMainThread(); @@ -1170,7 +1172,7 @@ public: EXPECT_EQ(1, context->numTextures()); // Number of textures used for commit should be one. EXPECT_EQ(1, context->numUsedTextures()); - // Verify used texture is correct. + // Verify that used texture is correct. EXPECT_TRUE(context->usedTexture(context->texture(0))); context->resetUsedTextures(); @@ -1211,7 +1213,7 @@ public: virtual void layout() { - m_updateCheckLayer->setNeedsDisplay(); + m_layer->setNeedsDisplay(); } virtual void afterTest() @@ -1220,8 +1222,7 @@ public: private: MockContentLayerDelegate m_delegate; - RefPtr<ContentLayerChromiumWithUpdateTracking> m_updateCheckLayer; - int m_numCommits; + RefPtr<ContentLayerChromiumWithUpdateTracking> m_layer; }; TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) @@ -1229,6 +1230,132 @@ TEST_F(CCLayerTreeHostTestAtomicCommit, runMultiThread) runTest(true); } +class CCLayerTreeHostTestAtomicCommitWithPartialUpdate : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestAtomicCommitWithPartialUpdate() + : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) + , m_child(ContentLayerChromiumWithUpdateTracking::create(&m_delegate)) + , m_numCommits(0) + { + // Allow one partial texture update. + m_settings.maxPartialTextureUpdates = 1; + } + + virtual void beginTest() + { + m_layerTreeHost->setRootLayer(m_parent); + m_layerTreeHost->setViewportSize(IntSize(10, 10)); + m_parent->addChild(m_child); + m_child->setOpacity(0.5); + m_child->setBounds(IntSize(20, 20)); + + postSetNeedsCommitToMainThread(); + postSetNeedsRedrawToMainThread(); + } + + virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl) + { + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); + + switch (impl->frameNumber()) { + case 0: + // Number of textures should be two. + EXPECT_EQ(2, context->numTextures()); + // Number of textures used for commit should be two. + EXPECT_EQ(2, context->numUsedTextures()); + // Verify that used textures are correct. + EXPECT_TRUE(context->usedTexture(context->texture(0))); + EXPECT_TRUE(context->usedTexture(context->texture(1))); + + context->resetUsedTextures(); + break; + case 1: + // Number of textures should be four as the first two + // textures are used by the impl thread. + EXPECT_EQ(4, context->numTextures()); + // Number of textures used for commit should still be two. + EXPECT_EQ(2, context->numUsedTextures()); + // First two textures should not have been used. + EXPECT_FALSE(context->usedTexture(context->texture(0))); + EXPECT_FALSE(context->usedTexture(context->texture(1))); + // New textures should have been used. + EXPECT_TRUE(context->usedTexture(context->texture(2))); + EXPECT_TRUE(context->usedTexture(context->texture(3))); + + context->resetUsedTextures(); + break; + case 2: + // Number of textures should be three as we allow one + // partial update and the first two textures are used by + // the impl thread. + EXPECT_EQ(3, context->numTextures()); + // Number of textures used for commit should still be two. + EXPECT_EQ(2, context->numUsedTextures()); + // First texture should not have been used. + EXPECT_FALSE(context->usedTexture(context->texture(0))); + // Second texture should have been used. + EXPECT_TRUE(context->usedTexture(context->texture(1))); + // New textures should have been used. + EXPECT_TRUE(context->usedTexture(context->texture(2))); + + context->resetUsedTextures(); + break; + default: + ASSERT_NOT_REACHED(); + break; + } + } + + virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl) + { + CompositorFakeWebGraphicsContext3DWithTextureTracking* context = static_cast<CompositorFakeWebGraphicsContext3DWithTextureTracking*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(impl->context())); + + // Number of textures used for drawing should always be two. + EXPECT_EQ(2, context->numUsedTextures()); + + if (impl->frameNumber() < 3) { + context->resetUsedTextures(); + postSetNeedsAnimateAndCommitToMainThread(); + postSetNeedsRedrawToMainThread(); + } else + endTest(); + } + + virtual void layout() + { + switch (m_numCommits++) { + case 0: + case 1: + m_parent->setNeedsDisplay(); + m_child->setNeedsDisplay(); + break; + case 2: + // Damage part of layers. + m_parent->setNeedsDisplayRect(FloatRect(0, 0, 5, 5)); + m_child->setNeedsDisplayRect(FloatRect(0, 0, 5, 5)); + break; + default: + ASSERT_NOT_REACHED(); + break; + } + } + + virtual void afterTest() + { + } + +private: + MockContentLayerDelegate m_delegate; + RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent; + RefPtr<ContentLayerChromiumWithUpdateTracking> m_child; + int m_numCommits; +}; + +TEST_F(CCLayerTreeHostTestAtomicCommitWithPartialUpdate, runMultiThread) +{ + runTest(true); +} + #define EXPECT_EQ_RECT(a, b) \ EXPECT_EQ(a.x(), b.x()); \ EXPECT_EQ(a.y(), b.y()); \ @@ -1469,4 +1596,61 @@ public: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerOcclusion) +class CCLayerTreeHostTestManySurfaces : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestManySurfaces() { } + + virtual void beginTest() + { + // We create enough RenderSurfaces that it will trigger Vector reallocation while computing occlusion. + Region occluded; + const TransformationMatrix identityMatrix; + Vector<RefPtr<TestLayerChromium> > layers; + Vector<RefPtr<TestLayerChromium> > children; + int numSurfaces = 20; + RefPtr<TestLayerChromium> replica = TestLayerChromium::create(); + + for (int i = 0; i < numSurfaces; ++i) { + layers.append(TestLayerChromium::create()); + if (!i) { + setLayerPropertiesForTesting(layers.last().get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(100, 100), true); + layers.last()->createRenderSurface(); + } else { + setLayerPropertiesForTesting(layers.last().get(), layers[layers.size()-2].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(1, 1), IntSize(100-i, 100-i), true); + layers.last()->setMasksToBounds(true); + layers.last()->setReplicaLayer(replica.get()); // Make it have a RenderSurface + } + } + + for (int i = 1; i < numSurfaces; ++i) { + children.append(TestLayerChromium::create()); + setLayerPropertiesForTesting(children.last().get(), layers[i].get(), identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(500, 500), false); + } + + m_layerTreeHost->setRootLayer(layers[0].get()); + m_layerTreeHost->setViewportSize(layers[0]->bounds()); + m_layerTreeHost->updateLayers(); + m_layerTreeHost->commitComplete(); + + for (int i = 0; i < numSurfaces-1; ++i) { + IntRect expectedOcclusion(i+1, i+1, 100-i-1, 100-i-1); + + EXPECT_EQ_RECT(expectedOcclusion, layers[i]->occludedScreenSpace().bounds()); + EXPECT_EQ(1u, layers[i]->occludedScreenSpace().rects().size()); + } + + // Kill the layerTreeHost immediately. + m_layerTreeHost->setRootLayer(0); + m_layerTreeHost.clear(); + + endTest(); + } + + virtual void afterTest() + { + } +}; + +SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestManySurfaces) + } // namespace diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp index 1df27c011..4b3dd27d3 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerChromiumTest.cpp @@ -75,12 +75,6 @@ namespace WebCore { class Canvas2DLayerChromiumTest : public Test { protected: - // This indirection is needed because individual tests aren't friends of Canvas2DLayerChromium. - void setTextureManager(Canvas2DLayerChromium* layer, TextureManager* manager) - { - layer->setTextureManager(manager); - } - void fullLifecycleTest(bool threaded) { GraphicsContext3D::Attributes attrs; @@ -133,7 +127,7 @@ protected: RefPtr<Canvas2DLayerChromium> canvas = Canvas2DLayerChromium::create(mainContext.get(), size); canvas->setIsDrawable(true); - setTextureManager(canvas.get(), textureManager.get()); + canvas->setTextureManager(textureManager.get()); canvas->setBounds(IntSize(600, 300)); canvas->setTextureId(backTextureId); diff --git a/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp b/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp index c2311a843..2b76b80ad 100644 --- a/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp +++ b/Source/WebKit/chromium/tests/FakeGraphicsContext3DTest.cpp @@ -101,13 +101,13 @@ private: }; -TEST(FakeGraphicsContext3DTest, ContextForThisThreadShouldMakeCurrent) +TEST(FakeGraphicsContext3DTest, ContextForThisThreadShouldNotMakeCurrent) { GraphicsContext3D::Attributes attrs; RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextThatCountsMakeCurrents()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread); EXPECT_TRUE(context); ContextThatCountsMakeCurrents& mockContext = *static_cast<ContextThatCountsMakeCurrents*>(GraphicsContext3DPrivate::extractWebGraphicsContext3D(context.get())); - EXPECT_EQ(1, mockContext.makeCurrentCount()); + EXPECT_EQ(0, mockContext.makeCurrentCount()); } TEST(FakeGraphicsContext3DTest, ContextForAnotherThreadShouldNotMakeCurrent) @@ -119,15 +119,3 @@ TEST(FakeGraphicsContext3DTest, ContextForAnotherThreadShouldNotMakeCurrent) EXPECT_EQ(0, mockContext.makeCurrentCount()); } -class ContextWithMakeCurrentThatFails : public FakeWebGraphicsContext3D { -public: - ContextWithMakeCurrentThatFails() { } - virtual bool makeContextCurrent() { return false; } -}; - -TEST(FakeGraphicsContext3DTest, ContextForThisThreadFailsWhenMakeCurrentFails) -{ - GraphicsContext3D::Attributes attrs; - RefPtr<GraphicsContext3D> context = GraphicsContext3DPrivate::createGraphicsContextFromWebContext(adoptPtr(new ContextWithMakeCurrentThatFails()), attrs, 0, GraphicsContext3D::RenderDirectlyToHostWindow, GraphicsContext3DPrivate::ForUseOnThisThread); - EXPECT_FALSE(context); -} diff --git a/Source/WebKit/chromium/tests/InnerGestureRecognizerTest.cpp b/Source/WebKit/chromium/tests/InnerGestureRecognizerTest.cpp deleted file mode 100644 index 191054e4b..000000000 --- a/Source/WebKit/chromium/tests/InnerGestureRecognizerTest.cpp +++ /dev/null @@ -1,759 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * 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 "GestureRecognizerChromium.h" - -#include <gtest/gtest.h> -#include <stdarg.h> - -using namespace WebCore; - -class InspectableGestureRecognizerChromium : public WebCore::GestureRecognizerChromium { -public: - InspectableGestureRecognizerChromium() - : WebCore::GestureRecognizerChromium() - { - } - - int signature(State gestureState, unsigned id, PlatformTouchPoint::State touchType, bool handled) - { - return GestureRecognizerChromium::signature(gestureState, id, touchType, handled); - }; - - IntPoint firstTouchPosition() { return m_firstTouchPosition; }; - - void setFirstTouchTime(double t) { m_firstTouchTime = t; }; - double firstTouchTime() { return m_firstTouchTime; }; - - void setLastTouchTime(double t) { m_lastTouchTime = t; }; - double lastTouchTime() { return m_lastTouchTime; }; - - GestureRecognizerChromium::GestureTransitionFunction edgeFunction(int hash) - { - return m_edgeFunctions.get(hash); - }; - - virtual void updateValues(double d, const PlatformTouchPoint &p) - { - GestureRecognizerChromium::updateValues(d, p); - }; - - void addEdgeFunction(State state, unsigned finger, PlatformTouchPoint::State touchState, bool touchHandledByJavaScript, GestureTransitionFunction function) - { - GestureRecognizerChromium::addEdgeFunction(state, finger, touchState, touchHandledByJavaScript, function); - }; - - bool stubEdgeFunction(const PlatformTouchPoint&, GestureRecognizerChromium::Gestures*); - - void setStateTest(State value) - { - GestureRecognizerChromium::setState(value); - }; - - bool isInsideManhattanSquare(const PlatformTouchPoint& touchPoint) - { - return GestureRecognizerChromium::isInsideManhattanSquare(touchPoint); - }; - - bool isInClickTimeWindow() - { - return GestureRecognizerChromium::isInClickTimeWindow(); - }; - -}; - -bool InspectableGestureRecognizerChromium::stubEdgeFunction(const PlatformTouchPoint&, GestureRecognizerChromium::Gestures*) -{ - return false; -} - -class BuildablePlatformTouchPoint : public WebCore::PlatformTouchPoint { -public: - BuildablePlatformTouchPoint(); - BuildablePlatformTouchPoint(int x, int y); - BuildablePlatformTouchPoint(int x, int y, PlatformTouchPoint::State); - - void setX(int x) - { - m_pos.setX(x); - m_screenPos.setX(x); - }; - - void setY(int y) - { - m_pos.setY(y); - m_screenPos.setY(y); - }; -}; - -BuildablePlatformTouchPoint::BuildablePlatformTouchPoint() -{ - m_id = 0; - m_state = PlatformTouchPoint::TouchStationary; - m_pos = IntPoint::zero(); - m_screenPos = IntPoint::zero(); -} - -BuildablePlatformTouchPoint::BuildablePlatformTouchPoint(int x, int y) -{ - m_id = 0; - m_state = PlatformTouchPoint::TouchStationary; - m_pos = IntPoint(x, y); - m_screenPos = IntPoint(x, y); -} - -BuildablePlatformTouchPoint::BuildablePlatformTouchPoint(int x, int y, PlatformTouchPoint::State state) -{ - m_id = 0; - m_state = state; - m_pos = IntPoint(x, y); - m_screenPos = IntPoint(x, y); -} - -class BuildablePlatformTouchEvent : public WebCore::PlatformTouchEvent { -public: - BuildablePlatformTouchEvent(WebCore::PlatformEvent::Type type, PlatformTouchPoint& point, double time) - { - m_type = type; - m_touchPoints.append(point); - m_timestamp = time; - } - - BuildablePlatformTouchEvent(WebCore::PlatformEvent::Type type, PlatformTouchPoint& point) - { - m_type = type; - m_touchPoints.append(point); - m_timestamp = 100.; - } -}; - -class GestureRecognizerTest : public testing::Test { -public: - GestureRecognizerTest() { } - -protected: - virtual void SetUp() { } - virtual void TearDown() { } -}; - -void SimulateAndTestFirstClick(InspectableGestureRecognizerChromium& gm) -{ - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000.); - OwnPtr<Vector<WebCore::PlatformGestureEvent> > gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ((unsigned int)1, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint release(10, 16, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.7); - OwnPtr<Vector<WebCore::PlatformGestureEvent> > gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ((unsigned int)1, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureTap, (*gestureEnd)[0].type()); -} - -typedef OwnPtr<Vector<WebCore::PlatformGestureEvent> > Gestures; - -TEST_F(GestureRecognizerTest, hash) -{ - InspectableGestureRecognizerChromium testGm; - const unsigned FirstFinger = 0; - const unsigned SecondFinger = 1; - - ASSERT_EQ(1 + 0, testGm.signature(GestureRecognizerChromium::NoGesture, FirstFinger, PlatformTouchPoint::TouchReleased, false)); - - ASSERT_EQ(1 + ((8 | 1) << 1), testGm.signature(GestureRecognizerChromium::NoGesture, FirstFinger, PlatformTouchPoint::TouchPressed, true)); - - ASSERT_EQ(1 + ((0x10000 | 2) << 1), testGm.signature(GestureRecognizerChromium::PendingSyntheticClick, FirstFinger, PlatformTouchPoint::TouchMoved, false)); - - ASSERT_EQ(1 + (0x20000 << 1), testGm.signature(GestureRecognizerChromium::Scroll, FirstFinger, PlatformTouchPoint::TouchReleased, false)); - - ASSERT_EQ(1 + ((0x20000 | 1) << 1), testGm.signature(GestureRecognizerChromium::Scroll, FirstFinger, PlatformTouchPoint::TouchPressed, false)); - - ASSERT_EQ(1 + ((0x20000 | 0x10 | 8 | 1) << 1), testGm.signature(GestureRecognizerChromium::Scroll, SecondFinger, PlatformTouchPoint::TouchPressed, true)); -} - -TEST_F(GestureRecognizerTest, state) -{ - InspectableGestureRecognizerChromium testGm; - - ASSERT_EQ(0, testGm.state()); - testGm.setStateTest(GestureRecognizerChromium::PendingSyntheticClick); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, testGm.state()); -} - -TEST_F(GestureRecognizerTest, isInsideManhattanSquare) -{ - InspectableGestureRecognizerChromium gm; - BuildablePlatformTouchPoint p; - - ASSERT_EQ(0.0, gm.firstTouchPosition().x()); - ASSERT_EQ(0.0, gm.firstTouchPosition().y()); - - p.setX(0.0); - p.setY(19.999); - ASSERT_TRUE(gm.isInsideManhattanSquare(p)); - - p.setX(19.999); - p.setY(0.0); - ASSERT_TRUE(gm.isInsideManhattanSquare(p)); - - p.setX(20.0); - p.setY(0.0); - ASSERT_FALSE(gm.isInsideManhattanSquare(p)); - - p.setX(0.0); - p.setY(20.0); - ASSERT_FALSE(gm.isInsideManhattanSquare(p)); - - p.setX(-20.0); - p.setY(0.0); - ASSERT_FALSE(gm.isInsideManhattanSquare(p)); - - p.setX(0.0); - p.setY(-20.0); - ASSERT_FALSE(gm.isInsideManhattanSquare(p)); -} - -TEST_F(GestureRecognizerTest, isInClickTimeWindow) -{ - InspectableGestureRecognizerChromium gm; - - gm.setFirstTouchTime(0.0); - gm.setLastTouchTime(0.0); - ASSERT_FALSE(gm.isInClickTimeWindow()); - - gm.setFirstTouchTime(0.0); - gm.setLastTouchTime(0.010001); - ASSERT_TRUE(gm.isInClickTimeWindow()); - - gm.setFirstTouchTime(0.0); - gm.setLastTouchTime(0.8 - .00000001); - ASSERT_TRUE(gm.isInClickTimeWindow()); - - gm.setFirstTouchTime(0.0); - gm.setLastTouchTime(0.80001); - ASSERT_FALSE(gm.isInClickTimeWindow()); -} - -TEST_F(GestureRecognizerTest, addEdgeFunction) -{ - InspectableGestureRecognizerChromium gm; - gm.addEdgeFunction(GestureRecognizerChromium::Scroll, 0, PlatformTouchPoint::TouchReleased, true, reinterpret_cast<GestureRecognizerChromium::GestureTransitionFunction>(&InspectableGestureRecognizerChromium::stubEdgeFunction)); - - ASSERT_EQ(reinterpret_cast<GestureRecognizerChromium::GestureTransitionFunction>(&InspectableGestureRecognizerChromium::stubEdgeFunction), gm.edgeFunction(gm.signature(GestureRecognizerChromium::Scroll, 0, PlatformTouchPoint::TouchReleased, true))); -} - -TEST_F(GestureRecognizerTest, updateValues) -{ - InspectableGestureRecognizerChromium gm; - - ASSERT_EQ(0.0, gm.firstTouchTime()); - ASSERT_EQ(0.0, gm.lastTouchTime()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint p1(10, 11); - gm.updateValues(1.1, p1); - - ASSERT_EQ(10, gm.firstTouchPosition().x()); - ASSERT_EQ(11, gm.firstTouchPosition().y()); - ASSERT_EQ(1.1, gm.firstTouchTime()); - ASSERT_EQ(0.0, gm.lastTouchTime() - gm.firstTouchTime()); - - BuildablePlatformTouchPoint p2(13, 14); - gm.setStateTest(GestureRecognizerChromium::PendingSyntheticClick); - gm.updateValues(2.0, p2); - - ASSERT_EQ(10, gm.firstTouchPosition().x()); - ASSERT_EQ(11, gm.firstTouchPosition().y()); - ASSERT_EQ(1.1, gm.firstTouchTime()); - ASSERT_EQ(2.0 - 1.1, gm.lastTouchTime() - gm.firstTouchTime()); - - BuildablePlatformTouchPoint p3(23, 34); - gm.setStateTest(GestureRecognizerChromium::NoGesture); - gm.updateValues(3.0, p3); - - ASSERT_EQ(23, gm.firstTouchPosition().x()); - ASSERT_EQ(34, gm.firstTouchPosition().y()); - ASSERT_EQ(3.0, gm.firstTouchTime()); - ASSERT_EQ(0.0, gm.lastTouchTime() - gm.firstTouchTime()); -} - -#if OS(WINDOWS) -#define MAYBE_doubleTapGestureTest DISABLED_doubleTapGestureTest -#else -#define MAYBE_doubleTapGestureTest doubleTapGestureTest -#endif - -TEST_F(GestureRecognizerTest, DISABLED_doubleTapGestureTest) -{ - InspectableGestureRecognizerChromium gm; - SimulateAndTestFirstClick(gm); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000 + .5); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 16, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000 + .5 + .01); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - ASSERT_EQ(0u, gestureMove->size()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint release(10, 16, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000 + .5 + .02); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ(2u, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureTap, (*gestureEnd)[0].type()); - ASSERT_EQ(PlatformEvent::GestureDoubleTap, (*gestureEnd)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -TEST_F(GestureRecognizerTest, doubleTapGestureIncompleteTest) -{ - InspectableGestureRecognizerChromium gm; - SimulateAndTestFirstClick(gm); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000. + 0.7 + 0.01); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 50, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000. + 0.7 + 0.02); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - ASSERT_EQ(2u, gestureMove->size()); - ASSERT_EQ(PlatformEvent::GestureScrollBegin, (*gestureMove)[0].type()); - ASSERT_EQ(PlatformEvent::GestureScrollUpdate, (*gestureMove)[1].type()); - ASSERT_EQ(GestureRecognizerChromium::Scroll, gm.state()); - - BuildablePlatformTouchPoint release(10, 50, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.7 + 0.03); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ(1u, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureScrollEnd, (*gestureEnd)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -TEST_F(GestureRecognizerTest, doubleTapGestureIncompleteDueToSecondClickPositionTest) -{ - InspectableGestureRecognizerChromium gm; - SimulateAndTestFirstClick(gm); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - IntPoint awayFromFirstClick(24, 26); - - BuildablePlatformTouchPoint press(awayFromFirstClick.x(), awayFromFirstClick.y(), PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000. + 0.7 + 0.01); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint release(awayFromFirstClick.x(), awayFromFirstClick.y(), PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.7 + 0.025); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ(1u, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureTap, (*gestureEnd)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -TEST_F(GestureRecognizerTest, tapDownWithoutTapGestureTest) -{ - InspectableGestureRecognizerChromium gm; - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 50, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - for (unsigned int i = 0; i < gestureMove->size(); i++) - ASSERT_NE(PlatformEvent::GestureTap, (*gestureMove)[i].type()); - ASSERT_EQ(GestureRecognizerChromium::Scroll, gm.state()); - - BuildablePlatformTouchPoint release(10, 50, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - for (unsigned int i = 0; i < gestureEnd->size(); i++) - ASSERT_NE(PlatformEvent::GestureTap, (*gestureEnd)[i].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -TEST_F(GestureRecognizerTest, tapDownWithTapGestureTest) -{ - InspectableGestureRecognizerChromium gm; - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000.); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 16, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000.); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - ASSERT_EQ(0u, gestureMove->size()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint release(10, 16, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.011); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ(1u, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureTap, (*gestureEnd)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - - -TEST_F(GestureRecognizerTest, noDoubleTapGestureBecauseOfInterTouchIntervalTest) -{ - InspectableGestureRecognizerChromium gm; - SimulateAndTestFirstClick(gm); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - // Values are from GestureRecognizerChromium.cpp - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000 + .8 + 10 + .1); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ(1u, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 16, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000 + .8 + 10 + .1 + .05); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - ASSERT_EQ(0u, gestureMove->size()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint release(11, 17, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000 + .8 + 10 + .1 + .02); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ(1u, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureTap, (*gestureEnd)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - - - -TEST_F(GestureRecognizerTest, gestureScrollEvents) -{ - InspectableGestureRecognizerChromium gm; - - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000.); - gm.processTouchEventForGestures(pressEvent, false); - - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 50, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000. + 0.2); - Gestures gestureStart(gm.processTouchEventForGestures(moveEvent, false)); - bool scrollStarted = false, scrollUpdated = false; - for (unsigned int i = 0; i < gestureStart->size(); i++) { - switch ((*gestureStart)[i].type()) { - case PlatformEvent::GestureScrollBegin: - scrollStarted = true; - break; - case PlatformEvent::GestureScrollUpdate: - scrollUpdated = true; - break; - default: - ASSERT_TRUE(false); - } - } - - ASSERT_TRUE(scrollStarted); - ASSERT_TRUE(scrollUpdated); - ASSERT_EQ(GestureRecognizerChromium::Scroll, gm.state()); - - BuildablePlatformTouchPoint release(10, 50, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.2 + 0.2); - bool scrollEnd = false; - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - for (unsigned int i = 0; i < gestureEnd->size(); i++) { - switch ((*gestureEnd)[i].type()) { - case PlatformEvent::GestureScrollEnd: - scrollEnd = true; - ASSERT_EQ((*gestureEnd)[i].deltaX(), 0); - ASSERT_EQ((*gestureEnd)[i].deltaY(), 0); - break; - default: - ASSERT_TRUE(false); - } - } - ASSERT_TRUE(scrollEnd); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -TEST_F(GestureRecognizerTest, flickGestureTest) -{ - InspectableGestureRecognizerChromium gm; - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - BuildablePlatformTouchPoint press(10, 15, PlatformTouchPoint::TouchPressed); - BuildablePlatformTouchEvent pressEvent(WebCore::PlatformEvent::TouchStart, press, 1000.); - Gestures gestureStart(gm.processTouchEventForGestures(pressEvent, false)); - ASSERT_EQ((unsigned int)1, gestureStart->size()); - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()); - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()); - - BuildablePlatformTouchPoint move(10, 50, PlatformTouchPoint::TouchMoved); - BuildablePlatformTouchEvent moveEvent(WebCore::PlatformEvent::TouchMove, move, 1000. + 0.02); - Gestures gestureMove(gm.processTouchEventForGestures(moveEvent, false)); - bool scrollStarted = false, scrollUpdated = false; - for (unsigned int i = 0; i < gestureMove->size(); i++) { - switch ((*gestureMove)[i].type()) { - case PlatformEvent::GestureScrollBegin: - scrollStarted = true; - break; - case PlatformEvent::GestureScrollUpdate: - scrollUpdated = true; - break; - default: - ASSERT_TRUE(false); - } - } - - ASSERT_TRUE(scrollStarted); - ASSERT_TRUE(scrollUpdated); - ASSERT_EQ(GestureRecognizerChromium::Scroll, gm.state()); - - BuildablePlatformTouchPoint release(10, 50, PlatformTouchPoint::TouchReleased); - BuildablePlatformTouchEvent releaseEvent(WebCore::PlatformEvent::TouchEnd, release, 1000. + 0.06); - Gestures gestureEnd(gm.processTouchEventForGestures(releaseEvent, false)); - ASSERT_EQ((unsigned int) 1, gestureEnd->size()); - ASSERT_EQ(PlatformEvent::GestureScrollEnd, (*gestureEnd)[0].type()); - ASSERT_EQ((*gestureEnd)[0].deltaX(), 0); - ASSERT_EQ((*gestureEnd)[0].deltaY(), 1750.); - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); -} - -struct TouchPointAndEvent { -public: - TouchPointAndEvent(int x, int y, double timestamp, PlatformTouchPoint::State state, WebCore::PlatformEvent::Type type) - : m_point(x, y, state) - , m_event(type, m_point, timestamp) - { } - BuildablePlatformTouchPoint m_point; - BuildablePlatformTouchEvent m_event; -}; - -class TouchSequence { -public: - TouchSequence(int n, ...) : m_n(n) - { - va_list args; - va_start(args, n); - ASSERT(n > 0); - m_data = new TouchPointAndEvent*[n]; - for (int i = 0; i < n; ++i) - m_data[i] = va_arg(args, TouchPointAndEvent*); - va_end(args); - } - ~TouchSequence() - { - for (int i = 0; i < m_n; ++i) - delete m_data[i]; - delete[] m_data; - } - int m_n; - TouchPointAndEvent** m_data; -}; - -TEST_F(GestureRecognizerTest, sampleFlickSequenceGestureTest) -{ - const int numberOfFlickSamples = 11; - TouchSequence sampleFlickSequence[numberOfFlickSamples] = - { - TouchSequence(8, - new TouchPointAndEvent(256, 348, 1308336245.407, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(254, 345, 1308336245.470, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(252, 336, 1308336245.488, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(242, 261, 1308336245.505, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(242, 179, 1308336245.521, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(255, 100, 1308336245.533, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(262, 74, 1308336245.549, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(262, 74, 1308336245.566, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(8, - new TouchPointAndEvent(178, 339, 1308336266.180, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(177, 335, 1308336266.212, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(172, 314, 1308336266.226, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(160, 248, 1308336266.240, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(156, 198, 1308336266.251, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(166, 99, 1308336266.266, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(179, 41, 1308336266.280, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(179, 41, 1308336266.291, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(7, - new TouchPointAndEvent(238, 386, 1308336272.068, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(237, 383, 1308336272.121, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(236, 374, 1308336272.138, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(223, 264, 1308336272.155, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(231, 166, 1308336272.173, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(243, 107, 1308336272.190, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(243, 107, 1308336272.202, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(10, - new TouchPointAndEvent(334, 351, 1308336313.581, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(334, 348, 1308336313.694, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(335, 346, 1308336313.714, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(334, 343, 1308336313.727, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(332, 336, 1308336313.738, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(328, 316, 1308336313.753, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(317, 277, 1308336313.770, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(306, 243, 1308336313.784, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(292, 192, 1308336313.799, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(292, 192, 1308336313.815, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(14, - new TouchPointAndEvent(92, 112, 1308336323.955, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(92, 115, 1308336324.056, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(91, 116, 1308336324.066, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(91, 117, 1308336324.074, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(90, 122, 1308336324.089, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(90, 129, 1308336324.102, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(89, 147, 1308336324.120, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(89, 163, 1308336324.135, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(89, 188, 1308336324.151, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(89, 213, 1308336324.169, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(89, 252, 1308336324.189, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(90, 283, 1308336324.204, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(91, 308, 1308336324.218, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(91, 308, 1308336324.230, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(5, - new TouchPointAndEvent(55, 249, 1308336349.093, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(59, 249, 1308336349.179, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(66, 248, 1308336349.191, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(128, 253, 1308336349.208, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(128, 253, 1308336349.258, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(9, - new TouchPointAndEvent(376, 290, 1308336353.071, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(373, 288, 1308336353.127, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(372, 287, 1308336353.140, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(353, 280, 1308336353.156, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(319, 271, 1308336353.171, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(264, 258, 1308336353.188, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(215, 251, 1308336353.200, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(151, 246, 1308336353.217, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(151, 246, 1308336353.231, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(5, - new TouchPointAndEvent(60, 166, 1308336358.898, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(63, 166, 1308336358.944, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(68, 167, 1308336358.958, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(118, 179, 1308336358.971, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(118, 179, 1308336358.984, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(5, - new TouchPointAndEvent(66, 318, 1308336362.996, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(70, 316, 1308336363.046, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(77, 314, 1308336363.058, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(179, 295, 1308336363.082, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(179, 295, 1308336363.096, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(11, - new TouchPointAndEvent(345, 333, 1308336366.618, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(344, 330, 1308336366.664, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(343, 329, 1308336366.681, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(339, 324, 1308336366.694, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(332, 317, 1308336366.709, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(312, 300, 1308336366.728, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(279, 275, 1308336366.741, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(246, 251, 1308336366.752, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(198, 219, 1308336366.769, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(155, 196, 1308336366.783, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(155, 196, 1308336366.794, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ), - TouchSequence(7, - new TouchPointAndEvent(333, 360, 1308336369.547, PlatformTouchPoint::TouchPressed, WebCore::PlatformEvent::TouchStart), - new TouchPointAndEvent(332, 357, 1308336369.596, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(331, 353, 1308336369.661, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(326, 345, 1308336369.713, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(310, 323, 1308336369.748, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(250, 272, 1308336369.801, PlatformTouchPoint::TouchMoved, WebCore::PlatformEvent::TouchMove), - new TouchPointAndEvent(250, 272, 1308336369.840, PlatformTouchPoint::TouchReleased, WebCore::PlatformEvent::TouchEnd) - ) - }; - - InspectableGestureRecognizerChromium gm; - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()); - - for (int i = 0; i < numberOfFlickSamples; ++i) { - std::ostringstream failureMessageBuilder; - failureMessageBuilder << "Failed on sample sequence " << i; - std::string failureMessage = failureMessageBuilder.str(); - - // There should be at least 3 events (TouchStart, TouchMove, TouchEnd) in every sequence - ASSERT_GT(sampleFlickSequence[i].m_n, 3) << failureMessage; - - // First event (TouchStart) should produce a TouchDown gesture - Gestures gestureStart(gm.processTouchEventForGestures(sampleFlickSequence[i].m_data[0]->m_event, false)); - ASSERT_EQ((unsigned int)1, gestureStart->size()) << failureMessage; - ASSERT_EQ(PlatformEvent::GestureTapDown, (*gestureStart)[0].type()) << failureMessage; - ASSERT_EQ(GestureRecognizerChromium::PendingSyntheticClick, gm.state()) << failureMessage; - - // Then we have a bunch of TouchMove events - for (int j = 1; j < sampleFlickSequence[i].m_n - 1; ++j) - gm.processTouchEventForGestures(sampleFlickSequence[i].m_data[j]->m_event, false); - - // Last event (TouchEnd) should generate a Flick gesture - Gestures gestureEnd(gm.processTouchEventForGestures(sampleFlickSequence[i].m_data[sampleFlickSequence[i].m_n - 1]->m_event, false)); - ASSERT_EQ((unsigned int) 1, gestureEnd->size()) << failureMessage; - ASSERT_EQ(PlatformEvent::GestureScrollEnd, (*gestureEnd)[0].type()) << failureMessage; - double xVelocity = (*gestureEnd)[0].deltaX(); - double yVelocity = (*gestureEnd)[0].deltaY(); - double velocity = sqrt(xVelocity * xVelocity + yVelocity * yVelocity); - ASSERT_GT(velocity, 550) << failureMessage; - ASSERT_EQ(GestureRecognizerChromium::NoGesture, gm.state()) << failureMessage; - } -} diff --git a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp index 0ff539023..924b42d28 100644 --- a/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp +++ b/Source/WebKit/chromium/tests/PlatformContextSkiaTest.cpp @@ -28,6 +28,7 @@ #include "BitmapImageSingleFrameSkia.h" #include "GraphicsContext.h" +#include "ImageBuffer.h" #include "NativeImageSkia.h" #include "SkCanvas.h" #include <gtest/gtest.h> @@ -57,6 +58,7 @@ TEST(PlatformContextSkiaTest, trackOpaqueTest) SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); bitmap.allocPixels(); + bitmap.eraseColor(0); SkCanvas canvas(bitmap); PlatformContextSkia platformContext(&canvas); @@ -111,6 +113,89 @@ TEST(PlatformContextSkiaTest, trackOpaqueTest) EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); } +TEST(PlatformContextSkiaTest, trackOpaqueClipTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + SkCanvas canvas(bitmap); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + Color alpha(0.0f, 0.0f, 0.0f, 0.0f); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.save(); + context.clip(FloatRect(0, 0, 10, 10)); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.restore(); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.save(); + context.clip(FloatRect(20, 20, 10, 10)); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 10, 10), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + // The intersection of the two clips becomes empty. + context.clip(FloatRect(30, 20, 10, 10)); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.restore(); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + Path path; + path.moveTo(FloatPoint(0, 0)); + path.addLineTo(FloatPoint(100, 0)); + + // Non-rectangular clips just cause the paint to be considered non-opaque. + context.save(); + context.clipPath(path, RULE_EVENODD); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.restore(); + + // Another non-rectangular clip. + context.save(); + context.clip(IntRect(30, 30, 20, 20)); + context.clipOut(IntRect(30, 30, 10, 10)); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.restore(); + + OwnPtr<ImageBuffer> alphaImage = ImageBuffer::create(IntSize(100, 100)); + alphaImage->context()->fillRect(IntRect(0, 0, 100, 100), alpha, ColorSpaceDeviceRGB); + + // Clipping with a non-opaque Image (there is no way to mark an ImageBuffer as opaque today). + context.save(); + context.clipToImageBuffer(alphaImage.get(), FloatRect(30, 30, 10, 10)); + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); + context.restore(); +} + TEST(PlatformContextSkiaTest, trackOpaqueJoinTest) { SkBitmap bitmap; @@ -175,6 +260,7 @@ TEST(PlatformContextSkiaTest, trackOpaqueLineTest) SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); bitmap.allocPixels(); + bitmap.eraseColor(0); SkCanvas canvas(bitmap); PlatformContextSkia platformContext(&canvas); @@ -414,6 +500,7 @@ TEST(PlatformContextSkiaTest, trackOpaqueOvalTest) SkBitmap bitmap; bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); bitmap.allocPixels(); + bitmap.eraseColor(0); SkCanvas canvas(bitmap); PlatformContextSkia platformContext(&canvas); @@ -461,4 +548,73 @@ TEST(PlatformContextSkiaTest, trackOpaqueOvalTest) EXPECT_PIXELS_MATCH(bitmap, platformContext.opaqueRegion().asRect()); } +TEST(PlatformContextSkiaTest, layerTransformTranslateOpaqueTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + AffineTransform transform; + transform.translate(10, 10); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + platformContext.setOpaqueRegionTransform(transform); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(20, 20, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect())); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.translate(30, 30); + + context.fillRect(FloatRect(10, 10, 90, 90), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(50, 50, 90, 90), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect())); + + context.clearRect(FloatRect(10, 10, 90, 90)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); +} + +TEST(PlatformContextSkiaTest, layerTransformScaleOpaqueTest) +{ + SkBitmap bitmap; + bitmap.setConfig(SkBitmap::kARGB_8888_Config, 400, 400); + bitmap.allocPixels(); + bitmap.eraseColor(0); + SkCanvas canvas(bitmap); + AffineTransform transform; + transform.scale(2); + + PlatformContextSkia platformContext(&canvas); + platformContext.setTrackOpaqueRegion(true); + platformContext.setOpaqueRegionTransform(transform); + GraphicsContext context(&platformContext); + + Color opaque(1.0f, 0.0f, 0.0f, 1.0f); + + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(40, 40, 20, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect())); + + context.clearRect(FloatRect(20, 20, 10, 10)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); + + context.scale(FloatSize(2, 1)); + context.translate(0, 10); + + context.fillRect(FloatRect(20, 20, 10, 10), opaque, ColorSpaceDeviceRGB, CompositeSourceOver); + EXPECT_EQ_RECT(IntRect(80, 60, 40, 20), platformContext.opaqueRegion().asRect()); + EXPECT_PIXELS_MATCH(bitmap, transform.inverse().mapRect(platformContext.opaqueRegion().asRect())); + + context.clearRect(FloatRect(20, 20, 10, 10)); + EXPECT_EQ_RECT(IntRect(), platformContext.opaqueRegion().asRect()); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index b56fe7db7..f053ca410 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -100,8 +100,8 @@ public: virtual PopupMenuStyle menuStyle() const { return itemStyle(0); } virtual int clientInsetLeft() const { return 0; } virtual int clientInsetRight() const { return 0; } - virtual int clientPaddingLeft() const { return 0; } - virtual int clientPaddingRight() const { return 0; } + virtual LayoutUnit clientPaddingLeft() const { return 0; } + virtual LayoutUnit clientPaddingRight() const { return 0; } virtual int listSize() const { return 10; } virtual int selectedIndex() const { return m_selectIndex; } virtual void popupDidHide() { } diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp index 6fe616c24..3b576af99 100644 --- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp +++ b/Source/WebKit/chromium/tests/TextureManagerTest.cpp @@ -24,6 +24,7 @@ #include "config.h" +#include "ManagedTexture.h" #include "TextureManager.h" #include <gtest/gtest.h> @@ -64,8 +65,7 @@ public: bool requestTexture(TextureManager* manager, TextureToken token) { - unsigned textureId; - bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId); + bool result = manager->requestTexture(token, m_textureSize, m_textureFormat); if (result) manager->allocateTexture(&m_fakeTextureAllocator, token); return result; @@ -116,9 +116,17 @@ TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) tokens[i] = textureManager->getToken(); EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - textureManager->unprotectTexture(tokens[i]); } + textureManager->unprotectTexture(tokens[4]); + textureManager->unprotectTexture(tokens[5]); + + // These textures should be valid before the reduceMemoryToLimit call. + EXPECT_TRUE(textureManager->hasTexture(tokens[0])); + EXPECT_TRUE(textureManager->hasTexture(tokens[2])); + + textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); + EXPECT_FALSE(textureManager->hasTexture(tokens[0])); EXPECT_TRUE(textureManager->hasTexture(tokens[1])); EXPECT_TRUE(textureManager->isProtected(tokens[1])); @@ -243,4 +251,50 @@ TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); } +TEST_F(TextureManagerTest, textureManagerDestroyedBeforeManagedTexture) +{ + OwnPtr<TextureManager> textureManager = createTextureManager(1, 1); + OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManager.get()); + + IntSize size(50, 50); + unsigned format = GraphicsContext3D::RGBA; + + // Texture is initially invalid, but we should be able to reserve. + EXPECT_FALSE(managedTexture->isValid(size, format)); + EXPECT_TRUE(managedTexture->reserve(size, format)); + EXPECT_TRUE(managedTexture->isValid(size, format)); + + textureManager.clear(); + + // Deleting the manager should invalidate the texture and reservation attempts should fail. + EXPECT_FALSE(managedTexture->isValid(size, format)); + EXPECT_FALSE(managedTexture->reserve(size, format)); +} + +TEST_F(TextureManagerTest, textureMovedToNewManager) +{ + OwnPtr<TextureManager> textureManagerOne = createTextureManager(1, 1); + OwnPtr<TextureManager> textureManagerTwo = createTextureManager(1, 1); + OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManagerOne.get()); + + IntSize size(50, 50); + unsigned format = GraphicsContext3D::RGBA; + + // Texture is initially invalid, but we should be able to reserve. + EXPECT_FALSE(managedTexture->isValid(size, format)); + EXPECT_TRUE(managedTexture->reserve(size, format)); + EXPECT_TRUE(managedTexture->isValid(size, format)); + + // Setting to the same manager should be a no-op. + managedTexture->setTextureManager(textureManagerOne.get()); + EXPECT_TRUE(managedTexture->isValid(size, format)); + + // Setting to a different manager should invalidate the texture. + managedTexture->setTextureManager(textureManagerTwo.get()); + + EXPECT_FALSE(managedTexture->isValid(size, format)); + EXPECT_TRUE(managedTexture->reserve(size, format)); + EXPECT_TRUE(managedTexture->isValid(size, format)); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index b0350db49..fcd3878a6 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -60,13 +60,24 @@ class FakeLayerTextureUpdater : public LayerTextureUpdater { public: class Texture : public LayerTextureUpdater::Texture { public: - Texture(PassOwnPtr<ManagedTexture> texture) : LayerTextureUpdater::Texture(texture) { } + Texture(FakeLayerTextureUpdater* layer, PassOwnPtr<ManagedTexture> texture) + : LayerTextureUpdater::Texture(texture) + , m_layer(layer) + { + } virtual ~Texture() { } - virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect&, const IntRect&) { } + virtual void updateRect(GraphicsContext3D*, TextureAllocator*, const IntRect&, const IntRect&) { m_layer->updateRect(); } + + private: + FakeLayerTextureUpdater* m_layer; }; - FakeLayerTextureUpdater() : m_prepareCount(0) { } + FakeLayerTextureUpdater() + : m_prepareCount(0) + , m_updateCount(0) + { + } virtual ~FakeLayerTextureUpdater() { } // Sets the rect to invalidate during the next call to prepareToUpdate(). After the next @@ -77,17 +88,23 @@ public: int prepareCount() const { return m_prepareCount; } void clearPrepareCount() { m_prepareCount = 0; } + // Number of times updateRect has been invoked. + int updateCount() const { return m_updateCount; } + void clearUpdateCount() { m_updateCount = 0; } + void updateRect() { m_updateCount++; } + void setOpaquePaintRect(const IntRect& opaquePaintRect) { m_opaquePaintRect = opaquePaintRect; } // Last rect passed to prepareToUpdate(). const IntRect& lastUpdateRect() const { return m_lastUpdateRect; } - virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(ManagedTexture::create(manager))); } + virtual PassOwnPtr<LayerTextureUpdater::Texture> createTexture(TextureManager* manager) { return adoptPtr(new Texture(this, ManagedTexture::create(manager))); } virtual SampledTexelFormat sampledTexelFormat(GC3Denum) { return SampledTexelFormatRGBA; } virtual void prepareToUpdate(const IntRect& contentRect, const IntSize&, int, float, IntRect* resultingOpaqueRect); private: int m_prepareCount; + int m_updateCount; IntRect m_rectToInvalidate; IntRect m_lastUpdateRect; IntRect m_opaquePaintRect; @@ -155,13 +172,13 @@ public: } private: - virtual void createTextureUpdater(const CCLayerTreeHost*) { } - virtual LayerTextureUpdater* textureUpdater() const { return m_fakeTextureUpdater.get(); } + virtual void createTextureUpdaterIfNeeded() { } + RefPtr<FakeLayerTextureUpdater> m_fakeTextureUpdater; TextureManager* m_textureManager; }; @@ -428,8 +445,12 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset) IntSize contentBounds(300, 300); IntRect contentRect(IntPoint::zero(), contentBounds); - RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); - RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); + // We have enough memory for only one of the two layers. + int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. + OwnPtr<TextureManager> textureManager = TextureManager::create(memoryLimit, memoryLimit, memoryLimit); + + RefPtr<FakeTiledLayerChromium> rootLayer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + RefPtr<FakeTiledLayerChromium> childLayer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); rootLayer->addChild(childLayer); rootLayer->setBounds(contentBounds); @@ -439,15 +460,12 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->invalidateRect(contentRect); childLayer->invalidateRect(contentRect); - // We have enough memory for only one of the two layers. - int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel. - FakeTextureAllocator textureAllocator; CCTextureUpdater updater(&textureAllocator); ccLayerTreeHost->setRootLayer(rootLayer); ccLayerTreeHost->setViewportSize(IntSize(300, 300)); - ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit); + textureManager->setMaxMemoryLimitBytes(memoryLimit); ccLayerTreeHost->updateLayers(); ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater); @@ -456,12 +474,11 @@ TEST(TiledLayerChromiumTest, skipsDrawGetsReset) EXPECT_FALSE(childLayer->skipsDraw()); ccLayerTreeHost->commitComplete(); + textureManager->unprotectAllTextures(); // CCLayerTreeHost::commitComplete() normally does this, but since we're mocking out the manager we have to do it. // Remove the child layer. rootLayer->removeAllChildren(); - // Need to set the max limit again as it gets overwritten by updateLayers(). - ccLayerTreeHost->contentsTextureManager()->setMaxMemoryLimitBytes(memoryLimit); ccLayerTreeHost->updateLayers(); EXPECT_FALSE(rootLayer->skipsDraw()); @@ -564,4 +581,88 @@ TEST(TiledLayerChromiumTest, layerAddsSelfToOccludedRegion) EXPECT_EQ(0u, occluded.rects().size()); } +TEST(TiledLayerChromiumTest, resizeToSmaller) +{ + OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + + layer->setBounds(IntSize(700, 700)); + layer->invalidateRect(IntRect(0, 0, 700, 700)); + layer->prepareToUpdate(IntRect(0, 0, 700, 700)); + + layer->setBounds(IntSize(200, 200)); + layer->invalidateRect(IntRect(0, 0, 200, 200)); +} + +TEST(TiledLayerChromiumTest, partialUpdates) +{ + CCSettings settings; + settings.maxPartialTextureUpdates = 4; + // Initialize without threading support. + WebKit::WebCompositor::initialize(0); + FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient; + RefPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings); + + // Create one 500 x 300 tiled layer. + IntSize contentBounds(300, 200); + IntRect contentRect(IntPoint::zero(), contentBounds); + + OwnPtr<TextureManager> textureManager = TextureManager::create(60*1024*1024, 60*1024*1024, 1024); + RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); + layer->setBounds(contentBounds); + layer->setPosition(FloatPoint(150, 150)); + layer->invalidateRect(contentRect); + + FakeTextureAllocator textureAllocator; + CCTextureUpdater updater(&textureAllocator); + + ccLayerTreeHost->setRootLayer(layer); + ccLayerTreeHost->setViewportSize(IntSize(300, 200)); + + // Full update of all 6 tiles. + ccLayerTreeHost->updateLayers(); + ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater); + updater.update(0, 4); + EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_TRUE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + updater.update(0, 4); + EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_FALSE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + ccLayerTreeHost->commitComplete(); + + // Full update of 3 tiles and partial update of 3 tiles. + layer->invalidateRect(IntRect(0, 0, 300, 150)); + ccLayerTreeHost->updateLayers(); + ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater); + updater.update(0, 4); + EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_TRUE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + updater.update(0, 4); + EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_FALSE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + ccLayerTreeHost->commitComplete(); + + // Partial update of 6 tiles. + layer->invalidateRect(IntRect(50, 50, 200, 100)); + ccLayerTreeHost->updateLayers(); + ccLayerTreeHost->updateCompositorResources(ccLayerTreeHost->context(), updater); + updater.update(0, 4); + EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_TRUE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + updater.update(0, 4); + EXPECT_EQ(4, layer->fakeLayerTextureUpdater()->updateCount()); + EXPECT_FALSE(updater.hasMoreUpdates()); + layer->fakeLayerTextureUpdater()->clearUpdateCount(); + ccLayerTreeHost->commitComplete(); + + ccLayerTreeHost->setRootLayer(0); + ccLayerTreeHost.clear(); + WebKit::WebCompositor::shutdown(); +} + } // namespace diff --git a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp index f207c06a2..ad5810524 100644 --- a/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp +++ b/Source/WebKit/chromium/tests/WebCompositorInputHandlerImplTest.cpp @@ -28,6 +28,9 @@ #include "WebCompositorInputHandlerImpl.h" #include "WebCompositor.h" +#include "WebCompositorInputHandlerClient.h" +#include "WebInputEvent.h" +#include "cc/CCInputHandler.h" #include "cc/CCSingleThreadProxy.h" #include <gtest/gtest.h> @@ -38,6 +41,98 @@ using WebKit::WebCompositorInputHandlerImpl; namespace { +class MockInputHandlerClient : public WebCore::CCInputHandlerClient { + WTF_MAKE_NONCOPYABLE(MockInputHandlerClient); +public: + MockInputHandlerClient() + : m_scrollStatus(ScrollStarted) + , m_pinchStarted(false) + , m_pinchEnded(false) + , m_pinchMagnification(0) + { + } + virtual ~MockInputHandlerClient() { } + + void setScrollStatus(ScrollStatus status) { m_scrollStatus = status; } + + bool pinchStarted() const { return m_pinchStarted; } + bool pinchEnded() const { return m_pinchEnded; } + float pinchMaginifcation() const { return m_pinchMagnification; } + + void resetPinch() + { + m_pinchStarted = m_pinchEnded = false; + m_pinchMagnification = 0; + } + +private: + virtual void setNeedsRedraw() OVERRIDE { } + virtual ScrollStatus scrollBegin(const WebCore::IntPoint&) OVERRIDE + { + return m_scrollStatus; + } + virtual void scrollBy(const WebCore::IntSize&) OVERRIDE { } + virtual void scrollEnd() OVERRIDE { } + + virtual bool haveWheelEventHandlers() OVERRIDE { return false; } + virtual void pinchGestureBegin() OVERRIDE + { + m_pinchStarted = true; + } + virtual void pinchGestureUpdate(float magnifyDelta, const WebCore::IntPoint& anchor) OVERRIDE + { + m_pinchMagnification = magnifyDelta; + } + virtual void pinchGestureEnd() OVERRIDE + { + m_pinchEnded = true; + } + virtual void startPageScaleAnimation(const WebCore::IntSize& targetPosition, + bool anchorPoint, + float pageScale, + double startTimeMs, + double durationMs) OVERRIDE { } + + ScrollStatus m_scrollStatus; + bool m_pinchStarted; + bool m_pinchEnded; + float m_pinchMagnification; +}; + +class MockWebCompositorInputHandlerClient : public WebKit::WebCompositorInputHandlerClient { + WTF_MAKE_NONCOPYABLE(MockWebCompositorInputHandlerClient); +public: + MockWebCompositorInputHandlerClient() + : m_handled(false) + , m_sendToWidget(false) + { + } + virtual ~MockWebCompositorInputHandlerClient() { } + + void reset() + { + m_handled = false; + m_sendToWidget = false; + } + + bool handled() const { return m_handled; } + bool sendToWidget() const { return m_sendToWidget; } + +private: + virtual void willShutdown() OVERRIDE { } + virtual void didHandleInputEvent() OVERRIDE + { + m_handled = true; + } + virtual void didNotHandleInputEvent(bool sendToWidget) OVERRIDE + { + m_sendToWidget = sendToWidget; + } + + bool m_handled; + bool m_sendToWidget; +}; + TEST(WebCompositorInputHandlerImpl, fromIdentifier) { WebKit::WebCompositor::initialize(0); @@ -53,13 +148,13 @@ TEST(WebCompositorInputHandlerImpl, fromIdentifier) int compositorIdentifier = -1; { - OwnPtr<WebCompositorInputHandlerImpl> comp = WebCompositorInputHandlerImpl::create(0); - compositorIdentifier = comp->identifier(); + OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(0); + compositorIdentifier = inputHandler->identifier(); // The compositor we just created should be locatable. - EXPECT_EQ(comp.get(), WebCompositorInputHandler::fromIdentifier(compositorIdentifier)); + EXPECT_EQ(inputHandler.get(), WebCompositorInputHandler::fromIdentifier(compositorIdentifier)); // But nothing else. - EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(comp->identifier() + 10)); + EXPECT_EQ(0, WebCompositorInputHandler::fromIdentifier(inputHandler->identifier() + 10)); } // After the compositor is destroyed, its entry should be removed from the map. @@ -68,4 +163,122 @@ TEST(WebCompositorInputHandlerImpl, fromIdentifier) WebKit::WebCompositor::shutdown(); } +TEST(WebCompositorInputHandlerImpl, gestureScroll) +{ + WebKit::WebCompositor::initialize(0); +#ifndef NDEBUG + // WebCompositorInputHandler APIs can only be called from the compositor thread. + WebCore::DebugScopedSetImplThread alwaysImplThread; +#endif + + MockInputHandlerClient mockInputHandler; + OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler); + MockWebCompositorInputHandlerClient mockClient; + inputHandler->setClient(&mockClient); + + WebKit::WebGestureEvent gesture; + + gesture.type = WebKit::WebInputEvent::GestureScrollBegin; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + mockClient.reset(); + + gesture.type = WebKit::WebInputEvent::GestureScrollUpdate; + gesture.deltaY = 40; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + mockClient.reset(); + + gesture.type = WebKit::WebInputEvent::GestureScrollEnd; + gesture.deltaY = 0; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + mockClient.reset(); + + mockInputHandler.setScrollStatus(WebCore::CCInputHandlerClient::ScrollFailed); + + gesture.type = WebKit::WebInputEvent::GestureScrollBegin; + inputHandler->handleInputEvent(gesture); + EXPECT_FALSE(mockClient.handled()); + EXPECT_TRUE(mockClient.sendToWidget()); + mockClient.reset(); + + gesture.type = WebKit::WebInputEvent::GestureScrollUpdate; + gesture.deltaY = 40; + inputHandler->handleInputEvent(gesture); + EXPECT_FALSE(mockClient.handled()); + EXPECT_TRUE(mockClient.sendToWidget()); + mockClient.reset(); + + gesture.type = WebKit::WebInputEvent::GestureScrollEnd; + gesture.deltaY = 0; + inputHandler->handleInputEvent(gesture); + EXPECT_FALSE(mockClient.handled()); + EXPECT_TRUE(mockClient.sendToWidget()); + mockClient.reset(); + + inputHandler->setClient(0); + + WebKit::WebCompositor::shutdown(); +} + +TEST(WebCompositorInputHandlerImpl, gesturePinch) +{ + WebKit::WebCompositor::initialize(0); +#ifndef NDEBUG + // WebCompositorInputHandler APIs can only be called from the compositor thread. + WebCore::DebugScopedSetImplThread alwaysImplThread; +#endif + + MockInputHandlerClient mockInputHandler; + OwnPtr<WebCompositorInputHandlerImpl> inputHandler = WebCompositorInputHandlerImpl::create(&mockInputHandler); + MockWebCompositorInputHandlerClient mockClient; + inputHandler->setClient(&mockClient); + + WebKit::WebGestureEvent gesture; + + gesture.type = WebKit::WebInputEvent::GesturePinchBegin; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + EXPECT_TRUE(mockInputHandler.pinchStarted()); + mockClient.reset(); + mockInputHandler.resetPinch(); + + gesture.type = WebKit::WebInputEvent::GesturePinchUpdate; + gesture.deltaX = 1.5; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + EXPECT_FALSE(mockInputHandler.pinchEnded()); + EXPECT_EQ(1.5, mockInputHandler.pinchMaginifcation()); + mockClient.reset(); + mockInputHandler.resetPinch(); + + gesture.type = WebKit::WebInputEvent::GesturePinchUpdate; + gesture.deltaX = 0.5; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + EXPECT_FALSE(mockInputHandler.pinchEnded()); + EXPECT_EQ(0.5, mockInputHandler.pinchMaginifcation()); + mockClient.reset(); + mockInputHandler.resetPinch(); + + gesture.type = WebKit::WebInputEvent::GesturePinchEnd; + inputHandler->handleInputEvent(gesture); + EXPECT_TRUE(mockClient.handled()); + EXPECT_FALSE(mockClient.sendToWidget()); + EXPECT_TRUE(mockInputHandler.pinchEnded()); + mockClient.reset(); + mockInputHandler.resetPinch(); + + inputHandler->setClient(0); + + WebKit::WebCompositor::shutdown(); +} + } diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 06b26469a..b59001860 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -381,7 +381,7 @@ TEST_F(WebFrameTest, ContextNotificationsIsolatedWorlds) EXPECT_EQ(1, matchCount); } -TEST_F(WebFrameTest, DISABLED_FindInPage) +TEST_F(WebFrameTest, FindInPage) { registerMockedHttpURLLoad("find.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find.html"); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index dd94c852f..6a52fa252 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,199 @@ +2012-02-07 Krzysztof Czech <k.czech@samsung.com> + + [EFL] Add missing initialization of editable variable. + https://bugs.webkit.org/show_bug.cgi?id=77948 + + Reviewed by Eric Seidel. + + The value of editable in Ewk_Frame_Smart_Data struct is not set. + + * ewk/ewk_frame.cpp: + (ewk_frame_editable_set): + +2012-02-06 JungJik Lee <jungjik.lee@samsung.com> + + [EFL] Define to prevent a single backing-store application from calling the tiled view function. + https://bugs.webkit.org/show_bug.cgi?id=77842 + + Reviewed by Andreas Kling. + + The define prevents an application using single backing store from calling tiled cache function. + The tiled APIs opened to outer should check the view type before being called. + + * ewk/ewk_private.h: + * ewk/ewk_view.cpp: + (_Ewk_View_Private_Data): + (ewk_view_frame_view_creation_notify): + * ewk/ewk_view_tiled.cpp: + (ewk_view_tiled_unused_cache_get): + (ewk_view_tiled_unused_cache_set): + +2012-02-06 JungJik Lee <jungjik.lee@samsung.com> + + [EFL] Adopt C++ style using camelCase and full variable names. + https://bugs.webkit.org/show_bug.cgi?id=76378 + + Reviewed by Andreas Kling. + + Modify the code to use camelCase and spell out variable names instead of using abbreviations. + Modify the comments which do not match with actual parameters and correct misspelled words. + Adopt EFL Coding style in header files. + The logic of the code is not changed. + + * ewk/ewk_cookies.h: + * ewk/ewk_frame.cpp: + (ewk_frame_selection_get): + (ewk_frame_feed_focus_in): + (EWKPrivate::coreFrame): + * ewk/ewk_frame.h: + * ewk/ewk_history.cpp: + (ewk_history_item_new): + (ewk_history_item_title_get): + (ewk_history_item_title_alternate_get): + (ewk_history_item_uri_get): + (ewk_history_item_uri_original_get): + * ewk/ewk_network.h: + * ewk/ewk_tiled_backing_store.cpp: + (_Ewk_Tiled_Backing_Store_Item): + (_Ewk_Tiled_Backing_Store_Data): + (_ewk_tiled_backing_store_tile_associate): + (_ewk_tiled_backing_store_tile_dissociate): + (_ewk_tiled_backing_store_pre_render_request_clear): + (_ewk_tiled_backing_store_pre_render_request_process_single): + (_ewk_tiled_backing_store_item_fill): + (_ewk_tiled_backing_store_item_add): + (_ewk_tiled_backing_store_item_smooth_scale_set): + (_ewk_tiled_backing_store_view_cols_end_add): + (_ewk_tiled_backing_store_view_rows_all_del): + (_ewk_tiled_backing_store_render): + (_ewk_tiled_backing_store_mem_dbg): + (_ewk_tiled_backing_store_sig_usr): + (_ewk_tiled_backing_store_smart_add): + (_ewk_tiled_backing_store_smart_del): + (_ewk_tiled_backing_store_smart_move): + (_ewk_tiled_backing_store_smart_resize): + (_ewk_tiled_backing_store_recalc_renderers): + (_ewk_tiled_backing_store_view_dbg): + (_ewk_tiled_backing_store_view_wrap_up): + (_ewk_tiled_backing_store_view_wrap_down): + (_ewk_tiled_backing_store_view_wrap_left): + (_ewk_tiled_backing_store_view_refill): + (_ewk_tiled_backing_store_view_pos_apply): + (_ewk_tiled_backing_store_smart_calculate_offset_force): + (_ewk_tiled_backing_store_smart_calculate_offset): + (_ewk_tiled_backing_store_smart_calculate_pos): + (_ewk_tiled_backing_store_smart_calculate): + (_ewk_tiled_backing_store_scroll_full_offset_set_internal): + (ewk_tiled_backing_store_scroll_full_offset_set): + (ewk_tiled_backing_store_scroll_full_offset_add): + (_ewk_tiled_backing_store_zoom_set_internal): + (ewk_tiled_backing_store_zoom_set): + (ewk_tiled_backing_store_zoom_weak_set): + (ewk_tiled_backing_store_fix_offsets): + (ewk_tiled_backing_store_flush): + (ewk_tiled_backing_store_pre_render_region): + (ewk_tiled_backing_store_pre_render_relative_radius): + * ewk/ewk_tiled_backing_store.h: + (_Ewk_Tile): + * ewk/ewk_tiled_matrix.cpp: + (_Ewk_Tile_Matrix): + (_ewk_tile_matrix_cell_free): + (_ewk_tile_matrix_tile_free): + (ewk_tile_matrix_new): + (ewk_tile_matrix_free): + (ewk_tile_matrix_unused_cache_get): + (ewk_tile_matrix_tile_exact_get): + (ewk_tile_matrix_tile_new): + (ewk_tile_matrix_tile_put): + (ewk_tile_matrix_dbg): + (ewk_tile_matrix_freeze): + (ewk_tile_matrix_thaw): + * ewk/ewk_tiled_matrix.h: + * ewk/ewk_tiled_model.cpp: + (tile_account): + (ewk_tile_updates_process): + (ewk_tile_unused_cache_tile_put): + (ewk_tile_unused_cache_dbg): + * ewk/ewk_tiled_model.h: + * ewk/ewk_util.h: + * ewk/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_smart_focus_in): + (_ewk_view_smart_pre_render_region): + (ewk_view_pre_render_region): + (ewk_view_toolbars_visible_get): + (ewk_view_statusbar_visible_get): + (ewk_view_scrollbars_visible_get): + (ewk_view_menubar_visible_get): + (ewk_view_zoom_range_set): + * ewk/ewk_view.h: + * ewk/ewk_view_single.cpp: + (_ewk_view_single_smart_repaints_process): + * ewk/ewk_view_tiled.cpp: + (_ewk_view_tiled_smart_backing_store_add): + (_ewk_view_tiled_smart_add): + (ewk_view_tiled_unused_cache_get): + (ewk_view_tiled_unused_cache_set): + +2012-02-05 ChangSeok Oh <shivamidow@gmail.com> + + [EFL] Enable WebGL with glx backend + https://bugs.webkit.org/show_bug.cgi?id=77308 + + Reviewed by Martin Robinson. + + Activated WebGL feature. + + * ewk/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_priv_new): + +2012-02-05 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Remove g_thread_init() calls + https://bugs.webkit.org/show_bug.cgi?id=77828 + + Reviewed by Andreas Kling. + + g_thread_init has been deprecated since glib 2.32. This function is no longer necessary. + The GLib threading system is automatically initialized at the start of your program. + + * ewk/ewk_main.cpp: + (_ewk_init_body): + +2012-02-02 KwangHyuk Kim <hyuki.kim@samsung.com> + + [EFL] Add contentsSize flag into ewk_tiled_backing_store's private data. + https://bugs.webkit.org/show_bug.cgi?id=77586 + + Reviewed by Andreas Kling. + + As both zoom and content size change are identified by model flag, + ewk_tiled_backing_store can not detect the conflict between them. + In order to prevent conflict between zoom and contents size change, + contentsSize flag is newly added. + + * ewk/ewk_tiled_backing_store.cpp: + (_Ewk_Tiled_Backing_Store_Item): + (_Ewk_Tiled_Backing_Store_Data): + (_ewk_tiled_backing_store_smart_calculate): + (ewk_tiled_backing_store_contents_resize): + +2012-02-02 Raphael Kubo da Costa <kubo@profusion.mobi> + + [EFL] Remove check for ENABLE_GTK_PLUGINS_SUPPORT + https://bugs.webkit.org/show_bug.cgi?id=77647 + + Reviewed by Martin Robinson. + + There is no clear reason why this check was in place (it came with the + upstreaming of the port), but ENABLE_GTK_PLUGINS_SUPPORT is not set + anywhere, and the build system does not even check for the presence of + GTK+ when building. + + * ewk/ewk_main.cpp: + (_ewk_init_body): + 2012-01-31 Ryuan Choi <ryuan.choi@samsung.com> [EFL] Add basic DRT/Efl implementation to support viewport test. diff --git a/Source/WebKit/efl/ewk/ewk_cookies.h b/Source/WebKit/efl/ewk/ewk_cookies.h index acd15596f..40e69d56c 100644 --- a/Source/WebKit/efl/ewk/ewk_cookies.h +++ b/Source/WebKit/efl/ewk/ewk_cookies.h @@ -95,7 +95,7 @@ EAPI void ewk_cookies_clear(void); * * @return an @c Eina_List with all the cookies in the cookie jar */ -EAPI Eina_List* ewk_cookies_get_all(void); +EAPI Eina_List *ewk_cookies_get_all(void); /** * Deletes a cookie from the cookie jar. diff --git a/Source/WebKit/efl/ewk/ewk_frame.cpp b/Source/WebKit/efl/ewk/ewk_frame.cpp index 961fa0b1d..8dc140150 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.cpp +++ b/Source/WebKit/efl/ewk/ewk_frame.cpp @@ -86,28 +86,28 @@ struct Eina_Iterator_Ewk_Frame { #ifndef EWK_TYPE_CHECK #define EWK_FRAME_TYPE_CHECK(ewkFrame, ...) do { } while (0) #else -#define EWK_FRAME_TYPE_CHECK(ewkFrame, ...) \ - do { \ - const char* _tmp_otype = evas_object_type_get(ewkFrame); \ - if (EINA_UNLIKELY(_tmp_otype != EWK_FRAME_TYPE_STR)) { \ - EINA_LOG_CRIT \ - ("%p (%s) is not of an ewk_frame!", ewkFrame, \ - _tmp_otype ? _tmp_otype : "(null)"); \ - return __VA_ARGS__; \ - } \ +#define EWK_FRAME_TYPE_CHECK(ewkFrame, ...) \ + do { \ + const char* _tmp_otype = evas_object_type_get(ewkFrame); \ + if (EINA_UNLIKELY(_tmp_otype != EWK_FRAME_TYPE_STR)) { \ + EINA_LOG_CRIT \ + ("%p (%s) is not of an ewk_frame!", ewkFrame, \ + _tmp_otype ? _tmp_otype : "(null)"); \ + return __VA_ARGS__; \ + } \ } while (0) #endif -#define EWK_FRAME_SD_GET(ewkFrame, ptr) \ - Ewk_Frame_Smart_Data* ptr = static_cast<Ewk_Frame_Smart_Data*>(evas_object_smart_data_get(ewkFrame)) +#define EWK_FRAME_SD_GET(ewkFrame, pointer) \ + Ewk_Frame_Smart_Data* pointer = static_cast<Ewk_Frame_Smart_Data*>(evas_object_smart_data_get(ewkFrame)) -#define EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, ptr, ...) \ - EWK_FRAME_TYPE_CHECK(ewkFrame, __VA_ARGS__); \ - EWK_FRAME_SD_GET(ewkFrame, ptr); \ - if (!ptr) { \ - CRITICAL("no smart data for object %p (%s)", \ - ewkFrame, evas_object_type_get(ewkFrame)); \ - return __VA_ARGS__; \ +#define EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, pointer, ...) \ + EWK_FRAME_TYPE_CHECK(ewkFrame, __VA_ARGS__); \ + EWK_FRAME_SD_GET(ewkFrame, pointer); \ + if (!pointer) { \ + CRITICAL("no smart data for object %p (%s)", \ + ewkFrame, evas_object_type_get(ewkFrame)); \ + return __VA_ARGS__; \ } static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL; @@ -459,6 +459,7 @@ Eina_Bool ewk_frame_editable_set(Evas_Object* ewkFrame, Eina_Bool editable) editable = !!editable; if (smartData->editable == editable) return true; + smartData->editable = editable; if (editable) smartData->frame->editor()->applyEditingStyleToBodyElement(); return true; @@ -468,10 +469,10 @@ char* ewk_frame_selection_get(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, 0); - WTF::CString s = smartData->frame->editor()->selectedText().utf8(); - if (s.isNull()) + WTF::CString selectedText = smartData->frame->editor()->selectedText().utf8(); + if (selectedText.isNull()) return 0; - return strdup(s.data()); + return strdup(selectedText.data()); } Eina_Bool ewk_frame_text_search(const Evas_Object* ewkFrame, const char* text, Eina_Bool caseSensitive, Eina_Bool forward, Eina_Bool wrap) @@ -834,8 +835,8 @@ Eina_Bool ewk_frame_feed_focus_in(Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); - WebCore::FocusController* c = smartData->frame->page()->focusController(); - c->setFocusedFrame(smartData->frame); + WebCore::FocusController* focusController = smartData->frame->page()->focusController(); + focusController->setFocusedFrame(smartData->frame); return true; } @@ -1774,7 +1775,7 @@ void ewk_frame_mixed_content_run_set(Evas_Object* ewkFrame, bool hasRun) namespace EWKPrivate { -WebCore::Frame *coreFrame(const Evas_Object *ewkFrame) +WebCore::Frame* coreFrame(const Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0); return smartData->frame; diff --git a/Source/WebKit/efl/ewk/ewk_frame.h b/Source/WebKit/efl/ewk/ewk_frame.h index 0df8c51f5..f74555e5a 100644 --- a/Source/WebKit/efl/ewk/ewk_frame.h +++ b/Source/WebKit/efl/ewk/ewk_frame.h @@ -857,7 +857,7 @@ EAPI Eina_List *ewk_frame_resources_location_get(const Evas_Object *o); * @return A newly allocated string (which must be freed by the caller with @c free()) * or @c 0 in case of failure. */ -EAPI char* ewk_frame_plain_text_get(const Evas_Object* o); +EAPI char *ewk_frame_plain_text_get(const Evas_Object *o); /** * Returns whether the frame has displayed mixed content. diff --git a/Source/WebKit/efl/ewk/ewk_history.cpp b/Source/WebKit/efl/ewk/ewk_history.cpp index a39875911..faef0c805 100644 --- a/Source/WebKit/efl/ewk/ewk_history.cpp +++ b/Source/WebKit/efl/ewk/ewk_history.cpp @@ -255,9 +255,9 @@ Ewk_History_Item* ewk_history_item_new_from_core(WebCore::HistoryItem* core) Ewk_History_Item* ewk_history_item_new(const char* uri, const char* title) { - WTF::String u = WTF::String::fromUTF8(uri); - WTF::String t = WTF::String::fromUTF8(title); - WTF::RefPtr<WebCore::HistoryItem> core = WebCore::HistoryItem::create(u, t, 0); + WTF::String historyUri = WTF::String::fromUTF8(uri); + WTF::String historyTitle = WTF::String::fromUTF8(title); + WTF::RefPtr<WebCore::HistoryItem> core = WebCore::HistoryItem::create(historyUri, historyTitle, 0); Ewk_History_Item* item = ewk_history_item_new_from_core(core.release().leakRef()); return item; } @@ -287,19 +287,19 @@ const char* ewk_history_item_title_get(const Ewk_History_Item* item) { EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0); // hide the following optimzation from outside - Ewk_History_Item* item1 = const_cast<Ewk_History_Item*>(item); - eina_stringshare_replace(&item1->title, core->title().utf8().data()); - return item1->title; + Ewk_History_Item* historyItem = const_cast<Ewk_History_Item*>(item); + eina_stringshare_replace(&historyItem->title, core->title().utf8().data()); + return historyItem->title; } const char* ewk_history_item_title_alternate_get(const Ewk_History_Item* item) { EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0); // hide the following optimzation from outside - Ewk_History_Item* item1 = const_cast<Ewk_History_Item*>(item); - eina_stringshare_replace(&item1->alternateTitle, + Ewk_History_Item* historyItem = const_cast<Ewk_History_Item*>(item); + eina_stringshare_replace(&historyItem->alternateTitle, core->alternateTitle().utf8().data()); - return item1->alternateTitle; + return historyItem->alternateTitle; } void ewk_history_item_title_alternate_set(Ewk_History_Item* item, const char* title) @@ -314,19 +314,19 @@ const char* ewk_history_item_uri_get(const Ewk_History_Item* item) { EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0); // hide the following optimzation from outside - Ewk_History_Item* i = const_cast<Ewk_History_Item*>((item)); - eina_stringshare_replace(&i->uri, core->urlString().utf8().data()); - return i->uri; + Ewk_History_Item* historyItem = const_cast<Ewk_History_Item*>((item)); + eina_stringshare_replace(&historyItem->uri, core->urlString().utf8().data()); + return historyItem->uri; } const char* ewk_history_item_uri_original_get(const Ewk_History_Item* item) { EWK_HISTORY_ITEM_CORE_GET_OR_RETURN(item, core, 0); // hide the following optimzation from outside - Ewk_History_Item* i = const_cast<Ewk_History_Item*>(item); - eina_stringshare_replace(&i->originalUri, + Ewk_History_Item* historyItem = const_cast<Ewk_History_Item*>(item); + eina_stringshare_replace(&historyItem->originalUri, core->originalURLString().utf8().data()); - return i->originalUri; + return historyItem->originalUri; } double ewk_history_item_time_last_visited_get(const Ewk_History_Item* item) diff --git a/Source/WebKit/efl/ewk/ewk_main.cpp b/Source/WebKit/efl/ewk/ewk_main.cpp index e821a4a18..cead2de72 100644 --- a/Source/WebKit/efl/ewk/ewk_main.cpp +++ b/Source/WebKit/efl/ewk/ewk_main.cpp @@ -44,11 +44,6 @@ #if ENABLE(GLIB_SUPPORT) #include <glib-object.h> #include <glib.h> - -#ifdef ENABLE_GTK_PLUGINS_SUPPORT -#include <gtk/gtk.h> -#endif - #endif #if USE(SOUP) @@ -146,15 +141,6 @@ Eina_Bool _ewk_init_body(void) #if ENABLE(GLIB_SUPPORT) g_type_init(); - if (!g_thread_supported()) - g_thread_init(0); - -#ifdef ENABLE_GTK_PLUGINS_SUPPORT - gdk_threads_init(); - if (!gtk_init_check(0, 0)) - WRN("Could not initialize GTK support."); -#endif - if (!ecore_main_loop_glib_integrate()) WRN("Ecore was not compiled with GLib support, some plugins will not " "work (ie: Adobe Flash)"); diff --git a/Source/WebKit/efl/ewk/ewk_network.h b/Source/WebKit/efl/ewk/ewk_network.h index 612c2f7ce..3977e9978 100644 --- a/Source/WebKit/efl/ewk/ewk_network.h +++ b/Source/WebKit/efl/ewk/ewk_network.h @@ -119,7 +119,7 @@ EAPI void ewk_network_tls_ca_certificates_path_set(const char *path) * @return The default @c SoupSession in use, or @c NULL if another network * backend was used. */ -EAPI SoupSession* ewk_network_default_soup_session_get(void); +EAPI SoupSession *ewk_network_default_soup_session_get(void); #ifdef __cplusplus } diff --git a/Source/WebKit/efl/ewk/ewk_private.h b/Source/WebKit/efl/ewk/ewk_private.h index bbff734fc..b4a8dd936 100644 --- a/Source/WebKit/efl/ewk/ewk_private.h +++ b/Source/WebKit/efl/ewk/ewk_private.h @@ -62,6 +62,13 @@ struct _Ewk_JS_Object { const char ewkViewTiledName[] = "Ewk_View_Tiled"; const char ewkViewSingleName[] = "Ewk_View_Single"; +// Define to prevent an application using different view type from calling the function. +#define EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, viewName, ...) \ + if (!evas_object_smart_type_check(ewkView, viewName)) { \ + INF("ewkView isn't an instance of %s", viewName); \ + return __VA_ARGS__; \ + } + // forward declarations namespace WebCore { struct PopupMenuClient; diff --git a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp index 4cdd72d85..e0dde4d74 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.cpp @@ -33,7 +33,7 @@ #include <stdlib.h> #include <string.h> -#define IDX(col, row, rowspan) (col + (row * rowspan)) +#define IDX(column, row, rowspan) (column + (row * rowspan)) typedef struct _Ewk_Tiled_Backing_Store_Data Ewk_Tiled_Backing_Store_Data; typedef struct _Ewk_Tiled_Backing_Store_Item Ewk_Tiled_Backing_Store_Item; @@ -45,7 +45,7 @@ struct _Ewk_Tiled_Backing_Store_Item { struct { Evas_Coord x, y, width, height; } geometry; - bool smooth_scale; + bool smoothScale; }; struct _Ewk_Tiled_Backing_Store_Pre_Render_Request { @@ -61,7 +61,7 @@ struct _Ewk_Tiled_Backing_Store_Data { struct { Eina_Inlist** items; Evas_Coord x, y, width, height; - long cols, rows; + long columns, rows; struct { Evas_Coord width, height; float zoom; @@ -71,7 +71,7 @@ struct _Ewk_Tiled_Backing_Store_Data { struct { struct { Evas_Coord x, y; - } cur, old, base, zoomCenter; + } current, old, base, zoomCenter; } offset; bool visible : 1; } view; @@ -106,20 +106,21 @@ struct _Ewk_Tiled_Backing_Store_Data { bool size : 1; bool model : 1; bool offset : 1; + bool contentsSize : 1; } changed; #ifdef DEBUG_MEM_LEAKS - Ecore_Event_Handler* sig_usr; + Ecore_Event_Handler* signalUser; #endif }; static Evas_Smart_Class _parent_sc = EVAS_SMART_CLASS_INIT_NULL; int _ewk_tiled_log_dom = -1; -#define PRIV_DATA_GET_OR_RETURN(obj, ptr, ...) \ +#define PRIV_DATA_GET_OR_RETURN(obj, ptr, ...) \ Ewk_Tiled_Backing_Store_Data* ptr = static_cast<Ewk_Tiled_Backing_Store_Data*>(evas_object_smart_data_get(obj)); \ - if (!ptr) { \ - CRITICAL("no private data in obj=%p", obj); \ - return __VA_ARGS__; \ + if (!ptr) { \ + CRITICAL("no private data in obj=%p", obj); \ + return __VA_ARGS__; \ } static void _ewk_tiled_backing_store_fill_renderers(Ewk_Tiled_Backing_Store_Data* priv); @@ -203,13 +204,13 @@ static void _ewk_tiled_backing_store_item_resize(Ewk_Tiled_Backing_Store_Item* i static void _ewk_tiled_backing_store_tile_associate(Ewk_Tiled_Backing_Store_Data* priv, Ewk_Tile* tile, Ewk_Tiled_Backing_Store_Item* item) { if (item->tile) - CRITICAL("it->tile=%p, but it should be 0!", item->tile); + CRITICAL("item->tile=%p, but it should be 0!", item->tile); item->tile = tile; evas_object_move(item->tile->image, item->geometry.x, item->geometry.y); evas_object_resize(item->tile->image, item->geometry.width, item->geometry.height); evas_object_image_fill_set (item->tile->image, 0, 0, item->geometry.width, item->geometry.height); - evas_object_image_smooth_scale_set(item->tile->image, item->smooth_scale); + evas_object_image_smooth_scale_set(item->tile->image, item->smoothScale); evas_object_image_alpha_set(item->tile->image, priv->view.tile.hasAlpha); if (!ewk_tile_visible_get(tile)) @@ -220,13 +221,13 @@ static void _ewk_tiled_backing_store_tile_associate(Ewk_Tiled_Backing_Store_Data static void _ewk_tiled_backing_store_tile_dissociate(Ewk_Tiled_Backing_Store_Data* priv, Ewk_Tiled_Backing_Store_Item* item, double lastUsed) { - Ewk_Tile_Unused_Cache* tiledUnusedCache; + Ewk_Tile_Unused_Cache* tileUnusedCache; ewk_tile_hide(item->tile); if (!ewk_tile_visible_get(item->tile)) evas_object_smart_member_del(item->tile->image); ewk_tile_matrix_tile_put(priv->model.matrix, item->tile, lastUsed); - tiledUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); - ewk_tile_unused_cache_auto_flush(tiledUnusedCache); + tileUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); + ewk_tile_unused_cache_auto_flush(tileUnusedCache); item->tile = 0; } @@ -292,26 +293,26 @@ static void _ewk_tiled_backing_store_pre_render_request_flush(Ewk_Tiled_Backing_ static void _ewk_tiled_backing_store_pre_render_request_clear(Ewk_Tiled_Backing_Store_Data* priv) { Eina_Inlist** preRenderList = &priv->render.preRenderRequests; - Eina_Inlist* iter = *preRenderList, *tmp; + Eina_Inlist* iter = *preRenderList, *next; while (iter) { Ewk_Tiled_Backing_Store_Pre_Render_Request* request = EINA_INLIST_CONTAINER_GET( iter, Ewk_Tiled_Backing_Store_Pre_Render_Request); - tmp = iter->next; + next = iter->next; *preRenderList = eina_inlist_remove(*preRenderList, iter); - iter = tmp; + iter = next; free(request); } } -/* assumes priv->process.pre_cb was called if required! */ +/* assumes priv->process.preCallback was called if required! */ static void _ewk_tiled_backing_store_pre_render_request_process_single(Ewk_Tiled_Backing_Store_Data* priv) { Ewk_Tiled_Backing_Store_Pre_Render_Request* request; Eina_Rectangle area; Ewk_Tile_Matrix* tileMatrix = priv->model.matrix; Ewk_Tile* tile; - Ewk_Tile_Unused_Cache* tiledUnusedCache; + Ewk_Tile_Unused_Cache* tileUnusedCache; unsigned long column, row; float zoom; double last_used = ecore_loop_time_get(); @@ -348,8 +349,8 @@ static void _ewk_tiled_backing_store_pre_render_request_process_single(Ewk_Tiled end: _ewk_tiled_backing_store_pre_render_request_del(priv, request); - tiledUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); - ewk_tile_unused_cache_auto_flush(tiledUnusedCache); + tileUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); + ewk_tile_unused_cache_auto_flush(tileUnusedCache); } static Eina_Bool _ewk_tiled_backing_store_item_process_idler_cb(void* data) @@ -430,18 +431,18 @@ static inline Eina_Bool _ewk_tiled_backing_store_item_fill(Ewk_Tiled_Backing_Sto if (item->tile) { Ewk_Tile* old = item->tile; - if (old->row != currentRow || old->col != currentColumn || old->zoom != zoom) + if (old->row != currentRow || old->column != currentColumn || old->zoom != zoom) _ewk_tiled_backing_store_tile_dissociate(priv, item, lastUsed); - else if (old->row == currentRow && old->col == currentColumn && old->zoom == zoom) + else if (old->row == currentRow && old->column == currentColumn && old->zoom == zoom) goto end; } tile = ewk_tile_matrix_tile_exact_get(priv->model.matrix, currentColumn, currentRow, zoom); if (!tile) { - /* NOTE: it never returns 0 if it->tile was set! */ + /* NOTE: it never returns 0 if item->tile was set! */ if (item->tile) { - CRITICAL("it->tile=%p, but it should be 0!", item->tile); + CRITICAL("item->tile=%p, but it should be 0!", item->tile); _ewk_tiled_backing_store_tile_dissociate(priv, item, lastUsed); } @@ -473,7 +474,7 @@ static Ewk_Tiled_Backing_Store_Item* _ewk_tiled_backing_store_item_add(Ewk_Tiled Ewk_Tiled_Backing_Store_Item* item; Evas_Coord x, y, tileWidth, tileHeight; - DBG("ewkBackingStore%p", priv->self); + DBG("ewkBackingStore=%p", priv->self); item = static_cast<Ewk_Tiled_Backing_Store_Item*>(malloc(sizeof(*item))); if (!item) @@ -481,12 +482,12 @@ static Ewk_Tiled_Backing_Store_Item* _ewk_tiled_backing_store_item_add(Ewk_Tiled tileWidth = priv->view.tile.width; tileHeight = priv->view.tile.height; - x = priv->view.offset.base.x + priv->view.x + tileWidth *column; - y = priv->view.offset.base.y + priv->view.y + tileHeight *row; + x = priv->view.offset.base.x + priv->view.x + tileWidth * column; + y = priv->view.offset.base.y + priv->view.y + tileHeight * row; item->tile = 0; - item->smooth_scale = priv->view.tile.zoomWeakSmoothScale; + item->smoothScale = priv->view.tile.zoomWeakSmoothScale; _ewk_tiled_backing_store_item_move(item, x, y); _ewk_tiled_backing_store_item_resize(item, tileWidth, tileHeight); if (!_ewk_tiled_backing_store_item_fill(priv, item, column, row)) { @@ -509,7 +510,7 @@ static void _ewk_tiled_backing_store_item_del(Ewk_Tiled_Backing_Store_Data* priv static void _ewk_tiled_backing_store_item_smooth_scale_set(Ewk_Tiled_Backing_Store_Item* item, Eina_Bool smoothScale) { - if (item->smooth_scale == smoothScale) + if (item->smoothScale == smoothScale) return; if (item->tile) @@ -548,16 +549,16 @@ static Eina_Bool _ewk_tiled_backing_store_view_cols_end_add(Ewk_Tiled_Backing_St unsigned int i, row = rowList - priv->view.items; for (i = 0; i < count; i++, baseColumn++) { - Ewk_Tiled_Backing_Store_Item* it; + Ewk_Tiled_Backing_Store_Item* item; - it = _ewk_tiled_backing_store_item_add(priv, baseColumn, row); - if (!it) { + item = _ewk_tiled_backing_store_item_add(priv, baseColumn, row); + if (!item) { CRITICAL("failed to add column %u of %u in row %u.", i, count, row); _ewk_tiled_backing_store_view_cols_end_del(priv, rowList, i); return false; } - *rowList = eina_inlist_append(*rowList, EINA_INLIST_GET(it)); + *rowList = eina_inlist_append(*rowList, EINA_INLIST_GET(item)); } return true; } @@ -591,7 +592,7 @@ static void _ewk_tiled_backing_store_view_rows_all_del(Ewk_Tiled_Backing_Store_D free(priv->view.items); priv->view.items = 0; - priv->view.cols = 0; + priv->view.columns = 0; priv->view.rows = 0; } @@ -600,7 +601,7 @@ static void _ewk_tiled_backing_store_render(void* data, Ewk_Tile* tile, const Ei Ewk_Tiled_Backing_Store_Data* priv = static_cast<Ewk_Tiled_Backing_Store_Data*>(data); INF("TODO %p (visible? %d) [%lu,%lu] %d,%d + %dx%d", - tile, tile->visible, tile->col, tile->row, area->x, area->y, area->w, area->h); + tile, tile->visible, tile->column, tile->row, area->x, area->y, area->w, area->h); if (!tile->visible) return; @@ -657,7 +658,7 @@ static void _ewk_tiled_backing_store_mem_dbg(Ewk_Tiled_Backing_Store_Data* priv) run++; printf("\n--- BEGIN DEBUG TILED BACKING STORE MEMORY [%d] --\n" - "t=%0.2f, obj=%p, priv=%p, view.items=%p, matrix=%p\n", + "tile=%0.2f, obj=%p, priv=%p, view.items=%p, matrix=%p\n", run, ecore_loop_time_get(), priv->self, priv, priv->view.items, priv->model.matrix); @@ -669,13 +670,13 @@ static void _ewk_tiled_backing_store_mem_dbg(Ewk_Tiled_Backing_Store_Data* priv) static Eina_Bool _ewk_tiled_backing_store_sig_usr(void* data, int type, void* event) { - Ecore_Event_Signal_User* sig = (Ecore_Event_Signal_User*)event; + Ecore_Event_Signal_User* signalUser = (Ecore_Event_Signal_User*)event; Ewk_Tiled_Backing_Store_Data* priv = (Ewk_Tiled_Backing_Store_Data*)data; - if (sig->number == 2) { - Ewk_Tile_Unused_Cache* tilieUnusedCache; - tilieUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); - ewk_tile_unused_cache_auto_flush(tilieUnusedCache); + if (signalUser->number == 2) { + Ewk_Tile_Unused_Cache* tileUnusedCache; + tileUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); + ewk_tile_unused_cache_auto_flush(tileUnusedCache); } _ewk_tiled_backing_store_view_dbg(priv); @@ -698,8 +699,8 @@ static void _ewk_tiled_backing_store_smart_add(Evas_Object* ewkBackingStore) priv->view.tile.zoom = 1.0; priv->view.tile.width = defaultTileWidth; priv->view.tile.height = defaultTileHeigth; - priv->view.offset.cur.x = 0; - priv->view.offset.cur.y = 0; + priv->view.offset.current.x = 0; + priv->view.offset.current.y = 0; priv->view.offset.old.x = 0; priv->view.offset.old.y = 0; priv->view.offset.base.x = 0; @@ -734,7 +735,7 @@ static void _ewk_tiled_backing_store_smart_add(Evas_Object* ewkBackingStore) evas_object_clip_set(priv->contentsClipper, priv->base.clipper); #ifdef DEBUG_MEM_LEAKS - priv->sig_usr = ecore_event_handler_add + priv->signalUser = ecore_event_handler_add (ECORE_EVENT_SIGNAL_USER, _ewk_tiled_backing_store_sig_usr, priv); #endif } @@ -742,7 +743,7 @@ static void _ewk_tiled_backing_store_smart_add(Evas_Object* ewkBackingStore) static void _ewk_tiled_backing_store_smart_del(Evas_Object* ewkBackingStore) { PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); - DBG("ewkBackingStore%p", ewkBackingStore); + DBG("ewkBackingStore=%p", ewkBackingStore); Ewk_Tile_Unused_Cache* tileUnusedCache; tileUnusedCache = ewk_tile_matrix_unused_cache_get(priv->model.matrix); @@ -774,7 +775,7 @@ static void _ewk_tiled_backing_store_smart_del(Evas_Object* ewkBackingStore) static void _ewk_tiled_backing_store_smart_move(Evas_Object* ewkBackingStore, Evas_Coord x, Evas_Coord y) { - DBG("ewkBackingStore%p, new pos: %dx%d", ewkBackingStore, x, y); + DBG("ewkBackingStore=%p, new pos: %dx%d", ewkBackingStore, x, y); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); @@ -790,7 +791,7 @@ static void _ewk_tiled_backing_store_smart_move(Evas_Object* ewkBackingStore, Ev static void _ewk_tiled_backing_store_smart_resize(Evas_Object* ewkBackingStore, Evas_Coord width, Evas_Coord height) { - DBG("ewkBackingStore%p, new size: %dx%d", ewkBackingStore, width, height); + DBG("ewkBackingStore=%p, new size: %dx%d", ewkBackingStore, width, height); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); @@ -824,18 +825,18 @@ static void _ewk_tiled_backing_store_smart_hide(Evas_Object* ewkBackingStore) static void _ewk_tiled_backing_store_recalc_renderers(Ewk_Tiled_Backing_Store_Data* priv, Evas_Coord width, Evas_Coord height, Evas_Coord tileWidth, Evas_Coord tileHeight) { long columns, rows, oldRows, oldCols; - INF("ewkBackingStore%p, new size: %dx%d", priv->self, width, height); + INF("ewkBackingStore=%p, new size: %dx%d", priv->self, width, height); columns = 1 + static_cast<int>(ceil(width / static_cast<float>(tileWidth))); rows = 1 + static_cast<int>(ceil(height / static_cast<float>(tileHeight))); - INF("ewkBackingStore%p new grid size cols: %ld, rows: %ld, was %ld, %ld", - priv->self, columns, rows, priv->view.cols, priv->view.rows); + INF("ewkBackingStore=%p new grid size columns: %ld, rows: %ld, was %ld, %ld", + priv->self, columns, rows, priv->view.columns, priv->view.rows); - if (priv->view.cols == columns && priv->view.rows == rows) + if (priv->view.columns == columns && priv->view.rows == rows) return; - oldCols = priv->view.cols; + oldCols = priv->view.columns; oldRows = priv->view.rows; if (rows < oldRows) { @@ -851,14 +852,14 @@ static void _ewk_tiled_backing_store_recalc_renderers(Ewk_Tiled_Backing_Store_Da priv->view.items = static_cast<Eina_Inlist**>(newItems); priv->view.rows = rows; - priv->view.cols = columns; + priv->view.columns = columns; if (rows > oldRows) { Eina_Inlist** start = priv->view.items + oldRows; Eina_Inlist** end = priv->view.items + rows; for (; start < end; start++) { *start = 0; - Eina_Bool r = _ewk_tiled_backing_store_view_cols_end_add(priv, start, 0, columns); - if (!r) { + Eina_Bool result = _ewk_tiled_backing_store_view_cols_end_add(priv, start, 0, columns); + if (!result) { CRITICAL("failed to allocate %ld columns", columns); _ewk_tiled_backing_store_view_rows_range_del(priv, priv->view.items + oldRows, start); priv->view.rows = oldRows; @@ -914,11 +915,11 @@ static inline void _ewk_tiled_backing_store_view_dbg(const Ewk_Tiled_Backing_Sto { Eina_Inlist** start, **end; printf("tiles=%2ld,%2ld model=%2ld,%2ld [%dx%d] base=%+3ld,%+4ld offset=%+4d,%+4d old=%+4d,%+4d base=%+3d,%+3d\n", - priv->view.cols, priv->view.rows, + priv->view.columns, priv->view.rows, priv->model.current.columns, priv->model.current.rows, priv->model.width, priv->model.height, priv->model.base.column, priv->model.base.row, - priv->view.offset.cur.x, priv->view.offset.cur.y, + priv->view.offset.current.x, priv->view.offset.current.y, priv->view.offset.old.x, priv->view.offset.old.y, priv->view.offset.base.x, priv->view.offset.base.y); @@ -933,7 +934,7 @@ static inline void _ewk_tiled_backing_store_view_dbg(const Ewk_Tiled_Backing_Sto if (!item->tile) printf(" ;"); else - printf("%8p %lu,%lu;", item->tile, item->tile->col, item->tile->row); + printf("%8p %lu,%lu;", item->tile, item->tile->column, item->tile->row); } printf("\n"); } @@ -971,7 +972,7 @@ static void _ewk_tiled_backing_store_view_wrap_up(Ewk_Tiled_Backing_Store_Data* Eina_Inlist* temp = *iteratorStart; Ewk_Tiled_Backing_Store_Item* item; Evas_Coord tilePositionX = originX; - int count1 = 0; + int column = 0; for (iteratorList = iteratorStart; iteratorList < iteratorEnd; iteratorList++) *iteratorList = *(iteratorList + 1); @@ -981,8 +982,8 @@ static void _ewk_tiled_backing_store_view_wrap_up(Ewk_Tiled_Backing_Store_Data* EINA_INLIST_FOREACH(temp, item) { _ewk_tiled_backing_store_item_move(item, tilePositionX, tilePositionY); tilePositionX += tileWidth; - _ewk_tiled_backing_store_item_fill(priv, item, count1, lastRow); - count1++; + _ewk_tiled_backing_store_item_fill(priv, item, column, lastRow); + column++; } tilePositionY += tileHeight; } @@ -1019,7 +1020,7 @@ static void _ewk_tiled_backing_store_view_wrap_down(Ewk_Tiled_Backing_Store_Data Eina_Inlist* temp = *iteratorStart; Ewk_Tiled_Backing_Store_Item* item; Evas_Coord tilePositionX = originX; - int count1 = 0; + int column = 0; for (iteratorList = iteratorStart; iteratorList > iteratorEnd; iteratorList--) *iteratorList = *(iteratorList - 1); @@ -1029,8 +1030,8 @@ static void _ewk_tiled_backing_store_view_wrap_down(Ewk_Tiled_Backing_Store_Data EINA_INLIST_FOREACH(temp, item) { _ewk_tiled_backing_store_item_move(item, tilePositionX, tilePositionY); tilePositionX += tileWidth; - _ewk_tiled_backing_store_item_fill(priv, item, count1, 0); - count1++; + _ewk_tiled_backing_store_item_fill(priv, item, column, 0); + column++; } tilePositionY -= tileHeight; } @@ -1041,22 +1042,22 @@ static void _ewk_tiled_backing_store_view_wrap_down(Ewk_Tiled_Backing_Store_Data * @internal * Move left-most (first) column right as last (right-most). * - * The final result is visually the same, but logically the first col that + * The final result is visually the same, but logically the first column that * went out of screen is now at last and filled with new model items. * * This is worth just when @a count is smaller than @c - * priv->view.cols, after that one is refilling the whole matrix so it + * priv->view.columns, after that one is refilling the whole matrix so it * is better to trigger full refill. * * @param count the number of times to repeat the process. */ static void _ewk_tiled_backing_store_view_wrap_left(Ewk_Tiled_Backing_Store_Data* priv, Evas_Coord x, Evas_Coord y, unsigned int count) { - unsigned int row, lastColumn = priv->view.cols - 1; + unsigned int row, lastColumn = priv->view.columns - 1; Evas_Coord tileWidth = priv->view.tile.width; Evas_Coord tileHeight = priv->view.tile.height; Evas_Coord offsetX = priv->view.offset.base.x + count * tileWidth; - Evas_Coord oy = y + priv->view.offset.base.y; + Evas_Coord offsetY = y + priv->view.offset.base.y; Eina_Inlist** iterator; Eina_Inlist** iteratorEnd; unsigned int baseColumn = lastColumn - count + 1; @@ -1077,10 +1078,10 @@ static void _ewk_tiled_backing_store_view_wrap_left(Ewk_Tiled_Backing_Store_Data it = EINA_INLIST_CONTAINER_GET(*iterator, Ewk_Tiled_Backing_Store_Item); *iterator = eina_inlist_demote(*iterator, *iterator); - _ewk_tiled_backing_store_item_move(it, tilePositionX, oy); + _ewk_tiled_backing_store_item_move(it, tilePositionX, offsetY); _ewk_tiled_backing_store_item_fill(priv, it, column, row); } - oy += tileHeight; + offsetY += tileHeight; } priv->view.offset.base.x = offsetX; @@ -1090,11 +1091,11 @@ static void _ewk_tiled_backing_store_view_wrap_left(Ewk_Tiled_Backing_Store_Data * @internal * Move right-most (last) column left as first (left-most). * - * The final result is visually the same, but logically the last col that + * The final result is visually the same, but logically the last column that * went out of screen is now at first and filled with new model items. * * This is worth just when @a count is smaller than @c - * priv->view.cols, after that one is refilling the whole matrix so it + * priv->view.columns, after that one is refilling the whole matrix so it * is better to trigger full refill. * * @param count the number of times to repeat the process. @@ -1138,7 +1139,7 @@ static void _ewk_tiled_backing_store_view_refill(Ewk_Tiled_Backing_Store_Data* p { Eina_Inlist** iterator, **iteratorEnd; Evas_Coord baseTilePositionX, tilePositionY, tileWidth, tileHeight; - unsigned int r; + unsigned int row; evas_object_move(priv->base.clipper, x, y); @@ -1150,19 +1151,19 @@ static void _ewk_tiled_backing_store_view_refill(Ewk_Tiled_Backing_Store_Data* p iterator = priv->view.items; iteratorEnd = iterator + priv->view.rows; - r = 0; + row = 0; priv->model.base.column -= stepX; priv->model.base.row -= stepY; - for (; iterator < iteratorEnd; iterator++, r++) { + for (; iterator < iteratorEnd; iterator++, row++) { Ewk_Tiled_Backing_Store_Item* item; Evas_Coord newTilePositionX = baseTilePositionX; - unsigned int count = 0; + unsigned int column = 0; EINA_INLIST_FOREACH(*iterator, item) { - _ewk_tiled_backing_store_item_fill(priv, item, count, r); + _ewk_tiled_backing_store_item_fill(priv, item, column, row); _ewk_tiled_backing_store_item_move(item, newTilePositionX, tilePositionY); - count++; + column++; newTilePositionX += tileWidth; } tilePositionY += tileHeight; @@ -1185,11 +1186,11 @@ static void _ewk_tiled_backing_store_view_pos_apply(Ewk_Tiled_Backing_Store_Data iterator = priv->view.items; iteratorEnd = iterator + priv->view.rows; for (; iterator < iteratorEnd; iterator++) { - Ewk_Tiled_Backing_Store_Item* it; - Evas_Coord ox = baseTilePositionX; - EINA_INLIST_FOREACH(*iterator, it) { - _ewk_tiled_backing_store_item_move(it, ox, baseTilePositionY); - ox += tileWidth; + Ewk_Tiled_Backing_Store_Item* item; + Evas_Coord offsetX = baseTilePositionX; + EINA_INLIST_FOREACH(*iterator, item) { + _ewk_tiled_backing_store_item_move(item, offsetX, baseTilePositionY); + offsetX += tileWidth; } baseTilePositionY += tileHeight; } @@ -1197,28 +1198,28 @@ static void _ewk_tiled_backing_store_view_pos_apply(Ewk_Tiled_Backing_Store_Data static void _ewk_tiled_backing_store_smart_calculate_offset_force(Ewk_Tiled_Backing_Store_Data* priv) { - Evas_Coord deltaX = priv->view.offset.cur.x - priv->view.offset.old.x; - Evas_Coord deltaY = priv->view.offset.cur.y - priv->view.offset.old.y; + Evas_Coord deltaX = priv->view.offset.current.x - priv->view.offset.old.x; + Evas_Coord deltaY = priv->view.offset.current.y - priv->view.offset.old.y; Evas_Coord tileWidth, tileHeight; int stepY, stepX; - INF("ewkBackingStore%p, offset: %+4d, %+4d (%+4d, %+4d)", - priv->self, deltaX, deltaY, priv->view.offset.cur.x, priv->view.offset.cur.y); + INF("ewkBackingStore=%p, offset: %+4d, %+4d (%+4d, %+4d)", + priv->self, deltaX, deltaY, priv->view.offset.current.x, priv->view.offset.current.y); tileWidth = priv->view.tile.width; tileHeight = priv->view.tile.height; - long newColumn = -priv->view.offset.cur.x / tileWidth; + long newColumn = -priv->view.offset.current.x / tileWidth; stepX = priv->model.base.column - newColumn; - long newRow = -priv->view.offset.cur.y / tileHeight; + long newRow = -priv->view.offset.current.y / tileHeight; stepY = priv->model.base.row - newRow; - priv->view.offset.old.x = priv->view.offset.cur.x; - priv->view.offset.old.y = priv->view.offset.cur.y; + priv->view.offset.old.x = priv->view.offset.current.x; + priv->view.offset.old.y = priv->view.offset.current.y; evas_object_move( priv->contentsClipper, - priv->view.offset.cur.x + priv->view.x, - priv->view.offset.cur.y + priv->view.y); + priv->view.offset.current.x + priv->view.x, + priv->view.offset.current.y + priv->view.y); priv->view.offset.base.x += deltaX - stepX * tileWidth; priv->view.offset.base.y += deltaY - stepY * tileHeight; @@ -1229,13 +1230,13 @@ static void _ewk_tiled_backing_store_smart_calculate_offset_force(Ewk_Tiled_Back static void _ewk_tiled_backing_store_smart_calculate_offset(Ewk_Tiled_Backing_Store_Data* priv, Evas_Coord x, Evas_Coord y) { - Evas_Coord deltaX = priv->view.offset.cur.x - priv->view.offset.old.x; - Evas_Coord deltaY = priv->view.offset.cur.y - priv->view.offset.old.y; + Evas_Coord deltaX = priv->view.offset.current.x - priv->view.offset.old.x; + Evas_Coord deltaY = priv->view.offset.current.y - priv->view.offset.old.y; Evas_Coord tileWidth, tileHeight; int stepY, stepX; - INF("ewkBackingStore%p, offset: %+4d, %+4d (%+4d, %+4d)", - priv->self, deltaX, deltaY, priv->view.offset.cur.x, priv->view.offset.cur.y); + INF("ewkBackingStore=%p, offset: %+4d, %+4d (%+4d, %+4d)", + priv->self, deltaX, deltaY, priv->view.offset.current.x, priv->view.offset.current.y); if (!deltaX && !deltaY) return; @@ -1243,20 +1244,20 @@ static void _ewk_tiled_backing_store_smart_calculate_offset(Ewk_Tiled_Backing_St tileWidth = priv->view.tile.width; tileHeight = priv->view.tile.height; - long newCol = -priv->view.offset.cur.x / tileWidth; + long newCol = -priv->view.offset.current.x / tileWidth; stepX = priv->model.base.column - newCol; - long newRow = -priv->view.offset.cur.y / tileHeight; + long newRow = -priv->view.offset.current.y / tileHeight; stepY = priv->model.base.row - newRow; - priv->view.offset.old.x = priv->view.offset.cur.x; - priv->view.offset.old.y = priv->view.offset.cur.y; + priv->view.offset.old.x = priv->view.offset.current.x; + priv->view.offset.old.y = priv->view.offset.current.y; evas_object_move( priv->contentsClipper, - priv->view.offset.cur.x + priv->view.x, - priv->view.offset.cur.y + priv->view.y); + priv->view.offset.current.x + priv->view.x, + priv->view.offset.current.y + priv->view.y); - if ((stepX < 0 && stepX <= -priv->view.cols) - || (stepX > 0 && stepX >= priv->view.cols) + if ((stepX < 0 && stepX <= -priv->view.columns) + || (stepX > 0 && stepX >= priv->view.columns) || (stepY < 0 && stepY <= -priv->view.rows) || (stepY > 0 && stepY >= priv->view.rows)) { @@ -1291,8 +1292,8 @@ static void _ewk_tiled_backing_store_smart_calculate_pos(Ewk_Tiled_Backing_Store priv->view.y = y; evas_object_move( priv->contentsClipper, - priv->view.offset.cur.x + priv->view.x, - priv->view.offset.cur.y + priv->view.y); + priv->view.offset.current.x + priv->view.x, + priv->view.offset.current.y + priv->view.y); } static void _ewk_tiled_backing_store_fill_renderers(Ewk_Tiled_Backing_Store_Data* priv) @@ -1314,7 +1315,7 @@ static void _ewk_tiled_backing_store_smart_calculate(Evas_Object* ewkBackingStor Evas_Coord x, y, width, height; evas_object_geometry_get(ewkBackingStore, &x, &y, &width, &height); - DBG("ewkBackingStore%p at %d,%d + %dx%d", ewkBackingStore, x, y, width, height); + DBG("ewkBackingStore=%p at %d,%d + %dx%d", ewkBackingStore, x, y, width, height); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); @@ -1322,10 +1323,10 @@ static void _ewk_tiled_backing_store_smart_calculate(Evas_Object* ewkBackingStor ewk_tile_matrix_freeze(priv->model.matrix); - if (priv->changed.model && !priv->changed.size) + if (priv->changed.contentsSize) ewk_tile_matrix_invalidate(priv->model.matrix); - if (!priv->render.suspend && priv->changed.model) { + if (!priv->render.suspend && (priv->changed.model || priv->changed.contentsSize)) { unsigned long columns, rows; columns = priv->model.width / priv->view.tile.width + 1; @@ -1356,7 +1357,7 @@ static void _ewk_tiled_backing_store_smart_calculate(Evas_Object* ewkBackingStor priv->changed.size = false; } - if (!priv->render.suspend && priv->changed.model) { + if (!priv->render.suspend && (priv->changed.model || priv->changed.contentsSize)) { _ewk_tiled_backing_store_fill_renderers(priv); ewk_tile_matrix_resize(priv->model.matrix, priv->model.current.columns, @@ -1371,6 +1372,8 @@ static void _ewk_tiled_backing_store_smart_calculate(Evas_Object* ewkBackingStor { 0, 0, priv->model.width, priv->model.height }; ewk_tile_matrix_update(priv->model.matrix, &rect, priv->view.tile.zoom); + + priv->changed.contentsSize = false; } ewk_tile_matrix_thaw(priv->model.matrix); @@ -1381,10 +1384,10 @@ static void _ewk_tiled_backing_store_smart_calculate(Evas_Object* ewkBackingStor || priv->view.offset.base.x <= - priv->view.tile.width || priv->view.offset.base.y > 0 || priv->view.offset.base.y <= - priv->view.tile.height) - ERR("incorrect base offset %+4d,%+4d, tile=%dx%d, cur=%+4d,%+4d\n", + ERR("incorrect base offset %+4d,%+4d, tile=%dx%d, current=%+4d,%+4d\n", priv->view.offset.base.x, priv->view.offset.base.y, priv->view.tile.width, priv->view.tile.height, - priv->view.offset.cur.x, priv->view.offset.cur.y); + priv->view.offset.current.x, priv->view.offset.current.y); } @@ -1448,8 +1451,8 @@ static Eina_Bool _ewk_tiled_backing_store_scroll_full_offset_set_internal(Ewk_Ti if (priv->render.disabled) return false; - priv->view.offset.cur.x = x; - priv->view.offset.cur.y = y; + priv->view.offset.current.x = x; + priv->view.offset.current.y = y; priv->changed.offset = true; _ewk_tiled_backing_store_changed(priv); @@ -1459,10 +1462,10 @@ static Eina_Bool _ewk_tiled_backing_store_scroll_full_offset_set_internal(Ewk_Ti Eina_Bool ewk_tiled_backing_store_scroll_full_offset_set(Evas_Object* ewkBackingStore, Evas_Coord x, Evas_Coord y) { - DBG("ewkBackingStore%p, x=%d, y=%d", ewkBackingStore, x, y); + DBG("ewkBackingStore=%p, x=%d, y=%d", ewkBackingStore, x, y); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv, false); - if (x == priv->view.offset.cur.x && y == priv->view.offset.cur.y) + if (x == priv->view.offset.current.x && y == priv->view.offset.current.y) return true; return _ewk_tiled_backing_store_scroll_full_offset_set_internal(priv, x, y); @@ -1470,20 +1473,20 @@ Eina_Bool ewk_tiled_backing_store_scroll_full_offset_set(Evas_Object* ewkBacking Eina_Bool ewk_tiled_backing_store_scroll_full_offset_add(Evas_Object* ewkBackingStore, Evas_Coord deltaX, Evas_Coord deltaY) { - DBG("ewkBackingStore%p, deltaX=%d, deltaY=%d", ewkBackingStore, deltaX, deltaY); + DBG("ewkBackingStore=%p, deltaX=%d, deltaY=%d", ewkBackingStore, deltaX, deltaY); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv, false); if (!deltaX && !deltaY) return true; return _ewk_tiled_backing_store_scroll_full_offset_set_internal - (priv, priv->view.offset.cur.x + deltaX, priv->view.offset.cur.y + deltaY); + (priv, priv->view.offset.current.x + deltaX, priv->view.offset.current.y + deltaY); } static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_Store_Data* priv, float* zoom, Evas_Coord currentX, Evas_Coord currentY, Evas_Coord* offsetX, Evas_Coord* offsetY) { - *offsetX = priv->view.offset.cur.x; - *offsetY = priv->view.offset.cur.y; + *offsetX = priv->view.offset.current.x; + *offsetY = priv->view.offset.current.y; if (fabsf(priv->view.tile.zoom - *zoom) < zoomStepMinimum) { DBG("ignored as zoom difference is < %f: %f", @@ -1514,10 +1517,10 @@ static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_St return true; } Eina_Inlist** iterator, **iteratorEnd; - Ewk_Tiled_Backing_Store_Item* it; + Ewk_Tiled_Backing_Store_Item* item; - Evas_Coord newX = currentX + (priv->view.offset.cur.x - currentX) * scale; - Evas_Coord newY = currentY + (priv->view.offset.cur.y - currentY) * scale; + Evas_Coord newX = currentX + (priv->view.offset.current.x - currentX) * scale; + Evas_Coord newY = currentY + (priv->view.offset.current.y - currentY) * scale; Evas_Coord modelWidth = priv->model.width * scale; Evas_Coord modelHeight = priv->model.height * scale; @@ -1541,15 +1544,15 @@ static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_St priv->changed.model = true; _ewk_tiled_backing_store_changed(priv); - priv->view.offset.cur.x = newX; - priv->view.offset.cur.y = newY; + priv->view.offset.current.x = newX; + priv->view.offset.current.y = newY; priv->view.offset.base.x = baseX; priv->view.offset.base.y = baseY; - priv->view.offset.old.x = priv->view.offset.cur.x; - priv->view.offset.old.y = priv->view.offset.cur.y; - *offsetX = priv->view.offset.cur.x; - *offsetY = priv->view.offset.cur.y; + priv->view.offset.old.x = priv->view.offset.current.x; + priv->view.offset.old.y = priv->view.offset.current.y; + *offsetX = priv->view.offset.current.x; + *offsetY = priv->view.offset.current.y; evas_object_move( priv->contentsClipper, @@ -1568,9 +1571,9 @@ static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_St Evas_Coord tilePositionX = baseTilePositionX; Eina_Inlist* lst = *iterator; - EINA_INLIST_FOREACH(lst, it) { - _ewk_tiled_backing_store_item_move(it, tilePositionX, tilePositionY); - _ewk_tiled_backing_store_item_resize(it, tileWidth, tileHeight); + EINA_INLIST_FOREACH(lst, item) { + _ewk_tiled_backing_store_item_move(item, tilePositionX, tilePositionY); + _ewk_tiled_backing_store_item_resize(item, tileWidth, tileHeight); tilePositionX += tileWidth; } tilePositionY += tileHeight; @@ -1581,7 +1584,7 @@ static Eina_Bool _ewk_tiled_backing_store_zoom_set_internal(Ewk_Tiled_Backing_St Eina_Bool ewk_tiled_backing_store_zoom_set(Evas_Object* ewkBackingStore, float* zoom, Evas_Coord currentX, Evas_Coord currentY, Evas_Coord* offsetX, Evas_Coord* offsetY) { - DBG("ewkBackingStore%p, zoom=%f", ewkBackingStore, *zoom); + DBG("ewkBackingStore=%p, zoom=%f", ewkBackingStore, *zoom); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv, false); @@ -1590,7 +1593,7 @@ Eina_Bool ewk_tiled_backing_store_zoom_set(Evas_Object* ewkBackingStore, float* Eina_Bool ewk_tiled_backing_store_zoom_weak_set(Evas_Object* ewkBackingStore, float zoom, Evas_Coord currentX, Evas_Coord currentY) { - DBG("ewkBackingStore%p, zoom=%f", ewkBackingStore, zoom); + DBG("ewkBackingStore=%p, zoom=%f", ewkBackingStore, zoom); PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv, false); if (!priv->view.width || !priv->view.height) return false; @@ -1613,8 +1616,8 @@ Eina_Bool ewk_tiled_backing_store_zoom_weak_set(Evas_Object* ewkBackingStore, fl int vrows = static_cast<int>(ceil(priv->view.height /static_cast<float>(tileHeight)) + 1); int vcols = static_cast<int>(ceil(priv->view.width / static_cast<float>(tileWidth)) + 1); - Evas_Coord newX = currentX + (priv->view.offset.cur.x - currentX) * scale; - Evas_Coord newY = currentY + (priv->view.offset.cur.y - currentY) * scale; + Evas_Coord newX = currentX + (priv->view.offset.current.x - currentX) * scale; + Evas_Coord newY = currentY + (priv->view.offset.current.y - currentY) * scale; Evas_Coord baseX = newX % tileWidth; Evas_Coord baseY = newY % tileHeight; unsigned long baseRow = -newY / tileHeight; @@ -1626,7 +1629,7 @@ Eina_Bool ewk_tiled_backing_store_zoom_weak_set(Evas_Object* ewkBackingStore, fl reCalculate = true; } - if (vrows > priv->view.rows || vcols > priv->view.cols) + if (vrows > priv->view.rows || vcols > priv->view.columns) reCalculate = true; if (reCalculate) { @@ -1667,8 +1670,8 @@ void ewk_tiled_backing_store_fix_offsets(Evas_Object* ewkBackingStore, Evas_Coor PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); Eina_Inlist** iterator, **iteratorEnd; Ewk_Tiled_Backing_Store_Item* item; - Evas_Coord newX = priv->view.offset.cur.x; - Evas_Coord newY = priv->view.offset.cur.y; + Evas_Coord newX = priv->view.offset.current.x; + Evas_Coord newY = priv->view.offset.current.y; Evas_Coord baseX = priv->view.offset.base.x; Evas_Coord baseY = priv->view.offset.base.y; Evas_Coord tileWidth = priv->view.tile.width; @@ -1696,8 +1699,8 @@ void ewk_tiled_backing_store_fix_offsets(Evas_Object* ewkBackingStore, Evas_Coor priv->model.base.row = -newY / tileHeight; } - priv->view.offset.cur.x = newX; - priv->view.offset.cur.y = newY; + priv->view.offset.current.x = newX; + priv->view.offset.current.y = newY; priv->view.offset.old.x = newX; priv->view.offset.old.y = newY; priv->view.offset.base.x = baseX; @@ -1796,7 +1799,7 @@ void ewk_tiled_backing_store_contents_resize(Evas_Object* ewkBackingStore, Evas_ priv->model.width = width; priv->model.height = height; - priv->changed.model = true; + priv->changed.contentsSize = true; DBG("w,h=%d, %d", width, height); _ewk_tiled_backing_store_changed(priv); @@ -1815,8 +1818,8 @@ void ewk_tiled_backing_store_flush(Evas_Object* ewkBackingStore) PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv); Ewk_Tile_Unused_Cache* tileUnusedCache = 0; - priv->view.offset.cur.x = 0; - priv->view.offset.cur.y = 0; + priv->view.offset.current.x = 0; + priv->view.offset.current.y = 0; priv->view.offset.old.x = 0; priv->view.offset.old.y = 0; priv->view.offset.base.x = 0; @@ -1956,7 +1959,7 @@ Eina_Bool ewk_tiled_backing_store_pre_render_region(Evas_Object* ewkBackingStore { PRIV_DATA_GET_OR_RETURN(ewkBackingStore, priv, false); Eina_Tile_Grid_Slicer slicer; - const Eina_Tile_Grid_Info* info; + const Eina_Tile_Grid_Info* gridInfo; Evas_Coord tileWidth, tileHeight; Ewk_Tile_Unused_Cache* tileUnusedCache; @@ -1970,10 +1973,10 @@ Eina_Bool ewk_tiled_backing_store_pre_render_region(Evas_Object* ewkBackingStore return false; } - while (eina_tile_grid_slicer_next(&slicer, &info)) { - const unsigned long c = info->col; - const unsigned long r = info->row; - if (!_ewk_tiled_backing_store_pre_render_request_add(priv, c, r, zoom)) + while (eina_tile_grid_slicer_next(&slicer, &gridInfo)) { + const unsigned long column = gridInfo->col; + const unsigned long row = gridInfo->row; + if (!_ewk_tiled_backing_store_pre_render_request_add(priv, column, row, zoom)) break; } @@ -1997,7 +2000,7 @@ Eina_Bool ewk_tiled_backing_store_pre_render_relative_radius(Evas_Object* ewkBac endRow = std::min(priv->model.current.rows - 1, priv->model.base.row + priv->view.rows + n - 1); endCol = std::min(priv->model.current.columns - 1, - priv->model.base.column + priv->view.cols + n - 1); + priv->model.base.column + priv->view.columns + n - 1); INF("startRow=%lu, endRow=%lu, startCol=%lu, endCol=%lu", startRow, endRow, startCol, endCol); diff --git a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h index e93ccf799..7b8ce0d6f 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h +++ b/Source/WebKit/efl/ewk/ewk_tiled_backing_store.h @@ -62,9 +62,9 @@ struct _Ewk_Tile_Stats { }; struct _Ewk_Tile { - Eina_Tiler* updates; /**< updated/dirty areas */ + Eina_Tiler *updates; /**< updated/dirty areas */ Ewk_Tile_Stats stats; /**< tile usage statistics */ - unsigned long col, row; /**< tile tile position */ + unsigned long column, row; /**< tile tile position */ Evas_Coord x, y; /**< tile coordinate position */ /** Never ever change those after tile is created (respect const!) */ @@ -76,45 +76,45 @@ struct _Ewk_Tile { * alignement! */ int visible; /**< visibility counter of this tile */ - Evas_Object* image; /**< Evas Image, the tile to be rendered */ - uint8_t* pixels; + Evas_Object *image; /**< Evas Image, the tile to be rendered */ + uint8_t *pixels; }; #include "ewk_tiled_matrix.h" #include "ewk_tiled_model.h" /* view */ -Evas_Object* ewk_tiled_backing_store_add(Evas* e); - -void ewk_tiled_backing_store_render_cb_set(Evas_Object *o, Eina_Bool (*cb)(void* data, Ewk_Tile* t, const Eina_Rectangle* area), const void* data); - -Eina_Bool ewk_tiled_backing_store_scroll_full_offset_set(Evas_Object* o, Evas_Coord x, Evas_Coord y); -Eina_Bool ewk_tiled_backing_store_scroll_full_offset_add(Evas_Object* o, Evas_Coord dx, Evas_Coord dy); -Eina_Bool ewk_tiled_backing_store_scroll_inner_offset_add(Evas_Object* o, Evas_Coord dx, Evas_Coord dy, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); - -Eina_Bool ewk_tiled_backing_store_zoom_set(Evas_Object* o, float* zoom, Evas_Coord cx, Evas_Coord cy, Evas_Coord* offx, Evas_Coord* offy); -Eina_Bool ewk_tiled_backing_store_zoom_weak_set(Evas_Object* o, float zoom, Evas_Coord cx, Evas_Coord cy); -void ewk_tiled_backing_store_fix_offsets(Evas_Object* o, Evas_Coord w, Evas_Coord h); -void ewk_tiled_backing_store_zoom_weak_smooth_scale_set(Evas_Object* o, Eina_Bool smooth_scale); -void ewk_tiled_backing_store_alpha_set(Evas_Object* o, Eina_Bool has_alpha); -Eina_Bool ewk_tiled_backing_store_update(Evas_Object* o, const Eina_Rectangle* update); -void ewk_tiled_backing_store_updates_process_pre_set(Evas_Object* o, void*(*cb)(void* data, Evas_Object *o), const void* data); -void ewk_tiled_backing_store_updates_process_post_set(Evas_Object* o, void*(*cb)(void* data, void* pre_data, Evas_Object *o), const void* data); -void ewk_tiled_backing_store_updates_process(Evas_Object* o); -void ewk_tiled_backing_store_updates_clear(Evas_Object* o); -void ewk_tiled_backing_store_contents_resize(Evas_Object* o, Evas_Coord width, Evas_Coord height); -void ewk_tiled_backing_store_disabled_update_set(Evas_Object* o, Eina_Bool value); -void ewk_tiled_backing_store_flush(Evas_Object* o); -void ewk_tiled_backing_store_enable_scale_set(Evas_Object* o, Eina_Bool value); - -Ewk_Tile_Unused_Cache* ewk_tiled_backing_store_tile_unused_cache_get(const Evas_Object* o); -void ewk_tiled_backing_store_tile_unused_cache_set(Evas_Object* o, Ewk_Tile_Unused_Cache* tuc); - -Eina_Bool ewk_tiled_backing_store_pre_render_region(Evas_Object* o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom); -Eina_Bool ewk_tiled_backing_store_pre_render_relative_radius(Evas_Object* o, unsigned int n, float zoom); -Eina_Bool ewk_tiled_backing_store_pre_render_spiral_queue(Evas_Object* o, Eina_Rectangle* view_rect, Eina_Rectangle* render_rect, int max_memory, float zoom); -void ewk_tiled_backing_store_pre_render_cancel(Evas_Object* o); - -Eina_Bool ewk_tiled_backing_store_disable_render(Evas_Object* o); -Eina_Bool ewk_tiled_backing_store_enable_render(Evas_Object* o); +Evas_Object *ewk_tiled_backing_store_add(Evas *e); + +void ewk_tiled_backing_store_render_cb_set(Evas_Object *o, Eina_Bool (*cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *area), const void *data); + +Eina_Bool ewk_tiled_backing_store_scroll_full_offset_set(Evas_Object *o, Evas_Coord x, Evas_Coord y); +Eina_Bool ewk_tiled_backing_store_scroll_full_offset_add(Evas_Object *o, Evas_Coord dx, Evas_Coord dy); +Eina_Bool ewk_tiled_backing_store_scroll_inner_offset_add(Evas_Object *o, Evas_Coord dx, Evas_Coord dy, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h); + +Eina_Bool ewk_tiled_backing_store_zoom_set(Evas_Object *o, float *zoom, Evas_Coord cx, Evas_Coord cy, Evas_Coord *offx, Evas_Coord *offy); +Eina_Bool ewk_tiled_backing_store_zoom_weak_set(Evas_Object *o, float zoom, Evas_Coord cx, Evas_Coord cy); +void ewk_tiled_backing_store_fix_offsets(Evas_Object *o, Evas_Coord w, Evas_Coord h); +void ewk_tiled_backing_store_zoom_weak_smooth_scale_set(Evas_Object *o, Eina_Bool smooth_scale); +void ewk_tiled_backing_store_alpha_set(Evas_Object *o, Eina_Bool has_alpha); +Eina_Bool ewk_tiled_backing_store_update(Evas_Object *o, const Eina_Rectangle *update); +void ewk_tiled_backing_store_updates_process_pre_set(Evas_Object *o, void*(*cb)(void *data, Evas_Object *o), const void *data); +void ewk_tiled_backing_store_updates_process_post_set(Evas_Object *o, void*(*cb)(void *data, void *pre_data, Evas_Object *o), const void *data); +void ewk_tiled_backing_store_updates_process(Evas_Object *o); +void ewk_tiled_backing_store_updates_clear(Evas_Object *o); +void ewk_tiled_backing_store_contents_resize(Evas_Object *o, Evas_Coord width, Evas_Coord height); +void ewk_tiled_backing_store_disabled_update_set(Evas_Object *o, Eina_Bool value); +void ewk_tiled_backing_store_flush(Evas_Object *o); +void ewk_tiled_backing_store_enable_scale_set(Evas_Object *o, Eina_Bool value); + +Ewk_Tile_Unused_Cache *ewk_tiled_backing_store_tile_unused_cache_get(const Evas_Object *o); +void ewk_tiled_backing_store_tile_unused_cache_set(Evas_Object *o, Ewk_Tile_Unused_Cache *tuc); + +Eina_Bool ewk_tiled_backing_store_pre_render_region(Evas_Object *o, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom); +Eina_Bool ewk_tiled_backing_store_pre_render_relative_radius(Evas_Object *o, unsigned int n, float zoom); +Eina_Bool ewk_tiled_backing_store_pre_render_spiral_queue(Evas_Object *o, Eina_Rectangle* view_rect, Eina_Rectangle *render_rect, int max_memory, float zoom); +void ewk_tiled_backing_store_pre_render_cancel(Evas_Object *o); + +Eina_Bool ewk_tiled_backing_store_disable_render(Evas_Object *o); +Eina_Bool ewk_tiled_backing_store_enable_render(Evas_Object *o); #endif // ewk_tiled_backing_store_h diff --git a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp index ab06042ce..5d991b436 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_matrix.cpp @@ -44,7 +44,7 @@ typedef struct _Ewk_Tile_Matrix_Entry Ewk_Tile_Matrix_Entry; struct _Ewk_Tile_Matrix { Eina_Matrixsparse* matrix; Eina_Inlist* matrices; - Ewk_Tile_Unused_Cache* tilieUnusedCache; + Ewk_Tile_Unused_Cache* tileUnusedCache; Evas_Colorspace cspace; struct { void (*callback)(void* data, Ewk_Tile* tile, const Eina_Rectangle* update); @@ -94,7 +94,7 @@ static void _ewk_tile_matrix_cell_free(void* userData, void* cellData) if (!tile) return; - ewk_tile_unused_cache_freeze(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_freeze(tileMatrix->tileUnusedCache); if (tile->updates || tile->stats.full_update) tileMatrix->updates = eina_list_remove(tileMatrix->updates, tile); @@ -102,8 +102,8 @@ static void _ewk_tile_matrix_cell_free(void* userData, void* cellData) if (tile->visible) ERR("freeing cell that is visible, leaking tile %p", tile); else { - if (!ewk_tile_unused_cache_tile_get(tileMatrix->tilieUnusedCache, tile)) - ERR("tile %p was not in cache %p? leaking...", tile, tileMatrix->tilieUnusedCache); + if (!ewk_tile_unused_cache_tile_get(tileMatrix->tileUnusedCache, tile)) + ERR("tile %p was not in cache %p? leaking...", tile, tileMatrix->tileUnusedCache); else { Ewk_Tile_Matrix_Entry* entry; DBG("tile cell does not exist anymore, free it %p", tile); @@ -121,7 +121,7 @@ static void _ewk_tile_matrix_cell_free(void* userData, void* cellData) } } - ewk_tile_unused_cache_thaw(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_thaw(tileMatrix->tileUnusedCache); } /* called when cache of unused tile is flushed */ @@ -137,7 +137,7 @@ static void _ewk_tile_matrix_tile_free(void* data, Ewk_Tile* tile) return; } - if (!eina_matrixsparse_cell_idx_get(entry->matrix, tile->row, tile->col, &cell)) { + if (!eina_matrixsparse_cell_idx_get(entry->matrix, tile->row, tile->column, &cell)) { ERR("removing tile %p that was not in the matrix? Leaking...", tile); return; @@ -184,7 +184,7 @@ static void _ewk_tile_matrix_tile_free(void* data, Ewk_Tile* tile) * existing tiles and give them back, allowing them to be * freed/replaced by the cache. * - * @param tuc cache of unused tiles or @c 0 to create one + * @param tileUnusedCache cache of unused tiles or @c 0 to create one * automatically. * @param columns number of columns in the matrix. * @param rows number of rows in the matrix. @@ -211,10 +211,10 @@ Ewk_Tile_Matrix* ewk_tile_matrix_new(Ewk_Tile_Unused_Cache* tileUnusedCache, uns ewk_tile_matrix_zoom_level_set(tileMatrix, zoomLevel); if (tileUnusedCache) - tileMatrix->tilieUnusedCache = ewk_tile_unused_cache_ref(tileUnusedCache); + tileMatrix->tileUnusedCache = ewk_tile_unused_cache_ref(tileUnusedCache); else { - tileMatrix->tilieUnusedCache = ewk_tile_unused_cache_new(DEFAULT_CACHE_SIZE); - if (!tileMatrix->tilieUnusedCache) { + tileMatrix->tileUnusedCache = ewk_tile_unused_cache_new(DEFAULT_CACHE_SIZE); + if (!tileMatrix->tileUnusedCache) { ERR("no cache of unused tile!"); eina_matrixsparse_free(tileMatrix->matrix); free(tileMatrix); @@ -298,7 +298,7 @@ void ewk_tile_matrix_free(Ewk_Tile_Matrix* tileMatrix) EINA_SAFETY_ON_NULL_RETURN(tileMatrix); - ewk_tile_unused_cache_freeze(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_freeze(tileMatrix->tileUnusedCache); ewk_tile_matrix_invalidate(tileMatrix); entry = EINA_INLIST_CONTAINER_GET(tileMatrix->matrices, Ewk_Tile_Matrix_Entry); eina_matrixsparse_free(entry->matrix); @@ -306,8 +306,8 @@ void ewk_tile_matrix_free(Ewk_Tile_Matrix* tileMatrix) free(entry); tileMatrix->matrices = 0; - ewk_tile_unused_cache_thaw(tileMatrix->tilieUnusedCache); - ewk_tile_unused_cache_unref(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_thaw(tileMatrix->tileUnusedCache); + ewk_tile_unused_cache_unref(tileMatrix->tileUnusedCache); #ifdef DEBUG_MEM_LEAKS tiles = tileMatrix->stats.tiles.allocated - tileMatrix->stats.tiles.freed; @@ -355,7 +355,7 @@ void ewk_tile_matrix_resize(Ewk_Tile_Matrix* tileMatrix, unsigned long cols, uns Ewk_Tile_Unused_Cache* ewk_tile_matrix_unused_cache_get(const Ewk_Tile_Matrix* tileMatrix) { EINA_SAFETY_ON_NULL_RETURN_VAL(tileMatrix, 0); - return tileMatrix->tilieUnusedCache; + return tileMatrix->tileUnusedCache; } /** @@ -390,7 +390,7 @@ Ewk_Tile* ewk_tile_matrix_tile_exact_get(Ewk_Tile_Matrix* tileMatrix, unsigned l end: if (!tile->visible) { - if (!ewk_tile_unused_cache_tile_get(tileMatrix->tilieUnusedCache, tile)) + if (!ewk_tile_unused_cache_tile_get(tileMatrix->tileUnusedCache, tile)) WRN("Ewk_Tile was unused but not in cache? bug!"); } @@ -459,7 +459,7 @@ Ewk_Tile* ewk_tile_matrix_tile_new(Ewk_Tile_Matrix* tileMatrix, Evas* canvas, un return 0; } - tile->col = column; + tile->column = column; tile->row = row; tile->x = column * tileWidth; tile->y = row * tileHeight; @@ -486,7 +486,7 @@ Ewk_Tile* ewk_tile_matrix_tile_new(Ewk_Tile_Matrix* tileMatrix, Evas* canvas, un * unused cache. * * @param tileMatrix the tile matrix to return tile to. - * @param t the tile instance to return, must @b not be @c 0. + * @param tile the tile instance to return, must @b not be @c 0. * @param last_used time in which tile.widthas last used. * * @return #true on success or #false on failure. @@ -500,7 +500,7 @@ Eina_Bool ewk_tile_matrix_tile_put(Ewk_Tile_Matrix* tileMatrix, Ewk_Tile* tile, return true; tile->stats.last_used = lastUsed; - return ewk_tile_unused_cache_tile_put(tileMatrix->tilieUnusedCache, tile, _ewk_tile_matrix_tile_free, tileMatrix); + return ewk_tile_unused_cache_tile_put(tileMatrix->tileUnusedCache, tile, _ewk_tile_matrix_tile_free, tileMatrix); } Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix* tileMatrix, unsigned long col, unsigned long row, const Eina_Rectangle* update) @@ -706,7 +706,7 @@ void ewk_tile_matrix_dbg(const Ewk_Tile_Matrix* tileMatrix) printf("\n"); } printf("%3lu,%3lu %10p:", column, row, tile); - printf(" [%3lu,%3lu + %dx%d @ %0.3f]%c", tile->col, tile->row, tile->width, tile->height, tile->zoom, tile->visible ? '*' : ' '); + printf(" [%3lu,%3lu + %dx%d @ %0.3f]%c", tile->column, tile->row, tile->width, tile->height, tile->zoom, tile->visible ? '*' : ' '); printf("\n"); } } @@ -714,7 +714,7 @@ void ewk_tile_matrix_dbg(const Ewk_Tile_Matrix* tileMatrix) printf("\n"); eina_iterator_free(iterator); - ewk_tile_unused_cache_dbg(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_dbg(tileMatrix->tileUnusedCache); } /** @@ -730,7 +730,7 @@ void ewk_tile_matrix_freeze(Ewk_Tile_Matrix* tileMatrix) { EINA_SAFETY_ON_NULL_RETURN(tileMatrix); if (!tileMatrix->frozen) - ewk_tile_unused_cache_freeze(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_freeze(tileMatrix->tileUnusedCache); tileMatrix->frozen++; } @@ -750,5 +750,5 @@ void ewk_tile_matrix_thaw(Ewk_Tile_Matrix* tileMatrix) tileMatrix->frozen--; if (!tileMatrix->frozen) - ewk_tile_unused_cache_thaw(tileMatrix->tilieUnusedCache); + ewk_tile_unused_cache_thaw(tileMatrix->tileUnusedCache); } diff --git a/Source/WebKit/efl/ewk/ewk_tiled_matrix.h b/Source/WebKit/efl/ewk/ewk_tiled_matrix.h index fe6b66850..98b95921b 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_matrix.h +++ b/Source/WebKit/efl/ewk/ewk_tiled_matrix.h @@ -26,36 +26,34 @@ #include <Evas.h> /* matrix of tiles */ -Ewk_Tile_Matrix* ewk_tile_matrix_new(Ewk_Tile_Unused_Cache* tileUnusedCache, unsigned long columns, unsigned long rows, float zoomLevel, Evas_Colorspace colorSpace, void (*render_callback)(void* data, Ewk_Tile* tile, const Eina_Rectangle* update), const void* renderData); -void ewk_tile_matrix_free(Ewk_Tile_Matrix* tm); +Ewk_Tile_Matrix *ewk_tile_matrix_new(Ewk_Tile_Unused_Cache *tuc, unsigned long cols, unsigned long rows, float zoom_level, Evas_Colorspace color_space, void (*render_callback)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *render_data); +void ewk_tile_matrix_free(Ewk_Tile_Matrix *tm); -void ewk_tile_matrix_resize(Ewk_Tile_Matrix* tm, unsigned long cols, unsigned long rows); -void ewk_tile_matrix_zoom_level_set(Ewk_Tile_Matrix* tileMatrix, float zoom); -void ewk_tile_matrix_invalidate(Ewk_Tile_Matrix* tileMatrix); +void ewk_tile_matrix_resize(Ewk_Tile_Matrix *tm, unsigned long cols, unsigned long rows); +void ewk_tile_matrix_zoom_level_set(Ewk_Tile_Matrix *tm, float zoom); +void ewk_tile_matrix_invalidate(Ewk_Tile_Matrix *tm); -Ewk_Tile_Unused_Cache* ewk_tile_matrix_unused_cache_get(const Ewk_Tile_Matrix* tm); +Ewk_Tile_Unused_Cache *ewk_tile_matrix_unused_cache_get(const Ewk_Tile_Matrix *tm); -Ewk_Tile* ewk_tile_matrix_tile_exact_get(Ewk_Tile_Matrix* tm, unsigned long col, unsigned long row, float zoom); -Eina_Bool ewk_tile_matrix_tile_exact_exists(Ewk_Tile_Matrix* tm, unsigned long col, unsigned long row, float zoom); -Ewk_Tile* ewk_tile_matrix_tile_nearest_get(Ewk_Tile_Matrix* tm, unsigned long col, unsigned long row, float zoom); -Ewk_Tile* ewk_tile_matrix_tile_new(Ewk_Tile_Matrix* tm, Evas* evas, unsigned long col, unsigned long row, float zoom); -Eina_Bool ewk_tile_matrix_tile_put(Ewk_Tile_Matrix* tm, Ewk_Tile* t, double last_used); +Ewk_Tile *ewk_tile_matrix_tile_exact_get(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row, float zoom); +Eina_Bool ewk_tile_matrix_tile_exact_exists(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row, float zoom); +Ewk_Tile *ewk_tile_matrix_tile_nearest_get(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row, float zoom); +Ewk_Tile *ewk_tile_matrix_tile_new(Ewk_Tile_Matrix *tm, Evas *evas, unsigned long col, unsigned long row, float zoom); +Eina_Bool ewk_tile_matrix_tile_put(Ewk_Tile_Matrix *tm, Ewk_Tile *t, double last_used); -Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix* tm, unsigned long col, unsigned long row, const Eina_Rectangle* update); -Eina_Bool ewk_tile_matrix_tile_update_full(Ewk_Tile_Matrix* tm, unsigned long col, unsigned long row); -void ewk_tile_matrix_tile_updates_clear(Ewk_Tile_Matrix* tm, Ewk_Tile* t); +Eina_Bool ewk_tile_matrix_tile_update(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row, const Eina_Rectangle *update); +Eina_Bool ewk_tile_matrix_tile_update_full(Ewk_Tile_Matrix *tm, unsigned long col, unsigned long row); +void ewk_tile_matrix_tile_updates_clear(Ewk_Tile_Matrix *tm, Ewk_Tile *t); -Eina_Bool ewk_tile_matrix_update(Ewk_Tile_Matrix* tm, const Eina_Rectangle* update, float zoom); -void ewk_tile_matrix_updates_process(Ewk_Tile_Matrix* tm); -void ewk_tile_matrix_updates_clear(Ewk_Tile_Matrix* tm); -void ewk_tile_matrix_freeze(Ewk_Tile_Matrix* tm); -void ewk_tile_matrix_thaw(Ewk_Tile_Matrix* tm); +Eina_Bool ewk_tile_matrix_update(Ewk_Tile_Matrix *tm, const Eina_Rectangle *update, float zoom); +void ewk_tile_matrix_updates_process(Ewk_Tile_Matrix *tm); +void ewk_tile_matrix_updates_clear(Ewk_Tile_Matrix *tm); +void ewk_tile_matrix_freeze(Ewk_Tile_Matrix *tm); +void ewk_tile_matrix_thaw(Ewk_Tile_Matrix *tm); // remove me! -void ewk_tile_matrix_dbg(const Ewk_Tile_Matrix* tm); -void ewk_tile_unused_cache_dbg(const Ewk_Tile_Unused_Cache* tuc); +void ewk_tile_matrix_dbg(const Ewk_Tile_Matrix *tm); +void ewk_tile_unused_cache_dbg(const Ewk_Tile_Unused_Cache *tuc); void ewk_tile_accounting_dbg(); - #endif // ewk_tiled_matrix_h - diff --git a/Source/WebKit/efl/ewk/ewk_tiled_model.cpp b/Source/WebKit/efl/ewk/ewk_tiled_model.cpp index 84048cbf6..87fa83c11 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_model.cpp +++ b/Source/WebKit/efl/ewk/ewk_tiled_model.cpp @@ -345,16 +345,16 @@ void ewk_tile_updates_process(Ewk_Tile* tile, void (*callback)(void* data, Ewk_T rect.h = tile->height; #ifdef TILE_STATS_ACCOUNT_RENDER_TIME struct timeval timev; - double render_start; + double renderStartTime; gettimeofday(&timev, 0); - render_startile = (double)timev.tv_sec + + renderStartTime = (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); #endif callback((void*)data, tile, &rect); #ifdef TILE_STATS_ACCOUNT_RENDER_TIME gettimeofday(&timev, 0); tile->stats.render_time = (double)timev.tv_sec + - (((double)timev.tv_usec) / 1000000) - render_start; + (((double)timev.tv_usec) / 1000000) - renderStartTime; #endif } else if (tile->updates) { Eina_Iterator* itr = eina_tiler_iterator_new(tile->updates); @@ -520,7 +520,7 @@ void ewk_tile_unused_cache_clear(Ewk_Tile_Unused_Cache* tileUnusedCache) } /** - * heightold reference to cache. + * Hold reference to cache. * * @return same pointer as taken. * @@ -630,7 +630,7 @@ void ewk_tile_unused_cache_auto_flush(Ewk_Tile_Unused_Cache* tileUnusedCache) * Freeze cache to not do maintenance tasks. * * Maintenance tasks optimize cache usage, but maybe we know we should - * heightold on them until we do the last operation, in this case we freeze + * hold on them until we do the last operation, in this case we freeze * while operating and then thaw when we're done. * * @see ewk_tile_unused_cache_thaw() @@ -707,8 +707,8 @@ Eina_Bool ewk_tile_unused_cache_tile_get(Ewk_Tile_Unused_Cache* tileUnusedCache, * because usually we want a lazy operation for better performance. * * @param tileUnusedCache cache of unused tiles - * @param t tile to be added to cache. - * @param tile_free_cb function used to free tiles. + * @param tile tile to be added to cache. + * @param tileFreeCallback function used to free tiles. * @param data context to give back to @a tile_free_cb as first argument. * * @return #true on success, #false otherwise. If @c tile->visible @@ -716,7 +716,7 @@ Eina_Bool ewk_tile_unused_cache_tile_get(Ewk_Tile_Unused_Cache* tileUnusedCache, * * @see ewk_tile_unused_cache_auto_flush() */ -Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache* tileUnusedCache, Ewk_Tile* tile, void (* tileFreeCb)(void* data, Ewk_Tile* tile), const void* data) +Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache* tileUnusedCache, Ewk_Tile* tile, void (* tileFreeCallback)(void* data, Ewk_Tile* tile), const void* data) { Ewk_Tile_Unused_Cache_Entry* unusedCacheEntry; @@ -737,7 +737,7 @@ Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache* tileUnusedCache, unusedCacheEntry->tile = tile; unusedCacheEntry->weight = 0; /* calculated just before sort */ - unusedCacheEntry->tile_free.callback = tileFreeCb; + unusedCacheEntry->tile_free.callback = tileFreeCallback; unusedCacheEntry->tile_free.data = (void*)data; tileUnusedCache->entries.count++; @@ -758,7 +758,7 @@ void ewk_tile_unused_cache_dbg(const Ewk_Tile_Unused_Cache* tileUnusedCache) EINA_LIST_FOREACH(tileUnusedCache->entries.list, list, item) { const Ewk_Tile* tile = static_cast<Ewk_Tile_Unused_Cache_Entry*>(item)->tile; printf(" [%3lu,%3lu + %dx%d @ %0.3f]%c", - tile->col, tile->row, tile->width, tile->height, tile->zoom, + tile->column, tile->row, tile->width, tile->height, tile->zoom, tile->visible ? '*' : ' '); if (!(count % 4)) diff --git a/Source/WebKit/efl/ewk/ewk_tiled_model.h b/Source/WebKit/efl/ewk/ewk_tiled_model.h index 58716c563..daaf21389 100644 --- a/Source/WebKit/efl/ewk/ewk_tiled_model.h +++ b/Source/WebKit/efl/ewk/ewk_tiled_model.h @@ -26,32 +26,31 @@ #include <Evas.h> /* model */ -Ewk_Tile* ewk_tile_new(Evas* evas, Evas_Coord w, Evas_Coord h, float zoom, Evas_Colorspace cspace); -void ewk_tile_free(Ewk_Tile* t); -void ewk_tile_unused_cache_clear(Ewk_Tile_Unused_Cache* tuc); -void ewk_tile_show(Ewk_Tile* t); -void ewk_tile_hide(Ewk_Tile* t); -size_t ewk_tile_memory_size_get(const Ewk_Tile* t); -Eina_Bool ewk_tile_visible_get(Ewk_Tile* t); -void ewk_tile_update_full(Ewk_Tile* t); -void ewk_tile_update_area(Ewk_Tile* t, const Eina_Rectangle* r); -void ewk_tile_updates_process(Ewk_Tile* t, void (*cb)(void* data, Ewk_Tile* t, const Eina_Rectangle* update), const void* data); -void ewk_tile_updates_clear(Ewk_Tile* t); +Ewk_Tile *ewk_tile_new(Evas *evas, Evas_Coord w, Evas_Coord h, float zoom, Evas_Colorspace cspace); +void ewk_tile_free(Ewk_Tile *t); +void ewk_tile_unused_cache_clear(Ewk_Tile_Unused_Cache *tuc); +void ewk_tile_show(Ewk_Tile *t); +void ewk_tile_hide(Ewk_Tile *t); +size_t ewk_tile_memory_size_get(const Ewk_Tile *t); +Eina_Bool ewk_tile_visible_get(Ewk_Tile *t); +void ewk_tile_update_full(Ewk_Tile *t); +void ewk_tile_update_area(Ewk_Tile *t, const Eina_Rectangle *r); +void ewk_tile_updates_process(Ewk_Tile *t, void (*cb)(void *data, Ewk_Tile *t, const Eina_Rectangle *update), const void *data); +void ewk_tile_updates_clear(Ewk_Tile *t); /* cache of unused tiles */ -Ewk_Tile_Unused_Cache* ewk_tile_unused_cache_new(size_t max); -void ewk_tile_unused_cache_lock_area(Ewk_Tile_Unused_Cache* tuc, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom); -void ewk_tile_unused_cache_unlock_area(Ewk_Tile_Unused_Cache* tuc); -Ewk_Tile_Unused_Cache* ewk_tile_unused_cache_ref(Ewk_Tile_Unused_Cache* tuc); -void ewk_tile_unused_cache_unref(Ewk_Tile_Unused_Cache* tuc); +Ewk_Tile_Unused_Cache *ewk_tile_unused_cache_new(size_t max); +void ewk_tile_unused_cache_lock_area(Ewk_Tile_Unused_Cache *tuc, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h, float zoom); +void ewk_tile_unused_cache_unlock_area(Ewk_Tile_Unused_Cache *tuc); +Ewk_Tile_Unused_Cache *ewk_tile_unused_cache_ref(Ewk_Tile_Unused_Cache *tuc); +void ewk_tile_unused_cache_unref(Ewk_Tile_Unused_Cache *tuc); -void ewk_tile_unused_cache_dirty(Ewk_Tile_Unused_Cache* tuc); +void ewk_tile_unused_cache_dirty(Ewk_Tile_Unused_Cache *tuc); -void ewk_tile_unused_cache_freeze(Ewk_Tile_Unused_Cache* tuc); -void ewk_tile_unused_cache_thaw(Ewk_Tile_Unused_Cache* tuc); +void ewk_tile_unused_cache_freeze(Ewk_Tile_Unused_Cache *tuc); +void ewk_tile_unused_cache_thaw(Ewk_Tile_Unused_Cache *tuc); -Eina_Bool ewk_tile_unused_cache_tile_get(Ewk_Tile_Unused_Cache* tuc, Ewk_Tile* t); -Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache* tuc, Ewk_Tile* t, void (* tile_free_cb)(void* data, Ewk_Tile* t), const void* data); +Eina_Bool ewk_tile_unused_cache_tile_get(Ewk_Tile_Unused_Cache *tuc, Ewk_Tile *t); +Eina_Bool ewk_tile_unused_cache_tile_put(Ewk_Tile_Unused_Cache *tuc, Ewk_Tile *t, void (* tile_free_cb)(void *data, Ewk_Tile *t), const void *data); #endif // ewk_tiled_model_h - diff --git a/Source/WebKit/efl/ewk/ewk_util.h b/Source/WebKit/efl/ewk/ewk_util.h index 2371888a0..3b32d9c88 100644 --- a/Source/WebKit/efl/ewk/ewk_util.h +++ b/Source/WebKit/efl/ewk/ewk_util.h @@ -29,6 +29,6 @@ #include <Evas.h> #include <cairo.h> -Evas_Object* ewk_util_image_from_cairo_surface_add(Evas* canvas, cairo_surface_t* surface); +Evas_Object *ewk_util_image_from_cairo_surface_add(Evas *canvas, cairo_surface_t *surface); #endif // ewk_util_h diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index 853b342eb..9789c1c30 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -216,59 +216,53 @@ struct _Ewk_View_Private_Data { #ifndef EWK_TYPE_CHECK #define EWK_VIEW_TYPE_CHECK(ewkView, ...) do { } while (0) #else -#define EWK_VIEW_TYPE_CHECK(ewkView, ...) \ - do { \ - const char* _tmp_otype = evas_object_type_get(ewkView); \ - const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \ - if (EINA_UNLIKELY(!_tmp_s)) { \ - EINA_LOG_CRIT \ - ("%p (%s) is not a smart object!", ewkView, \ - _tmp_otype ? _tmp_otype : "(null)"); \ - return __VA_ARGS__; \ - } \ +#define EWK_VIEW_TYPE_CHECK(ewkView, ...) \ + do { \ + const char* _tmp_otype = evas_object_type_get(ewkView); \ + const Evas_Smart* _tmp_s = evas_object_smart_smart_get(ewkView); \ + if (EINA_UNLIKELY(!_tmp_s)) { \ + EINA_LOG_CRIT \ + ("%p (%s) is not a smart object!", ewkView, \ + _tmp_otype ? _tmp_otype : "(null)"); \ + return __VA_ARGS__; \ + } \ const Evas_Smart_Class* _tmp_sc = evas_smart_class_get(_tmp_s); \ - if (EINA_UNLIKELY(!_tmp_sc)) { \ - EINA_LOG_CRIT \ - ("%p (%s) is not a smart object!", ewkView, \ - _tmp_otype ? _tmp_otype : "(null)"); \ - return __VA_ARGS__; \ - } \ - if (EINA_UNLIKELY(_tmp_sc->data != ewkViewTypeString)) { \ - EINA_LOG_CRIT \ - ("%p (%s) is not of an ewk_view (need %p, got %p)!", \ - ewkView, _tmp_otype ? _tmp_otype : "(null)", \ - ewkViewTypeString, _tmp_sc->data); \ - return __VA_ARGS__; \ - } \ + if (EINA_UNLIKELY(!_tmp_sc)) { \ + EINA_LOG_CRIT \ + ("%p (%s) is not a smart object!", ewkView, \ + _tmp_otype ? _tmp_otype : "(null)"); \ + return __VA_ARGS__; \ + } \ + if (EINA_UNLIKELY(_tmp_sc->data != ewkViewTypeString)) { \ + EINA_LOG_CRIT \ + ("%p (%s) is not of an ewk_view (need %p, got %p)!", \ + ewkView, _tmp_otype ? _tmp_otype : "(null)", \ + ewkViewTypeString, _tmp_sc->data); \ + return __VA_ARGS__; \ + } \ } while (0) #endif -#define EWK_VIEW_SD_GET(ewkView, ptr) \ - Ewk_View_Smart_Data* ptr = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView)) +#define EWK_VIEW_SD_GET(ewkView, pointer) \ + Ewk_View_Smart_Data* pointer = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView)) -#define EWK_VIEW_SD_GET_OR_RETURN(ewkView, ptr, ...) \ - EWK_VIEW_TYPE_CHECK(ewkView, __VA_ARGS__); \ - EWK_VIEW_SD_GET(ewkView, ptr); \ - if (!ptr) { \ - CRITICAL("no smart data for object %p (%s)", \ - ewkView, evas_object_type_get(ewkView)); \ - return __VA_ARGS__; \ +#define EWK_VIEW_SD_GET_OR_RETURN(ewkView, pointer, ...) \ + EWK_VIEW_TYPE_CHECK(ewkView, __VA_ARGS__); \ + EWK_VIEW_SD_GET(ewkView, pointer); \ + if (!pointer) { \ + CRITICAL("no smart data for object %p (%s)", \ + ewkView, evas_object_type_get(ewkView)); \ + return __VA_ARGS__; \ } -#define EWK_VIEW_PRIV_GET(smartData, ptr) \ - Ewk_View_Private_Data *ptr = smartData->_priv - -#define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, ptr, ...) \ - EWK_VIEW_PRIV_GET(smartData, ptr); \ - if (!ptr) { \ - CRITICAL("no private data for object %p (%s)", \ - smartData->self, evas_object_type_get(smartData->self)); \ - return __VA_ARGS__; \ - } +#define EWK_VIEW_PRIV_GET(smartData, pointer) \ + Ewk_View_Private_Data* pointer = smartData->_priv -#define EWK_VIEW_TILED_TYPE_CHECK_OR_RETURN(ewkView, ...) \ - if (!evas_object_smart_type_check(ewkView, ewkViewTiledName)) { \ - INF("object isn't an instance of %s", ewkViewTiledName); \ +#define EWK_VIEW_PRIV_GET_OR_RETURN(smartData, pointer, ...) \ + EWK_VIEW_PRIV_GET(smartData, pointer); \ + if (!pointer) { \ + CRITICAL("no private data for object %p (%s)", \ + smartData->self, evas_object_type_get(smartData->self)); \ return __VA_ARGS__; \ } @@ -410,12 +404,12 @@ static void _ewk_view_scrolls_flush(Ewk_View_Private_Data* priv) static Eina_Bool _ewk_view_smart_focus_in(Ewk_View_Smart_Data* smartData) { EWK_VIEW_PRIV_GET(smartData, priv); - WebCore::FocusController* fc = priv->page->focusController(); - DBG("ewkView=%p, fc=%p", smartData->self, fc); - EINA_SAFETY_ON_NULL_RETURN_VAL(fc, false); + WebCore::FocusController* focusController = priv->page->focusController(); + DBG("ewkView=%p, focusController=%p", smartData->self, focusController); + EINA_SAFETY_ON_NULL_RETURN_VAL(focusController, false); - fc->setActive(true); - fc->setFocused(true); + focusController->setActive(true); + focusController->setFocused(true); return true; } @@ -648,6 +642,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) priv->pageSettings->setOfflineWebApplicationCacheEnabled(true); priv->pageSettings->setUsesPageCache(true); priv->pageSettings->setUsesEncodingDetector(false); + priv->pageSettings->setWebGLEnabled(true); url = priv->pageSettings->userStyleSheetLocation(); priv->settings.userStylesheet = eina_stringshare_add(url.string().utf8().data()); @@ -994,7 +989,7 @@ static void _ewk_view_smart_flush(Ewk_View_Smart_Data* smartData) static Eina_Bool _ewk_view_smart_pre_render_region(Ewk_View_Smart_Data* smartData, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height, float zoom) { - WRN("not supported by engine. smartDAta=%p area=%d,%d+%dx%d, zoom=%f", + WRN("not supported by engine. smartData=%p area=%d,%d+%dx%d, zoom=%f", smartData, x, y, width, height, zoom); return false; } @@ -1790,7 +1785,7 @@ Eina_Bool ewk_view_pre_render_region(Evas_Object* ewkView, Evas_Coord x, Evas_Co EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api->pre_render_region, false); - float cur_zoom; + float currentZoom; Evas_Coord contentsWidth, contentsHeight; /* When doing animated zoom it's not possible to call pre-render since it @@ -1799,15 +1794,15 @@ Eina_Bool ewk_view_pre_render_region(Evas_Object* ewkView, Evas_Coord x, Evas_Co if (priv->animatedZoom.animator) return false; - cur_zoom = ewk_frame_page_zoom_get(smartData->main_frame); + currentZoom = ewk_frame_page_zoom_get(smartData->main_frame); - if (cur_zoom < 0.00001) + if (currentZoom < 0.00001) return false; if (!ewk_frame_contents_size_get(smartData->main_frame, &contentsWidth, &contentsHeight)) return false; - contentsWidth *= zoom / cur_zoom; - contentsHeight *= zoom / cur_zoom; + contentsWidth *= zoom / currentZoom; + contentsHeight *= zoom / currentZoom; DBG("region %d,%d+%dx%d @ %f contents=%dx%d", x, y, width, height, zoom, contentsWidth, contentsHeight); if (x + width > contentsWidth) @@ -2957,8 +2952,8 @@ void ewk_view_restore_state(Evas_Object* ewkView, Evas_Object* frame) * @param ewkView Current view. * @param javascript @c true if the new window is originated from javascript, * @c false otherwise - * @param widthindow_features Features of the new window being created. If it's @c - * NULL, it will be created a window with default features. + * @param window_features Features of the new window being created. If it's @c + * 0, it will be created a window with default features. * * @return New view, in case smart class implements the creation of new windows; * else, current view @param ewkView or @c 0 on failure. @@ -3050,7 +3045,7 @@ void ewk_view_toolbars_visible_set(Evas_Object* ewkView, bool visible) */ void ewk_view_toolbars_visible_get(Evas_Object* ewkView, bool* visible) { - DBG("%s, o=%p", __func__, ewkView); + DBG("%s, ewkView=%p", __func__, ewkView); *visible = false; evas_object_smart_callback_call(ewkView, "toolbars,visible,get", visible); } @@ -3083,7 +3078,7 @@ void ewk_view_statusbar_visible_set(Evas_Object* ewkView, bool visible) */ void ewk_view_statusbar_visible_get(Evas_Object* ewkView, bool* visible) { - DBG("%s, o=%p", __func__, ewkView); + DBG("%s, ewkView=%p", __func__, ewkView); *visible = false; evas_object_smart_callback_call(ewkView, "statusbar,visible,get", visible); } @@ -3132,7 +3127,7 @@ void ewk_view_scrollbars_visible_set(Evas_Object* ewkView, bool visible) */ void ewk_view_scrollbars_visible_get(Evas_Object* ewkView, bool* visible) { - DBG("%s, o=%p", __func__, ewkView); + DBG("%s, ewkView=%p", __func__, ewkView); *visible = false; evas_object_smart_callback_call(ewkView, "scrollbars,visible,get", visible); } @@ -3165,7 +3160,7 @@ void ewk_view_menubar_visible_set(Evas_Object* ewkView, bool visible) */ void ewk_view_menubar_visible_get(Evas_Object* ewkView, bool* visible) { - DBG("%s, o=%p", __func__, ewkView); + DBG("%s, ewkView=%p", __func__, ewkView); *visible = false; evas_object_smart_callback_call(ewkView, "menubar,visible,get", visible); } @@ -3215,7 +3210,7 @@ void ewk_view_add_console_message(Evas_Object* ewkView, const char* message, uns */ void ewk_view_frame_view_creation_notify(Evas_Object* ewkView) { - EWK_VIEW_TILED_TYPE_CHECK_OR_RETURN(ewkView); + EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, ewkViewTiledName); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); ewk_frame_paint_full_set(smartData->main_frame, true); } @@ -3593,7 +3588,7 @@ Eina_Bool ewk_view_zoom_range_set(Evas_Object* ewkView, float minScale, float ma EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); if (maxScale < minScale) { - WRN("min_scale is larger than max_scale"); + WRN("minScale is larger than maxScale"); return false; } diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index a4335374f..d3474a64b 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -1442,7 +1442,7 @@ EAPI Eina_Bool ewk_view_setting_enable_plugins_set(Evas_Object *o, Eina_Bool * @return @c EINA_TRUE if the frame flattening feature is enabled, * @c EINA_FALSE if not or on failure */ -EAPI Eina_Bool ewk_view_setting_enable_frame_flattening_get(const Evas_Object* o); +EAPI Eina_Bool ewk_view_setting_enable_frame_flattening_get(const Evas_Object *o); /** * Enables/disables the frame flattening feature. @@ -1453,7 +1453,7 @@ EAPI Eina_Bool ewk_view_setting_enable_frame_flattening_get(const Evas_Object * * @return @c EINA_TRUE on success or @c EINA_FALSE on failure */ -EAPI Eina_Bool ewk_view_setting_enable_frame_flattening_set(Evas_Object* o, Eina_Bool enable); +EAPI Eina_Bool ewk_view_setting_enable_frame_flattening_set(Evas_Object *o, Eina_Bool enable); /** * Queries if the scripts can open the new windows. @@ -2288,7 +2288,7 @@ typedef enum _Ewk_Page_Visibility_State Ewk_Page_Visibility_State; * * @return @c EINA_TRUE on success or @c EINA_FALSE on failure. */ -EAPI Eina_Bool ewk_view_visibility_state_set(Evas_Object* o, Ewk_Page_Visibility_State page_visible_state, Eina_Bool initial_state); +EAPI Eina_Bool ewk_view_visibility_state_set(Evas_Object *o, Ewk_Page_Visibility_State page_visible_state, Eina_Bool initial_state); /** * Gets the visibility state of the page. diff --git a/Source/WebKit/efl/ewk/ewk_view_single.cpp b/Source/WebKit/efl/ewk/ewk_view_single.cpp index 526524bdd..4981ef0cc 100644 --- a/Source/WebKit/efl/ewk/ewk_view_single.cpp +++ b/Source/WebKit/efl/ewk/ewk_view_single.cpp @@ -9,7 +9,7 @@ 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 + 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 @@ -216,8 +216,8 @@ static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data* sm Evas_Coord ow, oh; void* pixels; Eina_Rectangle* rect; - const Eina_Rectangle* pr; - const Eina_Rectangle* pr_end; + const Eina_Rectangle* paintRequest; + const Eina_Rectangle* paintRequestEnd; Eina_Tiler* tiler; Eina_Iterator* iterator; cairo_status_t status; @@ -284,10 +284,10 @@ static Eina_Bool _ewk_view_single_smart_repaints_process(Ewk_View_Smart_Data* sm ewk_view_layout_if_needed_recursive(smartData->_priv); - pr = ewk_view_repaints_pop(smartData->_priv, &count); - pr_end = pr + count; - for (; pr < pr_end; pr++) - eina_tiler_rect_add(tiler, pr); + paintRequest = ewk_view_repaints_pop(smartData->_priv, &count); + paintRequestEnd = paintRequest + count; + for (; paintRequest < paintRequestEnd; paintRequest++) + eina_tiler_rect_add(tiler, paintRequest); iterator = eina_tiler_iterator_new(tiler); if (!iterator) { diff --git a/Source/WebKit/efl/ewk/ewk_view_tiled.cpp b/Source/WebKit/efl/ewk/ewk_view_tiled.cpp index e5b826319..bfb2d95f8 100644 --- a/Source/WebKit/efl/ewk/ewk_view_tiled.cpp +++ b/Source/WebKit/efl/ewk/ewk_view_tiled.cpp @@ -77,12 +77,12 @@ static void* _ewk_view_tiled_updates_process_pre(void* data, Evas_Object* ewkVie static Evas_Object* _ewk_view_tiled_smart_backing_store_add(Ewk_View_Smart_Data* smartData) { - Evas_Object* bs = ewk_tiled_backing_store_add(smartData->base.evas); + Evas_Object* backingStore = ewk_tiled_backing_store_add(smartData->base.evas); ewk_tiled_backing_store_render_cb_set - (bs, _ewk_view_tiled_render_cb, smartData->_priv); + (backingStore, _ewk_view_tiled_render_cb, smartData->_priv); ewk_tiled_backing_store_updates_process_pre_set - (bs, _ewk_view_tiled_updates_process_pre, smartData->_priv); - return bs; + (backingStore, _ewk_view_tiled_updates_process_pre, smartData->_priv); + return backingStore; } static void @@ -97,17 +97,17 @@ _ewk_view_tiled_contents_size_changed_cb(void* data, Evas_Object* ewkView, void* static void _ewk_view_tiled_smart_add(Evas_Object* ewkView) { - Ewk_View_Smart_Data* sd; + Ewk_View_Smart_Data* smartData; _parent_sc.sc.add(ewkView); - sd = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView)); - if (!sd) + smartData = static_cast<Ewk_View_Smart_Data*>(evas_object_smart_data_get(ewkView)); + if (!smartData) return; evas_object_smart_callback_add( - sd->main_frame, "contents,size,changed", - _ewk_view_tiled_contents_size_changed_cb, sd); + smartData->main_frame, "contents,size,changed", + _ewk_view_tiled_contents_size_changed_cb, smartData); } static Eina_Bool _ewk_view_tiled_smart_scrolls_process(Ewk_View_Smart_Data* smartData) @@ -392,14 +392,16 @@ Evas_Object* ewk_view_tiled_add(Evas* canvas) Ewk_Tile_Unused_Cache* ewk_view_tiled_unused_cache_get(const Evas_Object* ewkView) { - Ewk_View_Smart_Data* sd = ewk_view_smart_data_get(ewkView); - EINA_SAFETY_ON_NULL_RETURN_VAL(sd, 0); - return ewk_tiled_backing_store_tile_unused_cache_get(sd->backing_store); + EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, ewkViewTiledName, 0); + Ewk_View_Smart_Data* smartData = ewk_view_smart_data_get(ewkView); + EINA_SAFETY_ON_NULL_RETURN_VAL(smartData, 0); + return ewk_tiled_backing_store_tile_unused_cache_get(smartData->backing_store); } void ewk_view_tiled_unused_cache_set(Evas_Object* ewkView, Ewk_Tile_Unused_Cache* cache) { - Ewk_View_Smart_Data* sd = ewk_view_smart_data_get(ewkView); - EINA_SAFETY_ON_NULL_RETURN(sd); - ewk_tiled_backing_store_tile_unused_cache_set(sd->backing_store, cache); + EWK_VIEW_TYPE_CHECK_OR_RETURN(ewkView, ewkViewTiledName); + Ewk_View_Smart_Data* smartData = ewk_view_smart_data_get(ewkView); + EINA_SAFETY_ON_NULL_RETURN(smartData); + ewk_tiled_backing_store_tile_unused_cache_set(smartData->backing_store, cache); } diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 6dbea6560..8c59bb93f 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,157 @@ +2012-02-08 Mario Sanchez Prada <msanchez@igalia.com> + + [Gtk] atk_text_get_text_at_offset() fails to provide the correct line for list items whose text wraps + https://bugs.webkit.org/show_bug.cgi?id=73431 + + Reviewed by Chris Fleizach. + + Updated unit test to check text wrapping accross different lines + inside list items with bullet markers. + + * tests/testatk.c: + (testWebkitAtkGetTextAtOffsetWithSpecialCharacters): Updated test. + +2012-02-06 Martin Robinson <mrobinson@igalia.com> and Nayan Kumar K <nayankk@motorola.com> + + [GTK] Add TextureMapperGL implementation + https://bugs.webkit.org/show_bug.cgi?id=75308 + + Reviewed by Alejandro G. Castro. + + * GNUmakefile.am: Add AcceleratedCompositingContextGL to the list. + * WebCoreSupport/AcceleratedCompositingContext.h: + (AcceleratedCompositingContext): Added some members for AcceleratedCompositingContextGL. + * WebCoreSupport/AcceleratedCompositingContextClutter.cpp: Added empty implementations + for GraphicsLayerClient. This is only used for the GL variant. + * WebCoreSupport/AcceleratedCompositingContextGL.cpp: Added. + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::performAllPendingScrolls): Update the root layer while scrolling. + (WebKit::ChromeClient::paint): Update the root layer after painting. + * webkit/webkitwebsettings.cpp: Added an enable-accelerated-compositing setting. + * webkit/webkitwebsettingsprivate.h: Ditto. + * webkit/webkitwebview.cpp: + (webkit_web_view_draw): Call into TextureMapper now. + (webkit_web_view_realize): Use gdk_window_ensure_native here. + (webkit_web_view_update_settings): Support the new enable-accelerated-compositing setting. + (webkit_web_view_settings_notify): Ditto. + +2012-02-06 Gustavo Noronha Silva <gns@gnome.org> + + Do not try to chdir to the directory where the executable is in + only if the path is absolute. This makes tests runnable from + anywhere. + + Reviewed by Martin Robinson. + + * tests/test_utils.c: + (testutils_relative_chdir): + +2012-02-06 Gustavo Noronha Silva <gns@gnome.org> + + Unreviewed fix for the new API test that is failing - + WEBKIT_INSPECTOR_PATH needs to be set, since we do not install our + builds. + + * tests/testwebinspector.c: + (main): + +2012-02-05 Gustavo Noronha Silva <gns@gnome.org> + + [GTK] Insta-crash when closing browser with inspector window opened + https://bugs.webkit.org/show_bug.cgi?id=50744 + + Reviewed by Martin Robinson. + + * GNUmakefile.am: + * WebCoreSupport/InspectorClientGtk.cpp: + (WebKit::InspectorClient::releaseFrontendPage): also let go of the + frontend client when releasing the frontend page; + (WebKit::InspectorFrontendClient::~InspectorFrontendClient(): Call releaseFrontendPage() + like other ports do instead of just disconnectFrontendClient(). + (WebKit::InspectorFrontendClient::destroyInspectorWindow): Use GRefPtr for the + inspector ref. + (WebKit::InspectorFrontendClient::bringToFront): Adjust for GRefPtr usage. + (WebKit::InspectorFrontendClient::attachWindow): Ditto. + (WebKit::InspectorFrontendClient::detachWindow): Ditto. + (WebKit::InspectorFrontendClient::inspectedURLChanged): Ditto. + * WebCoreSupport/InspectorClientGtk.h: + (InspectorFrontendClient): Use GRefPtr for inspector member. + * tests/testwebinspector.c: Added. Test that killing a WebView with the inspector + open does not crash, and that closing and reinspecting works. + (quitLoop): + (consoleMessageCallback): + (inspectElementCallback): + (closeInspector): + (showInspector): + (test_webkit_web_inspector_close_and_inspect): + (test_webkit_web_inspector_destroy_inspected_web_view): + (main): + +2012-02-06 Gustavo Noronha Silva <gns@gnome.org> + + Add a null check for the gdkwindow, that will happen if the window + is not mapped. + + Reviewed by Martin Robinson. + + * WebCoreSupport/ChromeClientGtk.cpp: + (WebKit::ChromeClient::setCursor): + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + [GTK] WebKitWebView does a lot of work during size_allocate when not mapped + https://bugs.webkit.org/show_bug.cgi?id=77743 + + Reviewed by Gustavo Noronha Silva. + + Instead of resizing the guts of a WebView when it's not mapped, wait + until it's mapped and do one resize. This prevents unmapped WebViews + from adding to a container's resize cost. + + * webkit/webkitwebview.cpp: + (resizeWebViewFromAllocation): Abstracted out this helper. + (webkit_web_view_size_allocate): Wait until map to resize umapped widgets. + (webkitWebViewMap): Added this vmethod implementation. + (webkit_web_view_class_init): Added vmethod. + * webkit/webkitwebviewprivate.h: Added new needsResizeOnMap member. + +2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Update NEWS and configure.ac for 1.7.5 release + https://bugs.webkit.org/show_bug.cgi?id=77859 + + Reviewed by Philippe Normand. + + * NEWS: Added release notes for 1.7.5. + +2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix several gtkdoc-fixxref warnings + https://bugs.webkit.org/show_bug.cgi?id=77613 + + Reviewed by Martin Robinson. + + * docs/webkitgtk-docs.sgml: Remove webkitspellcheckerenchant + section. + * docs/webkitgtk-sections.txt: Remove webkitspellcheckerenchant + symbols and move WebKitWebNavigationReason from the private + section to the global section. + * webkit/webkitwebnavigationaction.h: Document + WebKitWebNavigationReason enum. + +2012-02-02 Kalev Lember <kalevlember@gmail.com> + + [GTK] Don't use uint + https://bugs.webkit.org/show_bug.cgi?id=77678 + + Reviewed by Martin Robinson. + + With the MingGW cross compiler toolchain in Fedora, uint wasn't + defined, so use unsigned int instead. + + * WebCoreSupport/ChromeClientGtk.h: + (ChromeClient): Use unsigned int instead of uint + 2012-02-02 Claudio Saavedra <csaavedra@igalia.com> and Martin Robinson <mrobinson@igalia.com> [GTK] WebKitWebView won't work in a GtkOffscreenWindow diff --git a/Source/WebKit/gtk/GNUmakefile.am b/Source/WebKit/gtk/GNUmakefile.am index 2472212e9..38d2bb02a 100644 --- a/Source/WebKit/gtk/GNUmakefile.am +++ b/Source/WebKit/gtk/GNUmakefile.am @@ -184,6 +184,7 @@ webkitgtk_sources += \ Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \ Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \ Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp \ + Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp \ Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \ Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \ Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \ @@ -456,6 +457,7 @@ TEST_PROGS += \ Programs/unittests/testatk \ Programs/unittests/testatkroles \ Programs/unittests/testhittestresult \ + Programs/unittests/testwebinspector \ Programs/unittests/testwebsettings \ Programs/unittests/testwebresource \ Programs/unittests/testwebdatasource \ @@ -555,6 +557,11 @@ Programs_unittests_testatkroles_CFLAGS = $(webkit_tests_cflags) Programs_unittests_testatkroles_LDADD = $(webkit_tests_ldadd) Programs_unittests_testatkroles_LDFLAGS = $(webkit_tests_ldflags) +Programs_unittests_testwebinspector_SOURCES = Source/WebKit/gtk/tests/testwebinspector.c Source/WebKit/gtk/tests/test_utils.c +Programs_unittests_testwebinspector_CFLAGS = $(webkit_tests_cflags) +Programs_unittests_testwebinspector_LDADD = $(webkit_tests_ldadd) +Programs_unittests_testwebinspector_LDFLAGS = $(webkit_tests_ldflags) + Programs_unittests_testwebsettings_SOURCES = Source/WebKit/gtk/tests/testwebsettings.c Programs_unittests_testwebsettings_CFLAGS = $(webkit_tests_cflags) Programs_unittests_testwebsettings_LDADD = $(webkit_tests_ldadd) diff --git a/Source/WebKit/gtk/NEWS b/Source/WebKit/gtk/NEWS index 94096480d..0aa4791e7 100644 --- a/Source/WebKit/gtk/NEWS +++ b/Source/WebKit/gtk/NEWS @@ -1,4 +1,34 @@ ================= +WebKitGTK+ 1.7.5 +================= + +What's new in WebKitGTK+ 1.7.5? + + - Add new signals to track resources loading. + - Add --no-timeout command line option to DumpRenderTree. + - Expose accessibility hierarchy in WebKit2 to ATK/AT-SPI based ATs. + - Allow to build using extra jhbuild modulesets. + - Fix emission of ATK text-caret-moved and text-selection-changed + events. + - Update primary clipboard with the current selection in X11 + platforms in WebKit2. + - Implement the policy client in WebKit2 GTK+ API. + - Add basic printing support to WebKit2. + - Do not add unnecessary blanks at the end of a line of text to fix. + the line returned by atk_text_get_text_at_offset(). + - Make sure input text field is repainted when value is changed. + - Add print-backgrounds setting to WebKit2 GTK+ API. + - Respect the has-backward-stepper and has-forward-stepper + properties when drawing scrollbars. + - WebKit-3.0.gir now includes information about C includes or + exported packages. + - WebKit1 API documentation was not generated when building with + gtk-2.0. + - Make WebKitWebView work inside a GtkOffscreenWindow. + - Implement DownloadClient and add downloads API to WebKit2 GTK+ + API. + +================= WebKitGTK+ 1.7.4 ================= diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h index 61c23b70c..42a5f24b6 100644 --- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h @@ -19,6 +19,7 @@ #ifndef AcceleratedCompositingContext_h #define AcceleratedCompositingContext_h +#include "GraphicsLayer.h" #include "GraphicsLayerClient.h" #include "IntRect.h" #include "IntSize.h" @@ -26,15 +27,16 @@ #include "webkitwebview.h" #include <wtf/PassOwnPtr.h> -#if USE(ACCELERATED_COMPOSITING) +#if USE(TEXTURE_MAPPER_GL) +#include "TextureMapperNode.h" +#include "WindowGLContext.h" +#endif -namespace WebCore { -class GraphicsLayer; -} +#if USE(ACCELERATED_COMPOSITING) namespace WebKit { -class AcceleratedCompositingContext { +class AcceleratedCompositingContext : public WebCore::GraphicsLayerClient { WTF_MAKE_NONCOPYABLE(AcceleratedCompositingContext); public: static PassOwnPtr<AcceleratedCompositingContext> create(WebKitWebView* webView) @@ -47,7 +49,17 @@ public: void scheduleRootLayerRepaint(const WebCore::IntRect&); void markForSync(); void syncLayersTimeout(WebCore::Timer<AcceleratedCompositingContext>*); + void syncLayersNow(); void resizeRootLayer(const WebCore::IntSize&); + bool renderLayersToWindow(const WebCore::IntRect& clipRect); + bool enabled(); + + // GraphicsLayerClient + virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); + virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint); + virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; + virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; private: WebKitWebView* m_webView; @@ -56,6 +68,13 @@ private: #if USE(CLUTTER) GtkWidget* m_rootLayerEmbedder; +#elif USE(TEXTURE_MAPPER_GL) + void initializeIfNecessary(); + + bool m_initialized; + WebCore::TextureMapperNode* m_rootTextureMapperNode; + OwnPtr<WebCore::WindowGLContext> m_context; + OwnPtr<WebCore::TextureMapper> m_textureMapper; #endif AcceleratedCompositingContext(WebKitWebView*); diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp index 4657ec43f..b52b409e5 100644 --- a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextClutter.cpp @@ -45,6 +45,11 @@ AcceleratedCompositingContext::~AcceleratedCompositingContext() { } +bool AcceleratedCompositingContext::enabled() +{ + return m_rootGraphicsLayer; +} + bool AcceleratedCompositingContext::renderLayersToWindow(cairo_t* widgetCr, const IntRect& clipRect) { notImplemented(); @@ -116,6 +121,32 @@ void AcceleratedCompositingContext::syncLayersTimeout(Timer<AcceleratedCompositi core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes(); } +void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) +{ + ASSERT_NOT_REACHED(); +} +void AcceleratedCompositingContext::notifySyncRequired(const WebCore::GraphicsLayer*) +{ + ASSERT_NOT_REACHED(); +} + +void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect&) +{ + ASSERT_NOT_REACHED(); +} + +bool AcceleratedCompositingContext::showDebugBorders(const WebCore::GraphicsLayer*) const +{ + ASSERT_NOT_REACHED(); + return false; +} + +bool AcceleratedCompositingContext::showRepaintCounter(const WebCore::GraphicsLayer*) const +{ + ASSERT_NOT_REACHED(); + return false; +} + } // namespace WebKit #endif // USE(ACCELERATED_COMPOSITING) && USE(CLUTTER) diff --git a/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp new file mode 100644 index 000000000..9bfa3d0fe --- /dev/null +++ b/Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2012 Igalia, S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "AcceleratedCompositingContext.h" + +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) + +#include "CairoUtilities.h" +#include "Chrome.h" +#include "ChromeClientGtk.h" +#include "Frame.h" +#include "FrameView.h" +#include "PlatformContextCairo.h" +#include "TextureMapperGL.h" +#include "TextureMapperNode.h" +#include "webkitwebviewprivate.h" +#include <GL/gl.h> +#include <cairo.h> +#include <gdk/gdk.h> +#include <gtk/gtk.h> + +using namespace WebCore; + +namespace WebKit { + +AcceleratedCompositingContext::AcceleratedCompositingContext(WebKitWebView* webView) + : m_webView(webView) + , m_syncTimer(this, &AcceleratedCompositingContext::syncLayersTimeout) + , m_initialized(false) + , m_rootTextureMapperNode(0) +{ +} + +AcceleratedCompositingContext::~AcceleratedCompositingContext() +{ + +} + +void AcceleratedCompositingContext::initializeIfNecessary() +{ + if (m_initialized) + return; + + m_initialized = true; + + // The GTK+ docs say that we can fail to create a native window. + // FIXME: We should fall back to the ImageBuffer TextureMapper when it exists. + if (!m_webView->priv->hasNativeWindow) + return; + + m_context = WebCore::WindowGLContext::createContextWithGdkWindow(gtk_widget_get_window(GTK_WIDGET(m_webView))); +} + +bool AcceleratedCompositingContext::enabled() +{ + return m_rootTextureMapperNode && m_textureMapper; +} + + +bool AcceleratedCompositingContext::renderLayersToWindow(const IntRect& clipRect) +{ + if (!enabled()) + return false; + + // We initialize the context lazily here so that we know that the GdkWindow realized. + initializeIfNecessary(); + if (!m_context) + return false; + + m_context->startDrawing(); + + GtkAllocation allocation; + gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); + glViewport(0, 0, allocation.width, allocation.height); + + m_textureMapper->beginPainting(); + m_rootTextureMapperNode->paint(); + m_textureMapper->endPainting(); + + m_context->finishDrawing(); + return true; +} + +void AcceleratedCompositingContext::attachRootGraphicsLayer(GraphicsLayer* graphicsLayer) +{ + if (!graphicsLayer) { + m_rootGraphicsLayer.clear(); + m_rootTextureMapperNode = 0; + return; + } + + m_rootGraphicsLayer = GraphicsLayer::create(this); + m_rootTextureMapperNode = toTextureMapperNode(m_rootGraphicsLayer.get()); + m_rootGraphicsLayer->addChild(graphicsLayer); + m_rootGraphicsLayer->setDrawsContent(true); + m_rootGraphicsLayer->setMasksToBounds(false); + m_rootGraphicsLayer->setNeedsDisplay(); + m_rootGraphicsLayer->setSize(core(m_webView)->mainFrame()->view()->frameRect().size()); + + // We initialize the context lazily here so that we know that the GdkWindow realized. + initializeIfNecessary(); + if (!m_context) + return; + + // The context needs to be active when creating the texture mapper. It's fine to + // avoid calling endDrawing here, because it will just initialize shaders. + m_context->startDrawing(); + + GtkAllocation allocation; + gtk_widget_get_allocation(GTK_WIDGET(m_webView), &allocation); + glViewport(0, 0, allocation.width, allocation.height); + + m_textureMapper = TextureMapperGL::create(); + m_rootTextureMapperNode->setTextureMapper(m_textureMapper.get()); + m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly(); +} + +void AcceleratedCompositingContext::scheduleRootLayerRepaint(const IntRect& rect) +{ + if (!m_rootGraphicsLayer) + return; + if (rect.isEmpty()) { + m_rootGraphicsLayer->setNeedsDisplay(); + return; + } + m_rootGraphicsLayer->setNeedsDisplayInRect(rect); +} + +void AcceleratedCompositingContext::resizeRootLayer(const IntSize& size) +{ + if (!m_rootGraphicsLayer) + return; + m_rootGraphicsLayer->setSize(size); + m_rootGraphicsLayer->setNeedsDisplay(); +} + +void AcceleratedCompositingContext::markForSync() +{ + if (m_syncTimer.isActive()) + return; + m_syncTimer.startOneShot(0); +} + +void AcceleratedCompositingContext::syncLayersNow() +{ + if (m_rootGraphicsLayer) + m_rootGraphicsLayer->syncCompositingStateForThisLayerOnly(); + + core(m_webView)->mainFrame()->view()->syncCompositingStateIncludingSubframes(); +} + +void AcceleratedCompositingContext::syncLayersTimeout(Timer<AcceleratedCompositingContext>*) +{ + syncLayersNow(); + if (!m_rootGraphicsLayer) + return; + + renderLayersToWindow(IntRect()); + + if (toTextureMapperNode(m_rootGraphicsLayer.get())->descendantsOrSelfHaveRunningAnimations()) + m_syncTimer.startOneShot(1.0 / 60.0); +} + +void AcceleratedCompositingContext::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) +{ + +} +void AcceleratedCompositingContext::notifySyncRequired(const WebCore::GraphicsLayer*) +{ + +} + +void AcceleratedCompositingContext::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint) +{ + cairo_t* cr = context.platformContext()->cr(); + copyRectFromCairoSurfaceToContext(m_webView->priv->backingStore->cairoSurface(), cr, + IntSize(), rectToPaint); +} + +bool AcceleratedCompositingContext::showDebugBorders(const WebCore::GraphicsLayer*) const +{ + return false; +} + +bool AcceleratedCompositingContext::showRepaintCounter(const WebCore::GraphicsLayer*) const +{ + return false; +} + +} // namespace WebKit + +#endif // USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp index 137b918ad..955c166a9 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp @@ -525,6 +525,20 @@ static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegio gc.restore(); } +void ChromeClient::invalidateWidgetRect(const IntRect& rect) +{ +#if USE(ACCELERATED_COMPOSITING) + AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get(); + if (acContext->enabled()) { + acContext->scheduleRootLayerRepaint(rect); + return; + } +#endif + gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), + rect.x(), rect.y(), + rect.width(), rect.height()); +} + void ChromeClient::performAllPendingScrolls() { if (!m_webView->priv->backingStore) @@ -534,16 +548,13 @@ void ChromeClient::performAllPendingScrolls() for (size_t i = 0; i < m_rectsToScroll.size(); i++) { IntRect& scrollRect = m_rectsToScroll[i]; m_webView->priv->backingStore->scroll(scrollRect, m_scrollOffsets[i]); - gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), - scrollRect.x(), scrollRect.y(), - scrollRect.width(), scrollRect.height()); + invalidateWidgetRect(scrollRect); } m_rectsToScroll.clear(); m_scrollOffsets.clear(); } - void ChromeClient::paint(WebCore::Timer<ChromeClient>*) { static const double minimumFrameInterval = 1.0 / 60.0; // No more than 60 frames a second. @@ -559,13 +570,10 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*) if (!frame || !frame->contentRenderer() || !frame->view()) return; - performAllPendingScrolls(); frame->view()->updateLayoutAndStyleIfNeededRecursive(); + performAllPendingScrolls(); paintWebView(m_webView, frame, m_dirtyRegion); - const IntRect& rect = m_dirtyRegion.bounds(); - gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height()); - HashSet<GtkWidget*> children = m_webView->priv->children; HashSet<GtkWidget*>::const_iterator end = children.end(); for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) { @@ -575,6 +583,14 @@ void ChromeClient::paint(WebCore::Timer<ChromeClient>*) } } + const IntRect& rect = m_dirtyRegion.bounds(); + invalidateWidgetRect(rect); + +#if USE(ACCELERATED_COMPOSITING) + m_webView->priv->acceleratedCompositingContext->syncLayersNow(); + m_webView->priv->acceleratedCompositingContext->renderLayersToWindow(rect); +#endif + m_dirtyRegion = Region(); m_lastDisplayTime = currentTime(); m_repaintSoonSourceId = 0; @@ -829,6 +845,9 @@ void ChromeClient::setCursor(const Cursor& cursor) // Setting the cursor may be an expensive operation in some backends, // so don't re-set the cursor if it's already set to the target value. GdkWindow* window = gtk_widget_get_window(platformPageClient()); + if (!window) + return; + GdkCursor* currentCursor = gdk_window_get_cursor(window); GdkCursor* newCursor = cursor.platformCursor().get(); if (currentCursor != newCursor) diff --git a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h index 932224f04..8c7c89233 100644 --- a/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h @@ -182,7 +182,9 @@ namespace WebKit { Vector<IntRect> m_rectsToScroll; Vector<IntSize> m_scrollOffsets; double m_lastDisplayTime; - uint m_repaintSoonSourceId; + unsigned int m_repaintSoonSourceId; + + void invalidateWidgetRect(const IntRect&); }; } diff --git a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp index 2e55ca3cb..d4d321d93 100644 --- a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Gustavo Noronha Silva + * Copyright (C) 2008, 2012 Gustavo Noronha Silva * Copyright (C) 2010 Collabora Ltd. * * This library is free software; you can redistribute it and/or @@ -171,6 +171,7 @@ void InspectorClient::bringFrontendToFront() void InspectorClient::releaseFrontendPage() { m_frontendPage = 0; + m_frontendClient = 0; } void InspectorClient::highlight() @@ -220,9 +221,10 @@ InspectorFrontendClient::InspectorFrontendClient(WebKitWebView* inspectedWebView InspectorFrontendClient::~InspectorFrontendClient() { if (m_inspectorClient) { - m_inspectorClient->disconnectFrontendClient(); + m_inspectorClient->releaseFrontendPage(); m_inspectorClient = 0; } + ASSERT(!m_webInspector); } @@ -230,11 +232,13 @@ void InspectorFrontendClient::destroyInspectorWindow(bool notifyInspectorControl { if (!m_webInspector) return; - WebKitWebInspector* webInspector = m_webInspector; - m_webInspector = 0; - g_signal_handlers_disconnect_by_func(m_inspectorWebView, (gpointer)notifyWebViewDestroyed, (gpointer)this); - m_inspectorWebView = 0; + GRefPtr<WebKitWebInspector> webInspector = adoptGRef(m_webInspector.leakRef()); + + if (m_inspectorWebView) { + g_signal_handlers_disconnect_by_func(m_inspectorWebView, reinterpret_cast<gpointer>(notifyWebViewDestroyed), this); + m_inspectorWebView = 0; + } if (notifyInspectorController) core(m_inspectedWebView)->inspectorController()->disconnectFrontend(); @@ -243,14 +247,11 @@ void InspectorFrontendClient::destroyInspectorWindow(bool notifyInspectorControl m_inspectorClient->releaseFrontendPage(); gboolean handled = FALSE; - g_signal_emit_by_name(webInspector, "close-window", &handled); + g_signal_emit_by_name(webInspector.get(), "close-window", &handled); ASSERT(handled); // Please do not use member variables here because InspectorFrontendClient object pointed by 'this' // has been implicitly deleted by "close-window" function. - - /* we should now dispose our own reference */ - g_object_unref(webInspector); } String InspectorFrontendClient::localizedStringsURL() @@ -274,7 +275,7 @@ void InspectorFrontendClient::bringToFront() return; gboolean handled = FALSE; - g_signal_emit_by_name(m_webInspector, "show-window", &handled); + g_signal_emit_by_name(m_webInspector.get(), "show-window", &handled); } void InspectorFrontendClient::closeWindow() @@ -288,7 +289,7 @@ void InspectorFrontendClient::attachWindow() return; gboolean handled = FALSE; - g_signal_emit_by_name(m_webInspector, "attach-window", &handled); + g_signal_emit_by_name(m_webInspector.get(), "attach-window", &handled); } void InspectorFrontendClient::detachWindow() @@ -297,7 +298,7 @@ void InspectorFrontendClient::detachWindow() return; gboolean handled = FALSE; - g_signal_emit_by_name(m_webInspector, "detach-window", &handled); + g_signal_emit_by_name(m_webInspector.get(), "detach-window", &handled); } void InspectorFrontendClient::setAttachedWindowHeight(unsigned height) @@ -310,7 +311,7 @@ void InspectorFrontendClient::inspectedURLChanged(const String& newURL) if (!m_inspectorWebView) return; - webkit_web_inspector_set_inspected_uri(m_webInspector, newURL.utf8().data()); + webkit_web_inspector_set_inspected_uri(m_webInspector.get(), newURL.utf8().data()); } } diff --git a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h index c692e8f19..db558f096 100644 --- a/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h @@ -30,6 +30,7 @@ #define InspectorClientGtk_h #include "GOwnPtr.h" +#include "GRefPtr.h" #include "InspectorClient.h" #include "InspectorFrontendClientLocal.h" #include "webkitwebview.h" @@ -98,7 +99,7 @@ namespace WebKit { private: WebKitWebView* m_inspectorWebView; WebKitWebView* m_inspectedWebView; - WebKitWebInspector* m_webInspector; + GRefPtr<WebKitWebInspector> m_webInspector; InspectorClient* m_inspectorClient; }; } diff --git a/Source/WebKit/gtk/docs/webkitgtk-docs.sgml b/Source/WebKit/gtk/docs/webkitgtk-docs.sgml index 3a7d35d44..3ad0fae10 100644 --- a/Source/WebKit/gtk/docs/webkitgtk-docs.sgml +++ b/Source/WebKit/gtk/docs/webkitgtk-docs.sgml @@ -40,7 +40,6 @@ <xi:include href="xml/webkitwebwindowfeatures.xml"/> <xi:include href="xml/webkiticondatabase.xml"/> <xi:include href="xml/webkitspellchecker.xml"/> - <xi:include href="xml/webkitspellcheckerenchant.xml"/> </chapter> <chapter> diff --git a/Source/WebKit/gtk/docs/webkitgtk-sections.txt b/Source/WebKit/gtk/docs/webkitgtk-sections.txt index a72aef726..4a358e83d 100644 --- a/Source/WebKit/gtk/docs/webkitgtk-sections.txt +++ b/Source/WebKit/gtk/docs/webkitgtk-sections.txt @@ -292,6 +292,7 @@ WebKitWebInspectorClass <FILE>webkitwebnavigationaction</FILE> <TITLE>WebKitWebNavigationAction</TITLE> WebKitWebNavigationAction +WebKitWebNavigationReason webkit_web_navigation_action_get_button webkit_web_navigation_action_get_modifier_state webkit_web_navigation_action_get_original_uri @@ -307,7 +308,6 @@ WEBKIT_WEB_NAVIGATION_ACTION WEBKIT_WEB_NAVIGATION_ACTION_CLASS WEBKIT_WEB_NAVIGATION_ACTION_GET_CLASS <SUBSECTION Private> -WebKitWebNavigationReason WebKitWebNavigationActionClass WebKitWebNavigationActionPrivate webkit_web_navigation_action_get_type @@ -639,23 +639,6 @@ webkit_spell_checker_get_type </SECTION> <SECTION> -<FILE>webkitspellcheckerenchant</FILE> -<TITLE>WebKitSpellCheckerEnchant</TITLE> -<SUBSECTION Standard> -WEBKIT_IS_SPELL_CHECKER_ENCHANT -WEBKIT_IS_SPELL_CHECKER_ENCHANT_CLASS -WEBKIT_SPELL_CHECKER_ENCHANT -WEBKIT_SPELL_CHECKER_ENCHANT_CLASS -WEBKIT_SPELL_CHECKER_ENCHANT_GET_CLASS -WEBKIT_TYPE_SPELL_CHECKER_ENCHANT -<SUBSECTION Private> -WebKitSpellCheckerEnchant -WebKitSpellCheckerEnchantClass -WebKitSpellCheckerEnchantPrivate -webkit_spell_checker_enchant_get_type -</SECTION> - -<SECTION> <FILE>webkiterror</FILE> WEBKIT_NETWORK_ERROR WEBKIT_PLUGIN_ERROR diff --git a/Source/WebKit/gtk/tests/test_utils.c b/Source/WebKit/gtk/tests/test_utils.c index 360a15b2a..6bb645d0d 100644 --- a/Source/WebKit/gtk/tests/test_utils.c +++ b/Source/WebKit/gtk/tests/test_utils.c @@ -29,10 +29,8 @@ int testutils_relative_chdir(const gchar *targetFilename, const gchar *executabl if (repoPath) { if (g_chdir(repoPath)) return -1; - } else if (g_path_is_absolute(executablePath)) { - if (g_chdir(g_path_get_dirname(executablePath))) + } else if (g_chdir(g_path_get_dirname(executablePath))) return -1; - } while (!g_file_test(targetFilename, G_FILE_TEST_EXISTS)) { gchar *pathName; diff --git a/Source/WebKit/gtk/tests/testatk.c b/Source/WebKit/gtk/tests/testatk.c index a79010175..60c27942b 100644 --- a/Source/WebKit/gtk/tests/testatk.c +++ b/Source/WebKit/gtk/tests/testatk.c @@ -35,7 +35,7 @@ static const char* contentsWithNewlines = "<html><body><p>This is a test. \n\nTh static const char* contentsWithPreformattedText = "<html><body><pre>\n\t\n\tfirst line\n\tsecond line\n</pre></body></html>"; -static const char* contentsWithSpecialChars = "<html><body><p>« This is a paragraph with “special” characters inside. »</p></body></html>"; +static const char* contentsWithSpecialChars = "<html><body><p>« This is a paragraph with “special” characters inside. »</p><ul><li style='max-width:100px;'>List item with some text that wraps across different lines.</li></ul></body></html>"; static const char* contentsInTextarea = "<html><body><textarea cols='80'>This is a test. This is the second sentence. And this the third.</textarea></body></html>"; @@ -810,23 +810,44 @@ static void testWebkitAtkGetTextAtOffsetWithSpecialCharacters() /* Get to the inner AtkText object. */ AtkObject* object = getWebAreaObject(webView); g_assert(object); - object = atk_object_ref_accessible_child(object, 0); - g_assert(object); - AtkText* textObject = ATK_TEXT(object); - g_assert(ATK_IS_TEXT(textObject)); + AtkObject* paragraph = atk_object_ref_accessible_child(object, 0); + g_assert(ATK_IS_TEXT(paragraph)); - const gchar* expectedText = "\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273"; - char* text = atk_text_get_text(textObject, 0, -1); + gchar* expectedText = g_strdup("\302\253\302\240This is a paragraph with \342\200\234special\342\200\235 characters inside.\302\240\302\273"); + char* text = atk_text_get_text(ATK_TEXT(paragraph), 0, -1); g_assert_cmpstr(text, ==, expectedText); g_free(text); /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START and ATK_TEXT_BOUNDARY_LINE_END does not crash because of not properly handling characters inside the UTF-8 string. */ - testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57); - testGetTextFunction(textObject, atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57); + testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 0, expectedText, 0, 57); + testGetTextFunction(ATK_TEXT(paragraph), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, expectedText, 0, 57); + g_free(expectedText); + + AtkObject* list = atk_object_ref_accessible_child(object, 1); + g_assert(ATK_OBJECT(list)); + + AtkText* listItem = ATK_TEXT(atk_object_ref_accessible_child(list, 0)); + g_assert(ATK_IS_TEXT(listItem)); + + text = atk_text_get_text(ATK_TEXT(listItem), 0, -1); + g_assert_cmpstr(text, ==, "\342\200\242 List item with some text that wraps across different lines."); + g_free(text); + /* Check that getting the text with ATK_TEXT_BOUNDARY_LINE_START + and ATK_TEXT_BOUNDARY_LINE_END for line items with bullets + (special character) and wrapped text always return the right + piece of text for each line. */ + testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 3, "\342\200\242 List item ", 0, 12); + testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_START, 13, "with some ", 12, 22); + testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 0, "\342\200\242 List item", 0, 11); + testGetTextFunction(ATK_TEXT(listItem), atk_text_get_text_at_offset, ATK_TEXT_BOUNDARY_LINE_END, 12, " with some", 11, 21); + + g_object_unref(list); + g_object_unref(listItem); + g_object_unref(paragraph); g_object_unref(webView); } diff --git a/Source/WebKit/gtk/tests/testwebinspector.c b/Source/WebKit/gtk/tests/testwebinspector.c new file mode 100644 index 000000000..40aa55334 --- /dev/null +++ b/Source/WebKit/gtk/tests/testwebinspector.c @@ -0,0 +1,177 @@ +/* + * Copyright (C) 2012 Gustavo Noronha Silva <gns@gnome.org> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "test_utils.h" + +#include <string.h> +#include <glib.h> +#include <gtk/gtk.h> +#include <webkit/webkit.h> + +#if GTK_CHECK_VERSION(2, 14, 0) + +GMainLoop *loop; +GtkWidget *window; + +static gboolean quitLoop(gpointer data) +{ + g_main_loop_quit(loop); + return TRUE; +} + +/* Ignore simple translation-related messages and upgrade other + * messages to warnings. + */ +static gboolean consoleMessageCallback(WebKitWebView* webView, const char* message, unsigned int line, const char* sourceId) +{ + if (strstr(message, "Localized string") || strstr(message, "Protocol Error: the message is for non-existing domain 'Profiler'")) + return TRUE; + + g_warning("Console: %s @%d: %s\n", sourceId, line, message); + return TRUE; +} + +static WebKitWebView* inspectElementCallback(WebKitWebInspector *inspector, WebKitWebView *inspectedWebView, int *timesElementInspected) +{ + *timesElementInspected = *timesElementInspected + 1; + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + + GtkWidget *newWebView = webkit_web_view_new(); + gtk_container_add(GTK_CONTAINER(window), newWebView); + + g_signal_connect(newWebView, "console-message", + G_CALLBACK(consoleMessageCallback), NULL); + + return WEBKIT_WEB_VIEW(newWebView); +} + +static gboolean closeInspector (WebKitWebInspector *inspector, int *timesClosed) +{ + *timesClosed = *timesClosed + 1; + + gtk_widget_destroy(window); + return TRUE; +} + +static gboolean showInspector (WebKitWebInspector *inspector, gpointer data) +{ + g_idle_add(quitLoop, NULL); + return TRUE; +} + +static void test_webkit_web_inspector_close_and_inspect() +{ + WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + WebKitWebSettings *settings = webkit_web_view_get_settings(webView); + g_object_set(settings, "enable-developer-extras", TRUE, NULL); + + webkit_web_view_load_string (webView, + "<html><body><p>woohoo</p></body></html>", + "text/html", "UTF-8", "file://"); + + WebKitWebInspector *inspector = webkit_web_view_get_inspector(webView); + + int timesElementInspected = 0; + int timesClosed = 0; + g_object_connect(inspector, + "signal::inspect-web-view", G_CALLBACK(inspectElementCallback), ×ElementInspected, + "signal::show-window", G_CALLBACK(showInspector), NULL, + "signal::close-window", G_CALLBACK(closeInspector), ×Closed, + NULL); + + webkit_web_inspector_inspect_coordinates(inspector, 0.0, 0.0); + g_assert_cmpint(timesElementInspected, ==, 1); + + loop = g_main_loop_new(NULL, TRUE); + g_main_loop_run(loop); + + webkit_web_inspector_close(inspector); + g_assert_cmpint(timesClosed, ==, 1); + + webkit_web_inspector_inspect_coordinates(inspector, 0.0, 0.0); + g_assert_cmpint(timesElementInspected, ==, 2); + + g_main_loop_run(loop); + + gtk_widget_destroy(GTK_WIDGET(webView)); + g_assert_cmpint(timesClosed, ==, 2); + + g_main_loop_unref(loop); +} + +static void test_webkit_web_inspector_destroy_inspected_web_view() +{ + WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); + + WebKitWebSettings *settings = webkit_web_view_get_settings(webView); + g_object_set(settings, "enable-developer-extras", TRUE, NULL); + + webkit_web_view_load_string (webView, + "<html><body><p>woohoo</p></body></html>", + "text/html", "UTF-8", "file://"); + + WebKitWebInspector *inspector = webkit_web_view_get_inspector(webView); + + int timesElementInspected = 0; + int timesClosed = 0; + g_object_connect(inspector, + "signal::inspect-web-view", G_CALLBACK(inspectElementCallback), ×ElementInspected, + "signal::show-window", G_CALLBACK(showInspector), NULL, + "signal::close-window", G_CALLBACK(closeInspector), ×Closed, + NULL); + + webkit_web_inspector_inspect_coordinates(inspector, 0.0, 0.0); + g_assert_cmpint(timesElementInspected, ==, 1); + + loop = g_main_loop_new(NULL, TRUE); + g_main_loop_run(loop); + + gtk_widget_destroy(GTK_WIDGET(webView)); + g_assert_cmpint(timesClosed, ==, 1); + + g_main_loop_unref(loop); +} + +int main(int argc, char** argv) +{ + gtk_test_init(&argc, &argv, NULL); + + testutils_relative_chdir("Programs/resources/inspector/inspector.html", argv[0]); + + char *currentDir = g_get_current_dir(); + g_setenv("WEBKIT_INSPECTOR_PATH", currentDir, TRUE); + g_free(currentDir); + + g_test_bug_base("https://bugs.webkit.org/"); + g_test_add_func("/webkit/webinspector/destroy-inspected-web-view", test_webkit_web_inspector_destroy_inspected_web_view); + g_test_add_func("/webkit/webinspector/close-and-inspect", test_webkit_web_inspector_close_and_inspect); + + return g_test_run (); +} + +#else +int main(int argc, char** argv) +{ + g_critical("You will need gtk-2.14.0 to run the unit tests. Doing nothing now."); + return 0; +} + +#endif diff --git a/Source/WebKit/gtk/webkit/webkitwebnavigationaction.h b/Source/WebKit/gtk/webkit/webkitwebnavigationaction.h index 4d8582e38..b317749f2 100644 --- a/Source/WebKit/gtk/webkit/webkitwebnavigationaction.h +++ b/Source/WebKit/gtk/webkit/webkitwebnavigationaction.h @@ -26,9 +26,16 @@ G_BEGIN_DECLS -/* - * The order of this enum must be the same as NavigationType in - * FrameLoaderTypes.h +/** + * WebKitWebNavigationReason: + * @WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED: The navigation was triggered by clicking a link. + * @WEBKIT_WEB_NAVIGATION_REASON_FORM_SUBMITTED: The navigation was triggered by submitting a form. + * @WEBKIT_WEB_NAVIGATION_REASON_BACK_FORWARD: The navigation was triggered by navigating forward or backward. + * @WEBKIT_WEB_NAVIGATION_REASON_RELOAD: The navigation was triggered by reloading. + * @WEBKIT_WEB_NAVIGATION_REASON_FORM_RESUBMITTED: The navigation was triggered by resubmitting a form. + * @WEBKIT_WEB_NAVIGATION_REASON_OTHER: The navigation was triggered by some other action. + * + * Enum values used to denote the various navigation reasons. */ typedef enum { WEBKIT_WEB_NAVIGATION_REASON_LINK_CLICKED, diff --git a/Source/WebKit/gtk/webkit/webkitwebsettings.cpp b/Source/WebKit/gtk/webkit/webkitwebsettings.cpp index 6b260c29a..d91c3bbf3 100644 --- a/Source/WebKit/gtk/webkit/webkitwebsettings.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebsettings.cpp @@ -119,7 +119,8 @@ enum { PROP_ENABLE_FULLSCREEN, PROP_ENABLE_DNS_PREFETCHING, PROP_ENABLE_WEBGL, - PROP_ENABLE_WEB_AUDIO + PROP_ENABLE_WEB_AUDIO, + PROP_ENABLE_ACCELERATED_COMPOSITING }; // Create a default user agent string @@ -899,6 +900,23 @@ static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass) _("Whether WebGL content should be rendered"), FALSE, flags)); + + /** + * WebKitWebSettings:enable-accelerated-compositing: + * + * Enable or disable support for accelerated compositing on pages. Accelerated + * compositing uses the GPU to render animations on pages smoothly and also allows + * proper rendering of 3D CSS transforms. + * + * Since: 1.7.5 + */ + g_object_class_install_property(gobject_class, + PROP_ENABLE_ACCELERATED_COMPOSITING, + g_param_spec_boolean("enable-accelerated-compositing", + _("Enable accelerated compositing"), + _("Whether accelerated compositing should be enabled"), + FALSE, + flags)); /** * WebKitWebSettings:enable-webaudio: * @@ -1107,6 +1125,9 @@ static void webkit_web_settings_set_property(GObject* object, guint prop_id, con case PROP_ENABLE_WEB_AUDIO: priv->enableWebAudio = g_value_get_boolean(value); break; + case PROP_ENABLE_ACCELERATED_COMPOSITING: + priv->enableAcceleratedCompositing = g_value_get_boolean(value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -1269,6 +1290,9 @@ static void webkit_web_settings_get_property(GObject* object, guint prop_id, GVa case PROP_ENABLE_WEB_AUDIO: g_value_set_boolean(value, priv->enableWebAudio); break; + case PROP_ENABLE_ACCELERATED_COMPOSITING: + g_value_set_boolean(value, priv->enableAcceleratedCompositing); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; diff --git a/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h b/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h index 823c36ec9..d7d082e5b 100644 --- a/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h +++ b/Source/WebKit/gtk/webkit/webkitwebsettingsprivate.h @@ -79,6 +79,7 @@ struct _WebKitWebSettingsPrivate { gboolean enableDNSPrefetching; gboolean enableWebgl; gboolean enableWebAudio; + gboolean enableAcceleratedCompositing; }; WEBKIT_API void webkit_web_settings_add_extra_plugin_directory(WebKitWebView*, const gchar* directory); diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index ac6158b44..c22461c74 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -648,6 +648,12 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr) if (!gdk_cairo_get_clip_rectangle(cr, &clipRect)) return FALSE; + WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv; +#if USE(TEXTURE_MAPPER_GL) + if (priv->acceleratedCompositingContext->renderLayersToWindow(clipRect)) + return FALSE; +#endif + cairo_rectangle_list_t* rectList = cairo_copy_clip_rectangle_list(cr); if (rectList->status || !rectList->num_rectangles) { cairo_rectangle_list_destroy(rectList); @@ -656,8 +662,8 @@ static gboolean webkit_web_view_draw(GtkWidget* widget, cairo_t* cr) Vector<IntRect> rects; for (int i = 0; i < rectList->num_rectangles; i++) { - copyRectFromCairoSurfaceToContext(WEBKIT_WEB_VIEW(widget)->priv->backingStore->cairoSurface(), - cr, IntSize(), enclosingIntRect(FloatRect(rectList->rectangles[i]))); + copyRectFromCairoSurfaceToContext(priv->backingStore->cairoSurface(), cr, IntSize(), + enclosingIntRect(FloatRect(rectList->rectangles[i]))); } cairo_rectangle_list_destroy(rectList); @@ -859,28 +865,52 @@ static void updateChildAllocationFromPendingAllocation(GtkWidget* child, void*) *allocation = IntRect(); } -static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) +static void resizeWebViewFromAllocation(WebKitWebView* webView, GtkAllocation* allocation) { - GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation); - - Page* page = core(WEBKIT_WEB_VIEW(widget)); + Page* page = core(webView); IntSize oldSize; if (FrameView* frameView = page->mainFrame()->view()) { oldSize = frameView->size(); frameView->resize(allocation->width, allocation->height); } - gtk_container_forall(GTK_CONTAINER(widget), updateChildAllocationFromPendingAllocation, 0); + gtk_container_forall(GTK_CONTAINER(webView), updateChildAllocationFromPendingAllocation, 0); WebKit::ChromeClient* chromeClient = static_cast<WebKit::ChromeClient*>(page->chrome()->client()); chromeClient->widgetSizeChanged(oldSize, IntSize(allocation->width, allocation->height)); chromeClient->adjustmentWatcher()->updateAdjustmentsFromScrollbars(); #if USE(ACCELERATED_COMPOSITING) - WEBKIT_WEB_VIEW(widget)->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height)); + webView->priv->acceleratedCompositingContext->resizeRootLayer(IntSize(allocation->width, allocation->height)); #endif } +static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) +{ + GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation); + + WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); + if (!gtk_widget_get_mapped(widget)) { + webView->priv->needsResizeOnMap = true; + return; + } + resizeWebViewFromAllocation(webView, allocation); +} + +static void webkitWebViewMap(GtkWidget* widget) +{ + GTK_WIDGET_CLASS(webkit_web_view_parent_class)->map(widget); + + WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); + if (!webView->priv->needsResizeOnMap) + return; + + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + resizeWebViewFromAllocation(webView, &allocation); + webView->priv->needsResizeOnMap = false; +} + static void webkit_web_view_grab_focus(GtkWidget* widget) { @@ -941,6 +971,8 @@ static gboolean webkit_web_view_focus_out_event(GtkWidget* widget, GdkEventFocus static void webkit_web_view_realize(GtkWidget* widget) { + WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv; + gtk_widget_set_realized(widget, TRUE); GtkAllocation allocation; @@ -979,6 +1011,10 @@ static void webkit_web_view_realize(GtkWidget* widget) attributes_mask |= GDK_WA_COLORMAP; #endif GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); + +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) + priv->hasNativeWindow = gdk_window_ensure_native(window); +#endif gtk_widget_set_window(widget, window); gdk_window_set_user_data(window, widget); @@ -993,8 +1029,6 @@ static void webkit_web_view_realize(GtkWidget* widget) gtk_style_context_set_background(gtk_widget_get_style_context(widget), window); #endif - WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); - WebKitWebViewPrivate* priv = webView->priv; gtk_im_context_set_client_window(priv->imContext.get(), window); } @@ -2767,6 +2801,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) widgetClass->query_tooltip = webkit_web_view_query_tooltip; widgetClass->show_help = webkit_web_view_show_help; #endif + widgetClass->map = webkitWebViewMap; GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass); containerClass->add = webkit_web_view_container_add; @@ -3211,6 +3246,10 @@ static void webkit_web_view_update_settings(WebKitWebView* webView) coreSettings->setWebGLEnabled(settingsPrivate->enableWebgl); #endif +#if USE(ACCELERATED_COMPOSITING) + coreSettings->setAcceleratedCompositingEnabled(settingsPrivate->enableAcceleratedCompositing); +#endif + #if ENABLE(WEB_AUDIO) coreSettings->setWebAudioEnabled(settingsPrivate->enableWebAudio); #endif @@ -3343,6 +3382,11 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar settings->setWebGLEnabled(g_value_get_boolean(&value)); #endif +#if USE(ACCELERATED_COMPOSITING) + else if (name == g_intern_string("enable-accelerated-compositing")) + settings->setAcceleratedCompositingEnabled(g_value_get_boolean(&value)); +#endif + #if ENABLE(WEB_AUDIO) else if (name == g_intern_string("enable-webaudio")) settings->setWebAudioEnabled(g_value_get_boolean(&value)); diff --git a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h index 8d2b7b04b..75ba14cbe 100644 --- a/Source/WebKit/gtk/webkit/webkitwebviewprivate.h +++ b/Source/WebKit/gtk/webkit/webkitwebviewprivate.h @@ -44,6 +44,7 @@ extern "C" { typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; struct _WebKitWebViewPrivate { WebCore::Page* corePage; + bool hasNativeWindow; OwnPtr<WebCore::WidgetBackingStore> backingStore; GRefPtr<WebKitWebSettings> webSettings; GRefPtr<WebKitWebInspector> webInspector; @@ -61,6 +62,7 @@ struct _WebKitWebViewPrivate { GRefPtr<GtkIMContext> imContext; gboolean transparent; + bool needsResizeOnMap; #ifndef GTK_API_VERSION_2 // GtkScrollablePolicy needs to be checked when diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 9e3f1563b..bf1173720 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,78 @@ +2012-02-07 Antti Koivisto <antti@apple.com> + + REGRESSION (r106681): Null check missing in [WebFrame(WebInternal) _typingStyle] + https://bugs.webkit.org/show_bug.cgi?id=78080 + + Reviewed by Reviewed by Andreas Kling, Darin Adler and Dan Bernstein. + + * WebView/WebFrame.mm: + (-[WebFrame _typingStyle]): + +2012-02-07 Tony Chang <tony@chromium.org> + + merge DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in + https://bugs.webkit.org/show_bug.cgi?id=78036 + + Reviewed by Darin Adler. + + * Configurations/FeatureDefines.xcconfig: Add ENABLE_DASHBOARD_SUPPORT to FEATURE_DEFINES. + +2012-02-06 Anders Carlsson <andersca@apple.com> + + Overlay scrollbars flash when window is simply activated + https://bugs.webkit.org/show_bug.cgi?id=77911 + <rdar://problem/10211995> + + Reviewed by Kenneth Russell. + + * WebView/WebView.mm: + (-[WebView _windowWillOrderOnScreen:]): + (-[WebView _windowWillOrderOffScreen:]): + Call FocusController::setContainingWindowIsVisible. + + +2012-02-06 Matthew Delaney <mdelaney@apple.com> + + toDataURL() uses stale data after putImageData() + https://bugs.webkit.org/show_bug.cgi?id=65767 + + Reviewed by Chris Marrin. + + * WebCoreSupport/WebSystemInterface.mm: + +2012-02-03 Antti Koivisto <antti@apple.com> + + Rename CSSMutableStyleDeclaration.h/.cpp to StylePropertySet.h/.cpp + https://bugs.webkit.org/show_bug.cgi?id=77779 + + Reviewed by Darin Adler. + + * WebView/WebHTMLView.mm: + +2012-02-03 Antti Koivisto <antti@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77740 + Split CSSMutableStyleDeclaration into separate internal and CSSOM types + + Reviewed by Andreas Kling and Darin Adler. + + * WebView/WebFrame.mm: + (-[WebFrame _typingStyle]): + +2012-02-03 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77691 + Fix PlatformScreen layering violation and PlatformScreenMac's incorrect use + of device scale + + Reviewed by Andy Estes. + + toUserSpace() and toDeviceSpace() don't need to take device scale. Also + restore a comment that I needlessly removed. + * WebCoreSupport/WebChromeClient.mm: + (WebChromeClient::setWindowRect): + (WebChromeClient::windowRect): + 2012-02-01 Dan Bernstein <mitz@apple.com> WebKit/mac part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after} diff --git a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig index 9be349394..f5bc9cf39 100644 --- a/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit/mac/Configurations/FeatureDefines.xcconfig @@ -37,6 +37,8 @@ ENABLE_BLOB_macosx = ENABLE_BLOB; ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; +ENABLE_DASHBOARD_SUPPORT = ENABLE_DASHBOARD_SUPPORT; + ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); ENABLE_DATALIST_macosx = ENABLE_DATALIST; @@ -123,4 +125,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit/mac/Configurations/Version.xcconfig b/Source/WebKit/mac/Configurations/Version.xcconfig index 39d847570..20bc364c1 100644 --- a/Source/WebKit/mac/Configurations/Version.xcconfig +++ b/Source/WebKit/mac/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 19; +MINOR_VERSION = 20; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index ce2f37cc9..3bac87b9c 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -150,16 +150,19 @@ void WebChromeClient::chromeDestroyed() delete this; } +// These functions scale between window and WebView coordinates because JavaScript/DOM operations +// assume that the WebView and the window share the same coordinate system. + void WebChromeClient::setWindowRect(const FloatRect& rect) { - NSRect windowRect = toDeviceSpace(rect, [m_webView window], [m_webView _backingScaleFactor]); + NSRect windowRect = toDeviceSpace(rect, [m_webView window]); [[m_webView _UIDelegateForwarder] webView:m_webView setFrame:windowRect]; } FloatRect WebChromeClient::windowRect() { NSRect windowRect = [[m_webView _UIDelegateForwarder] webViewFrame:m_webView]; - return toUserSpace(windowRect, [m_webView window], [m_webView _backingScaleFactor]); + return toUserSpace(windowRect, [m_webView window]); } // FIXME: We need to add API for setting and getting this. diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 5c3cdb3ee..2a76c98a9 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -45,6 +45,7 @@ void InitWebCoreSystemInterface(void) INIT(AdvanceDefaultButtonPulseAnimation); INIT(CGContextGetShouldSmoothFonts); INIT(CGPatternCreateWithImageAndTransform); + INIT(CGContextResetClip); INIT(CopyCFLocalizationPreferredName); INIT(CopyCONNECTProxyResponse); INIT(CopyNSURLResponseStatusLine); diff --git a/Source/WebKit/mac/WebView/WebFrame.mm b/Source/WebKit/mac/WebView/WebFrame.mm index c03435476..9c15fafef 100644 --- a/Source/WebKit/mac/WebView/WebFrame.mm +++ b/Source/WebKit/mac/WebView/WebFrame.mm @@ -55,7 +55,7 @@ #import <WebCore/AXObjectCache.h> #import <WebCore/AccessibilityObject.h> #import <WebCore/AnimationController.h> -#import <WebCore/CSSMutableStyleDeclaration.h> +#import <WebCore/CSSStyleDeclaration.h> #import <WebCore/CachedResourceLoader.h> #import <WebCore/Chrome.h> #import <WebCore/ColorMac.h> @@ -791,10 +791,10 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) { if (!_private->coreFrame) return nil; - RefPtr<CSSMutableStyleDeclaration> typingStyle = _private->coreFrame->selection()->copyTypingStyle(); + RefPtr<StylePropertySet> typingStyle = _private->coreFrame->selection()->copyTypingStyle(); if (!typingStyle) return nil; - return kit(typingStyle.get()); + return kit(typingStyle->ensureCSSStyleDeclaration()); } - (void)_setTypingStyle:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index cfc7b953c..66f7b3aaf 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -73,7 +73,6 @@ #import "WebViewInternal.h" #import <AppKit/NSAccessibility.h> #import <ApplicationServices/ApplicationServices.h> -#import <WebCore/CSSMutableStyleDeclaration.h> #import <WebCore/CachedImage.h> #import <WebCore/CachedResourceClient.h> #import <WebCore/CachedResourceLoader.h> @@ -112,6 +111,7 @@ #import <WebCore/RuntimeApplicationChecks.h> #import <WebCore/SharedBuffer.h> #import <WebCore/SimpleFontData.h> +#import <WebCore/StylePropertySet.h> #import <WebCore/Text.h> #import <WebCore/WebCoreObjCExtras.h> #import <WebCore/WebFontCache.h> diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index e2bf898e6..4525cba9f 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -3469,8 +3469,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl // Send a change screen to make sure the initial displayID is set [self doWindowDidChangeScreen]; - if (_private && _private->page) - _private->page->resumeScriptedAnimations(); + if (_private && _private->page) { + _private->page->resumeScriptedAnimations(); + _private->page->focusController()->setContainingWindowIsVisible(true); + } } - (void)_windowDidChangeScreen:(NSNotification *)notification @@ -3480,8 +3482,10 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl - (void)_windowWillOrderOffScreen:(NSNotification *)notification { - if (_private && _private->page) - _private->page->suspendScriptedAnimations(); + if (_private && _private->page) { + _private->page->suspendScriptedAnimations(); + _private->page->focusController()->setContainingWindowIsVisible(false); + } } - (void)_windowWillClose:(NSNotification *)notification diff --git a/Source/WebKit/qt/Api/qgraphicswebview.cpp b/Source/WebKit/qt/Api/qgraphicswebview.cpp index 7811ab170..c1eb5293a 100644 --- a/Source/WebKit/qt/Api/qgraphicswebview.cpp +++ b/Source/WebKit/qt/Api/qgraphicswebview.cpp @@ -40,7 +40,6 @@ #include <qgraphicsview.h> #include <qscrollbar.h> #include <qstyleoption.h> -#include <qinputcontext.h> #include <QtCore/qmetaobject.h> #include <QtCore/qsharedpointer.h> #include <QtCore/qtimer.h> diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 771ad56fb..178c70e5b 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -22,7 +22,6 @@ #include "qwebelement_p.h" #include "CSSComputedStyleDeclaration.h" -#include "CSSMutableStyleDeclaration.h" #include "CSSParser.h" #include "CSSRule.h" #include "CSSRuleList.h" @@ -33,6 +32,7 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "HTMLElement.h" +#include "StylePropertySet.h" #if USE(JSC) #include "Completion.h" #include "JSGlobalObject.h" @@ -503,12 +503,11 @@ QStringList QWebElement::attributeNames(const QString& namespaceUri) const return QStringList(); QStringList attributeNameList; - const NamedNodeMap* const attrs = m_element->updatedAttributes(); - if (attrs) { + if (m_element->hasAttributes()) { const String namespaceUriString(namespaceUri); // convert QString -> String once - const unsigned attrsCount = attrs->length(); + const unsigned attrsCount = m_element->attributeCount(); for (unsigned i = 0; i < attrsCount; ++i) { - const Attribute* const attribute = attrs->attributeItem(i); + const Attribute* const attribute = m_element->attributeItem(i); if (namespaceUriString == attribute->namespaceURI()) attributeNameList.append(attribute->localName()); } @@ -844,7 +843,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str if (!propID) return QString(); - CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); + StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); if (strategy == InlineStyle) return style->getPropertyValue(propID); @@ -909,7 +908,7 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value) return; int propID = cssPropertyID(name); - CSSMutableStyleDeclaration* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); + StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyleDecl(); if (!propID || !style) return; diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index c8e8dad5e..39b9d20d4 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -69,6 +69,7 @@ #include "PlatformWheelEvent.h" #include "PrintContext.h" #if USE(JSC) +#include "PropertyDescriptor.h" #include "PutPropertySlot.h" #endif #include "RenderLayer.h" @@ -336,7 +337,6 @@ void QWebFramePrivate::renderCompositedLayers(GraphicsContext* context, const In textureMapper->setGraphicsContext(context); textureMapper->setImageInterpolationQuality(context->imageInterpolationQuality()); textureMapper->setTextDrawingMode(context->textDrawingMode()); - textureMapper->setViewportSize(frame->view()->frameRect().size()); QPainter* painter = context->platformContext(); const QTransform transform = painter->worldTransform(); const TransformationMatrix matrix( @@ -518,8 +518,12 @@ void QWebFramePrivate::addQtSenderToGlobalObject() JSObjectRef function = JSObjectMakeFunctionWithCallback(context, propertyName.get(), qtSenderCallback); // JSC public API doesn't support setting a Getter for a property of a given object, https://bugs.webkit.org/show_bug.cgi?id=61374. - window->methodTable()->defineGetter(window, exec, propertyName.get()->identifier(&exec->globalData()), ::toJS(function), - JSC::ReadOnly | JSC::DontEnum | JSC::DontDelete); + JSC::PropertyDescriptor descriptor; + descriptor.setGetter(::toJS(function)); + descriptor.setSetter(JSC::jsUndefined()); + descriptor.setEnumerable(false); + descriptor.setConfigurable(false); + window->methodTable()->defineOwnProperty(window, exec, propertyName.get()->identifier(&exec->globalData()), descriptor, false); } #endif diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 0b854f952..148a27369 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,126 @@ +2012-02-09 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix compilation with newer Qt5 + https://bugs.webkit.org/show_bug.cgi?id=77653 + + Reviewed by Tor Arne Vestbø. + + * Api/qgraphicswebview.cpp: Removed unnecessary inclusion of removed header file. + * declarative/public.pri: Use quick1 instead of qtquick1. It's mandator with Qt 5. + * tests/tests.pri: Ditto. + * declarative/qdeclarativewebview_p.h: Fix includes, just use the module-less + version that works with all Qt versions. + * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: Ditto. + +2012-02-08 Leo Franchi <lfranchi@kde.org> + + Remote web inspector reentrancy fixes + https://bugs.webkit.org/show_bug.cgi?id=77022 + + Reviewed by Joseph Pecoraro. + + * WebCoreSupport/InspectorServerQt.cpp: + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): + +2012-02-06 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> + + Provide more attribute methods in Element + https://bugs.webkit.org/show_bug.cgi?id=77800 + + Reviewed by Ryosuke Niwa. + + * Api/qwebelement.cpp: + (QWebElement::attributeNames): access attributes via Element interface. + +2012-02-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Don't version QtWebKit.experimental. + https://bugs.webkit.org/show_bug.cgi?id=77739 + + Reviewed by Tor Arne Vestbø. + + We won't support previous versions of the experimental API. + + * declarative/experimental/plugin.cpp: + +2012-02-05 Gavin Barraclough <barraclough@apple.com> + + Remove JSObject defineGetter/defineSetter lookupGetter/lookupSetter + https://bugs.webkit.org/show_bug.cgi?id=77451 + + Reviewed by Sam Weinig. + + These can now all be implemented in terms of defineOwnProperty & getPropertyDescriptor. + Also remove initializeGetterSetterProperty, since this is equivalent to putDirectAccessor. + + * Api/qwebframe.cpp: + (QWebFramePrivate::addQtSenderToGlobalObject): + +2012-02-03 Antti Koivisto <antti@apple.com> + + Rename CSSMutableStyleDeclaration.h/.cpp to StylePropertySet.h/.cpp + https://bugs.webkit.org/show_bug.cgi?id=77779 + + Reviewed by Darin Adler. + + * Api/qwebelement.cpp: + +2012-02-03 Antti Koivisto <antti@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77740 + Split CSSMutableStyleDeclaration into separate internal and CSSOM types + + Reviewed by Andreas Kling and Darin Adler. + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + +2012-02-03 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Use TextureMapper::create instead of creating TextureMapperGL/TextureMapperQt directly. + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderCompositedLayers): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQWidget::setRootGraphicsLayer): + (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106620. + http://trac.webkit.org/changeset/106620 + https://bugs.webkit.org/show_bug.cgi?id=77716 + + It broke non ENABLE(3D_RENDERING) builds (Requested by + Ossy_morning on #webkit). + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderCompositedLayers): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQWidget::setRootGraphicsLayer): + (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): + +2012-02-02 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Use TextureMapper::create instead of creating TextureMapperGL/TextureMapperQt directly. + + * Api/qwebframe.cpp: + (QWebFramePrivate::renderCompositedLayers): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PageClientQWidget::setRootGraphicsLayer): + (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): + 2012-02-01 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Avoid creating NamedNodeMap unnecessarily diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index fdc14f533..26c52ff89 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -209,7 +209,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() // switch to websocket-style WebSocketService messaging if (m_tcpConnection) { m_tcpConnection->disconnect(SIGNAL(readyRead())); - connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead())); + connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()), Qt::QueuedConnection); QByteArray key3 = m_tcpConnection->read(8); @@ -357,6 +357,10 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() QByteArray payload = m_data.mid(1, length); + // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). + // Truncate data before delivering message in case of re-entrancy. + m_data = m_data.mid(length + 2); + #if ENABLE(INSPECTOR) if (m_inspectorClient) { InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController(); @@ -364,8 +368,6 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() } #endif - // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). - m_data = m_data.mid(length + 2); } } diff --git a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp index 40e6b148d..45dcfbbe1 100644 --- a/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -28,12 +28,8 @@ #endif #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) -#include "TextureMapperQt.h" +#include "TextureMapper.h" #include "texmap/TextureMapperNode.h" - -#if USE(TEXTURE_MAPPER_GL) -#include "opengl/TextureMapperGL.h" -#endif #endif namespace WebCore { @@ -76,7 +72,7 @@ void PageClientQWidget::setRootGraphicsLayer(GraphicsLayer* layer) { if (layer) { textureMapperNodeClient = adoptPtr(new TextureMapperNodeClientQt(page->mainFrame(), layer)); - textureMapperNodeClient->setTextureMapper(adoptPtr(new TextureMapperQt)); + textureMapperNodeClient->setTextureMapper(TextureMapper::create()); textureMapperNodeClient->syncRootLayer(); return; } @@ -267,11 +263,11 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(GraphicsLayer* layer) #if USE(TEXTURE_MAPPER_GL) QGraphicsView* graphicsView = view->scene()->views()[0]; if (graphicsView && graphicsView->viewport() && graphicsView->viewport()->inherits("QGLWidget")) { - textureMapperNodeClient->setTextureMapper(TextureMapperGL::create()); + textureMapperNodeClient->setTextureMapper(TextureMapper::create(TextureMapper::OpenGLMode)); return; } #endif - textureMapperNodeClient->setTextureMapper(TextureMapperQt::create()); + textureMapperNodeClient->setTextureMapper(TextureMapper::create()); return; } textureMapperNodeClient.clear(); diff --git a/Source/WebKit/qt/declarative/experimental/plugin.cpp b/Source/WebKit/qt/declarative/experimental/plugin.cpp index cab0fba09..7a41657ac 100644 --- a/Source/WebKit/qt/declarative/experimental/plugin.cpp +++ b/Source/WebKit/qt/declarative/experimental/plugin.cpp @@ -48,18 +48,18 @@ public: { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit.experimental")); - qmlRegisterUncreatableType<QWebDownloadItem>(uri, 3, 0, "DownloadItem", QObject::tr("Cannot create separate instance of DownloadItem")); - qmlRegisterUncreatableType<QWebNavigationListModel>(uri, 3, 0, "NavigationListModel", QObject::tr("Cannot create separate instance of NavigationListModel")); - qmlRegisterUncreatableType<QWebNavigationHistory>(uri, 3, 0, "NavigationHistory", QObject::tr("Cannot create separate instance of NavigationHistory")); - qmlRegisterExtendedType<QQuickWebView, QQuickWebViewExperimentalExtension>(uri, 3, 0, "WebView"); - qmlRegisterUncreatableType<QQuickWebViewExperimental>(uri, 3, 0, "WebViewExperimental", + qmlRegisterUncreatableType<QWebDownloadItem>(uri, 1, 0, "DownloadItem", QObject::tr("Cannot create separate instance of DownloadItem")); + qmlRegisterUncreatableType<QWebNavigationListModel>(uri, 1, 0, "NavigationListModel", QObject::tr("Cannot create separate instance of NavigationListModel")); + qmlRegisterUncreatableType<QWebNavigationHistory>(uri, 1, 0, "NavigationHistory", QObject::tr("Cannot create separate instance of NavigationHistory")); + qmlRegisterExtendedType<QQuickWebView, QQuickWebViewExperimentalExtension>(uri, 1, 0, "WebView"); + qmlRegisterUncreatableType<QQuickWebViewExperimental>(uri, 1, 0, "WebViewExperimental", QObject::tr("Cannot create separate instance of WebViewExperimental")); - qmlRegisterUncreatableType<QWebViewportInfo>(uri, 3, 0, "QWebViewportInfo", + qmlRegisterUncreatableType<QWebViewportInfo>(uri, 1, 0, "QWebViewportInfo", QObject::tr("Cannot create separate instance of QWebViewportInfo")); - qmlRegisterType<QQuickUrlSchemeDelegate>(uri, 3, 0, "UrlSchemeDelegate"); - qmlRegisterUncreatableType<QQuickNetworkRequest>(uri, 3, 0, "NetworkRequest", + qmlRegisterType<QQuickUrlSchemeDelegate>(uri, 1, 0, "UrlSchemeDelegate"); + qmlRegisterUncreatableType<QQuickNetworkRequest>(uri, 1, 0, "NetworkRequest", QObject::tr("NetworkRequest should not be created from QML")); - qmlRegisterUncreatableType<QQuickNetworkReply>(uri, 3, 0, "NetworkReply", + qmlRegisterUncreatableType<QQuickNetworkReply>(uri, 1, 0, "NetworkReply", QObject::tr("NetworkReply should not be created from QML")); } }; diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 667d944e2..a6665eda6 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -27,11 +27,7 @@ wince*:LIBS += $$QMAKE_LIBS_GUI CONFIG += qtwebkit qtwebkit-private QT += declarative -haveQt(5): QT += widgets quick - -contains(QT_CONFIG, qtquick1): { - QT += qtquick1 -} +haveQt(5): QT += widgets quick quick1 DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h index 83463db97..088f23bc8 100644 --- a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h +++ b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h @@ -21,17 +21,10 @@ #ifndef qdeclarativewebview_p_h #define qdeclarativewebview_p_h +#include <QAction> +#include <QDeclarativeItem> #include <QtCore/QBasicTimer> #include <QtCore/QUrl> - -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include <QtQuick1/QDeclarativeItem> -#include <QtWidgets/QAction> -#else -#include <QtDeclarative/QDeclarativeItem> -#include <QtGui/QAction> -#endif - #include <QtNetwork/QNetworkAccessManager> #include "qgraphicswebview.h" #include "qwebpage.h" diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp index b38db1daf..1f9a2ff84 100644 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -2,13 +2,8 @@ #include <QAction> #include <QColor> #include <QDebug> -#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) -#include <QtQuick1/QDeclarativeItem> -#include <QtQuick1/QDeclarativeView> -#else #include <QDeclarativeItem> #include <QDeclarativeView> -#endif #include <QDeclarativeComponent> #include <QDeclarativeEngine> #include <QDeclarativeProperty> diff --git a/Source/WebKit/qt/tests/tests.pri b/Source/WebKit/qt/tests/tests.pri index 2a08136b1..c4a5818f9 100644 --- a/Source/WebKit/qt/tests/tests.pri +++ b/Source/WebKit/qt/tests/tests.pri @@ -22,7 +22,7 @@ haveQt(5): QT += widgets CONFIG += qtwebkit haveQt(5) { - contains(QT_CONFIG, qtquick1): QT += declarative qtquick1 + QT += declarative quick1 } else { contains(QT_CONFIG, declarative): QT += declarative } diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 0b0b9b632..32db318fa 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,27 @@ +2012-02-07 MORITA Hajime <morrita@google.com> + + Replacement text should be available from the marker. + https://bugs.webkit.org/show_bug.cgi?id=77934 + + Reviewed by Kent Tamura. + + * WebKit.vcproj/WebKit_Cairo.def: + * WebKit.vcproj/WebKit_Cairo_debug.def: + +2012-02-02 Jon Lee <jonlee@apple.com> + + Clear shown notifications when context is no longer active + https://bugs.webkit.org/show_bug.cgi?id=77363 + <rdar://problem/10568907> + + Reviewed by Darin Adler. + + * WebCoreSupport/WebDesktopNotificationsDelegate.h: + (WebDesktopNotificationsDelegate): Add previously missing virtual functions. + * WebCoreSupport/WebDesktopNotificationsDelegate.cpp: + (WebDesktopNotificationsDelegate::notificationControllerDestroyed): + (WebDesktopNotificationsDelegate::cancelRequestsForPermission): + 2012-02-01 Anders Carlsson <andersca@apple.com> Another attempt to fix the Windows build. diff --git a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp index 8c66d0e50..b80590687 100644 --- a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.cpp @@ -165,6 +165,10 @@ void WebDesktopNotificationsDelegate::notificationObjectDestroyed(Notification* notificationDelegate()->notificationDestroyed(NotificationCOMWrapper::create(object)); } +void WebDesktopNotificationsDelegate::notificationControllerDestroyed() +{ +} + void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, PassRefPtr<VoidCallback> callback) { BString org(origin->toString()); @@ -172,6 +176,10 @@ void WebDesktopNotificationsDelegate::requestPermission(SecurityOrigin* origin, notificationDelegate()->requestNotificationPermission(org); } +void WebDesktopNotificationsDelegate::cancelRequestsForPermission(ScriptExecutionContext* context) +{ +} + NotificationPresenter::Permission WebDesktopNotificationsDelegate::checkPermission(const KURL& url) { int out = 0; diff --git a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h index 344c95b49..f0441cffe 100644 --- a/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h +++ b/Source/WebKit/win/WebCoreSupport/WebDesktopNotificationsDelegate.h @@ -49,7 +49,9 @@ public: virtual bool show(WebCore::Notification* object); virtual void cancel(WebCore::Notification* object); virtual void notificationObjectDestroyed(WebCore::Notification* object); + virtual void notificationControllerDestroyed(); virtual void requestPermission(WebCore::SecurityOrigin* origin, PassRefPtr<WebCore::VoidCallback> callback); + virtual void cancelRequestsForPermission(WebCore::ScriptExecutionContext*); virtual WebCore::NotificationPresenter::Permission checkPermission(const KURL& url); private: diff --git a/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo.def b/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo.def index 8d3528139..89b0a2a61 100644 --- a/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo.def +++ b/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo.def @@ -110,6 +110,7 @@ EXPORTS ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z ??0ClientRect@WebCore@@AAE@XZ ?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z + ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ ?fastMalloc@WTF@@YAPAXI@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z ?fastFree@WTF@@YAXPAX@Z diff --git a/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def b/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def index 5522672b4..1b1b72df4 100644 --- a/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def +++ b/Source/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def @@ -110,6 +110,7 @@ EXPORTS ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z ??0ClientRect@WebCore@@AAE@XZ ?absoluteBoundingBoxRect@RenderObject@WebCore@@QAE?AVIntRect@2@_N@Z + ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ ?fastMalloc@WTF@@YAPAXI@Z ?fastZeroedMalloc@WTF@@YAPAXI@Z ?fastFree@WTF@@YAXPAX@Z diff --git a/Source/WebKit2/CMakeLists.txt b/Source/WebKit2/CMakeLists.txt index 3c4a8d0ca..0414d1333 100644 --- a/Source/WebKit2/CMakeLists.txt +++ b/Source/WebKit2/CMakeLists.txt @@ -219,7 +219,6 @@ SET(WebKit2_SOURCES UIProcess/GeolocationPermissionRequestManagerProxy.cpp UIProcess/GeolocationPermissionRequestProxy.cpp UIProcess/ResponsivenessTimer.cpp - UIProcess/TiledDrawingAreaProxy.cpp UIProcess/VisitedLinkProvider.cpp UIProcess/WebApplicationCacheManagerProxy.cpp UIProcess/WebBackForwardList.cpp @@ -373,7 +372,6 @@ SET(WebKit2_SOURCES WebProcess/WebPage/FindController.cpp WebProcess/WebPage/LayerTreeHost.cpp WebProcess/WebPage/PageOverlay.cpp - WebProcess/WebPage/TiledDrawingArea.cpp WebProcess/WebPage/WebBackForwardListProxy.cpp WebProcess/WebPage/WebContextMenu.cpp WebProcess/WebPage/WebUndoStep.cpp @@ -440,7 +438,7 @@ SET(WebKit2_LIBRARIES ${WebCore_LIBRARY_NAME} ) -SET(WebProcess_NAME ../Programs/WebProcess) +SET(WebProcess_NAME ../bin/WebProcess) SET(WebProcess_SOURCES "") SET(WebProcess_LIBRARIES diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index e2d0471f2..35d30bb45 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,1135 @@ +2012-02-08 Keunsoon Lee <keunsoon.lee@samsung.com> + + [WK2][EFL] creating dummy class derived from ResourceHandleClient for Efl download module. + https://bugs.webkit.org/show_bug.cgi?id=76171 + + Reviewed by Andreas Kling. + + FileDownloaderEfl is a practical class to operate file download. + It communicates with Download class to start download + and to notify downloading states to user(e.g. client application). + Besides FileDownloaderEfl derives from ResourceHandleClient + and receives chunked data from ResourceHandle directly + or redirects data flow which is started from MainResourceLoader + by mean of exchanging ResourceHandle's existing client for FileDownloaderEfl. + + This patch has only dummy functions to make easy to review. + Working patch will be uploaded on another bug thread. + + * PlatformEfl.cmake: added new file to compile. + * WebProcess/Downloads/Download.h: added FileDownloaderEfl's instance as a form of OwnPtr<FileDownloaderEfl>. + (WebKit): + (Download): + * WebProcess/Downloads/efl/DownloadEfl.cpp: + (WebKit::Download::start): calling to FileDownloaderEfl::start() to start download for passing ResourceRequest. + * WebProcess/Downloads/efl/FileDownloaderEfl.cpp: Added. a practical class to operate file download. + (WebKit): + (WebKit::FileDownloaderEfl::create): create function, which returns PassOwnPtr<FileDownloaderEfl>. + (WebKit::FileDownloaderEfl::FileDownloaderEfl): constructor, which receives Download* as a parameter. + (WebKit::FileDownloaderEfl::~FileDownloaderEfl): deconstructor. + (WebKit::FileDownloaderEfl::start): a function to start downloading for passed ResourceRequest. + It does nothing for now, but shows how Download class can call FileDownloaderEfl's function. + (WebKit::FileDownloaderEfl::didReceiveResponse): virtual function for ResourceHandleClient. + It will receive response header information from ResourceHandle. + (WebKit::FileDownloaderEfl::didReceiveData): virtual function for ResourceHandleClient. + It will receive chunk data from ResourceHandle. + (WebKit::FileDownloaderEfl::didFinishLoading): virtual function for ResourceHandleClient. + It will be notified loading is finished from ResourceHandle. + (WebKit::FileDownloaderEfl::didFail): virtual function for ResourceHandleClient. + It will be notified loading is fail with ResourceError from ResourceHandle. + (WebKit::FileDownloaderEfl::shouldUseCredentialStorage): virtual function for ResourceHandleClient. + It returns whether to use credential storage or not. + (WebKit::FileDownloaderEfl::didReceiveAuthenticationChallenge): virtual function for ResourceHandleClient. + It will receive AuthenticationChallenge. + (WebKit::FileDownloaderEfl::didCancelAuthenticationChallenge): virtual function for ResourceHandleClient. + It will be notified AuthenticationChallenge is canceled. + (WebKit::FileDownloaderEfl::receivedCancellation): virtual function for ResourceHandleClient. + * WebProcess/Downloads/efl/FileDownloaderEfl.h: Added. + (WebCore): + (WebKit): + (FileDownloaderEfl): + +2012-02-07 MORITA Hajime <morrita@google.com> + + Replacement text should be available from the marker. + https://bugs.webkit.org/show_bug.cgi?id=77934 + + Reviewed by Kent Tamura. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-02-08 Anders Carlsson <andersca@apple.com> + + Don't use the wheel event handler count to track if a page has horizontal scrollbars + https://bugs.webkit.org/show_bug.cgi?id=78192 + + Reviewed by Andreas Kling. + + Prior to this change, we were incrementing and decrementing the wheel event handler count + whenever a scrollable area gained or lost a horizontal scrollbar, so we could use the count + to determine if Safari can handle horizontal wheel events directly or whether they have to be sent + to the web process first. + + What this meant was that whenever a page had horizontal scrollbars we'd have to send all scroll wheel events + to the main thread instead of the scrolling thread, regardless of whether there were any wheel event handlers. + + After this change, we traverse the tree of scrollable areas after every layout and check if any of them + have a horizontal scrollbar. (We still also check if there are wheel event handlers). + + If traversing the tree after every layout is deemed to slow we can go back to caching the number of horizontal scrollbars + in a page, but the number of subframes in a page is usually very small and the number of other scrollable areas is even smaller. + + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + (WebKit::WebPageProxy::willHandleHorizontalScrollEvents): + * UIProcess/WebPageProxy.h: + (WebKit::WebPageProxy::setCanShortCircuitHorizontalWheelEvents): + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + * WebProcess/WebCoreSupport/WebChromeClient.cpp: + (WebKit::WebChromeClient::numWheelEventHandlersChanged): + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::dispatchDidLayout): + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::WebPage): + (WebKit::WebPage::numWheelEventHandlersChanged): + (WebKit): + (WebKit::hasEnabledHorizontalScrollbar): + (WebKit::pageContainsAnyHorizontalScrollbars): + (WebKit::WebPage::recomputeShortCircuitHorizontalWheelEventsState): + * WebProcess/WebPage/WebPage.h: + (WebPage): + +2012-02-08 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106920, r106924, r106933, r106939, + and r107090. + http://trac.webkit.org/changeset/106920 + http://trac.webkit.org/changeset/106924 + http://trac.webkit.org/changeset/106933 + http://trac.webkit.org/changeset/106939 + http://trac.webkit.org/changeset/107090 + https://bugs.webkit.org/show_bug.cgi?id=78124 + + Something is completely wrong this change (Requested by + Ossy_gardener on #webkit). + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + (WebProcessCreationParameters): + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): + * UIProcess/qt/WebContextQt.cpp: + (WebKit::WebContext::platformInitializeWebProcess): + * WebProcess/qt/WebProcessQt.cpp: + (WebKit): + (WebKit::WebProcess::platformSetCacheModel): + (WebKit::WebProcess::platformInitializeWebProcess): + +2012-02-08 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix a crash when WebKitWebView is created without a WebContext + https://bugs.webkit.org/show_bug.cgi?id=78104 + + Reviewed by Philippe Normand. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewSetProperty): Make sure WebKitWebView:web-context + property is initialized to the default web context when a web + context is not passed to g_object_new(). + * UIProcess/API/gtk/tests/TestWebKitWebView.cpp: + (testWebViewDefaultContext): Check that a web view created with + g_object_new has the default context. + +2012-02-08 Michael Brüning <michael.bruning@nokia.com> + + [Qt][WK2] Compute and set cache capacities using the current CacheModel + https://bugs.webkit.org/show_bug.cgi?id=73918 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/WebContext.cpp: + (WebKit::WebContext::WebContext): Set default cacheModel for Qt platform to + CacheModelPrimaryWebBrowser. + +2012-02-08 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix WebKitWebView::decide-policy API documentation + https://bugs.webkit.org/show_bug.cgi?id=78101 + + Reviewed by Martin Robinson. + + - It refers to WebKitPolicyClient instead of WebKitWebView + - Trailing ':' is missing + - References @decision as WebKitNavigationPolicyDecision instead + of WebKitPolicyDecision + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkit_web_view_class_init): + +2012-02-08 Mahesh Kulkarni <mahesh.kulkarni@nokia.com> + + [Qt] Build broken if qt missing openssl + https://bugs.webkit.org/show_bug.cgi?id=77894 + + Reviewed by Chang Shu. + + Build fix. No new test content. + + * WebProcess/qt/QtNetworkAccessManager.cpp: + (WebKit::QtNetworkAccessManager::onSslErrors): + +2012-02-08 Yael Aharon <yael.aharon@nokia.com> + + [WK2] Text notifications should have an iconURL + https://bugs.webkit.org/show_bug.cgi?id=77968 + + Reviewed by Simon Hausmann. + + Per http://www.w3.org/TR/notifications simple text notifications should have an iconURL. + Add an iconURL to WebNotification and add a public API to access it. + + * UIProcess/API/C/WKNotification.cpp: + (WKNotificationCopyiconURL): + * UIProcess/API/C/WKNotification.h: + * UIProcess/Notifications/WebNotification.cpp: + (WebKit::WebNotification::WebNotification): + * UIProcess/Notifications/WebNotification.h: + (WebKit::WebNotification::create): + (WebKit::WebNotification::iconURL): + (WebNotification): + * UIProcess/Notifications/WebNotificationManagerProxy.cpp: + (WebKit::WebNotificationManagerProxy::show): + * UIProcess/Notifications/WebNotificationManagerProxy.h: + (WebNotificationManagerProxy): + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::showNotification): + * UIProcess/WebPageProxy.h: + (WebPageProxy): + * UIProcess/WebPageProxy.messages.in: + * WebProcess/Notifications/WebNotificationManager.cpp: + (WebKit::WebNotificationManager::show): + +2012-02-08 Philippe Normand <pnormand@igalia.com> + + [GTK][WK2] enable-webaudio WebSetting + https://bugs.webkit.org/show_bug.cgi?id=77959 + + Reviewed by Martin Robinson. + + Add a new WebKitGTK WebSetting to enable/disable WebAudio at + runtime. + + * UIProcess/API/gtk/WebKitSettings.cpp: + (webKitSettingsSetProperty): + (webKitSettingsGetProperty): + (webkit_settings_class_init): + (webkit_settings_get_enable_webaudio): + (webkit_settings_set_enable_webaudio): + * UIProcess/API/gtk/WebKitSettings.h: + * UIProcess/API/gtk/tests/TestWebKitSettings.cpp: + (testWebKitSettings): + +2012-02-07 Martin Robinson <mrobinson@igalia.com> + + [GTK] [WK2] Add WebKitResponsePolicyDecision + https://bugs.webkit.org/show_bug.cgi?id=76789 + + Reviewed by Philippe Normand. + + Add a WebKitResponsePolicyDecision GObject, use it for response + policy decisions and add a test. + + * GNUmakefile.am: Added new source files to the list. + * UIProcess/API/gtk/WebKitPolicyClient.cpp: + (decidePolicyForResponseCallback): Added this callback which creates the request + and fires the signal. + (attachPolicyClientToPage): Added new callback to the C API policy client. + * UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp: Added. + * UIProcess/API/gtk/WebKitResponsePolicyDecision.h: Added. + * UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h: Added. + * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: Added new docs. + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Ditto. + * UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp: + (testResponsePolicy): Added this test for response policy decisions. + (serverCallback): Added a SoupServer to test policy response policy decisions. + (beforeAll): Ditto. + (afterAll): Ditto. + +2012-02-07 Timothy Hatcher <timothy@apple.com> + + Avoid making a window for the Web Inspector when it is docked. + + This also makes sure the inspector WKView is in a window before the page is loaded. + This avoids some redundant work caused by moving it to a window later. + + https://webkit.org/b/78064 + + Reviewed by Brian Weinstein. + + * UIProcess/WebInspectorProxy.cpp: + (WebKit::WebInspectorProxy::createInspectorPage): Set m_isAttached here... + (WebKit::WebInspectorProxy::didLoadInspectorPage): ... instead of here. + * UIProcess/WebInspectorProxy.h: + (WebInspectorProxy): + * UIProcess/mac/WebInspectorProxyMac.mm: + (WebKit::WebInspectorProxy::createInspectorWindow): Added. Factored out of platformOpen. + (WebKit::WebInspectorProxy::updateInspectorWindowTitle): Added. Factored out of platformInspectedURLChanged. + (WebKit::WebInspectorProxy::platformCreateInspectorPage): Call platformAttach or createInspectorWindow. + (WebKit::WebInspectorProxy::platformOpen): Make the view or window visible. + (WebKit::WebInspectorProxy::platformDidClose): Only message m_inspectorWindow if it isn't nil. + (WebKit::WebInspectorProxy::platformInspectedURLChanged): Store the urlString and call updateInspectorWindowTitle. + (WebKit::WebInspectorProxy::inspectedViewFrameDidChange): Return early if not visible. + (WebKit::WebInspectorProxy::platformAttach): Start out hidden if we are not visible yet. Destroy the window. + (WebKit::WebInspectorProxy::platformDetach): Use createInspectorWindow to create it again. + +2012-02-07 Tony Chang <tony@chromium.org> + + merge DashboardSupportCSSPropertyNames.in into CSSPropertyNames.in + https://bugs.webkit.org/show_bug.cgi?id=78036 + + Reviewed by Darin Adler. + + * Configurations/FeatureDefines.xcconfig: Add ENABLE_DASHBOARD_SUPPORT to FEATURE_DEFINES. + +2012-02-07 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [CMAKE] Use *bin* and *lib* directories for executable and libraries. + https://bugs.webkit.org/show_bug.cgi?id=77928 + + Reviewed by Daniel Bates. + + CMake has used *Programs* directory for executable. In addition, shared libraries are being + built in source directory. It is better to set common places in order to maintain executable + and libraries. *bin* is for executable and *lib* is for library. + + * CMakeLists.txt: + +2012-02-07 Timothy Hatcher <timothy@apple.com> + + Initilize the WebPageProxy intrinsicDeviceScaleFactor on creation of the WKView. + + If WKView was created and loaded a page with canvas elements before beinging moved + to a window, the canvas elements would be locked in at a pixel ratio of 1. With this + change the WKView will use the main screen's pixel ratio until it moves to a window. + + Reviewed by Anders Carlsson. + + * UIProcess/API/mac/WKView.mm: + (-[WKView initWithFrame:contextRef:pageGroupRef:]): Call setIntrinsicDeviceScaleFactor. + +2012-02-07 Alexey Proskuryakov <ap@apple.com> + + Keep a reference in didReceiveInvalidMessage. + https://bugs.webkit.org/show_bug.cgi?id=78024 + + Reviewed by Anders Carlsson. + + * UIProcess/WebConnectionToWebProcess.cpp: + (WebKit::WebConnectionToWebProcess::didReceiveInvalidMessage): + +2012-02-06 Anders Carlsson <andersca@apple.com> + + ScrollableAreaSet should be moved from Page to FrameView + https://bugs.webkit.org/show_bug.cgi?id=62762 + + Reviewed by Beth Dakin. + + * WebProcess/Plugins/PDF/BuiltInPDFView.cpp: + (WebKit::BuiltInPDFView::initialize): + Call FrameView::addScrollableArea instead. + + (WebKit::BuiltInPDFView::destroy): + Call FrameView::removeScrollableArea instead. + + * WebProcess/Plugins/PDF/BuiltInPDFView.h: + Remove disconnectFromPage since it no longer exists on ScrollableArea. + +2012-02-07 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Add cut, copy and paste methods to WebKit2 GTK+ API + https://bugs.webkit.org/show_bug.cgi?id=76998 + + Reviewed by Martin Robinson. + + * GNUmakefile.am: Add WebKitEditingCommands.h. + * UIProcess/API/gtk/WebKitEditingCommands.h: Added. + * UIProcess/API/gtk/WebKitWebView.cpp: + (didValidateCommand): Callback called by the C API when an editor + command has been validated. + (webkit_web_view_can_execute_editing_command): Asynchronously + validate the given editing command. + (webkit_web_view_can_execute_editing_command_finish): Finish async + operation started by webkit_web_view_can_execute_editing_command(). + (webkit_web_view_execute_editing_command): Execute the given + command. + * UIProcess/API/gtk/WebKitWebView.h: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new symbols. + * UIProcess/API/gtk/tests/GNUmakefile.am: + * UIProcess/API/gtk/tests/LoadTrackingTest.cpp: + (LoadTrackingTest::provisionalLoadFailed): Do not finish the main + loop on load failure, now finished is always called. + * UIProcess/API/gtk/tests/TestBackForwardList.cpp: Use WebViewTest + instead of LoadTrackingTest. + * UIProcess/API/gtk/tests/TestWebViewEditor.cpp: Added. + (testWebViewEditorCutCopyPasteNonEditable): + (testWebViewEditorCutCopyPasteEditable): + (beforeAll): + (afterAll): + * UIProcess/API/gtk/tests/WebViewTest.cpp: + (loadChanged): + (WebViewTest::waitUntilLoadFinished): Run a main loop until load + finished. + * UIProcess/API/gtk/tests/WebViewTest.h: Add waitUntilLoadFinished(). + * UIProcess/API/gtk/webkit2.h: Include WebKitEditingCommands.h. + +2012-02-07 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + Encode radius, force and rotationAngle in WebPlatformTouchPoint. + https://bugs.webkit.org/show_bug.cgi?id=77986 + + Reviewed by Kenneth Rohde Christiansen. + + * Shared/WebEvent.h: + (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint): + (WebPlatformTouchPoint): + (WebKit::WebPlatformTouchPoint::radius): + (WebKit::WebPlatformTouchPoint::rotationAngle): + (WebKit::WebPlatformTouchPoint::force): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint): + * Shared/WebPlatformTouchPoint.cpp: + (WebKit::WebPlatformTouchPoint::WebPlatformTouchPoint): + (WebKit::WebPlatformTouchPoint::encode): + (WebKit::WebPlatformTouchPoint::decode): + +2012-02-07 Andras Becsi <andras.becsi@nokia.com> + + [Qt] [WK2] Fix the debug build after r106920 + + * WebProcess/qt/WebProcessQt.cpp: + (WebKit::WebProcess::platformSetCacheModel): + Remove unnecessary assert. + +2012-02-03 Andras Becsi <andras.becsi@nokia.com> + + [Qt][WK2] Add the componentComplete method to WebView + https://bugs.webkit.org/show_bug.cgi?id=77111 + + Reviewed by Simon Hausmann. + + Move the initialization of the interaction engine to componentComplete + in preparation of switching to a Flickable based content positioning + for the touch based WebView. + Suspend the page and delay the dispatch of load success on startup until + the component finished initialization. With this patch instantiating the + WebView in C++ is only possible by creating a QDeclarativeComponent as + the initialization depends on the componentComplete method being called. + Also return valid default values in the viewport info functions if the + interaction engine is not yet initialized because the viewport info + component could finish initialization earlier than the WebView, which + results in QML warnings during MiniBrowser startup. + + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::initialize): + (QQuickWebViewPrivate::loadDidSucceed): + (QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate): + (QQuickWebViewFlickablePrivate::initialize): + (QQuickWebViewFlickablePrivate::onComponentComplete): + (QQuickWebViewFlickablePrivate::loadDidSucceed): + (QQuickWebViewFlickablePrivate::updateViewportSize): + (QQuickWebViewFlickablePrivate::_q_resume): + (QQuickWebView::geometryChanged): + (QQuickWebView::componentComplete): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate::onComponentComplete): + (QQuickWebViewPrivate): + (QQuickWebViewFlickablePrivate): + * UIProcess/API/qt/qwebviewportinfo.cpp: + (QWebViewportInfo::currentScale): + (QWebViewportInfo::devicePixelRatio): + (QWebViewportInfo::initialScale): + (QWebViewportInfo::minimumScale): + (QWebViewportInfo::maximumScale): + (QWebViewportInfo::isScalable): + (QWebViewportInfo::layoutSize): + * UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro: + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView::tst_QQuickWebView): + (tst_QQuickWebView::init): + (tst_QQuickWebView::multipleWebViewWindows): + (tst_QQuickWebView::multipleWebViews): + * UIProcess/qt/QtWebPageLoadClient.cpp: + (QtWebPageLoadClient::dispatchLoadSucceeded): + +2012-02-07 YoungTaeck Song <youngtaeck.song@samsung.com> + + [EFL][WK2] Add ModuleEfl.cpp + https://bugs.webkit.org/show_bug.cgi?id=63608 + + Reviewed by Andreas Kling. + + Add first version of ModuleEfl.cpp including load(), unload() and platformFunctionPointer(). + + * Platform/Module.h: + * Platform/efl/ModuleEfl.cpp: Added. + (WebKit::Module::load): + (WebKit::Module::unload): + (WebKit::Module::platformFunctionPointer): + +2012-02-07 Michael Brüning <michael.bruning@nokia.com> + + [Qt][WK2] Compute and set cache capacities using the current CacheModel + https://bugs.webkit.org/show_bug.cgi?id=73918 + + Reviewed by Kenneth Rohde Christiansen. + + First part of the implementation. The next steps are the implementation + of the API for the Qt WebKit 2 port and the hybrid memory and disk cache. + + * Shared/WebProcessCreationParameters.cpp: + (WebKit::WebProcessCreationParameters::encode): + (WebKit::WebProcessCreationParameters::decode): + * Shared/WebProcessCreationParameters.h: + (WebProcessCreationParameters): + * UIProcess/qt/WebContextQt.cpp: + (WebKit::defaultDiskCacheDirectory): + (WebKit): + (WebKit::WebContext::platformInitializeWebProcess): + * WebProcess/qt/WebProcessQt.cpp: + (WebKit::physicalMemorySizeInBytes): + (WebKit): + (WebKit::WebProcess::platformSetCacheModel): + (WebKit::WebProcess::platformInitializeWebProcess): + +2012-02-06 Shinya Kawanaka <shinyak@google.com> + + Remove Element::ensureShadowRoot export. + https://bugs.webkit.org/show_bug.cgi?id=77932 + + Reviewed by Hajime Morita. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + [GTK] Add TextureMapperGL implementation + https://bugs.webkit.org/show_bug.cgi?id=75308 + + Reviewed by Alejandro G. Castro. + + Fix the WebKit2 + AC build for GTK+. + + * GNUmakefile.am: Add some missing source files. + * UIProcess/DrawingAreaProxy.cpp: + (WebKit): Add USE(TILED_BACKING_STORE) to the guard. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::didReceiveMessage): Ditto. + * WebProcess/WebPage/DrawingArea.h: + (DrawingArea): Ditto. + * WebProcess/WebPage/DrawingAreaImpl.cpp: + (WebKit): Ditto. + * WebProcess/WebPage/DrawingAreaImpl.h: + (DrawingAreaImpl): Ditto. + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + Fix some miscellaneous 'make dist' error for WebKitGTK+. + + * GNUmakefile.am: Do not distribute generated files. + +2012-02-06 Anders Carlsson <andersca@apple.com> + + Overlay scrollbars flash when window is simply activated + https://bugs.webkit.org/show_bug.cgi?id=77911 + + Reviewed by Kenneth Russell. + + * UIProcess/API/mac/WKView.mm: + (-[WKView _updateWindowVisibility]): + Use -[NSWindow isVisible] here, since we also want to consider the window hidden if the application itself is hidden. + + (-[WKView _windowDidOrderOffScreen:]): + (-[WKView _windowDidOrderOnScreen:]): + Call -[WKView updateWindowVisibility]. + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::setWindowIsVisible): + Call FocusController::setContainingWindowIsVisible. + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + [GTK] Fix remaining errors in GTK+ WebKit2 API + https://bugs.webkit.org/show_bug.cgi?id=77890 + + Reviewed by Gustavo Noronha Silva. + + Fix some style issues in the GTK+ WebKit2 API section of the source code. + + * UIProcess/API/gtk/WebKitPrivate.h: + * UIProcess/API/gtk/WebKitWebView.cpp: + * UIProcess/API/gtk/tests/TestMain.h: + +2012-02-06 Matthew Delaney <mdelaney@apple.com> + + toDataURL() uses stale data after putImageData() + https://bugs.webkit.org/show_bug.cgi?id=65767 + + Reviewed by Chris Marrin. + + * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: + (InitWebCoreSystemInterface): + +2012-02-06 Ryosuke Niwa <rniwa@webkit.org> + + gcc build fix after r106749. + + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::WebPreferences): + +2012-02-06 Martin Robinson <mrobinson@igalia.com> + + [GTK] WebKitWebView does a lot of work during size_allocate when not mapped + https://bugs.webkit.org/show_bug.cgi?id=77743 + + Reviewed by Gustavo Noronha Silva. + + Instead of resizing the guts of a WebView when it's not mapped, wait + until it's mapped and do one resize. This prevents unmapped WebViews + from adding to a container's resize cost. + + * UIProcess/API/gtk/WebKitWebViewBase.cpp: + (_WebKitWebViewBasePrivate): Added a new member needsResizeOnMap. + (resizeWebKitWebViewBaseFromAllocation): Abstracted out this helper. + (webkitWebViewBaseSizeAllocate): Wait until map to resize unmapped WebViews. + (webkitWebViewBaseMap): Added this vmethod implementation. + (webkit_web_view_base_class_init): Added vmethod. + +2012-02-06 Allan Sandfeld Jensen <allan.jensen@nokia.com> + + WebGestureEvent can not encode delta and area. + https://bugs.webkit.org/show_bug.cgi?id=77728 + + Support delta and area fields in WebGestureEvent, and send area with Qt tap gesture. + + Reviewed by Kenneth Rohde Christiansen. + + * Shared/WebEvent.h: + (WebKit::WebGestureEvent::area): + (WebKit::WebGestureEvent::delta): + * Shared/WebEventConversion.cpp: + (WebKit::WebKit2PlatformGestureEvent::WebKit2PlatformGestureEvent): + * Shared/WebGestureEvent.cpp: + (WebKit::WebGestureEvent::WebGestureEvent): + (WebKit::WebGestureEvent::encode): + (WebKit::WebGestureEvent::decode): + * UIProcess/qt/QtWebPageEventHandler.cpp: + (QtWebPageEventHandler::handleSingleTapEvent): + +2012-02-03 Zalan Bujtas <zbujtas@gmail.com> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt][WK2] Remove TiledDrawingArea and dependencies. + https://bugs.webkit.org/show_bug.cgi?id=71681 + + Reviewed by Kenneth Rohde Christiansen. + + Tiled drawing surface functionality got converted to LayerTree. + TiledDrawingArea and its dependencies are not used by any port anymore. + + * CMakeLists.txt: + * GNUmakefile.am: + * Shared/DrawingAreaInfo.h: + * Target.pri: + * UIProcess/API/qt/qquickwebpage.cpp: + (QQuickWebPagePrivate::QQuickWebPagePrivate): + * UIProcess/API/qt/qquickwebpage_p.h: + * UIProcess/API/qt/qquickwebpage_p_p.h: + (QQuickWebPagePrivate): + * UIProcess/DrawingAreaProxy.h: + * UIProcess/DrawingAreaProxy.messages.in: + * UIProcess/TiledDrawingAreaProxy.cpp: Removed. + * UIProcess/TiledDrawingAreaProxy.h: Removed. + * UIProcess/qt/QtSGTileNode.cpp: Removed. + * UIProcess/qt/QtSGTileNode.h: Removed. + * UIProcess/qt/QtSGUpdateQueue.cpp: Removed. + * UIProcess/qt/QtSGUpdateQueue.h: Removed. + * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: Removed. + * WebProcess/WebPage/DrawingArea.cpp: + (WebKit::DrawingArea::create): + * WebProcess/WebPage/DrawingArea.h: + * WebProcess/WebPage/DrawingArea.messages.in: + * WebProcess/WebPage/TiledDrawingArea.cpp: Removed. + * WebProcess/WebPage/TiledDrawingArea.h: Removed. + * WebProcess/WebPage/WebPage.h: + (WebPage): + +2012-02-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Don't version QtWebKit.experimental. + https://bugs.webkit.org/show_bug.cgi?id=77739 + + Reviewed by Tor Arne Vestbø. + + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml: + * UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml: + +2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> + + [GTK] Fix several gtkdoc-fixxref warnings + https://bugs.webkit.org/show_bug.cgi?id=77613 + + Reviewed by Martin Robinson. + + * UIProcess/API/gtk/WebKitWindowProperties.cpp: Fix a typo, a + colon was missing in WebKitWebView::ready-to-show. + +2012-02-05 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10809525> WebKit2’s WebFrameLoaderClient::shouldUseCredentialStorage() always returns true + https://bugs.webkit.org/show_bug.cgi?id=77823 + + Reviewed by Anders Carlsson. + + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp: + (WebKit::InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage): Added. Calls + through to the client if it implements shouldUseCredentialStorage. Returns true otherwise. + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::shouldUseCredentialStorage): Changed to call the injected + bundle resource load client. + +2012-02-04 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10660698> Clients cannot prevent caching of individual responses + https://bugs.webkit.org/show_bug.cgi?id=77822 + + Reviewed by Sam Weinig. + + * Shared/APIClientTraits.cpp: Added definition of interfaceSizesByVersion for + WKBundlePageResourceLoadClient. + * Shared/APIClientTraits.h: Added APIClientTraits specialization for WKBundlePageResourceLoadClient. + * WebProcess/InjectedBundle/API/c/WKBundlePage.h: Added WKBundlePageShouldCacheResponseCallback + typedef, added shouldCacheResponse member to WKBundlePageResourceLoadClient, and bumped + kWKBundlePageResourceLoadClientCurrentVersion to 1. + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp: + (WebKit::InjectedBundlePageResourceLoadClient::shouldCacheResponse): Added. Calls through + to the client if it implements shouldCacheResponse. Returns true otherwise. + * WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h: + * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: + (WebKit::WebFrameLoaderClient::willCacheResponse): Changed to call + InjectedBundlePageResourceLoadClient::shouldCacheResponse() and return nil if the former + returns false. + (WebKit::WebFrameLoaderClient::shouldCacheResponse): Changed to call + InjectedBundlePageResourceLoadClient::shouldCacheResponse(). + +2012-02-04 Sam Weinig <sam@webkit.org> + + Add ability to send WKURLRequests in WebKit2 API user messages + https://bugs.webkit.org/show_bug.cgi?id=77819 + + Reviewed by Anders Carlsson. + + Test: WebKit2UserMessageRoundTripTest API test. + + * Shared/UserMessageCoders.h: + (WebKit::UserMessageEncoder::baseEncode): + (WebKit::UserMessageDecoder::baseDecode): + Add encode/decode for WebURLRequest. + +2012-02-04 Dan Bernstein <mitz@apple.com> + + <rdar://problem/10772406> WKPreferences instances cannot be copied + https://bugs.webkit.org/show_bug.cgi?id=77816 + + Reviewed by Sam Weinig. + + Test added in TestWebKitAPI/Tests/WebKit2/WKPreferences.cpp. + + * UIProcess/API/C/WKPreferences.cpp: + (WKPreferencesCreateCopy): Added. + * UIProcess/API/C/WKPreferencesPrivate.h: + * UIProcess/WebPreferences.cpp: + (WebKit::WebPreferences::WebPreferences): Added this constructor that copies the + WebPreferencesStore of the given WebPreferences. + * UIProcess/WebPreferences.h: + (WebKit::WebPreferences::create): Added this create function that takes a WebPreferences + instance and creates a new instance with a copy of the given instance’s store. + +2012-02-03 Anders Carlsson <andersca@apple.com> + + WebKit2 should dispatch wheel events to the new ScrollingTree class + https://bugs.webkit.org/show_bug.cgi?id=77795 + + Reviewed by Andreas Kling. + + Replace all uses of ScrollingCoordinator with ScrollingTree instead. + Also, don't try to handle gesture events on the scrolling thread anymore; + we don't need to to that right now. + + * WebProcess/WebPage/EventDispatcher.cpp: + (WebKit::EventDispatcher::addScrollingTreeForPage): + (WebKit::EventDispatcher::removeScrollingTreeForPage): + (WebKit::EventDispatcher::wheelEvent): + (WebKit::EventDispatcher::gestureEvent): + * WebProcess/WebPage/EventDispatcher.h: + (WebCore): + (EventDispatcher): + * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm: + (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea): + (WebKit::TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea): + +2012-02-03 Alexey Proskuryakov <ap@apple.com> + + [WK2 Mac] No need to allow access to input methods or keyboard layouts + https://bugs.webkit.org/show_bug.cgi?id=77775 + <rdar://problem/9276253> + <rdar://problem/9276268> + + Reviewed by Dan Bernstein. + + * WebProcess/com.apple.WebProcess.sb: These rules were likely only necessary in early days + of WebKit2. If there are cases when this happens, that's likely wrong, and we need to know + about that. + +2012-02-03 Alexey Proskuryakov <ap@apple.com> + + [WK2] Use properly quoted string literals + https://bugs.webkit.org/show_bug.cgi?id=77583 + + Reviewed by Darin Adler. + + Also added some FIXMEs. + + * WebProcess/com.apple.WebProcess.sb: + +2012-02-03 Brady Eidson <beidson@apple.com> + + <rdar://problem/10742441> and https://bugs.webkit.org/show_bug.cgi?id=77766 + Need a WK2 API to filter which subframes go into WebArchives as they are created. + + Reviewed by Darin Adler. + + Add a new WKBundleFrame API that takes a filter callback object to allow or reject + subframes from a WebArchive: + * WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp: + (WKBundleFrameCopyWebArchive): + (WKBundleFrameCopyWebArchiveFilteringSubframes): + * WebProcess/InjectedBundle/API/c/WKBundleFrame.h: + + Implement the above API by calling through to WebCore: + * WebProcess/WebPage/WebFrame.cpp: + (WebFrameFilter): + (WebKit::WebFrameFilter::WebFrameFilter): + (WebKit::WebFrameFilter::shouldIncludeSubframe): + (WebKit::WebFrame::webArchiveData): + * WebProcess/WebPage/WebFrame.h: + (WebFrame): + + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::getWebArchiveOfFrame): + +2012-02-03 Alexey Proskuryakov <ap@apple.com> + + [Mac WK2] Use a minimally invasive way to fake plug-in process name + https://bugs.webkit.org/show_bug.cgi?id=77682 + + Reviewed by Darin Adler. + + * PluginProcess/PluginProcess.cpp: (WebKit::PluginProcess::netscapePluginModule): + Only change the name as it's seen from within the process. + + * Shared/Plugins/PluginQuirks.h: Fixed a typo. + +2012-02-03 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=77691 + Fix PlatformScreen layering violation and PlatformScreenMac's incorrect use + of device scale + + Reviewed by Andy Estes. + + toUserSpace() and toDeviceSpace() don't need to take device scale. + * UIProcess/API/mac/WKView.mm: + (-[WKView _convertToDeviceSpace:]): + (-[WKView _convertToUserSpace:]): + +2012-02-03 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Use TextureMapper::create instead of creating TextureMapperGL/TextureMapperQt directly. + Remove calls to unused API. + + * UIProcess/qt/LayerTreeHostProxyQt.cpp: + (WebKit::LayerTreeHostProxy::paintToCurrentGLContext): + (WebKit::LayerTreeHostProxy::paintToGraphicsContext): + (WebKit::LayerTreeHostProxy::createImage): + (WebKit::LayerTreeHostProxy::ensureRootLayer): + +2012-02-03 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Split QQuickWebViewPrivate in two classes, for desktop and touch behavior. + https://bugs.webkit.org/show_bug.cgi?id=77632 + + Reviewed by Kenneth Rohde Christiansen. + + Replace the runtime property setting the desktop behavior on each instance + by a static boolean controlling the behavior used by future created WebViews. + + * UIProcess/API/qt/qquickwebpage.cpp: + Let only setContentsSize control the size of the drawing area instead of deferring + it until geometryChanged is called. + (QQuickWebPagePrivate::QQuickWebPagePrivate): + * UIProcess/API/qt/qquickwebpage_p.h: + * UIProcess/API/qt/qquickwebpage_p_p.h: + (QQuickWebPagePrivate): + * UIProcess/API/qt/qquickwebview.cpp: + (createPrivateObject): + (QQuickWebViewPrivate::QQuickWebViewPrivate): + (QQuickWebViewPrivate::~QQuickWebViewPrivate): + (QQuickWebViewPrivate::initialize): + (QQuickWebViewPrivate::processDidCrash): + (QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate): + (QQuickWebViewLegacyPrivate::initialize): + (QQuickWebViewLegacyPrivate::updateViewportSize): + (QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate): + (QQuickWebViewFlickablePrivate::~QQuickWebViewFlickablePrivate): + (QQuickWebViewFlickablePrivate::initialize): + (QQuickWebViewFlickablePrivate::loadDidCommit): + (QQuickWebViewFlickablePrivate::didFinishFirstNonEmptyLayout): + (QQuickWebViewFlickablePrivate::didChangeViewportProperties): + (QQuickWebViewFlickablePrivate::updateViewportSize): + (QQuickWebViewFlickablePrivate::_q_updateVisibleContentRectAndScale): + (QQuickWebViewFlickablePrivate::_q_suspend): + (QQuickWebViewFlickablePrivate::_q_resume): + (QQuickWebViewFlickablePrivate::pageDidRequestScroll): + (QQuickWebViewFlickablePrivate::didChangeContentsSize): + (QQuickWebViewFlickablePrivate::computeViewportConstraints): + (QQuickWebViewFlickablePrivate::PostTransitionState::apply): + (QQuickWebViewExperimental::setFlickableViewportEnabled): + The switch is now a static function that has to be called before a WebView + is created. The switch can have it's default defined by the deploying platform. + (QQuickWebViewExperimental::flickableViewportEnabled): + (QQuickWebView::QQuickWebView): + On creation of QQuickWebView, the static boolean is read to know if we want + a QQuickWebViewTouchPrivate or a QQuickWebViewDesktopPrivate. + (QQuickWebView::geometryChanged): + * UIProcess/API/qt/qquickwebview_p.h: + * UIProcess/API/qt/qquickwebview_p_p.h: + (QQuickWebViewPrivate): + (QQuickWebViewPrivate::loadDidCommit): + (QQuickWebViewPrivate::didFinishFirstNonEmptyLayout): + (QQuickWebViewPrivate::didChangeViewportProperties): + (QQuickWebViewPrivate::viewportInteractionEngine): + (QQuickWebViewPrivate::updateViewportSize): + (QQuickWebViewPrivate::_q_updateVisibleContentRectAndScale): + (QQuickWebViewPrivate::_q_suspend): + (QQuickWebViewPrivate::_q_resume): + (QQuickWebViewPrivate::pageDidRequestScroll): + (QQuickWebViewPrivate::didChangeContentsSize): + (QQuickWebViewLegacyPrivate): + (QQuickWebViewFlickablePrivate): + (QQuickWebViewFlickablePrivate::viewportInteractionEngine): + (PostTransitionState): + (QQuickWebViewFlickablePrivate::PostTransitionState::PostTransitionState): + * UIProcess/API/qt/qwebviewportinfo.cpp: + (QWebViewportInfo::currentScale): + (QWebViewportInfo::devicePixelRatio): + (QWebViewportInfo::initialScale): + (QWebViewportInfo::minimumScale): + (QWebViewportInfo::maximumScale): + (QWebViewportInfo::isScalable): + (QWebViewportInfo::layoutSize): + * UIProcess/API/qt/tests/publicapi/publicapi.pro: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro: Added. + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/DesktopWebView.qml: Removed. + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml: Renamed + from Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml. + Moved to DesktopBehavior instead of using a DesktopWebView to workaround the touch event limitation. + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml: + * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml: + * UIProcess/API/qt/tests/qmltests/WebView.pro: Copied + from Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro. + * UIProcess/API/qt/tests/qmltests/qmltests.pro: + Split qmltests in two executables, tst_qmltests_DesktopBehavior and tst_qmltests_WebView. + The former runs without setFlickableViewportEnabled and the later does. + * UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp: + (main): + * UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro: + * UIProcess/API/qt/tests/tests.pri: + * UIProcess/qt/QtWebPageEventHandler.cpp: + (QtWebPageEventHandler::QtWebPageEventHandler): + +2012-02-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + [Qt] Rename content* to contents* in QQuickWebPage. + https://bugs.webkit.org/show_bug.cgi?id=77629 + + Reviewed by Kenneth Rohde Christiansen. + + * UIProcess/API/qt/qquickwebpage.cpp: + (QQuickWebPagePrivate::QQuickWebPagePrivate): + (QQuickWebPagePrivate::paintToCurrentGLContext): + (QQuickWebPage::setContentsSize): + (QQuickWebPage::contentsSize): + (QQuickWebPage::setContentsScale): + (QQuickWebPage::contentsScale): + (QQuickWebPage::transformToItem): + (QQuickWebPagePrivate::updateSize): + * UIProcess/API/qt/qquickwebpage_p.h: + * UIProcess/API/qt/qquickwebpage_p_p.h: + (QQuickWebPagePrivate): + * UIProcess/API/qt/qquickwebview.cpp: + (QQuickWebViewPrivate::didChangeContentsSize): + (QQuickWebViewPrivate::updateVisibleContentRectAndScale): + (QQuickWebViewPrivate::PostTransitionState::apply): + * UIProcess/API/qt/qwebviewportinfo.cpp: + (QWebViewportInfo::contentsSize): + * UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp: + (tst_QQuickWebView::scrollRequest): + * UIProcess/qt/QtViewportInteractionEngine.cpp: + (WebKit::QtViewportInteractionEngine::setItemRectVisible): + (WebKit::QtViewportInteractionEngine::event): + (WebKit::QtViewportInteractionEngine::wheelEvent): + (WebKit::QtViewportInteractionEngine::pagePositionRequest): + (WebKit::QtViewportInteractionEngine::computePosRangeForItemAtScale): + (WebKit::QtViewportInteractionEngine::applyConstraints): + (WebKit::QtViewportInteractionEngine::currentCSSScale): + (WebKit::QtViewportInteractionEngine::pinchGestureStarted): + (WebKit::QtViewportInteractionEngine::scaleContent): + +2012-02-03 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Fix build when cross-compiling + https://bugs.webkit.org/show_bug.cgi?id=77634 + + Reviewed by Tor Arne Vestbø. + + * WebKit2.pri: Link in -lrt on linux mkspecs, regardless of whether gcc + is in use or not. More specifically this fixes the case where the makespace + is not linux-g++* but for a cross-compiling one like linux-arm-gnueabi-g++. + +2012-02-03 Shinya Kawanaka <shinyak@google.com> + + Stop calling Element::ensureShadowRoot in Internals. + https://bugs.webkit.org/show_bug.cgi?id=77612 + + Reviewed by Hajime Morita. + + Exports symbols. + + * win/WebKit2.def: + * win/WebKit2CFLite.def: + +2012-02-02 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r106620. + http://trac.webkit.org/changeset/106620 + https://bugs.webkit.org/show_bug.cgi?id=77716 + + It broke non ENABLE(3D_RENDERING) builds (Requested by + Ossy_morning on #webkit). + + * UIProcess/qt/LayerTreeHostProxyQt.cpp: + (WebKit::LayerTreeHostProxy::paintToCurrentGLContext): + (WebKit::LayerTreeHostProxy::paintToGraphicsContext): + (WebKit::LayerTreeHostProxy::createImage): + (WebKit::LayerTreeHostProxy::ensureRootLayer): + +2012-02-02 No'am Rosenthal <noam.rosenthal@nokia.com> + + [Qt][Texmap] Refactor TextureMapper API to use ImageBuffers when possible. + https://bugs.webkit.org/show_bug.cgi?id=77148 + + Reviewed by Martin Robinson. + + Use TextureMapper::create instead of creating TextureMapperGL/TextureMapperQt directly. + Remove calls to unused API. + + * UIProcess/qt/LayerTreeHostProxyQt.cpp: + (WebKit::LayerTreeHostProxy::paintToCurrentGLContext): + (WebKit::LayerTreeHostProxy::paintToGraphicsContext): + (WebKit::LayerTreeHostProxy::createImage): + (WebKit::LayerTreeHostProxy::ensureRootLayer): + +2012-02-02 Jon Lee <jonlee@apple.com> + + Clear shown notifications when context is no longer active + https://bugs.webkit.org/show_bug.cgi?id=77363 + <rdar://problem/10568907> + + Reviewed by Darin Adler. + + * WebProcess/WebCoreSupport/WebNotificationClient.cpp: + (WebKit::WebNotificationClient::clearNotifications): Forward the call to + WebNotificationManager. + * WebProcess/WebCoreSupport/WebNotificationClient.h: + (WebNotificationClient): + + * WebProcess/Notifications/WebNotificationManager.h: Add an additional map that maps + all notifications associated with a given ScriptExecutionContext instance. + * WebProcess/Notifications/WebNotificationManager.cpp: + (WebKit::WebNotificationManager::show): Create a map entry for the notification's + context if it doesn't exist already, and note that notification's ID. Also, correct + the return value of show() if notifications are not enabled, to return false. + (WebKit::WebNotificationManager::didCloseNotifications): When the notification is closed, + we remove that notification from the map. + (WebKit::WebNotificationManager::clearNotifications): Use the map entry for the given + context, and pass that along to the proxy so that all of the notifications with those IDs + can be cleared. In the meantime, we remove that context's map entry. + + * UIProcess/Notifications/WebNotificationManagerProxy.messages.in: New ClearNotifications() + message. + * UIProcess/Notifications/WebNotificationManagerProxy.h: + * UIProcess/Notifications/WebNotificationManagerProxy.cpp: + (WebKit::WebNotificationManagerProxy::clearNotifications): Forward the call to the provider. + Then remove this proxy's entries for the given notification IDs. + + * UIProcess/Notifications/WebNotificationProvider.cpp: + (WebKit::WebNotificationProvider::clearNotifications): Convert the vector of IDs to a mutable + array. + * UIProcess/Notifications/WebNotificationProvider.h: + (WebNotificationProvider): + + * UIProcess/API/C/WKNotificationProvider.h: Add WK API to tell the platform to clear the notifications. + + Remove the #if guard since they already exist in WebNotificationManager functions: + * WebProcess/WebCoreSupport/WebNotificationClient.cpp: + (WebKit::WebNotificationClient::show): + (WebKit::WebNotificationClient::cancel): + (WebKit::WebNotificationClient::notificationObjectDestroyed): + +2012-02-02 Anders Carlsson <andersca@apple.com> + + NPAPI will not send mouse up events when mouse is outside plugin area + https://bugs.webkit.org/show_bug.cgi?id=77657 + <rdar://problem/10160674> + + Reviewed by Andreas Kling. + + Use EventHandler::setCapturingMouseEventsNode to ensure we get all the mouse events when the mouse is down. + + * WebProcess/Plugins/PluginView.cpp: + (WebKit::PluginView::handleEvent): + 2012-02-02 Claudio Saavedra <csaavedra@igalia.com> and Martin Robinson <mrobinson@igalia.com> [GTK] WebKitWebView won't work in a GtkOffscreenWindow diff --git a/Source/WebKit2/Configurations/FeatureDefines.xcconfig b/Source/WebKit2/Configurations/FeatureDefines.xcconfig index 9be349394..f5bc9cf39 100644 --- a/Source/WebKit2/Configurations/FeatureDefines.xcconfig +++ b/Source/WebKit2/Configurations/FeatureDefines.xcconfig @@ -37,6 +37,8 @@ ENABLE_BLOB_macosx = ENABLE_BLOB; ENABLE_CLIENT_BASED_GEOLOCATION = $(ENABLE_CLIENT_BASED_GEOLOCATION_$(REAL_PLATFORM_NAME)); ENABLE_CLIENT_BASED_GEOLOCATION_macosx = ENABLE_CLIENT_BASED_GEOLOCATION; +ENABLE_DASHBOARD_SUPPORT = ENABLE_DASHBOARD_SUPPORT; + ENABLE_DATALIST = $(ENABLE_DATALIST_$(REAL_PLATFORM_NAME)); ENABLE_DATALIST_macosx = ENABLE_DATALIST; @@ -123,4 +125,4 @@ ENABLE_WEB_TIMING = ; ENABLE_WORKERS = ENABLE_WORKERS; ENABLE_XSLT = ENABLE_XSLT; -FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); +FEATURE_DEFINES = $(ENABLE_3D_RENDERING) $(ENABLE_ACCELERATED_2D_CANVAS) $(ENABLE_ANIMATION_API) $(ENABLE_BLOB) $(ENABLE_CHANNEL_MESSAGING) $(ENABLE_CLIENT_BASED_GEOLOCATION) $(ENABLE_CSS_FILTERS) $(ENABLE_CSS_GRID_LAYOUT) $(ENABLE_CSS_SHADERS) $(ENABLE_DASHBOARD_SUPPORT) $(ENABLE_DATALIST) $(ENABLE_DATA_TRANSFER_ITEMS) $(ENABLE_DETAILS) $(ENABLE_DEVICE_ORIENTATION) $(ENABLE_DIRECTORY_UPLOAD) $(ENABLE_FILE_SYSTEM) $(ENABLE_FILTERS) $(ENABLE_FULLSCREEN_API) $(ENABLE_GAMEPAD) $(ENABLE_GEOLOCATION) $(ENABLE_ICONDATABASE) $(ENABLE_INDEXED_DATABASE) $(ENABLE_INPUT_COLOR) $(ENABLE_INPUT_SPEECH) $(ENABLE_INPUT_TYPE_DATE) $(ENABLE_INPUT_TYPE_DATETIME) $(ENABLE_INPUT_TYPE_DATETIMELOCAL) $(ENABLE_INPUT_TYPE_MONTH) $(ENABLE_INPUT_TYPE_TIME) $(ENABLE_INPUT_TYPE_WEEK) $(ENABLE_JAVASCRIPT_DEBUGGER) $(ENABLE_LINK_PREFETCH) $(ENABLE_MATHML) $(ENABLE_MEDIA_SOURCE) $(ENABLE_MEDIA_STATISTICS) $(ENABLE_METER_TAG) $(ENABLE_MUTATION_OBSERVERS) $(ENABLE_NOTIFICATIONS) $(ENABLE_PAGE_VISIBILITY_API) $(ENABLE_PROGRESS_TAG) $(ENABLE_QUOTA) $(ENABLE_REGISTER_PROTOCOL_HANDLER) $(ENABLE_REQUEST_ANIMATION_FRAME) $(ENABLE_SHADOW_DOM) $(ENABLE_SHARED_WORKERS) $(ENABLE_SQL_DATABASE) $(ENABLE_STYLE_SCOPED) $(ENABLE_SVG) $(ENABLE_SVG_DOM_OBJC_BINDINGS) $(ENABLE_SVG_FONTS) $(ENABLE_TEXT_NOTIFICATIONS_ONLY) $(ENABLE_TOUCH_ICON_LOADING) $(ENABLE_VIDEO) $(ENABLE_VIDEO_TRACK) $(ENABLE_WEBGL) $(ENABLE_WEB_AUDIO) $(ENABLE_WEB_SOCKETS) $(ENABLE_WEB_TIMING) $(ENABLE_WORKERS) $(ENABLE_XSLT); diff --git a/Source/WebKit2/Configurations/Version.xcconfig b/Source/WebKit2/Configurations/Version.xcconfig index 1b5b0ad13..c7089df71 100644 --- a/Source/WebKit2/Configurations/Version.xcconfig +++ b/Source/WebKit2/Configurations/Version.xcconfig @@ -22,7 +22,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. MAJOR_VERSION = 535; -MINOR_VERSION = 19; +MINOR_VERSION = 20; TINY_VERSION = 0; FULL_VERSION = $(MAJOR_VERSION).$(MINOR_VERSION); diff --git a/Source/WebKit2/GNUmakefile.am b/Source/WebKit2/GNUmakefile.am index 1cf1a2d90..2b36ed3db 100644 --- a/Source/WebKit2/GNUmakefile.am +++ b/Source/WebKit2/GNUmakefile.am @@ -78,15 +78,19 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_HEA $(WebKit2)/UIProcess/API/cpp/WKRetainPtr.h libwebkit2gtkincludedir = $(libwebkitgtkincludedir)/webkit2 +nodist_libwebkit2gtkinclude_HEADERS = \ + DerivedSources/WebKit2/webkit2gtk/webkit2/WebKitEnumTypes.h + libwebkit2gtkinclude_HEADERS = \ - DerivedSources/WebKit2/webkit2gtk/webkit2/WebKitEnumTypes.h \ $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardList.h \ $(WebKit2)/UIProcess/API/gtk/WebKitBackForwardListItem.h \ $(WebKit2)/UIProcess/API/gtk/WebKitDefines.h \ $(WebKit2)/UIProcess/API/gtk/WebKitDownload.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitEditingCommands.h \ $(WebKit2)/UIProcess/API/gtk/WebKitError.h \ $(WebKit2)/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \ $(WebKit2)/UIProcess/API/gtk/WebKitPolicyDecision.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \ $(WebKit2)/UIProcess/API/gtk/WebKitSettings.h \ $(WebKit2)/UIProcess/API/gtk/WebKitURIRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitURIResponse.h \ @@ -107,6 +111,8 @@ webkit2_built_sources += \ DerivedSources/WebKit2/DrawingAreaProxyMessages.h \ DerivedSources/WebKit2/EventDispatcherMessageReceiver.cpp \ DerivedSources/WebKit2/EventDispatcherMessages.h \ + DerivedSources/WebKit2/LayerTreeHostProxyMessageReceiver.cpp \ + DerivedSources/WebKit2/LayerTreeHostProxyMessages.h \ DerivedSources/WebKit2/NPObjectMessageReceiverMessageReceiver.cpp \ DerivedSources/WebKit2/NPObjectMessageReceiverMessages.h \ DerivedSources/WebKit2/PluginControllerProxyMessageReceiver.cpp \ @@ -530,6 +536,7 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU Source/WebKit2/UIProcess/API/gtk/WebKitDownloadPrivate.h \ Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitDownloadClient.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h \ Source/WebKit2/UIProcess/API/gtk/WebKitError.h \ Source/WebKit2/UIProcess/API/gtk/WebKitError.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.h \ @@ -543,6 +550,9 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.h \ Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h \ Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h \ Source/WebKit2/UIProcess/API/gtk/WebKitSettingsPrivate.h \ @@ -635,8 +645,6 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU Source/WebKit2/UIProcess/ResponsivenessTimer.cpp \ Source/WebKit2/UIProcess/ResponsivenessTimer.h \ Source/WebKit2/UIProcess/TextChecker.h \ - Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp \ - Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h \ Source/WebKit2/UIProcess/VisitedLinkProvider.cpp \ Source/WebKit2/UIProcess/VisitedLinkProvider.h \ Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.h \ @@ -921,8 +929,6 @@ libwebkit2gtk_@WEBKITGTK_API_MAJOR_VERSION@_@WEBKITGTK_API_MINOR_VERSION@_la_SOU Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h \ Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp \ Source/WebKit2/WebProcess/WebPage/PageOverlay.h \ - Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp \ - Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h \ Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp \ Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h \ Source/WebKit2/WebProcess/WebPage/WebContextMenu.cpp \ diff --git a/Source/WebKit2/Platform/Module.h b/Source/WebKit2/Platform/Module.h index 736718a8b..41c2c7180 100644 --- a/Source/WebKit2/Platform/Module.h +++ b/Source/WebKit2/Platform/Module.h @@ -41,6 +41,10 @@ typedef struct _GModule GModule; #endif +#if PLATFORM(EFL) +#include <Eina.h> +#endif + namespace WebKit { class Module { @@ -79,6 +83,8 @@ private: QLibrary m_lib; #elif PLATFORM(GTK) GModule* m_handle; +#elif PLATFORM(EFL) + OwnPtr<Eina_Module> m_module; #endif }; diff --git a/Source/WebKit2/Platform/efl/ModuleEfl.cpp b/Source/WebKit2/Platform/efl/ModuleEfl.cpp new file mode 100644 index 000000000..f40b13b10 --- /dev/null +++ b/Source/WebKit2/Platform/efl/ModuleEfl.cpp @@ -0,0 +1,53 @@ +/* + Copyright (C) 2012 Samsung Electronics + + 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 "Module.h" + +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> +#include <wtf/text/CString.h> + +namespace WebKit { + +bool Module::load() +{ + m_module = adoptPtr(eina_module_new(m_path.utf8().data())); + if (!m_module || !eina_module_load(m_module.get())) { + m_module = nullptr; + return false; + } + + return true; +} + +void Module::unload() +{ + m_module = nullptr; +} + +void* Module::platformFunctionPointer(const char* functionName) const +{ + if (m_module) + return eina_module_symbol_get(m_module.get(), functionName); + + return 0; +} + +} diff --git a/Source/WebKit2/PlatformEfl.cmake b/Source/WebKit2/PlatformEfl.cmake index 1591dfbbc..ef5f3953d 100644 --- a/Source/WebKit2/PlatformEfl.cmake +++ b/Source/WebKit2/PlatformEfl.cmake @@ -45,6 +45,7 @@ LIST(APPEND WebKit2_SOURCES UIProcess/Plugins/efl/PluginProcessProxyEfl.cpp WebProcess/Downloads/efl/DownloadEfl.cpp + WebProcess/Downloads/efl/FileDownloaderEfl.cpp WebProcess/efl/WebProcessEfl.cpp WebProcess/efl/WebProcessMainEfl.cpp @@ -65,6 +66,7 @@ LIST(APPEND WebKit2_INCLUDE_DIRECTORIES "${WEBCORE_DIR}/platform/graphics/cairo" "${WEBKIT2_DIR}/Shared/efl" "${WEBKIT2_DIR}/UIProcess/API/efl/" + "${WEBKIT2_DIR}/WebProcess/Downloads/efl" "${WEBKIT2_DIR}/WebProcess/efl" "${WEBKIT2_DIR}/WebProcess/WebCoreSupport/efl" ${Cairo_INCLUDE_DIRS} diff --git a/Source/WebKit2/PluginProcess/PluginProcess.cpp b/Source/WebKit2/PluginProcess/PluginProcess.cpp index 099bf3a48..bb1b3b839 100644 --- a/Source/WebKit2/PluginProcess/PluginProcess.cpp +++ b/Source/WebKit2/PluginProcess/PluginProcess.cpp @@ -38,6 +38,10 @@ #include <WebCore/NotImplemented.h> #include <WebCore/RunLoop.h> +#if PLATFORM(MAC) +#include <crt_externs.h> +#endif + #if USE(UNIX_DOMAIN_SOCKETS) #include <errno.h> #include <fcntl.h> @@ -115,7 +119,7 @@ NetscapePluginModule* PluginProcess::netscapePluginModule() #if PLATFORM(MAC) if (m_pluginModule) { if (m_pluginModule->pluginQuirks().contains(PluginQuirks::PrognameShouldBeWebKitPluginHost)) - setprogname("WebKitPluginHost"); + *const_cast<const char**>(_NSGetProgname()) = "WebKitPluginHost"; } #endif } diff --git a/Source/WebKit2/Shared/APIClientTraits.cpp b/Source/WebKit2/Shared/APIClientTraits.cpp index 4f668f7fc..4c50bd273 100644 --- a/Source/WebKit2/Shared/APIClientTraits.cpp +++ b/Source/WebKit2/Shared/APIClientTraits.cpp @@ -35,6 +35,11 @@ const size_t APIClientTraits<WKBundlePageLoaderClient>::interfaceSizesByVersion[ sizeof(WKBundlePageLoaderClient) }; +const size_t APIClientTraits<WKBundlePageResourceLoadClient>::interfaceSizesByVersion[] = { + offsetof(WKBundlePageResourceLoadClient, shouldCacheResponse), + sizeof(WKBundlePageResourceLoadClient) +}; + const size_t APIClientTraits<WKPageContextMenuClient>::interfaceSizesByVersion[] = { offsetof(WKPageContextMenuClient, contextMenuDismissed), sizeof(WKPageContextMenuClient) diff --git a/Source/WebKit2/Shared/APIClientTraits.h b/Source/WebKit2/Shared/APIClientTraits.h index 4330d5d07..27c81e4db 100644 --- a/Source/WebKit2/Shared/APIClientTraits.h +++ b/Source/WebKit2/Shared/APIClientTraits.h @@ -31,14 +31,16 @@ namespace WebKit { -template <typename ClientInterface> struct APIClientTraits -{ +template <typename ClientInterface> struct APIClientTraits { static const size_t interfaceSizesByVersion[1]; }; template <typename ClientInterface> const size_t APIClientTraits<ClientInterface>::interfaceSizesByVersion[] = { sizeof(ClientInterface) }; -template<> struct APIClientTraits<WKBundlePageLoaderClient> -{ +template<> struct APIClientTraits<WKBundlePageLoaderClient> { + static const size_t interfaceSizesByVersion[2]; +}; + +template<> struct APIClientTraits<WKBundlePageResourceLoadClient> { static const size_t interfaceSizesByVersion[2]; }; @@ -50,8 +52,7 @@ template<> struct APIClientTraits<WKPageLoaderClient> { static const size_t interfaceSizesByVersion[2]; }; -template<> struct APIClientTraits<WKPageUIClient> -{ +template<> struct APIClientTraits<WKPageUIClient> { static const size_t interfaceSizesByVersion[2]; }; diff --git a/Source/WebKit2/Shared/DrawingAreaInfo.h b/Source/WebKit2/Shared/DrawingAreaInfo.h index b38b714ea..33c4993e6 100644 --- a/Source/WebKit2/Shared/DrawingAreaInfo.h +++ b/Source/WebKit2/Shared/DrawingAreaInfo.h @@ -30,9 +30,6 @@ namespace WebKit { enum DrawingAreaType { DrawingAreaTypeImpl, -#if USE(TILED_BACKING_STORE) - DrawingAreaTypeTiled, -#endif #if PLATFORM(MAC) DrawingAreaTypeTiledCoreAnimation, #endif diff --git a/Source/WebKit2/Shared/Plugins/PluginQuirks.h b/Source/WebKit2/Shared/Plugins/PluginQuirks.h index 0b89d3f23..049664ae0 100644 --- a/Source/WebKit2/Shared/Plugins/PluginQuirks.h +++ b/Source/WebKit2/Shared/Plugins/PluginQuirks.h @@ -33,7 +33,7 @@ public: enum PluginQuirk { // Mac specific quirks: #if PLUGIN_ARCHITECTURE(MAC) - // The plug-in wants the call to getprogame() to return "WebKitPluginHost". + // The plug-in wants the call to getprogname() to return "WebKitPluginHost". // Adobe Flash Will not handle key down events otherwise. PrognameShouldBeWebKitPluginHost, diff --git a/Source/WebKit2/Shared/UserMessageCoders.h b/Source/WebKit2/Shared/UserMessageCoders.h index e745c39bb..df3860805 100644 --- a/Source/WebKit2/Shared/UserMessageCoders.h +++ b/Source/WebKit2/Shared/UserMessageCoders.h @@ -41,6 +41,7 @@ #include "WebSerializedScriptValue.h" #include "WebString.h" #include "WebURL.h" +#include "WebURLRequest.h" #include "WebUserContentURLPattern.h" namespace WebKit { @@ -57,6 +58,7 @@ namespace WebKit { // - WebImage -> WebImage // - WebUInt64 -> WebUInt64 // - WebURL -> WebURL +// - WebURLRequest -> WebURLRequest template<typename Owner> class UserMessageEncoder { @@ -142,6 +144,11 @@ public: encoder->encode(urlObject->string()); return true; } + case APIObject::TypeURLRequest: { + WebURLRequest* urlRequestObject = static_cast<WebURLRequest*>(m_root); + encoder->encode(urlRequestObject->resourceRequest()); + return true; + } case APIObject::TypeUserContentURLPattern: { WebUserContentURLPattern* urlPattern = static_cast<WebUserContentURLPattern*>(m_root); encoder->encode(urlPattern->patternString()); @@ -203,6 +210,7 @@ protected: // - WebImage -> WebImage // - WebUInt64 -> WebUInt64 // - WebURL -> WebURL +// - WebURLRequest -> WebURLRequest template<typename Owner> class UserMessageDecoder { @@ -337,6 +345,13 @@ public: coder.m_root = WebURL::create(string); break; } + case APIObject::TypeURLRequest: { + WebCore::ResourceRequest request; + if (!decoder->decode(request)) + return false; + coder.m_root = WebURLRequest::create(request); + break; + } case APIObject::TypeUserContentURLPattern: { String string; if (!decoder->decode(string)) diff --git a/Source/WebKit2/Shared/WebEvent.h b/Source/WebKit2/Shared/WebEvent.h index 7ec01d499..2aabf280a 100644 --- a/Source/WebKit2/Shared/WebEvent.h +++ b/Source/WebKit2/Shared/WebEvent.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,8 +30,10 @@ // FIXME: We should probably move to makeing the WebCore/PlatformFooEvents trivial classes so that // we can use them as the event type. +#include <WebCore/FloatPoint.h> #include <WebCore/FloatSize.h> #include <WebCore/IntPoint.h> +#include <WebCore/IntSize.h> #include <wtf/text/WTFString.h> namespace CoreIPC { @@ -254,9 +257,12 @@ class WebGestureEvent : public WebEvent { public: WebGestureEvent() { } WebGestureEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, Modifiers, double timestamp); + WebGestureEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, Modifiers, double timestamp, const WebCore::IntSize& area, const WebCore::FloatPoint& delta); const WebCore::IntPoint position() const { return m_position; } const WebCore::IntPoint globalPosition() const { return m_globalPosition; } + const WebCore::IntSize area() const { return m_area; } + const WebCore::FloatPoint delta() const { return m_delta; } void encode(CoreIPC::ArgumentEncoder*) const; static bool decode(CoreIPC::ArgumentDecoder*, WebGestureEvent&); @@ -266,6 +272,8 @@ private: WebCore::IntPoint m_position; WebCore::IntPoint m_globalPosition; + WebCore::IntSize m_area; + WebCore::FloatPoint m_delta; }; #endif // ENABLE(GESTURE_EVENTS) @@ -284,16 +292,21 @@ public: TouchCancelled }; - WebPlatformTouchPoint() { } + WebPlatformTouchPoint() : m_rotationAngle(0.0), m_force(0.0) { } WebPlatformTouchPoint(uint32_t id, TouchPointState, const WebCore::IntPoint& screenPosition, const WebCore::IntPoint& position); + WebPlatformTouchPoint(uint32_t id, TouchPointState, const WebCore::IntPoint& screenPosition, const WebCore::IntPoint& position, const WebCore::IntSize& radius, float rotationAngle = 0.0, float force = 0.0); + uint32_t id() const { return m_id; } TouchPointState state() const { return static_cast<TouchPointState>(m_state); } const WebCore::IntPoint& screenPosition() const { return m_screenPosition; } const WebCore::IntPoint& position() const { return m_position; } - + const WebCore::IntSize& radius() const { return m_radius; } + float rotationAngle() const { return m_rotationAngle; } + float force() const { return m_force; } + void setState(TouchPointState state) { m_state = state; } void encode(CoreIPC::ArgumentEncoder*) const; @@ -304,7 +317,9 @@ private: uint32_t m_state; WebCore::IntPoint m_screenPosition; WebCore::IntPoint m_position; - + WebCore::IntSize m_radius; + float m_rotationAngle; + float m_force; }; // FIXME: Move this class to its own header file. diff --git a/Source/WebKit2/Shared/WebEventConversion.cpp b/Source/WebKit2/Shared/WebEventConversion.cpp index eb88dca8b..ed8569d1f 100644 --- a/Source/WebKit2/Shared/WebEventConversion.cpp +++ b/Source/WebKit2/Shared/WebEventConversion.cpp @@ -232,6 +232,10 @@ public: // PlatformGestureEvent m_position = webEvent.position(); m_globalPosition = webEvent.globalPosition(); + + m_area = webEvent.area(); + m_deltaX = webEvent.delta().x(); + m_deltaY = webEvent.delta().y(); } }; @@ -270,6 +274,10 @@ public: m_screenPos = webTouchPoint.screenPosition(); m_pos = webTouchPoint.position(); + m_radiusX = webTouchPoint.radius().width(); + m_radiusY = webTouchPoint.radius().height(); + m_force = webTouchPoint.force(); + m_rotationAngle = webTouchPoint.rotationAngle(); } }; diff --git a/Source/WebKit2/Shared/WebGestureEvent.cpp b/Source/WebKit2/Shared/WebGestureEvent.cpp index 821c1165b..d491a5707 100644 --- a/Source/WebKit2/Shared/WebGestureEvent.cpp +++ b/Source/WebKit2/Shared/WebGestureEvent.cpp @@ -43,12 +43,24 @@ WebGestureEvent::WebGestureEvent(Type type, const IntPoint& position, const IntP ASSERT(isGestureEventType(type)); } +WebGestureEvent::WebGestureEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, Modifiers modifiers, double timestamp, const IntSize& area, const FloatPoint& delta) + : WebEvent(type, modifiers, timestamp) + , m_position(position) + , m_globalPosition(globalPosition) + , m_area(area) + , m_delta(delta) +{ + ASSERT(isGestureEventType(type)); +} + void WebGestureEvent::encode(CoreIPC::ArgumentEncoder* encoder) const { WebEvent::encode(encoder); encoder->encode(m_position); encoder->encode(m_globalPosition); + encoder->encode(m_area); + encoder->encode(m_delta); } bool WebGestureEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebGestureEvent& t) @@ -59,6 +71,10 @@ bool WebGestureEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebGestureEvent& return false; if (!decoder->decode(t.m_globalPosition)) return false; + if (!decoder->decode(t.m_area)) + return false; + if (!decoder->decode(t.m_delta)) + return false; return true; } diff --git a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp index e23830f85..d86fc7aef 100644 --- a/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp +++ b/Source/WebKit2/Shared/WebPlatformTouchPoint.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,17 +41,30 @@ WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, , m_state(state) , m_screenPosition(screenPosition) , m_position(position) + , m_rotationAngle(0.0) + , m_force(0.0) +{ +} + +WebPlatformTouchPoint::WebPlatformTouchPoint(unsigned id, TouchPointState state, const IntPoint& screenPosition, const IntPoint& position, const WebCore::IntSize& radius, float rotationAngle, float force) + : m_id(id) + , m_state(state) + , m_screenPosition(screenPosition) + , m_position(position) + , m_radius(radius) + , m_rotationAngle(rotationAngle) + , m_force(force) { } void WebPlatformTouchPoint::encode(CoreIPC::ArgumentEncoder* encoder) const { - encoder->encode(CoreIPC::In(m_id, m_state, m_screenPosition, m_position)); + encoder->encode(CoreIPC::In(m_id, m_state, m_screenPosition, m_position, m_radius, m_rotationAngle, m_force)); } bool WebPlatformTouchPoint::decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t) { - return decoder->decode(CoreIPC::Out(t.m_id, t.m_state, t.m_screenPosition, t.m_position)); + return decoder->decode(CoreIPC::Out(t.m_id, t.m_state, t.m_screenPosition, t.m_position, t.m_radius, t.m_rotationAngle, t.m_force)); } } // namespace WebKit diff --git a/Source/WebKit2/Target.pri b/Source/WebKit2/Target.pri index 7bd4a72a0..4326a4a99 100644 --- a/Source/WebKit2/Target.pri +++ b/Source/WebKit2/Target.pri @@ -211,7 +211,6 @@ HEADERS += \ UIProcess/ProcessModel.h \ UIProcess/ResponsivenessTimer.h \ UIProcess/TextChecker.h \ - UIProcess/TiledDrawingAreaProxy.h \ UIProcess/VisitedLinkProvider.h \ UIProcess/WebApplicationCacheManagerProxy.h \ UIProcess/WebBackForwardList.h \ @@ -267,8 +266,6 @@ HEADERS += \ UIProcess/qt/QtWebPageLoadClient.h \ UIProcess/qt/QtWebPagePolicyClient.h \ UIProcess/qt/QtWebPageUIClient.h \ - UIProcess/qt/QtSGUpdateQueue.h \ - UIProcess/qt/QtSGTileNode.h \ UIProcess/qt/QtViewportInteractionEngine.h \ UIProcess/qt/QtWebUndoController.h \ UIProcess/qt/QtWebIconDatabaseClient.h \ @@ -541,7 +538,6 @@ SOURCES += \ UIProcess/Plugins/qt/PluginProcessProxyQt.cpp \ UIProcess/Plugins/unix/PluginInfoStoreUnix.cpp \ UIProcess/ResponsivenessTimer.cpp \ - UIProcess/TiledDrawingAreaProxy.cpp \ UIProcess/VisitedLinkProvider.cpp \ UIProcess/WebApplicationCacheManagerProxy.cpp \ UIProcess/WebBackForwardList.cpp \ @@ -597,9 +593,6 @@ SOURCES += \ UIProcess/qt/QtWebPageLoadClient.cpp \ UIProcess/qt/QtWebPagePolicyClient.cpp \ UIProcess/qt/QtWebPageUIClient.cpp \ - UIProcess/qt/QtSGUpdateQueue.cpp \ - UIProcess/qt/QtSGTileNode.cpp \ - UIProcess/qt/TiledDrawingAreaProxyQt.cpp \ UIProcess/qt/TextCheckerQt.cpp \ UIProcess/qt/QtViewportInteractionEngine.cpp \ UIProcess/qt/WebContextMenuProxyQt.cpp \ @@ -704,7 +697,6 @@ SOURCES += \ WebProcess/WebPage/LayerTreeHost.cpp \ WebProcess/WebPage/PageOverlay.cpp \ WebProcess/WebPage/TiledBackingStoreRemoteTile.cpp \ - WebProcess/WebPage/TiledDrawingArea.cpp \ WebProcess/WebPage/WebBackForwardListProxy.cpp \ WebProcess/WebPage/WebContextMenu.cpp \ WebProcess/WebPage/WebFrame.cpp \ diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp index db7d1f02f..634aa9824 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp @@ -47,6 +47,11 @@ WKStringRef WKNotificationCopyBody(WKNotificationRef notification) return toCopiedAPI(toImpl(notification)->body()); } +WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification) +{ + return toCopiedAPI(toImpl(notification)->iconURL()); +} + WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification) { return toAPI(toImpl(notification)->origin()); diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.h b/Source/WebKit2/UIProcess/API/C/WKNotification.h index 07311af3f..7c2723896 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.h @@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKNotificationGetTypeID(); WK_EXPORT WKStringRef WKNotificationCopyTitle(WKNotificationRef notification); WK_EXPORT WKStringRef WKNotificationCopyBody(WKNotificationRef notification); +WK_EXPORT WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification); WK_EXPORT WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification); WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification); diff --git a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h index 42a4beb92..bc99ec9b0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotificationProvider.h @@ -38,6 +38,7 @@ typedef void (*WKNotificationProviderDidDestroyNotificationCallback)(WKNotificat typedef void (*WKNotificationProviderAddNotificationManagerCallback)(WKNotificationManagerRef manager, const void* clientInfo); typedef void (*WKNotificationProviderRemoveNotificationManagerCallback)(WKNotificationManagerRef manager, const void* clientInfo); typedef WKDictionaryRef (*WKNotificationProviderNotificationPermissionsCallback)(const void* clientInfo); +typedef void (*WKNotificationProviderClearNotificationsCallback)(WKArrayRef notificationIDs, const void* clientInfo); struct WKNotificationProvider { int version; @@ -48,6 +49,7 @@ struct WKNotificationProvider { WKNotificationProviderAddNotificationManagerCallback addNotificationManager; WKNotificationProviderRemoveNotificationManagerCallback removeNotificationManager; WKNotificationProviderNotificationPermissionsCallback notificationPermissions; + WKNotificationProviderClearNotificationsCallback clearNotifications; }; typedef struct WKNotificationProvider WKNotificationProvider; diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp index 60e7b7264..521e6d4a0 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp @@ -52,6 +52,12 @@ WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef) return toAPI(preferences.release().leakRef()); } +WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef preferencesRef) +{ + RefPtr<WebPreferences> preferences = WebPreferences::create(*toImpl(preferencesRef)); + return toAPI(preferences.release().leakRef()); +} + void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferencesRef, bool javaScriptEnabled) { toImpl(preferencesRef)->setJavaScriptEnabled(javaScriptEnabled); diff --git a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h index 3208c6ea3..9153ccab8 100644 --- a/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h +++ b/Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h @@ -52,6 +52,9 @@ enum WKEditableLinkBehavior { }; typedef enum WKEditableLinkBehavior WKEditableLinkBehavior; +// Creates a copy with no identifier. +WK_EXPORT WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef); + // Defaults to kWKFontSmoothingLevelWindows on Windows, kWKFontSmoothingLevelMedium on other platforms. WK_EXPORT void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef, WKFontSmoothingLevel); WK_EXPORT WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h new file mode 100644 index 000000000..f85bf31bd --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitEditingCommands.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) +#error "Only <webkit2/webkit2.h> can be included directly." +#endif + +#ifndef WebKitEditingCommands_h +#define WebKitEditingCommands_h + +G_BEGIN_DECLS + +/** + * WEBKIT_EDITING_COMMAND_CUT: + * + * The cut clipboard command. Copies the current selection inside + * a #WebKitWebView to the clipboard and deletes the selected content. + * You can check whether it's possible to execute the command with + * webkit_web_view_can_execute_editing_command(). In general it's + * possible to cut to the clipboard when the #WebKitWebView content is + * editable and there is an active selection. + */ +#define WEBKIT_EDITING_COMMAND_CUT "Cut" + +/** + * WEBKIT_EDITING_COMMAND_COPY: + * + * The copy clipboard command. Copies the current selection inside + * a #WebKitWebView to the clipboard. + * You can check whether it's possible to execute the command with + * webkit_web_view_can_execute_editing_command(). In general it's + * possible to copy to the clipboard when there is an active selection + * inside the #WebKitWebView. + */ +#define WEBKIT_EDITING_COMMAND_COPY "Copy" + +/** + * WEBKIT_EDITING_COMMAND_PASTE: + * + * The paste clipboard command. Pastes the contents of the clipboard to + * a #WebKitWebView. + * You can check whether it's possible to execute the command with + * webkit_web_view_can_execute_editing_command(). In general it's possible + * to paste from the clipboard when the #WebKitWebView content is editable + * and clipboard is not empty. + */ +#define WEBKIT_EDITING_COMMAND_PASTE "Paste" + + +G_END_DECLS + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp index 61757d428..87fe90799 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPolicyClient.cpp @@ -23,6 +23,7 @@ #include "WebKitNavigationPolicyDecisionPrivate.h" #include "WebKitPolicyDecision.h" #include "WebKitPrivate.h" +#include "WebKitResponsePolicyDecisionPrivate.h" #include "WebKitWebViewBasePrivate.h" #include "WebKitWebViewPrivate.h" #include <wtf/gobject/GRefPtr.h> @@ -57,6 +58,15 @@ static void decidePolicyForNewWindowActionCallback(WKPageRef page, WKFrameRef fr WEBKIT_POLICY_DECISION(decision.get())); } +static void decidePolicyForResponseCallback(WKPageRef page, WKFrameRef frame, WKURLResponseRef response, WKURLRequestRef request, WKFramePolicyListenerRef listener, WKTypeRef userData, const void* clientInfo) +{ + GRefPtr<WebKitResponsePolicyDecision> decision = + adoptGRef(webkitResponsePolicyDecisionCreate(request, response, listener)); + webkitWebViewMakePolicyDecision(WEBKIT_WEB_VIEW(clientInfo), + WEBKIT_POLICY_DECISION_TYPE_RESPONSE, + WEBKIT_POLICY_DECISION(decision.get())); +} + void attachPolicyClientToPage(WebKitWebView* webView) { WKPagePolicyClient policyClient = { @@ -64,7 +74,7 @@ void attachPolicyClientToPage(WebKitWebView* webView) webView, // clientInfo decidePolicyForNavigationActionCallback, decidePolicyForNewWindowActionCallback, - 0, // decidePolicyForResponseCallback, + decidePolicyForResponseCallback, 0, // unableToImplementPolicy }; WKPageSetPagePolicyClient(toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))), &policyClient); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h index 13280d600..c44d877e0 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPrivate.h @@ -33,9 +33,9 @@ #include <glib.h> #include <wtf/Assertions.h> -#define WEBKIT_PARAM_READABLE (static_cast<GParamFlags>(G_PARAM_READABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) -#define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) -#define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB)) +#define WEBKIT_PARAM_READABLE (static_cast<GParamFlags>(G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)) +#define WEBKIT_PARAM_WRITABLE (static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)) +#define WEBKIT_PARAM_READWRITE (static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)) #define COMPILE_ASSERT_MATCHING_ENUM(webkitName, webcoreName) \ COMPILE_ASSERT(int(webkitName) == int(webcoreName), mismatchingEnums) diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp new file mode 100644 index 000000000..adfcdfdd7 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "WebKitResponsePolicyDecision.h" + +#include "WebKitPolicyDecisionPrivate.h" +#include "WebKitPrivate.h" +#include "WebKitURIRequestPrivate.h" +#include "WebKitURIResponsePrivate.h" +#include "WebURLRequest.h" +#include "WebURLResponse.h" +#include <glib/gi18n-lib.h> +#include <wtf/gobject/GRefPtr.h> +#include <wtf/text/CString.h> + +using namespace WebKit; + +/** + * SECTION: WebKitResponsePolicyDecision + * @Short_description: A policy decision for resource responses + * @Title: WebKitResponsePolicyDecision + * @See_also: #WebKitPolicyDecision, #WebKitWebView + * + * WebKitResponsePolicyDecision represents a policy decision for a + * resource response, whether from the network or the local system. + * A very common usecase for these types of decision is deciding + * whether or not to download a particular resource or to load it + * normally. + */ +G_DEFINE_TYPE(WebKitResponsePolicyDecision, webkit_response_policy_decision, WEBKIT_TYPE_POLICY_DECISION) + +struct _WebKitResponsePolicyDecisionPrivate { + GRefPtr<WebKitURIRequest> request; + GRefPtr<WebKitURIResponse> response; +}; + +enum { + PROP_0, + PROP_REQUEST, + PROP_RESPONSE, +}; + +static void webkit_response_policy_decision_init(WebKitResponsePolicyDecision* decision) +{ + decision->priv = G_TYPE_INSTANCE_GET_PRIVATE(decision, WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionPrivate); + new (decision->priv) WebKitResponsePolicyDecisionPrivate(); +} + +static void webkitResponsePolicyDecisionFinalize(GObject* object) +{ + WEBKIT_RESPONSE_POLICY_DECISION(object)->priv->~WebKitResponsePolicyDecisionPrivate(); + G_OBJECT_CLASS(webkit_response_policy_decision_parent_class)->finalize(object); +} + +static void webkitResponsePolicyDecisionGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec) +{ + WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(object); + switch (propId) { + case PROP_REQUEST: + g_value_set_object(value, webkit_response_policy_decision_get_request(decision)); + break; + case PROP_RESPONSE: + g_value_set_object(value, webkit_response_policy_decision_get_response(decision)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); + break; + } +} + +static void webkit_response_policy_decision_class_init(WebKitResponsePolicyDecisionClass* decisionClass) +{ + GObjectClass* objectClass = G_OBJECT_CLASS(decisionClass); + objectClass->finalize = webkitResponsePolicyDecisionFinalize; + objectClass->get_property = webkitResponsePolicyDecisionGetProperty; + g_type_class_add_private(decisionClass, sizeof(WebKitResponsePolicyDecisionPrivate)); + + /** + * WebKitResponsePolicyDecision:request: + * + * This property contains the #WebKitURIRequest associated with this + * policy decision. + */ + g_object_class_install_property(objectClass, + PROP_REQUEST, + g_param_spec_object("request", + _("Response URI request"), + _("The URI request that is associated with this policy decision"), + WEBKIT_TYPE_URI_REQUEST, + WEBKIT_PARAM_READABLE)); + + /** + * WebKitResponsePolicyDecision:response: + * + * This property contains the #WebKitURIResponse associated with this + * policy decision. + */ + g_object_class_install_property(objectClass, + PROP_REQUEST, + g_param_spec_object("response", + _("URI response"), + _("The URI response that is associated with this policy decision"), + WEBKIT_TYPE_URI_REQUEST, + WEBKIT_PARAM_READABLE)); + +} + +/** + * webkit_response_policy_decision_get_request: + * @decision: a #WebKitResponsePolicyDecision + * + * Gets the value of the #WebKitResponsePolicyDecision:request property. + * + * Returns: (transfer none): The URI request that is associated with this policy decision. + */ +WebKitURIRequest* webkit_response_policy_decision_get_request(WebKitResponsePolicyDecision* decision) +{ + g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0); + return decision->priv->request.get(); +} + +/** + * webkit_response_policy_decision_get_response: + * @decision: a #WebKitResponsePolicyDecision + * + * Gets the value of the #WebKitResponsePolicyDecision:response property. + * + * Returns: (transfer none): The URI response that is associated with this policy decision. + */ +WebKitURIResponse* webkit_response_policy_decision_get_response(WebKitResponsePolicyDecision* decision) +{ + g_return_val_if_fail(WEBKIT_IS_RESPONSE_POLICY_DECISION(decision), 0); + return decision->priv->response.get(); +} + +WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(WKURLRequestRef request, WKURLResponseRef response, WKFramePolicyListenerRef listener) +{ + WebKitResponsePolicyDecision* decision = WEBKIT_RESPONSE_POLICY_DECISION(g_object_new(WEBKIT_TYPE_RESPONSE_POLICY_DECISION, NULL)); + decision->priv->request = adoptGRef(webkitURIRequestCreateForResourceRequest(toImpl(request)->resourceRequest())); + decision->priv->response = adoptGRef(webkitURIResponseCreateForResourceResponse(toImpl(response)->resourceResponse())); + webkitPolicyDecisionSetListener(WEBKIT_POLICY_DECISION(decision), listener); + return decision; +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h new file mode 100644 index 000000000..7653fcc14 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecision.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#if !defined(__WEBKIT2_H_INSIDE__) && !defined(WEBKIT2_COMPILATION) +#error "Only <webkit2/webkit2.h> can be included directly." +#endif + +#ifndef WebKitResponsePolicyDecision_h +#define WebKitResponsePolicyDecision_h + +#include <glib-object.h> +#include <webkit2/WebKitDefines.h> +#include <webkit2/WebKitPolicyDecision.h> +#include <webkit2/WebKitURIResponse.h> +#include <webkit2/WebKitURIRequest.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_RESPONSE_POLICY_DECISION (webkit_response_policy_decision_get_type()) +#define WEBKIT_RESPONSE_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecision)) +#define WEBKIT_RESPONSE_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionClass)) +#define WEBKIT_IS_RESPONSE_POLICY_DECISION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION)) +#define WEBKIT_IS_RESPONSE_POLICY_DECISION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_RESPONSE_POLICY_DECISION)) +#define WEBKIT_RESPONSE_POLICY_DECISION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_RESPONSE_POLICY_DECISION, WebKitResponsePolicyDecisionClass)) + +typedef struct _WebKitResponsePolicyDecision WebKitResponsePolicyDecision; +typedef struct _WebKitResponsePolicyDecisionClass WebKitResponsePolicyDecisionClass; +typedef struct _WebKitResponsePolicyDecisionPrivate WebKitResponsePolicyDecisionPrivate; + +struct _WebKitResponsePolicyDecision { + WebKitPolicyDecision parent; + + /*< private >*/ + WebKitResponsePolicyDecisionPrivate *priv; +}; + +struct _WebKitResponsePolicyDecisionClass { + WebKitPolicyDecisionClass parent_class; +}; + +WEBKIT_API GType +webkit_response_policy_decision_get_type (void); + +WEBKIT_API WebKitURIRequest * +webkit_response_policy_decision_get_request (WebKitResponsePolicyDecision *decision); + +WEBKIT_API WebKitURIResponse * +webkit_response_policy_decision_get_response (WebKitResponsePolicyDecision *decision); + +G_END_DECLS + +#endif diff --git a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h index 618806d75..b508aa525 100644 --- a/Source/WebCore/platform/graphics/cairo/TextureMapperGLCairo.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitResponsePolicyDecisionPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 ChangSeok Oh <shivamidow@gmail.com> + * Copyright (C) 2012 Igalia S.L. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -17,26 +17,12 @@ * Boston, MA 02110-1301, USA. */ -#ifndef TextureMapperGLCairo_h -#define TextureMapperGLCairo_h +#ifndef WebKitResponsePolicyDecisionPrivate_h +#define WebKitResponsePolicyDecisionPrivate_h -#include "TextureMapperGL.h" +#include "WebKitPrivate.h" +#include "WebKitResponsePolicyDecision.h" -namespace WebCore { +WebKitResponsePolicyDecision* webkitResponsePolicyDecisionCreate(WKURLRequestRef, WKURLResponseRef, WKFramePolicyListenerRef); -class BGRA32PremultimpliedBufferCairo: public BGRA32PremultimpliedBuffer { -public: - BGRA32PremultimpliedBufferCairo(); - virtual ~BGRA32PremultimpliedBufferCairo(); - virtual PlatformGraphicsContext* beginPaint(const IntRect& dirtyRect, bool opaque); - virtual void endPaint(); - virtual void* data(); - -private: - PlatformContextCairo* m_context; - cairo_t* m_cairoContext; - cairo_surface_t* m_cairoSurface; -}; - -} -#endif +#endif // WebKitResponsePolicyDecisionPrivate_h diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp index 06418613d..774f17190 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp @@ -101,7 +101,8 @@ enum { PROP_ENABLE_DNS_PREFETCHING, PROP_ENABLE_CARET_BROWSING, PROP_ENABLE_FULLSCREEN, - PROP_PRINT_BACKGROUNDS + PROP_PRINT_BACKGROUNDS, + PROP_ENABLE_WEBAUDIO }; static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec) @@ -202,6 +203,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu case PROP_PRINT_BACKGROUNDS: webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value)); break; + case PROP_ENABLE_WEBAUDIO: + webkit_settings_set_enable_webaudio(settings, g_value_get_boolean(value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -306,6 +310,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val case PROP_PRINT_BACKGROUNDS: g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings)); break; + case PROP_ENABLE_WEBAUDIO: + g_value_set_boolean(value, webkit_settings_get_enable_webaudio(settings)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -768,6 +775,25 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) TRUE, readWriteConstructParamFlags)); + /** + * WebKitSettings:enable-webaudio: + * + * + * Enable or disable support for WebAudio on pages. WebAudio is an + * experimental proposal for allowing web pages to generate Audio + * WAVE data from JavaScript. The standard is currently a + * work-in-progress by the W3C Audio Working Group. + * + * See also https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html + */ + g_object_class_install_property(gObjectClass, + PROP_ENABLE_WEBAUDIO, + g_param_spec_boolean("enable-webaudio", + _("Enable WebAudio"), + _("Whether WebAudio content should be handled"), + FALSE, + readWriteConstructParamFlags)); + g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate)); } @@ -1955,3 +1981,38 @@ void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean pr WKPreferencesSetShouldPrintBackgrounds(priv->preferences.get(), printBackgrounds); g_object_notify(G_OBJECT(settings), "print-backgrounds"); } + +/** + * webkit_settings_get_enable_webaudio: + * @settings: a #WebKitSettings + * + * Get the #WebKitSettings:enable-webaudio property. + * + * Returns: %TRUE If webaudio support is enabled or %FALSE otherwise. + */ +gboolean webkit_settings_get_enable_webaudio(WebKitSettings* settings) +{ + g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE); + + return WKPreferencesGetWebAudioEnabled(settings->priv->preferences.get()); +} + +/** + * webkit_settings_set_enable_webaudio: + * @settings: a #WebKitSettings + * @enabled: Value to be set + * + * Set the #WebKitSettings:enable-webaudio property. + */ +void webkit_settings_set_enable_webaudio(WebKitSettings* settings, gboolean enabled) +{ + g_return_if_fail(WEBKIT_IS_SETTINGS(settings)); + + WebKitSettingsPrivate* priv = settings->priv; + bool currentValue = WKPreferencesGetWebAudioEnabled(priv->preferences.get()); + if (currentValue == enabled) + return; + + WKPreferencesSetWebAudioEnabled(priv->preferences.get(), enabled); + g_object_notify(G_OBJECT(settings), "enable-webaudio"); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h index a6769fc0e..27cb7c75a 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h @@ -293,6 +293,13 @@ WEBKIT_API void webkit_settings_set_print_backgrounds (WebKitSettings *settings, gboolean print_backgrounds); +WEBKIT_API gboolean +webkit_settings_get_enable_webaudio (WebKitSettings *settings); + +WEBKIT_API void +webkit_settings_set_enable_webaudio (WebKitSettings *settings, + gboolean enabled); + G_END_DECLS #endif /* WebKitSettings_h */ diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index fcaa2db1d..c3accccbb 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -27,13 +27,13 @@ #include "WebKitLoaderClient.h" #include "WebKitMarshal.h" #include "WebKitPolicyClient.h" +#include "WebKitPrivate.h" #include "WebKitSettingsPrivate.h" #include "WebKitUIClient.h" #include "WebKitWebContextPrivate.h" #include "WebKitWebViewBasePrivate.h" #include "WebKitWebViewPrivate.h" #include "WebKitWindowPropertiesPrivate.h" -#include "WebKitPrivate.h" #include "WebPageProxy.h" #include <WebCore/DragIcon.h> #include <WebCore/GtkUtilities.h> @@ -180,9 +180,11 @@ static void webkitWebViewSetProperty(GObject* object, guint propId, const GValue WebKitWebView* webView = WEBKIT_WEB_VIEW(object); switch (propId) { - case PROP_WEB_CONTEXT: - webView->priv->context = WEBKIT_WEB_CONTEXT(g_value_get_object(value)); + case PROP_WEB_CONTEXT: { + gpointer webContext = g_value_get_object(value); + webView->priv->context = webContext ? WEBKIT_WEB_CONTEXT(webContext) : webkit_web_context_get_default(); break; + } case PROP_ZOOM_LEVEL: webkit_web_view_set_zoom_level(webView, g_value_get_double(value)); break; @@ -554,9 +556,9 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); /** - * WebKitPolicyClient::decide-policy + * WebKitWebView::decide-policy: * @web_view: the #WebKitWebView on which the signal is emitted - * @decision: the #WebKitNavigationPolicyDecision + * @decision: the #WebKitPolicyDecision * @decision_type: a #WebKitPolicyDecisionType denoting the type of @decision * * This signal is emitted when WebKit is requesting the client to decide a policy @@ -1267,3 +1269,77 @@ gdouble webkit_web_view_get_zoom_level(WebKitWebView* webView) WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); return WKPageGetPageZoomFactor(wkPage); } + + +static void didValidateCommand(WKStringRef command, bool isEnabled, int32_t state, WKErrorRef, void* context) +{ + GRefPtr<GSimpleAsyncResult> result = adoptGRef(G_SIMPLE_ASYNC_RESULT(context)); + g_simple_async_result_set_op_res_gboolean(result.get(), isEnabled); + g_simple_async_result_complete(result.get()); +} + +/** + * webkit_web_view_can_execute_editing_command: + * @web_view: a #WebKitWebView + * @command: the command to check + * @callback: (scope async): a #GAsyncReadyCallback to call when the request is satisfied + * @user_data: (closure): the data to pass to callback function + * + * Asynchronously execute the given editing command. + * + * When the operation is finished, @callback will be called. You can then call + * webkit_web_view_can_execute_editing_command_finish() to get the result of the operation. + */ +void webkit_web_view_can_execute_editing_command(WebKitWebView* webView, const char* command, GAsyncReadyCallback callback, gpointer userData) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + g_return_if_fail(command); + + GSimpleAsyncResult* result = g_simple_async_result_new(G_OBJECT(webView), callback, userData, + reinterpret_cast<gpointer>(webkit_web_view_can_execute_editing_command)); + WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); + WKRetainPtr<WKStringRef> wkCommand(AdoptWK, WKStringCreateWithUTF8CString(command)); + WKPageValidateCommand(toAPI(page), wkCommand.get(), result, didValidateCommand); +} + +/** + * webkit_web_view_can_execute_editing_command_finish: + * @web_view: a #WebKitWebView + * @result: a #GAsyncResult + * @error: return location for error or %NULL to ignore + * + * Finish an asynchronous operation started with webkit_web_view_can_execute_editing_command(). + * + * Returns: %TRUE if a selection can be cut or %FALSE otherwise + */ +gboolean webkit_web_view_can_execute_editing_command_finish(WebKitWebView* webView, GAsyncResult* result, GError** error) +{ + g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), FALSE); + g_return_val_if_fail(G_IS_ASYNC_RESULT(result), FALSE); + + GSimpleAsyncResult* simple = G_SIMPLE_ASYNC_RESULT(result); + g_warn_if_fail(g_simple_async_result_get_source_tag(simple) == webkit_web_view_can_execute_editing_command); + + if (g_simple_async_result_propagate_error(simple, error)) + return FALSE; + return g_simple_async_result_get_op_res_gboolean(simple); +} + +/** + * webkit_web_view_execute_editing_command: + * @web_view: a #WebKitWebView + * @command: the command to execute + * + * Request to execute the given @command for @web_view. You can use + * webkit_web_view_can_execute_editing_command() to check whether + * it's possible to execute the command. + */ +void webkit_web_view_execute_editing_command(WebKitWebView* webView, const char* command) +{ + g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); + g_return_if_fail(command); + + WebPageProxy* page = webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView)); + WKRetainPtr<WKStringRef> wkCommand(AdoptWK, WKStringCreateWithUTF8CString(command)); + WKPageExecuteCommand(toAPI(page), wkCommand.get()); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 697fcdc80..d4768e3b6 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -39,6 +39,17 @@ G_BEGIN_DECLS +#define WEBKIT_TYPE_WEB_VIEW (webkit_web_view_get_type()) +#define WEBKIT_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebView)) +#define WEBKIT_IS_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_VIEW)) +#define WEBKIT_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass)) +#define WEBKIT_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_VIEW)) +#define WEBKIT_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass)) + +typedef struct _WebKitWebView WebKitWebView; +typedef struct _WebKitWebViewClass WebKitWebViewClass; +typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; + /** * WebKitPolicyDecisionType: * @WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: This type of policy decision @@ -73,17 +84,6 @@ typedef enum { WEBKIT_POLICY_DECISION_TYPE_RESPONSE, } WebKitPolicyDecisionType; -#define WEBKIT_TYPE_WEB_VIEW (webkit_web_view_get_type()) -#define WEBKIT_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebView)) -#define WEBKIT_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass)) -#define WEBKIT_IS_WEB_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_WEB_VIEW)) -#define WEBKIT_IS_WEB_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_WEB_VIEW)) -#define WEBKIT_WEB_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_WEB_VIEW, WebKitWebViewClass)) - -typedef struct _WebKitWebView WebKitWebView; -typedef struct _WebKitWebViewClass WebKitWebViewClass; -typedef struct _WebKitWebViewPrivate WebKitWebViewPrivate; - /** * WebKitLoadEvent * @WEBKIT_LOAD_STARTED: A new load request has been made. @@ -152,99 +152,113 @@ struct _WebKitWebViewClass { }; WEBKIT_API GType -webkit_web_view_get_type (void); +webkit_web_view_get_type (void); WEBKIT_API GtkWidget * -webkit_web_view_new (void); +webkit_web_view_new (void); WEBKIT_API GtkWidget * -webkit_web_view_new_with_context (WebKitWebContext *context); +webkit_web_view_new_with_context (WebKitWebContext *context); WEBKIT_API WebKitWebContext * -webkit_web_view_get_context (WebKitWebView *web_view); +webkit_web_view_get_context (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_load_uri (WebKitWebView *web_view, - const gchar *uri); +webkit_web_view_load_uri (WebKitWebView *web_view, + const gchar *uri); WEBKIT_API void -webkit_web_view_load_html (WebKitWebView *web_view, - const gchar *content, - const gchar *base_uri); +webkit_web_view_load_html (WebKitWebView *web_view, + const gchar *content, + const gchar *base_uri); WEBKIT_API void -webkit_web_view_load_plain_text (WebKitWebView *web_view, - const gchar *plain_text); +webkit_web_view_load_plain_text (WebKitWebView *web_view, + const gchar *plain_text); WEBKIT_API void -webkit_web_view_load_request (WebKitWebView *web_view, - WebKitURIRequest *request); +webkit_web_view_load_request (WebKitWebView *web_view, + WebKitURIRequest *request); WEBKIT_API void -webkit_web_view_stop_loading (WebKitWebView *web_view); +webkit_web_view_stop_loading (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_replace_content (WebKitWebView *web_view, - const gchar *content, - const gchar *content_uri, - const gchar *base_uri); +webkit_web_view_replace_content (WebKitWebView *web_view, + const gchar *content, + const gchar *content_uri, + const gchar *base_uri); WEBKIT_API const gchar * -webkit_web_view_get_title (WebKitWebView *web_view); +webkit_web_view_get_title (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_reload (WebKitWebView *web_view); +webkit_web_view_reload (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_reload_bypass_cache (WebKitWebView *web_view); +webkit_web_view_reload_bypass_cache (WebKitWebView *web_view); WEBKIT_API gdouble -webkit_web_view_get_estimated_load_progress (WebKitWebView *web_view); +webkit_web_view_get_estimated_load_progress (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_back (WebKitWebView *web_view); +webkit_web_view_go_back (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_can_go_back (WebKitWebView *web_view); +webkit_web_view_can_go_back (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_forward (WebKitWebView *web_view); +webkit_web_view_go_forward (WebKitWebView *web_view); WEBKIT_API gboolean -webkit_web_view_can_go_forward (WebKitWebView *web_view); +webkit_web_view_can_go_forward (WebKitWebView *web_view); WEBKIT_API WebKitBackForwardList * -webkit_web_view_get_back_forward_list (WebKitWebView *web_view); +webkit_web_view_get_back_forward_list (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_go_to_back_forward_list_item (WebKitWebView *web_view, - WebKitBackForwardListItem *list_item); +webkit_web_view_go_to_back_forward_list_item (WebKitWebView *web_view, + WebKitBackForwardListItem *list_item); WEBKIT_API const gchar * -webkit_web_view_get_uri (WebKitWebView *web_view); +webkit_web_view_get_uri (WebKitWebView *web_view); WEBKIT_API const gchar * -webkit_web_view_get_custom_charset (WebKitWebView *web_view); +webkit_web_view_get_custom_charset (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_set_custom_charset (WebKitWebView *web_view, - const gchar *charset); +webkit_web_view_set_custom_charset (WebKitWebView *web_view, + const gchar *charset); WEBKIT_API void -webkit_web_view_set_settings (WebKitWebView *web_view, - WebKitSettings *settings); +webkit_web_view_set_settings (WebKitWebView *web_view, + WebKitSettings *settings); WEBKIT_API WebKitSettings * -webkit_web_view_get_settings (WebKitWebView *web_view); +webkit_web_view_get_settings (WebKitWebView *web_view); WEBKIT_API WebKitWindowProperties * -webkit_web_view_get_window_properties (WebKitWebView *web_view); +webkit_web_view_get_window_properties (WebKitWebView *web_view); WEBKIT_API void -webkit_web_view_set_zoom_level (WebKitWebView *web_view, - gdouble zoom_level); +webkit_web_view_set_zoom_level (WebKitWebView *web_view, + gdouble zoom_level); WEBKIT_API gdouble -webkit_web_view_get_zoom_level (WebKitWebView *web_view); +webkit_web_view_get_zoom_level (WebKitWebView *web_view); + +WEBKIT_API void +webkit_web_view_can_execute_editing_command (WebKitWebView *web_view, + const gchar *command, + GAsyncReadyCallback callback, + gpointer user_data); +WEBKIT_API gboolean +webkit_web_view_can_execute_editing_command_finish (WebKitWebView *web_view, + GAsyncResult *result, + GError **error); + +WEBKIT_API void +webkit_web_view_execute_editing_command (WebKitWebView *web_view, + const gchar *command); G_END_DECLS #endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp index d9ccaa32a..adcc34ae3 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp @@ -71,6 +71,7 @@ struct _WebKitWebViewBasePrivate { DragIcon dragIcon; IntSize resizerSize; GRefPtr<AtkObject> accessible; + bool needsResizeOnMap; }; G_DEFINE_TYPE(WebKitWebViewBase, webkit_web_view_base, GTK_TYPE_CONTAINER) @@ -202,20 +203,43 @@ static gboolean webkitWebViewBaseDraw(GtkWidget* widget, cairo_t* cr) return FALSE; } +static void resizeWebKitWebViewBaseFromAllocation(WebKitWebViewBase* webViewBase, GtkAllocation* allocation) +{ + WebKitWebViewBasePrivate* priv = webViewBase->priv; + + if (priv->pageProxy->drawingArea()) + priv->pageProxy->drawingArea()->setSize(IntSize(allocation->width, allocation->height), IntSize()); + + GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(webViewBase)); + if (widgetIsOnscreenToplevelWindow(toplevel)) + webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(toplevel)); +} + static void webkitWebViewBaseSizeAllocate(GtkWidget* widget, GtkAllocation* allocation) { + GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation); + WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); - WebKitWebViewBasePrivate* priv = webViewBase->priv; + if (!gtk_widget_get_mapped(GTK_WIDGET(webViewBase)) && !webViewBase->priv->pageProxy->drawingArea()->size().isEmpty()) { + webViewBase->priv->needsResizeOnMap = true; + return; + } + resizeWebKitWebViewBaseFromAllocation(webViewBase, allocation); +} + +static void webkitWebViewBaseMap(GtkWidget* widget) +{ + GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->map(widget); - if (!priv->pageProxy->drawingArea()) + WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); + if (!webViewBase->priv->needsResizeOnMap) return; - GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->size_allocate(widget, allocation); - priv->pageProxy->drawingArea()->setSize(IntSize(allocation->width, allocation->height), IntSize()); + GtkAllocation allocation; + gtk_widget_get_allocation(widget, &allocation); + resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation); + webViewBase->priv->needsResizeOnMap = false; - GtkWidget* toplevel = gtk_widget_get_toplevel(widget); - if (widgetIsOnscreenToplevelWindow(toplevel)) - webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(toplevel)); } static gboolean webkitWebViewBaseFocusInEvent(GtkWidget* widget, GdkEventFocus* event) @@ -454,6 +478,7 @@ static void webkit_web_view_base_class_init(WebKitWebViewBaseClass* webkitWebVie widgetClass->realize = webkitWebViewBaseRealize; widgetClass->draw = webkitWebViewBaseDraw; widgetClass->size_allocate = webkitWebViewBaseSizeAllocate; + widgetClass->map = webkitWebViewBaseMap; widgetClass->focus_in_event = webkitWebViewBaseFocusInEvent; widgetClass->focus_out_event = webkitWebViewBaseFocusOutEvent; widgetClass->key_press_event = webkitWebViewBaseKeyPressEvent; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp index b170c82c9..413890203 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp @@ -38,7 +38,7 @@ * scrollbar, statusbar, locationbar should be visible to the user, * and the request to show the #WebKitWebView fullscreen. * - * The #WebKitWebView:ready-to-show signal handler is the proper place + * The #WebKitWebView::ready-to-show signal handler is the proper place * to apply the initial window properties. Then you can monitor the * #WebKitWindowProperties by connecting to ::notify signal. * diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml index c6f943ab2..af0cdae7c 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml @@ -23,6 +23,7 @@ <xi:include href="xml/WebKitDownload.xml"/> <xi:include href="xml/WebKitPolicyDecision.xml"/> <xi:include href="xml/WebKitNavigationPolicyDecision.xml"/> + <xi:include href="xml/WebKitResponsePolicyDecision.xml"/> <xi:include href="xml/WebKitError.xml"/> </chapter> diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index ef44b2bed..52cd89ee7 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -49,6 +49,13 @@ webkit_web_context_get_type WebKitWebView WebKitLoadEvent WebKitPolicyDecisionType + +<SUBSECTION Editing Commands> +WEBKIT_EDITING_COMMAND_CUT +WEBKIT_EDITING_COMMAND_COPY +WEBKIT_EDITING_COMMAND_PASTE + +<SUBSECTION> webkit_web_view_new webkit_web_view_new_with_context webkit_web_view_get_context @@ -76,6 +83,9 @@ webkit_web_view_get_settings webkit_web_view_get_window_properties webkit_web_view_set_zoom_level webkit_web_view_get_zoom_level +webkit_web_view_can_execute_editing_command +webkit_web_view_can_execute_editing_command_finish +webkit_web_view_execute_editing_command <SUBSECTION Standard> WebKitWebViewClass @@ -206,6 +216,8 @@ webkit_settings_get_enable_fullscreen webkit_settings_set_enable_fullscreen webkit_settings_get_print_backgrounds webkit_settings_set_print_backgrounds +webkit_settings_get_enable_webaudio +webkit_settings_set_enable_webaudio <SUBSECTION Standard> WebKitSettingsClass @@ -358,6 +370,26 @@ webkit_navigation_policy_decision_get_type </SECTION> <SECTION> +<FILE>WebKitResponsePolicyDecision</FILE> +WebKitResponsePolicyDecision +webkit_response_policy_decision_get_request +webkit_response_policy_decision_get_response + +<SUBSECTION Standard> +WebKitResponsePolicyDecisionClass +WEBKIT_TYPE_RESPONSE_POLICY_DECISION +WEBKIT_RESPONSE_POLICY_DECISION +WEBKIT_IS_RESPONSE_POLICY_DECISION +WEBKIT_RESPONSE_POLICY_DECISION_CLASS +WEBKIT_IS_RESPONSE_POLICY_DECISION_CLASS +WEBKIT_RESPONSE_POLICY_DECISION_GET_CLASS + +<SUBSECTION Private> +WebKitResponsePolicyDecisionPrivate +webkit_response_policy_decision_get_type +</SECTION> + +<SECTION> <FILE>WebKitError</FILE> WEBKIT_NETWORK_ERROR WEBKIT_PLUGIN_ERROR diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am index 175a149e4..7241b9980 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am +++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am @@ -5,7 +5,8 @@ TEST_PROGS += \ Programs/WebKit2APITests/TestWebKitSettings \ Programs/WebKit2APITests/TestBackForwardList \ Programs/WebKit2APITests/TestDownloads \ - Programs/WebKit2APITests/TestWebKitPolicyClient + Programs/WebKit2APITests/TestWebKitPolicyClient \ + Programs/WebKit2APITests/TestWebViewEditor noinst_PROGRAMS += $(TEST_PROGS) @@ -111,3 +112,9 @@ Programs_WebKit2APITests_TestDownloads_SOURCES = \ Programs_WebKit2APITests_TestDownloads_CPPFLAGS = $(webkit2_tests_cppflags) Programs_WebKit2APITests_TestDownloads_LDADD = $(webkit2_tests_ldadd) Programs_WebKit2APITests_TestDownloads_LDFLAGS = $(webkit2_tests_ldflags) + +Programs_WebKit2APITests_TestWebViewEditor_SOURCES = \ + Source/WebKit2/UIProcess/API/gtk/tests/TestWebViewEditor.cpp +Programs_WebKit2APITests_TestWebViewEditor_CPPFLAGS = $(webkit2_tests_cppflags) +Programs_WebKit2APITests_TestWebViewEditor_LDADD = $(webkit2_tests_ldadd) +Programs_WebKit2APITests_TestWebViewEditor_LDFLAGS = $(webkit2_tests_ldflags) diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp index 9eb08575d..a35c8745b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/LoadTrackingTest.cpp @@ -110,8 +110,6 @@ void LoadTrackingTest::provisionalLoadReceivedServerRedirect() void LoadTrackingTest::provisionalLoadFailed(const gchar* failingURI, GError* error) { m_loadEvents.append(ProvisionalLoadFailed); - if (m_runLoadUntilCompletion) - g_main_loop_quit(m_mainLoop); } void LoadTrackingTest::loadCommitted() diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp index cc657cc64..e70e391ff 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp @@ -19,8 +19,8 @@ #include "config.h" -#include "LoadTrackingTest.h" #include "WebKitTestServer.h" +#include "WebViewTest.h" #include <gtk/gtk.h> #include <libsoup/soup.h> #include <string.h> @@ -46,7 +46,7 @@ static void serverCallback(SoupServer* server, SoupMessage* msg, const char* pat soup_message_body_complete(msg->response_body); } -class BackForwardListTest: public LoadTrackingTest { +class BackForwardListTest: public WebViewTest { public: MAKE_GLIB_TEST_FIXTURE(BackForwardListTest); @@ -130,7 +130,7 @@ public: void waitUntilLoadFinished() { m_hasChanged = false; - LoadTrackingTest::waitUntilLoadFinished(); + WebViewTest::waitUntilLoadFinished(); g_assert(m_hasChanged); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h index 631096a76..39a2000ac 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestMain.h @@ -20,9 +20,9 @@ #ifndef TestMain_h #define TestMain_h -#include <glib-object.h> #include <JavaScriptCore/GOwnPtr.h> #include <JavaScriptCore/HashSet.h> +#include <glib-object.h> #define MAKE_GLIB_TEST_FIXTURE(ClassName) \ static void setUp(ClassName* fixture, gconstpointer data) \ @@ -39,8 +39,7 @@ g_test_add(testPath.get(), ClassName, 0, ClassName::setUp, testFunc, ClassName::tearDown); \ } -class Test -{ +class Test { public: MAKE_GLIB_TEST_FIXTURE(Test); diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp index 7cbe4e7f9..9f6ce7819 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitPolicyClient.cpp @@ -20,9 +20,12 @@ #include "config.h" #include "LoadTrackingTest.h" +#include "WebKitTestServer.h" #include <wtf/gobject/GRefPtr.h> #include <wtf/text/CString.h> +static WebKitTestServer* kServer; + class PolicyClientTest: public LoadTrackingTest { public: MAKE_GLIB_TEST_FIXTURE(PolicyClientTest); @@ -142,6 +145,37 @@ static void testNavigationPolicy(PolicyClientTest* test, gconstpointer) g_assert_cmpint(test->m_loadEvents.size(), ==, 0); } +static void testResponsePolicy(PolicyClientTest* test, gconstpointer) +{ + test->m_policyDecisionTypeFilter = WEBKIT_POLICY_DECISION_TYPE_RESPONSE; + + test->m_policyDecisionResponse = PolicyClientTest::Use; + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + g_assert_cmpint(test->m_loadEvents.size(), ==, 3); + g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted); + g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted); + g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished); + + test->m_respondToPolicyDecisionAsynchronously = true; + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + g_assert_cmpint(test->m_loadEvents.size(), ==, 3); + g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted); + g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::LoadCommitted); + g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished); + + test->m_respondToPolicyDecisionAsynchronously = false; + test->m_policyDecisionResponse = PolicyClientTest::Ignore; + test->loadURI(kServer->getURIForPath("/").data()); + test->waitUntilLoadFinished(); + + g_assert_cmpint(test->m_loadEvents.size(), ==, 3); + g_assert_cmpint(test->m_loadEvents[0], ==, LoadTrackingTest::ProvisionalLoadStarted); + g_assert_cmpint(test->m_loadEvents[1], ==, LoadTrackingTest::ProvisionalLoadFailed); + g_assert_cmpint(test->m_loadEvents[2], ==, LoadTrackingTest::LoadFinished); +} + struct CreateCallbackData { bool triedToOpenWindow; GMainLoop* mainLoop; @@ -191,12 +225,31 @@ static void testNewWindowPolicy(PolicyClientTest* test, gconstpointer) g_assert(!data.triedToOpenWindow); } +static void serverCallback(SoupServer* server, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer) +{ + if (message->method != SOUP_METHOD_GET) { + soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED); + return; + } + + soup_message_set_status(message, SOUP_STATUS_OK); + + static const char* responseString = "<html><body>Testing!</body></html>"; + soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString)); + soup_message_body_complete(message->response_body); +} + void beforeAll() { + kServer = new WebKitTestServer(); + kServer->run(serverCallback); + PolicyClientTest::add("WebKitPolicyClient", "navigation-policy", testNavigationPolicy); + PolicyClientTest::add("WebKitPolicyClient", "response-policy", testResponsePolicy); PolicyClientTest::add("WebKitPolicyClient", "new-window-policy", testNewWindowPolicy); } void afterAll() { + delete kServer; } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp index cce7e1fe7..0ecea5604 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp @@ -189,6 +189,11 @@ static void testWebKitSettings(Test*, gconstpointer) webkit_settings_set_print_backgrounds(settings, FALSE); g_assert(!webkit_settings_get_print_backgrounds(settings)); + // WebAudio is disabled by default. + g_assert(!webkit_settings_get_enable_webaudio(settings)); + webkit_settings_set_enable_webaudio(settings, TRUE); + g_assert(webkit_settings_get_enable_webaudio(settings)); + g_object_unref(G_OBJECT(settings)); } diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp index 16375ed20..3d59ee917 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp @@ -26,6 +26,10 @@ static void testWebViewDefaultContext(WebViewTest* test, gconstpointer) { g_assert(webkit_web_view_get_context(test->m_webView) == webkit_web_context_get_default()); + + // Check that a web view created with g_object_new has the default context. + GRefPtr<WebKitWebView> webView = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW, NULL)); + g_assert(webkit_web_view_get_context(webView.get()) == webkit_web_context_get_default()); } static void testWebViewCustomCharset(WebViewTest* test, gconstpointer) diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebViewEditor.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebViewEditor.cpp new file mode 100644 index 000000000..644584a3e --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebViewEditor.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2012 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2,1 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 "WebViewTest.h" +#include <wtf/gobject/GRefPtr.h> + +class EditorTest: public WebViewTest { +public: + MAKE_GLIB_TEST_FIXTURE(EditorTest); + + static const unsigned int kClipboardWaitTimeout = 50; + static const unsigned int kClipboardWaitMaxTries = 2; + + EditorTest() + : m_clipboard(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)) + , m_canExecuteEditingCommand(false) + , m_triesCount(0) + { + gtk_clipboard_clear(m_clipboard); + } + + static void canExecuteEditingCommandReadyCallback(GObject*, GAsyncResult* result, EditorTest* test) + { + GOwnPtr<GError> error; + test->m_canExecuteEditingCommand = webkit_web_view_can_execute_editing_command_finish(test->m_webView, result, &error.outPtr()); + g_assert(!error.get()); + g_main_loop_quit(test->m_mainLoop); + } + + bool canExecuteEditingCommand(const char* command) + { + m_canExecuteEditingCommand = false; + webkit_web_view_can_execute_editing_command(m_webView, command, reinterpret_cast<GAsyncReadyCallback>(canExecuteEditingCommandReadyCallback), this); + g_main_loop_run(m_mainLoop); + return m_canExecuteEditingCommand; + } + + static gboolean waitForClipboardText(EditorTest* test) + { + test->m_triesCount++; + if (gtk_clipboard_wait_is_text_available(test->m_clipboard) || test->m_triesCount > kClipboardWaitMaxTries) { + g_main_loop_quit(test->m_mainLoop); + return FALSE; + } + + return TRUE; + } + + void copyClipboard() + { + webkit_web_view_execute_editing_command(m_webView, WEBKIT_EDITING_COMMAND_COPY); + // There's no way to know when the selection has been copied to + // the clipboard, so use a timeout source to query the clipboard. + m_triesCount = 0; + g_timeout_add(kClipboardWaitTimeout, reinterpret_cast<GSourceFunc>(waitForClipboardText), this); + g_main_loop_run(m_mainLoop); + } + + GtkClipboard* m_clipboard; + bool m_canExecuteEditingCommand; + size_t m_triesCount; +}; + +static void testWebViewEditorCutCopyPasteNonEditable(EditorTest* test, gconstpointer) +{ + static const char* selectedSpanHTML = "<html><body contentEditable=\"false\">" + "<span id=\"mainspan\">All work and no play <span id=\"subspan\">make Jack a dull</span> boy.</span>" + "<script>document.getSelection().collapse();\n" + "document.getSelection().selectAllChildren(document.getElementById('subspan'));\n" + "</script></body></html>"; + + // Nothing loaded yet. + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT)); + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_COPY)); + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE)); + + test->loadHtml(selectedSpanHTML, 0); + test->waitUntilLoadFinished(); + + g_assert(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_COPY)); + // It's not possible to cut and paste when content is not editable + // even if there's a selection. + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT)); + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE)); + + test->copyClipboard(); + GOwnPtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard)); + g_assert_cmpstr(clipboardText.get(), ==, "make Jack a dull"); +} + +static void testWebViewEditorCutCopyPasteEditable(EditorTest* test, gconstpointer) +{ + static const char* selectedSpanHTML = "<html><body contentEditable=\"true\">" + "<span id=\"mainspan\">All work and no play <span>make Jack a dull</span> boy.</span>" + "<script>document.getSelection().collapse();\n" + "document.getSelection().selectAllChildren(document.getElementById('mainspan'));\n" + "</script></body></html>"; + + // Nothing loaded yet. + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT)); + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_COPY)); + g_assert(!test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE)); + + test->loadHtml(selectedSpanHTML, 0); + test->waitUntilLoadFinished(); + + // There's a selection. + g_assert(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_CUT)); + g_assert(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_COPY)); + g_assert(test->canExecuteEditingCommand(WEBKIT_EDITING_COMMAND_PASTE)); + + test->copyClipboard(); + GOwnPtr<char> clipboardText(gtk_clipboard_wait_for_text(test->m_clipboard)); + g_assert_cmpstr(clipboardText.get(), ==, "All work and no play make Jack a dull boy."); +} + +void beforeAll() +{ + EditorTest::add("WebKitWebView", "cut-copy-paste/non-editable", testWebViewEditorCutCopyPasteNonEditable); + EditorTest::add("WebKitWebView", "cut-copy-paste/editable", testWebViewEditorCutCopyPasteEditable); +} + +void afterAll() +{ +} diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp index 099eabda5..20895eccb 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.cpp @@ -116,3 +116,17 @@ void WebViewTest::wait(double seconds) g_timeout_add_seconds(seconds, reinterpret_cast<GSourceFunc>(testLoadTimeoutFinishLoop), m_mainLoop); g_main_loop_run(m_mainLoop); } + +static void loadChanged(WebKitWebView* webView, WebKitLoadEvent loadEvent, WebViewTest* test) +{ + if (loadEvent != WEBKIT_LOAD_FINISHED) + return; + g_signal_handlers_disconnect_by_func(webView, reinterpret_cast<void*>(loadChanged), test); + g_main_loop_quit(test->m_mainLoop); +} + +void WebViewTest::waitUntilLoadFinished() +{ + g_signal_connect(m_webView, "load-changed", G_CALLBACK(loadChanged), this); + g_main_loop_run(m_mainLoop); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h index 882e8b224..4ad6fa648 100644 --- a/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h +++ b/Source/WebKit2/UIProcess/API/gtk/tests/WebViewTest.h @@ -41,6 +41,7 @@ public: void goToBackForwardListItem(WebKitBackForwardListItem*); void wait(double seconds); + void waitUntilLoadFinished(); WebKitWebView* m_webView; GMainLoop* m_mainLoop; diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index e9d892b54..78e53d508 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -27,6 +27,7 @@ #include <webkit2/WebKitBackForwardListItem.h> #include <webkit2/WebKitDefines.h> #include <webkit2/WebKitDownload.h> +#include <webkit2/WebKitEditingCommands.h> #include <webkit2/WebKitEnumTypes.h> #include <webkit2/WebKitError.h> #include <webkit2/WebKitSettings.h> diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm index 7d21e9b7f..728f0e56f 100644 --- a/Source/WebKit2/UIProcess/API/mac/WKView.mm +++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm @@ -1709,7 +1709,7 @@ static bool maybeCreateSandboxExtensionFromPasteboard(NSPasteboard *pasteboard, - (void)_updateWindowVisibility { - _data->_page->updateWindowIsVisible(![[self window] isMiniaturized]); + _data->_page->updateWindowIsVisible([[self window] isVisible]); } - (BOOL)_ownsWindowGrowBox @@ -1924,6 +1924,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl // we hide it first and then update the active state. _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); + [self _updateWindowVisibility]; } - (void)_windowDidOrderOnScreen:(NSNotification *)notification @@ -1932,6 +1933,7 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl // we update the active state first and then make it visible. _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive); _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); + [self _updateWindowVisibility]; } - (void)_windowDidChangeBackingProperties:(NSNotification *)notification @@ -2279,12 +2281,12 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I - (NSRect)_convertToDeviceSpace:(NSRect)rect { - return toDeviceSpace(rect, [self window], _data->_page->deviceScaleFactor()); + return toDeviceSpace(rect, [self window]); } - (NSRect)_convertToUserSpace:(NSRect)rect { - return toUserSpace(rect, [self window], _data->_page->deviceScaleFactor()); + return toUserSpace(rect, [self window]); } // Any non-zero value will do, but using something recognizable might help us debug some day. @@ -2734,6 +2736,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I _data->_pageClient = PageClientImpl::create(self); _data->_page = toImpl(contextRef)->createWebPage(_data->_pageClient.get(), toImpl(pageGroupRef)); _data->_page->initializeWebPage(); + _data->_page->setIntrinsicDeviceScaleFactor([self _intrinsicDeviceScaleFactor]); #if ENABLE(FULLSCREEN_API) _data->_page->fullScreenManager()->setWebView(self); #endif diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp index 206ba2522..22c6703c4 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp @@ -46,31 +46,13 @@ QQuickWebPage::~QQuickWebPage() delete d; } -QtSGUpdateQueue *QQuickWebPage::sceneGraphUpdateQueue() const -{ - return &d->sgUpdateQueue; -} - -void QQuickWebPage::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) -{ - QQuickItem::geometryChanged(newGeometry, oldGeometry); - - if (!d->useTraditionalDesktopBehaviour) - return; - - if (newGeometry.size() != oldGeometry.size()) - d->setDrawingAreaSize(newGeometry.size().toSize()); -} - QQuickWebPagePrivate::QQuickWebPagePrivate(QQuickWebPage* q, QQuickWebView* viewportItem) : q(q) , viewportItem(viewportItem) , webPageProxy(0) - , sgUpdateQueue(q) , paintingIsInitialized(false) , m_paintNode(0) - , contentScale(1) - , useTraditionalDesktopBehaviour(false) + , contentsScale(1) { } @@ -112,7 +94,7 @@ void QQuickWebPagePrivate::paintToCurrentGLContext() return; QTransform transform = q->itemTransform(0, 0); - transform.scale(contentScale, contentScale); + transform.scale(contentsScale, contentsScale); float opacity = computeEffectiveOpacity(q); QRectF clipRect = q->parentItem()->mapRectToScene(q->parentItem()->boundingRect()); @@ -220,47 +202,37 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) return proxyNode; } -bool QQuickWebPage::usesTraditionalDesktopBehaviour() const -{ - return d->useTraditionalDesktopBehaviour; -} - -void QQuickWebPage::setUsesTraditionalDesktopBehaviour(bool enable) -{ - d->useTraditionalDesktopBehaviour = enable; -} - QtWebPageEventHandler* QQuickWebPage::eventHandler() const { return d->eventHandler.data(); } -void QQuickWebPage::setContentSize(const QSizeF& size) +void QQuickWebPage::setContentsSize(const QSizeF& size) { - if (size.isEmpty() || d->contentSize == size) + if (size.isEmpty() || d->contentsSize == size) return; - d->contentSize = size; + d->contentsSize = size; d->updateSize(); - d->setDrawingAreaSize(d->contentSize.toSize()); + d->setDrawingAreaSize(d->contentsSize.toSize()); } -const QSizeF& QQuickWebPage::contentSize() const +const QSizeF& QQuickWebPage::contentsSize() const { - return d->contentSize; + return d->contentsSize; } -void QQuickWebPage::setContentScale(qreal scale) +void QQuickWebPage::setContentsScale(qreal scale) { ASSERT(scale > 0); - d->contentScale = scale; + d->contentsScale = scale; d->updateSize(); } -qreal QQuickWebPage::contentScale() const +qreal QQuickWebPage::contentsScale() const { - ASSERT(d->contentScale > 0); - return d->contentScale; + ASSERT(d->contentsScale > 0); + return d->contentsScale; } QTransform QQuickWebPage::transformFromItem() const @@ -270,12 +242,12 @@ QTransform QQuickWebPage::transformFromItem() const QTransform QQuickWebPage::transformToItem() const { - return QTransform(d->contentScale, 0, 0, 0, d->contentScale, 0, x(), y(), 1); + return QTransform(d->contentsScale, 0, 0, 0, d->contentsScale, 0, x(), y(), 1); } void QQuickWebPagePrivate::updateSize() { - QSizeF scaledSize = contentSize * contentScale; + QSizeF scaledSize = contentsSize * contentsScale; q->setSize(scaledSize); } diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h index bf44b9dc7..9d791ac25 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p.h @@ -31,34 +31,23 @@ class QQuickWebView; class QtWebPageEventHandler; class QWebPreferences; -namespace WebKit { -class QtSGUpdateQueue; -} - class QWEBKIT_EXPORT QQuickWebPage : public QQuickItem { Q_OBJECT public: QQuickWebPage(QQuickWebView* view = 0); virtual ~QQuickWebPage(); - void setContentSize(const QSizeF& size); - const QSizeF& contentSize() const; - void setContentScale(qreal); - qreal contentScale() const; + void setContentsSize(const QSizeF& size); + const QSizeF& contentsSize() const; + void setContentsScale(qreal); + qreal contentsScale() const; QTransform transformFromItem() const; QTransform transformToItem() const; - bool usesTraditionalDesktopBehaviour() const; - void setUsesTraditionalDesktopBehaviour(bool enable); - QtWebPageEventHandler* eventHandler() const; - // Internal. To be removed soon. - WebKit::QtSGUpdateQueue* sceneGraphUpdateQueue() const; - protected: - virtual void geometryChanged(const QRectF&, const QRectF&); virtual QSGNode* updatePaintNode(QSGNode*, UpdatePaintNodeData*); private: diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h index 0c17aa5b5..dfd223dbe 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h @@ -21,7 +21,6 @@ #ifndef qquickwebpage_p_p_h #define qquickwebpage_p_p_h -#include "QtSGUpdateQueue.h" #include "qquickwebpage_p.h" #include <QTransform> @@ -50,13 +49,11 @@ public: QQuickWebPage* const q; QQuickWebView* const viewportItem; WebKit::WebPageProxy* webPageProxy; - WebKit::QtSGUpdateQueue sgUpdateQueue; bool paintingIsInitialized; QSGNode* m_paintNode; - QSizeF contentSize; - qreal contentScale; - bool useTraditionalDesktopBehaviour; + QSizeF contentsSize; + qreal contentsScale; }; #endif // qquickwebpage_p_p_h diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp index 5712ca593..7ea6d347c 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp @@ -55,6 +55,15 @@ using namespace WebCore; +static bool s_flickableViewportEnabled = true; + +static QQuickWebViewPrivate* createPrivateObject(QQuickWebView* publicObject) +{ + if (s_flickableViewportEnabled) + return new QQuickWebViewFlickablePrivate(publicObject); + return new QQuickWebViewLegacyPrivate(publicObject); +} + QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) : q_ptr(viewport) , alertDialog(0) @@ -63,9 +72,6 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) , authenticationDialog(0) , certificateVerificationDialog(0) , itemSelector(0) - , postTransitionState(adoptPtr(new PostTransitionState(this))) - , isTransitioningToNewPage(false) - , pageIsSuspended(false) , m_navigatorQtObjectEnabled(false) , m_renderToOffscreenBuffer(false) { @@ -76,8 +82,6 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) QQuickWebViewPrivate::~QQuickWebViewPrivate() { - if (interactionEngine) - interactionEngine->disconnect(); webPageProxy->close(); } @@ -106,15 +110,11 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa QObject::connect(q_ptr, SIGNAL(urlChanged(QUrl)), iconDatabase, SLOT(requestIconForPageURL(QUrl))); // Any page setting should preferrable be set before creating the page. - setUseTraditionalDesktopBehaviour(false); webPageProxy->pageGroup()->preferences()->setAcceleratedCompositingEnabled(true); webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true); pageClient.initialize(q_ptr, pageViewPrivate->eventHandler.data(), &undoController); webPageProxy->initializeWebPage(); - - // Trigger setting of correct visibility flags after everything was allocated and initialized. - _q_onVisibleChanged(); } void QQuickWebViewPrivate::enableMouseEvents() @@ -131,30 +131,11 @@ void QQuickWebViewPrivate::disableMouseEvents() q->setAcceptHoverEvents(false); } -void QQuickWebViewPrivate::initializeDesktop(QQuickWebView* viewport) -{ - if (interactionEngine) { - QObject::disconnect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), viewport, SLOT(_q_suspend())); - QObject::disconnect(interactionEngine.data(), SIGNAL(contentResumeRequested()), viewport, SLOT(_q_resume())); - QObject::disconnect(interactionEngine.data(), SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), viewport, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&))); - QObject::disconnect(interactionEngine.data(), SIGNAL(visibleContentRectAndScaleChanged()), viewport, SLOT(_q_updateVisibleContentRectAndScale())); - } - interactionEngine.reset(0); - pageView->d->eventHandler->setViewportInteractionEngine(0); - enableMouseEvents(); - updateDesktopViewportSize(); -} - -void QQuickWebViewPrivate::initializeTouch(QQuickWebView* viewport) +void QQuickWebViewPrivate::loadDidSucceed() { - interactionEngine.reset(new QtViewportInteractionEngine(viewport, pageView.data())); - pageView->d->eventHandler->setViewportInteractionEngine(interactionEngine.data()); - disableMouseEvents(); - QObject::connect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), viewport, SLOT(_q_suspend())); - QObject::connect(interactionEngine.data(), SIGNAL(contentResumeRequested()), viewport, SLOT(_q_resume())); - QObject::connect(interactionEngine.data(), SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), viewport, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&))); - QObject::connect(interactionEngine.data(), SIGNAL(visibleContentRectAndScaleChanged()), viewport, SLOT(_q_updateVisibleContentRectAndScale())); - updateTouchViewportSize(); + Q_Q(QQuickWebView); + emit q->navigationStateChanged(); + emit q->loadSucceeded(); } void QQuickWebViewPrivate::setNeedsDisplay() @@ -171,28 +152,6 @@ void QQuickWebViewPrivate::setNeedsDisplay() q->page()->update(); } -void QQuickWebViewPrivate::loadDidCommit() -{ - // Due to entering provisional load before committing, we - // might actually be suspended here. - - if (pageView->usesTraditionalDesktopBehaviour()) - return; - - isTransitioningToNewPage = true; -} - -void QQuickWebViewPrivate::didFinishFirstNonEmptyLayout() -{ - if (pageView->usesTraditionalDesktopBehaviour()) - return; - - if (!pageIsSuspended) { - isTransitioningToNewPage = false; - postTransitionState->apply(); - } -} - void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL) { Q_Q(QQuickWebView); @@ -202,74 +161,15 @@ void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const setIcon(iconURL); } -void QQuickWebViewPrivate::_q_suspend() -{ - pageIsSuspended = true; -} - -void QQuickWebViewPrivate::_q_resume() -{ - pageIsSuspended = false; - - if (isTransitioningToNewPage) { - isTransitioningToNewPage = false; - postTransitionState->apply(); - } - - _q_updateVisibleContentRectAndScale(); -} - -void QQuickWebViewPrivate::didChangeContentsSize(const QSize& newSize) -{ - Q_Q(QQuickWebView); - if (pageView->usesTraditionalDesktopBehaviour()) - return; - - // FIXME: We probably want to handle suspend here as well - if (isTransitioningToNewPage) { - postTransitionState->contentsSize = newSize; - return; - } - - pageView->setContentSize(newSize); - q->m_experimental->viewportInfo()->didUpdateContentsSize(); -} - -void QQuickWebViewPrivate::didChangeViewportProperties(const WebCore::ViewportArguments& args) -{ - if (pageView->usesTraditionalDesktopBehaviour()) - return; - - viewportArguments = args; - - if (isTransitioningToNewPage) - return; - - interactionEngine->applyConstraints(computeViewportConstraints()); -} - void QQuickWebViewPrivate::didChangeBackForwardList() { navigationHistory->d->reset(); } -void QQuickWebViewPrivate::pageDidRequestScroll(const QPoint& pos) -{ - if (pageView->usesTraditionalDesktopBehaviour()) - return; - - if (isTransitioningToNewPage) { - postTransitionState->position = pos; - return; - } - - interactionEngine->pagePositionRequest(pos); -} - void QQuickWebViewPrivate::processDidCrash() { emit q_ptr->navigationStateChanged(); - pageView->d->eventHandler->resetGestureRecognizers(); + pageView->eventHandler()->resetGestureRecognizers(); WebCore::KURL url(WebCore::ParsedURLString, webPageProxy->urlAtProcessExit()); qWarning("WARNING: The web process experienced a crash on '%s'.", qPrintable(QUrl(url).toString(QUrl::RemoveUserInfo))); } @@ -300,24 +200,6 @@ void QQuickWebViewPrivate::handleDownloadRequest(DownloadProxy* download) context->downloadManager()->addDownload(download, downloadItem); } -void QQuickWebViewPrivate::_q_updateVisibleContentRectAndScale() -{ - DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); - if (!drawingArea) - return; - - Q_Q(QQuickWebView); - const QRectF visibleRectInCSSCoordinates = q->mapRectToWebContent(q->boundingRect()).intersected(pageView->boundingRect()); - float scale = pageView->contentScale(); - - QRect alignedVisibleContentRect = visibleRectInCSSCoordinates.toAlignedRect(); - drawingArea->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale); - - // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended. - webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect); - q->m_experimental->viewportInfo()->didUpdateCurrentScale(); -} - void QQuickWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector) { DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); @@ -342,85 +224,6 @@ void QQuickWebViewPrivate::_q_onReceivedResponseFromDownload(QWebDownloadItem* d emit q->experimental()->downloadRequested(downloadItem); } -void QQuickWebViewPrivate::updateDesktopViewportSize() -{ - Q_Q(QQuickWebView); - QSize viewportSize = q->boundingRect().size().toSize(); - pageView->setWidth(viewportSize.width()); - pageView->setHeight(viewportSize.height()); - // The fixed layout is handled by the FrameView and the drawing area doesn't behave differently - // wether its fixed or not. We still need to tell the drawing area which part of it - // has to be rendered on tiles, and in desktop mode it's all of it. - webPageProxy->drawingArea()->setVisibleContentsRectAndScale(IntRect(IntPoint(), viewportSize), 1); -} - -void QQuickWebViewPrivate::updateTouchViewportSize() -{ - Q_Q(QQuickWebView); - QSize viewportSize = q->boundingRect().size().toSize(); - - if (viewportSize.isEmpty()) - return; - - // Let the WebProcess know about the new viewport size, so that - // it can resize the content accordingly. - webPageProxy->setViewportSize(viewportSize); - - interactionEngine->applyConstraints(computeViewportConstraints()); - _q_updateVisibleContentRectAndScale(); -} - -void QQuickWebViewPrivate::PostTransitionState::apply() -{ - p->interactionEngine->reset(); - p->interactionEngine->applyConstraints(p->computeViewportConstraints()); - p->interactionEngine->pagePositionRequest(position); - - if (contentsSize.isValid()) { - p->pageView->setContentSize(contentsSize); - p->q_ptr->experimental()->viewportInfo()->didUpdateContentsSize(); - } - - position = QPoint(); - contentsSize = QSize(); -} - -QtViewportInteractionEngine::Constraints QQuickWebViewPrivate::computeViewportConstraints() -{ - Q_Q(QQuickWebView); - - QtViewportInteractionEngine::Constraints newConstraints; - QSize availableSize = q->boundingRect().size().toSize(); - - // Return default values for zero sized viewport. - if (availableSize.isEmpty()) - return newConstraints; - - WebPreferences* wkPrefs = webPageProxy->pageGroup()->preferences(); - - // FIXME: Remove later; Hardcode some values for now to make sure the DPI adjustment is being tested. - wkPrefs->setDeviceDPI(240); - wkPrefs->setDeviceWidth(480); - wkPrefs->setDeviceHeight(720); - - int minimumLayoutFallbackWidth = qMax<int>(wkPrefs->layoutFallbackWidth(), availableSize.width()); - - WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(viewportArguments, minimumLayoutFallbackWidth, wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize); - WebCore::restrictMinimumScaleFactorToViewportSize(attr, availableSize); - WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr); - - newConstraints.initialScale = attr.initialScale; - newConstraints.minimumScale = attr.minimumScale; - newConstraints.maximumScale = attr.maximumScale; - newConstraints.devicePixelRatio = attr.devicePixelRatio; - newConstraints.isUserScalable = !!attr.userScalable; - newConstraints.layoutSize = attr.layoutSize; - - q->m_experimental->viewportInfo()->didUpdateViewportConstraints(); - - return newConstraints; -} - void QQuickWebViewPrivate::runJavaScriptAlert(const QString& alertText) { if (!alertDialog) @@ -565,20 +368,6 @@ void QQuickWebViewPrivate::_q_onOpenPanelFinished(int result) fileDialog = 0; } -void QQuickWebViewPrivate::setUseTraditionalDesktopBehaviour(bool enable) -{ - Q_Q(QQuickWebView); - - // Do not guard, testing for the same value, as we call this from the constructor. - - webPageProxy->setUseFixedLayout(!enable); - pageView->setUsesTraditionalDesktopBehaviour(enable); - if (enable) - initializeDesktop(q); - else - initializeTouch(q); -} - void QQuickWebViewPrivate::setViewInAttachedProperties(QObject* object) { Q_Q(QQuickWebView); @@ -634,6 +423,236 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String& emit q_ptr->experimental()->messageReceived(variantMap); } +QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport) + : QQuickWebViewPrivate(viewport) +{ +} + +void QQuickWebViewLegacyPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) +{ + QQuickWebViewPrivate::initialize(contextRef, pageGroupRef); + enableMouseEvents(); + + // Trigger setting of correct visibility flags after everything was allocated and initialized. + _q_onVisibleChanged(); +} + +void QQuickWebViewLegacyPrivate::updateViewportSize() +{ + Q_Q(QQuickWebView); + QSize viewportSize = q->boundingRect().size().toSize(); + pageView->setContentsSize(viewportSize); + // The fixed layout is handled by the FrameView and the drawing area doesn't behave differently + // whether its fixed or not. We still need to tell the drawing area which part of it + // has to be rendered on tiles, and in desktop mode it's all of it. + webPageProxy->drawingArea()->setVisibleContentsRectAndScale(IntRect(IntPoint(), viewportSize), 1); +} + +QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* viewport) + : QQuickWebViewPrivate(viewport) + , postTransitionState(adoptPtr(new PostTransitionState(this))) + , isTransitioningToNewPage(false) + , pageIsSuspended(true) + , loadSuccessDispatchIsPending(false) +{ +} + +QQuickWebViewFlickablePrivate::~QQuickWebViewFlickablePrivate() +{ + interactionEngine->disconnect(); +} + +void QQuickWebViewFlickablePrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef) +{ + QQuickWebViewPrivate::initialize(contextRef, pageGroupRef); + webPageProxy->setUseFixedLayout(true); +} + +void QQuickWebViewFlickablePrivate::onComponentComplete() +{ + Q_Q(QQuickWebView); + interactionEngine.reset(new QtViewportInteractionEngine(q, pageView.data())); + pageView->eventHandler()->setViewportInteractionEngine(interactionEngine.data()); + + QObject::connect(interactionEngine.data(), SIGNAL(contentSuspendRequested()), q, SLOT(_q_suspend())); + QObject::connect(interactionEngine.data(), SIGNAL(contentResumeRequested()), q, SLOT(_q_resume())); + QObject::connect(interactionEngine.data(), SIGNAL(viewportTrajectoryVectorChanged(const QPointF&)), q, SLOT(_q_viewportTrajectoryVectorChanged(const QPointF&))); + QObject::connect(interactionEngine.data(), SIGNAL(visibleContentRectAndScaleChanged()), q, SLOT(_q_updateVisibleContentRectAndScale())); + + _q_resume(); + + if (loadSuccessDispatchIsPending) { + QQuickWebViewPrivate::loadDidSucceed(); + loadSuccessDispatchIsPending = false; + } + + // Trigger setting of correct visibility flags after everything was allocated and initialized. + _q_onVisibleChanged(); +} + +void QQuickWebViewFlickablePrivate::loadDidSucceed() +{ + if (interactionEngine) + QQuickWebViewPrivate::loadDidSucceed(); + else + loadSuccessDispatchIsPending = true; + +} + +void QQuickWebViewFlickablePrivate::loadDidCommit() +{ + // Due to entering provisional load before committing, we + // might actually be suspended here. + + isTransitioningToNewPage = true; +} + +void QQuickWebViewFlickablePrivate::didFinishFirstNonEmptyLayout() +{ + if (!pageIsSuspended) { + isTransitioningToNewPage = false; + postTransitionState->apply(); + } +} + +void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportArguments& args) +{ + viewportArguments = args; + + if (isTransitioningToNewPage) + return; + + interactionEngine->applyConstraints(computeViewportConstraints()); +} + +void QQuickWebViewFlickablePrivate::updateViewportSize() +{ + Q_Q(QQuickWebView); + QSize viewportSize = q->boundingRect().size().toSize(); + + if (viewportSize.isEmpty() || !interactionEngine) + return; + + // Let the WebProcess know about the new viewport size, so that + // it can resize the content accordingly. + webPageProxy->setViewportSize(viewportSize); + + interactionEngine->applyConstraints(computeViewportConstraints()); + _q_updateVisibleContentRectAndScale(); +} + +void QQuickWebViewFlickablePrivate::_q_updateVisibleContentRectAndScale() +{ + DrawingAreaProxy* drawingArea = webPageProxy->drawingArea(); + if (!drawingArea) + return; + + Q_Q(QQuickWebView); + const QRectF visibleRectInCSSCoordinates = q->mapRectToWebContent(q->boundingRect()).intersected(pageView->boundingRect()); + float scale = pageView->contentsScale(); + + QRect alignedVisibleContentRect = visibleRectInCSSCoordinates.toAlignedRect(); + drawingArea->setVisibleContentsRectAndScale(alignedVisibleContentRect, scale); + + // FIXME: Once we support suspend and resume, this should be delayed until the page is active if the page is suspended. + webPageProxy->setFixedVisibleContentRect(alignedVisibleContentRect); + q->experimental()->viewportInfo()->didUpdateCurrentScale(); +} + +void QQuickWebViewFlickablePrivate::_q_suspend() +{ + pageIsSuspended = true; +} + +void QQuickWebViewFlickablePrivate::_q_resume() +{ + if (!interactionEngine) + return; + + pageIsSuspended = false; + + if (isTransitioningToNewPage) { + isTransitioningToNewPage = false; + postTransitionState->apply(); + } + + _q_updateVisibleContentRectAndScale(); +} + +void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos) +{ + if (isTransitioningToNewPage) { + postTransitionState->position = pos; + return; + } + + interactionEngine->pagePositionRequest(pos); +} + +void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize) +{ + Q_Q(QQuickWebView); + // FIXME: We probably want to handle suspend here as well + if (isTransitioningToNewPage) { + postTransitionState->contentsSize = newSize; + return; + } + + pageView->setContentsSize(newSize); + q->experimental()->viewportInfo()->didUpdateContentsSize(); +} + +QtViewportInteractionEngine::Constraints QQuickWebViewFlickablePrivate::computeViewportConstraints() +{ + Q_Q(QQuickWebView); + + QtViewportInteractionEngine::Constraints newConstraints; + QSize availableSize = q->boundingRect().size().toSize(); + + // Return default values for zero sized viewport. + if (availableSize.isEmpty()) + return newConstraints; + + WebPreferences* wkPrefs = webPageProxy->pageGroup()->preferences(); + + // FIXME: Remove later; Hardcode some values for now to make sure the DPI adjustment is being tested. + wkPrefs->setDeviceDPI(240); + wkPrefs->setDeviceWidth(480); + wkPrefs->setDeviceHeight(720); + + int minimumLayoutFallbackWidth = qMax<int>(wkPrefs->layoutFallbackWidth(), availableSize.width()); + + WebCore::ViewportAttributes attr = WebCore::computeViewportAttributes(viewportArguments, minimumLayoutFallbackWidth, wkPrefs->deviceWidth(), wkPrefs->deviceHeight(), wkPrefs->deviceDPI(), availableSize); + WebCore::restrictMinimumScaleFactorToViewportSize(attr, availableSize); + WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attr); + + newConstraints.initialScale = attr.initialScale; + newConstraints.minimumScale = attr.minimumScale; + newConstraints.maximumScale = attr.maximumScale; + newConstraints.devicePixelRatio = attr.devicePixelRatio; + newConstraints.isUserScalable = !!attr.userScalable; + newConstraints.layoutSize = attr.layoutSize; + + q->experimental()->viewportInfo()->didUpdateViewportConstraints(); + + return newConstraints; +} + +void QQuickWebViewFlickablePrivate::PostTransitionState::apply() +{ + p->interactionEngine->reset(); + p->interactionEngine->applyConstraints(p->computeViewportConstraints()); + p->interactionEngine->pagePositionRequest(position); + + if (contentsSize.isValid()) { + p->pageView->setContentsSize(contentsSize); + p->q_ptr->experimental()->viewportInfo()->didUpdateContentsSize(); + } + + position = QPoint(); + contentsSize = QSize(); +} + /*! \qmlsignal WebView::onNavigationRequested(request) @@ -674,16 +693,6 @@ QQuickWebViewExperimental::~QQuickWebViewExperimental() { } -void QQuickWebViewExperimental::setUseTraditionalDesktopBehaviour(bool enable) -{ - Q_D(QQuickWebView); - - if (enable == d->pageView->usesTraditionalDesktopBehaviour()) - return; - - d->setUseTraditionalDesktopBehaviour(enable); -} - void QQuickWebViewExperimental::setRenderToOffscreenBuffer(bool enable) { Q_D(QQuickWebView); @@ -696,6 +705,16 @@ bool QQuickWebViewExperimental::renderToOffscreenBuffer() const return d->renderToOffscreenBuffer(); } +void QQuickWebViewExperimental::setFlickableViewportEnabled(bool enable) +{ + s_flickableViewportEnabled = enable; +} + +bool QQuickWebViewExperimental::flickableViewportEnabled() +{ + return s_flickableViewportEnabled; +} + void QQuickWebViewExperimental::postMessage(const QString& message) { Q_D(QQuickWebView); @@ -805,12 +824,6 @@ void QQuickWebViewExperimental::setItemSelector(QDeclarativeComponent* itemSelec emit itemSelectorChanged(); } -bool QQuickWebViewExperimental::useTraditionalDesktopBehaviour() const -{ - Q_D(const QQuickWebView); - return d->pageView->usesTraditionalDesktopBehaviour(); -} - QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property, int index) { const QObjectList children = property->object->children(); @@ -899,7 +912,7 @@ QQuickWebPage* QQuickWebViewExperimental::page() QQuickWebView::QQuickWebView(QQuickItem* parent) : QQuickItem(parent) - , d_ptr(new QQuickWebViewPrivate(this)) + , d_ptr(createPrivateObject(this)) , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); @@ -908,7 +921,7 @@ QQuickWebView::QQuickWebView(QQuickItem* parent) QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent) : QQuickItem(parent) - , d_ptr(new QQuickWebViewPrivate(this)) + , d_ptr(createPrivateObject(this)) , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); @@ -1084,12 +1097,17 @@ void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& old { Q_D(QQuickWebView); QQuickItem::geometryChanged(newGeometry, oldGeometry); - if (newGeometry.size() != oldGeometry.size()) { - if (d->pageView->usesTraditionalDesktopBehaviour()) - d->updateDesktopViewportSize(); - else - d->updateTouchViewportSize(); - } + if (newGeometry.size() != oldGeometry.size()) + d->updateViewportSize(); +} + +void QQuickWebView::componentComplete() +{ + Q_D(QQuickWebView); + QQuickItem::componentComplete(); + + d->onComponentComplete(); + d->updateViewportSize(); } void QQuickWebView::keyPressEvent(QKeyEvent* event) diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h index 7a713d133..69f1cd81b 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h @@ -60,6 +60,10 @@ class QPainter; class QUrl; QT_END_NAMESPACE + +// Instantiating the WebView in C++ is only possible by creating +// a QDeclarativeComponent as the initialization depends on the +// componentComplete method being called. class QWEBKIT_EXPORT QQuickWebView : public QQuickItem { Q_OBJECT Q_PROPERTY(QString title READ title NOTIFY titleChanged) @@ -135,7 +139,7 @@ Q_SIGNALS: protected: virtual void geometryChanged(const QRectF&, const QRectF&); - + virtual void componentComplete(); virtual void keyPressEvent(QKeyEvent*); virtual void keyReleaseEvent(QKeyEvent*); virtual void inputMethodEvent(QInputMethodEvent*); @@ -213,7 +217,6 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject { Q_PROPERTY(QDeclarativeComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged) Q_PROPERTY(QDeclarativeComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged) Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL) - Q_PROPERTY(bool useTraditionalDesktopBehaviour READ useTraditionalDesktopBehaviour WRITE setUseTraditionalDesktopBehaviour) Q_PROPERTY(QWebViewportInfo* viewportInfo READ viewportInfo CONSTANT FINAL) Q_PROPERTY(QDeclarativeListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates) Q_ENUMS(NavigationRequestAction) @@ -238,8 +241,6 @@ public: void setCertificateVerificationDialog(QDeclarativeComponent*); QDeclarativeComponent* itemSelector() const; void setItemSelector(QDeclarativeComponent*); - bool useTraditionalDesktopBehaviour() const; - void setUseTraditionalDesktopBehaviour(bool enable); QWebViewportInfo* viewportInfo(); @@ -258,6 +259,8 @@ public: // C++ only bool renderToOffscreenBuffer() const; void setRenderToOffscreenBuffer(bool enable); + static void setFlickableViewportEnabled(bool enable); + static bool flickableViewportEnabled(); public Q_SLOTS: void goBackTo(int index); diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h index 17a5cf82a..9e27ce322 100644 --- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h @@ -61,32 +61,29 @@ class QQuickWebViewPrivate { public: static QQuickWebViewPrivate* get(QQuickWebView* q) { return q->d_ptr.data(); } - QQuickWebViewPrivate(QQuickWebView* viewport); virtual ~QQuickWebViewPrivate(); - void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0); + virtual void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0); - void initializeTouch(QQuickWebView* viewport); - void initializeDesktop(QQuickWebView* viewport); void enableMouseEvents(); void disableMouseEvents(); - void loadDidCommit(); - - void didFinishFirstNonEmptyLayout(); - void didChangeViewportProperties(const WebCore::ViewportArguments& args); + virtual void loadDidSucceed(); + virtual void onComponentComplete() { } + virtual void loadDidCommit() { } + virtual void didFinishFirstNonEmptyLayout() { } + virtual void didChangeViewportProperties(const WebCore::ViewportArguments& args) { } void didChangeBackForwardList(); void setNeedsDisplay(); - void updateDesktopViewportSize(); + virtual QtViewportInteractionEngine* viewportInteractionEngine() { return 0; } + virtual void updateViewportSize() { } void updateTouchViewportSize(); - QtViewportInteractionEngine::Constraints computeViewportConstraints(); - - void _q_updateVisibleContentRectAndScale(); + virtual void _q_updateVisibleContentRectAndScale() { } - void _q_suspend(); - void _q_resume(); + virtual void _q_suspend() { } + virtual void _q_resume() { } void _q_viewportTrajectoryVectorChanged(const QPointF&); void _q_onOpenPanelFilesSelected(); void _q_onOpenPanelFinished(int result); @@ -102,7 +99,6 @@ public: void handleAuthenticationRequiredRequest(const QString& hostname, const QString& realm, const QString& prefilledUsername, QString& username, QString& password); bool handleCertificateVerificationRequest(const QString& hostname); - void setUseTraditionalDesktopBehaviour(bool enable); void setRenderToOffscreenBuffer(bool enable) { m_renderToOffscreenBuffer = enable; } void setViewInAttachedProperties(QObject*); void setIcon(const QUrl&); @@ -114,30 +110,15 @@ public: // PageClient. WebCore::IntSize viewSize() const; void didReceiveMessageFromNavigatorQtObject(const String& message); - void pageDidRequestScroll(const QPoint& pos); - void didChangeContentsSize(const QSize& newSize); + virtual void pageDidRequestScroll(const QPoint& pos) { } + virtual void didChangeContentsSize(const QSize& newSize) { } void processDidCrash(); void didRelaunchProcess(); PassOwnPtr<DrawingAreaProxy> createDrawingAreaProxy(); void handleDownloadRequest(DownloadProxy*); -private: - // This class is responsible for collecting and applying all properties - // on the viewport item, when transitioning from page A to page B is finished. - // See more at https://trac.webkit.org/wiki/QtWebKitLayoutInteraction - class PostTransitionState { - public: - PostTransitionState(QQuickWebViewPrivate* parent) - : p(parent) - { } - - void apply(); - - QQuickWebViewPrivate* p; - QSize contentsSize; - QPoint position; - }; - +protected: + QQuickWebViewPrivate(QQuickWebView* viewport); RefPtr<QtWebContext> context; RefPtr<WebKit::WebPageProxy> webPageProxy; @@ -151,8 +132,6 @@ private: QScopedPointer<QtWebPageUIClient> pageUIClient; QScopedPointer<QQuickWebPage> pageView; - QScopedPointer<QtViewportInteractionEngine> interactionEngine; - QQuickWebView* q_ptr; QDeclarativeComponent* alertDialog; @@ -163,15 +142,68 @@ private: QDeclarativeComponent* itemSelector; WebCore::ViewportArguments viewportArguments; - OwnPtr<PostTransitionState> postTransitionState; QFileDialog* fileDialog; WKOpenPanelResultListenerRef openPanelResultListener; - bool isTransitioningToNewPage; - bool pageIsSuspended; bool m_navigatorQtObjectEnabled; bool m_renderToOffscreenBuffer; QUrl m_iconURL; }; +class QQuickWebViewLegacyPrivate : public QQuickWebViewPrivate { + Q_DECLARE_PUBLIC(QQuickWebView) +public: + QQuickWebViewLegacyPrivate(QQuickWebView* viewport); + virtual void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0); + + virtual void updateViewportSize(); +}; + +class QQuickWebViewFlickablePrivate : public QQuickWebViewPrivate { + Q_DECLARE_PUBLIC(QQuickWebView) +public: + QQuickWebViewFlickablePrivate(QQuickWebView* viewport); + virtual ~QQuickWebViewFlickablePrivate(); + virtual void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0); + + virtual void loadDidSucceed(); + virtual void onComponentComplete(); + virtual void loadDidCommit(); + virtual void didFinishFirstNonEmptyLayout(); + virtual void didChangeViewportProperties(const WebCore::ViewportArguments& args); + virtual QtViewportInteractionEngine* viewportInteractionEngine() { return interactionEngine.data(); } + virtual void updateViewportSize(); + virtual void _q_updateVisibleContentRectAndScale(); + virtual void _q_suspend(); + virtual void _q_resume(); + + virtual void pageDidRequestScroll(const QPoint& pos); + virtual void didChangeContentsSize(const QSize& newSize); + + QtViewportInteractionEngine::Constraints computeViewportConstraints(); + +private: + // This class is responsible for collecting and applying all properties + // on the viewport item, when transitioning from page A to page B is finished. + // See more at https://trac.webkit.org/wiki/QtWebKitLayoutInteraction + class PostTransitionState { + public: + PostTransitionState(QQuickWebViewFlickablePrivate* parent) + : p(parent) + { } + + void apply(); + + QQuickWebViewFlickablePrivate* p; + QSize contentsSize; + QPoint position; + }; + + QScopedPointer<QtViewportInteractionEngine> interactionEngine; + OwnPtr<PostTransitionState> postTransitionState; + bool isTransitioningToNewPage; + bool pageIsSuspended; + bool loadSuccessDispatchIsPending; +}; + #endif // qquickwebview_p_p_h diff --git a/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp b/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp index 735196f86..22863be29 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp +++ b/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo.cpp @@ -38,63 +38,63 @@ QWebViewportInfo::~QWebViewportInfo() QSize QWebViewportInfo::contentsSize() const { - return QSize(m_webViewPrivate->pageView->contentSize().toSize()); + return QSize(m_webViewPrivate->pageView->contentsSize().toSize()); } QVariant QWebViewportInfo::currentScale() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->currentCSSScale(); - return m_webViewPrivate->interactionEngine->currentCSSScale(); + return QtViewportInteractionEngine::Constraints().initialScale; } QVariant QWebViewportInfo::devicePixelRatio() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().devicePixelRatio; - return m_webViewPrivate->interactionEngine->constraints().devicePixelRatio; + return QtViewportInteractionEngine::Constraints().devicePixelRatio; } QVariant QWebViewportInfo::initialScale() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().initialScale; - return m_webViewPrivate->interactionEngine->constraints().initialScale; + return QtViewportInteractionEngine::Constraints().initialScale; } QVariant QWebViewportInfo::minimumScale() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().minimumScale; - return m_webViewPrivate->interactionEngine->constraints().minimumScale; + return QtViewportInteractionEngine::Constraints().minimumScale; } QVariant QWebViewportInfo::maximumScale() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().maximumScale; - return m_webViewPrivate->interactionEngine->constraints().maximumScale; + return QtViewportInteractionEngine::Constraints().maximumScale; } QVariant QWebViewportInfo::isScalable() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().isUserScalable; - return m_webViewPrivate->interactionEngine->constraints().isUserScalable; + return QtViewportInteractionEngine::Constraints().isUserScalable; } QVariant QWebViewportInfo::layoutSize() const { - if (!m_webViewPrivate->interactionEngine) - return QVariant(); + if (QtViewportInteractionEngine* interactionEngine = m_webViewPrivate->viewportInteractionEngine()) + return interactionEngine->constraints().layoutSize; - return m_webViewPrivate->interactionEngine->constraints().layoutSize; + return QVariant(QSize()); } void QWebViewportInfo::didUpdateContentsSize() diff --git a/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h b/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h index e1dea6575..653018221 100644 --- a/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h +++ b/Source/WebKit2/UIProcess/API/qt/qwebviewportinfo_p.h @@ -29,9 +29,6 @@ #include <QtCore/QVariant> #include <QtDeclarative/QtDeclarative> -namespace WebCore { -class ViewportAttributes; -} class QQuickWebViewPrivate; class QWEBKIT_EXPORT QWebViewportInfo : public QObject { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro index 728521f8a..0f0d4f52c 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro @@ -1,2 +1,3 @@ include(../tests.pri) +SOURCES += $${TARGET}.cpp CONFIG += qtwebkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro new file mode 100644 index 000000000..8b5b3cbb8 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro @@ -0,0 +1,22 @@ +include(../tests.pri) +SOURCES += tst_qmltests.cpp +TARGET = tst_qmltests_DesktopBehavior +OBJECTS_DIR = obj_DesktopBehavior/$$activeBuildConfig() + +CONFIG += qtwebkit-private +CONFIG += warn_on testcase + +QT -= testlib +QT += qmltest + +DEFINES += DISABLE_FLICKABLE_VIEWPORT=1 +# Test the QML files under DesktopBehavior in the source repository. +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}DesktopBehavior\\\"\" +DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" + +OTHER_FILES += \ + DesktopBehavior/DesktopWebView.qml \ + DesktopBehavior/tst_linkHovered.qml \ + DesktopBehavior/tst_loadHtml.qml \ + DesktopBehavior/tst_messaging.qml \ + DesktopBehavior/tst_navigationRequested.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/DesktopWebView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/DesktopWebView.qml deleted file mode 100644 index 4dce0918b..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/DesktopWebView.qml +++ /dev/null @@ -1,9 +0,0 @@ -import QtQuick 2.0 -import QtWebKit 3.0 -import QtWebKit.experimental 3.0 - -WebView { - id: component - experimental.useTraditionalDesktopBehaviour: true -} - diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml index 03d68be5b..432416a63 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_itemSelector.qml @@ -1,13 +1,11 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 -// FIXME: used because we want to have mouseClick() to open the <select> tag. We can remove this +// FIXME: Moved to Desktop tests because we want to have mouseClick() to open the <select> tag. We can move it back // when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083. -import "../DesktopBehavior" - -DesktopWebView { +WebView { id: webView width: 400 diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml index c98958319..b8ab29496 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -DesktopWebView { +WebView { id: webView width: 200 height: 400 diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml index b45b01ac8..9e173d56a 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -DesktopWebView { +WebView { id: webView width: 200 height: 400 diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml index 7fcc91a64..eb18a8216 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_messaging.qml @@ -1,10 +1,10 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 Item { - DesktopWebView { + WebView { id: webView property variant lastMessage experimental.preferences.navigatorQtObjectEnabled: true @@ -13,7 +13,7 @@ Item { } } - DesktopWebView { + WebView { id: otherWebView property variant lastMessage experimental.preferences.navigatorQtObjectEnabled: true @@ -22,7 +22,7 @@ Item { } } - DesktopWebView { + WebView { id: disabledWebView property bool receivedMessage experimental.preferences.navigatorQtObjectEnabled: false diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml index 3ef7d5516..169a0273e 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 Item { property int expectedLength: 0 @@ -11,7 +11,7 @@ Item { property url beginUrl: Qt.resolvedUrl("../common/test2.html") property url endUrl: Qt.resolvedUrl("../common/test1.html") - DesktopWebView { + WebView { id: webView width: 200 height: 200 @@ -51,7 +51,7 @@ Item { signalName: "loadSucceeded" } - DesktopWebView { + WebView { id: otherWebView } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro new file mode 100644 index 000000000..8cd15ff4d --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro @@ -0,0 +1,30 @@ +include(../tests.pri) +SOURCES += tst_qmltests.cpp +TARGET = tst_qmltests_WebView +OBJECTS_DIR = obj_WebView/$$activeBuildConfig() + +CONFIG += qtwebkit-private +CONFIG += warn_on testcase + +QT -= testlib +QT += qmltest + +# Test the QML files under WebView in the source repository. +DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}WebView\\\"\" +DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" + +OTHER_FILES += \ + WebView/tst_favIconLoad.qml \ + WebView/tst_download.qml \ + WebView/tst_geopermission.qml \ + WebView/tst_itemSelector.qml \ + WebView/tst_javaScriptDialogs.qml \ + WebView/tst_loadFail.qml \ + WebView/tst_loadIgnore.qml \ + WebView/tst_loadHtml.qml \ + WebView/tst_loadProgress.qml \ + WebView/tst_loadProgressSignal.qml \ + WebView/tst_preferences.qml \ + WebView/tst_properties.qml \ + WebView/tst_titleChanged.qml \ + WebView/tst_applicationScheme.qml diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml index 239483c5b..8bcb5eccb 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 import Test 1.0 WebView { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml index 6c25af3bc..f8324a606 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 WebView { id: webView diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml index 697ab085a..fd898a78e 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 WebView { id: webView diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml index 56c34abcd..13adb3b2d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 WebView { id: webView diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml index 68aeeb556..b886e48f3 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 WebView { id: webView diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml index 8bec01418..917b689e6 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml @@ -1,7 +1,7 @@ import QtQuick 2.0 import QtTest 1.0 import QtWebKit 3.0 -import QtWebKit.experimental 3.0 +import QtWebKit.experimental 1.0 Item { WebView { diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro index c8ce87a7f..8ddc4484e 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro @@ -1,32 +1,3 @@ -include(../tests.pri) +TEMPLATE = subdirs -CONFIG += qtwebkit-private -CONFIG += warn_on testcase - -QT -= testlib -QT += qmltest - -# QML files tested are the ones in WebKit source repository. -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" -DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" - -OTHER_FILES += \ - DesktopBehavior/DesktopWebView.qml \ - DesktopBehavior/tst_linkHovered.qml \ - DesktopBehavior/tst_loadHtml.qml \ - DesktopBehavior/tst_messaging.qml \ - DesktopBehavior/tst_navigationRequested.qml \ - WebView/tst_favIconLoad.qml \ - WebView/tst_download.qml \ - WebView/tst_geopermission.qml \ - WebView/tst_itemSelector.qml \ - WebView/tst_javaScriptDialogs.qml \ - WebView/tst_loadFail.qml \ - WebView/tst_loadIgnore.qml \ - WebView/tst_loadHtml.qml \ - WebView/tst_loadProgress.qml \ - WebView/tst_loadProgressSignal.qml \ - WebView/tst_preferences.qml \ - WebView/tst_properties.qml \ - WebView/tst_titleChanged.qml \ - WebView/tst_applicationScheme.qml +SUBDIRS += DesktopBehavior.pro WebView.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp index 8c8c4b3e6..a80c5c389 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp @@ -20,6 +20,7 @@ #include "../bytearraytestdata.h" #include "../util.h" +#include "qquickwebview_p.h" #include <QVarLengthArray> #include <QtQuickTest/quicktest.h> #include <QtWidgets/QApplication> @@ -43,5 +44,9 @@ int main(int argc, char** argv) // This can be removed as soon as we do not use QtWidgets any more. QApplication app(argc, argv); qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData"); + +#ifdef DISABLE_FLICKABLE_VIEWPORT + QQuickWebViewExperimental::setFlickableViewportEnabled(false); +#endif return quick_test_main(argc, argv, "qmltests", 0, QUICK_TEST_SOURCE_DIR); } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro index 728521f8a..25cd8324f 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro @@ -1,2 +1,4 @@ include(../tests.pri) +SOURCES += $${TARGET}.cpp CONFIG += qtwebkit-private +DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp index 1d14d1844..db3f9c977 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp @@ -20,6 +20,7 @@ #include "../testwindow.h" #include "../util.h" +#include <QDeclarativeEngine> #include <QScopedPointer> #include <QtTest/QtTest> #include <qquickwebpage_p.h> @@ -55,19 +56,42 @@ private slots: void multipleWebViews(); private: + void prepareWebViewComponent(); + inline QQuickWebView* newWebView(); inline QQuickWebView* webView() const; QScopedPointer<TestWindow> m_window; + QScopedPointer<QDeclarativeComponent> m_component; }; tst_QQuickWebView::tst_QQuickWebView() { addQtWebProcessToPath(); - qRegisterMetaType<QQuickWebPage*>("QQuickWebPage*"); + prepareWebViewComponent(); +} + +void tst_QQuickWebView::prepareWebViewComponent() +{ + static QDeclarativeEngine* engine = new QDeclarativeEngine(this); + engine->addImportPath(QString::fromUtf8(IMPORT_DIR)); + + m_component.reset(new QDeclarativeComponent(engine, this)); + + m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n" + "import QtWebKit 3.0\n" + "WebView {}") + , QUrl()); +} + +QQuickWebView* tst_QQuickWebView::newWebView() +{ + QObject* viewInstance = m_component->create(); + + return qobject_cast<QQuickWebView*>(viewInstance); } void tst_QQuickWebView::init() { - m_window.reset(new TestWindow(new QQuickWebView())); + m_window.reset(new TestWindow(newWebView())); } void tst_QQuickWebView::cleanup() @@ -277,9 +301,9 @@ void tst_QQuickWebView::multipleWebViewWindows() showWebView(); // This should not crash. - QQuickWebView* webView1 = new QQuickWebView(); + QQuickWebView* webView1 = newWebView(); QScopedPointer<TestWindow> window1(new TestWindow(webView1)); - QQuickWebView* webView2 = new QQuickWebView(); + QQuickWebView* webView2 = newWebView(); QScopedPointer<TestWindow> window2(new TestWindow(webView2)); webView1->setSize(QSizeF(300, 400)); @@ -301,9 +325,9 @@ void tst_QQuickWebView::multipleWebViews() showWebView(); // This should not crash. - QScopedPointer<QQuickWebView> webView1(new QQuickWebView()); + QScopedPointer<QQuickWebView> webView1(newWebView()); webView1->setParentItem(m_window->rootItem()); - QScopedPointer<QQuickWebView> webView2(new QQuickWebView()); + QScopedPointer<QQuickWebView> webView2(newWebView()); webView2->setParentItem(m_window->rootItem()); webView1->setSize(QSizeF(300, 400)); @@ -328,7 +352,7 @@ void tst_QQuickWebView::scrollRequest() // COMPARE with the position requested in the html // Use qRound as that is also used when calculating the position // in WebKit. - int y = -qRound(50 * webView()->page()->contentScale()); + int y = -qRound(50 * webView()->page()->contentsScale()); QVERIFY(webView()->page()->pos().y() == y); } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri index 06ff1a0a3..ed91d3942 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri @@ -5,8 +5,7 @@ TARGET = tst_$$TARGET HEADERS += ../bytearraytestdata.h -SOURCES += $${TARGET}.cpp \ - ../util.cpp \ +SOURCES += ../util.cpp \ ../bytearraytestdata.cpp INCLUDEPATH += $$PWD diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp index aa25dd1fd..9bb9783ca 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.cpp @@ -69,9 +69,12 @@ WebCore::IntRect DrawingAreaProxy::contentsRect() const return IntRect(IntPoint::zero(), m_webPageProxy->viewSize()); } +#if USE(TILED_BACKING_STORE) void DrawingAreaProxy::didReceiveLayerTreeHostProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { } #endif +#endif + } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.h b/Source/WebKit2/UIProcess/DrawingAreaProxy.h index 617c17506..c5b713c39 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.h @@ -130,14 +130,6 @@ private: #if PLATFORM(MAC) virtual void didUpdateGeometry() { } #endif -#if USE(TILED_BACKING_STORE) - virtual void snapshotTaken(const UpdateInfo&) { } - virtual void createTile(int tileID, const UpdateInfo& updateInfo) { } - virtual void updateTile(int tileID, const UpdateInfo& updateInfo) { } - virtual void didRenderFrame() { } - virtual void removeTile(int tileID) { } - virtual void allTileUpdatesProcessed() { } -#endif }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in index 89f7328a3..e27b5bf26 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in +++ b/Source/WebKit2/UIProcess/DrawingAreaProxy.messages.in @@ -32,12 +32,4 @@ messages -> DrawingAreaProxy { // Used by TiledCoreAnimationDrawingAreaProxy. DidUpdateGeometry() #endif - -#if USE(TILED_BACKING_STORE) - CreateTile(int tileID, WebKit::UpdateInfo updateInfo) - UpdateTile(int tileID, WebKit::UpdateInfo updateInfo) - DidRenderFrame() - RemoveTile(int tileID) - SnapshotTaken(WebKit::UpdateInfo updateInfo) -#endif } diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp index 065bbbf7f..d6b209286 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp +++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp @@ -33,9 +33,10 @@ namespace WebKit { -WebNotification::WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID) +WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID) : m_title(title) , m_body(body) + , m_iconURL(iconURL) , m_origin(WebSecurityOrigin::createFromString(originString)) , m_notificationID(notificationID) { diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.h b/Source/WebKit2/UIProcess/Notifications/WebNotification.h index 9447da427..4a6fc7e49 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotification.h +++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.h @@ -45,24 +45,26 @@ class WebNotification : public APIObject { public: static const Type APIType = TypeNotification; - static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& originString, uint64_t notificationID) + static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID) { - return adoptRef(new WebNotification(title, body, originString, notificationID)); + return adoptRef(new WebNotification(title, body, iconURL, originString, notificationID)); } const String& title() const { return m_title; } const String& body() const { return m_body; } + const String& iconURL() const { return m_iconURL; } WebSecurityOrigin* origin() const { return m_origin.get(); } uint64_t notificationID() const { return m_notificationID; } private: - WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID); + WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID); virtual Type type() const { return APIType; } String m_title; String m_body; + String m_iconURL; RefPtr<WebSecurityOrigin> m_origin; uint64_t m_notificationID; }; diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp index e74ad07b7..0c0850bee 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp @@ -77,12 +77,12 @@ void WebNotificationManagerProxy::didReceiveMessage(CoreIPC::Connection* connect didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments); } -void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& originString, uint64_t notificationID) +void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID) { if (!isNotificationIDValid(notificationID)) return; - RefPtr<WebNotification> notification = WebNotification::create(title, body, originString, notificationID); + RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, originString, notificationID); m_notifications.set(notificationID, notification); m_provider.show(page, notification.get()); } @@ -111,6 +111,14 @@ void WebNotificationManagerProxy::didDestroyNotification(uint64_t notificationID m_provider.didDestroyNotification(notification.get()); } +void WebNotificationManagerProxy::clearNotifications(const Vector<uint64_t>& notificationIDs) +{ + m_provider.clearNotifications(notificationIDs); + size_t count = notificationIDs.size(); + for (size_t i = 0; i < count; ++i) + m_notifications.remove(notificationIDs[i]); +} + void WebNotificationManagerProxy::providerDidShowNotification(uint64_t notificationID) { if (!m_context) diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h index 8f4b9e9de..d62b9f28f 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h @@ -60,7 +60,7 @@ public: void initializeProvider(const WKNotificationProvider*); void populateCopyOfNotificationPermissions(HashMap<String, bool>&); - void show(WebPageProxy*, const String& title, const String& body, const String& originString, uint64_t notificationID); + void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID); void providerDidShowNotification(uint64_t notificationID); void providerDidClickNotification(uint64_t notificationID); @@ -80,6 +80,7 @@ private: // Message handlers void cancel(uint64_t notificationID); void didDestroyNotification(uint64_t notificationID); + void clearNotifications(const Vector<uint64_t>& notificationIDs); typedef HashMap<uint64_t, RefPtr<WebNotification> > WebNotificationMap; diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in index a06fd0292..a06e92812 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in @@ -23,4 +23,5 @@ messages -> WebNotificationManagerProxy { Cancel(uint64_t notificationID); DidDestroyNotification(uint64_t notificationID); + ClearNotifications(Vector<uint64_t> notificationIDs); } diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp index afd13bccd..133e79aaa 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp @@ -27,9 +27,11 @@ #include "WebNotificationProvider.h" #include "ImmutableDictionary.h" +#include "MutableArray.h" #include "WKAPICast.h" #include "WebNotification.h" #include "WebNotificationManagerProxy.h" +#include "WebNumber.h" #include "WebSecurityOrigin.h" namespace WebKit { @@ -58,6 +60,20 @@ void WebNotificationProvider::didDestroyNotification(WebNotification* notificati m_client.didDestroyNotification(toAPI(notification), m_client.clientInfo); } +void WebNotificationProvider::clearNotifications(const Vector<uint64_t>& notificationIDs) +{ + if (!m_client.clearNotifications) + return; + + RefPtr<MutableArray> arrayIDs = MutableArray::create(); + size_t count = notificationIDs.size(); + arrayIDs->reserveCapacity(count); + for (size_t i = 0; i < count; ++i) + arrayIDs->append(WebUInt64::create(notificationIDs[i]).leakRef()); + + m_client.clearNotifications(toAPI(arrayIDs.get()), m_client.clientInfo); +} + void WebNotificationProvider::addNotificationManager(WebNotificationManagerProxy* manager) { if (!m_client.addNotificationManager) diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h index 8503ee27c..574b887a4 100644 --- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h +++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h @@ -29,6 +29,7 @@ #include "APIClient.h" #include "WKNotificationProvider.h" #include <wtf/Forward.h> +#include <wtf/Vector.h> namespace WebKit { @@ -43,6 +44,7 @@ public: void show(WebPageProxy*, WebNotification*); void cancel(WebNotification*); void didDestroyNotification(WebNotification*); + void clearNotifications(const Vector<uint64_t>& notificationIDs); void addNotificationManager(WebNotificationManagerProxy*); void removeNotificationManager(WebNotificationManagerProxy*); diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp deleted file mode 100644 index 6f544407e..000000000 --- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TiledDrawingAreaProxy.h" - -#if USE(TILED_BACKING_STORE) -#include "DrawingAreaMessages.h" -#include "DrawingAreaProxyMessages.h" -#include "MessageID.h" -#include "NotImplemented.h" -#include "WebCoreArgumentCoders.h" -#include "WebPageProxy.h" -#include "WebProcessProxy.h" - -using namespace WebCore; - -namespace WebKit { - -PassOwnPtr<TiledDrawingAreaProxy> TiledDrawingAreaProxy::create(PlatformWebView* webView, WebPageProxy* webPageProxy) -{ - return adoptPtr(new TiledDrawingAreaProxy(webView, webPageProxy)); -} - -TiledDrawingAreaProxy::TiledDrawingAreaProxy(PlatformWebView* webView, WebPageProxy* webPageProxy) - : DrawingAreaProxy(DrawingAreaTypeTiled, webPageProxy) - , m_isWaitingForDidSetFrameNotification(false) - , m_webView(webView) -{ -} - -TiledDrawingAreaProxy::~TiledDrawingAreaProxy() -{ -} - -void TiledDrawingAreaProxy::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentRect, float scale) -{ - page()->process()->send(Messages::DrawingArea::SetVisibleContentRectAndScale(visibleContentRect, scale), page()->pageID()); -} - -void TiledDrawingAreaProxy::setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint& trajectoryVector) -{ - page()->process()->send(Messages::DrawingArea::SetVisibleContentRectTrajectoryVector(trajectoryVector), page()->pageID()); -} - -void TiledDrawingAreaProxy::renderNextFrame() -{ -} - -void TiledDrawingAreaProxy::sizeDidChange() -{ - WebPageProxy* page = this->page(); - if (!page || !page->isValid()) - return; - - if (m_size.isEmpty()) - return; - - if (m_isWaitingForDidSetFrameNotification) - return; - m_isWaitingForDidSetFrameNotification = true; - - page->process()->responsivenessTimer()->start(); - page->process()->send(Messages::DrawingArea::SetSize(m_size), page->pageID()); -} - -void TiledDrawingAreaProxy::deviceScaleFactorDidChange() -{ - notImplemented(); -} - -} // namespace WebKit - -#endif diff --git a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h b/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h deleted file mode 100644 index 0fcccf4e1..000000000 --- a/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TiledDrawingAreaProxy_h -#define TiledDrawingAreaProxy_h - -#if USE(TILED_BACKING_STORE) - -#include "DrawingAreaProxy.h" -#include <WebCore/GraphicsContext.h> -#include <WebCore/IntRect.h> -#include <WebCore/RunLoop.h> -#include <wtf/HashSet.h> - -#if PLATFORM(MAC) -#include <wtf/RetainPtr.h> -#ifdef __OBJC__ -@class WKView; -#else -class WKView; -#endif -#endif - -namespace WebCore { -class GraphicsContext; -} - -#if PLATFORM(QT) -class QQuickWebPage; -typedef QQuickWebPage PlatformWebView; -#endif - -namespace WebKit { - -class ShareableBitmap; -class TiledDrawingAreaTileSet; -class WebPageProxy; - -#if PLATFORM(MAC) -typedef WKView PlatformWebView; -#elif PLATFORM(WIN) -class WebView; -typedef WebView PlatformWebView; -#endif - -class TiledDrawingAreaProxy : public DrawingAreaProxy { -public: - static PassOwnPtr<TiledDrawingAreaProxy> create(PlatformWebView* webView, WebPageProxy*); - - TiledDrawingAreaProxy(PlatformWebView*, WebPageProxy*); - virtual ~TiledDrawingAreaProxy(); - - void setVisibleContentRectAndScale(const WebCore::IntRect&, float); - void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&); - void renderNextFrame(); - -#if USE(ACCELERATED_COMPOSITING) - virtual void attachCompositingContext(uint32_t /* contextID */) { } - virtual void detachCompositingContext() { } -#endif - -private: - WebPageProxy* page(); - void updateWebView(const Vector<WebCore::IntRect>& paintedArea); - - // DrawingAreaProxy - virtual void sizeDidChange(); - virtual void deviceScaleFactorDidChange(); - - virtual void createTile(int tileID, const UpdateInfo&); - virtual void updateTile(int tileID, const UpdateInfo&); - virtual void didRenderFrame(); - virtual void removeTile(int tileID); - - -private: - bool m_isWaitingForDidSetFrameNotification; - - PlatformWebView* m_webView; -#if PLATFORM(QT) - // Maps tile IDs to node IDs. - HashMap<int, int> m_tileNodeMap; -#endif -}; - -} // namespace WebKit - -#endif // USE(TILED_BACKING_STORE) - -#endif // TiledDrawingAreaProxy_h diff --git a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp index be814c0a9..84280a73d 100644 --- a/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp +++ b/Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp @@ -109,6 +109,7 @@ void WebConnectionToWebProcess::didClose(CoreIPC::Connection* connection) void WebConnectionToWebProcess::didReceiveInvalidMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID) { + RefPtr<WebConnectionToWebProcess> protector = this; RefPtr<WebProcessProxy> process = m_process; // This will invalidate the CoreIPC::Connection and the WebProcessProxy member diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp index 825420a4a..cb5df7906 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.cpp +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.cpp @@ -207,6 +207,8 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr if (!m_page) return; + m_isAttached = shouldOpenAttached(); + WebPageProxy* inspectorPage = platformCreateInspectorPage(); ASSERT(inspectorPage); if (!inspectorPage) @@ -216,7 +218,7 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr inspectorPageParameters = inspectorPage->creationParameters(); String url = inspectorPageURL(); - if (shouldOpenAttached()) + if (m_isAttached) url += "?docked=true"; m_page->process()->assumeReadAccessToBaseURL(inspectorBaseURL()); inspectorPage->loadURL(url); @@ -225,7 +227,6 @@ void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCr void WebInspectorProxy::didLoadInspectorPage() { m_isVisible = true; - m_isAttached = shouldOpenAttached(); // platformOpen is responsible for rendering attached mode depending on m_isAttached. platformOpen(); diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index a70ac700c..56df78cd2 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -34,6 +34,7 @@ #include <wtf/Forward.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> #if PLATFORM(MAC) #include <wtf/RetainPtr.h> @@ -82,6 +83,8 @@ public: void close(); #if PLATFORM(MAC) + void createInspectorWindow(); + void updateInspectorWindowTitle() const; void inspectedViewFrameDidChange(); #elif PLATFORM(GTK) void windowDestroyed(); @@ -175,6 +178,7 @@ private: RetainPtr<WKWebInspectorWKView> m_inspectorView; RetainPtr<NSWindow> m_inspectorWindow; RetainPtr<WKWebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter; + String m_urlString; #elif PLATFORM(WIN) HWND m_inspectorWindow; RefPtr<WebView> m_inspectorView; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index b945ef0b5..85b7d54ca 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -195,6 +195,7 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_mainFrameHasCustomRepresentation(false) , m_mainFrameHasHorizontalScrollbar(false) , m_mainFrameHasVerticalScrollbar(false) + , m_canShortCircuitHorizontalWheelEvents(true) , m_mainFrameIsPinnedToLeftSide(false) , m_mainFrameIsPinnedToRightSide(false) , m_pageCount(0) @@ -1533,7 +1534,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M return; } -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE) if (messageID.is<CoreIPC::MessageClassLayerTreeHostProxy>()) { m_drawingArea->didReceiveLayerTreeHostProxyMessage(connection, messageID, arguments); return; @@ -3377,9 +3378,9 @@ void WebPageProxy::requestNotificationPermission(uint64_t requestID, const Strin request->deny(); } -void WebPageProxy::showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID) +void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID) { - m_process->context()->notificationManagerProxy()->show(this, title, body, originString, notificationID); + m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, originString, notificationID); } float WebPageProxy::headerHeight(WebFrameProxy* frame) @@ -3456,7 +3457,7 @@ void WebPageProxy::didFailToInitializePlugin(const String& mimeType) bool WebPageProxy::willHandleHorizontalScrollEvents() const { - return m_wheelEventHandlerCount > 0; + return !m_canShortCircuitHorizontalWheelEvents; } void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const String& suggestedFilename, const CoreIPC::DataReference& dataReference) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index caa5df4a2..2e64d16ec 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -719,13 +719,13 @@ private: void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide); void didChangePageCount(unsigned); void didFailToInitializePlugin(const String& mimeType); - void numWheelEventHandlersChanged(unsigned count) { m_wheelEventHandlerCount = count; } + void setCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) { m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; } void reattachToWebProcess(); void reattachToWebProcessWithItem(WebBackForwardListItem*); void requestNotificationPermission(uint64_t notificationID, const String& originString); - void showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID); + void showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID); #if USE(TILED_BACKING_STORE) void pageDidRequestScroll(const WebCore::IntPoint&); @@ -1009,7 +1009,9 @@ private: bool m_mainFrameHasHorizontalScrollbar; bool m_mainFrameHasVerticalScrollbar; - int m_wheelEventHandlerCount; + + // Whether horizontal wheel events can be handled directly for swiping purposes. + bool m_canShortCircuitHorizontalWheelEvents; bool m_mainFrameIsPinnedToLeftSide; bool m_mainFrameIsPinnedToRightSide; diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 8c8ce4995..9ba1d5254 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -66,7 +66,7 @@ messages -> WebPageProxy { DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar) DidChangePageCount(unsigned pageCount); DidFailToInitializePlugin(WTF::String mimeType) - NumWheelEventHandlersChanged(unsigned count) + SetCanShortCircuitHorizontalWheelEvents(bool canShortCircuitHorizontalWheelEvents) #if USE(TILED_BACKING_STORE) PageDidRequestScroll(WebCore::IntPoint point) @@ -206,7 +206,7 @@ messages -> WebPageProxy { # Notification messages RequestNotificationPermission(uint64_t requestID, WTF::String originIdentifier) - ShowNotification(WTF::String title, WTF::String body, WTF::String originIdentifier, uint64_t notificationID) + ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String originIdentifier, uint64_t notificationID) # Spelling and grammar messages #if USE(UNIFIED_TEXT_CHECKING) diff --git a/Source/WebKit2/UIProcess/WebPreferences.cpp b/Source/WebKit2/UIProcess/WebPreferences.cpp index efda4cdf0..ca00bb963 100644 --- a/Source/WebKit2/UIProcess/WebPreferences.cpp +++ b/Source/WebKit2/UIProcess/WebPreferences.cpp @@ -41,6 +41,13 @@ WebPreferences::WebPreferences(const String& identifier) platformInitializeStore(); } +WebPreferences::WebPreferences(const WebPreferences& other) + : APIObject() + , m_store(other.m_store) +{ + platformInitializeStore(); +} + WebPreferences::~WebPreferences() { } diff --git a/Source/WebKit2/UIProcess/WebPreferences.h b/Source/WebKit2/UIProcess/WebPreferences.h index 53b610200..1cb9731e1 100644 --- a/Source/WebKit2/UIProcess/WebPreferences.h +++ b/Source/WebKit2/UIProcess/WebPreferences.h @@ -54,6 +54,11 @@ public: return adoptRef(new WebPreferences(identifier)); } + static PassRefPtr<WebPreferences> create(const WebPreferences& other) + { + return adoptRef(new WebPreferences(other)); + } + virtual ~WebPreferences(); void addPageGroup(WebPageGroup*); @@ -75,6 +80,7 @@ public: private: WebPreferences(); WebPreferences(const String& identifier); + WebPreferences(const WebPreferences&); void platformInitializeStore(); diff --git a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm index d43a2ac04..d90ad1215 100644 --- a/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm +++ b/Source/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm @@ -99,25 +99,10 @@ static const CGFloat windowContentBorderThickness = 55; namespace WebKit { -WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() -{ - ASSERT(m_page); - ASSERT(!m_inspectorView); - - m_inspectorView.adoptNS([[WKWebInspectorWKView alloc] initWithFrame:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) contextRef:toAPI(page()->process()->context()) pageGroupRef:toAPI(inspectorPageGroup())]); - ASSERT(m_inspectorView); - - [m_inspectorView.get() setDrawsBackground:NO]; - - return toImpl(m_inspectorView.get().pageRef); -} - -void WebInspectorProxy::platformOpen() +void WebInspectorProxy::createInspectorWindow() { ASSERT(!m_inspectorWindow); - m_inspectorProxyObjCAdapter.adoptNS([[WKWebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]); - bool useTexturedWindow = page()->process()->context()->overrideWebInspectorPagePath().isEmpty(); NSUInteger styleMask = (NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask); @@ -135,31 +120,72 @@ void WebInspectorProxy::platformOpen() WKNSWindowMakeBottomCornersSquare(window); } + NSView *contentView = [window contentView]; + [m_inspectorView.get() setFrame:[contentView bounds]]; + [contentView addSubview:m_inspectorView.get()]; + // Center the window initially before setting the frame autosave name so that the window will be in a good // position if there is no saved frame yet. [window center]; [window setFrameAutosaveName:@"Web Inspector 2"]; - NSView *contentView = [window contentView]; - [m_inspectorView.get() setFrame:[contentView bounds]]; + m_inspectorWindow.adoptNS(window); + + updateInspectorWindowTitle(); +} + +void WebInspectorProxy::updateInspectorWindowTitle() const +{ + if (!m_inspectorWindow) + return; + + NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Web Inspector — %@", "Web Inspector window title"), (NSString *)m_urlString]; + [m_inspectorWindow.get() setTitle:title]; +} + +WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() +{ + ASSERT(m_page); + ASSERT(!m_inspectorView); + + m_inspectorView.adoptNS([[WKWebInspectorWKView alloc] initWithFrame:NSMakeRect(0, 0, initialWindowWidth, initialWindowHeight) contextRef:toAPI(page()->process()->context()) pageGroupRef:toAPI(inspectorPageGroup())]); + ASSERT(m_inspectorView); + + [m_inspectorView.get() setDrawsBackground:NO]; [m_inspectorView.get() setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; - [contentView addSubview:m_inspectorView.get()]; - m_inspectorWindow.adoptNS(window); + m_inspectorProxyObjCAdapter.adoptNS([[WKWebInspectorProxyObjCAdapter alloc] initWithWebInspectorProxy:this]); if (m_isAttached) platformAttach(); else - [window makeKeyAndOrderFront:nil]; + createInspectorWindow(); + + return toImpl(m_inspectorView.get().pageRef); +} + +void WebInspectorProxy::platformOpen() +{ + if (m_isAttached) { + // Make the inspector view visible since it was hidden while loading. + [m_inspectorView.get() setHidden:NO]; + + // Adjust the frames now that we are visible and inspectedViewFrameDidChange wont return early. + inspectedViewFrameDidChange(); + } else + [m_inspectorWindow.get() makeKeyAndOrderFront:nil]; } void WebInspectorProxy::platformDidClose() { - [m_inspectorWindow.get() setDelegate:nil]; - [m_inspectorWindow.get() orderOut:nil]; + if (m_inspectorWindow) { + [m_inspectorWindow.get() setDelegate:nil]; + [m_inspectorWindow.get() orderOut:nil]; + m_inspectorWindow = 0; + } - m_inspectorWindow = 0; m_inspectorView = 0; + m_inspectorProxyObjCAdapter = 0; } @@ -171,13 +197,14 @@ void WebInspectorProxy::platformBringToFront() void WebInspectorProxy::platformInspectedURLChanged(const String& urlString) { - NSString *title = [NSString stringWithFormat:WEB_UI_STRING("Web Inspector — %@", "Web Inspector window title"), (NSString *)urlString]; - [m_inspectorWindow.get() setTitle:title]; + m_urlString = urlString; + + updateInspectorWindowTitle(); } void WebInspectorProxy::inspectedViewFrameDidChange() { - if (!m_isAttached) + if (!m_isAttached || !m_isVisible) return; WKView *inspectedView = m_page->wkView(); @@ -187,7 +214,7 @@ void WebInspectorProxy::inspectedViewFrameDidChange() CGFloat inspectedTop = NSMaxY(inspectedViewFrame); CGFloat inspectedWidth = NSWidth(inspectedViewFrame); CGFloat inspectorHeight = NSHeight([m_inspectorView.get() frame]); - + CGFloat parentHeight = NSHeight([[inspectedView superview] frame]); inspectorHeight = InspectorFrontendClientLocal::constrainedAttachedWindowHeight(inspectorHeight, parentHeight); @@ -213,9 +240,16 @@ void WebInspectorProxy::platformAttach() NSRect inspectedViewFrame = [inspectedView frame]; [m_inspectorView.get() setFrame:NSMakeRect(NSMinX(inspectedViewFrame), 0, NSWidth(inspectedViewFrame), inspectorPageGroup()->preferences()->inspectorAttachedHeight())]; + // Start out hidden if we are not visible yet. When platformOpen is called, hidden will be set to NO. + [m_inspectorView.get() setHidden:!m_isVisible]; + [[inspectedView superview] addSubview:m_inspectorView.get() positioned:NSWindowBelow relativeTo:inspectedView]; - [m_inspectorWindow.get() orderOut:nil]; + if (m_inspectorWindow) { + [m_inspectorWindow.get() setDelegate:nil]; + [m_inspectorWindow.get() orderOut:nil]; + m_inspectorWindow = 0; + } inspectedViewFrameDidChange(); } @@ -227,10 +261,10 @@ void WebInspectorProxy::platformDetach() [m_inspectorView.get() removeFromSuperview]; - // Move the inspector view back into the inspector window. - NSView *inspectorWindowContentView = [m_inspectorWindow.get() contentView]; - [m_inspectorView.get() setFrame:[inspectorWindowContentView bounds]]; - [inspectorWindowContentView addSubview:m_inspectorView.get()]; + createInspectorWindow(); + + // Make the inspector view visible in case it is still hidden from loading while attached. + [m_inspectorView.get() setHidden:NO]; // Make sure that we size the inspected view's frame after detaching so that it takes up the space that the // attached inspector used to. This assumes the previous height was the Y origin. diff --git a/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp b/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp index 8969bbbe3..c7ca7f116 100644 --- a/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp +++ b/Source/WebKit2/UIProcess/qt/LayerTreeHostProxyQt.cpp @@ -26,8 +26,7 @@ #include "MainThread.h" #include "MessageID.h" #include "ShareableBitmap.h" -#include "TextureMapperGL.h" -#include "TextureMapperQt.h" +#include "TextureMapper.h" #include "UpdateInfo.h" #include "WebCoreArgumentCoders.h" #include "WebLayerTreeInfo.h" @@ -171,8 +170,8 @@ LayerTreeHostProxy::~LayerTreeHostProxy() void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& matrix, float opacity, const FloatRect& clipRect) { if (!m_textureMapper) - m_textureMapper = TextureMapperGL::create(); - ASSERT(dynamic_cast<TextureMapperGL*>(m_textureMapper.get())); + m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode); + ASSERT(m_textureMapper->accelerationMode() == TextureMapper::OpenGLMode); syncRemoteContent(); GraphicsLayer* currentRootLayer = rootLayer(); @@ -184,9 +183,6 @@ void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& mat if (!node) return; - GLint viewport[4]; - glGetIntegerv(GL_VIEWPORT, viewport); - m_textureMapper->setViewportSize(IntSize(viewport[2], viewport[3])); node->setTextureMapper(m_textureMapper.get()); m_textureMapper->beginPainting(); m_textureMapper->bindSurface(0); @@ -211,9 +207,8 @@ void LayerTreeHostProxy::paintToCurrentGLContext(const TransformationMatrix& mat void LayerTreeHostProxy::paintToGraphicsContext(QPainter* painter) { if (!m_textureMapper) - m_textureMapper = TextureMapperQt::create(); - ASSERT(dynamic_cast<TextureMapperQt*>(m_textureMapper.get())); - + m_textureMapper = TextureMapper::create(); + ASSERT(m_textureMapper->accelerationMode() == TextureMapper::SoftwareMode); syncRemoteContent(); TextureMapperNode* node = toTextureMapperNode(rootLayer()); @@ -410,7 +405,7 @@ void LayerTreeHostProxy::createImage(int64_t imageID, ShareableBitmap* bitmap) subImage = image.copy(rect); RefPtr<BitmapTexture> texture = m_textureMapper->createTexture(); texture->reset(rect.size(), !imageHasAlpha); - texture->updateRawContents(IntRect(IntPoint::zero(), rect.size()), subImage.constBits()); + texture->updateContents(subImage.constBits(), IntRect(IntPoint::zero(), rect.size())); tiledImage.add(rect.location(), texture); } } @@ -473,7 +468,7 @@ void LayerTreeHostProxy::ensureRootLayer() // The root layer should not have zero size, or it would be optimized out. m_rootLayer->setSize(FloatSize(1.0, 1.0)); if (!m_textureMapper) - m_textureMapper = TextureMapperGL::create(); + m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode); toTextureMapperNode(m_rootLayer.get())->setTextureMapper(m_textureMapper.get()); } diff --git a/Source/WebKit2/UIProcess/qt/QtSGTileNode.cpp b/Source/WebKit2/UIProcess/qt/QtSGTileNode.cpp deleted file mode 100644 index 229bafc7c..000000000 --- a/Source/WebKit2/UIProcess/qt/QtSGTileNode.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2010, 2011 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 program 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 program; 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 "QtSGTileNode.h" - -#include <QtQuick/QSGEngine> -#include <QtQuick/QSGFlatColorMaterial> -#include <QtQuick/QSGTexture> - -namespace WebKit { - -QtSGTileNode::QtSGTileNode(QSGEngine* engine) - : m_engine(engine) - , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4) - , m_textureMaterialsCreated(false) -{ - setFlags(OwnsMaterial | OwnsOpaqueMaterial); - setGeometry(&m_geometry); - setMaterial(new QSGFlatColorMaterial); - setOpaqueMaterial(new QSGFlatColorMaterial); -} - -void QtSGTileNode::setBackBuffer(const QImage& backBuffer, const QRectF& sourceRect, const QRectF& targetRect) -{ - m_backBufferTexture.reset(m_engine->createTextureFromImage(backBuffer)); - m_backBufferTargetRect = targetRect; - m_backBufferSourceRect = m_backBufferTexture->convertToNormalizedSourceRect(sourceRect); - - // Force the texture upload. - m_backBufferTexture->bind(); -} - -void QtSGTileNode::swapBuffersIfNeeded() -{ - if (!m_backBufferTexture) - return; - - if (!m_textureMaterialsCreated) { - setMaterial(new QSGTextureMaterial); - setOpaqueMaterial(new QSGOpaqueTextureMaterial); - m_textureMaterialsCreated = true; - } - - static_cast<QSGTextureMaterial*>(material())->setTexture(m_backBufferTexture.data()); - static_cast<QSGOpaqueTextureMaterial*>(opaqueMaterial())->setTexture(m_backBufferTexture.data()); - markDirty(DirtyMaterial); - - QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_backBufferTargetRect, m_backBufferSourceRect); - markDirty(DirtyGeometry); - - m_frontBufferTexture.swap(m_backBufferTexture); - m_backBufferTexture.reset(); -} - -} diff --git a/Source/WebKit2/UIProcess/qt/QtSGTileNode.h b/Source/WebKit2/UIProcess/qt/QtSGTileNode.h deleted file mode 100644 index 11aaecad8..000000000 --- a/Source/WebKit2/UIProcess/qt/QtSGTileNode.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2011 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 program 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 program; 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 QtSGTileNode_h -#define QtSGTileNode_h - -#include <QtQuick/QSGGeometryNode> -#include <QtQuick/QSGOpaqueTextureMaterial> -#include <QtQuick/QSGTextureMaterial> - -QT_BEGIN_NAMESPACE -class QSGEngine; -class QSGTexture; -QT_END_NAMESPACE - -namespace WebKit { - -class QtSGTileNode : public QSGGeometryNode { -public: - QtSGTileNode(QSGEngine*); - void setBackBuffer(const QImage&, const QRectF& sourceRect, const QRectF& targetRect); - void swapBuffersIfNeeded(); - -private: - QSGEngine* m_engine; - QSGGeometry m_geometry; - QScopedPointer<QSGTexture> m_frontBufferTexture; - QScopedPointer<QSGTexture> m_backBufferTexture; - bool m_textureMaterialsCreated; - - QRectF m_backBufferTargetRect; - QRectF m_backBufferSourceRect; -}; - -} - -#endif // QtSGTileNode_h diff --git a/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.cpp b/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.cpp deleted file mode 100644 index 7b1675dfe..000000000 --- a/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2010, 2011 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 program 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 program; 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 "QtSGUpdateQueue.h" - -#include "PassOwnPtr.h" -#include "QtSGTileNode.h" -#include <QtQuick/QQuickItem> - -namespace WebKit { - -struct NodeUpdateCreateTile : public NodeUpdate { - NodeUpdateCreateTile(int nodeID, float scale) - : NodeUpdate(CreateTile) - , nodeID(nodeID) - , scale(scale) - { } - int nodeID; - float scale; -}; - -struct NodeUpdateRemoveTile : public NodeUpdate { - NodeUpdateRemoveTile(int nodeID) - : NodeUpdate(RemoveTile) - , nodeID(nodeID) - { } - int nodeID; -}; - -struct NodeUpdateSetBackBuffer : public NodeUpdate { - NodeUpdateSetBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect) - : NodeUpdate(SetBackBuffer) - , nodeID(nodeID) - , backBuffer(backBuffer) - , sourceRect(sourceRect) - , targetRect(targetRect) - { } - int nodeID; - QImage backBuffer; - QRect sourceRect; - QRect targetRect; -}; - -struct NodeUpdateSwapTileBuffers : public NodeUpdate { - NodeUpdateSwapTileBuffers() - : NodeUpdate(SwapTileBuffers) - { } -}; - -QtSGUpdateQueue::QtSGUpdateQueue(QQuickItem *item) - : item(item) - , lastScale(0) - , lastScaleNode(0) - , nextNodeID(1) - , m_isSwapPending(false) -{ -} - -int QtSGUpdateQueue::createTileNode(float scale) -{ - int nodeID = nextNodeID++; - nodeUpdateQueue.append(adoptPtr(new NodeUpdateCreateTile(nodeID, scale))); - item->update(); - return nodeID; -} - -void QtSGUpdateQueue::removeTileNode(int nodeID) -{ - nodeUpdateQueue.append(adoptPtr(new NodeUpdateRemoveTile(nodeID))); - item->update(); -} - -void QtSGUpdateQueue::setNodeBackBuffer(int nodeID, const QImage& backBuffer, const QRect& sourceRect, const QRect& targetRect) -{ - nodeUpdateQueue.append(adoptPtr(new NodeUpdateSetBackBuffer(nodeID, backBuffer, sourceRect, targetRect))); - item->update(); -} - -void QtSGUpdateQueue::swapTileBuffers() -{ - nodeUpdateQueue.append(adoptPtr(new NodeUpdateSwapTileBuffers())); - m_isSwapPending = true; - item->update(); -} - -void QtSGUpdateQueue::applyUpdates(QSGNode* itemNode) -{ - while (!nodeUpdateQueue.isEmpty()) { - OwnPtr<NodeUpdate> nodeUpdate(nodeUpdateQueue.takeFirst()); - switch (nodeUpdate->type) { - case NodeUpdate::CreateTile: { - NodeUpdateCreateTile* createTileUpdate = static_cast<NodeUpdateCreateTile*>(nodeUpdate.get()); - QtSGTileNode* tileNode = new QtSGTileNode(item->sceneGraphEngine()); - getScaleNode(createTileUpdate->scale, itemNode)->prependChildNode(tileNode); - nodes.set(createTileUpdate->nodeID, tileNode); - break; - } - case NodeUpdate::RemoveTile: { - NodeUpdateRemoveTile* removeUpdate = static_cast<NodeUpdateRemoveTile*>(nodeUpdate.get()); - QSGNode* node = nodes.take(removeUpdate->nodeID); - QSGNode* scaleNode = node->parent(); - - scaleNode->removeChildNode(node); - if (!scaleNode->childCount()) { - if (scaleNode == lastScaleNode) { - lastScale = 0; - lastScaleNode = 0; - } - delete scaleNode; - } - delete node; - break; - } - case NodeUpdate::SetBackBuffer: { - NodeUpdateSetBackBuffer* setBackBufferUpdate = static_cast<NodeUpdateSetBackBuffer*>(nodeUpdate.get()); - QtSGTileNode* tileNode = nodes.get(setBackBufferUpdate->nodeID); - tileNode->setBackBuffer(setBackBufferUpdate->backBuffer, setBackBufferUpdate->sourceRect, setBackBufferUpdate->targetRect); - break; - } - case NodeUpdate::SwapTileBuffers: { - HashMap<int, QtSGTileNode*>::iterator end = nodes.end(); - for (HashMap<int, QtSGTileNode*>::iterator it = nodes.begin(); it != end; ++it) - it->second->swapBuffersIfNeeded(); - m_isSwapPending = false; - break; - } - default: - ASSERT_NOT_REACHED(); - } - } -} - -QSGNode* QtSGUpdateQueue::getScaleNode(float scale, QSGNode* itemNode) -{ - if (scale == lastScale) - return lastScaleNode; - - QSGTransformNode* scaleNode = new QSGTransformNode; - QMatrix4x4 scaleMatrix; - // Use scale(float,float) to prevent scaling the Z component. - // Reverse the item's transform scale since our tiles were generated for this specific scale. - scaleMatrix.scale(1 / scale, 1 / scale); - scaleNode->setMatrix(scaleMatrix); - // Prepend instead of append to paint the new, incomplete, scale before/behind the previous one. - itemNode->prependChildNode(scaleNode); - - lastScale = scale; - lastScaleNode = scaleNode; - return lastScaleNode; -} - -} diff --git a/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.h b/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.h deleted file mode 100644 index f70c50668..000000000 --- a/Source/WebKit2/UIProcess/qt/QtSGUpdateQueue.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2011 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 program 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 program; 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 QtSGUpdateQueue_h -#define QtSGUpdateQueue_h - -#include "Deque.h" -#include "HashMap.h" -#include "OwnPtr.h" - -class QImage; -class QRect; -class QQuickItem; -class QSGNode; -class QSize; - -namespace WebKit { - -class NodeUpdate; -class PageNode; -class QtSGTileNode; - -// Takes care of taking update requests then fulfilling them asynchronously on the scene graph thread. -class QtSGUpdateQueue { -public: - QtSGUpdateQueue(QQuickItem*); - - int createTileNode(float scale); - void removeTileNode(int nodeID); - void setNodeBackBuffer(int nodeID, const QImage& texture, const QRect& sourceRect, const QRect& targetRect); - void swapTileBuffers(); - - // Called by the QQuickItem. - void applyUpdates(QSGNode* itemNode); - bool isSwapPending() const { return m_isSwapPending; } - -private: - QSGNode* getScaleNode(float scale, QSGNode* itemNode); - - QQuickItem* item; - Deque<OwnPtr<NodeUpdate> > nodeUpdateQueue; - HashMap<int, QtSGTileNode*> nodes; - float lastScale; - QSGNode* lastScaleNode; - int nextNodeID; - bool m_isSwapPending; -}; - -struct NodeUpdate { - enum Type { - CreateTile, - RemoveTile, - SetBackBuffer, - SwapTileBuffers - }; - NodeUpdate(Type type) - : type(type) - { } - virtual ~NodeUpdate() { } - Type type; -}; - -} - -#endif // QtSGUpdateQueue_h diff --git a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp index d2eb1566d..62400fa42 100644 --- a/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp +++ b/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp @@ -180,7 +180,7 @@ void QtViewportInteractionEngine::setItemRectVisible(const QRectF& itemRect) qreal itemScale = m_viewport->width() / itemRect.width(); - m_content->setContentScale(itemScale); + m_content->setContentsScale(itemScale); // We need to animate the content but the position represents the viewport hence we need to invert the position here. // To animate the position together with the scale we multiply the position with the current scale; @@ -244,7 +244,7 @@ bool QtViewportInteractionEngine::event(QEvent* event) QScrollPrepareEvent* prepareEvent = static_cast<QScrollPrepareEvent*>(event); const QRectF viewportRect = m_viewport->boundingRect(); const QRectF contentRect = m_viewport->mapRectFromItem(m_content, m_content->boundingRect()); - const QRectF posRange = computePosRangeForItemAtScale(m_content->contentScale()); + const QRectF posRange = computePosRangeForItemAtScale(m_content->contentsScale()); prepareEvent->setContentPosRange(posRange); prepareEvent->setViewportSize(viewportRect.size()); @@ -303,7 +303,7 @@ void QtViewportInteractionEngine::wheelEvent(QWheelEvent* ev) else newPos.ry() += delta; - QRectF endPosRange = computePosRangeForItemAtScale(m_content->contentScale()); + QRectF endPosRange = computePosRangeForItemAtScale(m_content->contentsScale()); m_content->setPos(-boundPosition(endPosRange.topLeft(), newPos, endPosRange.bottomRight())); emit visibleContentRectAndScaleChanged(); @@ -315,7 +315,7 @@ void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition if (m_suspendCount) return; - qreal endItemScale = m_content->contentScale(); // Stay at same scale. + qreal endItemScale = m_content->contentsScale(); // Stay at same scale. QRectF endPosRange = computePosRangeForItemAtScale(endItemScale); QPointF endPosition = boundPosition(endPosRange.topLeft(), pagePosition * endItemScale, endPosRange.bottomRight()); @@ -327,7 +327,7 @@ void QtViewportInteractionEngine::pagePositionRequest(const QPoint& pagePosition QRectF QtViewportInteractionEngine::computePosRangeForItemAtScale(qreal itemScale) const { - const QSizeF contentItemSize = m_content->contentSize() * itemScale; + const QSizeF contentItemSize = m_content->contentsSize() * itemScale; const QSizeF viewportItemSize = m_viewport->boundingRect().size(); const qreal horizontalRange = contentItemSize.width() - viewportItemSize.width(); @@ -449,7 +449,7 @@ void QtViewportInteractionEngine::applyConstraints(const Constraints& constraint if (!m_hadUserInteraction) { qreal initialScale = innerBoundedCSSScale(m_constraints.initialScale); - m_content->setContentScale(itemScaleFromCSS(initialScale)); + m_content->setContentsScale(itemScaleFromCSS(initialScale)); } // If the web app changes successively changes the viewport on purpose @@ -459,7 +459,7 @@ void QtViewportInteractionEngine::applyConstraints(const Constraints& constraint qreal QtViewportInteractionEngine::currentCSSScale() { - return cssScaleFromItem(m_content->contentScale()); + return cssScaleFromItem(m_content->contentsScale()); } bool QtViewportInteractionEngine::scrollAnimationActive() const @@ -532,7 +532,7 @@ void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenter m_scaleUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this)); m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates; - m_pinchStartScale = m_content->contentScale(); + m_pinchStartScale = m_content->contentsScale(); // Reset the tiling look-ahead vector so that tiles all around the viewport will be requested on pinch-end. emit viewportTrajectoryVectorChanged(QPointF()); @@ -586,7 +586,7 @@ void QtViewportInteractionEngine::itemSizeChanged() void QtViewportInteractionEngine::scaleContent(const QPointF& centerInCSSCoordinates, qreal cssScale) { QPointF oldPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); - m_content->setContentScale(itemScaleFromCSS(cssScale)); + m_content->setContentsScale(itemScaleFromCSS(cssScale)); QPointF newPinchCenterOnViewport = m_viewport->mapFromWebContent(centerInCSSCoordinates); m_content->setPos(m_content->pos() - (newPinchCenterOnViewport - oldPinchCenterOnViewport)); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp index 09f896021..a07967801 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp @@ -87,6 +87,7 @@ static inline WebCore::DragOperation dropActionToDragOperation(Qt::DropActions a QtWebPageEventHandler::QtWebPageEventHandler(WKPageRef pageRef, QQuickWebPage* qmlWebPage, QQuickWebView* qmlWebView) : m_webPageProxy(toImpl(pageRef)) + , m_interactionEngine(0) , m_panGestureRecognizer(this) , m_pinchGestureRecognizer(this) , m_tapGestureRecognizer(this) @@ -297,7 +298,7 @@ void QtWebPageEventHandler::handleSingleTapEvent(const QTouchEvent::TouchPoint& m_postponeTextInputStateChanged = true; QTransform fromItemTransform = m_webPage->transformFromItem(); - WebGestureEvent gesture(WebEvent::GestureSingleTap, fromItemTransform.map(point.pos()).toPoint(), point.screenPos().toPoint(), WebEvent::Modifiers(0), 0); + WebGestureEvent gesture(WebEvent::GestureSingleTap, fromItemTransform.map(point.pos()).toPoint(), point.screenPos().toPoint(), WebEvent::Modifiers(0), 0, IntSize(point.rect().size().toSize()), FloatPoint(0, 0)); m_webPageProxy->handleGestureEvent(gesture); } diff --git a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp index 3ba8c74f6..2601f4802 100644 --- a/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp +++ b/Source/WebKit2/UIProcess/qt/QtWebPageLoadClient.cpp @@ -85,8 +85,7 @@ void QtWebPageLoadClient::didChangeBackForwardList() void QtWebPageLoadClient::dispatchLoadSucceeded() { - emit m_webView->navigationStateChanged(); - emit m_webView->loadSucceeded(); + m_webView->d_func()->loadDidSucceed(); } void QtWebPageLoadClient::dispatchLoadFailed(WKErrorRef error) diff --git a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp b/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp deleted file mode 100644 index 2c76062f5..000000000 --- a/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TiledDrawingAreaProxy.h" - -#include "QtSGUpdateQueue.h" -#include "qquickwebpage_p.h" -#include "ShareableBitmap.h" -#include "UpdateInfo.h" -#include "WKAPICast.h" -#include "WebPageProxy.h" - -using namespace WebCore; - -#define TILE_DEBUG_LOG - -namespace WebKit { - -void TiledDrawingAreaProxy::updateWebView(const Vector<IntRect>& paintedArea) -{ - // SG updates are triggered through QtSGUpdateQueue. -} - -WebPageProxy* TiledDrawingAreaProxy::page() -{ - return m_webPageProxy; -} - -void TiledDrawingAreaProxy::createTile(int tileID, const UpdateInfo& updateInfo) -{ - int nodeID = m_webView->sceneGraphUpdateQueue()->createTileNode(updateInfo.updateScaleFactor); - m_tileNodeMap.set(tileID, nodeID); - updateTile(tileID, updateInfo); -} - -void TiledDrawingAreaProxy::updateTile(int tileID, const UpdateInfo& updateInfo) -{ - int nodeID = m_tileNodeMap.get(tileID); - ASSERT(nodeID); - - RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle); - // FIXME: We could avoid this copy by carying the ShareableBitmap all the way up to texture uploading. - // Currently won't work since the SharedMemory handle is owned by updateInfo. - QImage image(bitmap->createQImage().copy()); - QRect sourceRect(0, 0, updateInfo.updateRectBounds.width(), updateInfo.updateRectBounds.height()); - m_webView->sceneGraphUpdateQueue()->setNodeBackBuffer(nodeID, image, sourceRect, updateInfo.updateRectBounds); -} - -void TiledDrawingAreaProxy::didRenderFrame() -{ - m_webView->sceneGraphUpdateQueue()->swapTileBuffers(); -} - -void TiledDrawingAreaProxy::removeTile(int tileID) -{ - int nodeID = m_tileNodeMap.take(tileID); - m_webView->sceneGraphUpdateQueue()->removeTileNode(nodeID); -} - -} // namespace WebKit diff --git a/Source/WebKit2/WebKit2.pri b/Source/WebKit2/WebKit2.pri index 1fdcf2614..a82ee7787 100644 --- a/Source/WebKit2/WebKit2.pri +++ b/Source/WebKit2/WebKit2.pri @@ -61,7 +61,7 @@ INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/WebKit/qt/Api INCLUDEPATH += $$WEBKIT2_GENERATED_SOURCES_DIR -linux-g++*: { +linux-*: { # -lrt is required for shm_open and shm_unlink. LIBS += -lrt } diff --git a/Source/WebKit2/WebProcess/Downloads/Download.h b/Source/WebKit2/WebProcess/Downloads/Download.h index 0387efa66..2688b72d1 100644 --- a/Source/WebKit2/WebProcess/Downloads/Download.h +++ b/Source/WebKit2/WebProcess/Downloads/Download.h @@ -47,6 +47,10 @@ OBJC_CLASS WKDownloadAsDelegate; #include <CFNetwork/CFURLDownloadPriv.h> #endif +#if PLATFORM(EFL) +#include <FileDownloaderEfl.h> +#endif + namespace CoreIPC { class DataReference; } @@ -69,6 +73,10 @@ class WebPage; class QtFileDownloader; #endif +#if PLATFORM(EFL) +class FileDownloaderEfl; +#endif + class Download : public CoreIPC::MessageSender<Download> { WTF_MAKE_NONCOPYABLE(Download); public: @@ -146,6 +154,9 @@ private: OwnPtr<WebCore::ResourceHandleClient> m_downloadClient; RefPtr<WebCore::ResourceHandle> m_resourceHandle; #endif +#if PLATFORM(EFL) + OwnPtr<FileDownloaderEfl> m_fileDownloader; +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp index 7d098f133..9828c2b0c 100755 --- a/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp +++ b/Source/WebKit2/WebProcess/Downloads/efl/DownloadEfl.cpp @@ -20,6 +20,7 @@ #include "config.h" #include "Download.h" +#include "FileDownloaderEfl.h" #include <WebCore/NotImplemented.h> using namespace WebCore; @@ -28,7 +29,8 @@ namespace WebKit { void Download::start(WebPage* initiatingWebPage) { - notImplemented(); + m_fileDownloader = FileDownloaderEfl::create(this); + m_fileDownloader->start(initiatingWebPage, m_request); } void Download::startWithHandle(WebPage* initiatingPage, ResourceHandle* handle, const ResourceResponse& response) diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp new file mode 100644 index 000000000..8f17840e1 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.cpp @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "FileDownloaderEfl.h" + +#include <WebCore/NotImplemented.h> + +using namespace WebCore; + +namespace WebKit { + +PassOwnPtr<FileDownloaderEfl> FileDownloaderEfl::create(Download* download) +{ + return adoptPtr(new FileDownloaderEfl(download)); +} + +FileDownloaderEfl::FileDownloaderEfl(Download* download) + : m_download(download) +{ + ASSERT(download); +} + +FileDownloaderEfl::~FileDownloaderEfl() +{ +} + +void FileDownloaderEfl::start(WebPage*, ResourceRequest&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didReceiveResponse(ResourceHandle*, const ResourceResponse&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didReceiveData(ResourceHandle*, const char*, int, int) +{ + notImplemented(); +} + +void FileDownloaderEfl::didFinishLoading(ResourceHandle*, double) +{ + notImplemented(); +} + +void FileDownloaderEfl::didFail(ResourceHandle*, const ResourceError&) +{ + notImplemented(); +} + +bool FileDownloaderEfl::shouldUseCredentialStorage(ResourceHandle*) +{ + return false; +} + +void FileDownloaderEfl::didReceiveAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FileDownloaderEfl::didCancelAuthenticationChallenge(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FileDownloaderEfl::receivedCancellation(ResourceHandle*, const AuthenticationChallenge&) +{ + notImplemented(); +} + +} // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h new file mode 100644 index 000000000..d8f998be9 --- /dev/null +++ b/Source/WebKit2/WebProcess/Downloads/efl/FileDownloaderEfl.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * 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; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef FileDownloaderEfl_h +#define FileDownloaderEfl_h + +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceHandle.h> +#include <WebCore/ResourceHandleClient.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> +#include <wtf/PassOwnPtr.h> + +namespace WebCore { +class AuthenticationChallenge; +class ResourceError; +class ResourceHandle; +class ResourceHandleClient; +class ResourceRequest; +class ResourceResponse; +} + +namespace WebKit { + +class Download; +class WebPage; + +class FileDownloaderEfl : public WebCore::ResourceHandleClient { +public: + static PassOwnPtr<FileDownloaderEfl> create(Download*); + virtual ~FileDownloaderEfl(); + + void start(WebPage*, WebCore::ResourceRequest&); + + // callbacks for ResourceHandleClient, which are called by ResourceHandle + virtual void didReceiveResponse(WebCore::ResourceHandle*, const WebCore::ResourceResponse&) OVERRIDE; + virtual void didReceiveData(WebCore::ResourceHandle*, const char* data, int length, int encodedDataLength) OVERRIDE; + virtual void didFinishLoading(WebCore::ResourceHandle*, double finishTime) OVERRIDE; + virtual void didFail(WebCore::ResourceHandle*, const WebCore::ResourceError&) OVERRIDE; + virtual bool shouldUseCredentialStorage(WebCore::ResourceHandle*) OVERRIDE; + virtual void didReceiveAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + virtual void didCancelAuthenticationChallenge(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + virtual void receivedCancellation(WebCore::ResourceHandle*, const WebCore::AuthenticationChallenge&) OVERRIDE; + +private: + FileDownloaderEfl(Download*); + + Download* m_download; +}; + +} // namespace WebKit + +#endif // FileDownloaderEfl_h diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp index f2d5cb42a..4f86778bd 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.cpp @@ -249,8 +249,13 @@ void WKBundleFrameSetTextDirection(WKBundleFrameRef frameRef, WKStringRef direct WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frameRef) { + return WKBundleFrameCopyWebArchiveFilteringSubframes(frameRef, 0, 0); +} + +WKDataRef WKBundleFrameCopyWebArchiveFilteringSubframes(WKBundleFrameRef frameRef, WKBundleFrameFrameFilterCallback frameFilterCallback, void* context) +{ #if PLATFORM(MAC) || PLATFORM(WIN) - RetainPtr<CFDataRef> data = toImpl(frameRef)->webArchiveData(); + RetainPtr<CFDataRef> data = toImpl(frameRef)->webArchiveData(frameFilterCallback, context); if (data) return WKDataCreate(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get())); #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h index 8f2781a69..021aec0ed 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleFrame.h @@ -71,9 +71,12 @@ WK_EXPORT bool WKBundleFrameGetDocumentBackgroundColor(WKBundleFrameRef frame, d WK_EXPORT WKStringRef WKBundleFrameCopySuggestedFilenameForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); WK_EXPORT WKStringRef WKBundleFrameCopyMIMETypeForResourceWithURL(WKBundleFrameRef frame, WKURLRef url); - + WK_EXPORT WKDataRef WKBundleFrameCopyWebArchive(WKBundleFrameRef frame); +typedef bool (*WKBundleFrameFrameFilterCallback)(WKBundleFrameRef frame, WKBundleFrameRef subframe, void* context); +WK_EXPORT WKDataRef WKBundleFrameCopyWebArchiveFilteringSubframes(WKBundleFrameRef frame, WKBundleFrameFrameFilterCallback frameFilterCallback, void* context); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h index 7da8d0a3d..53276b089 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h @@ -164,10 +164,14 @@ typedef void (*WKBundlePageDidReceiveResponseForResourceCallback)(WKBundlePageRe typedef void (*WKBundlePageDidReceiveContentLengthForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, uint64_t contentLength, const void* clientInfo); typedef void (*WKBundlePageDidFinishLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo); typedef void (*WKBundlePageDidFailLoadForResourceCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, WKErrorRef, const void* clientInfo); +typedef bool (*WKBundlePageShouldCacheResponseCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo); +typedef bool (*WKBundlePageShouldUseCredentialStorageCallback)(WKBundlePageRef, WKBundleFrameRef, uint64_t resourceIdentifier, const void* clientInfo); struct WKBundlePageResourceLoadClient { int version; const void * clientInfo; + + // Version 0. WKBundlePageDidInitiateLoadForResourceCallback didInitiateLoadForResource; // willSendRequestForFrame is supposed to return a retained reference to the URL request. @@ -177,10 +181,14 @@ struct WKBundlePageResourceLoadClient { WKBundlePageDidReceiveContentLengthForResourceCallback didReceiveContentLengthForResource; WKBundlePageDidFinishLoadForResourceCallback didFinishLoadForResource; WKBundlePageDidFailLoadForResourceCallback didFailLoadForResource; + + // Version 1. + WKBundlePageShouldCacheResponseCallback shouldCacheResponse; + WKBundlePageShouldUseCredentialStorageCallback shouldUseCredentialStorage; }; typedef struct WKBundlePageResourceLoadClient WKBundlePageResourceLoadClient; -enum { kWKBundlePageResourceLoadClientCurrentVersion = 0 }; +enum { kWKBundlePageResourceLoadClientCurrentVersion = 1 }; enum { WKBundlePageUIElementVisibilityUnknown, diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp index 49dcac6cc..3efe74d46 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.cpp @@ -85,4 +85,20 @@ void InjectedBundlePageResourceLoadClient::didFailLoadForResource(WebPage* page, m_client.didFailLoadForResource(toAPI(page), toAPI(frame), identifier, toAPI(error), m_client.clientInfo); } +bool InjectedBundlePageResourceLoadClient::shouldCacheResponse(WebPage* page, WebFrame* frame, uint64_t identifier) +{ + if (!m_client.shouldCacheResponse) + return true; + + return m_client.shouldCacheResponse(toAPI(page), toAPI(frame), identifier, m_client.clientInfo); +} + +bool InjectedBundlePageResourceLoadClient::shouldUseCredentialStorage(WebPage* page, WebFrame* frame, uint64_t identifier) +{ + if (!m_client.shouldUseCredentialStorage) + return true; + + return m_client.shouldUseCredentialStorage(toAPI(page), toAPI(frame), identifier, m_client.clientInfo); +} + } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h index 68c68205c..e6c2bdfc7 100644 --- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h +++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageResourceLoadClient.h @@ -52,6 +52,8 @@ public: void didReceiveContentLengthForResource(WebPage*, WebFrame*, uint64_t identifier, uint64_t contentLength); void didFinishLoadForResource(WebPage*, WebFrame*, uint64_t identifier); void didFailLoadForResource(WebPage*, WebFrame*, uint64_t identifier, const WebCore::ResourceError&); + bool shouldCacheResponse(WebPage*, WebFrame*, uint64_t identifier); + bool shouldUseCredentialStorage(WebPage*, WebFrame*, uint64_t identifier); }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp index 0c865292d..84b52c2ac 100644 --- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp +++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp @@ -33,6 +33,7 @@ #include "WebNotification.h" #include "WebNotificationManagerProxyMessages.h" #include "WebPageProxyMessages.h" +#include <WebCore/Document.h> #include <WebCore/Notification.h> #include <WebCore/Page.h> #include <WebCore/ScriptExecutionContext.h> @@ -113,9 +114,18 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page) m_notificationMap.set(notification, notificationID); m_notificationIDMap.set(notificationID, notification); - m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID()); -#endif + NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext()); + if (it == m_notificationContextMap.end()) { + pair<NotificationContextMap::iterator, bool> addedPair = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()); + it = addedPair.first; + } + it->second.append(notificationID); + + m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->iconURL().string(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID()); return true; +#else + return false; +#endif } void WebNotificationManager::cancel(Notification* notification, WebPage* page) @@ -132,6 +142,18 @@ void WebNotificationManager::cancel(Notification* notification, WebPage* page) #endif } +void WebNotificationManager::clearNotifications(WebCore::ScriptExecutionContext* context, WebPage* page) +{ +#if ENABLE(NOTIFICATIONS) + NotificationContextMap::iterator it = m_notificationContextMap.find(context); + if (it == m_notificationContextMap.end()) + return; + + m_process->connection()->send(Messages::WebNotificationManagerProxy::ClearNotifications(it->second), page->pageID()); + m_notificationContextMap.remove(it); +#endif +} + void WebNotificationManager::didDestroyNotification(Notification* notification, WebPage* page) { #if ENABLE(NOTIFICATIONS) @@ -185,6 +207,12 @@ void WebNotificationManager::didCloseNotifications(const Vector<uint64_t>& notif if (!notification) continue; + NotificationContextMap::iterator it = m_notificationContextMap.find(notification->scriptExecutionContext()); + ASSERT(it != m_notificationContextMap.end()); + size_t index = it->second.find(notificationID); + ASSERT(index != notFound); + it->second.remove(index); + notification->dispatchCloseEvent(); } #endif diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h index 61507394c..dc550e231 100644 --- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h +++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.h @@ -59,6 +59,7 @@ public: bool show(WebCore::Notification*, WebPage*); void cancel(WebCore::Notification*, WebPage*); + void clearNotifications(WebCore::ScriptExecutionContext*, WebPage*); // This callback comes from WebCore, not messaged from the UI process. void didDestroyNotification(WebCore::Notification*, WebPage*); @@ -86,6 +87,9 @@ private: typedef HashMap<uint64_t, RefPtr<WebCore::Notification> > NotificationIDMap; NotificationIDMap m_notificationIDMap; + typedef HashMap<RefPtr<WebCore::ScriptExecutionContext>, Vector<uint64_t> > NotificationContextMap; + NotificationContextMap m_notificationContextMap; + HashMap<String, bool> m_permissionsMap; #endif }; diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp index 13f97d96f..904a83dcd 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.cpp @@ -348,7 +348,7 @@ void BuiltInPDFView::calculateSizes() bool BuiltInPDFView::initialize(const Parameters& parameters) { - m_frame->coreFrame()->page()->addScrollableArea(this); + m_frame->coreFrame()->view()->addScrollableArea(this); // Load the src URL if needed. m_sourceURL = parameters.url; @@ -361,8 +361,8 @@ bool BuiltInPDFView::initialize(const Parameters& parameters) void BuiltInPDFView::destroy() { if (m_frame) { - if (Page* page = m_frame->coreFrame()->page()) - page->removeScrollableArea(this); + if (FrameView* frameView = m_frame->coreFrame()->view()) + frameView->removeScrollableArea(this); } destroyScrollbar(HorizontalScrollbar); diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h index 6ee4bf3c5..c185c1871 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.h @@ -138,7 +138,6 @@ private: virtual WebCore::Scrollbar* horizontalScrollbar() const { return m_horizontalScrollbar.get(); } virtual WebCore::Scrollbar* verticalScrollbar() const { return m_verticalScrollbar.get(); } virtual bool isOnActivePage() const; - virtual void disconnectFromPage() { m_frame = 0; } virtual bool shouldSuspendScrollAnimations() const { return false; } // If we return true, ScrollAnimatorMac will keep cycling a timer forever, waiting for a good time to animate. virtual void scrollbarStyleChanged(int newStyle, bool forceUpdate); virtual void zoomAnimatorTransformChanged(float, float, float, ZoomAnimationState) { } diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp index 5b915dc40..8935dcf78 100644 --- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp +++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp @@ -631,8 +631,11 @@ void PluginView::handleEvent(Event* event) // We have a mouse event. // FIXME: Clicking in a scroll bar should not change focus. - if (currentEvent->type() == WebEvent::MouseDown) + if (currentEvent->type() == WebEvent::MouseDown) { focusPluginElement(); + frame()->eventHandler()->setCapturingMouseEventsNode(m_pluginElement.get()); + } else if (currentEvent->type() == WebEvent::MouseUp) + frame()->eventHandler()->setCapturingMouseEventsNode(0); didHandleEvent = m_plugin->handleMouseEvent(static_cast<const WebMouseEvent&>(*currentEvent)); } else if (event->type() == eventNames().mousewheelEvent && currentEvent->type() == WebEvent::Wheel) { diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp index 44c0c002d..5a48fff87 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp @@ -780,7 +780,7 @@ bool WebChromeClient::shouldRubberBandInDirection(WebCore::ScrollDirection direc void WebChromeClient::numWheelEventHandlersChanged(unsigned count) { - m_page->send(Messages::WebPageProxy::NumWheelEventHandlersChanged(count)); + m_page->numWheelEventHandlersChanged(count); } } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp index 5ddf23caa..be24684db 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp @@ -175,7 +175,11 @@ void WebFrameLoaderClient::dispatchWillSendRequest(DocumentLoader*, unsigned lon bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader*, unsigned long identifier) { - return true; + WebPage* webPage = m_frame->page(); + if (!webPage) + return true; + + return webPage->injectedBundleResourceLoadClient().shouldUseCredentialStorage(webPage, m_frame, identifier); } void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge& challenge) @@ -573,6 +577,8 @@ void WebFrameLoaderClient::dispatchDidLayout() // Notify the bundle client. webPage->injectedBundleLoaderClient().didLayoutForFrame(webPage, m_frame); + webPage->recomputeShortCircuitHorizontalWheelEventsState(); + // NOTE: Unlike the other layout notifications, this does not notify the // the UIProcess for every call. @@ -1416,19 +1422,28 @@ RemoteAXObjectRef WebFrameLoaderClient::accessibilityRemoteObject() #if ENABLE(MAC_JAVA_BRIDGE) jobject WebFrameLoaderClient::javaApplet(NSView*) { return 0; } #endif + NSCachedURLResponse* WebFrameLoaderClient::willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const { - return response; + WebPage* webPage = m_frame->page(); + if (!webPage) + return response; + + return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(webPage, m_frame, identifier) ? response : nil; } -#endif +#endif // PLATFORM(MAC) + #if PLATFORM(WIN) && USE(CFNETWORK) bool WebFrameLoaderClient::shouldCacheResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&, const unsigned char* data, unsigned long long length) { - return true; -} + WebPage* webPage = m_frame->page(); + if (!webPage) + return true; -#endif + return webPage->injectedBundleResourceLoadClient().shouldCacheResponse(webPage, m_frame, identifier); +} +#endif // PLATFORM(WIN) && USE(CFNETWORK) bool WebFrameLoaderClient::shouldUsePluginDocument(const String& /*mimeType*/) const { diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp index f93911390..90eb161f2 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.cpp @@ -32,7 +32,6 @@ #include "WebNotificationManager.h" #include "WebPage.h" #include "WebProcess.h" -#include <WebCore/NotImplemented.h> #include <WebCore/ScriptExecutionContext.h> using namespace WebCore; @@ -50,31 +49,22 @@ WebNotificationClient::~WebNotificationClient() bool WebNotificationClient::show(Notification* notification) { -#if ENABLE(NOTIFICATIONS) return WebProcess::shared().notificationManager().show(notification, m_page); -#else - notImplemented(); - return false; -#endif } void WebNotificationClient::cancel(Notification* notification) { -#if ENABLE(NOTIFICATIONS) WebProcess::shared().notificationManager().cancel(notification, m_page); -#else - notImplemented(); -#endif +} + +void WebNotificationClient::clearNotifications(ScriptExecutionContext* context) +{ + WebProcess::shared().notificationManager().clearNotifications(context, m_page); } void WebNotificationClient::notificationObjectDestroyed(Notification* notification) { -#if ENABLE(NOTIFICATIONS) WebProcess::shared().notificationManager().didDestroyNotification(notification, m_page); -#else - UNUSED_PARAM(notification); - notImplemented(); -#endif } void WebNotificationClient::notificationControllerDestroyed() diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h index ad36a9621..147a88ac1 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebNotificationClient.h @@ -47,6 +47,7 @@ public: private: virtual bool show(WebCore::Notification*) OVERRIDE; virtual void cancel(WebCore::Notification*) OVERRIDE; + virtual void clearNotifications(WebCore::ScriptExecutionContext*) OVERRIDE; virtual void notificationObjectDestroyed(WebCore::Notification*) OVERRIDE; virtual void notificationControllerDestroyed() OVERRIDE; virtual void requestPermission(WebCore::ScriptExecutionContext*, PassRefPtr<WebCore::VoidCallback>) OVERRIDE; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm index c40a68ab8..8d36fab5f 100644 --- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm +++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm @@ -40,6 +40,7 @@ void InitWebCoreSystemInterface(void) INIT(CopyCFLocalizationPreferredName); INIT(CGContextGetShouldSmoothFonts); INIT(CGPatternCreateWithImageAndTransform); + INIT(CGContextResetClip); INIT(CopyCONNECTProxyResponse); INIT(CopyNSURLResponseStatusLine); INIT(CreateCTLineWithUniCharProvider); diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp index 9d42ce4a5..841e35ab8 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp @@ -29,10 +29,6 @@ // Subclasses #include "DrawingAreaImpl.h" -#if USE(TILED_BACKING_STORE) -#include "TiledDrawingArea.h" -#endif - #if PLATFORM(MAC) #include "TiledCoreAnimationDrawingArea.h" #endif @@ -46,10 +42,6 @@ PassOwnPtr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreat switch (parameters.drawingAreaType) { case DrawingAreaTypeImpl: return DrawingAreaImpl::create(webPage, parameters); -#if USE(TILED_BACKING_STORE) - case DrawingAreaTypeTiled: - return adoptPtr(new TiledDrawingArea(webPage)); -#endif #if PLATFORM(MAC) case DrawingAreaTypeTiledCoreAnimation: return TiledCoreAnimationDrawingArea::create(webPage, parameters); diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h index ffbbdbb57..377c9001a 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.h @@ -79,7 +79,7 @@ public: #if USE(ACCELERATED_COMPOSITING) virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0; virtual void scheduleCompositingLayerSync() = 0; -#if USE(TEXTURE_MAPPER) +#if USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE) virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0; #endif #endif @@ -106,15 +106,6 @@ private: // Used by TiledCoreAnimationDrawingArea. virtual void updateGeometry(const WebCore::IntSize& viewSize) { } #endif - -#if USE(TILED_BACKING_STORE) - virtual void setSize(const WebCore::IntSize& viewSize) { } - virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float) { } - virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&) { } - virtual void setContentsScale(float scale) { } - virtual void renderNextFrame() { } - virtual void takeSnapshot(const WebCore::IntSize& targetSize, const WebCore::IntRect& contentsRect) { } -#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in index 48c3e1ae5..41a1aa362 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in +++ b/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in @@ -31,12 +31,4 @@ messages -> DrawingArea { // Used by TiledCoreAnimationDrawingArea. UpdateGeometry(WebCore::IntSize viewSize) #endif - -#if USE(TILED_BACKING_STORE) - SetSize(WebCore::IntSize viewSize) - SetVisibleContentRectAndScale(WebCore::IntRect visibleContentRect, float scale) - SetVisibleContentRectTrajectoryVector(WebCore::FloatPoint trajectoryVector) - RenderNextFrame() - TakeSnapshot(WebCore::IntSize size, WebCore::IntRect contentsRect) -#endif } diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp index 3ad27e7af..4cc1fe272 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp @@ -667,7 +667,7 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo) m_displayTimer.stop(); } -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE) void DrawingAreaImpl::didReceiveLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments) { if (m_layerTreeHost) diff --git a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h index 28c8ce68c..bf86fcf19 100644 --- a/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h +++ b/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h @@ -70,7 +70,7 @@ private: virtual void scheduleChildWindowGeometryUpdate(const WindowGeometry&); #endif -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) && USE(TILED_BACKING_STORE) virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); #endif diff --git a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp index 3c2e73eca..7f3c08198 100644 --- a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp +++ b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp @@ -37,6 +37,7 @@ #if ENABLE(THREADED_SCROLLING) #include <WebCore/ScrollingCoordinator.h> +#include <WebCore/ScrollingTree.h> #endif using namespace WebCore; @@ -52,21 +53,21 @@ EventDispatcher::~EventDispatcher() } #if ENABLE(THREADED_SCROLLING) -void EventDispatcher::addScrollingCoordinatorForPage(WebPage* webPage) +void EventDispatcher::addScrollingTreeForPage(WebPage* webPage) { - MutexLocker locker(m_scrollingCoordinatorsMutex); + MutexLocker locker(m_scrollingTreesMutex); ASSERT(webPage->corePage()->scrollingCoordinator()); - ASSERT(!m_scrollingCoordinators.contains(webPage->pageID())); - m_scrollingCoordinators.set(webPage->pageID(), webPage->corePage()->scrollingCoordinator()); + ASSERT(!m_scrollingTrees.contains(webPage->pageID())); + m_scrollingTrees.set(webPage->pageID(), webPage->corePage()->scrollingCoordinator()->scrollingTree()); } -void EventDispatcher::removeScrollingCoordinatorForPage(WebPage* webPage) +void EventDispatcher::removeScrollingTreeForPage(WebPage* webPage) { - MutexLocker locker(m_scrollingCoordinatorsMutex); - ASSERT(m_scrollingCoordinators.contains(webPage->pageID())); + MutexLocker locker(m_scrollingTreesMutex); + ASSERT(m_scrollingTrees.contains(webPage->pageID())); - m_scrollingCoordinators.remove(webPage->pageID()); + m_scrollingTrees.remove(webPage->pageID()); } #endif @@ -81,11 +82,11 @@ void EventDispatcher::didReceiveMessageOnConnectionWorkQueue(CoreIPC::Connection void EventDispatcher::wheelEvent(CoreIPC::Connection*, uint64_t pageID, const WebWheelEvent& wheelEvent) { #if ENABLE(THREADED_SCROLLING) - MutexLocker locker(m_scrollingCoordinatorsMutex); - if (ScrollingCoordinator* scrollingCoordinator = m_scrollingCoordinators.get(pageID).get()) { + MutexLocker locker(m_scrollingTreesMutex); + if (ScrollingTree* scrollingTree = m_scrollingTrees.get(pageID).get()) { PlatformWheelEvent platformWheelEvent = platform(wheelEvent); - if (scrollingCoordinator->handleWheelEvent(platformWheelEvent)) { + if (scrollingTree->tryToHandleWheelEvent(platformWheelEvent)) { sendDidHandleEvent(pageID, wheelEvent); return; } @@ -98,18 +99,6 @@ void EventDispatcher::wheelEvent(CoreIPC::Connection*, uint64_t pageID, const We #if ENABLE(GESTURE_EVENTS) void EventDispatcher::gestureEvent(CoreIPC::Connection*, uint64_t pageID, const WebGestureEvent& gestureEvent) { -#if ENABLE(THREADED_SCROLLING) - MutexLocker locker(m_scrollingCoordinatorsMutex); - if (ScrollingCoordinator* scrollingCoordinator = m_scrollingCoordinators.get(pageID).get()) { - PlatformGestureEvent platformGestureEvent = platform(gestureEvent); - - if (scrollingCoordinator->handleGestureEvent(platformGestureEvent)) { - sendDidHandleEvent(pageID, gestureEvent); - return; - } - } -#endif - RunLoop::main()->dispatch(bind(&EventDispatcher::dispatchGestureEvent, this, pageID, gestureEvent)); } #endif diff --git a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h index f8c459af5..15b25380d 100644 --- a/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h +++ b/Source/WebKit2/WebProcess/WebPage/EventDispatcher.h @@ -33,7 +33,7 @@ #include <wtf/ThreadingPrimitives.h> namespace WebCore { - class ScrollingCoordinator; + class ScrollingTree; } namespace WebKit { @@ -54,8 +54,8 @@ public: ~EventDispatcher(); #if ENABLE(THREADED_SCROLLING) - void addScrollingCoordinatorForPage(WebPage*); - void removeScrollingCoordinatorForPage(WebPage*); + void addScrollingTreeForPage(WebPage*); + void removeScrollingTreeForPage(WebPage*); #endif private: @@ -80,8 +80,8 @@ private: #if ENABLE(THREADED_SCROLLING) void sendDidHandleEvent(uint64_t pageID, const WebEvent&); - Mutex m_scrollingCoordinatorsMutex; - HashMap<uint64_t, RefPtr<WebCore::ScrollingCoordinator> > m_scrollingCoordinators; + Mutex m_scrollingTreesMutex; + HashMap<uint64_t, RefPtr<WebCore::ScrollingTree> > m_scrollingTrees; #endif }; diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp deleted file mode 100644 index c482e664b..000000000 --- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (C) 2010, 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "TiledDrawingArea.h" - -#if USE(TILED_BACKING_STORE) - -#include "DrawingAreaProxyMessages.h" -#include "MessageID.h" -#include "UpdateInfo.h" -#include "WebCoreArgumentCoders.h" -#include "WebPage.h" -#include "WebProcess.h" - -using namespace WebCore; - -namespace WebKit { - -TiledDrawingArea::TiledDrawingArea(WebPage* webPage) - : DrawingArea(DrawingAreaTypeTiled, webPage) - , m_suspended(false) - , m_isWaitingForUIProcess(false) - , m_didSendTileUpdate(false) - , m_mainBackingStore(adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this)))) -{ -} - -TiledDrawingArea::~TiledDrawingArea() -{ -} - -void TiledDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta) -{ - // FIXME: Do something much smarter. - setNeedsDisplay(scrollRect); -} - -void TiledDrawingArea::setNeedsDisplay(const IntRect& rect) -{ - m_mainBackingStore->invalidate(rect); -} - -void TiledDrawingArea::setSize(const IntSize& viewSize) -{ - ASSERT(!m_suspended); - ASSERT_ARG(viewSize, !viewSize.isEmpty()); - - m_webPage->setSize(viewSize); -} - -void TiledDrawingArea::setVisibleContentRectAndScale(const WebCore::IntRect& visibleContentsRect, float scale) -{ - m_visibleContentRect = visibleContentsRect; - - if (scale != m_mainBackingStore->contentsScale()) { - // Keep the tiles for the previous scale until enough content is available to be shown on the screen for the new scale. - // If we already have a previous set of tiles it means that two scale changed happened successively. - // In that case, make sure that our current main tiles have more content to show than the "previous previous" - // within the visible rect before replacing it. - if (!m_previousBackingStore || m_mainBackingStore->coverageRatio(m_visibleContentRect) > m_previousBackingStore->coverageRatio(m_visibleContentRect)) - m_previousBackingStore = m_mainBackingStore.release(); - - m_mainBackingStore = adoptPtr(new TiledBackingStore(this, TiledBackingStoreRemoteTileBackend::create(this))); - m_mainBackingStore->setContentsScale(scale); - } else - m_mainBackingStore->adjustVisibleRect(); -} - -void TiledDrawingArea::setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint& trajectoryVector) -{ - m_mainBackingStore->setVisibleRectTrajectoryVector(trajectoryVector); -} - -void TiledDrawingArea::renderNextFrame() -{ - m_isWaitingForUIProcess = false; - m_mainBackingStore->updateTileBuffers(); -} - -void TiledDrawingArea::suspendPainting() -{ - ASSERT(!m_suspended); - - m_suspended = true; -} - -void TiledDrawingArea::resumePainting() -{ - ASSERT(m_suspended); - - m_suspended = false; - m_mainBackingStore->updateTileBuffers(); -} - -void TiledDrawingArea::tiledBackingStorePaintBegin() -{ - m_webPage->layoutIfNeeded(); -} - -void TiledDrawingArea::tiledBackingStorePaint(GraphicsContext* graphicsContext, const IntRect& contentRect) -{ - m_webPage->drawRect(*graphicsContext, contentRect); -} - -void TiledDrawingArea::tiledBackingStorePaintEnd(const Vector<IntRect>& paintedArea) -{ - if (m_didSendTileUpdate) { - // Since we know that all tile updates following a page invalidate will all be rendered - // in one paint pass for all the tiles, we can send the swap tile message here. - m_webPage->send(Messages::DrawingAreaProxy::DidRenderFrame()); - m_isWaitingForUIProcess = true; - m_didSendTileUpdate = false; - - // Make sure that we destroy the previous backing store and remove its tiles only after DidRenderFrame - // was sent to swap recently created tiles' buffer. Else a frame could be rendered after the previous - // tiles were removed and before the new tile have their first back buffer swapped. - if (m_previousBackingStore && m_mainBackingStore->coverageRatio(m_visibleContentRect) >= 1.0f) - m_previousBackingStore.clear(); - } -} - -bool TiledDrawingArea::tiledBackingStoreUpdatesAllowed() const -{ - return !m_suspended && !m_isWaitingForUIProcess; -} - -IntRect TiledDrawingArea::tiledBackingStoreContentsRect() -{ - return IntRect(IntPoint::zero(), m_webPage->size()); -} - -IntRect TiledDrawingArea::tiledBackingStoreVisibleRect() -{ - return m_visibleContentRect; -} - -Color TiledDrawingArea::tiledBackingStoreBackgroundColor() const -{ - return Color::transparent; -} - -void TiledDrawingArea::createTile(int tileID, const UpdateInfo& updateInfo) -{ - m_webPage->send(Messages::DrawingAreaProxy::CreateTile(tileID, updateInfo)); - m_didSendTileUpdate = true; -} -void TiledDrawingArea::updateTile(int tileID, const UpdateInfo& updateInfo) -{ - m_webPage->send(Messages::DrawingAreaProxy::UpdateTile(tileID, updateInfo)); - m_didSendTileUpdate = true; -} -void TiledDrawingArea::removeTile(int tileID) -{ - m_webPage->send(Messages::DrawingAreaProxy::RemoveTile(tileID)); -} - -#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) -void TiledDrawingArea::didReceiveLayerTreeHostMessage(CoreIPC::Connection* connection, CoreIPC::MessageID, CoreIPC::ArgumentDecoder* arguments) -{ -} -#endif -} // namespace WebKit - -#endif // USE(TILED_BACKING_STORE) diff --git a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h deleted file mode 100644 index cbcbd3090..000000000 --- a/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef TiledDrawingArea_h -#define TiledDrawingArea_h - -#if USE(TILED_BACKING_STORE) - -#include "DrawingArea.h" -#include "TiledBackingStoreClient.h" -#include "TiledBackingStoreRemoteTile.h" -#include <WebCore/IntRect.h> - -namespace WebKit { - -class TiledDrawingArea : public DrawingArea, public WebCore::TiledBackingStoreClient, public TiledBackingStoreRemoteTileClient { -public: - explicit TiledDrawingArea(WebPage*); - virtual ~TiledDrawingArea(); - - virtual void setNeedsDisplay(const WebCore::IntRect&); - virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta); - -#if USE(ACCELERATED_COMPOSITING) - virtual void attachCompositingContext() { } - virtual void detachCompositingContext() { } - virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) { } - virtual void scheduleCompositingLayerSync() { } - virtual void didReceiveLayerTreeHostMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*); -#endif - -private: - // CoreIPC message handlers. - virtual void setSize(const WebCore::IntSize& viewSize); - virtual void setVisibleContentRectAndScale(const WebCore::IntRect&, float); - virtual void setVisibleContentRectTrajectoryVector(const WebCore::FloatPoint&); - virtual void renderNextFrame(); - virtual void suspendPainting(); - virtual void resumePainting(); - - // TiledBackingStoreClient - virtual void tiledBackingStorePaintBegin(); - virtual void tiledBackingStorePaint(WebCore::GraphicsContext*, const WebCore::IntRect& contentRect); - virtual void tiledBackingStorePaintEnd(const Vector<WebCore::IntRect>& paintedArea); - virtual bool tiledBackingStoreUpdatesAllowed() const; - virtual WebCore::IntRect tiledBackingStoreContentsRect(); - virtual WebCore::IntRect tiledBackingStoreVisibleRect(); - virtual WebCore::Color tiledBackingStoreBackgroundColor() const; - - // TiledBackingStoreRemoteTileClient - virtual void createTile(int tileID, const UpdateInfo&); - virtual void updateTile(int tileID, const UpdateInfo&); - virtual void removeTile(int tileID); - - bool m_suspended; - bool m_isWaitingForUIProcess; - bool m_didSendTileUpdate; - WebCore::IntRect m_visibleContentRect; - - OwnPtr<WebCore::TiledBackingStore> m_mainBackingStore; - OwnPtr<WebCore::TiledBackingStore> m_previousBackingStore; -}; - -} // namespace WebKit - -#endif // USE(TILED_BACKING_STORE) - -#endif // TiledDrawingArea_h diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp index 43f443829..a829fe45b 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp @@ -30,6 +30,8 @@ #include "InjectedBundleNodeHandle.h" #include "InjectedBundleRangeHandle.h" #include "InjectedBundleScriptWorld.h" +#include "WKAPICast.h" +#include "WKBundleAPICast.h" #include "WebChromeClient.h" #include "WebPage.h" #include "WebPageProxyMessages.h" @@ -734,9 +736,40 @@ void WebFrame::setTextDirection(const String& direction) } #if PLATFORM(MAC) || PLATFORM(WIN) -RetainPtr<CFDataRef> WebFrame::webArchiveData() const + +class WebFrameFilter : public FrameFilter { +public: + WebFrameFilter(WebFrame*, WebFrame::FrameFilterFunction, void* context); + +private: + virtual bool shouldIncludeSubframe(Frame*) const OVERRIDE; + + WebFrame* m_topLevelWebFrame; + WebFrame::FrameFilterFunction m_callback; + void* m_context; +}; + +WebFrameFilter::WebFrameFilter(WebFrame* topLevelWebFrame, WebFrame::FrameFilterFunction callback, void* context) + : m_topLevelWebFrame(topLevelWebFrame) + , m_callback(callback) + , m_context(context) +{ +} + +bool WebFrameFilter::shouldIncludeSubframe(Frame* frame) const { - if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(coreFrame()->document())) + if (!m_callback) + return true; + + WebFrame* webFrame = static_cast<WebFrameLoaderClient*>(frame->loader()->client())->webFrame(); + return m_callback(toAPI(m_topLevelWebFrame), toAPI(webFrame), m_context); +} + +RetainPtr<CFDataRef> WebFrame::webArchiveData(FrameFilterFunction callback, void* context) +{ + WebFrameFilter filter(this, callback, context); + + if (RefPtr<LegacyWebArchive> archive = LegacyWebArchive::create(coreFrame()->document(), &filter)) return archive->rawDataRepresentation(); return 0; diff --git a/Source/WebKit2/WebProcess/WebPage/WebFrame.h b/Source/WebKit2/WebProcess/WebPage/WebFrame.h index 29536c27a..839b57926 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebFrame.h +++ b/Source/WebKit2/WebProcess/WebPage/WebFrame.h @@ -28,6 +28,7 @@ #include "APIObject.h" #include "ImmutableArray.h" +#include "WKBase.h" #include "WebFrameLoaderClient.h" #include <JavaScriptCore/JSBase.h> #include <WebCore/FrameLoaderClient.h> @@ -137,7 +138,8 @@ public: LoadListener* loadListener() const { return m_loadListener; } #if PLATFORM(MAC) || PLATFORM(WIN) - RetainPtr<CFDataRef> webArchiveData() const; + typedef bool (*FrameFilterFunction)(WKBundleFrameRef, WKBundleFrameRef subframe, void* context); + RetainPtr<CFDataRef> webArchiveData(FrameFilterFunction, void* context); #endif private: diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 3b9a487e4..4aa1e45e8 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -206,6 +206,8 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters) , m_isRunningModal(false) , m_cachedMainFrameIsPinnedToLeftSide(false) , m_cachedMainFrameIsPinnedToRightSide(false) + , m_canShortCircuitHorizontalWheelEvents(false) + , m_numWheelEventHandlers(0) , m_cachedPageCount(0) , m_isShowingContextMenu(false) #if PLATFORM(WIN) @@ -1797,7 +1799,7 @@ void WebPage::getWebArchiveOfFrame(uint64_t frameID, uint64_t callbackID) #if PLATFORM(MAC) || PLATFORM(WIN) RetainPtr<CFDataRef> data; if (WebFrame* frame = WebProcess::shared().webFrame(frameID)) { - if ((data = frame->webArchiveData())) + if ((data = frame->webArchiveData(0, 0))) dataReference = CoreIPC::DataReference(CFDataGetBytePtr(data.get()), CFDataGetLength(data.get())); } #endif @@ -2388,6 +2390,8 @@ void WebPage::setWindowIsVisible(bool windowIsVisible) { m_windowIsVisible = windowIsVisible; + corePage()->focusController()->setContainingWindowIsVisible(windowIsVisible); + // Tell all our plug-in views that the window visibility changed. for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it) (*it)->setWindowIsVisible(windowIsVisible); @@ -2998,6 +3002,68 @@ void WebPage::confirmCompositionForTesting(const String& compositionString) frame->editor()->confirmComposition(compositionString); } +void WebPage::numWheelEventHandlersChanged(unsigned numWheelEventHandlers) +{ + if (m_numWheelEventHandlers == numWheelEventHandlers) + return; + + m_numWheelEventHandlers = numWheelEventHandlers; + recomputeShortCircuitHorizontalWheelEventsState(); +} + +static bool hasEnabledHorizontalScrollbar(ScrollableArea* scrollableArea) +{ + if (Scrollbar* scrollbar = scrollableArea->horizontalScrollbar()) + return scrollbar->enabled(); + + return false; +} + +static bool pageContainsAnyHorizontalScrollbars(Frame* mainFrame) +{ + if (FrameView* frameView = mainFrame->view()) { + if (hasEnabledHorizontalScrollbar(frameView)) + return true; + } + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { + FrameView* frameView = frame->view(); + if (!frameView) + continue; + + const HashSet<ScrollableArea*>* scrollableAreas = frameView->scrollableAreas(); + if (!scrollableAreas) + continue; + + for (HashSet<ScrollableArea*>::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) { + ScrollableArea* scrollableArea = *it; + ASSERT(scrollableArea->isOnActivePage()); + + if (hasEnabledHorizontalScrollbar(scrollableArea)) + return true; + } + } + + return false; +} + +void WebPage::recomputeShortCircuitHorizontalWheelEventsState() +{ + bool canShortCircuitHorizontalWheelEvents = !m_numWheelEventHandlers; + + if (canShortCircuitHorizontalWheelEvents) { + // Check if we have any horizontal scroll bars on the page. + if (pageContainsAnyHorizontalScrollbars(mainFrame())) + canShortCircuitHorizontalWheelEvents = false; + } + + if (m_canShortCircuitHorizontalWheelEvents == canShortCircuitHorizontalWheelEvents) + return; + + m_canShortCircuitHorizontalWheelEvents = canShortCircuitHorizontalWheelEvents; + send(Messages::WebPageProxy::SetCanShortCircuitHorizontalWheelEvents(m_canShortCircuitHorizontalWheelEvents)); +} + Frame* WebPage::mainFrame() const { return m_page ? m_page->mainFrame() : 0; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 09eef272a..aa1e57f08 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -500,6 +500,9 @@ public: void gestureEvent(const WebGestureEvent&); #endif + void numWheelEventHandlersChanged(unsigned); + void recomputeShortCircuitHorizontalWheelEventsState(); + private: WebPage(uint64_t pageID, const WebPageCreationParameters&); @@ -716,7 +719,6 @@ private: #endif #if USE(TILED_BACKING_STORE) - WebCore::IntSize m_resizesToContentsLayoutSize; WebCore::IntSize m_viewportSize; #endif @@ -757,6 +759,8 @@ private: bool m_cachedMainFrameIsPinnedToLeftSide; bool m_cachedMainFrameIsPinnedToRightSide; + bool m_canShortCircuitHorizontalWheelEvents; + unsigned m_numWheelEventHandlers; unsigned m_cachedPageCount; diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm index 4aca80c4b..9e2849328 100644 --- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm +++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm @@ -66,7 +66,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c #if ENABLE(THREADED_SCROLLING) page->settings()->setScrollingCoordinatorEnabled(true); - WebProcess::shared().eventDispatcher().addScrollingCoordinatorForPage(webPage); + WebProcess::shared().eventDispatcher().addScrollingTreeForPage(webPage); #endif m_rootLayer = [CALayer layer]; @@ -88,7 +88,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea() { #if ENABLE(THREADED_SCROLLING) - WebProcess::shared().eventDispatcher().removeScrollingCoordinatorForPage(m_webPage); + WebProcess::shared().eventDispatcher().removeScrollingTreeForPage(m_webPage); #endif m_layerFlushScheduler.invalidate(); diff --git a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb index 41c00ac2e..c706dc8d0 100644 --- a/Source/WebKit2/WebProcess/com.apple.WebProcess.sb +++ b/Source/WebKit2/WebProcess/com.apple.WebProcess.sb @@ -39,8 +39,8 @@ (literal "/Library/Preferences/com.apple.security.revocation.plist") (regex #"^/Library/Managed Preferences/[^/]+/com\.apple\.networkConnect\.plist$") (home-literal "/Library/Preferences/.GlobalPreferences.plist") - (home-regex "/Library/Preferences/ByHost/\.GlobalPreferences\.") - (home-regex "/Library/Preferences/ByHost/com\.apple\.networkConnect\.") + (home-regex #"/Library/Preferences/ByHost/\.GlobalPreferences\.") + (home-regex #"/Library/Preferences/ByHost/com\.apple\.networkConnect\.") (home-literal "/Library/Preferences/com.apple.ATS.plist") (home-literal "/Library/Preferences/com.apple.DownloadAssessment.plist") (home-literal "/Library/Preferences/com.apple.HIToolbox.plist") @@ -49,7 +49,7 @@ (home-literal "/Library/Preferences/com.apple.security.plist") (home-literal "/Library/Preferences/com.apple.security.revocation.plist") (home-literal "/Library/Application Support/SyncServices/Local/ClientsWithChanges/com.apple.Keychain") - (home-regex "/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$") + (home-regex #"/Library/Preferences/com\.apple\.driver\.(AppleBluetoothMultitouch\.mouse|AppleBluetoothMultitouch\.trackpad|AppleHIDMouse)\.plist$") ;; On-disk WebKit2 framework location, to account for debug installations ;; outside of /System/Library/Frameworks @@ -67,12 +67,6 @@ (subpath "/Library/Video/Plug-Ins") (subpath "/Library/QuickTime") - ;; FIXME: This should be removed when <rdar://problem/9276253> is fixed. - (home-subpath "/Library/Keyboard Layouts") - - ;; FIXME: This should be removed when <rdar://problem/9276268> is fixed. - (home-subpath "/Library/Input Methods") - (home-subpath "/Library/Dictionaries")) ;; This should be updated when <rdar://problem/9355830> is fixed. @@ -86,8 +80,8 @@ ;; Writable preferences and temporary files (allow file* (home-subpath "/Library/Caches/com.apple.WebProcess") - (home-regex "/Library/Preferences/ByHost/com\.apple\.HIToolbox\.") - (home-regex "/Library/Preferences/com\.apple\.WebProcess\.") + (home-regex #"/Library/Preferences/ByHost/com\.apple\.HIToolbox\.") + (home-regex #"/Library/Preferences/com\.apple\.WebProcess\.") ;; FIXME: This should be removed when <rdar://problem/10479685> is fixed. (home-subpath "/Library/Keychains")) @@ -96,9 +90,11 @@ (allow file* (subpath "/private/var/db/mds/system")) -;; Darwin temporary files and Security mds caches, if present +;; FIXME: <rdar://problem/10792047> Use private user cache directory (if (positive? (string-length (param "DARWIN_USER_CACHE_DIR"))) (allow file* (subpath (string-append (param "DARWIN_USER_CACHE_DIR") "/mds")))) + +;; FIXME: <rdar://problem/10785457> Use private temporary directory (if (positive? (string-length (param "DARWIN_USER_TEMP_DIR"))) (allow file* (subpath (param "DARWIN_USER_TEMP_DIR")))) diff --git a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp index aa487563d..28efc0c82 100644 --- a/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp +++ b/Source/WebKit2/WebProcess/qt/QtNetworkAccessManager.cpp @@ -111,8 +111,14 @@ void QtNetworkAccessManager::onSslErrors(QNetworkReply* reply, const QList<QSslE if (webPage->sendSync( Messages::WebPageProxy::CertificateVerificationRequest(hostname), Messages::WebPageProxy::CertificateVerificationRequest::Reply(ignoreErrors))) { - if (ignoreErrors) + if (ignoreErrors) { +#ifndef QT_NO_OPENSSL reply->ignoreSslErrors(qSslErrors); +#else + Q_UNUSED(qSslErrors); + reply->ignoreSslErrors(); +#endif + } } } diff --git a/Source/WebKit2/win/WebKit2.def b/Source/WebKit2/win/WebKit2.def index a1926a5ea..76830e01c 100644 --- a/Source/WebKit2/win/WebKit2.def +++ b/Source/WebKit2/win/WebKit2.def @@ -146,14 +146,15 @@ EXPORTS ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ + ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z ?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z ?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z + ?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z - ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ ?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z ?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z diff --git a/Source/WebKit2/win/WebKit2CFLite.def b/Source/WebKit2/win/WebKit2CFLite.def index 384992d31..3a927c27c 100644 --- a/Source/WebKit2/win/WebKit2CFLite.def +++ b/Source/WebKit2/win/WebKit2CFLite.def @@ -140,14 +140,15 @@ EXPORTS ??0FrameDestructionObserver@WebCore@@QAE@PAVFrame@1@@Z ?absoluteBoundingBoxRect@RenderObject@WebCore@@QBE?AVIntRect@2@_N@Z ?absoluteBoundingBoxRectIgnoringTransforms@RenderObject@WebCore@@QBE?AVIntRect@2@XZ + ?description@DocumentMarker@WebCore@@QBEABVString@WTF@@XZ ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBE@Z ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z ?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z ?create@HTMLContentElement@WebCore@@SA?AV?$PassRefPtr@VHTMLContentElement@WebCore@@@WTF@@PAVDocument@2@@Z ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z + ?create@ShadowRoot@WebCore@@SA?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@PAVElement@2@AAH@Z ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z - ?ensureShadowRoot@Element@WebCore@@QAEPAVShadowRoot@2@XZ ?equal@WTF@@YA_NPBVStringImpl@1@PBE@Z ?equalIgnoringCase@WTF@@YA_NPAVStringImpl@1@PBE@Z ?externalRepresentation@WebCore@@YA?AVString@WTF@@PAVElement@1@I@Z diff --git a/Source/api.pri b/Source/api.pri index 9b7b27bf2..d22d43cea 100644 --- a/Source/api.pri +++ b/Source/api.pri @@ -221,7 +221,3 @@ mac { plugin_backend_xlib: PKGCONFIG += x11 -linux-g++*: { - PRE_TARGETDEPS += $$PWD/qtwebkit-export.map - QMAKE_LFLAGS += -Wl,--version-script=$$PWD/qtwebkit-export.map -} diff --git a/Source/autotools/symbols.filter b/Source/autotools/symbols.filter index 1954092b9..f0cdc1a0c 100644 --- a/Source/autotools/symbols.filter +++ b/Source/autotools/symbols.filter @@ -40,6 +40,7 @@ _ZN7WebCore10JSDocument6s_infoE; _ZN7WebCore10toDocumentEN3JSC7JSValueE; _ZN7WebCore10ClientRectC1Ev; _ZN7WebCore10ClientRectC1ERKNS_7IntRectE; +_ZN7WebCore10ShadowRoot6createEPNS_7ElementERi; _ZN7WebCore11EventTarget17toGeneratedStreamEv; _ZN7WebCore11EventTarget8toStreamEv; _ZN7WebCore12TextIterator26rangeFromLocationAndLengthEPNS_7ElementEiib; @@ -64,7 +65,6 @@ _ZN7WebCore6JSNode10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueE _ZN7WebCore6JSNode20visitChildrenVirtualERN3JSC11SlotVisitorE; _ZN7WebCore6JSNode6s_infoE; _ZN7WebCore6toNodeEN3JSC7JSValueE; -_ZN7WebCore7Element16ensureShadowRootEv; _ZN7WebCore7Element16removeShadowRootEv; _ZN7WebCore7toRangeEN3JSC7JSValueE; _ZN7WebCore9JSElement10putVirtualEPN3JSC9ExecStateERKNS1_10IdentifierENS1_7JSValueERNS1_15PutPropertySlotE; @@ -83,6 +83,7 @@ _ZNK7WebCore8Document4pageEv; _ZNK7WebCore8Document8settingsEv; _ZNK7WebCore8Document4viewEv; _ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE; +_ZNK7WebCore14DocumentMarker11descriptionEv; _ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE; _ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb; _ZN7WebCore8Settings24setMockScrollbarsEnabledEb; diff --git a/Source/autotools/webkit.m4 b/Source/autotools/webkit.m4 deleted file mode 100644 index 26be32cae..000000000 --- a/Source/autotools/webkit.m4 +++ /dev/null @@ -1,171 +0,0 @@ -dnl macros to check for JavaScriptCore and WebKit/Gtk+ dependencies -dnl -dnl The rationale is so that we can share these macros between -dnl WebKit and JavaScriptCore builds. - -# global states -m4_define([initialized], [no]) - -AC_DEFUN([INIT_C_CXX_FLAGS], -[dnl -# If CXXFLAGS and CFLAGS are unset, default to empty. -# This is to tell automake not to include '-g' if CXXFLAGS is not set -# For more info - http://www.gnu.org/software/automake/manual/autoconf.html#C_002b_002b-Compiler -if test -z "$CXXFLAGS"; then - CXXFLAGS="" -fi -if test -z "$CFLAGS"; then - CFLAGS="" -fi -]) - -AC_DEFUN_ONCE([WEBKIT_INIT], -[dnl -dnl check if we have the required packages to have successful checks -dnl -# Make sure CXXFLAGS and CFLAGS are set before expanding AC_PROG_CXX to avoid -# building with '-g -O2' on Release builds. -AC_REQUIRE([INIT_C_CXX_FLAGS]) - -# check for -fvisibility=hidden compiler support (GCC >= 4) -saved_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden" -AC_MSG_CHECKING([if ${CXX} supports -fvisibility=hidden -fvisibility-inlines-hidden]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], - [ AC_MSG_RESULT([yes]) - SYMBOL_VISIBILITY="-fvisibility=hidden" SYMBOL_VISIBILITY_INLINES="-fvisibility-inlines-hidden" ], - AC_MSG_RESULT([no])) -CFLAGS="$saved_CFLAGS" -AC_SUBST(SYMBOL_VISIBILITY) -AC_SUBST(SYMBOL_VISIBILITY_INLINES) - -# check for pkg-config -AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -if test "$PKG_CONFIG" = "no"; then - AC_MSG_ERROR([Cannot find pkg-config, make sure it is installed in your PATH]) -fi - -AC_PATH_PROG(PERL, perl) -if test -z "$PERL"; then - AC_MSG_ERROR([You need 'perl' to compile WebKit]) -fi - -AC_PATH_PROG(PYTHON, python) -if test -z "$PYTHON"; then - AC_MSG_ERROR([You need 'python' to compile WebKit]) -fi - -AC_PATH_PROG(BISON, bison) -if test -z "$BISON"; then - AC_MSG_ERROR([You need the 'bison' parser generator to compile WebKit]) -fi - -AC_PATH_PROG(MV, mv) -if test -z "$MV"; then - AC_MSG_ERROR([You need 'mv' to compile WebKit]) -fi - -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AC_PROG_CXX]) -AM_PROG_CC_STDC -AM_PROG_CC_C_O -AC_PROG_INSTALL -AC_SYS_LARGEFILE - -# Check whether a C++ was found (AC_PROG_CXX sets $CXX to "g++" even when it -# doesn't exist) -AC_LANG_PUSH([C++]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[],[AC_MSG_ERROR([No C++ compiler found])]) -AC_LANG_POP([C++]) - -# C/C++ Language Features -AC_C_CONST -AC_C_INLINE -AC_C_VOLATILE - -# C/C++ Headers -AC_REQUIRE([AC_HEADER_STDC]) -AC_HEADER_STDBOOL - -m4_define([initialized], [yes]) -]) - -AC_DEFUN_ONCE([WEBKIT_CHECK_DEPENDENCIES], -[dnl -dnl check for module dependencies -for module in $1 -do - case $module in - glib) _WEBKIT_CHECK_GLIB ;; - unicode) _WEBKIT_CHECK_UNICODE ;; - *) AC_MSG_ERROR([I don't support that module. Sorry..]) ;; - - esac -done -]) - -AC_DEFUN_ONCE([_WEBKIT_CHECK_GLIB], -[dnl -dnl check for glib -# Version requirements -GLIB_REQUIRED_VERSION=2.27.90 -AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION) -if test -z "$GLIB_GENMARSHAL" || test -z "$GLIB_MKENUMS"; then - AC_MSG_ERROR([You need the GLib dev tools in your path]) -fi -GLIB_GSETTINGS -]) - -AC_DEFUN_ONCE([_WEBKIT_CHECK_UNICODE], -[dnl -dnl determine the Unicode backend -AC_MSG_CHECKING([which Unicode backend to use]) -AC_ARG_WITH(unicode_backend, - AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@], - [Select Unicode backend (WARNING: the glib-based backend is slow, and incomplete) [default=icu]]), - [],[with_unicode_backend="icu"]) - -case "$with_unicode_backend" in - icu|glib) ;; - *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;; -esac - -AC_MSG_RESULT([$with_unicode_backend]) - -if test "$with_unicode_backend" = "icu"; then - case "$host" in - *-*-darwin*) - UNICODE_CFLAGS="-I$srcdir/Source/JavaScriptCore/icu -I$srcdir/Source/WebCore/icu" - UNICODE_LIBS="-licucore" - ;; - *-*-mingw*) - UNICODE_CFLAGS="" - UNICODE_LIBS="-licuin -licuuc" - ;; - *) - AC_PATH_PROG(icu_config, icu-config, no) - if test "$icu_config" = "no"; then - AC_MSG_ERROR([Cannot find icu-config. The ICU library is needed.]) - fi - - # We don't use --cflags as this gives us a lot of things that we don't - # necessarily want, like debugging and optimization flags - # See man (1) icu-config for more info. - UNICODE_CFLAGS=`$icu_config --cppflags` - UNICODE_LIBS=`$icu_config --ldflags-libsonly` - ;; - esac -fi - -if test "$with_unicode_backend" = "glib"; then - PKG_CHECK_MODULES([UNICODE], [glib-2.0 pango >= 1.21.0]) -fi - -AC_SUBST([UNICODE_CFLAGS]) -AC_SUBST([UNICODE_LIBS]) - -PKG_CHECK_MODULES([ZLIB], [zlib]) -AC_SUBST([ZLIB_CFLAGS]) -AC_SUBST([ZLIB_LIBS]) - -]) diff --git a/Source/cmake/OptionsEfl.cmake b/Source/cmake/OptionsEfl.cmake index 2f2abf4a3..f7195df31 100644 --- a/Source/cmake/OptionsEfl.cmake +++ b/Source/cmake/OptionsEfl.cmake @@ -48,7 +48,8 @@ ADD_DEFINITIONS(-DWTF_USE_ICU_UNICODE=1) SET(WTF_USE_CAIRO 1) ADD_DEFINITIONS(-DWTF_USE_CAIRO=1) -SET(JSC_EXECUTABLE_NAME jsc_efl) +SET(JSC_EXECUTABLE_NAME jsc) + SET(WTF_LIBRARY_NAME wtf_efl) SET(JavaScriptCore_LIBRARY_NAME javascriptcore_efl) SET(WebCore_LIBRARY_NAME webcore_efl) @@ -95,6 +96,7 @@ WEBKIT_FEATURE(ENABLE_TOUCH_EVENTS "Enable Touch Events" DEFAULT OFF) WEBKIT_FEATURE(ENABLE_TOUCH_ICON_LOADING "Enable Touch Icon Loading" DEFAULT OFF) WEBKIT_FEATURE(ENABLE_VIDEO "Enable video" DEFAULT ON) WEBKIT_FEATURE(ENABLE_WEB_SOCKETS "Enable web sockets" DEFAULT ON) +WEBKIT_FEATURE(ENABLE_WEBGL "Enable WebGL" DEFAULT OFF) WEBKIT_FEATURE(ENABLE_WORKERS "Enable workers" DEFAULT ON) WEBKIT_FEATURE(ENABLE_XSLT "Enable XSLT" DEFAULT ON) diff --git a/Source/cmake/WebKitFS.cmake b/Source/cmake/WebKitFS.cmake index bf356c348..0a0778d2a 100644 --- a/Source/cmake/WebKitFS.cmake +++ b/Source/cmake/WebKitFS.cmake @@ -1,6 +1,5 @@ FILE(MAKE_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}) FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Source/JavaScriptCore/runtime) -FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Programs) IF (ENABLE_WEBCORE) FILE(MAKE_DIRECTORY ${DERIVED_SOURCES_WEBCORE_DIR}) diff --git a/Source/qtwebkit-export.map b/Source/qtwebkit-export.map deleted file mode 100644 index ba2e2fbd5..000000000 --- a/Source/qtwebkit-export.map +++ /dev/null @@ -1,167 +0,0 @@ -qwk_1.0 { - global: - WK*; - JSValueToObject; - JSObjectGetProperty; - JSValueIsObjectOfClass; - JSObjectSetProperty; - JSValueMakeString; - JSValueIsObject; - JSStringCreateWithUTF8CString; - JSValueToNumber; - JSStringRelease; - JSValueToStringCopy; - JSStringRetain; - JSClassRetain; - JSObjectGetPrivate; - JSObjectMake; - JSValueMakeBoolean; - JSClassCreate; - JSValueMakeNull; - JSValueToBoolean; - JSValueMakeNumber; - JSObjectCallAsFunction; - JSValueMakeUndefined; - JSClassRelease; - JSStringIsEqualToUTF8CString; - JSStringGetUTF8CString; - JSContextGetGlobalObject; - kJSClassDefinitionEmpty; - JSValueIsNumber; - JSObjectGetPropertyAtIndex; - JSValueIsString; - JSStringGetLength; - JSStringGetCharactersPtr; - JSStringCreateWithCharacters; - JSValueUnprotect; - JSValueProtect; - JSEvaluateScript; - _WKContextSetAdditionalPluginsDirectory; - WTFReportArgumentAssertionFailure; - WTFReportAssertionFailure; - WTFReportBacktrace; - WTFInvokeCrashHook; - WTFSetCrashHook; - extern "C++" { - # WebKit 1 API - *QGraphicsWebView; - non-virtual?thunk?to?QGraphicsWebView*; - QGraphicsWebView::*; - *QWebDatabase; - non-virtual?thunk?to?QWebDatabase*; - QWebDatabase::*; - *QWebElement; - non-virtual?thunk?to?QWebElement*; - QWebElement::*; - *QWebElementCollection; - non-virtual?thunk?to?QWebElementCollection*; - QWebElementCollection::*; - *QWebHitTestResult; - non-virtual?thunk?to?QWebHitTestResult*; - QWebHitTestResult::*; - *QWebFrame; - non-virtual?thunk?to?QWebFrame*; - QWebFrame::*; - *QWebPage; - non-virtual?thunk?to?QWebPage*; - QWebPage::*; - *QWebView; - non-virtual?thunk?to?QWebView*; - QWebView::*; - *QWebSettings; - non-virtual?thunk?to?QWebSettings*; - QWebSettings::*; - *QWebInspector; - non-virtual?thunk?to?QWebInspector*; - QWebInspector::*; - *DumpRenderTreeSupportQt; - non-virtual?thunk?to?DumpRenderTreeSupportQt*; - DumpRenderTreeSupportQt::*; - *QWebPluginFactory; - non-virtual?thunk?to?QWebPluginFactory*; - QWebPluginFactory::*; - *QWebHistory; - non-virtual?thunk?to?QWebHistory*; - QWebHistory::*; - *QWebHistoryItem; - non-virtual?thunk?to?QWebHistoryItem*; - QWebHistoryItem::*; - *QWebSecurityOrigin; - non-virtual?thunk?to?QWebSecurityOrigin*; - QWebSecurityOrigin::*; - *QWebHistoryInterface; - non-virtual?thunk?to?QWebHistoryInterface*; - QWebHistoryInterface::*; - qWebKit*Version*; - "operator<<(QDataStream&, QWebHistory const&)"; - "operator>>(QDataStream&, QWebHistory&)"; - - # WebKit 2 Helpers - WebKit::WebProcessMainQt*; - WTF::fastMalloc*; - WTF::fastFree*; - WTF::fastZeroedMalloc*; - WTF::Mutex::*; - WTF::currentThread*; - - # WebKit 2 API - *QQuickWebView; - non-virtual?thunk?to?QQuickWebView*; - QQuickWebView::*; - *QQuickWebViewPrivate; - non-virtual?thunk?to?QQuickWebViewPrivate*; - QQuickWebViewPrivate::*; - *QWebIconImageProvider; - non-virtual?thunk?to?QWebIconImageProvider*; - QWebIconImageProvider::*; - *QtWebIconDatabaseClient; - non-virtual?thunk?to?QtWebIconDatabaseClient*; - QtWebIconDatabaseClient::*; - *QQuickWebViewPrivateExtension; - non-virtual?thunk?to?QQuickWebViewPrivateExtension*; - QQuickWebViewPrivateExtension::*; - *QQuickWebViewAttached; - non-virtual?thunk?to?QQuickWebViewAttached*; - QQuickWebViewAttached::*; - *QQuickWebViewExperimental; - non-virtual?thunk?to?QQuickWebViewExperimental*; - QQuickWebViewExperimental::*; - *QWebNavigationHistory; - non-virtual?thunk?to?QWebNavigationHistory*; - QWebNavigationHistory::*; - *QWebNavigationListModel; - non-virtual?thunk?to?QWebNavigationListModel*; - QWebNavigationListModel::*; - *QWebPreferences; - non-virtual?thunk?to?QWebPreferences*; - QWebPreferences::*; - *QWebDownloadItem; - non-virtual?thunk?to?QWebDownloadItem*; - QWebDownloadItem::*; - *QWebViewportInfo; - non-virtual?thunk?to?QWebViewportInfo; - QWebViewportInfo::*; - *QQuickWebPage; - non-virtual?thunk?to?QQuickWebPage*; - QQuickWebPage::*; - *QWebPermissionRequest; - non-virtual?thunk?to?QWebPermissionRequest*; - QWebPermissionRequest::*; - *QWebNavigationRequest; - non-virtual?thunk?to?QWebNavigationRequest*; - QWebNavigationRequest::*; - *QQuickUrlSchemeDelegate; - QQuickUrlSchemeDelegate::*; - *QQuickNetworkRequest; - QQuickNetworkRequest::*; - *QQuickNetworkReply; - QQuickNetworkReply::*; - - - # WebKit 2 C API mangled in C++ - WKStringCopyQString*; - WKStringCreateWithQString*; - WKImageCreateQImage*; - }; - local: *; -}; |
