diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-27 21:51:42 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-27 21:51:42 +0200 |
commit | be01689f43cf6882cf670d33df49ead1f570c53a (patch) | |
tree | 4bb2161d8983b38e3e7ed37b4a50303bfd5e2e85 | |
parent | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (diff) | |
download | qtwebkit-be01689f43cf6882cf670d33df49ead1f570c53a.tar.gz |
Imported WebKit commit 8d6c5efc74f0222dfc7bcce8d845d4a2707ed9e6 (http://svn.webkit.org/repository/webkit/trunk@118629)
316 files changed, 6184 insertions, 1319 deletions
@@ -1,3 +1,29 @@ +2012-05-25 Zan Dobersek <zandobersek@gmail.com> + + configure.ac has duplicated AC_MSG_RESULT([$enable_sandbox]) and nothing for seamless iframes + https://bugs.webkit.org/show_bug.cgi?id=87453 + + Reviewed by Eric Seidel. + + Report the value of $enable_iframe_seamless rather than $enable_sandbox + after checking whether to enable the iframe seamless option. + + * configure.ac: + +2012-05-25 Zan Dobersek <zandobersek@gmail.com> + + [Gtk] Remove configuration options that do not apply anymore + https://bugs.webkit.org/show_bug.cgi?id=87509 + + Reviewed by Martin Robinson. + + Remove configuration options for enabling or disabling HTML5 datagrid, + DOM storage, image resizer API and sandboxed iframe support. These + features were either turned on by default with the feature defines + removed from the code or removed from the source. + + * configure.ac: + 2012-05-25 Zalan Bujtas <zbujtas@gmail.com> [Qt] Broken controls rendering when transform is applied. diff --git a/Source/JavaScriptCore/API/JSCallbackConstructor.cpp b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp index c8b4c0659..8fd2b61f1 100644 --- a/Source/JavaScriptCore/API/JSCallbackConstructor.cpp +++ b/Source/JavaScriptCore/API/JSCallbackConstructor.cpp @@ -61,7 +61,7 @@ JSCallbackConstructor::~JSCallbackConstructor() void JSCallbackConstructor::destroy(JSCell* cell) { - jsCast<JSCallbackConstructor*>(cell)->JSCallbackConstructor::~JSCallbackConstructor(); + static_cast<JSCallbackConstructor*>(cell)->JSCallbackConstructor::~JSCallbackConstructor(); } static EncodedJSValue JSC_HOST_CALL constructJSCallback(ExecState* exec) diff --git a/Source/JavaScriptCore/API/JSCallbackObject.cpp b/Source/JavaScriptCore/API/JSCallbackObject.cpp index 68c26824d..921d37897 100644 --- a/Source/JavaScriptCore/API/JSCallbackObject.cpp +++ b/Source/JavaScriptCore/API/JSCallbackObject.cpp @@ -54,13 +54,13 @@ Structure* JSCallbackObject<JSGlobalObject>::createStructure(JSGlobalData& globa template <class Parent> void JSCallbackObject<Parent>::destroy(JSCell* cell) { - jsCast<JSCallbackObject*>(cell)->JSCallbackObject::~JSCallbackObject(); + static_cast<JSCallbackObject*>(cell)->JSCallbackObject::~JSCallbackObject(); } void JSCallbackObjectData::finalize(Handle<Unknown> handle, void* context) { JSClassRef jsClass = static_cast<JSClassRef>(context); - JSObjectRef thisRef = toRef(asObject(handle.get())); + JSObjectRef thisRef = toRef(static_cast<JSObject*>(handle.get().asCell())); for (; jsClass; jsClass = jsClass->parentClass) if (JSObjectFinalizeCallback finalize = jsClass->finalize) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 7bea6a152..c80a45805 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,223 @@ +2012-05-26 Geoffrey Garen <ggaren@apple.com> + + WebKit should be lazy-finalization-safe (esp. the DOM) v2 + https://bugs.webkit.org/show_bug.cgi?id=87581 + + Reviewed by Oliver Hunt. + + * heap/MarkedBlock.cpp: + (JSC::MarkedBlock::callDestructor): + * heap/WeakBlock.h: + * heap/WeakSetInlines.h: + (JSC::WeakBlock::finalize): Since we don't guarantee destruction order, + it's not valid to access GC pointers like the Structure pointer during + finalization. We NULL out the structure pointer in debug builds to try + to make this programming mistake more obvious. + + * API/JSCallbackConstructor.cpp: + (JSC::JSCallbackConstructor::destroy): + * API/JSCallbackObject.cpp: + (JSC::::destroy): + (JSC::JSCallbackObjectData::finalize): + * runtime/Arguments.cpp: + (JSC::Arguments::destroy): + * runtime/DateInstance.cpp: + (JSC::DateInstance::destroy): + * runtime/Error.cpp: + (JSC::StrictModeTypeErrorFunction::destroy): + * runtime/Executable.cpp: + (JSC::ExecutableBase::destroy): + (JSC::NativeExecutable::destroy): + (JSC::ScriptExecutable::destroy): + (JSC::EvalExecutable::destroy): + (JSC::ProgramExecutable::destroy): + (JSC::FunctionExecutable::destroy): + * runtime/JSGlobalObject.cpp: + (JSC::JSGlobalObject::destroy): + * runtime/JSPropertyNameIterator.cpp: + (JSC::JSPropertyNameIterator::destroy): + * runtime/JSStaticScopeObject.cpp: + (JSC::JSStaticScopeObject::destroy): + * runtime/JSString.cpp: + (JSC::JSString::destroy): + * runtime/JSVariableObject.cpp: + (JSC::JSVariableObject::destroy): + * runtime/NameInstance.cpp: + (JSC::NameInstance::destroy): + * runtime/RegExp.cpp: + (JSC::RegExp::destroy): + * runtime/RegExpConstructor.cpp: + (JSC::RegExpConstructor::destroy): + * runtime/Structure.cpp: + (JSC::Structure::destroy): + * runtime/StructureChain.cpp: + (JSC::StructureChain::destroy): Use static_cast instead of jsCast because + jsCast does Structure-based validation, and our Structure is not guaranteed + to be alive when we get finalized. + +2012-05-22 Filip Pizlo <fpizlo@apple.com> + + DFG CSE should eliminate redundant WeakJSConstants + https://bugs.webkit.org/show_bug.cgi?id=87179 + + Reviewed by Gavin Barraclough. + + Merged r118141 from dfgopt. + + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::weakConstantCSE): + (CSEPhase): + (JSC::DFG::CSEPhase::performNodeCSE): + * dfg/DFGNode.h: + (JSC::DFG::Node::weakConstant): + +2012-05-22 Filip Pizlo <fpizlo@apple.com> + + DFG CSE should do redundant store elimination + https://bugs.webkit.org/show_bug.cgi?id=87161 + + Reviewed by Oliver Hunt. + + Merge r118138 from dfgopt. + + This patch adds redundant store elimination. For example, consider this + code: + + o.x = 42; + o.x = 84; + + If o.x is speculated to be a well-behaved field, the first assignment is + unnecessary, since the second just overwrites it. We would like to + eliminate the first assignment in these cases. The need for this + optimization arises mostly from stores that our runtime requires. For + example: + + o = {f:1, g:2, h:3}; + + This will have four assignments to the structure for the newly created + object - one assignment for the empty structure, one for {f}, one for + {f, g}, and one for {f, g, h}. We would like to only have the last of + those assigments in this case. + + Intriguingly, doing so for captured variables breaks the way arguments + simplification used to work. Consider that prior to either arguments + simplification or store elimination we will have IR that looks like: + + a: SetLocal(r0, Empty) + b: SetLocal(r1, Empty) + c: GetLocal(r0) + d: CreateArguments(@c) + e: SetLocal(r0, @d) + f: SetLocal(r1, @d) + + Then redundant store elimination will eliminate the stores that + initialize the arguments registers to Empty, but then arguments + simplification eliminates the stores that initialize the arguments to + the newly created arguments - and at this point we no longer have any + stores to the arguments register, leading to hilarious crashes. This + patch therefore changes arguments simplification to replace + CreateArguments with JSConstant(Empty) rather than eliminating the + SetLocals. But this revealed bugs where arguments simplification was + being overzealous, so I fixed those bugs. + + This is a minor speed-up on V8/early and a handful of other tests. + + * bytecode/CodeBlock.h: + (JSC::CodeBlock::uncheckedActivationRegister): + * dfg/DFGAbstractState.cpp: + (JSC::DFG::AbstractState::execute): + * dfg/DFGArgumentsSimplificationPhase.cpp: + (JSC::DFG::ArgumentsSimplificationPhase::run): + (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUse): + (JSC::DFG::ArgumentsSimplificationPhase::observeBadArgumentsUses): + (JSC::DFG::ArgumentsSimplificationPhase::observeProperArgumentsUse): + * dfg/DFGCSEPhase.cpp: + (JSC::DFG::CSEPhase::globalVarStoreElimination): + (CSEPhase): + (JSC::DFG::CSEPhase::putStructureStoreElimination): + (JSC::DFG::CSEPhase::putByOffsetStoreElimination): + (JSC::DFG::CSEPhase::setLocalStoreElimination): + (JSC::DFG::CSEPhase::setReplacement): + (JSC::DFG::CSEPhase::eliminate): + (JSC::DFG::CSEPhase::performNodeCSE): + * dfg/DFGGraph.h: + (JSC::DFG::Graph::uncheckedActivationRegisterFor): + (Graph): + * dfg/DFGNode.h: + (JSC::DFG::Node::isPhantomArguments): + (Node): + (JSC::DFG::Node::hasConstant): + (JSC::DFG::Node::valueOfJSConstant): + (JSC::DFG::Node::hasStructureTransitionData): + * dfg/DFGNodeType.h: + (DFG): + * dfg/DFGPredictionPropagationPhase.cpp: + (JSC::DFG::PredictionPropagationPhase::propagate): + * dfg/DFGSpeculativeJIT.cpp: + (JSC::DFG::SpeculativeJIT::computeValueRecoveryFor): + * dfg/DFGSpeculativeJIT32_64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + * dfg/DFGSpeculativeJIT64.cpp: + (JSC::DFG::SpeculativeJIT::compile): + +2012-05-21 Filip Pizlo <fpizlo@apple.com> + + DFG ConvertThis should just be a CheckStructure if the structure is known + https://bugs.webkit.org/show_bug.cgi?id=87057 + + Reviewed by Gavin Barraclough. + + Merged r118021 from dfgopt. + + This gives ValueProfile the ability to track singleton values - i.e. profiling + sites that always see the same value. + + That is then used to profile the structure in op_convert_this. + + This is then used to optimize op_convert_this into a CheckStructure if the + structure is always the same. + + That then results in better CSE in inlined code that uses 'this', since + previously we couldn't CSE accesses on 'this' from different inline call frames. + + Also fixed a bug where we were unnecessarily flushing 'this'. + + * bytecode/CodeBlock.cpp: + (JSC::CodeBlock::dump): + (JSC::CodeBlock::stronglyVisitStrongReferences): + * bytecode/LazyOperandValueProfile.cpp: + (JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions): + * bytecode/LazyOperandValueProfile.h: + (CompressedLazyOperandValueProfileHolder): + * bytecode/Opcode.h: + (JSC): + (JSC::padOpcodeName): + * bytecode/ValueProfile.h: + (JSC::ValueProfileBase::ValueProfileBase): + (JSC::ValueProfileBase::dump): + (JSC::ValueProfileBase::computeUpdatedPrediction): + (ValueProfileBase): + * bytecompiler/BytecodeGenerator.cpp: + (JSC::BytecodeGenerator::BytecodeGenerator): + * dfg/DFGByteCodeParser.cpp: + (JSC::DFG::ByteCodeParser::setArgument): + (JSC::DFG::ByteCodeParser::parseBlock): + * jit/JITOpcodes.cpp: + (JSC::JIT::emit_op_convert_this): + (JSC::JIT::emitSlow_op_convert_this): + * jit/JITOpcodes32_64.cpp: + (JSC::JIT::emit_op_convert_this): + (JSC::JIT::emitSlow_op_convert_this): + * llint/LLIntSlowPaths.cpp: + (JSC::LLInt::LLINT_SLOW_PATH_DECL): + * llint/LowLevelInterpreter32_64.asm: + * llint/LowLevelInterpreter64.asm: + * runtime/JSValue.h: + (JSValue): + * runtime/Structure.h: + (JSC::JSValue::structureOrUndefined): + (JSC): + 2012-05-24 Tim Horton <timothy_horton@apple.com> Add feature defines for web-facing parts of CSS Regions and Exclusions diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.cpp b/Source/JavaScriptCore/bytecode/CodeBlock.cpp index 6677b302b..e3ee2ed41 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.cpp +++ b/Source/JavaScriptCore/bytecode/CodeBlock.cpp @@ -670,6 +670,7 @@ void CodeBlock::dump(ExecState* exec, const Vector<Instruction>::const_iterator& case op_convert_this: { int r0 = (++it)->u.operand; dataLog("[%4d] convert_this\t %s\n", location, registerName(exec, r0).data()); + ++it; // Skip value profile. break; } case op_new_object: { @@ -2085,14 +2086,14 @@ void CodeBlock::stronglyVisitStrongReferences(SlotVisitor& visitor) } } - m_lazyOperandValueProfiles.computeUpdatedPredictions(); + m_lazyOperandValueProfiles.computeUpdatedPredictions(Collection); #endif #if ENABLE(VALUE_PROFILER) for (unsigned profileIndex = 0; profileIndex < numberOfArgumentValueProfiles(); ++profileIndex) - valueProfileForArgument(profileIndex)->computeUpdatedPrediction(); + valueProfileForArgument(profileIndex)->computeUpdatedPrediction(Collection); for (unsigned profileIndex = 0; profileIndex < numberOfValueProfiles(); ++profileIndex) - valueProfile(profileIndex)->computeUpdatedPrediction(); + valueProfile(profileIndex)->computeUpdatedPrediction(Collection); #endif } diff --git a/Source/JavaScriptCore/bytecode/CodeBlock.h b/Source/JavaScriptCore/bytecode/CodeBlock.h index c1772c3bf..ccaca3373 100644 --- a/Source/JavaScriptCore/bytecode/CodeBlock.h +++ b/Source/JavaScriptCore/bytecode/CodeBlock.h @@ -449,6 +449,12 @@ namespace JSC { ASSERT(needsFullScopeChain()); return m_activationRegister; } + int uncheckedActivationRegister() + { + if (!needsFullScopeChain()) + return InvalidVirtualRegister; + return activationRegister(); + } bool usesArguments() const { return m_argumentsRegister != -1; } bool needsActivation() const diff --git a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp index f199b6923..695e21219 100644 --- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp +++ b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp @@ -33,13 +33,13 @@ namespace JSC { CompressedLazyOperandValueProfileHolder::CompressedLazyOperandValueProfileHolder() { } CompressedLazyOperandValueProfileHolder::~CompressedLazyOperandValueProfileHolder() { } -void CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions() +void CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions(OperationInProgress operation) { if (!m_data) return; for (unsigned i = 0; i < m_data->size(); ++i) - m_data->at(i).computeUpdatedPrediction(); + m_data->at(i).computeUpdatedPrediction(operation); } LazyOperandValueProfile* CompressedLazyOperandValueProfileHolder::add( diff --git a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h index d0260f991..91e5314aa 100644 --- a/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h +++ b/Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h @@ -155,7 +155,7 @@ public: CompressedLazyOperandValueProfileHolder(); ~CompressedLazyOperandValueProfileHolder(); - void computeUpdatedPredictions(); + void computeUpdatedPredictions(OperationInProgress); LazyOperandValueProfile* add(const LazyOperandValueProfileKey& key); diff --git a/Source/JavaScriptCore/bytecode/Opcode.h b/Source/JavaScriptCore/bytecode/Opcode.h index ebf15bbd4..aa83d9b97 100644 --- a/Source/JavaScriptCore/bytecode/Opcode.h +++ b/Source/JavaScriptCore/bytecode/Opcode.h @@ -43,7 +43,7 @@ namespace JSC { macro(op_init_lazy_reg, 2) \ macro(op_create_arguments, 2) \ macro(op_create_this, 2) \ - macro(op_convert_this, 2) \ + macro(op_convert_this, 3) \ \ macro(op_new_object, 2) \ macro(op_new_array, 4) \ diff --git a/Source/JavaScriptCore/bytecode/ValueProfile.h b/Source/JavaScriptCore/bytecode/ValueProfile.h index 73e363a8b..47fa8b72c 100644 --- a/Source/JavaScriptCore/bytecode/ValueProfile.h +++ b/Source/JavaScriptCore/bytecode/ValueProfile.h @@ -33,6 +33,7 @@ #if ENABLE(VALUE_PROFILER) +#include "Heap.h" #include "JSArray.h" #include "PredictedType.h" #include "Structure.h" @@ -51,6 +52,7 @@ struct ValueProfileBase { : m_bytecodeOffset(-1) , m_prediction(PredictNone) , m_numberOfSamplesInPrediction(0) + , m_singletonValueIsTop(false) { for (unsigned i = 0; i < totalNumberOfBuckets; ++i) m_buckets[i] = JSValue::encode(JSValue()); @@ -60,6 +62,7 @@ struct ValueProfileBase { : m_bytecodeOffset(bytecodeOffset) , m_prediction(PredictNone) , m_numberOfSamplesInPrediction(0) + , m_singletonValueIsTop(false) { for (unsigned i = 0; i < totalNumberOfBuckets; ++i) m_buckets[i] = JSValue::encode(JSValue()); @@ -112,6 +115,11 @@ struct ValueProfileBase { "samples = %u, prediction = %s", totalNumberOfSamples(), predictionToString(m_prediction)); + fprintf(out, ", value = "); + if (m_singletonValueIsTop) + fprintf(out, "TOP"); + else + fprintf(out, "%s", m_singletonValue.description()); bool first = true; for (unsigned i = 0; i < totalNumberOfBuckets; ++i) { JSValue value = JSValue::decode(m_buckets[i]); @@ -127,7 +135,7 @@ struct ValueProfileBase { } // Updates the prediction and returns the new one. - PredictedType computeUpdatedPrediction() + PredictedType computeUpdatedPrediction(OperationInProgress operation = NoOperation) { for (unsigned i = 0; i < totalNumberOfBuckets; ++i) { JSValue value = JSValue::decode(m_buckets[i]); @@ -137,9 +145,23 @@ struct ValueProfileBase { m_numberOfSamplesInPrediction++; mergePrediction(m_prediction, predictionFromValue(value)); + if (!m_singletonValueIsTop && !!value) { + if (!m_singletonValue) + m_singletonValue = value; + else if (m_singletonValue != value) + m_singletonValueIsTop = true; + } + m_buckets[i] = JSValue::encode(JSValue()); } + if (operation == Collection + && !m_singletonValueIsTop + && !!m_singletonValue + && m_singletonValue.isCell() + && !Heap::isMarked(m_singletonValue.asCell())) + m_singletonValueIsTop = true; + return m_prediction; } @@ -148,6 +170,9 @@ struct ValueProfileBase { PredictedType m_prediction; unsigned m_numberOfSamplesInPrediction; + bool m_singletonValueIsTop; + JSValue m_singletonValue; + EncodedJSValue m_buckets[totalNumberOfBuckets]; }; diff --git a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp index 330750b61..fb05e48ff 100644 --- a/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp +++ b/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp @@ -445,8 +445,9 @@ BytecodeGenerator::BytecodeGenerator(FunctionBodyNode* functionBody, ScopeChainN emitOpcode(op_create_this); instructions().append(m_thisRegister.index()); } else if (!codeBlock->isStrictMode() && (functionBody->usesThis() || codeBlock->usesEval() || m_shouldEmitDebugHooks)) { - emitOpcode(op_convert_this); + ValueProfile* profile = emitProfiledOpcode(op_convert_this); instructions().append(m_thisRegister.index()); + instructions().append(profile); } } diff --git a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp index 33c058e7d..ff737cf1d 100644 --- a/Source/JavaScriptCore/dfg/DFGAbstractState.cpp +++ b/Source/JavaScriptCore/dfg/DFGAbstractState.cpp @@ -262,7 +262,8 @@ bool AbstractState::execute(unsigned indexInBlock) switch (node.op()) { case JSConstant: - case WeakJSConstant: { + case WeakJSConstant: + case PhantomArguments: { forNode(nodeIndex).set(m_graph.valueOfJSConstant(nodeIndex)); node.setCanExit(false); break; @@ -1403,6 +1404,7 @@ bool AbstractState::execute(unsigned indexInBlock) } case PutStructure: + case PhantomPutStructure: node.setCanExit(false); clobberStructures(indexInBlock); forNode(node.child1()).set(node.structureTransitionData().newStructure); diff --git a/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp b/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp index 5ab515bd7..48163a91b 100644 --- a/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGArgumentsSimplificationPhase.cpp @@ -283,6 +283,14 @@ public: break; } + case Phantom: + // We don't care about phantom uses, since phantom uses are all about + // just keeping things alive for OSR exit. If something - like the + // CreateArguments - is just being kept alive, then this transformation + // will not break this, since the Phantom will now just keep alive a + // PhantomArguments and OSR exit will still do the right things. + break; + default: observeBadArgumentsUses(node); break; @@ -392,31 +400,6 @@ public: VariableAccessData* variableAccessData = node.variableAccessData(); - // If this is a store into the arguments register for an InlineCallFrame* - // that does not create arguments, then kill it. - int argumentsRegister = - m_graph.uncheckedArgumentsRegisterFor(node.codeOrigin); - if ((variableAccessData->local() == argumentsRegister - || variableAccessData->local() - == unmodifiedArgumentsRegister(argumentsRegister)) - && !m_createsArguments.contains(source.codeOrigin.inlineCallFrame)) { - // Find the Flush. It should be the next instruction. - Node& flush = m_graph[block->at(indexInBlock + 1)]; - ASSERT(flush.op() == Flush); - ASSERT(flush.variableAccessData() == variableAccessData); - ASSERT(flush.child1() == nodeIndex); - // Be defensive in release mode. - if (flush.op() != Flush - || flush.variableAccessData() != variableAccessData - || flush.child1() != nodeIndex) - break; - flush.setOpAndDefaultFlags(Nop); - m_graph.clearAndDerefChild1(flush); - flush.setRefCount(0); - changed = true; - break; - } - if (variableAccessData->isCaptured()) break; @@ -583,6 +566,35 @@ public: insertionSet.execute(*block); } + for (BlockIndex blockIndex = 0; blockIndex < m_graph.m_blocks.size(); ++blockIndex) { + BasicBlock* block = m_graph.m_blocks[blockIndex].get(); + if (!block) + continue; + for (unsigned indexInBlock = 0; indexInBlock < block->size(); ++indexInBlock) { + NodeIndex nodeIndex = block->at(indexInBlock); + Node& node = m_graph[nodeIndex]; + if (!node.shouldGenerate()) + continue; + if (node.op() != CreateArguments) + continue; + // If this is a CreateArguments for an InlineCallFrame* that does + // not create arguments, then replace it with a PhantomArguments. + // PhantomArguments is a constant that represents JSValue() (the + // empty value) in DFG and arguments creation for OSR exit. + if (m_createsArguments.contains(node.codeOrigin.inlineCallFrame)) + continue; + Node phantom(Phantom, node.codeOrigin); + phantom.children = node.children; + phantom.ref(); + node.setOpAndDefaultFlags(PhantomArguments); + node.children.reset(); + NodeIndex phantomNodeIndex = m_graph.size(); + m_graph.append(phantom); + insertionSet.append(indexInBlock, phantomNodeIndex); + } + insertionSet.execute(*block); + } + if (changed) m_graph.collectGarbage(); @@ -659,9 +671,13 @@ private: } VariableAccessData* variableAccessData = child.variableAccessData(); - if (variableAccessData->isCaptured()) + if (variableAccessData->isCaptured()) { + if (child.local() == m_graph.uncheckedArgumentsRegisterFor(child.codeOrigin) + && node.codeOrigin.inlineCallFrame != child.codeOrigin.inlineCallFrame) + m_createsArguments.add(child.codeOrigin.inlineCallFrame); return; - + } + ArgumentsAliasingData& data = m_argumentsAliasing.find(variableAccessData)->second; data.mergeCallContext(node.codeOrigin.inlineCallFrame); } diff --git a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp index 27e198c75..43157963c 100644 --- a/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp +++ b/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp @@ -350,8 +350,9 @@ private: stack->m_argumentPositions[argument]->addVariable(variableAccessData); NodeIndex nodeIndex = addToGraph(SetLocal, OpInfo(variableAccessData), value); m_currentBlock->variablesAtTail.argument(argument) = nodeIndex; - // Always flush arguments. - addToGraph(Flush, OpInfo(variableAccessData), nodeIndex); + // Always flush arguments, except for 'this'. + if (argument) + addToGraph(Flush, OpInfo(variableAccessData), nodeIndex); } VariableAccessData* flushArgument(int operand) @@ -1582,10 +1583,27 @@ bool ByteCodeParser::parseBlock(unsigned limit) case op_convert_this: { NodeIndex op1 = getThis(); - if (m_graph[op1].op() == ConvertThis) - setThis(op1); - else - setThis(addToGraph(ConvertThis, op1)); + if (m_graph[op1].op() != ConvertThis) { + ValueProfile* profile = + m_inlineStackTop->m_profiledBlock->valueProfileForBytecodeOffset(m_currentProfilingIndex); + profile->computeUpdatedPrediction(); +#if DFG_ENABLE(DEBUG_VERBOSE) + dataLog("[@%lu bc#%u]: profile %p: ", m_graph.size(), m_currentProfilingIndex, profile); + profile->dump(WTF::dataFile()); + dataLog("\n"); +#endif + if (profile->m_singletonValueIsTop + || !profile->m_singletonValue + || !profile->m_singletonValue.isCell() + || profile->m_singletonValue.asCell()->classInfo() != &Structure::s_info) + setThis(addToGraph(ConvertThis, op1)); + else { + addToGraph( + CheckStructure, + OpInfo(m_graph.addStructureSet(jsCast<Structure*>(profile->m_singletonValue.asCell()))), + op1); + } + } NEXT_OPCODE(op_convert_this); } diff --git a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp index 842bcc236..3eeb70e05 100644 --- a/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGCSEPhase.cpp @@ -141,6 +141,22 @@ private: return NoNode; } + NodeIndex weakConstantCSE(Node& node) + { + for (unsigned i = endIndexForPureCSE(); i--;) { + NodeIndex index = m_currentBlock->at(i); + Node& otherNode = m_graph[index]; + if (otherNode.op() != WeakJSConstant) + continue; + + if (otherNode.weakConstant() != node.weakConstant()) + continue; + + return index; + } + return NoNode; + } + NodeIndex impureCSE(Node& node) { NodeIndex child1 = canonicalize(node.child1()); @@ -200,6 +216,33 @@ private: return NoNode; } + NodeIndex globalVarStoreElimination(unsigned varNumber, JSGlobalObject* globalObject) + { + for (unsigned i = m_indexInBlock; i--;) { + NodeIndex index = m_currentBlock->at(i); + Node& node = m_graph[index]; + if (!node.shouldGenerate()) + continue; + switch (node.op()) { + case PutGlobalVar: + if (node.varNumber() == varNumber && codeBlock()->globalObjectFor(node.codeOrigin) == globalObject) + return index; + break; + + case GetGlobalVar: + if (node.varNumber() == varNumber && codeBlock()->globalObjectFor(node.codeOrigin) == globalObject) + return NoNode; + break; + + default: + break; + } + if (m_graph.clobbersWorld(index) || node.canExit()) + return NoNode; + } + return NoNode; + } + NodeIndex getByValLoadElimination(NodeIndex child1, NodeIndex child2) { for (unsigned i = m_indexInBlock; i--;) { @@ -304,6 +347,56 @@ private: return false; } + NodeIndex putStructureStoreElimination(NodeIndex child1) + { + for (unsigned i = m_indexInBlock; i--;) { + NodeIndex index = m_currentBlock->at(i); + if (index == child1) + break; + Node& node = m_graph[index]; + if (!node.shouldGenerate()) + break; + switch (node.op()) { + case CheckStructure: + return NoNode; + + case PhantomPutStructure: + if (node.child1() == child1) // No need to retrace our steps. + return NoNode; + break; + + case PutStructure: + if (node.child1() == child1) + return index; + break; + + // PutStructure needs to execute if we GC. Hence this needs to + // be careful with respect to nodes that GC. + case CreateArguments: + case TearOffArguments: + case NewFunctionNoCheck: + case NewFunction: + case NewFunctionExpression: + case CreateActivation: + case TearOffActivation: + case StrCat: + case ToPrimitive: + case NewRegexp: + case NewArrayBuffer: + case NewArray: + case NewObject: + case CreateThis: + return NoNode; + + default: + break; + } + if (m_graph.clobbersWorld(index) || node.canExit()) + return NoNode; + } + return NoNode; + } + NodeIndex getByOffsetLoadElimination(unsigned identifierNumber, NodeIndex child1) { for (unsigned i = m_indexInBlock; i--;) { @@ -350,6 +443,52 @@ private: return NoNode; } + NodeIndex putByOffsetStoreElimination(unsigned identifierNumber, NodeIndex child1) + { + for (unsigned i = m_indexInBlock; i--;) { + NodeIndex index = m_currentBlock->at(i); + if (index == child1) + break; + + Node& node = m_graph[index]; + if (!node.shouldGenerate()) + continue; + switch (node.op()) { + case GetByOffset: + if (m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber == identifierNumber) + return NoNode; + break; + + case PutByOffset: + if (m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber == identifierNumber) { + if (node.child1() == child1) // Must be same property storage. + return index; + return NoNode; + } + break; + + case PutByVal: + case PutByValAlias: + case GetByVal: + if (m_graph.byValIsPure(node)) { + // If PutByVal speculates that it's accessing an array with an + // integer index, then it's impossible for it to cause a structure + // change. + break; + } + return NoNode; + + default: + if (m_graph.clobbersWorld(index)) + return NoNode; + break; + } + if (node.canExit()) + return NoNode; + } + return NoNode; + } + NodeIndex getPropertyStorageLoadElimination(NodeIndex child1) { for (unsigned i = m_indexInBlock; i--;) { @@ -480,6 +619,58 @@ private: return NoNode; } + // This returns the Flush node that is keeping a SetLocal alive. + NodeIndex setLocalStoreElimination(VirtualRegister local) + { + for (unsigned i = m_indexInBlock; i--;) { + NodeIndex index = m_currentBlock->at(i); + Node& node = m_graph[index]; + if (!node.shouldGenerate()) + continue; + switch (node.op()) { + case GetLocal: + case SetLocal: + if (node.local() == local) + return NoNode; + break; + + case GetLocalUnlinked: + if (node.unlinkedLocal() == local) + return NoNode; + break; + + case Flush: { + if (node.local() != local) + break; + if (!i) + break; + NodeIndex prevIndex = m_currentBlock->at(i - 1); + if (prevIndex != node.child1().index()) + break; + ASSERT(m_graph[prevIndex].local() == local); + ASSERT(m_graph[prevIndex].variableAccessData() == node.variableAccessData()); + ASSERT(m_graph[prevIndex].shouldGenerate()); + if (m_graph[prevIndex].refCount() > 1) + break; + return index; + } + + case GetScopeChain: + if (m_graph.uncheckedActivationRegisterFor(node.codeOrigin) == local) + return NoNode; + break; + + default: + if (m_graph.clobbersWorld(index)) + return NoNode; + break; + } + if (node.canExit()) + return NoNode; + } + return NoNode; + } + void performSubstitution(Edge& child, bool addRef = true) { // Check if this operand is actually unused. @@ -501,14 +692,16 @@ private: m_graph[child].ref(); } - bool setReplacement(NodeIndex replacement) + enum PredictionHandlingMode { RequireSamePrediction, AllowPredictionMismatch }; + bool setReplacement(NodeIndex replacement, PredictionHandlingMode predictionHandlingMode = RequireSamePrediction) { if (replacement == NoNode) return false; // Be safe. Don't try to perform replacements if the predictions don't // agree. - if (m_graph[m_compileIndex].prediction() != m_graph[replacement].prediction()) + if (predictionHandlingMode == RequireSamePrediction + && m_graph[m_compileIndex].prediction() != m_graph[replacement].prediction()) return false; #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE) @@ -537,6 +730,17 @@ private: node.setOpAndDefaultFlags(Phantom); } + void eliminate(NodeIndex nodeIndex, NodeType phantomType = Phantom) + { + if (nodeIndex == NoNode) + return; + Node& node = m_graph[nodeIndex]; + if (node.refCount() != 1) + return; + ASSERT(node.mustGenerate()); + node.setOpAndDefaultFlags(phantomType); + } + void performNodeCSE(Node& node) { bool shouldGenerate = node.shouldGenerate(); @@ -622,6 +826,12 @@ private: NodeIndex phiIndex = node.child1().index(); if (!setReplacement(possibleReplacement)) break; + // If the GetLocal we replaced used to refer to a SetLocal, then it now + // should refer to the child of the SetLocal instead. + if (m_graph[phiIndex].op() == SetLocal) { + ASSERT(node.child1().index() == phiIndex); + m_graph.changeEdge(node.children.child1(), m_graph[phiIndex].child1()); + } NodeIndex oldTailIndex = m_currentBlock->variablesAtTail.operand( variableAccessData->local()); if (oldTailIndex == m_compileIndex) { @@ -645,10 +855,39 @@ private: break; } + case SetLocal: { + if (m_fixpointState == FixpointNotConverged) + break; + VariableAccessData* variableAccessData = node.variableAccessData(); + if (!variableAccessData->isCaptured()) + break; + VirtualRegister local = variableAccessData->local(); + NodeIndex replacementIndex = setLocalStoreElimination(local); + if (replacementIndex == NoNode) + break; + Node& replacement = m_graph[replacementIndex]; + ASSERT(replacement.op() == Flush); + ASSERT(replacement.refCount() == 1); + ASSERT(replacement.shouldGenerate()); + ASSERT(replacement.mustGenerate()); + replacement.setOpAndDefaultFlags(Phantom); + NodeIndex setLocalIndex = replacement.child1().index(); + ASSERT(m_graph[setLocalIndex].op() == SetLocal); + m_graph.clearAndDerefChild1(replacement); + replacement.children.child1() = m_graph[setLocalIndex].child1(); + m_graph.ref(replacement.child1()); + break; + } + case JSConstant: // This is strange, but necessary. Some phases will convert nodes to constants, // which may result in duplicated constants. We use CSE to clean this up. - setReplacement(constantCSE(node)); + setReplacement(constantCSE(node), AllowPredictionMismatch); + break; + + case WeakJSConstant: + // FIXME: have CSE for weak constants against strong constants and vice-versa. + setReplacement(weakConstantCSE(node)); break; case GetArrayLength: @@ -681,6 +920,12 @@ private: setReplacement(globalVarLoadElimination(node.varNumber(), codeBlock()->globalObjectFor(node.codeOrigin))); break; + case PutGlobalVar: + if (m_fixpointState == FixpointNotConverged) + break; + eliminate(globalVarStoreElimination(node.varNumber(), codeBlock()->globalObjectFor(node.codeOrigin))); + break; + case GetByVal: if (m_graph.byValIsPure(node)) setReplacement(getByValLoadElimination(node.child1().index(), node.child2().index())); @@ -697,6 +942,12 @@ private: if (checkStructureLoadElimination(node.structureSet(), node.child1().index())) eliminate(); break; + + case PutStructure: + if (m_fixpointState == FixpointNotConverged) + break; + eliminate(putStructureStoreElimination(node.child1().index()), PhantomPutStructure); + break; case CheckFunction: if (checkFunctionElimination(node.function(), node.child1().index())) @@ -718,6 +969,12 @@ private: setReplacement(getByOffsetLoadElimination(m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber, node.child1().index())); break; + case PutByOffset: + if (m_fixpointState == FixpointNotConverged) + break; + eliminate(putByOffsetStoreElimination(m_graph.m_storageAccessData[node.storageAccessDataIndex()].identifierNumber, node.child1().index())); + break; + default: // do nothing. break; diff --git a/Source/JavaScriptCore/dfg/DFGGraph.h b/Source/JavaScriptCore/dfg/DFGGraph.h index 52654d23b..8ca3e2047 100644 --- a/Source/JavaScriptCore/dfg/DFGGraph.h +++ b/Source/JavaScriptCore/dfg/DFGGraph.h @@ -352,6 +352,12 @@ public: codeOrigin.inlineCallFrame->stackOffset; } + int uncheckedActivationRegisterFor(const CodeOrigin& codeOrigin) + { + ASSERT_UNUSED(codeOrigin, !codeOrigin.inlineCallFrame); + return m_codeBlock->uncheckedActivationRegister(); + } + ValueProfile* valueProfileFor(NodeIndex nodeIndex) { if (nodeIndex == NoNode) diff --git a/Source/JavaScriptCore/dfg/DFGNode.h b/Source/JavaScriptCore/dfg/DFGNode.h index 1dbfccb8a..12ebba823 100644 --- a/Source/JavaScriptCore/dfg/DFGNode.h +++ b/Source/JavaScriptCore/dfg/DFGNode.h @@ -201,9 +201,21 @@ struct Node { return op() == WeakJSConstant; } + bool isPhantomArguments() + { + return op() == PhantomArguments; + } + bool hasConstant() { - return isConstant() || isWeakConstant(); + switch (op()) { + case JSConstant: + case WeakJSConstant: + case PhantomArguments: + return true; + default: + return false; + } } unsigned constantNumber() @@ -234,14 +246,23 @@ struct Node { JSCell* weakConstant() { + ASSERT(op() == WeakJSConstant); return bitwise_cast<JSCell*>(m_opInfo); } JSValue valueOfJSConstant(CodeBlock* codeBlock) { - if (op() == WeakJSConstant) + switch (op()) { + case WeakJSConstant: return JSValue(weakConstant()); - return codeBlock->constantRegister(FirstConstantRegisterIndex + constantNumber()).get(); + case JSConstant: + return codeBlock->constantRegister(FirstConstantRegisterIndex + constantNumber()).get(); + case PhantomArguments: + return JSValue(); + default: + ASSERT_NOT_REACHED(); + return JSValue(); // Have to return something in release mode. + } } bool isInt32Constant(CodeBlock* codeBlock) @@ -589,7 +610,7 @@ struct Node { bool hasStructureTransitionData() { - return op() == PutStructure; + return op() == PutStructure || op() == PhantomPutStructure; } StructureTransitionData& structureTransitionData() diff --git a/Source/JavaScriptCore/dfg/DFGNodeType.h b/Source/JavaScriptCore/dfg/DFGNodeType.h index 091f96c6f..743f87955 100644 --- a/Source/JavaScriptCore/dfg/DFGNodeType.h +++ b/Source/JavaScriptCore/dfg/DFGNodeType.h @@ -37,11 +37,11 @@ namespace JSC { namespace DFG { // This macro defines a set of information about all known node types, used to populate NodeId, NodeType below. #define FOR_EACH_DFG_OP(macro) \ /* A constant in the CodeBlock's constant pool. */\ - macro(JSConstant, NodeResultJS) \ + macro(JSConstant, NodeResultJS | NodeDoesNotExit) \ \ /* A constant not in the CodeBlock's constant pool. Uses get patched to jumps that exit the */\ /* code block. */\ - macro(WeakJSConstant, NodeResultJS) \ + macro(WeakJSConstant, NodeResultJS | NodeDoesNotExit) \ \ /* Nodes for handling functions (both as call and as construct). */\ macro(ConvertThis, NodeResultJS) \ @@ -53,10 +53,10 @@ namespace JSC { namespace DFG { /* VariableAccessData, and thus will share predictions. */\ macro(GetLocal, NodeResultJS) \ macro(SetLocal, 0) \ - macro(Phantom, NodeMustGenerate) \ - macro(Nop, 0) \ - macro(Phi, 0) \ - macro(Flush, NodeMustGenerate) \ + macro(Phantom, NodeMustGenerate | NodeDoesNotExit) \ + macro(Nop, 0 | NodeDoesNotExit) \ + macro(Phi, 0 | NodeDoesNotExit) \ + macro(Flush, NodeMustGenerate | NodeDoesNotExit) \ \ /* Get the value of a local variable, without linking into the VariableAccessData */\ /* network. This is only valid for variable accesses whose predictions originated */\ @@ -64,12 +64,12 @@ namespace JSC { namespace DFG { macro(GetLocalUnlinked, NodeResultJS) \ \ /* Marker for an argument being set at the prologue of a function. */\ - macro(SetArgument, 0) \ + macro(SetArgument, 0 | NodeDoesNotExit) \ \ /* Hint that inlining begins here. No code is generated for this node. It's only */\ /* used for copying OSR data into inline frame data, to support reification of */\ /* call frames of inlined functions. */\ - macro(InlineStart, 0) \ + macro(InlineStart, 0 | NodeDoesNotExit) \ \ /* Nodes for bitwise operations. */\ macro(BitAnd, NodeResultInt32) \ @@ -118,11 +118,12 @@ namespace JSC { namespace DFG { macro(PutById, NodeMustGenerate | NodeClobbersWorld) \ macro(PutByIdDirect, NodeMustGenerate | NodeClobbersWorld) \ macro(CheckStructure, NodeMustGenerate) \ - macro(PutStructure, NodeMustGenerate | NodeClobbersWorld) \ + macro(PutStructure, NodeMustGenerate) \ + macro(PhantomPutStructure, NodeMustGenerate | NodeDoesNotExit) \ macro(GetPropertyStorage, NodeResultStorage) \ macro(GetIndexedPropertyStorage, NodeMustGenerate | NodeResultStorage) \ macro(GetByOffset, NodeResultJS) \ - macro(PutByOffset, NodeMustGenerate | NodeClobbersWorld) \ + macro(PutByOffset, NodeMustGenerate) \ macro(GetArrayLength, NodeResultInt32) \ macro(GetArgumentsLength, NodeResultInt32) \ macro(GetStringLength, NodeResultInt32) \ @@ -139,7 +140,7 @@ namespace JSC { namespace DFG { macro(GetScopedVar, NodeResultJS | NodeMustGenerate) \ macro(PutScopedVar, NodeMustGenerate | NodeClobbersWorld) \ macro(GetGlobalVar, NodeResultJS | NodeMustGenerate) \ - macro(PutGlobalVar, NodeMustGenerate | NodeClobbersWorld) \ + macro(PutGlobalVar, NodeMustGenerate) \ macro(CheckFunction, NodeMustGenerate) \ \ /* Optimizations for array mutation. */\ @@ -201,6 +202,7 @@ namespace JSC { namespace DFG { /* Nodes used for arguments. Similar to activation support, only it makes even less */\ /* sense. */\ macro(CreateArguments, NodeResultJS) \ + macro(PhantomArguments, NodeResultJS | NodeDoesNotExit) \ macro(TearOffArguments, NodeMustGenerate) \ macro(GetMyArgumentsLength, NodeResultJS | NodeMustGenerate) \ macro(GetMyArgumentByVal, NodeResultJS | NodeMustGenerate) \ diff --git a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp index de01adb1f..75f0b7a74 100644 --- a/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp +++ b/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp @@ -618,7 +618,9 @@ private: case DoubleAsInt32: case GetLocalUnlinked: case GetMyArgumentsLength: - case GetMyArgumentByVal: { + case GetMyArgumentByVal: + case PhantomPutStructure: + case PhantomArguments: { // This node should never be visible at this stage of compilation. It is // inserted by fixup(), which follows this phase. ASSERT_NOT_REACHED(); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp index db71fc01f..caa21aabf 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp @@ -1360,13 +1360,15 @@ ValueRecovery SpeculativeJIT::computeValueRecoveryFor(const ValueSource& valueSo return ValueRecovery::argumentsThatWereNotCreated(); case HaveNode: { - if (isConstant(valueSource.nodeIndex())) + Node* nodePtr = &at(valueSource.nodeIndex()); + + if (nodePtr->isPhantomArguments()) + return ValueRecovery::argumentsThatWereNotCreated(); + + if (nodePtr->hasConstant()) return ValueRecovery::constant(valueOfJSConstant(valueSource.nodeIndex())); - Node* nodePtr = &at(valueSource.nodeIndex()); if (!nodePtr->shouldGenerate()) { - if (nodePtr->op() == CreateArguments) - return ValueRecovery::argumentsThatWereNotCreated(); // It's legitimately dead. As in, nobody will ever use this node, or operand, // ever. Set it to Undefined to make the GC happy after the OSR. return ValueRecovery::constant(jsUndefined()); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp index 637e335a3..6c0093e41 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp @@ -1848,6 +1848,7 @@ void SpeculativeJIT::compile(Node& node) switch (op) { case JSConstant: + case PhantomArguments: initConstantInfo(m_compileIndex); break; @@ -3429,6 +3430,15 @@ void SpeculativeJIT::compile(Node& node) break; } + case PhantomPutStructure: { + m_jit.addWeakReferenceTransition( + node.codeOrigin.codeOriginOwner(), + node.structureTransitionData().previousStructure, + node.structureTransitionData().newStructure); + noResult(m_compileIndex); + break; + } + case PutStructure: { SpeculateCellOperand base(this, node.child1()); GPRReg baseGPR = base.gpr(); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp index 543e2b913..e4939b23a 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp @@ -1924,6 +1924,7 @@ void SpeculativeJIT::compile(Node& node) switch (op) { case JSConstant: + case PhantomArguments: initConstantInfo(m_compileIndex); break; @@ -3463,6 +3464,15 @@ void SpeculativeJIT::compile(Node& node) break; } + case PhantomPutStructure: { + m_jit.addWeakReferenceTransition( + node.codeOrigin.codeOriginOwner(), + node.structureTransitionData().previousStructure, + node.structureTransitionData().newStructure); + noResult(m_compileIndex); + break; + } + case PutStructure: { SpeculateCellOperand base(this, node.child1()); GPRReg baseGPR = base.gpr(); diff --git a/Source/JavaScriptCore/heap/MarkedBlock.cpp b/Source/JavaScriptCore/heap/MarkedBlock.cpp index 42dc10371..0075f78d7 100644 --- a/Source/JavaScriptCore/heap/MarkedBlock.cpp +++ b/Source/JavaScriptCore/heap/MarkedBlock.cpp @@ -67,8 +67,12 @@ inline void MarkedBlock::callDestructor(JSCell* cell) #if ENABLE(SIMPLE_HEAP_PROFILING) m_heap->m_destroyedTypeCounts.countVPtr(vptr); #endif - cell->methodTable()->destroy(cell); +#if !ASSERT_DISABLED || ENABLE(GC_VALIDATION) + cell->clearStructure(); +#endif + + cell->methodTable()->destroy(cell); cell->zap(); } diff --git a/Source/JavaScriptCore/heap/WeakBlock.h b/Source/JavaScriptCore/heap/WeakBlock.h index dc3e89d55..6461f7b2f 100644 --- a/Source/JavaScriptCore/heap/WeakBlock.h +++ b/Source/JavaScriptCore/heap/WeakBlock.h @@ -115,16 +115,6 @@ inline WeakBlock::FreeCell* WeakBlock::asFreeCell(WeakImpl* weakImpl) return reinterpret_cast<FreeCell*>(weakImpl); } -inline void WeakBlock::finalize(WeakImpl* weakImpl) -{ - ASSERT(weakImpl->state() == WeakImpl::Dead); - weakImpl->setState(WeakImpl::Finalized); - WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner(); - if (!weakHandleOwner) - return; - weakHandleOwner->finalize(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(weakImpl->jsValue())), weakImpl->context()); -} - inline WeakImpl* WeakBlock::weakImpls() { return reinterpret_cast<WeakImpl*>(this) + ((sizeof(WeakBlock) + sizeof(WeakImpl) - 1) / sizeof(WeakImpl)); diff --git a/Source/JavaScriptCore/heap/WeakSetInlines.h b/Source/JavaScriptCore/heap/WeakSetInlines.h index 6e2420c45..c1c87b380 100644 --- a/Source/JavaScriptCore/heap/WeakSetInlines.h +++ b/Source/JavaScriptCore/heap/WeakSetInlines.h @@ -42,6 +42,19 @@ inline WeakImpl* WeakSet::allocate(JSValue jsValue, WeakHandleOwner* weakHandleO return new (NotNull, weakImpl) WeakImpl(jsValue, weakHandleOwner, context); } +inline void WeakBlock::finalize(WeakImpl* weakImpl) +{ + ASSERT(weakImpl->state() == WeakImpl::Dead); + weakImpl->setState(WeakImpl::Finalized); + WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner(); + if (!weakHandleOwner) + return; +#if !ASSERT_DISABLED || ENABLE(GC_VALIDATION) + weakImpl->jsValue().asCell()->clearStructure(); +#endif + weakHandleOwner->finalize(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(weakImpl->jsValue())), weakImpl->context()); +} + } // namespace JSC #endif // WeakSetInlines_h diff --git a/Source/JavaScriptCore/jit/JITOpcodes.cpp b/Source/JavaScriptCore/jit/JITOpcodes.cpp index d458f7fb5..aa2938cc2 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes.cpp @@ -1257,10 +1257,14 @@ void JIT::emit_op_init_lazy_reg(Instruction* currentInstruction) void JIT::emit_op_convert_this(Instruction* currentInstruction) { - emitGetVirtualRegister(currentInstruction[1].u.operand, regT0); + emitGetVirtualRegister(currentInstruction[1].u.operand, regT1); - emitJumpSlowCaseIfNotJSCell(regT0); - addSlowCase(branchPtr(Equal, Address(regT0, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info))); + emitJumpSlowCaseIfNotJSCell(regT1); + if (shouldEmitProfiling()) { + loadPtr(Address(regT1, JSCell::structureOffset()), regT0); + emitValueProfilingSite(); + } + addSlowCase(branchPtr(Equal, Address(regT1, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info))); } void JIT::emit_op_create_this(Instruction* currentInstruction) @@ -1315,15 +1319,21 @@ void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowC void* globalThis = m_codeBlock->globalObject()->globalScopeChain()->globalThis.get(); linkSlowCase(iter); - Jump isNotUndefined = branchPtr(NotEqual, regT0, TrustedImmPtr(JSValue::encode(jsUndefined()))); + if (shouldEmitProfiling()) + move(TrustedImmPtr(bitwise_cast<void*>(JSValue::encode(jsUndefined()))), regT0); + Jump isNotUndefined = branchPtr(NotEqual, regT1, TrustedImmPtr(JSValue::encode(jsUndefined()))); + emitValueProfilingSite(); move(TrustedImmPtr(globalThis), regT0); emitPutVirtualRegister(currentInstruction[1].u.operand, regT0); emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_convert_this)); - isNotUndefined.link(this); linkSlowCase(iter); + if (shouldEmitProfiling()) + move(TrustedImmPtr(bitwise_cast<void*>(JSValue::encode(m_globalData->stringStructure.get()))), regT0); + isNotUndefined.link(this); + emitValueProfilingSite(); JITStubCall stubCall(this, cti_op_convert_this); - stubCall.addArgument(regT0); + stubCall.addArgument(regT1); stubCall.call(currentInstruction[1].u.operand); } diff --git a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp index 5643fe9f3..12e47b2ee 100644 --- a/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp +++ b/Source/JavaScriptCore/jit/JITOpcodes32_64.cpp @@ -1548,12 +1548,15 @@ void JIT::emit_op_convert_this(Instruction* currentInstruction) { unsigned thisRegister = currentInstruction[1].u.operand; - emitLoad(thisRegister, regT1, regT0); + emitLoad(thisRegister, regT3, regT2); - addSlowCase(branch32(NotEqual, regT1, TrustedImm32(JSValue::CellTag))); - addSlowCase(branchPtr(Equal, Address(regT0, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info))); - - map(m_bytecodeOffset + OPCODE_LENGTH(op_convert_this), thisRegister, regT1, regT0); + addSlowCase(branch32(NotEqual, regT3, TrustedImm32(JSValue::CellTag))); + if (shouldEmitProfiling()) { + loadPtr(Address(regT2, JSCell::structureOffset()), regT0); + move(regT3, regT1); + emitValueProfilingSite(); + } + addSlowCase(branchPtr(Equal, Address(regT2, JSCell::classInfoOffset()), TrustedImmPtr(&JSString::s_info))); } void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowCaseEntry>::iterator& iter) @@ -1562,16 +1565,26 @@ void JIT::emitSlow_op_convert_this(Instruction* currentInstruction, Vector<SlowC unsigned thisRegister = currentInstruction[1].u.operand; linkSlowCase(iter); - Jump isNotUndefined = branch32(NotEqual, regT1, TrustedImm32(JSValue::UndefinedTag)); + if (shouldEmitProfiling()) { + move(TrustedImm32(JSValue::UndefinedTag), regT1); + move(TrustedImm32(0), regT0); + } + Jump isNotUndefined = branch32(NotEqual, regT3, TrustedImm32(JSValue::UndefinedTag)); + emitValueProfilingSite(); move(TrustedImmPtr(globalThis), regT0); move(TrustedImm32(JSValue::CellTag), regT1); emitStore(thisRegister, regT1, regT0); emitJumpSlowToHot(jump(), OPCODE_LENGTH(op_convert_this)); - isNotUndefined.link(this); linkSlowCase(iter); + if (shouldEmitProfiling()) { + move(TrustedImm32(JSValue::CellTag), regT1); + move(TrustedImmPtr(m_globalData->stringStructure.get()), regT0); + } + isNotUndefined.link(this); + emitValueProfilingSite(); JITStubCall stubCall(this, cti_op_convert_this); - stubCall.addArgument(regT1, regT0); + stubCall.addArgument(regT3, regT2); stubCall.call(thisRegister); } diff --git a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp index 066530c87..5cba5ea70 100644 --- a/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp +++ b/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp @@ -467,6 +467,8 @@ LLINT_SLOW_PATH_DECL(slow_path_convert_this) LLINT_BEGIN(); JSValue v1 = LLINT_OP(1).jsValue(); ASSERT(v1.isPrimitive()); + pc[OPCODE_LENGTH(op_convert_this) - 1].u.profile->m_buckets[0] = + JSValue::encode(v1.structureOrUndefined()); LLINT_RETURN(v1.toThisObject(exec)); } diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm index e1b08eaa5..dd5ab674a 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm @@ -364,11 +364,13 @@ _llint_op_convert_this: loadi PayloadOffset[cfr, t0, 8], t0 loadp JSCell::m_structure[t0], t0 bbb Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow - dispatch(2) + loadi 8[PC], t1 + valueProfile(CellTag, t0, t1) + dispatch(3) .opConvertThisSlow: callSlowPath(_llint_slow_path_convert_this) - dispatch(2) + dispatch(3) _llint_op_new_object: diff --git a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm index a73085f76..5225bdda9 100644 --- a/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm +++ b/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm @@ -241,11 +241,13 @@ _llint_op_convert_this: btpnz t0, tagMask, .opConvertThisSlow loadp JSCell::m_structure[t0], t0 bbb Structure::m_typeInfo + TypeInfo::m_type[t0], ObjectType, .opConvertThisSlow - dispatch(2) + loadp 16[PB, PC, 8], t1 + valueProfile(t0, t1) + dispatch(3) .opConvertThisSlow: callSlowPath(_llint_slow_path_convert_this) - dispatch(2) + dispatch(3) _llint_op_new_object: diff --git a/Source/JavaScriptCore/runtime/Arguments.cpp b/Source/JavaScriptCore/runtime/Arguments.cpp index 4628cec8d..96791c326 100644 --- a/Source/JavaScriptCore/runtime/Arguments.cpp +++ b/Source/JavaScriptCore/runtime/Arguments.cpp @@ -54,7 +54,7 @@ void Arguments::visitChildren(JSCell* cell, SlotVisitor& visitor) void Arguments::destroy(JSCell* cell) { - jsCast<Arguments*>(cell)->Arguments::~Arguments(); + static_cast<Arguments*>(cell)->Arguments::~Arguments(); } void Arguments::copyToArguments(ExecState* exec, CallFrame* callFrame, uint32_t length) diff --git a/Source/JavaScriptCore/runtime/DateInstance.cpp b/Source/JavaScriptCore/runtime/DateInstance.cpp index a502770c8..47a19df47 100644 --- a/Source/JavaScriptCore/runtime/DateInstance.cpp +++ b/Source/JavaScriptCore/runtime/DateInstance.cpp @@ -55,7 +55,7 @@ void DateInstance::finishCreation(JSGlobalData& globalData, double time) void DateInstance::destroy(JSCell* cell) { - jsCast<DateInstance*>(cell)->DateInstance::~DateInstance(); + static_cast<DateInstance*>(cell)->DateInstance::~DateInstance(); } const GregorianDateTime* DateInstance::calculateGregorianDateTime(ExecState* exec) const diff --git a/Source/JavaScriptCore/runtime/Error.cpp b/Source/JavaScriptCore/runtime/Error.cpp index bae07448b..a3a990d59 100644 --- a/Source/JavaScriptCore/runtime/Error.cpp +++ b/Source/JavaScriptCore/runtime/Error.cpp @@ -183,7 +183,7 @@ const ClassInfo StrictModeTypeErrorFunction::s_info = { "Function", &Base::s_inf void StrictModeTypeErrorFunction::destroy(JSCell* cell) { - jsCast<StrictModeTypeErrorFunction*>(cell)->StrictModeTypeErrorFunction::~StrictModeTypeErrorFunction(); + static_cast<StrictModeTypeErrorFunction*>(cell)->StrictModeTypeErrorFunction::~StrictModeTypeErrorFunction(); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/Executable.cpp b/Source/JavaScriptCore/runtime/Executable.cpp index 0a6425a59..0ada2cb0f 100644 --- a/Source/JavaScriptCore/runtime/Executable.cpp +++ b/Source/JavaScriptCore/runtime/Executable.cpp @@ -43,7 +43,7 @@ const ClassInfo ExecutableBase::s_info = { "Executable", 0, 0, 0, CREATE_METHOD_ #if ENABLE(JIT) void ExecutableBase::destroy(JSCell* cell) { - jsCast<ExecutableBase*>(cell)->ExecutableBase::~ExecutableBase(); + static_cast<ExecutableBase*>(cell)->ExecutableBase::~ExecutableBase(); } #endif @@ -73,7 +73,7 @@ const ClassInfo NativeExecutable::s_info = { "NativeExecutable", &ExecutableBase #if ENABLE(JIT) void NativeExecutable::destroy(JSCell* cell) { - jsCast<NativeExecutable*>(cell)->NativeExecutable::~NativeExecutable(); + static_cast<NativeExecutable*>(cell)->NativeExecutable::~NativeExecutable(); } #endif @@ -108,7 +108,7 @@ const ClassInfo ScriptExecutable::s_info = { "ScriptExecutable", &ExecutableBase #if ENABLE(JIT) void ScriptExecutable::destroy(JSCell* cell) { - jsCast<ScriptExecutable*>(cell)->ScriptExecutable::~ScriptExecutable(); + static_cast<ScriptExecutable*>(cell)->ScriptExecutable::~ScriptExecutable(); } #endif @@ -121,7 +121,7 @@ EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode& source, bool i void EvalExecutable::destroy(JSCell* cell) { - jsCast<EvalExecutable*>(cell)->EvalExecutable::~EvalExecutable(); + static_cast<EvalExecutable*>(cell)->EvalExecutable::~EvalExecutable(); } const ClassInfo ProgramExecutable::s_info = { "ProgramExecutable", &ScriptExecutable::s_info, 0, 0, CREATE_METHOD_TABLE(ProgramExecutable) }; @@ -133,7 +133,7 @@ ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source) void ProgramExecutable::destroy(JSCell* cell) { - jsCast<ProgramExecutable*>(cell)->ProgramExecutable::~ProgramExecutable(); + static_cast<ProgramExecutable*>(cell)->ProgramExecutable::~ProgramExecutable(); } const ClassInfo FunctionExecutable::s_info = { "FunctionExecutable", &ScriptExecutable::s_info, 0, 0, CREATE_METHOD_TABLE(FunctionExecutable) }; @@ -166,7 +166,7 @@ FunctionExecutable::FunctionExecutable(ExecState* exec, const Identifier& name, void FunctionExecutable::destroy(JSCell* cell) { - jsCast<FunctionExecutable*>(cell)->FunctionExecutable::~FunctionExecutable(); + static_cast<FunctionExecutable*>(cell)->FunctionExecutable::~FunctionExecutable(); } JSObject* EvalExecutable::compileOptimized(ExecState* exec, ScopeChainNode* scopeChainNode) diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp index 2a4231537..8c8aa9079 100644 --- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp +++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp @@ -127,7 +127,7 @@ JSGlobalObject::~JSGlobalObject() void JSGlobalObject::destroy(JSCell* cell) { - jsCast<JSGlobalObject*>(cell)->JSGlobalObject::~JSGlobalObject(); + static_cast<JSGlobalObject*>(cell)->JSGlobalObject::~JSGlobalObject(); } void JSGlobalObject::init(JSObject* thisValue) diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp index 6fd8b770b..6ceb3c411 100644 --- a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp +++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp @@ -83,7 +83,7 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject void JSPropertyNameIterator::destroy(JSCell* cell) { - jsCast<JSPropertyNameIterator*>(cell)->JSPropertyNameIterator::~JSPropertyNameIterator(); + static_cast<JSPropertyNameIterator*>(cell)->JSPropertyNameIterator::~JSPropertyNameIterator(); } JSValue JSPropertyNameIterator::get(ExecState* exec, JSObject* base, size_t i) diff --git a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp index fc4c27bab..e5e65673c 100644 --- a/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp +++ b/Source/JavaScriptCore/runtime/JSStaticScopeObject.cpp @@ -36,7 +36,7 @@ const ClassInfo JSStaticScopeObject::s_info = { "Object", &Base::s_info, 0, 0, C void JSStaticScopeObject::destroy(JSCell* cell) { - jsCast<JSStaticScopeObject*>(cell)->JSStaticScopeObject::~JSStaticScopeObject(); + static_cast<JSStaticScopeObject*>(cell)->JSStaticScopeObject::~JSStaticScopeObject(); } void JSStaticScopeObject::visitChildren(JSCell* cell, SlotVisitor& visitor) diff --git a/Source/JavaScriptCore/runtime/JSString.cpp b/Source/JavaScriptCore/runtime/JSString.cpp index ad6bd3812..180c64b8b 100644 --- a/Source/JavaScriptCore/runtime/JSString.cpp +++ b/Source/JavaScriptCore/runtime/JSString.cpp @@ -47,7 +47,7 @@ void JSRopeString::RopeBuilder::expand() void JSString::destroy(JSCell* cell) { - JSString* thisObject = jsCast<JSString*>(cell); + JSString* thisObject = static_cast<JSString*>(cell); thisObject->JSString::~JSString(); } diff --git a/Source/JavaScriptCore/runtime/JSValue.h b/Source/JavaScriptCore/runtime/JSValue.h index 27046097c..f74bfad90 100644 --- a/Source/JavaScriptCore/runtime/JSValue.h +++ b/Source/JavaScriptCore/runtime/JSValue.h @@ -239,6 +239,8 @@ namespace JSC { bool isCell() const; JSCell* asCell() const; JS_EXPORT_PRIVATE bool isValidCallee(); + + JSValue structureOrUndefined() const; char* description() const; diff --git a/Source/JavaScriptCore/runtime/JSVariableObject.cpp b/Source/JavaScriptCore/runtime/JSVariableObject.cpp index eb9dfd4be..9dcbead34 100644 --- a/Source/JavaScriptCore/runtime/JSVariableObject.cpp +++ b/Source/JavaScriptCore/runtime/JSVariableObject.cpp @@ -39,7 +39,7 @@ namespace JSC { void JSVariableObject::destroy(JSCell* cell) { - jsCast<JSVariableObject*>(cell)->JSVariableObject::~JSVariableObject(); + static_cast<JSVariableObject*>(cell)->JSVariableObject::~JSVariableObject(); } bool JSVariableObject::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName) diff --git a/Source/JavaScriptCore/runtime/NameInstance.cpp b/Source/JavaScriptCore/runtime/NameInstance.cpp index aae290cb2..410fe62e7 100644 --- a/Source/JavaScriptCore/runtime/NameInstance.cpp +++ b/Source/JavaScriptCore/runtime/NameInstance.cpp @@ -38,7 +38,7 @@ NameInstance::NameInstance(JSGlobalData& globalData, Structure* structure, JSStr void NameInstance::destroy(JSCell* cell) { - jsCast<NameInstance*>(cell)->NameInstance::~NameInstance(); + static_cast<NameInstance*>(cell)->NameInstance::~NameInstance(); } } // namespace JSC diff --git a/Source/JavaScriptCore/runtime/RegExp.cpp b/Source/JavaScriptCore/runtime/RegExp.cpp index b0f67607e..64e553be1 100644 --- a/Source/JavaScriptCore/runtime/RegExp.cpp +++ b/Source/JavaScriptCore/runtime/RegExp.cpp @@ -243,7 +243,7 @@ void RegExp::finishCreation(JSGlobalData& globalData) void RegExp::destroy(JSCell* cell) { - RegExp* thisObject = jsCast<RegExp*>(cell); + RegExp* thisObject = static_cast<RegExp*>(cell); #if REGEXP_FUNC_TEST_DATA_GEN RegExpFunctionalTestCollector::get()->clearRegExp(this); #endif diff --git a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp index 2c0f0c000..0f2091c27 100644 --- a/Source/JavaScriptCore/runtime/RegExpConstructor.cpp +++ b/Source/JavaScriptCore/runtime/RegExpConstructor.cpp @@ -104,7 +104,7 @@ void RegExpConstructor::finishCreation(ExecState* exec, RegExpPrototype* regExpP void RegExpConstructor::destroy(JSCell* cell) { - jsCast<RegExpConstructor*>(cell)->RegExpConstructor::~RegExpConstructor(); + static_cast<RegExpConstructor*>(cell)->RegExpConstructor::~RegExpConstructor(); } void RegExpConstructor::visitChildren(JSCell* cell, SlotVisitor& visitor) diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp index b22deb0fa..dc4239799 100644 --- a/Source/JavaScriptCore/runtime/Structure.cpp +++ b/Source/JavaScriptCore/runtime/Structure.cpp @@ -216,7 +216,7 @@ Structure::Structure(JSGlobalData& globalData, const Structure* previous) void Structure::destroy(JSCell* cell) { - jsCast<Structure*>(cell)->Structure::~Structure(); + static_cast<Structure*>(cell)->Structure::~Structure(); } void Structure::materializePropertyMap(JSGlobalData& globalData) diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h index 74336a288..f67c4e7f7 100644 --- a/Source/JavaScriptCore/runtime/Structure.h +++ b/Source/JavaScriptCore/runtime/Structure.h @@ -332,6 +332,13 @@ namespace JSC { return entry ? entry->offset : notFound; } + inline JSValue JSValue::structureOrUndefined() const + { + if (isCell()) + return JSValue(asCell()->structure()); + return jsUndefined(); + } + inline bool JSCell::isObject() const { return m_structure->isObject(); diff --git a/Source/JavaScriptCore/runtime/StructureChain.cpp b/Source/JavaScriptCore/runtime/StructureChain.cpp index afb2d9501..a1c97340e 100644 --- a/Source/JavaScriptCore/runtime/StructureChain.cpp +++ b/Source/JavaScriptCore/runtime/StructureChain.cpp @@ -41,7 +41,7 @@ StructureChain::StructureChain(JSGlobalData& globalData, Structure* structure) void StructureChain::destroy(JSCell* cell) { - jsCast<StructureChain*>(cell)->StructureChain::~StructureChain(); + static_cast<StructureChain*>(cell)->StructureChain::~StructureChain(); } void StructureChain::visitChildren(JSCell* cell, SlotVisitor& visitor) diff --git a/Source/Platform/ChangeLog b/Source/Platform/ChangeLog index a09c57daf..7aa43c332 100644 --- a/Source/Platform/ChangeLog +++ b/Source/Platform/ChangeLog @@ -1,3 +1,42 @@ +2012-05-25 Kinuko Yasuda <kinuko@chromium.org> + + [chromium] Deprecate FileUtilities::getFileSize and getFileModifiedTime in favor of getFileMetadata + https://bugs.webkit.org/show_bug.cgi?id=87492 + + Reviewed by Adam Barth. + + * chromium/public/WebFileUtilities.h: + +2012-05-25 Mark Pilgrim <pilgrim@chromium.org> + + [Chomium] Move sandboxSupport to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87518 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * Platform.gypi: + * chromium/public/Platform.h: + (WebKit): + (Platform): + (WebKit::Platform::sandboxSupport): + * chromium/public/android/WebSandboxSupport.h: Added. + (WebKit): + (WebSandboxSupport): + * chromium/public/linux/WebFontFamily.h: Added. + (WebKit): + (WebFontFamily): + * chromium/public/linux/WebSandboxSupport.h: Added. + (WebKit): + (WebSandboxSupport): + * chromium/public/mac/WebSandboxSupport.h: Added. + (WebKit): + (WebSandboxSupport): + * chromium/public/win/WebSandboxSupport.h: Added. + (WebKit): + (WebSandboxSupport): + 2012-05-17 Andrey Kosyakov <caseq@chromium.org> [chromium] add instrumentation for compositing diff --git a/Source/Platform/Platform.gypi b/Source/Platform/Platform.gypi index 9f89c0238..a84fb4732 100644 --- a/Source/Platform/Platform.gypi +++ b/Source/Platform/Platform.gypi @@ -112,9 +112,13 @@ 'chromium/public/WebVideoFrame.h', 'chromium/public/WebVideoFrameProvider.h', 'chromium/public/WebWorkerRunLoop.h', + 'chromium/public/android/WebSandboxSupport.h', 'chromium/public/android/WebThemeEngine.h', + 'chromium/public/linux/WebSandboxSupport.h', 'chromium/public/linux/WebThemeEngine.h', + 'chromium/public/mac/WebSandboxSupport.h', 'chromium/public/mac/WebThemeEngine.h', + 'chromium/public/win/WebSandboxSupport.h', 'chromium/public/win/WebThemeEngine.h', 'chromium/src/Platform.cpp', 'chromium/src/WebCString.cpp', diff --git a/Source/Platform/chromium/public/Platform.h b/Source/Platform/chromium/public/Platform.h index 8aab66c61..86c1538a6 100644 --- a/Source/Platform/chromium/public/Platform.h +++ b/Source/Platform/chromium/public/Platform.h @@ -56,6 +56,7 @@ class WebPeerConnectionHandler; class WebPeerConnectionHandlerClient; class WebURL; class WebURLLoader; +class WebSandboxSupport; class WebSocketStreamHandle; class WebThemeEngine; class WebThread; @@ -80,6 +81,9 @@ public: // Must return non-null. virtual WebMimeRegistry* mimeRegistry() { return 0; } + // May return null if sandbox support is not necessary + virtual WebSandboxSupport* sandboxSupport() { return 0; } + // May return null on some platforms. virtual WebThemeEngine* themeEngine() { return 0; } diff --git a/Source/Platform/chromium/public/WebFileUtilities.h b/Source/Platform/chromium/public/WebFileUtilities.h index d9017f268..1098bda15 100644 --- a/Source/Platform/chromium/public/WebFileUtilities.h +++ b/Source/Platform/chromium/public/WebFileUtilities.h @@ -53,9 +53,6 @@ public: virtual bool fileExists(const WebString& path) { return false; } virtual bool deleteFile(const WebString& path) { return false; } virtual bool deleteEmptyDirectory(const WebString& path) { return false; } - // FIXME: Deprecate getFileSize and getFileModificationTime once getFileInfo is implemented. - virtual bool getFileSize(const WebString& path, long long& result) { return false; } - virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } virtual bool getFileInfo(const WebString& path, WebFileInfo& result) { return false; } virtual WebString directoryName(const WebString& path) { return WebString(); } virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } diff --git a/Source/Platform/chromium/public/android/WebSandboxSupport.h b/Source/Platform/chromium/public/android/WebSandboxSupport.h new file mode 100644 index 000000000..3f39f195d --- /dev/null +++ b/Source/Platform/chromium/public/android/WebSandboxSupport.h @@ -0,0 +1,43 @@ +/* + * 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 WebSandboxSupport_h +#define WebSandboxSupport_h + +namespace WebKit { + +// Empty class, as we need it to compile. +class WebSandboxSupport { +public: +}; + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/linux/WebFontFamily.h b/Source/Platform/chromium/public/linux/WebFontFamily.h new file mode 100644 index 000000000..47f037882 --- /dev/null +++ b/Source/Platform/chromium/public/linux/WebFontFamily.h @@ -0,0 +1,47 @@ +/* + * 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 WebFontFamily_h +#define WebFontFamily_h + +#include "../WebCString.h" +#include "../WebCommon.h" + +namespace WebKit { + +struct WebFontFamily { + WebCString name; + bool isBold; + bool isItalic; +}; + +} // namespace WebKit + +#endif // WebFontFamily_h diff --git a/Source/Platform/chromium/public/linux/WebSandboxSupport.h b/Source/Platform/chromium/public/linux/WebSandboxSupport.h new file mode 100644 index 000000000..8af2c8c23 --- /dev/null +++ b/Source/Platform/chromium/public/linux/WebSandboxSupport.h @@ -0,0 +1,65 @@ +/* + * 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 WebSandboxSupport_h +#define WebSandboxSupport_h + +#include "../WebCommon.h" +#include "../WebString.h" +#include "WebFontFamily.h" + +namespace WebKit { + +struct WebFontRenderStyle; + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Fonts --------------------------------------------------------------- + + // Get a font family which contains glyphs for the given Unicode + // code-points. + // characters: a UTF-16 encoded string + // numCharacters: the number of 16-bit words in |characters| + // preferredLocale: preferred locale identifier for the |characters| + // (e.g. "en", "ja", "zh-CN") + // + // Returns a string with the font family on an empty string if the + // request cannot be satisfied. + // Returns a WebFontFamily instance with the font name. The instance has empty font name if the request cannot be satisfied. + // FIXME: Make this to be a pure virtual function after transition. + virtual void getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*) = 0; + + virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle*) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/mac/WebSandboxSupport.h b/Source/Platform/chromium/public/mac/WebSandboxSupport.h new file mode 100644 index 000000000..34280c6eb --- /dev/null +++ b/Source/Platform/chromium/public/mac/WebSandboxSupport.h @@ -0,0 +1,61 @@ +/* + * 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 WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct CGFont* CGFontRef; + +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Given an input font - |srcFont| [which can't be loaded due to sandbox + // restrictions]. Return a font belonging to an equivalent font file + // that can be used to access the font and a unique identifier corresponding + // to the on-disk font file. + // + // If this function succeeds, the caller assumes ownership of the |out| + // parameter and must call CGFontRelease() to unload it when done. + // + // Returns: true on success, false on error. + virtual bool loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/Platform/chromium/public/win/WebSandboxSupport.h b/Source/Platform/chromium/public/win/WebSandboxSupport.h new file mode 100644 index 000000000..3522c7284 --- /dev/null +++ b/Source/Platform/chromium/public/win/WebSandboxSupport.h @@ -0,0 +1,52 @@ +/* + * 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 WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct HFONT__* HFONT; + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Sometimes a Win32 API call will fail because a font is not loaded, + // and due to sandbox restrictions, the current process may be unable + // to access the filesystem to load the font. So, this call serves as + // a failover to ask the embedder to try some other way to load the + // font (usually by delegating to an empowered process to have it load + // the font). Returns true if the font was successfully loaded. + virtual bool ensureFontLoaded(HFONT) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index df8447177..ac464e541 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,14 @@ +2012-05-25 Filip Pizlo <fpizlo@apple.com> + + weakCompareAndSwap should work on Windows + https://bugs.webkit.org/show_bug.cgi?id=87549 + + Reviewed by Jessie Berlin. + + * wtf/Atomics.h: + (WTF): + (WTF::weakCompareAndSwap): + 2012-05-24 Allan Sandfeld Jensen <allan.jensen@nokia.com> cti_vm_throw gets kicked out by gcc 4.6 -flto diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h index d30926897..d70c72a1f 100644 --- a/Source/WTF/wtf/Atomics.h +++ b/Source/WTF/wtf/Atomics.h @@ -118,6 +118,17 @@ inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_ #endif +#if OS(WINDOWS) +inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) +{ + return InterlockedCompareExchange(reinterpret_cast<LONG volatile*>(location), static_cast<LONG>(newValue), static_cast<LONG>(expected)) == static_cast<LONG>(expected); +} + +inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* newValue) +{ + return InterlockedCompareExchangePointer(location, newValue, expected) == expected; +} +#else // OS(WINDOWS) --> not windows #if COMPILER(GCC) && !COMPILER(CLANG) // Work around a gcc bug inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, unsigned newValue) #else @@ -184,6 +195,7 @@ inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* ne return 0; #endif // ENABLE(COMPARE_AND_SWAP) } +#endif // OS(WINDOWS) (end of the not-windows case) inline bool weakCompareAndSwapUIntPtr(volatile uintptr_t* location, uintptr_t expected, uintptr_t newValue) { diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt index e47ddee41..94ff7bc8c 100644 --- a/Source/WebCore/CMakeLists.txt +++ b/Source/WebCore/CMakeLists.txt @@ -1341,6 +1341,7 @@ SET(WebCore_SOURCES rendering/RenderFrameBase.cpp rendering/RenderFrameSet.cpp rendering/RenderFullScreen.cpp + rendering/RenderGeometryMap.cpp rendering/RenderHTMLCanvas.cpp rendering/RenderIFrame.cpp rendering/RenderImage.cpp diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index f6549bdfc..2574f055c 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,1355 @@ +2012-05-27 David Kilzer <ddkilzer@apple.com> + + Use xcrun to find gperf path on platforms that use Xcode + <http://webkit.org/b/87587> + + Reviewed by Dan Bernstein. + + * WebCore.xcodeproj/project.pbxproj: + (Generate Derived Sources): Set GPERF environment variable using + xcrun. + * css/makeprop.pl: Use GPERF environment variable if set, else + "gperf". + * css/makevalues.pl: Ditto. + * make-hash-tools.pl: Ditto. + +2012-05-27 Li Yin <li.yin@intel.com> + + [FileAPI] FileReader should fire progress event when blob has been completely read into memory + https://bugs.webkit.org/show_bug.cgi?id=87585 + + Reviewed by Kentaro Hara. + + From Spec: http://www.w3.org/TR/FileAPI/#dfn-progress-event + One progress event will fire when blob has been completely read into memory. + Firefox, Opera and IE follows the spec. + Webkit based browser doesn't do that, it only fires progress event at interval of 50ms. + WebKit should add the behavior to make the conformance with the spec. + + Tests: fast/files/file-reader-event-listener.html + + * fileapi/FileReader.cpp: + (WebCore::FileReader::didFinishLoading): + +2012-05-26 Li Yin <li.yin@intel.com> + + [FileAPI] The result attribute of FileReader shuold use null to replace empty string + https://bugs.webkit.org/show_bug.cgi?id=87578 + + Reviewed by Kentaro Hara. + + From Spec: http://www.w3.org/TR/FileAPI/#filedata-attr + Before read method has been called or an error in reading has occurred, + the result attribute should be null, not empty string. + + Currently, Firefox, Opera and IE 10 follows the spec, but Webkit based + browser don't. + WebKit should change the returned value empty string into null to keep + conformance with the spec. + + Tests: fast/files/read-file-async.html + fast/files/blob-slice-test.html + fast/files/read-blob-async.html + fast/files/workers/worker-read-blob-async.html + fast/files/workers/worker-read-file-async.html + + * fileapi/FileReader.cpp: + (WebCore::FileReader::stringResult): + +2012-05-26 Andy Estes <aestes@apple.com> + + Fix the build when NETSCAPE_PLUGIN_API is disabled by marking a + parameter as unused. + + * plugins/PluginData.cpp: + (WebCore::PluginData::initPlugins): + +2012-05-26 Nate Chapin <japhet@chromium.org> + + Cancel CachedResource loads when the last client is removed. + https://bugs.webkit.org/show_bug.cgi?id=35377 + + Reviewed by Darin Adler. + + Test: http/tests/cache/cancel-in-progress-load.html + + * loader/SubresourceLoader.cpp: + (WebCore::SubresourceLoader::errorLoadingResource): + * loader/cache/CachedCSSStyleSheet.cpp: + (WebCore::CachedCSSStyleSheet::allClientsRemoved): + * loader/cache/CachedFont.cpp: + (WebCore::CachedFont::allClientsRemoved): + * loader/cache/CachedImage.cpp: + (WebCore::CachedImage::allClientsRemoved): + * loader/cache/CachedRawResource.cpp: + (WebCore): + * loader/cache/CachedRawResource.h: + (WebCore::CachedRawResource::shouldIgnoreHTTPStatusCodeErrors): + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::allClientsRemoved): + (WebCore): + * loader/cache/CachedResource.h: + (CachedResource): + * loader/cache/CachedScript.cpp: + (WebCore::CachedScript::allClientsRemoved): + +2012-05-26 Simon Fraser <simon.fraser@apple.com> + + fast/block/inline-children-root-linebox-crash.html asserts after r118567 + https://bugs.webkit.org/show_bug.cgi?id=87544 + + Reviewed by Darin Adler. + + RenderInline::offsetFromContainer() set offsetDependsOnPoint to true based + on the container's flipped writing mode. However, offsetFromContainer() would + then overwrite that, since it only checked for columns. + + Fix by having RenderInline::offsetFromContainer() check for flipping on + the container. This fixes the assertion. + + The new testcase exercises fixes another issue; unlike mapLocalToAbsolute(), + RenderGeometryMap::absoluteRect() didn't pass the rect center point through + the mapping, which resulted in a different result in some flipping cases. + + Test: compositing/geometry/flipped-blocks-inline-mapping.html + + * rendering/RenderGeometryMap.cpp: + (WebCore::RenderGeometryMap::absoluteRect): + * rendering/RenderInline.cpp: + (WebCore::RenderInline::offsetFromContainer): + (WebCore::RenderInline::pushMappingToContainer): + +2012-05-26 Geoffrey Garen <ggaren@apple.com> + + WebKit should be lazy-finalization-safe (esp. the DOM) v2 + https://bugs.webkit.org/show_bug.cgi?id=87581 + + Reviewed by Oliver Hunt. + + * bindings/js/JSDOMGlobalObject.cpp: + (WebCore::JSDOMGlobalObject::destroy): + * bindings/js/JSDOMWindowBase.cpp: + (WebCore::JSDOMWindowBase::destroy): + * bindings/js/JSDOMWindowShell.cpp: + (WebCore::JSDOMWindowShell::destroy): + * bindings/js/JSNodeCustom.cpp: + (WebCore::JSNodeOwner::finalize): + * bindings/js/JSWorkerContextBase.cpp: + (WebCore::JSWorkerContextBase::destroy): + * bindings/scripts/CodeGeneratorJS.pm: + (GenerateImplementation): + * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: + (WebCore::JSTestActiveDOMObject::destroy): + (WebCore::JSTestActiveDOMObjectOwner::finalize): + * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: + (WebCore::JSTestCustomNamedGetter::destroy): + (WebCore::JSTestCustomNamedGetterOwner::finalize): + * bindings/scripts/test/JS/JSTestEventConstructor.cpp: + (WebCore::JSTestEventConstructor::destroy): + (WebCore::JSTestEventConstructorOwner::finalize): + * bindings/scripts/test/JS/JSTestEventTarget.cpp: + (WebCore::JSTestEventTarget::destroy): + (WebCore::JSTestEventTargetOwner::finalize): + * bindings/scripts/test/JS/JSTestException.cpp: + (WebCore::JSTestException::destroy): + (WebCore::JSTestExceptionOwner::finalize): + * bindings/scripts/test/JS/JSTestInterface.cpp: + (WebCore::JSTestInterface::destroy): + (WebCore::JSTestInterfaceOwner::finalize): + * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: + (WebCore::JSTestMediaQueryListListener::destroy): + (WebCore::JSTestMediaQueryListListenerOwner::finalize): + * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: + (WebCore::JSTestNamedConstructor::destroy): + (WebCore::JSTestNamedConstructorOwner::finalize): + * bindings/scripts/test/JS/JSTestObj.cpp: + (WebCore::JSTestObj::destroy): + (WebCore::JSTestObjOwner::finalize): + * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: + (WebCore::JSTestSerializedScriptValueInterface::destroy): + (WebCore::JSTestSerializedScriptValueInterfaceOwner::finalize): + * bridge/objc/objc_runtime.mm: + (JSC::Bindings::ObjcFallbackObjectImp::destroy): + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::QtRuntimeMethod::destroy): + * bridge/qt/qt_runtime_qt4.cpp: + (JSC::Bindings::QtRuntimeMethod::destroy): + * bridge/runtime_array.cpp: + (JSC::RuntimeArray::destroy): + * bridge/runtime_method.cpp: + (JSC::RuntimeMethod::destroy): + * bridge/runtime_object.cpp: + (JSC::Bindings::RuntimeObject::destroy): + * bridge/runtime_root.cpp: + (JSC::Bindings::RootObject::finalize): Use static_cast instead of jsCast because + jsCast does Structure-based validation, and our Structure is not guaranteed + to be alive when we get finalized. + +2012-05-26 Simon Fraser <simon.fraser@apple.com> + + Clip rects assertion when hovering div with transform + https://bugs.webkit.org/show_bug.cgi?id=87580 + + Reviewed by Eric Seidel. + + Hit testing used to use temporary clip rects in composited documents, + until r118562. Now that we cache clip rects for hit testing, we need + to clear the cache on descendant layers when a layer gains or loses + a transform. + + Test: fast/layers/clip-rects-assertion.html + + * rendering/RenderLayer.cpp: + (WebCore::RenderLayer::updateTransform): + +2012-05-25 Dan Bernstein <mitz@apple.com> + + <rdar://problem/11439771> WebProcess sends many synchronous messages to the UI process while scrolling beneath ScrollView::contentsToScreen() + https://bugs.webkit.org/show_bug.cgi?id=87571 + + Reviewed by Anders Carlsson. + + fakeMouseEventTimerFired() uses the last known mouse position for the fake mouse event, but + calls contentsToScreen() to compute a corresponding position in screen coordinates. Avoid + this by also recording the last known mouse position in screen coordinates, and using that + value. + + * page/EventHandler.cpp: + (WebCore::EventHandler::clear): Added resetting m_currentMouseGlobalPosition. + (WebCore::EventHandler::handleMousePressEvent): Added updating m_currentMouseGlobalPosition + when updating m_currentMousePosition. + (WebCore::EventHandler::handleMouseDoubleClickEvent): Ditto. + (WebCore::EventHandler::handleMouseMoveEvent): Ditto. + (WebCore::EventHandler::handleMouseReleaseEvent): Ditto. + (WebCore::EventHandler::fakeMouseMoveEventTimerFired): Changed to use m_currentMouseGlobalPosition + in the fake event instead of calling contentsToScreen(). + * page/EventHandler.h: Added m_currentMouseGlobalPosition data member. + +2012-05-25 Philippe Normand <pnormand@igalia.com> + + [GStreamer] Remove ImageGStreamerCG implementation + https://bugs.webkit.org/show_bug.cgi?id=87559 + + The ImageGStreamerCG abstraction is being removed until I manage to + port my gst-mac WebKit branch over to the WebKit2 mac port. No + need to update the XCode project because this file is not + referenced there anyway. + + Reviewed by Martin Robinson. + + * platform/graphics/gstreamer/ImageGStreamer.h: + (ImageGStreamer): + * platform/graphics/gstreamer/ImageGStreamerCG.mm: Removed. + +2012-05-26 Rob Buis <rwlbuis@webkit.org> + + Bug 15799: textPath element does not re-render when referenced path changes + https://bugs.webkit.org/show_bug.cgi?id=15799 + + Reviewed by Nikolas Zimmermann. + + Support textPath updating to changes on the referenced path. To make this possible + use the target reference functionality also used by SVGFEImageElement. + + Tests: svg/custom/textPath-change-id-expected.svg + svg/custom/textPath-change-id-pattern-expected.svg + svg/custom/textPath-change-id-pattern.svg + svg/custom/textPath-change-id.svg + svg/custom/textPath-change-id2-expected.svg + svg/custom/textPath-change-id2-pattern-expected.svg + svg/custom/textPath-change-id2-pattern.svg + svg/custom/textPath-change-id2.svg + svg/custom/textPath-change-reference-expected.svg + svg/custom/textPath-change-reference-pattern-expected.svg + svg/custom/textPath-change-reference-pattern.svg + svg/custom/textPath-change-reference-using-baseval-expected.svg + svg/custom/textPath-change-reference-using-baseval-pattern-expected.svg + svg/custom/textPath-change-reference-using-baseval-pattern.svg + svg/custom/textPath-change-reference-using-baseval.svg + svg/custom/textPath-change-reference.svg + svg/custom/textPath-change-reference2-expected.svg + svg/custom/textPath-change-reference2-pattern-expected.svg + svg/custom/textPath-change-reference2-pattern.svg + svg/custom/textPath-change-reference2-using-baseval-expected.svg + svg/custom/textPath-change-reference2-using-baseval-pattern-expected.svg + svg/custom/textPath-change-reference2-using-baseval-pattern.svg + svg/custom/textPath-change-reference2-using-baseval.svg + svg/custom/textPath-change-reference2.svg + svg/custom/textPath-insert-path-expected.svg + svg/custom/textPath-insert-path-pattern-expected.svg + svg/custom/textPath-insert-path-pattern.svg + svg/custom/textPath-insert-path.svg + svg/custom/textPath-modify-child-expected.svg + svg/custom/textPath-modify-child-pattern-expected.svg + svg/custom/textPath-modify-child-pattern.svg + svg/custom/textPath-modify-child.svg + svg/custom/textPath-path-change-expected.svg + svg/custom/textPath-path-change-pattern-expected.svg + svg/custom/textPath-path-change-pattern.svg + svg/custom/textPath-path-change-using-svg-dom-expected.svg + svg/custom/textPath-path-change-using-svg-dom-pattern-expected.svg + svg/custom/textPath-path-change-using-svg-dom-pattern.svg + svg/custom/textPath-path-change-using-svg-dom.svg + svg/custom/textPath-path-change.svg + svg/custom/textPath-path-change2-expected.svg + svg/custom/textPath-path-change2-pattern-expected.svg + svg/custom/textPath-path-change2-pattern.svg + svg/custom/textPath-path-change2.svg + svg/custom/textPath-remove-path-expected.svg + svg/custom/textPath-remove-path-pattern-expected.svg + svg/custom/textPath-remove-path-pattern.svg + svg/custom/textPath-remove-path.svg + svg/custom/textPath-set-id-expected.svg + svg/custom/textPath-set-id.svg + svg/custom/textPath-startoffset-expected.svg + svg/custom/textPath-startoffset-pattern-expected.svg + svg/custom/textPath-startoffset-pattern.svg + svg/custom/textPath-startoffset.svg + + * svg/SVGTextPathElement.cpp: + (WebCore::SVGTextPathElement::~SVGTextPathElement): + (WebCore): + (WebCore::SVGTextPathElement::clearResourceReferences): + (WebCore::SVGTextPathElement::svgAttributeChanged): + (WebCore::SVGTextPathElement::buildPendingResource): + (WebCore::SVGTextPathElement::insertedInto): + (WebCore::SVGTextPathElement::removedFrom): + * svg/SVGTextPathElement.h: + +2012-05-26 Nikolas Zimmermann <nzimmermann@rim.com> + + Avoid updateFromElement() usage in SVG + https://bugs.webkit.org/show_bug.cgi?id=87573 + + Stop relying on updateFromElement() - instead rely on addChild/removeChild, which + allows us to optimize the resources re-fetching. When a child is added to the tree + we don't need to remove existing resources from the SVGResourcesCache - the renderer + can't be in the cache yet. Similary, remove the entry from the cache earlier: as soon + as the renderer is removed from the tree, instead of waiting for willBeDestroyed(). + + No new tests, refactoring only. + + * rendering/svg/RenderSVGBlock.cpp: + * rendering/svg/RenderSVGBlock.h: + (RenderSVGBlock): + * rendering/svg/RenderSVGContainer.cpp: + (WebCore::RenderSVGContainer::addChild): + (WebCore): + (WebCore::RenderSVGContainer::removeChild): + * rendering/svg/RenderSVGContainer.h: + (RenderSVGContainer): + * rendering/svg/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::addChild): + (WebCore::RenderSVGInline::removeChild): + * rendering/svg/RenderSVGInline.h: + (RenderSVGInline): + * rendering/svg/RenderSVGModelObject.cpp: + * rendering/svg/RenderSVGModelObject.h: + (RenderSVGModelObject): + * rendering/svg/RenderSVGResourceContainer.cpp: + (WebCore::RenderSVGResourceContainer::registerResource): + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::addChild): + (WebCore): + (WebCore::RenderSVGRoot::removeChild): + * rendering/svg/RenderSVGRoot.h: + (RenderSVGRoot): + * rendering/svg/RenderSVGText.cpp: + (WebCore::RenderSVGText::addChild): + (WebCore::RenderSVGText::removeChild): + * rendering/svg/SVGResourcesCache.cpp: + (WebCore::SVGResourcesCache::clientStyleChanged): + (WebCore::rendererCanHaveResources): + (WebCore): + (WebCore::SVGResourcesCache::clientWasAddedToTree): + (WebCore::SVGResourcesCache::clientWillBeRemovedFromTree): + * rendering/svg/SVGResourcesCache.h: + (SVGResourcesCache): + * svg/SVGStyledElement.cpp: + * svg/SVGStyledElement.h: + (SVGStyledElement): + +2012-05-25 Nat Duca <nduca@chromium.org> + + [chromium] Instrument V8 GC with TraceEvent + https://bugs.webkit.org/show_bug.cgi?id=87530 + + Reviewed by Kentaro Hara. + + We sometimes get performance issues where performance stalls can + be attributed to badly timed GC operations, especially ones that + happen just before a frame running. This adds tracing calls around + GC so that we can better understand these kinds of hangs. + + * bindings/v8/V8GCController.cpp: + (WebCore::V8GCController::gcPrologue): + (WebCore::V8GCController::gcEpilogue): + +2012-05-25 Garrett Casto <gcasto@chromium.org> + + Allow WebTextFieldDecoratorClient to see applied decorations. + https://bugs.webkit.org/show_bug.cgi?id=86557 + + Reviewed by Kent Tamura. + + * html/shadow/TextFieldDecorationElement.cpp: + (WebCore::TextFieldDecorationElement::fromShadowRoot): A function + that will extract a TextFielDecorationElement from a ShadowRoot, if + there is one. + * html/shadow/TextFieldDecorationElement.h: + (WebCore): + (TextFieldDecorator): + +2012-05-25 Tony Chang <tony@chromium.org> + + implement new negative flexing algorithm + https://bugs.webkit.org/show_bug.cgi?id=86528 + + Reviewed by Ojan Vafai. + + Rather than just scale by the negative flexibility, we also take the + flex-basis (preferred size) into consideration. That means items with + a larger preferred size will shrink faster. + + Test: css3/flexbox/flex-algorithm.html (new test cases added) + + * rendering/RenderFlexibleBox.cpp: + (WebCore::RenderFlexibleBox::preferredMainAxisContentExtentForChild): Handle overflow. + (WebCore::RenderFlexibleBox::layoutFlexItems): + (WebCore::RenderFlexibleBox::computeNextFlexLine): Sum weighted negative flex. + (WebCore::RenderFlexibleBox::freezeViolations): + (WebCore::RenderFlexibleBox::resolveFlexibleLengths): Shrink by weighted amount. + Also handle large values by making sure the flex values are finite. + * rendering/RenderFlexibleBox.h: + +2012-05-25 Mihai Parparita <mihaip@chromium.org> + + Allow synchronous XHRs to be disabled in documents + https://bugs.webkit.org/show_bug.cgi?id=87540 + + Reviewed by Eric Seidel. + + Test: fast/xmlhttprequest/xmlhttprequest-sync-disabled.html + + Synchronous XMLHttpRequests are a problematic API, since they result + in blocked UI threads. Some clients may wish to always disable them; + give them a setting to do so (see also r103629 for other cases where + synchronous XHRs are disabled). + + * page/Settings.cpp: + (WebCore): + (WebCore::Settings::Settings): + * page/Settings.h: + (Settings): + (WebCore::Settings::setSyncXHRInDocumentsEnabled): + (WebCore::Settings::syncXHRInDocumentsEnabled): + * testing/InternalSettings.cpp: + (WebCore::InternalSettings::InternalSettings): + (WebCore::InternalSettings::restoreTo): + (WebCore::InternalSettings::setSyncXHRInDocumentsEnabled): + (WebCore): + * testing/InternalSettings.h: + (InternalSettings): + * testing/InternalSettings.idl: + * xml/XMLHttpRequest.cpp: + (WebCore::XMLHttpRequest::open): + +2012-05-25 Kinuko Yasuda <kinuko@chromium.org> + + [chromium] Deprecate FileUtilities::getFileSize and getFileModifiedTime in favor of getFileMetadata + https://bugs.webkit.org/show_bug.cgi?id=87492 + + Reviewed by Adam Barth. + + No new tests: existing tests (http/tests/local/fileapi/* and fast/files/*) should pass. + + * platform/chromium/FileSystemChromium.cpp: + (WebCore::getFileSize): + (WebCore::getFileModificationTime): + (WebCore::getFileMetadata): + * platform/chromium/PlatformSupport.h: + (PlatformSupport): + +2012-05-25 Abhishek Arya <inferno@chromium.org> + + Crash in RenderTableSection::paintCell. + https://bugs.webkit.org/show_bug.cgi?id=87445 + + Reviewed by Eric Seidel and Julien Chaffraix. + + Fix the crash by preventing table parts from being set + as layout root. This prevents us from accessing removed + table cells which can happen if RenderTableSection::layout + is called directly without calling RenderTable::layout first + (in case of cell recalc). + + Add ASSERTs to RenderTableSection::layout to prevent + layout to happen when we are already pending cell recalc + or our table is pending section recalc. In those cases, + RenderTable::layout should be called first to relayout + the entire table. + + Test: tables/table-section-overflow-clip-crash.html + + * rendering/RenderObject.cpp: + (WebCore::objectIsRelayoutBoundary): + * rendering/RenderTableSection.cpp: + (WebCore::RenderTableSection::layout): + +2012-05-25 Philip Rogers <pdr@google.com> + + Fix for self-closing <use> tags + https://bugs.webkit.org/show_bug.cgi?id=87504 + + Reviewed by Adam Barth. + + This change causes self-closing non-html tags to behave the same + as tags immediately followed by the closing tag. + + Test: svg/custom/svg-self-closing-use.html + + * html/parser/HTMLConstructionSite.cpp: + (WebCore::HTMLConstructionSite::attachLater): + (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement): + (WebCore::HTMLConstructionSite::insertForeignElement): + * html/parser/HTMLConstructionSite.h: + (HTMLConstructionSite): + +2012-05-25 Dan Bernstein <mitz@apple.com> + + Make the ICU-based implementation of NonSharedCharacterBreakIterator work in configurations + that do not have COMPARE_AND_SWAP enabled. + + Reviewed by Jessie Berlin. + + * platform/text/TextBreakIteratorICU.cpp: + (WebCore::compareAndSwapNonSharedCharacterBreakIterator): Added this helper. It uses + weakCompareAndSwap when COMPARE_AND_SWAP is enabled, and uses a mutex to do the atomic + compare and swap otherwise. + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Changed to use + compareAndSwapNonSharedCharacterBreakIterator(). + (WebCore::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): Ditto. + +2012-05-25 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Make sure IceCallback is valid for PeerConnection00 + https://bugs.webkit.org/show_bug.cgi?id=87480 + + Reviewed by Adam Barth. + + Existing tests have been extended to cover this change. + + * Modules/mediastream/PeerConnection00.cpp: + (WebCore::PeerConnection00::create): + * Modules/mediastream/PeerConnection00.h: + * Modules/mediastream/PeerConnection00.idl: + +2012-05-25 Mike West <mkwst@chromium.org> + + Inline script and style blocked by Content Security Policy should provide more detailed console errors. + https://bugs.webkit.org/show_bug.cgi?id=86848 + + Reviewed by Adam Barth. + + This change adds a URL and line number for context to each call to + `ContentSecurityPolicy::allowInline*`, and pipes it through to the + console message generation in `CSPDirectiveList::reportViolation`. + + Line numbers are not added for injected scripts (`document.write(...)`, + `document.body.appendChild`, and etc.). + + Tests: http/tests/security/contentSecurityPolicy/injected-inline-script-allowed.html + http/tests/security/contentSecurityPolicy/injected-inline-script-blocked.html + http/tests/security/contentSecurityPolicy/injected-inline-style-allowed.html + http/tests/security/contentSecurityPolicy/injected-inline-style-blocked.html + + * bindings/ScriptControllerBase.cpp: + (WebCore::ScriptController::executeIfJavaScriptURL): + * bindings/js/JSLazyEventListener.cpp: + (WebCore::JSLazyEventListener::initializeJSFunction): + * bindings/v8/V8LazyEventListener.cpp: + (WebCore::V8LazyEventListener::prepareListenerObject): + * dom/ScriptElement.cpp: + (WebCore::ScriptElement::ScriptElement): + (WebCore::ScriptElement::executeScript): + * dom/ScriptElement.h: + (ScriptElement): + * dom/StyleElement.cpp: + (WebCore::StyleElement::StyleElement): + (WebCore::StyleElement::createSheet): + * dom/StyleElement.h: + (StyleElement): + * dom/StyledElement.cpp: + (WebCore::StyledElement::StyledElement): + (WebCore): + (WebCore::StyledElement::style): + (WebCore::StyledElement::styleAttributeChanged): + * dom/StyledElement.h: + (StyledElement): + * page/ContentSecurityPolicy.cpp: + (CSPDirectiveList): + (WebCore::CSPDirectiveList::reportViolation): + (WebCore::CSPDirectiveList::checkInlineAndReportViolation): + (WebCore::CSPDirectiveList::checkEvalAndReportViolation): + (WebCore::CSPDirectiveList::allowJavaScriptURLs): + (WebCore::CSPDirectiveList::allowInlineEventHandlers): + (WebCore::CSPDirectiveList::allowInlineScript): + (WebCore::CSPDirectiveList::allowInlineStyle): + (WebCore::CSPDirectiveList::allowEval): + (WebCore): + (WebCore::isAllowedByAllWithCallStack): + (WebCore::isAllowedByAllWithContext): + (WebCore::ContentSecurityPolicy::allowJavaScriptURLs): + (WebCore::ContentSecurityPolicy::allowInlineEventHandlers): + (WebCore::ContentSecurityPolicy::allowInlineScript): + (WebCore::ContentSecurityPolicy::allowInlineStyle): + * page/ContentSecurityPolicy.h: + (WTF): + +2012-05-25 Tim Horton <timothy_horton@apple.com> + + ENABLE_CSS3_FLEXBOX is insufficient to disable all web-facing bits of the feature + https://bugs.webkit.org/show_bug.cgi?id=87537 + <rdar://problem/11524921> + + Reviewed by Simon Fraser. + + Allow the feature flag to disable more web-facing parts of the CSS3 flexbox + implementation (primarily fallout from hiding it from computed style). + + * css/CSSComputedStyleDeclaration.cpp: + (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): + * css/CSSParser.cpp: + (WebCore::isValidKeywordPropertyAndValue): + (WebCore::isKeywordPropertyID): + (WebCore::CSSParser::parseValue): + * css/CSSPrimitiveValueMappings.h: + (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): + * css/CSSProperty.cpp: + (WebCore::CSSProperty::isInheritedProperty): + * css/CSSPropertyNames.in: + * css/CSSValueKeywords.in: + * css/StyleBuilder.cpp: + (WebCore::StyleBuilder::StyleBuilder): + * css/StylePropertySet.cpp: + (WebCore::StylePropertySet::getPropertyValue): + (WebCore::StylePropertySet::asText): + * css/StylePropertyShorthand.cpp: + (WebCore::shorthandForProperty): + * css/StylePropertyShorthand.h: + * css/StyleResolver.cpp: + (WebCore::StyleResolver::collectMatchingRulesForList): + * page/animation/CSSPropertyAnimation.cpp: + (WebCore::CSSPropertyAnimation::ensurePropertyMap): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::createObject): + * rendering/style/RenderStyleConstants.h: + +2012-05-25 Adrienne Walker <enne@google.com> + + [chromium] Add setting for painting debug info onto tiles + https://bugs.webkit.org/show_bug.cgi?id=75763 + + Reviewed by James Robinson. + + Add a compile-time CCSetting to paint debug information onto tiles. This + can help to understand paint counts and layer indices. This setting is + off by default. + + * platform/graphics/chromium/ContentLayerChromium.cpp: + (WebCore::ContentLayerPainter::create): + (WebCore::ContentLayerPainter::paint): + (WebCore::ContentLayerPainter::ContentLayerPainter): + (WebCore::ContentLayerChromium::createTextureUpdater): + * platform/graphics/chromium/TiledLayerChromium.cpp: + (WebCore::UpdatableTile::UpdatableTile): + (WebCore::UpdatableTile::setUpdateFrame): + (WebCore::UpdatableTile::incrementPaintCount): + (WebCore::UpdatableTile::updateFrame): + (WebCore::UpdatableTile::paintCount): + (WebCore::TiledLayerChromium::TiledLayerChromium): + (WebCore::TiledLayerChromium::prepareToUpdateTiles): + (WebCore::TiledLayerChromium::paintDebugTileInfo): + * platform/graphics/chromium/TiledLayerChromium.h: + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (WebCore::CCSettings::CCSettings): + +2012-05-25 Ami Fischman <fischman@chromium.org> + + [chromium] Default media controls should render only the currentTime-containing buffered range + https://bugs.webkit.org/show_bug.cgi?id=85925 + + Reviewed by Eric Carlson. + + Test: http/tests/media/video-buffered-range-contains-currentTime.html + + * rendering/RenderMediaControlsChromium.cpp: + (WebCore::paintMediaSlider): + +2012-05-25 Simon Fraser <simon.fraser@apple.com> + + Build fix: add TransformationMatrix ctor from an AffineTransform. + + * platform/graphics/transforms/TransformationMatrix.cpp: + (WebCore::TransformationMatrix::TransformationMatrix): + (WebCore): + * platform/graphics/transforms/TransformationMatrix.h: + (TransformationMatrix): + +2012-05-24 Ryosuke Niwa <rniwa@webkit.org> + + createContextualFragment and insertAdjacentHTML should throw syntax error + https://bugs.webkit.org/show_bug.cgi?id=87454 + + Reviewed by Darin Adler. + + Before this patch, createContextualFragment threw NOT_SUPPORTED_ERR and insertAdjacentHTML didn't throw any errors. + Make them throw SYNTAX_ERR to be consistent with the spec and Firefox: + http://html5.org/specs/dom-parsing.html#parsing + http://www.whatwg.org/specs/web-apps/current-work/multipage/the-xhtml-syntax.html#xml-fragment-parsing-algorithm + + Also reduced the code duplication. + + Test: fast/dom/xhtml-fragment-parsing-exceptions.xhtml + + * dom/Range.cpp: + (WebCore::Range::createContextualFragment): + * dom/ShadowRoot.cpp: + (WebCore::ShadowRoot::setInnerHTML): Explicitly pass AllowScriptingContent. + * editing/markup.cpp: + (WebCore::createFragmentFromMarkup): + (WebCore::createFragmentForInnerOuterHTML): Takes ExceptionCode now. + (WebCore::createContextualFragment): Share code with createFragmentForInnerOuterHTML + and propagate the exception code. + * editing/markup.h: + * html/HTMLElement.cpp: + (WebCore::HTMLElement::setInnerHTML): Explicitly pass AllowScriptingContent. + (WebCore::HTMLElement::setOuterHTML): Ditto. + (WebCore::HTMLElement::insertAdjacentHTML): Ditto; also rename ignoredEc to ignoredEC + per Darin's comment on the bug 87339. + +2012-05-25 John Knottenbelt <jknotten@chromium.org> + + Body scrollWidth() and scrollHeight() should be page scale-invariant + https://bugs.webkit.org/show_bug.cgi?id=87494 + + RenderView::documentRect() is calculating the "scaled" document rect by applying + the current transformation matrix to the unscaledDocumentRect() and then + returning the rounded-out IntRect result. + + This rounding out is incorrect because it allows the scaled rectangle to + represent an area that is not actually covered by the document. + + We fix this by applying the current transform to the document rect + as a FloatRect and then explicitly converting to IntRect, which + takes the floor of the resulting rectangle coordinates instead of + rounding them out. + + This is evidenced by the document.body.scrollWidth() and + document.body.scrollHeight() changing under page scale factor when + they are expected to remain invariant. + + Reviewed by James Robinson. + + Test: fast/dom/window-scroll-scaling.html + + * rendering/RenderView.cpp: + (WebCore::RenderView::documentRect): + +2012-05-25 Dan Bernstein <mitz@apple.com> + + characterBreakIterator() is not safe to use reentrantly or from multiple threads + https://bugs.webkit.org/show_bug.cgi?id=87521 + + Reviewed by Darin Adler. + + Replaced characterBreakIterator() with a NonSharedCharacterBreakIterator class, which + obtains a unique TextBreakIterator. Replaced the global shared instance with a single-entry + cache. + + * dom/CharacterData.cpp: + (WebCore::CharacterData::parserAppendData): Changed to use NonSharedCharacterBreakIterator. + + * platform/graphics/StringTruncator.cpp: + (WebCore::centerTruncateToBuffer): Ditto. + (WebCore::rightTruncateToBuffer): Ditto. + + * platform/text/String.cpp: + (WebCore::numGraphemeClusters): Ditto. + (WebCore::numCharactersInGraphemeClusters): Ditto. + + * platform/text/TextBreakIterator.h: Removed the declaration of characterBreakIterator(). + (NonSharedCharacterBreakIterator): Added. An instance of this class has a character break + iterator instance that is unique to it for the lifetime of the instance. + (WebCore::NonSharedCharacterBreakIterator::operator TextBreakIterator*): Added. + + * platform/text/TextBreakIteratorICU.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Added. Tries + to swap the m_iterator member variable with the cached instance. If that fails, initializes + m_iterator to a new character break iterator. + (WebCore::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): Added. Tries + to put the m_iterator member variable back in the cache. If that fails, meaning there is + already something in the cache, destroys m_iterator. + + * platform/text/gtk/TextBreakIteratorGtk.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Same as in + TextBreakIteratorICU.cpp. + (WebCore::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): Ditto. + (WebCore::cursorMovementIterator): Moved the old implementation of characterBreakIterator() + here. + + * platform/text/qt/TextBreakIteratorQt.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Same as in + TextBreakIteratorICU.cpp. + (WebCore::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): Ditto. + (WebCore::cursorMovementIterator): Moved the old implementation of characterBreakIterator() + here. + + * platform/text/wince/TextBreakIteratorWinCE.cpp: + (WebCore::NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator): Same as in + TextBreakIteratorICU.cpp. + (WebCore::NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator): Ditto. + (WebCore::cursorMovementIterator): Moved the old implementation of characterBreakIterator() + here. + +2012-05-25 Simon Fraser <simon.fraser@apple.com> + + Terrible performance on http://alliances.commandandconquer.com/ and http://www.lordofultima.com/ + https://bugs.webkit.org/show_bug.cgi?id=84410 + + Reviewed by Dave Hyatt. + + First part of fixing O(N^2) issues when walking the RenderLayer tree + for computeCompositingRequirements(). + + For each layer that goes into the OverlapMap, we were computing an absolute + layer bounds, which requires walking back to the root of the tree. + Optimize this when possible by storing a stack of offsets as we walk + the tree, and using this stack to do the mapping. + + The stack of offsets and transforms is managed by RenderGeometryMap. + When visiting a RenderLayer, RenderLayerCompositor pushes onto + the geometry map stack data about offsets and transforms between + the current layer and its stacking-parent. RenderGeometryMap handles + the case where the previous renderer pushed is between the current + renderer and its container. RenderGeometryMap can also handle callers + pushing renderers with multiple containers between them. + + RenderGeometryMap stores some flags about whether the set of mapping + steps in the stack involve transforms, fixed position, or special non-uniform + mappings like CSS columns. In some cases, it falls back to mapping via + renderers. + + Once constructed, the RenderGeometryMap stack can be used to map multiple + rects or points efficiently. Stacks consisting of simple offsets are + collapsed to a single offset. + + Mappings between renderers and their containers are pushed by pushMappingToContainer() + methods, which are similar to mapLocalToContainer() methods. Having this code + in RenderObjects was deemed preferable to handling columns, transforms etc. all in + RenderLayer code. + + Tested by assertions in RenderGeometryMap code that its mapping matches + mapping via localToAbsolute() calls. + + RenderLayerCompositor::updateCompositingLayers() creates a RenderGeometryMap, + and pushes and pops layer renderers as it visits them. The geometry map is used + by RenderLayerCompositor::addToOverlapMap() when computing absolute layer bounds. + + Futher optimizations in RenderGeometryMap are possible, especially with stacks that + have many offsets and a few transforms. + + Tests: compositing/geometry/composited-in-columns.html + compositing/geometry/flipped-writing-mode.html + + * CMakeLists.txt: Add RenderGeometryMap + * GNUmakefile.list.am: Ditt + * Target.pri: Ditto + * WebCore.gypi: Ditto + * WebCore.vcproj/WebCore.vcproj: Ditto + * WebCore.xcodeproj/project.pbxproj: Ditto + * rendering/RenderBox.cpp: + (WebCore::RenderBox::absoluteContentBox): + (WebCore::RenderBox::pushMappingToContainer): + (WebCore::RenderBox::offsetFromContainer): + * rendering/RenderBox.h: + * rendering/RenderGeometryMap.cpp: Added. + (RenderGeometryMapStep): + (WebCore::RenderGeometryMapStep::RenderGeometryMapStep): + (WebCore::RenderGeometryMapStep::mapPoint): + (WebCore::RenderGeometryMapStep::mapQuad): + (WebCore::RenderGeometryMap::RenderGeometryMap): + (WebCore::RenderGeometryMap::~RenderGeometryMap): + (WebCore::RenderGeometryMap::absolutePoint): + (WebCore::RenderGeometryMap::absoluteRect): + (WebCore::RenderGeometryMap::mapToAbsolute): + (WebCore::RenderGeometryMap::pushMappingsToAncestor): + (WebCore::RenderGeometryMap::push): + (WebCore::RenderGeometryMap::pushView): + (WebCore::RenderGeometryMap::popMappingsToAncestor): + (WebCore::RenderGeometryMap::stepInserted): + (WebCore::RenderGeometryMap::stepRemoved): + * rendering/RenderGeometryMap.h: Added. + (RenderGeometryMap): + (WebCore::RenderGeometryMap::hasNonUniformStep): + (WebCore::RenderGeometryMap::hasTransformStep): + (WebCore::RenderGeometryMap::hasFixedPositionStep): + * rendering/RenderInline.cpp: + (WebCore::RenderInline::offsetFromContainer): + (WebCore::RenderInline::pushMappingToContainer): + * rendering/RenderInline.h: + (RenderInline): + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateCompositingLayers): + (WebCore::RenderLayerCompositor::addToOverlapMap): + (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): + (WebCore::RenderLayerCompositor::computeCompositingRequirements): + * rendering/RenderLayerCompositor.h: + (RenderLayerCompositor): + * rendering/RenderObject.cpp: + (WebCore::RenderObject::mapLocalToContainer): + (WebCore::RenderObject::pushMappingToContainer): + (WebCore::RenderObject::offsetFromContainer): + (WebCore::RenderObject::container): + * rendering/RenderObject.h: + * rendering/RenderTableCell.cpp: + (WebCore::RenderTableCell::offsetFromContainer): + * rendering/RenderTableCell.h: + (RenderTableCell): + * rendering/RenderView.cpp: + (WebCore::RenderView::pushMappingToContainer): + * rendering/RenderView.h: + * rendering/svg/RenderSVGForeignObject.cpp: + (WebCore::RenderSVGForeignObject::pushMappingToContainer): + * rendering/svg/RenderSVGForeignObject.h: + (RenderSVGForeignObject): + * rendering/svg/RenderSVGInline.cpp: + (WebCore::RenderSVGInline::pushMappingToContainer): + * rendering/svg/RenderSVGInline.h: + (RenderSVGInline): + * rendering/svg/RenderSVGModelObject.cpp: + (WebCore::RenderSVGModelObject::pushMappingToContainer): + * rendering/svg/RenderSVGModelObject.h: + (RenderSVGModelObject): + * rendering/svg/RenderSVGRoot.cpp: + (WebCore::RenderSVGRoot::pushMappingToContainer): + * rendering/svg/RenderSVGRoot.h: + (RenderSVGRoot): + * rendering/svg/RenderSVGText.cpp: + (WebCore::RenderSVGText::pushMappingToContainer): + * rendering/svg/RenderSVGText.h: + (RenderSVGText): + * rendering/svg/SVGRenderSupport.cpp: + (WebCore::SVGRenderSupport::pushMappingToContainer): + * rendering/svg/SVGRenderSupport.h: + (SVGRenderSupport): + +2012-05-25 Simon Fraser <simon.fraser@apple.com> + + Cache absolute clip rects on RenderLayer for compositing overlap testing + https://bugs.webkit.org/show_bug.cgi?id=87212 + + Reviewed by Dave Hyatt. + + Enhance the cache of ClipRects on RenderLayers to store three + different types of ClipRects, rather than just one. + + We need to compute clip rects relative to different layers + for different purposes. For painting, we compute relative to + the compositing layer which is acting as a painting root. + For hit testing, we compute relative to the root, except + for transformed layers. For composting overlap testing, we + compute relative to the root ("absolute"). At other times, we do one-off + computation which we never want to cache ("temporary clip rects"). + + This change allows us to cache rects for hit testing, and for + compositing overlap testing. This has huge performance benefits + on some pages (bug 84410). + + This change also makes ClipRects not arena-allocated, so we + can use RefPtr<ClipRect>. + + No testable behavior change. + + * rendering/RenderBoxModelObject.cpp: + (WebCore::RenderBoxModelObject::willBeDestroyed): No need for the + explicit clipRects teardown, since clipRects don't need a live + RenderObject for arena-based destruction. + + * rendering/RenderLayer.cpp: Remove arena-related new and delete. + (WebCore::RenderLayer::RenderLayer): No need to explicitly initialize m_clipRects, + since it's an OwnPtr now. + (WebCore::RenderLayer::~RenderLayer): No explicit clipRect teardown required. + (WebCore::RenderLayer::clippingRootForPainting): Renamed to make its purpose + more obvious. + (WebCore::RenderLayer::paintLayer): Use the TemporaryClipRects type when necessary. + (WebCore::RenderLayer::paintLayerContents): Ditto + (WebCore::RenderLayer::hitTestLayer): No longer need to use temporary clipRects when + hit testing since we cache clip rects for hit testing. + (WebCore::RenderLayer::updateClipRects): Take a ClipRectsType and pass it through. + (WebCore::RenderLayer::calculateClipRects): Ditto + (WebCore::RenderLayer::parentClipRects): Ditto + (WebCore::RenderLayer::backgroundClipRect): Ditto + (WebCore::RenderLayer::calculateRects): Take ClipRectsType, which obviates temporaryClipRects. + (WebCore::RenderLayer::childrenClipRect): Use clippingRootForPainting(). + (WebCore::RenderLayer::selfClipRect): Ditto + (WebCore::RenderLayer::localClipRect): Ditto + (WebCore::RenderLayer::clearClipRectsIncludingDescendants): Take a type of clip rect to clear + (include all). Allows us to just clear painting clip rects. + (WebCore::RenderLayer::clearClipRects): + + * rendering/RenderLayer.h: + (WebCore::ClipRects::create): We don't use RefCounted<> in order to use a bit in + the refCount for a flag. Add create() method. + (WebCore::ClipRects::deref): No longer arena-allocated. + (WebCore::ClipRectsCache::ClipRectsCache): Struct that holds a small + array of the 3 types of clipRects (and, in debug, the layer relative + to which they were computed). + (WebCore::RenderLayer::clipRects): + + * rendering/RenderLayerBacking.cpp: + (WebCore::RenderLayerBacking::updateCompositedBounds): Use AbsoluteClipRects; rootLayer + is always the RenderView's layer here. + (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Use TemporaryClipRects. + (WebCore::RenderLayerBacking::setRequiresOwnBackingStore): When this variable changes, + we need to invalidate painting clipRects, since it affects the ancestor relative to which + those rects are computed. + + * rendering/RenderLayerBacking.h: + * rendering/RenderLayerCompositor.cpp: + (WebCore::RenderLayerCompositor::updateBacking): When the composited state + of a layer changes, we have to clear all descendant clip rects, since this + can affect the layers relative to which clip rects are computed. + (WebCore::RenderLayerCompositor::addToOverlapMap): Use AbsoluteClipRects. + (WebCore::RenderLayerCompositor::computeCompositingRequirements): No need + to call updateLayerPosition(), since that should have always happened after + layout. That call cleared clip rects, so removing it is very beneficial. + (WebCore::RenderLayerCompositor::clippedByAncestor): Use TemporaryClipRects. + + * rendering/RenderTreeAsText.cpp: + (WebCore::writeLayers): Use TemporaryClipRects. + +2012-05-25 Dean Jackson <dino@apple.com> + + Unreviewed, rolling out r112155. + http://trac.webkit.org/changeset/112155 + https://bugs.webkit.org/show_bug.cgi?id=79389 + Hitch (due to style recalc?) when starting CSS3 animation + + This caused a number of issues, including: + https://bugs.webkit.org/show_bug.cgi?id=87146 + https://bugs.webkit.org/show_bug.cgi?id=84194 + <rdar://problem/11506629> + <rdar://problem/11267408> + <rdar://problem/11531859> + + * dom/Element.cpp: + (WebCore::Element::recalcStyle): + +2012-05-25 David Hyatt <hyatt@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87525 + + For the new multi-column layout, create a flow thread and make sure the children get put inside it. + + Reviewed by Eric Seidel. + + * rendering/RenderMultiColumnBlock.cpp: + (WebCore::RenderMultiColumnBlock::RenderMultiColumnBlock): + (WebCore::RenderMultiColumnBlock::addChild): + (WebCore): + * rendering/RenderMultiColumnBlock.h: + (WebCore): + (RenderMultiColumnBlock): + (WebCore::RenderMultiColumnBlock::flowThread): + * rendering/RenderMultiColumnFlowThread.cpp: + (WebCore::RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread): + (WebCore): + * rendering/RenderMultiColumnFlowThread.h: + (RenderMultiColumnFlowThread): + * rendering/RenderMultiColumnSet.h: + * rendering/RenderObject.h: + (RenderObject): + (WebCore::RenderObject::isRenderMultiColumnSet): + +2012-05-25 Emil A Eklund <eae@chromium.org> + + Change RenderBoxModelObject to compute relativePositionOffset as size + https://bugs.webkit.org/show_bug.cgi?id=87447 + + Reviewed by Eric Seidel. + + Compute relativePositionOffset as size instead of doing one axis at a + time as all call sites uses the size version of the method. This avoids + having to walk the DOM twice to accumulate the offsets. + + Also remove the relativePositionOffsetX and Y methods as they are no + longer used. + + No new tests, covered by existing tests. + + * rendering/RenderBox.cpp: + (WebCore::RenderBox::layoutOverflowRectForPropagation): + * rendering/RenderBoxModelObject.cpp: + (WebCore::accumulateRelativePositionOffsets): + (WebCore::RenderBoxModelObject::relativePositionOffset): + * rendering/RenderBoxModelObject.h: + (RenderBoxModelObject): + +2012-05-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r118395. + http://trac.webkit.org/changeset/118395 + https://bugs.webkit.org/show_bug.cgi?id=87526 + + Breaking sites including GMail and Yahoo mail (Requested by + jsbell on #webkit). + + * rendering/RenderBlock.cpp: + (WebCore::RenderBlock::collapseMargins): + +2012-05-25 Ken Buchanan <kenrb@chromium.org> + + Layout root not getting cleared for anonymous renderers geting destroyed + https://bugs.webkit.org/show_bug.cgi?id=84002 + + Reviewed by Abhishek Arya. + + This is a follow-up to r109406, which added a check to clear layout + roots when they point to a renderer that is being destroyed. The + thinking was that layout roots would never be anonymous renderers, + but there are some cases where this is not true (in particular, + generated content containers with overflow clips can be layout roots). + + As in r109406, this patch has no layout test. This is because any test + that exercises this behavior is caused by an existing layout bug where + a child is not properly getting layout (or a renderer is getting dirtied + out of order during layout) and will fail multiple ASSERTs: + in particular, ASSERT(!m_layoutRoot->container() || !m_layoutRoot-> + container()->needsLayout()) in FrameView::scheduleRelayoutOfSubtree(), + and ASSERT_NOT_REACHED() in RenderObject::clearLayoutRootIfNeeded(). + We are preventing those bugs from manifesting as security issues with + this patch. + + This also removes an ASSERT from the RenderObject destructor. This is + redundant with the condition in RenderObject::clearLayoutRootIfNeeded() + which is always called in RenderObject::willBeDestroyed(), so the check + is not needed. It had to be removed because it fails when I try to + adjust the ASSERT condition by removing the !node() + check, due to RenderWidget clearing its node() during destruction. + + * rendering/RenderObject.cpp: + (WebCore::RenderObject::~RenderObject): + (WebCore::RenderObject::willBeDestroyed): + +2012-05-25 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Hangup when continuously changing a css width value in Inspector + https://bugs.webkit.org/show_bug.cgi?id=85802 + + Reviewed by Vsevolod Vlasov. + + An error in the property whitespace prefix detection algorithm would append the previous line trailing whitespace, + thereby enormously increasing the actual prefix during multiple incremental property changes. + + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyle::newLineAndWhitespaceDelimiters): + +2012-05-25 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: Clean up Inspector.json after r118367 + https://bugs.webkit.org/show_bug.cgi?id=87499 + + Reviewed by Yury Semikhatsky. + + This cleans up the semantic inconsistencies introduced into type/field names r118367. + + No new tests, as this is a refactoring. + + * inspector/Inspector.json: + * inspector/InspectorCSSAgent.cpp: + (WebCore::InspectorCSSAgent::asInspectorStyleSheet): + (WebCore::InspectorCSSAgent::viaInspectorStyleSheet): + (WebCore::InspectorCSSAgent::detectOrigin): + * inspector/InspectorCSSAgent.h: + (InspectorCSSAgent): + * inspector/InspectorStyleSheet.cpp: + (WebCore::InspectorStyleSheet::create): + (WebCore::InspectorStyleSheet::InspectorStyleSheet): + (WebCore::InspectorStyleSheet::buildObjectForRule): + (WebCore::InspectorStyleSheet::resourceStyleSheetText): + (WebCore::InspectorStyleSheetForInlineStyle::create): + (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle): + * inspector/InspectorStyleSheet.h: + (InspectorStyleSheet): + (WebCore::InspectorStyleSheet::canBind): + (InspectorStyleSheetForInlineStyle): + +2012-05-25 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: speed-up HeapSnapshot._bfs method. + https://bugs.webkit.org/show_bug.cgi?id=87502 + + It had containmentEdges.length call in the loop that forced deoptimization. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshot.prototype._calculateObjectToWindowDistance): + (WebInspector.HeapSnapshot.prototype._bfs): + +2012-05-25 Alexei Filippov <alexeif@chromium.org> + + Web Inspector: Speed up edges iteration in heap profiler + https://bugs.webkit.org/show_bug.cgi?id=87286 + + Add an extra node to nodes array that points to the end of edges array. + It allows to eliminate a check for the last node in iteration code. + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshot.js: + (WebInspector.HeapSnapshotNode.prototype._edgeIndexesStart): + (WebInspector.HeapSnapshotNode.prototype._edgeIndexesEnd): + (WebInspector.HeapSnapshotNodeIterator): + (WebInspector.HeapSnapshot.prototype._buildRetainers): + (WebInspector.HeapSnapshot.prototype._bfs): + (WebInspector.HeapSnapshot.prototype._buildAggregates): + (WebInspector.HeapSnapshot.prototype._buildPostOrderIndex): + (WebInspector.HeapSnapshot.prototype._buildDominatorTree): + (WebInspector.HeapSnapshot.prototype._markQueriableHeapObjects): + +2012-05-25 Andrey Kosyakov <caseq@chromium.org> + + Web Inspector: put paint and compositing timeline events in a new category of their own + https://bugs.webkit.org/show_bug.cgi?id=86852 + + Reviewed by Pavel Feldman. + + - add forth timeline category, "Painting"; make it light-purple; + - assign paint and compositing events to Painting category; + + * WebCore.gypi: added timelineBarLightPurple.png; + * inspector/front-end/Images/timelineBarLightPurple.png: Added. + * inspector/front-end/Images/timelineCheckmarks.png: added light-purple icon; + * inspector/front-end/Images/timelineDots.png: ditto. + * inspector/front-end/TimelineOverviewPane.js: + (WebInspector.TimelineCategoryStrips.prototype.update.appendRecord): do not merge bars in same raw if these are from different categories; + (WebInspector.TimelineCategoryStrips.prototype.update): + * inspector/front-end/TimelinePresentationModel.js: + (WebInspector.TimelinePresentationModel.categories): + (WebInspector.TimelinePresentationModel.recordStyle): + * inspector/front-end/WebKit.qrc: added timelineBarLightPurple.png; + * inspector/front-end/timelinePanel.css: added styles for painting category; + (.timeline-category-statusbar-item.timeline-category-painting .timeline-category-checkbox): + (.timeline-category-painting .timeline-graph-bar): + (.popover .timeline-painting): + (.timeline-category-scripting .timeline-tree-icon): + (.timeline-category-rendering .timeline-tree-icon): + (.timeline-category-painting .timeline-tree-icon): + +2012-05-25 W. James MacLean <wjmaclean@chromium.org> + + [chromium] LayerChromium should recognise existing layer active animations when the layer is added. + https://bugs.webkit.org/show_bug.cgi?id=87166 + + Reviewed by Adrienne Walker. + + Unit test added. + + LayerChromium needs to correctly recognize if a newly added layer has an existing + active animation. + + * platform/graphics/chromium/LayerChromium.cpp: + (WebCore::LayerChromium::setLayerTreeHost): + (WebCore::LayerChromium::notifyAnimationFinished): + * platform/graphics/chromium/cc/CCLayerTreeHost.h: + (CCLayerTreeHost): + +2012-05-25 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: HeapSnapshot: introduce performance counter for HeapSnapshotConstructorsDataGrid._aggregatesReceived method. + https://bugs.webkit.org/show_bug.cgi?id=87393 + + Reviewed by Yury Semikhatsky. + + * inspector/front-end/HeapSnapshotDataGrids.js: + (WebInspector.HeapSnapshotConstructorsDataGrid.prototype._aggregatesReceived): + (WebInspector.HeapSnapshotConstructorsDataGrid.prototype._populateChildren): + +2012-05-25 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: drop obsolete WebInspector.Uint32Array and adjust snapshot chunk size for better transfer-snapshot metric. + https://bugs.webkit.org/show_bug.cgi?id=87490 + + Originally WebInspector.Uint32Array was used for dynamic array + reallocation because we had no information about expected arrays sizes. + Now we have these sizes and allocates array precisely. + + Reviewed by Yury Semikhatsky. + + * bindings/v8/ScriptHeapSnapshot.cpp: + (WebCore): + * inspector/front-end/HeapSnapshot.js: + * inspector/front-end/HeapSnapshotLoader.js: + (WebInspector.HeapSnapshotLoader.prototype._parseUintArray): + (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk): + +2012-05-25 Ilya Tikhonovsky <loislo@chromium.org> + + Web Inspector: drop obsolete WebInspector.Uint32Array and adjust snapshot chunk size for better transfer-snapshot metric. + https://bugs.webkit.org/show_bug.cgi?id=87490 + + Originally WebInspector.Uint32Array was used for dynamic array + reallocation because we had no information about expected arrays sizes. + Now we have these sizes and allocates array precisely. + + Reviewed by Yury Semikhatsky. + + * bindings/v8/ScriptHeapSnapshot.cpp: + (WebCore): + * inspector/front-end/HeapSnapshot.js: + * inspector/front-end/HeapSnapshotLoader.js: + (WebInspector.HeapSnapshotLoader.prototype._parseUintArray): + (WebInspector.HeapSnapshotLoader.prototype.pushJSONChunk): + +2012-05-25 Alexander Pavlov <apavlov@chromium.org> + + Web Inspector: cmd-[ shortcut navigates page and is fr-keyboard incompatible + https://bugs.webkit.org/show_bug.cgi?id=85312 + + Reviewed by Vsevolod Vlasov. + + Suppress the handling of panel history navigation events if the corresponding keyboard activities produce + the "keypress" event (which is the case on French keyboards, where AltGr+[ is translated into Ctrl+Alt+[ on Windows). + The event is also told to preventDefault() to avoid browser history navigation on Mac while traversing the Inspector panel history. + + * inspector/front-end/InspectorView.js: + (WebInspector.InspectorView): + (WebInspector.InspectorView.prototype._keyPress): + (WebInspector.InspectorView.prototype._keyDown): + (WebInspector.InspectorView.prototype._keyDownInternal): + * inspector/front-end/UIUtils.js: + (WebInspector.isWin): + +2012-05-25 Yury Semikhatsky <yurys@google.com> + + Unreviewed. Fixed closure compiler warnings. + + * inspector/front-end/NativeMemorySnapshotView.js: + (WebInspector.NativeMemoryProfileType.prototype.buttonClicked): + (WebInspector.NativeMemoryProfileHeader.prototype.createView): + +2012-05-25 Lu Guanqun <guanqun.lu@intel.com> + + [GTK] fix compilation warning in GtkInputMethodFilter.cpp + https://bugs.webkit.org/show_bug.cgi?id=87475 + + Reviewed by Martin Robinson. + + * platform/gtk/GtkInputMethodFilter.cpp: + (WebCore::GtkInputMethodFilter::setWidget): + 2012-05-25 Zalan Bujtas <zbujtas@gmail.com> [Qt] Broken controls rendering when transform is applied. diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am index 05a8026a1..f88e6563b 100644 --- a/Source/WebCore/GNUmakefile.list.am +++ b/Source/WebCore/GNUmakefile.list.am @@ -3814,6 +3814,8 @@ webcore_sources += \ Source/WebCore/rendering/RenderFrameSet.h \ Source/WebCore/rendering/RenderFullScreen.cpp \ Source/WebCore/rendering/RenderFullScreen.h \ + Source/WebCore/rendering/RenderGeometryMap.cpp \ + Source/WebCore/rendering/RenderGeometryMap.h \ Source/WebCore/rendering/RenderHTMLCanvas.cpp \ Source/WebCore/rendering/RenderHTMLCanvas.h \ Source/WebCore/rendering/RenderIFrame.cpp \ diff --git a/Source/WebCore/Modules/mediastream/PeerConnection00.cpp b/Source/WebCore/Modules/mediastream/PeerConnection00.cpp index 205616d24..9a61fc342 100644 --- a/Source/WebCore/Modules/mediastream/PeerConnection00.cpp +++ b/Source/WebCore/Modules/mediastream/PeerConnection00.cpp @@ -49,8 +49,12 @@ namespace WebCore { -PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback) +PassRefPtr<PeerConnection00> PeerConnection00::create(ScriptExecutionContext* context, const String& serverConfiguration, PassRefPtr<IceCallback> iceCallback, ExceptionCode& ec) { + if (!iceCallback) { + ec = TYPE_MISMATCH_ERR; + return 0; + } RefPtr<PeerConnection00> peerConnection = adoptRef(new PeerConnection00(context, serverConfiguration, iceCallback)); peerConnection->suspendIfNeeded(); return peerConnection.release(); diff --git a/Source/WebCore/Modules/mediastream/PeerConnection00.h b/Source/WebCore/Modules/mediastream/PeerConnection00.h index 6b345533f..5078c4d70 100644 --- a/Source/WebCore/Modules/mediastream/PeerConnection00.h +++ b/Source/WebCore/Modules/mediastream/PeerConnection00.h @@ -86,7 +86,7 @@ public: ICE_CLOSED = 0x700 }; - static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>); + static PassRefPtr<PeerConnection00> create(ScriptExecutionContext*, const String& serverConfiguration, PassRefPtr<IceCallback>, ExceptionCode&); ~PeerConnection00(); PassRefPtr<SessionDescription> createOffer(ExceptionCode&); diff --git a/Source/WebCore/Modules/mediastream/PeerConnection00.idl b/Source/WebCore/Modules/mediastream/PeerConnection00.idl index bbffe9cd4..bd56c8773 100644 --- a/Source/WebCore/Modules/mediastream/PeerConnection00.idl +++ b/Source/WebCore/Modules/mediastream/PeerConnection00.idl @@ -35,6 +35,7 @@ module p2p { ActiveDOMObject, Constructor(in DOMString serverConfiguration, in [Callback] IceCallback iceCallback), CallWith=ScriptExecutionContext, + ConstructorRaisesException, EventTarget ] PeerConnection00 { SessionDescription createOffer(in [Optional] Dictionary mediaHints) diff --git a/Source/WebCore/Target.pri b/Source/WebCore/Target.pri index 0fec43fa3..d391afe2f 100644 --- a/Source/WebCore/Target.pri +++ b/Source/WebCore/Target.pri @@ -1266,6 +1266,7 @@ SOURCES += \ rendering/RenderFrame.cpp \ rendering/RenderFrameBase.cpp \ rendering/RenderFrameSet.cpp \ + rendering/RenderGeometryMap.cpp \ rendering/RenderHTMLCanvas.cpp \ rendering/RenderIFrame.cpp \ rendering/RenderImage.cpp \ @@ -2463,6 +2464,7 @@ HEADERS += \ rendering/RenderFrame.h \ rendering/RenderFrameBase.h \ rendering/RenderFrameSet.h \ + rendering/RenderGeometryMap.h \ rendering/RenderHTMLCanvas.h \ rendering/RenderIFrame.h \ rendering/RenderImageResource.h \ diff --git a/Source/WebCore/WebCore.gypi b/Source/WebCore/WebCore.gypi index 45a087865..dfb579af0 100644 --- a/Source/WebCore/WebCore.gypi +++ b/Source/WebCore/WebCore.gypi @@ -4810,6 +4810,8 @@ 'rendering/RenderFrameSet.h', 'rendering/RenderFullScreen.cpp', 'rendering/RenderFullScreen.h', + 'rendering/RenderGeometryMap.cpp', + 'rendering/RenderGeometryMap.h', 'rendering/RenderHTMLCanvas.cpp', 'rendering/RenderHTMLCanvas.h', 'rendering/RenderIFrame.cpp', @@ -6679,6 +6681,7 @@ 'inspector/front-end/Images/timelineBarBlue.png', 'inspector/front-end/Images/timelineBarGray.png', 'inspector/front-end/Images/timelineBarGreen.png', + 'inspector/front-end/Images/timelineBarLightPurple.png', 'inspector/front-end/Images/timelineBarOrange.png', 'inspector/front-end/Images/timelineBarPurple.png', 'inspector/front-end/Images/timelineBarRed.png', diff --git a/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/Source/WebCore/WebCore.vcproj/WebCore.vcproj index ea1776f4f..844b8d3d0 100755 --- a/Source/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/Source/WebCore/WebCore.vcproj/WebCore.vcproj @@ -39371,6 +39371,14 @@ > </File> <File + RelativePath="..\rendering\RenderGeometryMap.cpp" + > + </File> + <File + RelativePath="..\rendering\RenderGeometryMap.h" + > + </File> + <File RelativePath="..\rendering\RenderHTMLCanvas.cpp" > <FileConfiguration diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj index af672ed23..741bc73f7 100644 --- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj +++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj @@ -241,6 +241,8 @@ 0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F29C16D1300C2E2002D794E /* AccessibilityAllInOne.cpp */; }; 0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */; }; 0F3DD45012F5EA1B000D9190 /* ShadowBlur.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */; }; + 0F3F0E59157030C3006DA57F /* RenderGeometryMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F3F0E57157030C3006DA57F /* RenderGeometryMap.cpp */; }; + 0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */; }; 0F4E57171313276200CF85AF /* RenderSVGAllInOne.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4E57161313276200CF85AF /* RenderSVGAllInOne.cpp */; }; 0F56028F0E4B76580065B038 /* RenderMarquee.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F56028D0E4B76580065B038 /* RenderMarquee.h */; }; 0F5602900E4B76580065B038 /* RenderMarquee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F56028E0E4B76580065B038 /* RenderMarquee.cpp */; }; @@ -7129,6 +7131,8 @@ 0F29C16D1300C2E2002D794E /* AccessibilityAllInOne.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityAllInOne.cpp; sourceTree = "<group>"; }; 0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowBlur.cpp; sourceTree = "<group>"; }; 0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShadowBlur.h; sourceTree = "<group>"; }; + 0F3F0E57157030C3006DA57F /* RenderGeometryMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderGeometryMap.cpp; sourceTree = "<group>"; }; + 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderGeometryMap.h; sourceTree = "<group>"; }; 0F4E57161313276200CF85AF /* RenderSVGAllInOne.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGAllInOne.cpp; sourceTree = "<group>"; }; 0F56028D0E4B76580065B038 /* RenderMarquee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMarquee.h; sourceTree = "<group>"; }; 0F56028E0E4B76580065B038 /* RenderMarquee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMarquee.cpp; sourceTree = "<group>"; }; @@ -20924,6 +20928,8 @@ A871DEC90A1530C700B12A68 /* RenderFrameSet.h */, CDEA7C831276230400B846DD /* RenderFullScreen.cpp */, CDEA7C821276230400B846DD /* RenderFullScreen.h */, + 0F3F0E57157030C3006DA57F /* RenderGeometryMap.cpp */, + 0F3F0E58157030C3006DA57F /* RenderGeometryMap.h */, BCEA482A097D93020094C9E4 /* RenderHTMLCanvas.cpp */, BCEA482B097D93020094C9E4 /* RenderHTMLCanvas.h */, 0FD308D3117D168400A791F7 /* RenderIFrame.cpp */, @@ -24950,6 +24956,7 @@ BC1BDF25156C18C7001C1243 /* DOMError.h in Headers */, E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */, 71DCB7021568197600862271 /* JSSVGZoomAndPan.h in Headers */, + 0F3F0E5A157030C3006DA57F /* RenderGeometryMap.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -25279,7 +25286,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" WebCore\nexport WebCore=\"WebCore\"\n\nif [ ! $CC ]; then\n case $TARGET_GCC_VERSION in\n (GCC_42)\n export CC=\"`xcrun -find gcc-4.2`\";;\n (LLVM_GCC_42)\n export CC=\"`xcrun -find llvm-gcc-4.2`\";;\n (LLVM_COMPILER)\n export CC=\"`xcrun -find clang`\";;\n esac\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"WebCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; + shellScript = "mkdir -p \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\ncd \"${BUILT_PRODUCTS_DIR}/DerivedSources/WebCore\"\n\n/bin/ln -sfh \"${SRCROOT}\" WebCore\nexport WebCore=\"WebCore\"\n\nif [ ! $CC ]; then\n case $TARGET_GCC_VERSION in\n (GCC_42)\n export CC=\"`xcrun -find gcc-4.2`\";;\n (LLVM_GCC_42)\n export CC=\"`xcrun -find llvm-gcc-4.2`\";;\n (LLVM_COMPILER)\n export CC=\"`xcrun -find clang`\";;\n esac\nfi\n\nif [ ! $GPERF ]; then\n export GPERF=\"`xcrun -find gperf`\"\nfi\n\nif [ \"${ACTION}\" = \"build\" -o \"${ACTION}\" = \"install\" -o \"${ACTION}\" = \"installhdrs\" ]; then\n make --no-builtin-rules -f \"WebCore/DerivedSources.make\" -j `/usr/sbin/sysctl -n hw.availcpu`\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -27981,6 +27988,7 @@ BC1BDF24156C1883001C1243 /* DOMError.cpp in Sources */, E4946EAE156E64DD00D3297F /* StyleRuleImport.cpp in Sources */, 71DCB7011568197600862271 /* JSSVGZoomAndPan.cpp in Sources */, + 0F3F0E59157030C3006DA57F /* RenderGeometryMap.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Source/WebCore/bindings/ScriptControllerBase.cpp b/Source/WebCore/bindings/ScriptControllerBase.cpp index 855158afc..9b006d2c2 100644 --- a/Source/WebCore/bindings/ScriptControllerBase.cpp +++ b/Source/WebCore/bindings/ScriptControllerBase.cpp @@ -32,6 +32,7 @@ #include "SecurityOrigin.h" #include "Settings.h" #include "UserGestureIndicator.h" +#include <wtf/text/TextPosition.h> namespace WebCore { @@ -75,7 +76,7 @@ bool ScriptController::executeIfJavaScriptURL(const KURL& url, ShouldReplaceDocu if (!m_frame->page() || !m_frame->page()->javaScriptURLsAreAllowed() - || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs() + || !m_frame->document()->contentSecurityPolicy()->allowJavaScriptURLs(m_frame->document()->url(), eventHandlerPosition().m_line) || m_frame->inViewSourceMode()) return true; diff --git a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp index 31ffb54d4..dbc274d23 100644 --- a/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp +++ b/Source/WebCore/bindings/js/JSDOMGlobalObject.cpp @@ -51,7 +51,7 @@ JSDOMGlobalObject::JSDOMGlobalObject(JSGlobalData& globalData, Structure* struct void JSDOMGlobalObject::destroy(JSCell* cell) { - jsCast<JSDOMGlobalObject*>(cell)->JSDOMGlobalObject::~JSDOMGlobalObject(); + static_cast<JSDOMGlobalObject*>(cell)->JSDOMGlobalObject::~JSDOMGlobalObject(); } void JSDOMGlobalObject::finishCreation(JSGlobalData& globalData) diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp index 00cb641be..1ea8c8b44 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp @@ -67,7 +67,7 @@ void JSDOMWindowBase::finishCreation(JSGlobalData& globalData, JSDOMWindowShell* void JSDOMWindowBase::destroy(JSCell* cell) { - jsCast<JSDOMWindowBase*>(cell)->JSDOMWindowBase::~JSDOMWindowBase(); + static_cast<JSDOMWindowBase*>(cell)->JSDOMWindowBase::~JSDOMWindowBase(); } void JSDOMWindowBase::updateDocument() diff --git a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp index 749440177..758e7278b 100644 --- a/Source/WebCore/bindings/js/JSDOMWindowShell.cpp +++ b/Source/WebCore/bindings/js/JSDOMWindowShell.cpp @@ -59,7 +59,7 @@ void JSDOMWindowShell::finishCreation(JSGlobalData& globalData, PassRefPtr<DOMWi void JSDOMWindowShell::destroy(JSCell* cell) { - jsCast<JSDOMWindowShell*>(cell)->JSDOMWindowShell::~JSDOMWindowShell(); + static_cast<JSDOMWindowShell*>(cell)->JSDOMWindowShell::~JSDOMWindowShell(); } void JSDOMWindowShell::setWindow(PassRefPtr<DOMWindow> domWindow) diff --git a/Source/WebCore/bindings/js/JSLazyEventListener.cpp b/Source/WebCore/bindings/js/JSLazyEventListener.cpp index f11bf900c..64f9cb9c0 100644 --- a/Source/WebCore/bindings/js/JSLazyEventListener.cpp +++ b/Source/WebCore/bindings/js/JSLazyEventListener.cpp @@ -80,7 +80,7 @@ JSObject* JSLazyEventListener::initializeJSFunction(ScriptExecutionContext* exec if (!document->frame()) return 0; - if (!document->contentSecurityPolicy()->allowInlineEventHandlers()) + if (!document->contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_position.m_line)) return 0; ScriptController* script = document->frame()->script(); diff --git a/Source/WebCore/bindings/js/JSNodeCustom.cpp b/Source/WebCore/bindings/js/JSNodeCustom.cpp index 394d0f33d..3630c0136 100644 --- a/Source/WebCore/bindings/js/JSNodeCustom.cpp +++ b/Source/WebCore/bindings/js/JSNodeCustom.cpp @@ -138,7 +138,7 @@ bool JSNodeOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, v void JSNodeOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSNode* jsNode = jsCast<JSNode*>(handle.get().asCell()); + JSNode* jsNode = static_cast<JSNode*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsNode->impl(), jsNode); jsNode->releaseImpl(); diff --git a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp index 2c13a9d77..46d5929c1 100644 --- a/Source/WebCore/bindings/js/JSWorkerContextBase.cpp +++ b/Source/WebCore/bindings/js/JSWorkerContextBase.cpp @@ -62,7 +62,7 @@ void JSWorkerContextBase::finishCreation(JSGlobalData& globalData) void JSWorkerContextBase::destroy(JSCell* cell) { - jsCast<JSWorkerContextBase*>(cell)->JSWorkerContextBase::~JSWorkerContextBase(); + static_cast<JSWorkerContextBase*>(cell)->JSWorkerContextBase::~JSWorkerContextBase(); } ScriptExecutionContext* JSWorkerContextBase::scriptExecutionContext() const diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm index 3a752ff19..ff8fb064b 100644 --- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm +++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm @@ -1626,7 +1626,7 @@ sub GenerateImplementation # the finalizer issue is being tracked in http://webkit.org/b/75451 push(@implContent, "void ${className}::destroy(JSC::JSCell* cell)\n"); push(@implContent, "{\n"); - push(@implContent, " ${className}* thisObject = jsCast<${className}*>(cell);\n"); + push(@implContent, " ${className}* thisObject = static_cast<${className}*>(cell);\n"); push(@implContent, " thisObject->${className}::~${className}();\n"); push(@implContent, "}\n\n"); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp index 5c23e1aea..3401c6453 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.cpp @@ -125,7 +125,7 @@ JSObject* JSTestActiveDOMObject::createPrototype(ExecState* exec, JSGlobalObject void JSTestActiveDOMObject::destroy(JSC::JSCell* cell) { - JSTestActiveDOMObject* thisObject = jsCast<JSTestActiveDOMObject*>(cell); + JSTestActiveDOMObject* thisObject = static_cast<JSTestActiveDOMObject*>(cell); thisObject->JSTestActiveDOMObject::~JSTestActiveDOMObject(); } @@ -229,7 +229,7 @@ bool JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unk void JSTestActiveDOMObjectOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestActiveDOMObject* jsTestActiveDOMObject = jsCast<JSTestActiveDOMObject*>(handle.get().asCell()); + JSTestActiveDOMObject* jsTestActiveDOMObject = static_cast<JSTestActiveDOMObject*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestActiveDOMObject->impl(), jsTestActiveDOMObject); jsTestActiveDOMObject->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp index 6867905cc..e76553ad2 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp @@ -123,7 +123,7 @@ JSObject* JSTestCustomNamedGetter::createPrototype(ExecState* exec, JSGlobalObje void JSTestCustomNamedGetter::destroy(JSC::JSCell* cell) { - JSTestCustomNamedGetter* thisObject = jsCast<JSTestCustomNamedGetter*>(cell); + JSTestCustomNamedGetter* thisObject = static_cast<JSTestCustomNamedGetter*>(cell); thisObject->JSTestCustomNamedGetter::~JSTestCustomNamedGetter(); } @@ -202,7 +202,7 @@ bool JSTestCustomNamedGetterOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::U void JSTestCustomNamedGetterOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestCustomNamedGetter* jsTestCustomNamedGetter = jsCast<JSTestCustomNamedGetter*>(handle.get().asCell()); + JSTestCustomNamedGetter* jsTestCustomNamedGetter = static_cast<JSTestCustomNamedGetter*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestCustomNamedGetter->impl(), jsTestCustomNamedGetter); jsTestCustomNamedGetter->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp index 7ab3ff2b6..ff7f83383 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.cpp @@ -157,7 +157,7 @@ JSObject* JSTestEventConstructor::createPrototype(ExecState* exec, JSGlobalObjec void JSTestEventConstructor::destroy(JSC::JSCell* cell) { - JSTestEventConstructor* thisObject = jsCast<JSTestEventConstructor*>(cell); + JSTestEventConstructor* thisObject = static_cast<JSTestEventConstructor*>(cell); thisObject->JSTestEventConstructor::~JSTestEventConstructor(); } @@ -229,7 +229,7 @@ bool JSTestEventConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Un void JSTestEventConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestEventConstructor* jsTestEventConstructor = jsCast<JSTestEventConstructor*>(handle.get().asCell()); + JSTestEventConstructor* jsTestEventConstructor = static_cast<JSTestEventConstructor*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestEventConstructor->impl(), jsTestEventConstructor); jsTestEventConstructor->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp index 18160b342..1a708d05e 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp @@ -132,7 +132,7 @@ JSObject* JSTestEventTarget::createPrototype(ExecState* exec, JSGlobalObject* gl void JSTestEventTarget::destroy(JSC::JSCell* cell) { - JSTestEventTarget* thisObject = jsCast<JSTestEventTarget*>(cell); + JSTestEventTarget* thisObject = static_cast<JSTestEventTarget*>(cell); thisObject->JSTestEventTarget::~JSTestEventTarget(); } @@ -330,7 +330,7 @@ bool JSTestEventTargetOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown void JSTestEventTargetOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestEventTarget* jsTestEventTarget = jsCast<JSTestEventTarget*>(handle.get().asCell()); + JSTestEventTarget* jsTestEventTarget = static_cast<JSTestEventTarget*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestEventTarget->impl(), jsTestEventTarget); jsTestEventTarget->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp index f6de9e05d..cf27cb734 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestException.cpp @@ -109,7 +109,7 @@ JSObject* JSTestException::createPrototype(ExecState* exec, JSGlobalObject* glob void JSTestException::destroy(JSC::JSCell* cell) { - JSTestException* thisObject = jsCast<JSTestException*>(cell); + JSTestException* thisObject = static_cast<JSTestException*>(cell); thisObject->JSTestException::~JSTestException(); } @@ -171,7 +171,7 @@ bool JSTestExceptionOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> void JSTestExceptionOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestException* jsTestException = jsCast<JSTestException*>(handle.get().asCell()); + JSTestException* jsTestException = static_cast<JSTestException*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestException->impl(), jsTestException); jsTestException->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp index 46ab7ff34..184ab33c5 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp @@ -212,7 +212,7 @@ JSObject* JSTestInterface::createPrototype(ExecState* exec, JSGlobalObject* glob void JSTestInterface::destroy(JSC::JSCell* cell) { - JSTestInterface* thisObject = jsCast<JSTestInterface*>(cell); + JSTestInterface* thisObject = static_cast<JSTestInterface*>(cell); thisObject->JSTestInterface::~JSTestInterface(); } @@ -435,7 +435,7 @@ bool JSTestInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> void JSTestInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestInterface* jsTestInterface = jsCast<JSTestInterface*>(handle.get().asCell()); + JSTestInterface* jsTestInterface = static_cast<JSTestInterface*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestInterface->impl(), jsTestInterface); jsTestInterface->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp index 9d589baaa..20e216c2c 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp @@ -123,7 +123,7 @@ JSObject* JSTestMediaQueryListListener::createPrototype(ExecState* exec, JSGloba void JSTestMediaQueryListListener::destroy(JSC::JSCell* cell) { - JSTestMediaQueryListListener* thisObject = jsCast<JSTestMediaQueryListListener*>(cell); + JSTestMediaQueryListListener* thisObject = static_cast<JSTestMediaQueryListListener*>(cell); thisObject->JSTestMediaQueryListListener::~JSTestMediaQueryListListener(); } @@ -192,7 +192,7 @@ bool JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots(JSC::Handle<J void JSTestMediaQueryListListenerOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestMediaQueryListListener* jsTestMediaQueryListListener = jsCast<JSTestMediaQueryListListener*>(handle.get().asCell()); + JSTestMediaQueryListListener* jsTestMediaQueryListListener = static_cast<JSTestMediaQueryListListener*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestMediaQueryListListener->impl(), jsTestMediaQueryListListener); jsTestMediaQueryListListener->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp index 9c7686790..9afe4aef4 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.cpp @@ -152,7 +152,7 @@ JSObject* JSTestNamedConstructor::createPrototype(ExecState* exec, JSGlobalObjec void JSTestNamedConstructor::destroy(JSC::JSCell* cell) { - JSTestNamedConstructor* thisObject = jsCast<JSTestNamedConstructor*>(cell); + JSTestNamedConstructor* thisObject = static_cast<JSTestNamedConstructor*>(cell); thisObject->JSTestNamedConstructor::~JSTestNamedConstructor(); } @@ -206,7 +206,7 @@ bool JSTestNamedConstructorOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Un void JSTestNamedConstructorOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestNamedConstructor* jsTestNamedConstructor = jsCast<JSTestNamedConstructor*>(handle.get().asCell()); + JSTestNamedConstructor* jsTestNamedConstructor = static_cast<JSTestNamedConstructor*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestNamedConstructor->impl(), jsTestNamedConstructor); jsTestNamedConstructor->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp index 8856ebce2..1479314b8 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp @@ -370,7 +370,7 @@ JSObject* JSTestObj::createPrototype(ExecState* exec, JSGlobalObject* globalObje void JSTestObj::destroy(JSC::JSCell* cell) { - JSTestObj* thisObject = jsCast<JSTestObj*>(cell); + JSTestObj* thisObject = static_cast<JSTestObj*>(cell); thisObject->JSTestObj::~JSTestObj(); } @@ -2810,7 +2810,7 @@ bool JSTestObjOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle void JSTestObjOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestObj* jsTestObj = jsCast<JSTestObj*>(handle.get().asCell()); + JSTestObj* jsTestObj = static_cast<JSTestObj*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestObj->impl(), jsTestObj); jsTestObj->releaseImpl(); diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp index b4ce03be7..e495d1ed3 100644 --- a/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp +++ b/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp @@ -161,7 +161,7 @@ JSObject* JSTestSerializedScriptValueInterface::createPrototype(ExecState* exec, void JSTestSerializedScriptValueInterface::destroy(JSC::JSCell* cell) { - JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell); + JSTestSerializedScriptValueInterface* thisObject = static_cast<JSTestSerializedScriptValueInterface*>(cell); thisObject->JSTestSerializedScriptValueInterface::~JSTestSerializedScriptValueInterface(); } @@ -380,7 +380,7 @@ bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC:: void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = jsCast<JSTestSerializedScriptValueInterface*>(handle.get().asCell()); + JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = static_cast<JSTestSerializedScriptValueInterface*>(handle.get().asCell()); DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context); uncacheWrapper(world, jsTestSerializedScriptValueInterface->impl(), jsTestSerializedScriptValueInterface); jsTestSerializedScriptValueInterface->releaseImpl(); diff --git a/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp b/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp index 769764e82..365c73d8d 100644 --- a/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp +++ b/Source/WebCore/bindings/v8/ScriptHeapSnapshot.cpp @@ -68,7 +68,7 @@ public: OutputStreamAdapter(ScriptHeapSnapshot::OutputStream* output) : m_output(output) { } void EndOfStream() { m_output->Close(); } - int GetChunkSize() { return 10240; } + int GetChunkSize() { return 102400; } WriteResult WriteAsciiChunk(char* data, int size) { m_output->Write(String(data, size)); diff --git a/Source/WebCore/bindings/v8/V8GCController.cpp b/Source/WebCore/bindings/v8/V8GCController.cpp index d88a53c2f..18fecc261 100644 --- a/Source/WebCore/bindings/v8/V8GCController.cpp +++ b/Source/WebCore/bindings/v8/V8GCController.cpp @@ -59,6 +59,10 @@ #include <wtf/StdLibExtras.h> #include <wtf/UnusedParam.h> +#if PLATFORM(CHROMIUM) +#include "TraceEvent.h" +#endif + namespace WebCore { #ifndef NDEBUG @@ -389,6 +393,10 @@ void V8GCController::gcPrologue() { v8::HandleScope scope; +#if PLATFORM(CHROMIUM) + TRACE_EVENT_BEGIN0("v8", "GC"); +#endif + #ifndef NDEBUG DOMObjectVisitor domObjectVisitor; visitDOMObjects(&domObjectVisitor); @@ -509,6 +517,10 @@ void V8GCController::gcEpilogue() enumerateGlobalHandles(); #endif + +#if PLATFORM(CHROMIUM) + TRACE_EVENT_END0("v8", "GC"); +#endif } void V8GCController::checkMemoryUsage() diff --git a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp index 7332318d2..ef4592e1a 100644 --- a/Source/WebCore/bindings/v8/V8LazyEventListener.cpp +++ b/Source/WebCore/bindings/v8/V8LazyEventListener.cpp @@ -105,7 +105,7 @@ void V8LazyEventListener::prepareListenerObject(ScriptExecutionContext* context) if (hasExistingListenerObject()) return; - if (context->isDocument() && !static_cast<Document*>(context)->contentSecurityPolicy()->allowInlineEventHandlers()) + if (context->isDocument() && !static_cast<Document*>(context)->contentSecurityPolicy()->allowInlineEventHandlers(m_sourceURL, m_position.m_line)) return; v8::HandleScope handleScope; diff --git a/Source/WebCore/bridge/objc/objc_runtime.mm b/Source/WebCore/bridge/objc/objc_runtime.mm index 25a3d1fc2..3fa799417 100644 --- a/Source/WebCore/bridge/objc/objc_runtime.mm +++ b/Source/WebCore/bridge/objc/objc_runtime.mm @@ -201,7 +201,7 @@ ObjcFallbackObjectImp::ObjcFallbackObjectImp(JSGlobalObject* globalObject, Struc void ObjcFallbackObjectImp::destroy(JSCell* cell) { - jsCast<ObjcFallbackObjectImp*>(cell)->ObjcFallbackObjectImp::~ObjcFallbackObjectImp(); + static_cast<ObjcFallbackObjectImp*>(cell)->ObjcFallbackObjectImp::~ObjcFallbackObjectImp(); } void ObjcFallbackObjectImp::finishCreation(JSGlobalObject* globalObject) diff --git a/Source/WebCore/bridge/qt/qt_runtime.cpp b/Source/WebCore/bridge/qt/qt_runtime.cpp index adae7ad4c..c403115bb 100644 --- a/Source/WebCore/bridge/qt/qt_runtime.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime.cpp @@ -989,7 +989,7 @@ QtRuntimeMethod::~QtRuntimeMethod() void QtRuntimeMethod::destroy(JSCell* cell) { - jsCast<QtRuntimeMethod*>(cell)->QtRuntimeMethod::~QtRuntimeMethod(); + static_cast<QtRuntimeMethod*>(cell)->QtRuntimeMethod::~QtRuntimeMethod(); } // =============== diff --git a/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp b/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp index df45a2155..477df71b6 100644 --- a/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp +++ b/Source/WebCore/bridge/qt/qt_runtime_qt4.cpp @@ -989,7 +989,7 @@ QtRuntimeMethod::~QtRuntimeMethod() void QtRuntimeMethod::destroy(JSCell* cell) { - jsCast<QtRuntimeMethod*>(cell)->QtRuntimeMethod::~QtRuntimeMethod(); + static_cast<QtRuntimeMethod*>(cell)->QtRuntimeMethod::~QtRuntimeMethod(); } // =============== diff --git a/Source/WebCore/bridge/runtime_array.cpp b/Source/WebCore/bridge/runtime_array.cpp index 4e39d43ca..84262cba8 100644 --- a/Source/WebCore/bridge/runtime_array.cpp +++ b/Source/WebCore/bridge/runtime_array.cpp @@ -57,7 +57,7 @@ RuntimeArray::~RuntimeArray() void RuntimeArray::destroy(JSCell* cell) { - jsCast<RuntimeArray*>(cell)->RuntimeArray::~RuntimeArray(); + static_cast<RuntimeArray*>(cell)->RuntimeArray::~RuntimeArray(); } JSValue RuntimeArray::lengthGetter(ExecState*, JSValue slotBase, PropertyName) diff --git a/Source/WebCore/bridge/runtime_method.cpp b/Source/WebCore/bridge/runtime_method.cpp index b8fb5b112..4dc4e6d7e 100644 --- a/Source/WebCore/bridge/runtime_method.cpp +++ b/Source/WebCore/bridge/runtime_method.cpp @@ -52,7 +52,7 @@ RuntimeMethod::RuntimeMethod(JSGlobalObject* globalObject, Structure* structure, void RuntimeMethod::destroy(JSCell* cell) { - jsCast<RuntimeMethod*>(cell)->RuntimeMethod::~RuntimeMethod(); + static_cast<RuntimeMethod*>(cell)->RuntimeMethod::~RuntimeMethod(); } void RuntimeMethod::finishCreation(JSGlobalData& globalData, const UString& ident) diff --git a/Source/WebCore/bridge/runtime_object.cpp b/Source/WebCore/bridge/runtime_object.cpp index 50bacbcf6..71f72fd4b 100644 --- a/Source/WebCore/bridge/runtime_object.cpp +++ b/Source/WebCore/bridge/runtime_object.cpp @@ -51,7 +51,7 @@ void RuntimeObject::finishCreation(JSGlobalObject* globalObject) void RuntimeObject::destroy(JSCell* cell) { - RuntimeObject* thisObject = jsCast<RuntimeObject*>(cell); + RuntimeObject* thisObject = static_cast<RuntimeObject*>(cell); ASSERT(!thisObject->m_instance); thisObject->RuntimeObject::~RuntimeObject(); } diff --git a/Source/WebCore/bridge/runtime_root.cpp b/Source/WebCore/bridge/runtime_root.cpp index 899586747..58b078856 100644 --- a/Source/WebCore/bridge/runtime_root.cpp +++ b/Source/WebCore/bridge/runtime_root.cpp @@ -194,7 +194,7 @@ void RootObject::removeRuntimeObject(RuntimeObject* object) void RootObject::finalize(JSC::Handle<JSC::Unknown> handle, void*) { - RuntimeObject* object = static_cast<RuntimeObject*>(asObject(handle.get())); + RuntimeObject* object = static_cast<RuntimeObject*>(handle.get().asCell()); RefPtr<RootObject> protect(this); object->invalidate(); diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index 52b41b726..596fa7cde 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -226,6 +226,7 @@ static const CSSPropertyID computedProperties[] = { #if ENABLE(CSS_FILTERS) CSSPropertyWebkitFilter, #endif +#if ENABLE(CSS3_FLEXBOX) CSSPropertyWebkitFlex, CSSPropertyWebkitFlexOrder, CSSPropertyWebkitFlexPack, @@ -235,6 +236,7 @@ static const CSSPropertyID computedProperties[] = { CSSPropertyWebkitFlexFlow, CSSPropertyWebkitFlexLinePack, CSSPropertyWebkitFlexWrap, +#endif CSSPropertyWebkitFontKerning, CSSPropertyWebkitFontSmoothing, CSSPropertyWebkitFontVariantLigatures, @@ -1627,6 +1629,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert return cssValuePool().createValue(style->display()); case CSSPropertyEmptyCells: return cssValuePool().createValue(style->emptyCells()); +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlex: { RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); list->append(cssValuePool().createValue(style->positiveFlex())); @@ -1667,6 +1670,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert list->append(cssValuePool().createValue(style->flexWrap())); return list.release(); } +#endif case CSSPropertyFloat: return cssValuePool().createValue(style->floating()); case CSSPropertyFont: { diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp index e14ed8ae9..725bc245e 100644 --- a/Source/WebCore/css/CSSParser.cpp +++ b/Source/WebCore/css/CSSParser.cpp @@ -684,6 +684,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueSrgb || valueID == CSSValueDefault) return true; break; +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexAlign: if (valueID == CSSValueStart || valueID == CSSValueEnd || valueID == CSSValueCenter || valueID == CSSValueBaseline || valueID == CSSValueStretch) return true; @@ -708,6 +709,7 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int if (valueID == CSSValueNone || valueID == CSSValueWrap || valueID == CSSValueWrapReverse) return true; break; +#endif case CSSPropertyWebkitFontKerning: if (valueID == CSSValueAuto || valueID == CSSValueNormal || valueID == CSSValueNone) return true; @@ -912,12 +914,14 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId) case CSSPropertyWebkitColumnBreakBefore: case CSSPropertyWebkitColumnBreakInside: case CSSPropertyWebkitColumnRuleStyle: +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexPack: case CSSPropertyWebkitFlexWrap: +#endif case CSSPropertyWebkitFontKerning: case CSSPropertyWebkitFontSmoothing: case CSSPropertyWebkitHyphens: @@ -2089,6 +2093,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) } break; #endif +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlex: if (id == CSSValueNone) validPrimitive = true; @@ -2103,6 +2108,7 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) m_valueList->next(); } break; +#endif case CSSPropertyWebkitMarquee: return parseShorthand(propId, webkitMarqueeShorthand(), important); case CSSPropertyWebkitMarqueeIncrement: @@ -2415,8 +2421,10 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyPadding: // <padding-width>{1,4} | inherit return parse4Values(propId, paddingShorthand().properties(), important); +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexFlow: return parseShorthand(propId, webkitFlexFlowShorthand(), important); +#endif case CSSPropertyFont: // [ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? // 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit @@ -2549,12 +2557,14 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) case CSSPropertyWebkitColumnBreakBefore: case CSSPropertyWebkitColumnBreakInside: case CSSPropertyWebkitColumnRuleStyle: +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexAlign: case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexItemAlign: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexPack: case CSSPropertyWebkitFlexWrap: +#endif case CSSPropertyWebkitFontKerning: case CSSPropertyWebkitFontSmoothing: case CSSPropertyWebkitHyphens: @@ -5555,6 +5565,8 @@ bool CSSParser::parseReflect(CSSPropertyID propId, bool important) return true; } +#if ENABLE(CSS3_FLEXBOX) + PassRefPtr<CSSValue> CSSParser::parseFlex(CSSParserValueList* args) { if (!args || !args->size() || args->size() > 3) @@ -5600,6 +5612,8 @@ PassRefPtr<CSSValue> CSSParser::parseFlex(CSSParserValueList* args) return flex; } +#endif + struct BorderImageParseContext { BorderImageParseContext() : m_canAdvance(false) diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index c734e065a..24a7d445c 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -1111,12 +1111,14 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e) case INLINE_BOX: m_value.ident = CSSValueWebkitInlineBox; break; +#if ENABLE(CSS3_FLEXBOX) case FLEX: m_value.ident = CSSValueWebkitFlex; break; case INLINE_FLEX: m_value.ident = CSSValueWebkitInlineFlex; break; +#endif case GRID: m_value.ident = CSSValueWebkitGrid; break; @@ -1166,6 +1168,8 @@ template<> inline CSSPrimitiveValue::operator EEmptyCell() const } } +#if ENABLE(CSS3_FLEXBOX) + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFlexAlign e) : CSSValue(PrimitiveClass) { @@ -1371,6 +1375,8 @@ template<> inline CSSPrimitiveValue::operator EFlexWrap() const } } +#endif + template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e) : CSSValue(PrimitiveClass) { diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp index fc76a5e7a..319b02614 100644 --- a/Source/WebCore/css/CSSProperty.cpp +++ b/Source/WebCore/css/CSSProperty.cpp @@ -537,6 +537,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) #if ENABLE(CSS_FILTERS) case CSSPropertyWebkitFilter: #endif +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlex: case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: @@ -546,6 +547,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) case CSSPropertyWebkitFlexFlow: case CSSPropertyWebkitFlexLinePack: case CSSPropertyWebkitFlexWrap: +#endif case CSSPropertyWebkitFontSizeDelta: case CSSPropertyWebkitGridColumns: case CSSPropertyWebkitGridRows: diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in index eddd71503..2739dbafc 100644 --- a/Source/WebCore/css/CSSPropertyNames.in +++ b/Source/WebCore/css/CSSPropertyNames.in @@ -256,6 +256,7 @@ z-index #if defined(ENABLE_CSS_FILTERS) && ENABLE_CSS_FILTERS -webkit-filter #endif +#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX -webkit-flex -webkit-flex-align -webkit-flex-direction @@ -265,6 +266,7 @@ z-index -webkit-flex-order -webkit-flex-pack -webkit-flex-wrap +#endif -webkit-font-size-delta -webkit-grid-columns -webkit-grid-rows diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index b626949e8..28e14cf4a 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -332,8 +332,10 @@ table-cell table-caption -webkit-box -webkit-inline-box +#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX -webkit-flex -webkit-inline-flex +#endif -webkit-grid -webkit-inline-grid //none @@ -481,6 +483,7 @@ block-axis single multiple +#if defined(ENABLE_CSS3_FLEXBOX) && ENABLE_CSS3_FLEXBOX // CSS_PROP_FLEX_ALIGN // start // end @@ -511,6 +514,7 @@ wrap-reverse // justify // distribute // stretch +#endif // CSS_PROP_MARQUEE_DIRECTION forwards diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index 53d384c8b..4c5bae6e5 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -1931,6 +1931,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitColumnSpan, ApplyPropertyDefault<ColumnSpan, &RenderStyle::columnSpan, ColumnSpan, &RenderStyle::setColumnSpan, ColumnSpan, &RenderStyle::initialColumnSpan>::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnRuleStyle, ApplyPropertyDefault<EBorderStyle, &RenderStyle::columnRuleStyle, EBorderStyle, &RenderStyle::setColumnRuleStyle, EBorderStyle, &RenderStyle::initialBorderStyle>::createHandler()); setPropertyHandler(CSSPropertyWebkitColumnWidth, ApplyPropertyAuto<float, &RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth, ComputeLength>::createHandler()); +#if ENABLE(CSS3_FLEXBOX) setPropertyHandler(CSSPropertyWebkitFlex, ApplyPropertyFlex::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexAlign, ApplyPropertyDefault<EFlexAlign, &RenderStyle::flexAlign, EFlexAlign, &RenderStyle::setFlexAlign, EFlexAlign, &RenderStyle::initialFlexAlign>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexDirection, ApplyPropertyDefault<EFlexDirection, &RenderStyle::flexDirection, EFlexDirection, &RenderStyle::setFlexDirection, EFlexDirection, &RenderStyle::initialFlexDirection>::createHandler()); @@ -1940,6 +1941,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitFlexOrder, ApplyPropertyDefault<int, &RenderStyle::flexOrder, int, &RenderStyle::setFlexOrder, int, &RenderStyle::initialFlexOrder>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexPack, ApplyPropertyDefault<EFlexPack, &RenderStyle::flexPack, EFlexPack, &RenderStyle::setFlexPack, EFlexPack, &RenderStyle::initialFlexPack>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlexWrap, ApplyPropertyDefault<EFlexWrap, &RenderStyle::flexWrap, EFlexWrap, &RenderStyle::setFlexWrap, EFlexWrap, &RenderStyle::initialFlexWrap>::createHandler()); +#endif #if ENABLE(CSS_REGIONS) setPropertyHandler(CSSPropertyWebkitFlowFrom, ApplyPropertyString<MapNoneToNull, &RenderStyle::regionThread, &RenderStyle::setRegionThread, &RenderStyle::initialRegionThread>::createHandler()); setPropertyHandler(CSSPropertyWebkitFlowInto, ApplyPropertyString<MapNoneToNull, &RenderStyle::flowThread, &RenderStyle::setFlowThread, &RenderStyle::initialFlowThread>::createHandler()); diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp index 2cc488701..4ec31996a 100644 --- a/Source/WebCore/css/StylePropertySet.cpp +++ b/Source/WebCore/css/StylePropertySet.cpp @@ -120,8 +120,10 @@ String StylePropertySet::getPropertyValue(CSSPropertyID propertyID) const return get4Values(borderWidthShorthand()); case CSSPropertyBorderStyle: return get4Values(borderStyleShorthand()); +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexFlow: return getShorthandValue(webkitFlexFlowShorthand()); +#endif case CSSPropertyFont: return fontValue(); case CSSPropertyMargin: @@ -697,10 +699,12 @@ String StylePropertySet::asText() const case CSSPropertyWebkitAnimationFillMode: shorthandPropertyID = CSSPropertyWebkitAnimation; break; +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexDirection: case CSSPropertyWebkitFlexWrap: shorthandPropertyID = CSSPropertyWebkitFlexFlow; break; +#endif case CSSPropertyWebkitMaskPositionX: case CSSPropertyWebkitMaskPositionY: case CSSPropertyWebkitMaskRepeatX: diff --git a/Source/WebCore/css/StylePropertyShorthand.cpp b/Source/WebCore/css/StylePropertyShorthand.cpp index 9c4cd370d..2265248e7 100644 --- a/Source/WebCore/css/StylePropertyShorthand.cpp +++ b/Source/WebCore/css/StylePropertyShorthand.cpp @@ -307,12 +307,14 @@ const StylePropertyShorthand& webkitColumnRuleShorthand() return webkitColumnRuleLonghands; } +#if ENABLE(CSS3_FLEXBOX) const StylePropertyShorthand& webkitFlexFlowShorthand() { static const CSSPropertyID flexFlowProperties[] = { CSSPropertyWebkitFlexDirection, CSSPropertyWebkitFlexWrap }; DEFINE_STATIC_LOCAL(StylePropertyShorthand, webkitFlexFlowLonghands, (flexFlowProperties, WTF_ARRAY_LENGTH(flexFlowProperties))); return webkitFlexFlowLonghands; } +#endif const StylePropertyShorthand& webkitMarginCollapseShorthand() { @@ -477,8 +479,10 @@ const StylePropertyShorthand& shorthandForProperty(CSSPropertyID propertyID) return webkitColumnsShorthand(); case CSSPropertyWebkitColumnRule: return webkitColumnRuleShorthand(); +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlexFlow: return webkitFlexFlowShorthand(); +#endif case CSSPropertyWebkitMarginCollapse: return webkitMarginCollapseShorthand(); case CSSPropertyWebkitMarquee: diff --git a/Source/WebCore/css/StylePropertyShorthand.h b/Source/WebCore/css/StylePropertyShorthand.h index d97a9a68a..a0585381f 100644 --- a/Source/WebCore/css/StylePropertyShorthand.h +++ b/Source/WebCore/css/StylePropertyShorthand.h @@ -86,7 +86,9 @@ const StylePropertyShorthand& webkitBorderEndShorthand(); const StylePropertyShorthand& webkitBorderStartShorthand(); const StylePropertyShorthand& webkitColumnsShorthand(); const StylePropertyShorthand& webkitColumnRuleShorthand(); +#if ENABLE(CSS3_FLEXBOX) const StylePropertyShorthand& webkitFlexFlowShorthand(); +#endif const StylePropertyShorthand& webkitMarginCollapseShorthand(); const StylePropertyShorthand& webkitMarqueeShorthand(); const StylePropertyShorthand& webkitMaskShorthand(); diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp index 07290a64e..06b41a8ac 100644 --- a/Source/WebCore/css/StyleResolver.cpp +++ b/Source/WebCore/css/StyleResolver.cpp @@ -1914,7 +1914,9 @@ static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool s case BLOCK: case TABLE: case BOX: +#if ENABLE(CSS3_FLEXBOX) case FLEX: +#endif case GRID: return display; @@ -1927,8 +1929,10 @@ static EDisplay equivalentBlockDisplay(EDisplay display, bool isFloating, bool s return TABLE; case INLINE_BOX: return BOX; +#if ENABLE(CSS3_FLEXBOX) case INLINE_FLEX: return FLEX; +#endif case INLINE_GRID: return GRID; @@ -4105,6 +4109,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue *value) case CSSPropertyWebkitColumns: case CSSPropertyWebkitColumnSpan: case CSSPropertyWebkitColumnWidth: +#if ENABLE(CSS3_FLEXBOX) case CSSPropertyWebkitFlex: case CSSPropertyWebkitFlexAlign: case CSSPropertyWebkitFlexDirection: @@ -4114,6 +4119,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue *value) case CSSPropertyWebkitFlexOrder: case CSSPropertyWebkitFlexPack: case CSSPropertyWebkitFlexWrap: +#endif #if ENABLE(CSS_REGIONS) case CSSPropertyWebkitFlowFrom: case CSSPropertyWebkitFlowInto: diff --git a/Source/WebCore/css/makeprop.pl b/Source/WebCore/css/makeprop.pl index fbf0dd525..9bc0290d3 100644 --- a/Source/WebCore/css/makeprop.pl +++ b/Source/WebCore/css/makeprop.pl @@ -3,7 +3,7 @@ # This file is part of the WebKit project # # Copyright (C) 1999 Waldo Bastian (bastian@kde.org) -# Copyright (C) 2007, 2008 Apple Inc. All rights reserved. +# Copyright (C) 2007, 2008, 2012 Apple Inc. All rights reserved. # Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) # Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged # @@ -222,4 +222,5 @@ EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf --output-file=CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; +my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf"; +system("\"$gperf\" --key-positions=\"*\" -D -n -s 2 CSSPropertyNames.gperf --output-file=CSSPropertyNames.cpp") == 0 || die "calling gperf failed: $?"; diff --git a/Source/WebCore/css/makevalues.pl b/Source/WebCore/css/makevalues.pl index 353360698..9c9fb5793 100644 --- a/Source/WebCore/css/makevalues.pl +++ b/Source/WebCore/css/makevalues.pl @@ -3,7 +3,7 @@ # This file is part of the WebKit project # # Copyright (C) 1999 Waldo Bastian (bastian@kde.org) -# Copyright (C) 2007 Apple Inc. All rights reserved. +# Copyright (C) 2007, 2012 Apple Inc. All rights reserved. # Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) # Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged # @@ -160,4 +160,5 @@ const char* getValueName(unsigned short id); EOF close HEADER; -system("gperf --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf --output-file=CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?"; +my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf"; +system("\"$gperf\" --key-positions=\"*\" -D -n -s 2 CSSValueKeywords.gperf --output-file=CSSValueKeywords.cpp") == 0 || die "calling gperf failed: $?"; diff --git a/Source/WebCore/dom/CharacterData.cpp b/Source/WebCore/dom/CharacterData.cpp index e6c081d14..2837a78a3 100644 --- a/Source/WebCore/dom/CharacterData.cpp +++ b/Source/WebCore/dom/CharacterData.cpp @@ -72,7 +72,7 @@ unsigned CharacterData::parserAppendData(const UChar* data, unsigned dataLength, // see <https://bugs.webkit.org/show_bug.cgi?id=29092>. // We need at least two characters look-ahead to account for UTF-16 surrogates. if (end < dataLength) { - TextBreakIterator* it = characterBreakIterator(data, (end + 2 > dataLength) ? dataLength : end + 2); + NonSharedCharacterBreakIterator it(data, (end + 2 > dataLength) ? dataLength : end + 2); if (!isTextBreak(it, end)) end = textBreakPreceding(it, end); } diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp index e6924bda1..8431cbba0 100644 --- a/Source/WebCore/dom/Element.cpp +++ b/Source/WebCore/dom/Element.cpp @@ -1115,7 +1115,7 @@ void Element::recalcStyle(StyleChange change) } if (change != Force) { - if (styleChangeType() == FullStyleChange) + if (styleChangeType() >= FullStyleChange) change = Force; else change = ch; diff --git a/Source/WebCore/dom/Range.cpp b/Source/WebCore/dom/Range.cpp index 2d86fcfa9..b4d3ff56d 100644 --- a/Source/WebCore/dom/Range.cpp +++ b/Source/WebCore/dom/Range.cpp @@ -1124,12 +1124,9 @@ PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku return 0; } - RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted); - - if (!fragment) { - ec = NOT_SUPPORTED_ERR; + RefPtr<DocumentFragment> fragment = WebCore::createContextualFragment(markup, toHTMLElement(element), AllowScriptingContentAndDoNotMarkAlreadyStarted, ec); + if (!fragment) return 0; - } return fragment.release(); } diff --git a/Source/WebCore/dom/ScriptElement.cpp b/Source/WebCore/dom/ScriptElement.cpp index aefdddb49..746e6c37b 100644 --- a/Source/WebCore/dom/ScriptElement.cpp +++ b/Source/WebCore/dom/ScriptElement.cpp @@ -41,12 +41,14 @@ #include "ScriptRunner.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" +#include "ScriptableDocumentParser.h" #include "SecurityOrigin.h" #include "Settings.h" #include "Text.h" #include <wtf/StdLibExtras.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/StringHash.h> +#include <wtf/text/TextPosition.h> #if ENABLE(SVG) #include "SVGNames.h" @@ -58,6 +60,7 @@ namespace WebCore { ScriptElement::ScriptElement(Element* element, bool parserInserted, bool alreadyStarted) : m_element(element) , m_cachedScript(0) + , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) , m_parserInserted(parserInserted) , m_isExternalScript(false) , m_alreadyStarted(alreadyStarted) @@ -70,6 +73,8 @@ ScriptElement::ScriptElement(Element* element, bool parserInserted, bool already , m_requestUsesAccessControl(false) { ASSERT(m_element); + if (parserInserted && m_element->document()->scriptableDocumentParser() && !m_element->document()->isInDocumentWrite()) + m_startLineNumber = m_element->document()->scriptableDocumentParser()->lineNumber(); } ScriptElement::~ScriptElement() @@ -276,7 +281,7 @@ void ScriptElement::executeScript(const ScriptSourceCode& sourceCode) if (sourceCode.isEmpty()) return; - if (!m_isExternalScript && !m_element->document()->contentSecurityPolicy()->allowInlineScript()) + if (!m_isExternalScript && !m_element->document()->contentSecurityPolicy()->allowInlineScript(m_element->document()->url(), m_startLineNumber)) return; RefPtr<Document> document = m_element->document(); diff --git a/Source/WebCore/dom/ScriptElement.h b/Source/WebCore/dom/ScriptElement.h index 6bec56d7e..5f98d7583 100644 --- a/Source/WebCore/dom/ScriptElement.h +++ b/Source/WebCore/dom/ScriptElement.h @@ -93,6 +93,7 @@ private: Element* m_element; CachedResourceHandle<CachedScript> m_cachedScript; + WTF::OrdinalNumber m_startLineNumber; bool m_parserInserted : 1; bool m_isExternalScript : 1; bool m_alreadyStarted : 1; diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp index 86a10cdc0..3eba812fc 100644 --- a/Source/WebCore/dom/ShadowRoot.cpp +++ b/Source/WebCore/dom/ShadowRoot.cpp @@ -144,7 +144,7 @@ String ShadowRoot::innerHTML() const void ShadowRoot::setInnerHTML(const String& markup, ExceptionCode& ec) { - if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), ec)) + if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, host(), AllowScriptingContent, ec)) replaceChildrenWithFragment(this, fragment.release(), ec); } diff --git a/Source/WebCore/dom/StyleElement.cpp b/Source/WebCore/dom/StyleElement.cpp index 090c40c2f..dd4de2901 100644 --- a/Source/WebCore/dom/StyleElement.cpp +++ b/Source/WebCore/dom/StyleElement.cpp @@ -30,6 +30,7 @@ #include "ScriptableDocumentParser.h" #include "StyleSheetContents.h" #include <wtf/text/StringBuilder.h> +#include <wtf/text/TextPosition.h> namespace WebCore { @@ -48,10 +49,10 @@ static bool isCSS(Element* element, const AtomicString& type) StyleElement::StyleElement(Document* document, bool createdByParser) : m_createdByParser(createdByParser) , m_loading(false) - , m_startLineNumber(0) + , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) { - if (createdByParser && document && document->scriptableDocumentParser()) - m_startLineNumber = document->scriptableDocumentParser()->lineNumber().zeroBasedInt(); + if (createdByParser && document && document->scriptableDocumentParser() && !document->isInDocumentWrite()) + m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); } StyleElement::~StyleElement() @@ -144,7 +145,7 @@ void StyleElement::clearSheet() m_sheet = 0; } -void StyleElement::createSheet(Element* e, int startLineNumber, const String& text) +void StyleElement::createSheet(Element* e, WTF::OrdinalNumber startLineNumber, const String& text) { ASSERT(e); ASSERT(e->inDocument()); @@ -157,7 +158,7 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te // If type is empty or CSS, this is a CSS style sheet. const AtomicString& type = this->type(); - if (document->contentSecurityPolicy()->allowInlineStyle() && isCSS(e, type)) { + if (document->contentSecurityPolicy()->allowInlineStyle(e->document()->url(), startLineNumber) && isCSS(e, type)) { RefPtr<MediaQuerySet> mediaQueries; if (e->isHTMLElement()) mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(media()); @@ -173,8 +174,7 @@ void StyleElement::createSheet(Element* e, int startLineNumber, const String& te m_sheet = CSSStyleSheet::createInline(e, KURL(), document->inputEncoding()); m_sheet->setMediaQueries(mediaQueries.release()); m_sheet->setTitle(e->title()); - - m_sheet->contents()->parseStringAtLine(text, startLineNumber); + m_sheet->contents()->parseStringAtLine(text, startLineNumber.zeroBasedInt()); m_loading = false; } diff --git a/Source/WebCore/dom/StyleElement.h b/Source/WebCore/dom/StyleElement.h index 3c31abbf7..6dd48ecbb 100644 --- a/Source/WebCore/dom/StyleElement.h +++ b/Source/WebCore/dom/StyleElement.h @@ -22,6 +22,7 @@ #define StyleElement_h #include "CSSStyleSheet.h" +#include <wtf/text/TextPosition.h> namespace WebCore { @@ -52,13 +53,13 @@ protected: RefPtr<CSSStyleSheet> m_sheet; private: - void createSheet(Element*, int startLineNumber, const String& text = String()); + void createSheet(Element*, WTF::OrdinalNumber startLineNumber, const String& text = String()); void process(Element*); void clearSheet(); bool m_createdByParser; bool m_loading; - int m_startLineNumber; + WTF::OrdinalNumber m_startLineNumber; }; } diff --git a/Source/WebCore/dom/StyledElement.cpp b/Source/WebCore/dom/StyledElement.cpp index a992644c1..43747b806 100644 --- a/Source/WebCore/dom/StyledElement.cpp +++ b/Source/WebCore/dom/StyledElement.cpp @@ -37,9 +37,11 @@ #include "Document.h" #include "HTMLNames.h" #include "HTMLParserIdioms.h" +#include "ScriptableDocumentParser.h" #include "StylePropertySet.h" #include "StyleResolver.h" #include <wtf/HashFunctions.h> +#include <wtf/text/TextPosition.h> using namespace std; @@ -126,13 +128,21 @@ void StyledElement::updateStyleAttribute() const const_cast<StyledElement*>(this)->setAttribute(styleAttr, inlineStyle->asText(), InUpdateStyleAttribute); } +StyledElement::StyledElement(const QualifiedName& name, Document* document, ConstructionType type) + : Element(name, document, type) + , m_startLineNumber(WTF::OrdinalNumber::beforeFirst()) +{ + if (document && document->scriptableDocumentParser() && !document->isInDocumentWrite()) + m_startLineNumber = document->scriptableDocumentParser()->lineNumber(); +} + StyledElement::~StyledElement() { destroyInlineStyle(); } -CSSStyleDeclaration* StyledElement::style() -{ +CSSStyleDeclaration* StyledElement::style() +{ return ensureAttributeData()->ensureMutableInlineStyle(this)->ensureInlineCSSStyleDeclaration(this); } @@ -173,7 +183,7 @@ void StyledElement::styleAttributeChanged(const AtomicString& newStyleString, Sh if (shouldReparse) { if (newStyleString.isNull()) destroyInlineStyle(); - else if (document()->contentSecurityPolicy()->allowInlineStyle()) + else if (document()->contentSecurityPolicy()->allowInlineStyle(document()->url(), m_startLineNumber)) ensureAttributeData()->updateInlineStyleAvoidingMutation(this, newStyleString); setIsStyleAttributeValid(); } diff --git a/Source/WebCore/dom/StyledElement.h b/Source/WebCore/dom/StyledElement.h index 6cf4145f2..4736a9800 100644 --- a/Source/WebCore/dom/StyledElement.h +++ b/Source/WebCore/dom/StyledElement.h @@ -27,6 +27,7 @@ #include "Element.h" #include "StylePropertySet.h" +#include <wtf/text/TextPosition.h> namespace WebCore { @@ -62,10 +63,7 @@ public: void styleAttributeChanged(const AtomicString& newStyleString, ShouldReparseStyleAttribute = ReparseStyleAttribute); protected: - StyledElement(const QualifiedName& name, Document* document, ConstructionType type) - : Element(name, document, type) - { - } + StyledElement(const QualifiedName&, Document*, ConstructionType); virtual void attributeChanged(const Attribute&) OVERRIDE; virtual void parseAttribute(const Attribute&); @@ -95,6 +93,8 @@ private: if (attributeData()) attributeData()->destroyInlineStyle(this); } + + WTF::OrdinalNumber m_startLineNumber; }; inline const SpaceSplitString& StyledElement::classNames() const diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp index 4983dcd4d..9ae7e72c2 100644 --- a/Source/WebCore/editing/markup.cpp +++ b/Source/WebCore/editing/markup.cpp @@ -665,7 +665,9 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const { // We use a fake body element here to trick the HTML parser to using the InBody insertion mode. RefPtr<HTMLBodyElement> fakeBody = HTMLBodyElement::create(document); - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, fakeBody.get(), scriptingPermission); + // Ignore exceptions here since this function is used to parse markup for pasting or for other editing purposes. + ExceptionCode ignoredEC; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, fakeBody.get(), scriptingPermission, ignoredEC); if (fragment && !baseURL.isEmpty() && baseURL != blankURL() && baseURL != document->baseURL()) completeURLs(fragment.get(), baseURL); @@ -992,19 +994,19 @@ String urlToMarkup(const KURL& url, const String& title) return markup.toString(); } -PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, ExceptionCode& ec) +PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String& markup, Element* contextElement, FragmentScriptingPermission scriptingPermission, ExceptionCode& ec) { Document* document = contextElement->document(); RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); if (document->isHTMLDocument()) { - fragment->parseHTML(markup, contextElement); + fragment->parseHTML(markup, contextElement, scriptingPermission); return fragment; } - bool wasValid = fragment->parseXML(markup, contextElement); + bool wasValid = fragment->parseXML(markup, contextElement, scriptingPermission); if (!wasValid) { - ec = INVALID_STATE_ERR; + ec = SYNTAX_ERR; return 0; } return fragment.release(); @@ -1050,24 +1052,23 @@ static inline void removeElementPreservingChildren(PassRefPtr<DocumentFragment> ASSERT(!ignoredExceptionCode); } -PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, Element* element, FragmentScriptingPermission scriptingPermission) +PassRefPtr<DocumentFragment> createContextualFragment(const String& markup, HTMLElement* element, FragmentScriptingPermission scriptingPermission, ExceptionCode& ec) { ASSERT(element); - HTMLElement* htmlElement = toHTMLElement(element); - if (htmlElement->ieForbidsInsertHTML()) + if (element->ieForbidsInsertHTML()) { + ec = NOT_SUPPORTED_ERR; return 0; + } - if (htmlElement->hasLocalName(colTag) || htmlElement->hasLocalName(colgroupTag) || htmlElement->hasLocalName(framesetTag) - || htmlElement->hasLocalName(headTag) || htmlElement->hasLocalName(styleTag) || htmlElement->hasLocalName(titleTag)) + if (element->hasLocalName(colTag) || element->hasLocalName(colgroupTag) || element->hasLocalName(framesetTag) + || element->hasLocalName(headTag) || element->hasLocalName(styleTag) || element->hasLocalName(titleTag)) { + ec = NOT_SUPPORTED_ERR; return 0; + } - // FIXME: This code is almost identical to createFragmentForInnerOuterHTML except this code doesn't handle exceptions. - RefPtr<DocumentFragment> fragment = element->document()->createDocumentFragment(); - - if (element->document()->isHTMLDocument()) - fragment->parseHTML(markup, element, scriptingPermission); - else if (!fragment->parseXML(markup, element, scriptingPermission)) - return 0; // FIXME: We should propagate a syntax error exception out here. + RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, element, scriptingPermission, ec); + if (!fragment) + return 0; // We need to pop <html> and <body> elements and remove <head> to // accommodate folks passing complete HTML documents to make the diff --git a/Source/WebCore/editing/markup.h b/Source/WebCore/editing/markup.h index a36cb350a..ca20c9acf 100644 --- a/Source/WebCore/editing/markup.h +++ b/Source/WebCore/editing/markup.h @@ -37,6 +37,7 @@ namespace WebCore { class Document; class DocumentFragment; class Element; + class HTMLElement; class KURL; class Node; class QualifiedName; @@ -51,9 +52,9 @@ namespace WebCore { PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document*, const String& markup, const String& baseURL, FragmentScriptingPermission = AllowScriptingContent); PassRefPtr<DocumentFragment> createFragmentFromMarkupWithContext(Document*, const String& markup, unsigned fragmentStart, unsigned fragmentEnd, const String& baseURL, FragmentScriptingPermission); PassRefPtr<DocumentFragment> createFragmentFromNodes(Document*, const Vector<Node*>&); - PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, ExceptionCode&); + PassRefPtr<DocumentFragment> createFragmentForInnerOuterHTML(const String&, Element*, FragmentScriptingPermission, ExceptionCode&); PassRefPtr<DocumentFragment> createFragmentForTransformToFragment(const String&, const String& sourceMIMEType, Document* outputDoc); - PassRefPtr<DocumentFragment> createContextualFragment(const String&, Element*, FragmentScriptingPermission); + PassRefPtr<DocumentFragment> createContextualFragment(const String&, HTMLElement*, FragmentScriptingPermission, ExceptionCode&); bool isPlainTextMarkup(Node *node); diff --git a/Source/WebCore/fileapi/FileReader.cpp b/Source/WebCore/fileapi/FileReader.cpp index e05b1d971..ab7c2b3b2 100644 --- a/Source/WebCore/fileapi/FileReader.cpp +++ b/Source/WebCore/fileapi/FileReader.cpp @@ -218,6 +218,7 @@ void FileReader::didFinishLoading() ASSERT(m_state != DONE); m_state = DONE; + fireEvent(eventNames().progressEvent); fireEvent(eventNames().loadEvent); fireEvent(eventNames().loadendEvent); @@ -254,7 +255,10 @@ PassRefPtr<ArrayBuffer> FileReader::arrayBufferResult() const String FileReader::stringResult() { - return m_loader ? m_loader->stringResult() : ""; + String ret = m_loader ? m_loader->stringResult() : ""; + if (ret.isEmpty()) + return String(); + return ret; } } // namespace WebCore diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp index b420c342b..3d4ee8d29 100644 --- a/Source/WebCore/html/HTMLElement.cpp +++ b/Source/WebCore/html/HTMLElement.cpp @@ -342,7 +342,7 @@ String HTMLElement::outerHTML() const void HTMLElement::setInnerHTML(const String& html, ExceptionCode& ec) { - if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, ec)) + if (RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, this, AllowScriptingContent, ec)) replaceChildrenWithFragment(this, fragment.release(), ec); } @@ -373,7 +373,7 @@ void HTMLElement::setOuterHTML(const String& html, ExceptionCode& ec) RefPtr<Node> prev = previousSibling(); RefPtr<Node> next = nextSibling(); - RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), ec); + RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(html, parent.get(), AllowScriptingContent, ec); if (ec) return; @@ -578,9 +578,8 @@ void HTMLElement::insertAdjacentHTML(const String& where, const String& markup, Element* contextElement = contextElementForInsertion(where, this, ec); if (!contextElement) return; - ExceptionCode ignoredEc = 0; // FIXME: We should propagate a syntax error exception out here. - RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, this, ignoredEc); - if (ignoredEc) + RefPtr<DocumentFragment> fragment = createFragmentForInnerOuterHTML(markup, this, AllowScriptingContent, ec); + if (!fragment) return; insertAdjacent(where, fragment.get(), ec); } diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.cpp b/Source/WebCore/html/parser/HTMLConstructionSite.cpp index 04e460613..4da7a7ae9 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.cpp +++ b/Source/WebCore/html/parser/HTMLConstructionSite.cpp @@ -106,11 +106,12 @@ static inline void executeTask(HTMLConstructionSiteTask& task) task.child->finishParsingChildren(); } -void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild) +void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> prpChild, bool selfClosing) { HTMLConstructionSiteTask task; task.parent = parent; task.child = prpChild; + task.selfClosing = selfClosing; if (shouldFosterParent()) { fosterParent(task.child); @@ -315,11 +316,10 @@ void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken& token) void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken& token) { ASSERT(token.type() == HTMLTokenTypes::StartTag); - attachLater(currentNode(), createHTMLElement(token)); // Normally HTMLElementStack is responsible for calling finishParsingChildren, // but self-closing elements are never in the element stack so the stack // doesn't get a chance to tell them that we're done parsing their children. - m_attachmentQueue.last().selfClosing = true; + attachLater(currentNode(), createHTMLElement(token), true); // FIXME: Do we want to acknowledge the token's self-closing flag? // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#acknowledge-self-closing-flag } @@ -355,9 +355,7 @@ void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken& token, const At notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. RefPtr<Element> element = createElement(token, namespaceURI); - attachLater(currentNode(), element); - // FIXME: Don't we need to set the selfClosing flag on the task if we're - // not going to push the element on to the stack of open elements? + attachLater(currentNode(), element, token.selfClosing()); if (!token.selfClosing()) m_openElements.push(element.release()); } diff --git a/Source/WebCore/html/parser/HTMLConstructionSite.h b/Source/WebCore/html/parser/HTMLConstructionSite.h index 6e28d3a9b..27906643b 100644 --- a/Source/WebCore/html/parser/HTMLConstructionSite.h +++ b/Source/WebCore/html/parser/HTMLConstructionSite.h @@ -155,7 +155,7 @@ private: // tokens produce only one DOM mutation. typedef Vector<HTMLConstructionSiteTask, 1> AttachmentQueue; - void attachLater(ContainerNode* parent, PassRefPtr<Node> child); + void attachLater(ContainerNode* parent, PassRefPtr<Node> child, bool selfClosing = false); void findFosterSite(HTMLConstructionSiteTask&); diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp index 0f7af3880..7763e23da 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.cpp @@ -66,6 +66,16 @@ PassRefPtr<TextFieldDecorationElement> TextFieldDecorationElement::create(Docume return adoptRef(new TextFieldDecorationElement(document, decorator)); } +TextFieldDecorationElement* TextFieldDecorationElement::fromShadowRoot(ShadowRoot* shadowRoot) +{ + if (!shadowRoot->firstChild() + || !shadowRoot->firstChild()->lastChild() + || !shadowRoot->firstChild()->lastChild()->isElementNode() + || !toElement(shadowRoot->firstChild()->lastChild())->isTextFieldDecoration()) + return 0; + return toTextFieldDecorationElement(shadowRoot->firstChild()->lastChild()); +} + static inline void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, ShadowRoot*& decorationRoot, ShadowRoot*& decoratedRoot) { ShadowRoot* existingRoot = input->youngestShadowRoot(); @@ -83,7 +93,7 @@ static inline void getDecorationRootAndDecoratedRoot(HTMLInputElement* input, Sh decoratedRoot = existingRoot; } -void TextFieldDecorationElement::decorate(HTMLInputElement* input) +void TextFieldDecorationElement::decorate(HTMLInputElement* input, bool visible) { ASSERT(input); ShadowRoot* existingRoot; @@ -99,7 +109,7 @@ void TextFieldDecorationElement::decorate(HTMLInputElement* input) toHTMLElement(existingRoot->firstChild())->setInlineStyleProperty(CSSPropertyWebkitBoxFlex, 1.0, CSSPrimitiveValue::CSS_NUMBER); box->appendChild(HTMLShadowElement::create(HTMLNames::shadowTag, input->document())); - setInlineStyleProperty(CSSPropertyWebkitBoxFlex, 0.0, CSSPrimitiveValue::CSS_NUMBER); + setInlineStyleProperty(CSSPropertyDisplay, visible ? CSSValueBlock : CSSValueNone); box->appendChild(this); } diff --git a/Source/WebCore/html/shadow/TextFieldDecorationElement.h b/Source/WebCore/html/shadow/TextFieldDecorationElement.h index b34e7b5aa..f2c827a45 100644 --- a/Source/WebCore/html/shadow/TextFieldDecorationElement.h +++ b/Source/WebCore/html/shadow/TextFieldDecorationElement.h @@ -37,6 +37,7 @@ namespace WebCore { class CachedImage; class HTMLInputElement; +class ShadowRoot; // A TextFieldDecorator object must live until all of text fields which were // decorated by it die. @@ -45,6 +46,7 @@ public: // Returns true if this TextFieldDecorator wants to add a // decoration to the specified text field. virtual bool willAddDecorationTo(HTMLInputElement*) = 0; + virtual bool visibleByDefault() = 0; // A TextFieldDecorator object should own the CachedImage objects. virtual CachedImage* imageForNormalState() = 0; @@ -65,8 +67,9 @@ public: class TextFieldDecorationElement : public HTMLDivElement { public: static PassRefPtr<TextFieldDecorationElement> create(Document*, TextFieldDecorator*); + static TextFieldDecorationElement* fromShadowRoot(ShadowRoot*); TextFieldDecorator* textFieldDecorator() { return m_textFieldDecorator; } - void decorate(HTMLInputElement*); + void decorate(HTMLInputElement*, bool visible); private: TextFieldDecorationElement(Document*, TextFieldDecorator*); diff --git a/Source/WebCore/inspector/Inspector.json b/Source/WebCore/inspector/Inspector.json index cda2bcbf1..b2ee963f4 100644 --- a/Source/WebCore/inspector/Inspector.json +++ b/Source/WebCore/inspector/Inspector.json @@ -1859,10 +1859,10 @@ "description": "This object identifies a CSS style in a unique way." }, { - "id": "Origin", + "id": "StyleSheetOrigin", "type": "string", "enum": ["user", "user-agent", "inspector", "regular"], - "description": "The parent stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding new rules created with <code>addRule()</code>), \"regular\" for regular stylesheets." + "description": "Stylesheet type: \"user\" for user stylesheets, \"user-agent\" for user-agent stylesheets, \"inspector\" for stylesheets created by the inspector (i.e. those holding the \"via inspector\" rules), \"regular\" for regular stylesheets." }, { "id": "CSSRuleId", @@ -1907,7 +1907,7 @@ { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "The stylesheet identifier."}, { "name": "frameId", "$ref": "Network.FrameId", "description": "Owner frame identifier."}, { "name": "sourceURL", "type": "string", "description": "Stylesheet resource URL."}, - { "name": "origin", "$ref": "Origin", "description": "Rule origin"}, + { "name": "origin", "$ref": "StyleSheetOrigin", "description": "Stylesheet origin."}, { "name": "title", "type": "string", "description": "Stylesheet title."}, { "name": "disabled", "type": "boolean", "description": "Denotes whether the stylesheet is disabled."} ], @@ -1931,7 +1931,7 @@ { "name": "selectorText", "type": "string", "description": "Rule selector."}, { "name": "sourceURL", "type": "string", "optional": true, "description": "Parent stylesheet resource URL (for regular rules)."}, { "name": "sourceLine", "type": "integer", "description": "Line ordinal of the rule selector start character in the resource."}, - { "name": "origin", "$ref": "Origin", "description": "Rule origin"}, + { "name": "origin", "$ref": "StyleSheetOrigin", "description": "Parent stylesheet's origin."}, { "name": "style", "$ref": "CSSStyle", "description": "Associated style declaration." }, { "name": "selectorRange", "$ref": "SourceRange", "optional": true, "description": "The rule selector range in the underlying resource (if available)." }, { "name": "media", "type": "array", "items": { "$ref": "CSSMedia" }, "optional": true, "description": "Media list array (for rules involving media queries). The array enumerates media queries starting with the innermost one, going outwards." } diff --git a/Source/WebCore/inspector/InspectorCSSAgent.cpp b/Source/WebCore/inspector/InspectorCSSAgent.cpp index 87f31e146..6fa88c45b 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.cpp +++ b/Source/WebCore/inspector/InspectorCSSAgent.cpp @@ -826,7 +826,7 @@ InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Elem return 0; String newStyleSheetId = String::number(m_lastStyleSheetId++); - RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(m_domAgent->pageAgent(), newStyleSheetId, element, TypeBuilder::CSS::Origin::Regular, this); + RefPtr<InspectorStyleSheetForInlineStyle> inspectorStyleSheet = InspectorStyleSheetForInlineStyle::create(m_domAgent->pageAgent(), newStyleSheetId, element, TypeBuilder::CSS::StyleSheetOrigin::Regular, this); m_idToInspectorStyleSheet.set(newStyleSheetId, inspectorStyleSheet); m_nodeToInspectorStyleSheet.set(element, inspectorStyleSheet); return inspectorStyleSheet.get(); @@ -912,7 +912,7 @@ InspectorStyleSheet* InspectorCSSAgent::viaInspectorStyleSheet(Document* documen return 0; CSSStyleSheet* cssStyleSheet = static_cast<CSSStyleSheet*>(styleSheet); String id = String::number(m_lastStyleSheetId++); - inspectorStyleSheet = InspectorStyleSheet::create(m_domAgent->pageAgent(), id, cssStyleSheet, TypeBuilder::CSS::Origin::Inspector, InspectorDOMAgent::documentURLString(document), this); + inspectorStyleSheet = InspectorStyleSheet::create(m_domAgent->pageAgent(), id, cssStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Inspector, InspectorDOMAgent::documentURLString(document), this); m_idToInspectorStyleSheet.set(id, inspectorStyleSheet); m_cssStyleSheetToInspectorStyleSheet.set(cssStyleSheet, inspectorStyleSheet); m_documentToInspectorStyleSheet.set(document, inspectorStyleSheet); @@ -929,17 +929,17 @@ InspectorStyleSheet* InspectorCSSAgent::assertStyleSheetForId(ErrorString* error return it->second.get(); } -TypeBuilder::CSS::Origin::Enum InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument) +TypeBuilder::CSS::StyleSheetOrigin::Enum InspectorCSSAgent::detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument) { - TypeBuilder::CSS::Origin::Enum origin = TypeBuilder::CSS::Origin::Regular; + TypeBuilder::CSS::StyleSheetOrigin::Enum origin = TypeBuilder::CSS::StyleSheetOrigin::Regular; if (pageStyleSheet && !pageStyleSheet->ownerNode() && pageStyleSheet->href().isEmpty()) - origin = TypeBuilder::CSS::Origin::User_agent; + origin = TypeBuilder::CSS::StyleSheetOrigin::User_agent; else if (pageStyleSheet && pageStyleSheet->ownerNode() && pageStyleSheet->ownerNode()->nodeName() == "#document") - origin = TypeBuilder::CSS::Origin::User; + origin = TypeBuilder::CSS::StyleSheetOrigin::User; else { InspectorStyleSheet* viaInspectorStyleSheetForOwner = viaInspectorStyleSheet(ownerDocument, false); if (viaInspectorStyleSheetForOwner && pageStyleSheet == viaInspectorStyleSheetForOwner->pageStyleSheet()) - origin = TypeBuilder::CSS::Origin::Inspector; + origin = TypeBuilder::CSS::StyleSheetOrigin::Inspector; } return origin; } diff --git a/Source/WebCore/inspector/InspectorCSSAgent.h b/Source/WebCore/inspector/InspectorCSSAgent.h index 44b210770..890391a19 100644 --- a/Source/WebCore/inspector/InspectorCSSAgent.h +++ b/Source/WebCore/inspector/InspectorCSSAgent.h @@ -143,7 +143,7 @@ private: InspectorStyleSheet* bindStyleSheet(CSSStyleSheet*); InspectorStyleSheet* viaInspectorStyleSheet(Document*, bool createIfAbsent); InspectorStyleSheet* assertStyleSheetForId(ErrorString*, const String&); - TypeBuilder::CSS::Origin::Enum detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument); + TypeBuilder::CSS::StyleSheetOrigin::Enum detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument); PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSRule> > buildArrayForRuleList(CSSRuleList*, StyleResolver*); PassRefPtr<TypeBuilder::CSS::CSSStyle> buildObjectForAttributesStyle(Element*); diff --git a/Source/WebCore/inspector/InspectorStyleSheet.cpp b/Source/WebCore/inspector/InspectorStyleSheet.cpp index 41fea65a9..4498adc14 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.cpp +++ b/Source/WebCore/inspector/InspectorStyleSheet.cpp @@ -57,6 +57,7 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/StringBuilder.h> using WebCore::TypeBuilder::Array; @@ -638,10 +639,9 @@ NewLineAndWhitespace& InspectorStyle::newLineAndWhitespaceDelimiters() const m_formatAcquired = true; - String formatLineFeed = ""; - String formatPropertyPrefix = ""; - String prefix; String candidatePrefix = defaultPrefix; + StringBuilder formatLineFeed; + StringBuilder prefix; int scanStart = 0; int propertyIndex = 0; bool isFullPrefixScanned = false; @@ -658,11 +658,12 @@ NewLineAndWhitespace& InspectorStyle::newLineAndWhitespaceDelimiters() const if (isLineFeed) { if (!lineFeedTerminated) formatLineFeed.append(ch); + prefix.clear(); } else if (isHTMLSpace(ch)) prefix.append(ch); else { - candidatePrefix = prefix; - prefix = ""; + candidatePrefix = prefix.toString(); + prefix.clear(); scanStart = currentProperty.range.end; ++propertyIndex; processNextProperty = true; @@ -677,12 +678,12 @@ NewLineAndWhitespace& InspectorStyle::newLineAndWhitespaceDelimiters() const } } - m_format.first = formatLineFeed; - m_format.second = isFullPrefixScanned ? prefix : candidatePrefix; + m_format.first = formatLineFeed.toString(); + m_format.second = isFullPrefixScanned ? prefix.toString() : candidatePrefix; return m_format; } -PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::Origin::Enum origin, const String& documentURL, Listener* listener) +PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, Listener* listener) { return adoptRef(new InspectorStyleSheet(pageAgent, id, pageStyleSheet, origin, documentURL, listener)); } @@ -695,7 +696,7 @@ String InspectorStyleSheet::styleSheetURL(CSSStyleSheet* pageStyleSheet) return emptyString(); } -InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::Origin::Enum origin, const String& documentURL, Listener* listener) +InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, Listener* listener) : m_pageAgent(pageAgent) , m_id(id) , m_pageStyleSheet(pageStyleSheet) @@ -898,7 +899,7 @@ PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS .setStyle(buildObjectForStyle(rule->style())); // "sourceURL" is present only for regular rules, otherwise "origin" should be used in the frontend. - if (m_origin == TypeBuilder::CSS::Origin::Regular) + if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::Regular) result->setSourceURL(finalURL()); if (canBind()) { @@ -1204,7 +1205,7 @@ bool InspectorStyleSheet::originalStyleSheetText(String* result) const bool InspectorStyleSheet::resourceStyleSheetText(String* result) const { - if (m_origin == TypeBuilder::CSS::Origin::User || m_origin == TypeBuilder::CSS::Origin::User_agent) + if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::User || m_origin == TypeBuilder::CSS::StyleSheetOrigin::User_agent) return false; if (!m_pageStyleSheet || !ownerDocument() || !ownerDocument()->frame()) @@ -1315,12 +1316,12 @@ void InspectorStyleSheet::collectFlatRules(PassRefPtr<CSSRuleList> ruleList, Vec } } -PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::Origin::Enum origin, Listener* listener) +PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle::create(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, Listener* listener) { return adoptRef(new InspectorStyleSheetForInlineStyle(pageAgent, id, element, origin, listener)); } -InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::Origin::Enum origin, Listener* listener) +InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(InspectorPageAgent* pageAgent, const String& id, PassRefPtr<Element> element, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, Listener* listener) : InspectorStyleSheet(pageAgent, id, 0, origin, "", listener) , m_element(element) , m_ruleSourceData(0) diff --git a/Source/WebCore/inspector/InspectorStyleSheet.h b/Source/WebCore/inspector/InspectorStyleSheet.h index 427dab280..03cab677d 100644 --- a/Source/WebCore/inspector/InspectorStyleSheet.h +++ b/Source/WebCore/inspector/InspectorStyleSheet.h @@ -171,7 +171,7 @@ public: }; typedef HashMap<CSSStyleDeclaration*, RefPtr<InspectorStyle> > InspectorStyleMap; - static PassRefPtr<InspectorStyleSheet> create(InspectorPageAgent*, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::Origin::Enum, const String& documentURL, Listener*); + static PassRefPtr<InspectorStyleSheet> create(InspectorPageAgent*, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, Listener*); static String styleSheetURL(CSSStyleSheet* pageStyleSheet); virtual ~InspectorStyleSheet(); @@ -201,9 +201,9 @@ public: InspectorCSSId styleId(CSSStyleDeclaration* style) const { return ruleOrStyleId(style); } protected: - InspectorStyleSheet(InspectorPageAgent*, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::Origin::Enum, const String& documentURL, Listener*); + InspectorStyleSheet(InspectorPageAgent*, const String& id, PassRefPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum, const String& documentURL, Listener*); - bool canBind() const { return m_origin != TypeBuilder::CSS::Origin::User_agent && m_origin != TypeBuilder::CSS::Origin::User; } + bool canBind() const { return m_origin != TypeBuilder::CSS::StyleSheetOrigin::User_agent && m_origin != TypeBuilder::CSS::StyleSheetOrigin::User; } InspectorCSSId ruleOrStyleId(CSSStyleDeclaration* style) const; virtual Document* ownerDocument() const; virtual RefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const; @@ -234,7 +234,7 @@ private: InspectorPageAgent* m_pageAgent; String m_id; RefPtr<CSSStyleSheet> m_pageStyleSheet; - TypeBuilder::CSS::Origin::Enum m_origin; + TypeBuilder::CSS::StyleSheetOrigin::Enum m_origin; String m_documentURL; bool m_isRevalidating; ParsedStyleSheet* m_parsedStyleSheet; @@ -245,14 +245,14 @@ private: class InspectorStyleSheetForInlineStyle : public InspectorStyleSheet { public: - static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorPageAgent*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::Origin::Enum, Listener*); + static PassRefPtr<InspectorStyleSheetForInlineStyle> create(InspectorPageAgent*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::Enum, Listener*); void didModifyElementAttribute(); virtual bool getText(String* result) const; virtual CSSStyleDeclaration* styleForId(const InspectorCSSId& id) const { ASSERT_UNUSED(id, !id.ordinal()); return inlineStyle(); } protected: - InspectorStyleSheetForInlineStyle(InspectorPageAgent*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::Origin::Enum, Listener*); + InspectorStyleSheetForInlineStyle(InspectorPageAgent*, const String& id, PassRefPtr<Element>, TypeBuilder::CSS::StyleSheetOrigin::Enum, Listener*); virtual Document* ownerDocument() const; virtual RefPtr<CSSRuleSourceData> ruleSourceDataFor(CSSStyleDeclaration* style) const { ASSERT_UNUSED(style, style == inlineStyle()); return m_ruleSourceData; } diff --git a/Source/WebCore/inspector/front-end/HeapSnapshot.js b/Source/WebCore/inspector/front-end/HeapSnapshot.js index ced4629a0..4206cf62e 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshot.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshot.js @@ -30,35 +30,6 @@ /** * @constructor - * @param {number=} size - */ -WebInspector.Uint32Array = function(size) -{ - const preallocateSize = 1000; - size = size || preallocateSize; - this._usedSize = 0; - this._array = new Uint32Array(preallocateSize); -} - -WebInspector.Uint32Array.prototype = { - push: function(value) - { - if (this._usedSize + 1 > this._array.length) { - var tempArray = new Uint32Array(this._array.length * 2); - tempArray.set(this._array); - this._array = tempArray; - } - this._array[this._usedSize++] = value; - }, - - get array() - { - return this._array.subarray(0, this._usedSize); - } -} - -/** - * @constructor */ WebInspector.HeapSnapshotArraySlice = function(array, start, end) { @@ -564,16 +535,14 @@ WebInspector.HeapSnapshotNode.prototype = { _edgeIndexesStart: function() { - return this._snapshot._nodes[this.nodeIndex + this._snapshot._firstEdgeIndexOffset]; + var snapshot = this._snapshot; + return snapshot._nodes[this.nodeIndex + snapshot._firstEdgeIndexOffset]; }, _edgeIndexesEnd: function() { - var nextNodeIndex = this._nextNodeIndex(); var snapshot = this._snapshot; - if (nextNodeIndex < snapshot._nodes.length) - return snapshot._nodes[nextNodeIndex + snapshot._firstEdgeIndexOffset] - return snapshot._containmentEdges.length; + return snapshot._nodes[this._nextNodeIndex() + snapshot._firstEdgeIndexOffset] }, _nextNodeIndex: function() @@ -594,7 +563,7 @@ WebInspector.HeapSnapshotNode.prototype = { WebInspector.HeapSnapshotNodeIterator = function(node) { this.node = node; - this._nodesLength = node._snapshot._nodes.length; + this._nodesLength = node._snapshot._realNodesLength; } WebInspector.HeapSnapshotNodeIterator.prototype = { @@ -719,9 +688,16 @@ WebInspector.HeapSnapshot.prototype = { visitedMarker: 0x10000 // bits: 1,0000,0000,0000,0000 }; - this.nodeCount = this._nodes.length / this._nodeFieldCount; + this._realNodesLength = this._nodes.length; + this.nodeCount = this._realNodesLength / this._nodeFieldCount; this._edgeCount = this._containmentEdges.length / this._edgeFieldsCount; + // Add an extra node and make its first edge field point to the end of edges array. + var nodes = this._nodes; + this._nodes = new Uint32Array(this._realNodesLength + this._nodeFieldCount); + this._nodes.set(nodes); + this._nodes[this._realNodesLength + this._firstEdgeIndexOffset] = this._containmentEdges.length; + this._markInvisibleEdges(); this._buildRetainers(); this._calculateFlags(); @@ -764,13 +740,11 @@ WebInspector.HeapSnapshot.prototype = { var srcNodeIndex = 0; var nextNodeFirstEdgeIndex = nodes[firstEdgeIndexOffset]; - var nodesLength = nodes.length; + var nodesLength = this._realNodesLength; while (srcNodeIndex < nodesLength) { var firstEdgeIndex = nextNodeFirstEdgeIndex; var nextNodeIndex = srcNodeIndex + nodeFieldCount; - nextNodeFirstEdgeIndex = nextNodeIndex < nodesLength - ? nodes[nextNodeIndex + firstEdgeIndexOffset] - : containmentEdges.length; + nextNodeFirstEdgeIndex = nodes[nextNodeIndex + firstEdgeIndexOffset]; for (var edgeIndex = firstEdgeIndex; edgeIndex < nextNodeFirstEdgeIndex; edgeIndex += edgeFieldsCount) { var toNodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset]; if (toNodeIndex % nodeFieldCount) @@ -914,25 +888,26 @@ WebInspector.HeapSnapshot.prototype = { var distances = new Uint32Array(this.nodeCount); // bfs for Window roots - var list = []; + var nodesToVisit = new Uint32Array(this.nodeCount); + var nodesToVisitLength = 0; for (var iter = this.rootNode().edges(); iter.hasNext(); iter.next()) { var node = iter.edge.node(); if (node.isWindow()) { - list.push(node.nodeIndex); + nodesToVisit[nodesToVisitLength++] = node.nodeIndex; distances[node.nodeIndex / nodeFieldCount] = 0; } } - this._bfs(list, distances); + this._bfs(nodesToVisit, nodesToVisitLength, distances); // bfs for root - list = []; - list.push(this._rootNodeIndex); + nodesToVisitLength = 0; + nodesToVisit[nodesToVisitLength++] = this._rootNodeIndex; distances[this._rootNodeIndex / nodeFieldCount] = 0; - this._bfs(list, distances); + this._bfs(nodesToVisit, nodesToVisitLength, distances); this._distancesToWindow = distances; }, - _bfs: function(list, distances) + _bfs: function(nodesToVisit, nodesToVisitLength, distances) { // Peload fields into local variables for better performance. var edgeFieldsCount = this._edgeFieldsCount; @@ -942,29 +917,26 @@ WebInspector.HeapSnapshot.prototype = { var edgeToNodeOffset = this._edgeToNodeOffset; var nodes = this._nodes; var nodeCount = this.nodeCount; + var containmentEdgesLength = containmentEdges.length; var index = 0; - while (index < list.length) { - var nodeIndex = list[index++]; // shift generates too much garbage. + while (index < nodesToVisitLength) { + var nodeIndex = nodesToVisit[index++]; // shift generates too much garbage. var nodeOrdinal = nodeIndex / nodeFieldCount; - if (index > 100000) { - list = list.slice(index); - index = 0; - } var distance = distances[nodeOrdinal] + 1; var firstEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset]; - var edgesEnd = nodeOrdinal < nodeCount - 1 - ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount] - : containmentEdges.length; + var edgesEnd = nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]; for (var edgeToNodeIndex = firstEdgeIndex + edgeToNodeOffset; edgeToNodeIndex < edgesEnd; edgeToNodeIndex += edgeFieldsCount) { var childNodeIndex = containmentEdges[edgeToNodeIndex]; var childNodeOrdinal = childNodeIndex / nodeFieldCount; if (distances[childNodeOrdinal]) continue; distances[childNodeOrdinal] = distance; - list.push(childNodeIndex); + nodesToVisit[nodesToVisitLength++] = childNodeIndex; } } + if (nodesToVisitLength > nodeCount) + throw new Error("BFS failed. Nodes to visit (" + nodesToVisitLength + ") is more than nodes count (" + nodeCount + ")"); }, _buildAggregates: function(filter) @@ -974,7 +946,7 @@ WebInspector.HeapSnapshot.prototype = { var classIndexes = []; var nodes = this._nodes; var flags = this._flags; - var nodesLength = nodes.length; + var nodesLength = this._realNodesLength; var nodeNativeType = this._nodeNativeType; var nodeFieldCount = this._nodeFieldCount; var selfSizeOffset = this._nodeSelfSizeOffset; @@ -1126,9 +1098,7 @@ WebInspector.HeapSnapshot.prototype = { painted[nodeOrdinal] = black; var nodeFlag = flags[nodeOrdinal] & flag; var beginEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset]; - var endEdgeIndex = nodeOrdinal < nodeCount - 1 - ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount] - : containmentEdgesLength; + var endEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]; for (var edgeIndex = beginEdgeIndex; edgeIndex < endEdgeIndex; edgeIndex += edgeFieldsCount) { if (nodeIndex !== rootNodeIndex && containmentEdges[edgeIndex + edgeTypeOffset] === edgeShortcutType) continue; @@ -1259,9 +1229,7 @@ WebInspector.HeapSnapshot.prototype = { nodeOrdinal = postOrderIndex2NodeOrdinal[postOrderIndex]; nodeIndex = nodeOrdinal * nodeFieldCount; beginEdgeToNodeFieldIndex = nodes[nodeIndex + firstEdgeIndexOffset] + edgeToNodeOffset; - endEdgeToNodeFieldIndex = nodeOrdinal < nodesCount - 1 - ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount] - : containmentEdgesLength; + endEdgeToNodeFieldIndex = nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]; for (var toNodeFieldIndex = beginEdgeToNodeFieldIndex; toNodeFieldIndex < endEdgeToNodeFieldIndex; toNodeFieldIndex += edgeFieldsCount) { @@ -1487,9 +1455,7 @@ WebInspector.HeapSnapshot.prototype = { continue; flags[nodeOrdinal] |= flag; var beginEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset]; - var endEdgeIndex = nodeOrdinal < nodeCount - 1 - ? nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount] - : containmentEdges.length; + var endEdgeIndex = nodes[nodeIndex + firstEdgeIndexOffset + nodeFieldCount]; for (var edgeIndex = beginEdgeIndex; edgeIndex < endEdgeIndex; edgeIndex += edgeFieldsCount) { var childNodeIndex = containmentEdges[edgeIndex + edgeToNodeOffset]; if (flags[childNodeIndex / nodeFieldCount] & flag) diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js index 88e502457..e50f1d218 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js @@ -558,14 +558,15 @@ WebInspector.HeapSnapshotConstructorsDataGrid.prototype = { } }, + _aggregatesReceived: function(key, aggregates) + { + for (var constructor in aggregates) + this.appendTopLevelNode(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], key)); + this.sortingChanged(); + }, + _populateChildren: function() { - function aggregatesReceived(key, aggregates) - { - for (var constructor in aggregates) - this.appendTopLevelNode(new WebInspector.HeapSnapshotConstructorNode(this, constructor, aggregates[constructor], key)); - this.sortingChanged(); - } this.dispose(); this.removeTopLevelNodes(); @@ -574,7 +575,7 @@ WebInspector.HeapSnapshotConstructorsDataGrid.prototype = { var key = this._profileIndex === -1 ? "allObjects" : this._minNodeId + ".." + this._maxNodeId; var filter = this._profileIndex === -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)); + this.snapshot.aggregates(false, key, filter, this._aggregatesReceived.bind(this, key)); }, _filterSelectIndexChanged: function(profiles, profileIndex) diff --git a/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js b/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js index c3ba4677c..aeb5527cc 100644 --- a/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js +++ b/Source/WebCore/inspector/front-end/HeapSnapshotLoader.js @@ -101,7 +101,7 @@ WebInspector.HeapSnapshotLoader.prototype = { this._json = this._json.slice(startIndex); return true; } - this._array.push(nextNumber); + this._array[this._arrayIndex++] = nextNumber; } }, @@ -149,7 +149,8 @@ WebInspector.HeapSnapshotLoader.prototype = { this._json = this._json.slice(bracketIndex + 1); var node_fields_count = this._snapshot.snapshot.meta.node_fields.length; var nodes_length = this._snapshot.snapshot.node_count * node_fields_count; - this._array = new WebInspector.Uint32Array(nodes_length); + this._array = new Uint32Array(nodes_length); + this._arrayIndex = 0; this._state = "parse-nodes"; this.pushJSONChunk(""); break; @@ -157,7 +158,7 @@ WebInspector.HeapSnapshotLoader.prototype = { case "parse-nodes": { if (this._parseUintArray()) return; - this._snapshot.nodes = this._array.array; + this._snapshot.nodes = this._array; this._state = "find-edges"; this._array = null; this.pushJSONChunk(""); @@ -174,7 +175,8 @@ WebInspector.HeapSnapshotLoader.prototype = { this._json = this._json.slice(bracketIndex + 1); var edge_fields_count = this._snapshot.snapshot.meta.edge_fields.length; var edges_length = this._snapshot.snapshot.edge_count * edge_fields_count; - this._array = new WebInspector.Uint32Array(edges_length); + this._array = new Uint32Array(edges_length); + this._arrayIndex = 0; this._state = "parse-edges"; this.pushJSONChunk(""); break; @@ -182,7 +184,7 @@ WebInspector.HeapSnapshotLoader.prototype = { case "parse-edges": { if (this._parseUintArray()) return; - this._snapshot.edges = this._array.array; + this._snapshot.edges = this._array; this._array = null; this._state = "find-strings"; this.pushJSONChunk(""); diff --git a/Source/WebCore/inspector/front-end/Images/timelineBarLightPurple.png b/Source/WebCore/inspector/front-end/Images/timelineBarLightPurple.png Binary files differnew file mode 100644 index 000000000..9db687d60 --- /dev/null +++ b/Source/WebCore/inspector/front-end/Images/timelineBarLightPurple.png diff --git a/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png b/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png Binary files differindex 1b3244984..15b95e3ce 100644 --- a/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png +++ b/Source/WebCore/inspector/front-end/Images/timelineCheckmarks.png diff --git a/Source/WebCore/inspector/front-end/Images/timelineDots.png b/Source/WebCore/inspector/front-end/Images/timelineDots.png Binary files differindex 325f2abd9..35835a4d5 100644 --- a/Source/WebCore/inspector/front-end/Images/timelineDots.png +++ b/Source/WebCore/inspector/front-end/Images/timelineDots.png diff --git a/Source/WebCore/inspector/front-end/InspectorView.js b/Source/WebCore/inspector/front-end/InspectorView.js index 52f301e12..74d5a84ac 100644 --- a/Source/WebCore/inspector/front-end/InspectorView.js +++ b/Source/WebCore/inspector/front-end/InspectorView.js @@ -41,7 +41,16 @@ WebInspector.InspectorView = function() this._history = []; this._historyIterator = -1; document.addEventListener("keydown", this._keyDown.bind(this), false); + document.addEventListener("keypress", this._keyPress.bind(this), false); this._panelOrder = []; + + // Windows and Mac have two different definitions of '[', so accept both. + this._openBracketIdentifiers = ["U+005B", "U+00DB"].keySet(); + this._openBracketCharCode = "[".charCodeAt(0); + + // Windows and Mac have two different definitions of ']', so accept both. + this._closeBracketIdentifiers = ["U+005D", "U+00DD"].keySet(); + this._closeBracketCharCode = "]".charCodeAt(0); } WebInspector.InspectorView.Events = { @@ -85,46 +94,66 @@ WebInspector.InspectorView.prototype = { } }, + _keyPress: function(event) + { + if (!this._keyDownTimer) + return; + + if (event.charCode === this._openBracketCharCode || event.charCode === this._closeBracketCharCode) { + clearTimeout(this._keyDownTimer); + delete this._keyDownTimer; + } + }, + _keyDown: function(event) { - switch (event.keyIdentifier) { - // Windows and Mac have two different definitions of [, so accept both. - case "U+005B": - case "U+00DB": // [ key - var isRotateLeft = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; - if (isRotateLeft) { - var index = this._panelOrder.indexOf(this.currentPanel()); - index = (index === 0) ? this._panelOrder.length - 1 : index - 1; - this._panelOrder[index].toolbarItem.click(); - event.consume(); - return; - } - - var isGoBack = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; - if (isGoBack && this._canGoBackInHistory()) { - this._goBackInHistory(); - event.consume(); - } - break; - - // Windows and Mac have two different definitions of ], so accept both. - case "U+005D": - case "U+00DD": // ] key - var isRotateRight = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; - if (isRotateRight) { - var index = this._panelOrder.indexOf(this.currentPanel()); - index = (index + 1) % this._panelOrder.length; - this._panelOrder[index].toolbarItem.click(); - event.consume(); - return; - } - - var isGoForward = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; - if (isGoForward && this._canGoForwardInHistory()) { - this._goForwardInHistory(); - event.consume(); - } - break; + // BUG85312: On French AZERTY keyboards, AltGr-]/[ combinations (synonymous to Ctrl-Alt-]/[ on Windows) are used to enter ]/[, + // so for a ]/[-related keydown we delay the panel switch using a timer, to see if there is a keypress event following this one. + // If there is, we cancel the timer and do not consider this a panel switch. + if (!WebInspector.isWin() || (!this._openBracketIdentifiers.hasOwnProperty(event.keyIdentifier) && !this._closeBracketIdentifiers.hasOwnProperty(event.keyIdentifier))) { + this._keyDownInternal(event); + return; + } + + this._keyDownTimer = setTimeout(this._keyDownInternal.bind(this, event), 0); + }, + + _keyDownInternal: function(event) + { + if (this._openBracketIdentifiers.hasOwnProperty(event.keyIdentifier)) { + var isRotateLeft = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; + if (isRotateLeft) { + var index = this._panelOrder.indexOf(this.currentPanel()); + index = (index === 0) ? this._panelOrder.length - 1 : index - 1; + this._panelOrder[index].toolbarItem.click(); + event.consume(true); + return; + } + + var isGoBack = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; + if (isGoBack && this._canGoBackInHistory()) { + this._goBackInHistory(); + event.consume(true); + } + return; + } + + if (this._closeBracketIdentifiers.hasOwnProperty(event.keyIdentifier)) { + var isRotateRight = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !event.shiftKey && !event.altKey; + if (isRotateRight) { + var index = this._panelOrder.indexOf(this.currentPanel()); + index = (index + 1) % this._panelOrder.length; + this._panelOrder[index].toolbarItem.click(); + event.consume(true); + return; + } + + var isGoForward = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && event.altKey; + if (isGoForward && this._canGoForwardInHistory()) { + this._goForwardInHistory(); + event.consume(true); + } + return; } }, diff --git a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js index 0fd7097f1..2f709fe23 100644 --- a/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js +++ b/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js @@ -85,8 +85,6 @@ WebInspector.NativeMemoryProfileType.prototype = { var profilesPanel = WebInspector.panels.profiles; var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._profileIndex++), -1); profilesPanel.addProfileHeader(profileHeader); - profilesPanel.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileStarted); - profilesPanel.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileFinished); return false; }, @@ -150,7 +148,7 @@ WebInspector.NativeMemoryProfileHeader.prototype = { */ createView: function() { - return new WebInspector.NativeMemorySnapshotView(); + return new WebInspector.NativeMemorySnapshotView(this); } } diff --git a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js index 748c04c3b..82de51d3e 100644 --- a/Source/WebCore/inspector/front-end/TimelineOverviewPane.js +++ b/Source/WebCore/inspector/front-end/TimelineOverviewPane.js @@ -843,7 +843,7 @@ WebInspector.TimelineCategoryStrips.prototype = { var timeSpan = this._model.maximumRecordTime() - timeOffset; var scale = this.element.width / timeSpan; - var barsByCategory = {}; + var lastBarByGroup = []; this._context.fillStyle = "rgba(0, 0, 0, 0.05)"; for (var i = 1; i < WebInspector.TimelineCategoryStrips._numberOfStrips; i += 2) @@ -854,23 +854,27 @@ WebInspector.TimelineCategoryStrips.prototype = { var isLong = WebInspector.TimelineModel.durationInSeconds(record) > WebInspector.TimelinePresentationModel.shortRecordThreshold; if (!(this._showShortEvents || isLong)) return; - var recordStart = Math.floor((WebInspector.TimelineModel.startTimeInSeconds(record) - timeOffset)* scale); + if (record.type === WebInspector.TimelineModel.RecordType.BeginFrame) + return; + var recordStart = Math.floor((WebInspector.TimelineModel.startTimeInSeconds(record) - timeOffset) * scale); var recordEnd = Math.ceil((WebInspector.TimelineModel.endTimeInSeconds(record) - timeOffset) * scale); var category = WebInspector.TimelinePresentationModel.categoryForRecord(record); - var bar = barsByCategory[category.name]; + var bar = lastBarByGroup[category.overviewStripGroupIndex]; // This bar may be merged with previous -- so just adjust the previous bar. const barsMergeThreshold = 2; - if (bar && bar.end + barsMergeThreshold >= recordStart) { + if (bar && bar.category === category && bar.end + barsMergeThreshold >= recordStart) { bar.end = recordEnd; return; } if (bar) - this._renderBar(bar.start, bar.end, category); - barsByCategory[category.name] = { start: recordStart, end: recordEnd }; + this._renderBar(bar.start, bar.end, bar.category); + lastBarByGroup[category.overviewStripGroupIndex] = { start: recordStart, end: recordEnd, category: category }; } WebInspector.TimelinePresentationModel.forAllRecords(this._model.records, appendRecord.bind(this)); - for (var category in barsByCategory) - this._renderBar(barsByCategory[category].start, barsByCategory[category].end, WebInspector.TimelinePresentationModel.categories()[category]); + for (var i = 0; i < lastBarByGroup.length; ++i) { + if (lastBarByGroup[i]) + this._renderBar(lastBarByGroup[i].start, lastBarByGroup[i].end, lastBarByGroup[i].category); + } }, /** diff --git a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js index 91622d46d..4470313dd 100644 --- a/Source/WebCore/inspector/front-end/TimelinePresentationModel.js +++ b/Source/WebCore/inspector/front-end/TimelinePresentationModel.js @@ -49,7 +49,8 @@ WebInspector.TimelinePresentationModel.categories = function() WebInspector.TimelinePresentationModel._categories = { loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), 0, "rgb(80, 135, 207)", "rgb(191, 214, 243)", "rgb(112, 162, 227)"), scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), 1, "rgb(220, 163, 49)", "rgb(253, 217, 144)", "rgb(253, 191, 68)"), - rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), 2, "rgb(148, 88, 199)", "rgb(219, 195, 239)", "rgb(175, 120, 221)") + rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), 2, "rgb(148, 88, 199)", "rgb(219, 195, 239)", "rgb(175, 120, 221)"), + painting: new WebInspector.TimelineCategory("painting", WebInspector.UIString("Painting"), 2, "rgb(165, 113, 208)", "rgb(224, 204, 241)", "rgb(187, 140, 227)") }; return WebInspector.TimelinePresentationModel._categories; }; @@ -71,8 +72,8 @@ WebInspector.TimelinePresentationModel.recordStyle = function(record) recordStyles[recordTypes.BeginFrame] = { title: WebInspector.UIString("Frame Start"), category: categories["rendering"] }; recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] }; recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] }; - recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["rendering"] }; - recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["rendering"] }; + recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] }; + recordStyles[recordTypes.CompositeLayers] = { title: WebInspector.UIString("Composite Layers"), category: categories["painting"] }; recordStyles[recordTypes.ParseHTML] = { title: WebInspector.UIString("Parse"), category: categories["loading"] }; recordStyles[recordTypes.TimerInstall] = { title: WebInspector.UIString("Install Timer"), category: categories["scripting"] }; recordStyles[recordTypes.TimerRemove] = { title: WebInspector.UIString("Remove Timer"), category: categories["scripting"] }; diff --git a/Source/WebCore/inspector/front-end/UIUtils.js b/Source/WebCore/inspector/front-end/UIUtils.js index c8d43e212..5c15ac451 100644 --- a/Source/WebCore/inspector/front-end/UIUtils.js +++ b/Source/WebCore/inspector/front-end/UIUtils.js @@ -512,6 +512,14 @@ WebInspector.isMac = function() return WebInspector._isMac; } +WebInspector.isWin = function() +{ + if (typeof WebInspector._isWin === "undefined") + WebInspector._isWin = WebInspector.platform() === "windows"; + + return WebInspector._isWin; +} + WebInspector.PlatformFlavor = { WindowsVista: "windows-vista", MacTiger: "mac-tiger", diff --git a/Source/WebCore/inspector/front-end/WebKit.qrc b/Source/WebCore/inspector/front-end/WebKit.qrc index 8982b95c7..b66e19f6a 100644 --- a/Source/WebCore/inspector/front-end/WebKit.qrc +++ b/Source/WebCore/inspector/front-end/WebKit.qrc @@ -319,6 +319,7 @@ <file>Images/timelineBarBlue.png</file> <file>Images/timelineBarGray.png</file> <file>Images/timelineBarGreen.png</file> + <file>Images/timelineBarLightPurple.png</file> <file>Images/timelineBarOrange.png</file> <file>Images/timelineBarPurple.png</file> <file>Images/timelineBarRed.png</file> diff --git a/Source/WebCore/inspector/front-end/timelinePanel.css b/Source/WebCore/inspector/front-end/timelinePanel.css index 2f8b3963e..9678c19ce 100644 --- a/Source/WebCore/inspector/front-end/timelinePanel.css +++ b/Source/WebCore/inspector/front-end/timelinePanel.css @@ -200,6 +200,10 @@ background-position-y: -11px; } +.timeline-category-statusbar-item.timeline-category-painting .timeline-category-checkbox { + background-position-y: -77px; +} + .timeline-tree-item { height: 18px; line-height: 15px; @@ -287,7 +291,6 @@ top: 5px; } - #timeline-graphs { position: absolute; left: 0; @@ -354,6 +357,10 @@ -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; } +.timeline-category-painting .timeline-graph-bar { + -webkit-border-image: url(Images/timelineBarLightPurple.png) 4 4 5 4; +} + .timeline-aggregated-category { display: inline-block; height: 11px; @@ -376,6 +383,10 @@ -webkit-border-image: url(Images/timelineBarPurple.png) 4 4 5 4; } +.popover .timeline-painting { + -webkit-border-image: url(Images/timelineBarLightPurple.png) 4 4 5 4; +} + .popover .timeline-aggregated-category.timeline-loading { margin-left: 0px; } @@ -385,11 +396,15 @@ } .timeline-category-scripting .timeline-tree-icon { - background-position-y: 48px; + background-position-y: -36px; } .timeline-category-rendering .timeline-tree-icon { - background-position-y: 72px; + background-position-y: -12px; +} + +.timeline-category-painting .timeline-tree-icon { + background-position-y: -84px; } .timeline-details { diff --git a/Source/WebCore/loader/SubresourceLoader.cpp b/Source/WebCore/loader/SubresourceLoader.cpp index 76583e8d9..a414162d5 100644 --- a/Source/WebCore/loader/SubresourceLoader.cpp +++ b/Source/WebCore/loader/SubresourceLoader.cpp @@ -232,8 +232,8 @@ bool SubresourceLoader::errorLoadingResource() if (m_resource->response().httpStatusCode() < 400 || m_resource->shouldIgnoreHTTPStatusCodeErrors()) return false; - m_resource->error(CachedResource::LoadError); m_state = Finishing; + m_resource->error(CachedResource::LoadError); cancel(); return true; } diff --git a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp index 2dbe75e54..e991397f6 100644 --- a/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp +++ b/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp @@ -66,6 +66,7 @@ void CachedCSSStyleSheet::allClientsRemoved() { if (!MemoryCache::shouldMakeResourcePurgeableOnEviction() && isSafeToMakePurgeable()) makePurgeable(true); + CachedResource::allClientsRemoved(); } void CachedCSSStyleSheet::setEncoding(const String& chs) diff --git a/Source/WebCore/loader/cache/CachedFont.cpp b/Source/WebCore/loader/cache/CachedFont.cpp index fddd79d47..9e2cdcab2 100644 --- a/Source/WebCore/loader/cache/CachedFont.cpp +++ b/Source/WebCore/loader/cache/CachedFont.cpp @@ -185,6 +185,7 @@ void CachedFont::allClientsRemoved() m_fontData = 0; } #endif + CachedResource::allClientsRemoved(); } void CachedFont::checkNotify() diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp index b4f0b2739..519ec6d73 100644 --- a/Source/WebCore/loader/cache/CachedImage.cpp +++ b/Source/WebCore/loader/cache/CachedImage.cpp @@ -124,6 +124,7 @@ void CachedImage::allClientsRemoved() m_image->resetAnimation(); if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) m_decodedDataDeletionTimer.startOneShot(interval); + CachedResource::allClientsRemoved(); } pair<Image*, float> CachedImage::brokenImage(float deviceScaleFactor) const diff --git a/Source/WebCore/loader/cache/CachedRawResource.cpp b/Source/WebCore/loader/cache/CachedRawResource.cpp index b0a703304..3ec544a22 100644 --- a/Source/WebCore/loader/cache/CachedRawResource.cpp +++ b/Source/WebCore/loader/cache/CachedRawResource.cpp @@ -87,12 +87,6 @@ void CachedRawResource::didAddClient(CachedResourceClient* c) CachedResource::didAddClient(client); } -void CachedRawResource::allClientsRemoved() -{ - if (m_loader) - m_loader->cancelIfNotFinishing(); -} - void CachedRawResource::willSendRequest(ResourceRequest& request, const ResourceResponse& response) { if (!response.isNull()) { diff --git a/Source/WebCore/loader/cache/CachedRawResource.h b/Source/WebCore/loader/cache/CachedRawResource.h index ed0ff955f..17ec4b0af 100644 --- a/Source/WebCore/loader/cache/CachedRawResource.h +++ b/Source/WebCore/loader/cache/CachedRawResource.h @@ -49,7 +49,6 @@ private: virtual void data(PassRefPtr<SharedBuffer> data, bool allDataReceived); virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return true; } - virtual void allClientsRemoved(); virtual void willSendRequest(ResourceRequest&, const ResourceResponse&); virtual void setResponse(const ResourceResponse&); diff --git a/Source/WebCore/loader/cache/CachedResource.cpp b/Source/WebCore/loader/cache/CachedResource.cpp index c95abedb4..71c0b7f5c 100755 --- a/Source/WebCore/loader/cache/CachedResource.cpp +++ b/Source/WebCore/loader/cache/CachedResource.cpp @@ -387,6 +387,12 @@ void CachedResource::didAddClient(CachedResourceClient* c) c->notifyFinished(this); } +void CachedResource::allClientsRemoved() +{ + if (m_loader) + m_loader->cancelIfNotFinishing(); +} + bool CachedResource::addClientToSet(CachedResourceClient* client) { ASSERT(!isPurgeable()); diff --git a/Source/WebCore/loader/cache/CachedResource.h b/Source/WebCore/loader/cache/CachedResource.h index b4f55c084..3b9e2083d 100644 --- a/Source/WebCore/loader/cache/CachedResource.h +++ b/Source/WebCore/loader/cache/CachedResource.h @@ -126,7 +126,7 @@ public: PreloadResult preloadResult() const { return static_cast<PreloadResult>(m_preloadResult); } virtual void didAddClient(CachedResourceClient*); - virtual void allClientsRemoved() { } + virtual void allClientsRemoved(); unsigned count() const { return m_clients.size(); } diff --git a/Source/WebCore/loader/cache/CachedScript.cpp b/Source/WebCore/loader/cache/CachedScript.cpp index 8c83bca88..decaa90bb 100644 --- a/Source/WebCore/loader/cache/CachedScript.cpp +++ b/Source/WebCore/loader/cache/CachedScript.cpp @@ -67,6 +67,7 @@ void CachedScript::allClientsRemoved() { if (double interval = memoryCache()->deadDecodedDataDeletionInterval()) m_decodedDataDeletionTimer.startOneShot(interval); + CachedResource::allClientsRemoved(); } void CachedScript::setEncoding(const String& chs) diff --git a/Source/WebCore/make-hash-tools.pl b/Source/WebCore/make-hash-tools.pl index 689af0d86..ea3a0f507 100644 --- a/Source/WebCore/make-hash-tools.pl +++ b/Source/WebCore/make-hash-tools.pl @@ -3,6 +3,7 @@ # This file is part of the WebKit project # # Copyright (C) 2010 Andras Becsi (abecsi@inf.u-szeged.hu), University of Szeged +# Copyright (C) 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 @@ -26,14 +27,13 @@ my $outdir = $ARGV[0]; shift; my $option = basename($ARGV[0],".gperf"); - if ($option eq "ColorData") { - my $colorDataGenerated = "$outdir/ColorData.cpp"; my $colorDataGperf = $ARGV[0]; shift; - system("gperf --key-positions=\"*\" -D -s 2 $colorDataGperf --output-file=$colorDataGenerated") == 0 || die "calling gperf failed: $?"; + my $gperf = $ENV{GPERF} ? $ENV{GPERF} : "gperf"; + system("\"$gperf\" --key-positions=\"*\" -D -s 2 $colorDataGperf --output-file=$colorDataGenerated") == 0 || die "calling gperf failed: $?"; } else { die "Unknown option."; diff --git a/Source/WebCore/page/ContentSecurityPolicy.cpp b/Source/WebCore/page/ContentSecurityPolicy.cpp index 45f76b019..2d75ad5fa 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.cpp +++ b/Source/WebCore/page/ContentSecurityPolicy.cpp @@ -31,11 +31,13 @@ #include "FormData.h" #include "FormDataList.h" #include "Frame.h" +#include "InspectorInstrumentation.h" #include "InspectorValues.h" #include "PingLoader.h" #include "ScriptCallStack.h" #include "SecurityOrigin.h" #include "TextEncoding.h" +#include <wtf/text/TextPosition.h> #include <wtf/text/WTFString.h> namespace WebCore { @@ -490,10 +492,10 @@ public: const String& header() const { return m_header; } ContentSecurityPolicy::HeaderType headerType() const { return m_reportOnly ? ContentSecurityPolicy::ReportOnly : ContentSecurityPolicy::EnforcePolicy; } - bool allowJavaScriptURLs() const; - bool allowInlineEventHandlers() const; - bool allowInlineScript() const; - bool allowInlineStyle() const; + bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; bool allowEval(PassRefPtr<ScriptCallStack>) const; bool allowScriptFromSource(const KURL&) const; @@ -518,12 +520,12 @@ private: PassOwnPtr<CSPDirective> createCSPDirective(const String& name, const String& value); CSPDirective* operativeDirective(CSPDirective*) const; - void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL = KURL(), PassRefPtr<ScriptCallStack> = 0) const; + void reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL = KURL(), const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; void logUnrecognizedDirective(const String& name) const; bool checkEval(CSPDirective*) const; - bool checkInlineAndReportViolation(CSPDirective*, const String& consoleMessage) const; - bool checkEvalAndReportViolation(CSPDirective*, const String& consoleMessage, PassRefPtr<ScriptCallStack>) const; + bool checkInlineAndReportViolation(CSPDirective*, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool checkEvalAndReportViolation(CSPDirective*, const String& consoleMessage, const String& contextURL = String(), const WTF::OrdinalNumber& contextLine = WTF::OrdinalNumber::beforeFirst(), PassRefPtr<ScriptCallStack> = 0) const; bool checkSourceAndReportViolation(CSPDirective*, const KURL&, const String& type) const; bool denyIfEnforcingPolicy() const { return m_reportOnly; } @@ -575,10 +577,10 @@ PassOwnPtr<CSPDirectiveList> CSPDirectiveList::create(ScriptExecutionContext* sc return policy.release(); } -void CSPDirectiveList::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, PassRefPtr<ScriptCallStack> callStack) const +void CSPDirectiveList::reportViolation(const String& directiveText, const String& consoleMessage, const KURL& blockedURL, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { String message = m_reportOnly ? "[Report Only] " + consoleMessage : consoleMessage; - m_scriptExecutionContext->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, String(), 0, callStack); + m_scriptExecutionContext->addConsoleMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, message, contextURL, contextLine.oneBasedInt(), callStack); if (m_reportURIs.isEmpty()) return; @@ -638,19 +640,19 @@ CSPDirective* CSPDirectiveList::operativeDirective(CSPDirective* directive) cons return directive ? directive : m_defaultSrc.get(); } -bool CSPDirectiveList::checkInlineAndReportViolation(CSPDirective* directive, const String& consoleMessage) const +bool CSPDirectiveList::checkInlineAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine) const { if (!directive || directive->allowInline()) return true; - reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n"); + reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine); return denyIfEnforcingPolicy(); } -bool CSPDirectiveList::checkEvalAndReportViolation(CSPDirective* directive, const String& consoleMessage, PassRefPtr<ScriptCallStack> callStack) const +bool CSPDirectiveList::checkEvalAndReportViolation(CSPDirective* directive, const String& consoleMessage, const String& contextURL, const WTF::OrdinalNumber& contextLine, PassRefPtr<ScriptCallStack> callStack) const { if (checkEval(directive)) return true; - reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), callStack); + reportViolation(directive->text(), consoleMessage + "\"" + directive->text() + "\".\n", KURL(), contextURL, contextLine, callStack); return denyIfEnforcingPolicy(); } @@ -663,34 +665,34 @@ bool CSPDirectiveList::checkSourceAndReportViolation(CSPDirective* directive, co return denyIfEnforcingPolicy(); } -bool CSPDirectiveList::allowJavaScriptURLs() const +bool CSPDirectiveList::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute JavaScript URL because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage); + return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine); } -bool CSPDirectiveList::allowInlineEventHandlers() const +bool CSPDirectiveList::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline event handler because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage); + return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine); } -bool CSPDirectiveList::allowInlineScript() const +bool CSPDirectiveList::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to execute inline script because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage); + return checkInlineAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, contextURL, contextLine); } -bool CSPDirectiveList::allowInlineStyle() const +bool CSPDirectiveList::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to apply inline style because it violates the following Content Security Policy directive: ")); - return checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage); + return checkInlineAndReportViolation(operativeDirective(m_styleSrc.get()), consoleMessage, contextURL, contextLine); } bool CSPDirectiveList::allowEval(PassRefPtr<ScriptCallStack> callStack) const { DEFINE_STATIC_LOCAL(String, consoleMessage, ("Refused to evaluate script because it violates the following Content Security Policy directive: ")); - return checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, callStack); + return checkEvalAndReportViolation(operativeDirective(m_scriptSrc.get()), consoleMessage, String(), WTF::OrdinalNumber::beforeFirst(), callStack); } bool CSPDirectiveList::allowScriptFromSource(const KURL& url) const @@ -923,21 +925,21 @@ ContentSecurityPolicy::HeaderType ContentSecurityPolicy::deprecatedHeaderType() return m_policies.isEmpty() ? EnforcePolicy : m_policies[0]->headerType(); } -template<bool (CSPDirectiveList::*allowed)() const> -bool isAllowedByAll(const CSPDirectiveListVector& policies) +template<bool (CSPDirectiveList::*allowed)(PassRefPtr<ScriptCallStack>) const> +bool isAllowedByAllWithCallStack(const CSPDirectiveListVector& policies, PassRefPtr<ScriptCallStack> callStack) { for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)()) + if (!(policies[i].get()->*allowed)(callStack)) return false; } return true; } -template<bool (CSPDirectiveList::*allowed)(PassRefPtr<ScriptCallStack>) const> -bool isAllowedByAllWithCallStack(const CSPDirectiveListVector& policies, PassRefPtr<ScriptCallStack> callStack) +template<bool (CSPDirectiveList::*allowed)(const String&, const WTF::OrdinalNumber&) const> +bool isAllowedByAllWithContext(const CSPDirectiveListVector& policies, const String& contextURL, const WTF::OrdinalNumber& contextLine) { for (size_t i = 0; i < policies.size(); ++i) { - if (!(policies[i].get()->*allowed)(callStack)) + if (!(policies[i].get()->*allowed)(contextURL, contextLine)) return false; } return true; @@ -953,26 +955,26 @@ bool isAllowedByAllWithURL(const CSPDirectiveListVector& policies, const KURL& u return true; } -bool ContentSecurityPolicy::allowJavaScriptURLs() const +bool ContentSecurityPolicy::allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { - return isAllowedByAll<&CSPDirectiveList::allowJavaScriptURLs>(m_policies); + return isAllowedByAllWithContext<&CSPDirectiveList::allowJavaScriptURLs>(m_policies, contextURL, contextLine); } -bool ContentSecurityPolicy::allowInlineEventHandlers() const +bool ContentSecurityPolicy::allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { - return isAllowedByAll<&CSPDirectiveList::allowInlineEventHandlers>(m_policies); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineEventHandlers>(m_policies, contextURL, contextLine); } -bool ContentSecurityPolicy::allowInlineScript() const +bool ContentSecurityPolicy::allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { - return isAllowedByAll<&CSPDirectiveList::allowInlineScript>(m_policies); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineScript>(m_policies, contextURL, contextLine); } -bool ContentSecurityPolicy::allowInlineStyle() const +bool ContentSecurityPolicy::allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const { if (m_overrideInlineStyleAllowed) return true; - return isAllowedByAll<&CSPDirectiveList::allowInlineStyle>(m_policies); + return isAllowedByAllWithContext<&CSPDirectiveList::allowInlineStyle>(m_policies, contextURL, contextLine); } bool ContentSecurityPolicy::allowEval(PassRefPtr<ScriptCallStack> callStack) const diff --git a/Source/WebCore/page/ContentSecurityPolicy.h b/Source/WebCore/page/ContentSecurityPolicy.h index 19c465e3b..7ac60d9d7 100644 --- a/Source/WebCore/page/ContentSecurityPolicy.h +++ b/Source/WebCore/page/ContentSecurityPolicy.h @@ -31,6 +31,10 @@ #include <wtf/Vector.h> #include <wtf/text/WTFString.h> +namespace WTF { +class OrdinalNumber; +} + namespace WebCore { class CSPDirectiveList; @@ -62,10 +66,10 @@ public: const String& deprecatedHeader() const; HeaderType deprecatedHeaderType() const; - bool allowJavaScriptURLs() const; - bool allowInlineEventHandlers() const; - bool allowInlineScript() const; - bool allowInlineStyle() const; + bool allowJavaScriptURLs(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineEventHandlers(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineScript(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; + bool allowInlineStyle(const String& contextURL, const WTF::OrdinalNumber& contextLine) const; bool allowEval(PassRefPtr<ScriptCallStack>) const; bool allowScriptFromSource(const KURL&) const; diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 3b1080267..6c1be3adb 100644 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -357,6 +357,7 @@ void EventHandler::clear() m_shouldOnlyFireDragOverEvent = false; #endif m_currentMousePosition = IntPoint(); + m_currentMouseGlobalPosition = IntPoint(); m_mousePressNode = 0; m_mousePressed = false; m_capturesDragging = false; @@ -1498,6 +1499,7 @@ bool EventHandler::handleMousePressEvent(const PlatformMouseEvent& mouseEvent) m_mousePressed = true; m_capturesDragging = true; m_currentMousePosition = mouseEvent.position(); + m_currentMouseGlobalPosition = mouseEvent.globalPosition(); m_mouseDownTimestamp = mouseEvent.timestamp(); #if ENABLE(DRAG_SUPPORT) m_mouseDownMayStartDrag = false; @@ -1631,6 +1633,7 @@ bool EventHandler::handleMouseDoubleClickEvent(const PlatformMouseEvent& mouseEv // We get this instead of a second mouse-up m_mousePressed = false; m_currentMousePosition = mouseEvent.position(); + m_currentMouseGlobalPosition = mouseEvent.globalPosition(); HitTestRequest request(HitTestRequest::Active); MouseEventWithHitTestResults mev = prepareMouseEvent(request, mouseEvent); @@ -1725,6 +1728,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi RefPtr<FrameView> protector(m_frame->view()); m_currentMousePosition = mouseEvent.position(); + m_currentMouseGlobalPosition = mouseEvent.globalPosition(); if (m_hoverTimer.isActive()) m_hoverTimer.stop(); @@ -1848,6 +1852,7 @@ bool EventHandler::handleMouseReleaseEvent(const PlatformMouseEvent& mouseEvent) m_mousePressed = false; m_currentMousePosition = mouseEvent.position(); + m_currentMouseGlobalPosition = mouseEvent.globalPosition(); #if ENABLE(SVG) if (m_svgPan) { @@ -2668,8 +2673,7 @@ void EventHandler::fakeMouseMoveEventTimerFired(Timer<EventHandler>* timer) bool altKey; bool metaKey; PlatformKeyboardEvent::getCurrentModifierState(shiftKey, ctrlKey, altKey, metaKey); - IntPoint globalPoint = view->contentsToScreen(IntRect(view->windowToContents(m_currentMousePosition), IntSize())).location(); - PlatformMouseEvent fakeMouseMoveEvent(m_currentMousePosition, globalPoint, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime()); + PlatformMouseEvent fakeMouseMoveEvent(m_currentMousePosition, m_currentMouseGlobalPosition, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, currentTime()); mouseMoved(fakeMouseMoveEvent); } diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index b8cfa1b81..c72dc0943 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -425,6 +425,7 @@ private: LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer. IntPoint m_currentMousePosition; + IntPoint m_currentMouseGlobalPosition; IntPoint m_mouseDownPos; // In our view's coords. double m_mouseDownTimestamp; PlatformMouseEvent m_mouseDown; diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp index 7de3719d5..87cb0b87c 100644 --- a/Source/WebCore/page/Settings.cpp +++ b/Source/WebCore/page/Settings.cpp @@ -272,6 +272,7 @@ Settings::Settings(Page* page) , m_requestAnimationFrameEnabled(true) , m_needsDidFinishLoadOrderQuirk(false) , m_fixedPositionCreatesStackingContext(false) + , m_syncXHRInDocumentsEnabled(true) , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired) , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds) { diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h index 21feceacf..eca6bf3a7 100644 --- a/Source/WebCore/page/Settings.h +++ b/Source/WebCore/page/Settings.h @@ -581,6 +581,9 @@ namespace WebCore { void setFixedPositionCreatesStackingContext(bool creates) { m_fixedPositionCreatesStackingContext = creates; } bool fixedPositionCreatesStackingContext() const { return m_fixedPositionCreatesStackingContext; } + void setSyncXHRInDocumentsEnabled(bool enabled) { m_syncXHRInDocumentsEnabled = enabled; } + bool syncXHRInDocumentsEnabled() const { return m_syncXHRInDocumentsEnabled; } + #if USE(JSC) static void setShouldRespectPriorityInCSSAttributeSetters(bool); static bool shouldRespectPriorityInCSSAttributeSetters(); @@ -753,6 +756,7 @@ namespace WebCore { bool m_needsDidFinishLoadOrderQuirk : 1; bool m_fixedPositionCreatesStackingContext : 1; + bool m_syncXHRInDocumentsEnabled : 1; Timer<Settings> m_loadsImagesAutomaticallyTimer; void loadsImagesAutomaticallyTimerFired(Timer<Settings>*); diff --git a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp b/Source/WebCore/page/animation/CSSPropertyAnimation.cpp index 3a22be1c1..9cd1a26aa 100644 --- a/Source/WebCore/page/animation/CSSPropertyAnimation.cpp +++ b/Source/WebCore/page/animation/CSSPropertyAnimation.cpp @@ -901,6 +901,7 @@ private: Vector<AnimationPropertyWrapperBase*> m_propertyWrappers; }; +#if ENABLE(CSS3_FLEXBOX) class PropertyWrapperFlex : public AnimationPropertyWrapperBase { public: PropertyWrapperFlex() : AnimationPropertyWrapperBase(CSSPropertyWebkitFlex) @@ -926,6 +927,7 @@ public: dst->setNegativeFlex(blendFunc(anim, a->negativeFlex(), b->negativeFlex(), progress)); } }; +#endif #if ENABLE(SVG) class PropertyWrapperSVGPaint : public AnimationPropertyWrapperBase { @@ -1044,7 +1046,9 @@ void CSSPropertyAnimation::ensurePropertyMap() gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMinHeight, &RenderStyle::minHeight, &RenderStyle::setMinHeight)); gPropertyWrappers->append(new PropertyWrapper<Length>(CSSPropertyMaxHeight, &RenderStyle::maxHeight, &RenderStyle::setMaxHeight)); +#if ENABLE(CSS3_FLEXBOX) gPropertyWrappers->append(new PropertyWrapperFlex()); +#endif gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderLeftWidth, &RenderStyle::borderLeftWidth, &RenderStyle::setBorderLeftWidth)); gPropertyWrappers->append(new PropertyWrapper<unsigned>(CSSPropertyBorderRightWidth, &RenderStyle::borderRightWidth, &RenderStyle::setBorderRightWidth)); diff --git a/Source/WebCore/platform/chromium/FileSystemChromium.cpp b/Source/WebCore/platform/chromium/FileSystemChromium.cpp index 3c5a534b7..d7ac34c81 100644 --- a/Source/WebCore/platform/chromium/FileSystemChromium.cpp +++ b/Source/WebCore/platform/chromium/FileSystemChromium.cpp @@ -50,25 +50,25 @@ bool deleteEmptyDirectory(const String& path) bool getFileSize(const String& path, long long& result) { - return PlatformSupport::getFileSize(path, result); + FileMetadata metadata; + if (!PlatformSupport::getFileMetadata(path, metadata)) + return false; + result = metadata.length; + return true; } bool getFileModificationTime(const String& path, time_t& result) { - return PlatformSupport::getFileModificationTime(path, result); + FileMetadata metadata; + if (!PlatformSupport::getFileMetadata(path, metadata)) + return false; + result = metadata.modificationTime; + return true; } bool getFileMetadata(const String& path, FileMetadata& metadata) { - // FIXME: Call PlatformSupport::getFileMetadata once it is implemented. - // return PlatformSupport::getFileMetadata(path, metadata); - if (!PlatformSupport::getFileSize(path, metadata.length)) - return false; - time_t modificationTime; - if (!PlatformSupport::getFileModificationTime(path, modificationTime)) - return false; - metadata.modificationTime = modificationTime; - return true; + return PlatformSupport::getFileMetadata(path, metadata); } String directoryName(const String& path) diff --git a/Source/WebCore/platform/chromium/PlatformSupport.h b/Source/WebCore/platform/chromium/PlatformSupport.h index 63986990e..7800f0cef 100644 --- a/Source/WebCore/platform/chromium/PlatformSupport.h +++ b/Source/WebCore/platform/chromium/PlatformSupport.h @@ -126,8 +126,6 @@ public: static bool fileExists(const String&); static bool deleteFile(const String&); static bool deleteEmptyDirectory(const String&); - static bool getFileSize(const String&, long long& result); - static bool getFileModificationTime(const String&, time_t& result); static bool getFileMetadata(const String&, FileMetadata& result); static String directoryName(const String& path); static String pathByAppendingComponent(const String& path, const String& component); diff --git a/Source/WebCore/platform/graphics/StringTruncator.cpp b/Source/WebCore/platform/graphics/StringTruncator.cpp index 1ea04603d..310d554e6 100644 --- a/Source/WebCore/platform/graphics/StringTruncator.cpp +++ b/Source/WebCore/platform/graphics/StringTruncator.cpp @@ -63,7 +63,7 @@ static unsigned centerTruncateToBuffer(const String& string, unsigned length, un ASSERT(keepCount < STRING_BUFFER_SIZE); unsigned omitStart = (keepCount + 1) / 2; - TextBreakIterator* it = characterBreakIterator(string.characters(), length); + NonSharedCharacterBreakIterator it(string.characters(), length); unsigned omitEnd = boundedTextBreakFollowing(it, omitStart + (length - keepCount) - 1, length); omitStart = textBreakAtOrPreceding(it, omitStart); @@ -82,7 +82,7 @@ static unsigned rightTruncateToBuffer(const String& string, unsigned length, uns ASSERT(keepCount < length); ASSERT(keepCount < STRING_BUFFER_SIZE); - TextBreakIterator* it = characterBreakIterator(string.characters(), length); + NonSharedCharacterBreakIterator it(string.characters(), length); unsigned keepLength = textBreakAtOrPreceding(it, keepCount); unsigned truncatedLength = keepLength + 1; diff --git a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp index ae8d3208b..b86ad31da 100644 --- a/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp @@ -49,9 +49,9 @@ namespace WebCore { class ContentLayerPainter : public LayerPainterChromium { WTF_MAKE_NONCOPYABLE(ContentLayerPainter); public: - static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate) + static PassOwnPtr<ContentLayerPainter> create(ContentLayerDelegate* delegate, TiledLayerChromium* layer) { - return adoptPtr(new ContentLayerPainter(delegate)); + return adoptPtr(new ContentLayerPainter(delegate, layer)); } virtual void paint(GraphicsContext& context, const IntRect& contentRect) @@ -59,19 +59,27 @@ public: double paintStart = currentTime(); context.clearRect(contentRect); context.clip(contentRect); - m_delegate->paintContents(context, contentRect); - double paintEnd = currentTime(); - double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); - WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); + { + GraphicsContextStateSaver stateSaver(context, m_layer->layerTreeHost()->settings().debugShowTileInfo); + + m_delegate->paintContents(context, contentRect); + double paintEnd = currentTime(); + double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); + WebKit::Platform::current()->histogramCustomCounts("Renderer4.AccelContentPaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); + } + if (m_layer->layerTreeHost()->settings().debugShowTileInfo) + m_layer->paintDebugTileInfo(context, contentRect); } private: - explicit ContentLayerPainter(ContentLayerDelegate* delegate) + explicit ContentLayerPainter(ContentLayerDelegate* delegate, TiledLayerChromium* layer) : m_delegate(delegate) + , m_layer(layer) { } ContentLayerDelegate* m_delegate; + TiledLayerChromium* m_layer; }; PassRefPtr<ContentLayerChromium> ContentLayerChromium::create(ContentLayerDelegate* delegate) @@ -126,11 +134,11 @@ void ContentLayerChromium::createTextureUpdaterIfNeeded() if (m_textureUpdater) return; if (layerTreeHost()->settings().acceleratePainting) - m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate)); + m_textureUpdater = FrameBufferSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this)); else if (layerTreeHost()->settings().perTilePainting) - m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapSkPictureCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); else - m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate), layerTreeHost()->layerRendererCapabilities().usingMapSub); + m_textureUpdater = BitmapCanvasLayerTextureUpdater::create(ContentLayerPainter::create(m_delegate, this), layerTreeHost()->layerRendererCapabilities().usingMapSub); m_textureUpdater->setOpaque(opaque()); GC3Denum textureFormat = layerTreeHost()->layerRendererCapabilities().bestTextureFormat; diff --git a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp index 3bf716bbe..74459a851 100644 --- a/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp @@ -121,6 +121,10 @@ void LayerChromium::setLayerTreeHost(CCLayerTreeHost* host) m_maskLayer->setLayerTreeHost(host); if (m_replicaLayer) m_replicaLayer->setLayerTreeHost(host); + + // If this layer already has active animations, the host needs to be notified. + if (host && m_layerAnimationController->hasActiveAnimation()) + host->didAddAnimation(); } void LayerChromium::setNeedsCommit() @@ -662,7 +666,8 @@ void LayerChromium::notifyAnimationStarted(const CCAnimationEvent& event, double void LayerChromium::notifyAnimationFinished(double wallClockTime) { - m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime); + if (m_layerAnimationDelegate) + m_layerAnimationDelegate->notifyAnimationFinished(wallClockTime); } Region LayerChromium::visibleContentOpaqueRegion() const diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp index 17c351f6d..d029d775f 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp @@ -29,10 +29,13 @@ #include "TiledLayerChromium.h" +#include "FontCache.h" +#include "FontDescription.h" #include "GraphicsContext3D.h" #include "LayerRendererChromium.h" #include "ManagedTexture.h" #include "Region.h" +#include "TextRun.h" #include "TextStream.h" #include "TraceEvent.h" @@ -73,11 +76,15 @@ public: bool partialUpdate; bool updated; bool isInUseOnImpl; + int lastUpdateFrame; + int totalPaintCount; private: explicit UpdatableTile(PassOwnPtr<LayerTextureUpdater::Texture> texture) : partialUpdate(false) , updated(false) , isInUseOnImpl(false) + , lastUpdateFrame(0) + , totalPaintCount(0) , m_texture(texture) { } @@ -409,6 +416,13 @@ void TiledLayerChromium::updateTiles(bool idle, int left, int top, int right, in return; } + if (tile->isDirty() && layerTreeHost()->settings().debugShowTileInfo) { + // Invalidate the entire tile so that text updates. + tile->dirtyRect = m_tiler->tileRect(tile); + tile->lastUpdateFrame = layerTreeHost()->frameNumber(); + tile->totalPaintCount++; + } + paintRect.unite(tile->dirtyRect); } } @@ -712,5 +726,71 @@ IntRect TiledLayerChromium::idlePaintRect(const IntRect& visibleLayerRect) return prepaintRect; } +void TiledLayerChromium::paintDebugTileInfo(GraphicsContext& context, const IntRect& layerRect) +{ + FontCachePurgePreventer fontCachePurgePreventer; + + // Don't bother writing info onto small tiles. + const int minDimension = 200; + if (m_tiler->tileSize().width() < minDimension || m_tiler->tileSize().height() < minDimension) + return; + + if (!m_debugInfoFont) { + FontDescription fontDesc; + fontDesc.setGenericFamily(FontDescription::MonospaceFamily); + fontDesc.setComputedSize(10); + m_debugInfoFont = adoptPtr(new Font(fontDesc, 0, 0)); + m_debugInfoFont->update(0); + } + + int fontHeight = m_debugInfoFont->fontMetrics().floatHeight() + 2; + + 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 tileRect = m_tiler->tileRect(tile); + String info[] = { + String::format("LayerId(%d)", id()), + String::format("Index(%d, %d)", i, j), + String::format("Tile(%d, %d, %d, %d)", tileRect.x(), tileRect.y(), tileRect.width(), tileRect.height()), + String::format("Frame(%d)", tile->lastUpdateFrame), + String::format("Count(%d)", tile->totalPaintCount), + String::format("Layer(%d, %d)", contentBounds().width(), contentBounds().height()), + }; + const size_t lines = sizeof(info) / sizeof(info[0]); + int width[lines]; + + IntPoint center = m_tiler->tileRect(tile).center(); + int currentY = center.y() - fontHeight * lines / 2; + + int maxWidth = 0; + for (size_t i = 0; i < lines; ++i) { + width[i] = m_debugInfoFont->width(TextRun(info[i])); + maxWidth = max(width[i], maxWidth); + } + + IntRect textRect(IntPoint(center.x() - maxWidth / 2, currentY - fontHeight / 2), IntSize(maxWidth, fontHeight * lines + fontHeight / 2)); + + context.setFillColor(Color(192, 192, 192, 192), ColorSpaceDeviceRGB); + context.fillRect(FloatRect(textRect)); + + context.setFillColor(Color(64, 64, 64), ColorSpaceDeviceRGB); + + for (size_t i = 0; i < lines; ++i) { + TextRun run(info[i]); + int textWidth = m_debugInfoFont->width(run); + IntPoint textStart(center.x() - textWidth / 2, currentY + fontHeight / 2); + context.drawText(*m_debugInfoFont, run, textStart); + currentY += fontHeight; + } + } + } +} + } #endif // USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h index ca389f2e4..ebc4ee492 100644 --- a/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h +++ b/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.h @@ -28,6 +28,7 @@ #if USE(ACCELERATED_COMPOSITING) +#include "Font.h" #include "LayerChromium.h" #include "cc/CCLayerTilingData.h" #include "cc/CCTiledLayerImpl.h" @@ -65,6 +66,8 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE; + void paintDebugTileInfo(GraphicsContext&, const IntRect&); + protected: TiledLayerChromium(); @@ -127,6 +130,7 @@ private: TilingOption m_tilingOption; OwnPtr<CCLayerTilingData> m_tiler; + OwnPtr<Font> m_debugInfoFont; }; } diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h index 98eeee7f1..714602356 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h +++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h @@ -77,6 +77,7 @@ protected: struct CCSettings { CCSettings() : acceleratePainting(false) + , debugShowTileInfo(false) , showFPSCounter(false) , showPlatformLayerTree(false) , showPaintRects(false) @@ -93,6 +94,7 @@ struct CCSettings { { } bool acceleratePainting; + bool debugShowTileInfo; bool showFPSCounter; bool showPlatformLayerTree; bool showPaintRects; @@ -211,7 +213,7 @@ public: bool commitRequested() const; void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); - void didAddAnimation(); + virtual void didAddAnimation(); LayerChromium* rootLayer() { return m_rootLayer.get(); } const LayerChromium* rootLayer() const { return m_rootLayer.get(); } diff --git a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h index ab799ba9a..38e083fb9 100644 --- a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h +++ b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h @@ -56,10 +56,6 @@ class ImageGStreamer : public RefCounted<ImageGStreamer> { ImageGStreamer(GstBuffer*&, IntSize, QImage::Format); #endif -#if PLATFORM(MAC) - ImageGStreamer(GstBuffer*&, IntSize); -#endif - }; } diff --git a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm b/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm deleted file mode 100644 index fe0928b9b..000000000 --- a/Source/WebCore/platform/graphics/gstreamer/ImageGStreamerCG.mm +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2010 Igalia S.L - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#include "GraphicsContextCG.h" -#include "ImageGStreamer.h" -#if ENABLE(VIDEO) && USE(GSTREAMER) - -using namespace WebCore; - -PassRefPtr<ImageGStreamer> ImageGStreamer::createImage(GstBuffer* buffer) -{ - int width = 0, height = 0; - GstCaps* caps = gst_buffer_get_caps(buffer); - GstVideoFormat format; - if (!gst_video_format_parse_caps(caps, &format, &width, &height)) { - gst_caps_unref(caps); - return NULL; - } - - return adoptRef(new ImageGStreamer(buffer, IntSize(width, height))); -} - -ImageGStreamer::ImageGStreamer(GstBuffer*& buffer, IntSize size) - : m_image(0) -{ - ASSERT(GST_BUFFER_SIZE(buffer)); - - RetainPtr<CFDataRef> data(AdoptCF, CFDataCreateWithBytesNoCopy(0, static_cast<UInt8*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer), kCFAllocatorNull)); - RetainPtr<CGDataProviderRef> provider(AdoptCF, CGDataProviderCreateWithCFData(data.get())); - CGImageRef frameImage = CGImageCreate(size.width(), size.height(), 8, 32, size.width()*4, deviceRGBColorSpaceRef(), - kCGBitmapByteOrder32Little | kCGImageAlphaFirst, provider.get(), 0, false, kCGRenderingIntentDefault); - m_image = BitmapImage::create(frameImage); -} - -ImageGStreamer::~ImageGStreamer() -{ - if (m_image) - m_image.clear(); - - m_image = 0; -} - -#endif // USE(GSTREAMER) diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp index b91ca1164..1cc0a220e 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp +++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp @@ -515,6 +515,11 @@ static void slerp(double qa[4], const double qb[4], double t) // End of Supporting Math Functions +TransformationMatrix::TransformationMatrix(const AffineTransform& t) +{ + setMatrix(t.a(), t.b(), t.c(), t.d(), t.e(), t.f()); +} + TransformationMatrix& TransformationMatrix::scale(double s) { return scaleNonUniform(s, s); diff --git a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h index 5918efcb7..7ce30c409 100644 --- a/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h +++ b/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h @@ -73,6 +73,7 @@ public: typedef double Matrix4[4][4]; TransformationMatrix() { makeIdentity(); } + TransformationMatrix(const AffineTransform& t); TransformationMatrix(const TransformationMatrix& t) { *this = t; } TransformationMatrix(double a, double b, double c, double d, double e, double f) { setMatrix(a, b, c, d, e, f); } TransformationMatrix(double m11, double m12, double m13, double m14, diff --git a/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp b/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp index 3e06cd481..da0ec7fa0 100644 --- a/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp +++ b/Source/WebCore/platform/gtk/GtkInputMethodFilter.cpp @@ -66,7 +66,7 @@ void GtkInputMethodFilter::setWidget(GtkWidget* widget) ASSERT(!m_widget); m_widget = widget; - if (GdkWindow* window = gtk_widget_get_window(m_widget)) + if (gtk_widget_get_window(m_widget)) handleWidgetRealize(m_widget, this); else g_signal_connect_after(widget, "realize", G_CALLBACK(handleWidgetRealize), this); diff --git a/Source/WebCore/platform/text/String.cpp b/Source/WebCore/platform/text/String.cpp index f2f8d2e20..590b7a3c1 100644 --- a/Source/WebCore/platform/text/String.cpp +++ b/Source/WebCore/platform/text/String.cpp @@ -51,7 +51,7 @@ PassRefPtr<SharedBuffer> utf8Buffer(const String& string) unsigned numGraphemeClusters(const String& s) { - TextBreakIterator* it = characterBreakIterator(s.characters(), s.length()); + NonSharedCharacterBreakIterator it(s.characters(), s.length()); if (!it) return s.length(); @@ -63,7 +63,7 @@ unsigned numGraphemeClusters(const String& s) unsigned numCharactersInGraphemeClusters(const String& s, unsigned numGraphemeClusters) { - TextBreakIterator* it = characterBreakIterator(s.characters(), s.length()); + NonSharedCharacterBreakIterator it(s.characters(), s.length()); if (!it) return min(s.length(), numGraphemeClusters); diff --git a/Source/WebCore/platform/text/TextBreakIterator.h b/Source/WebCore/platform/text/TextBreakIterator.h index 3c9c8c952..bbc1dba4b 100644 --- a/Source/WebCore/platform/text/TextBreakIterator.h +++ b/Source/WebCore/platform/text/TextBreakIterator.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2011, 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 @@ -31,12 +31,6 @@ namespace WebCore { // Note: The returned iterator is good only until you get another iterator, with the exception of acquireLineBreakIterator. - // Iterates over "extended grapheme clusters", as defined in UAX #29. - // Note that platform implementations may be less sophisticated - e.g. ICU prior to - // version 4.0 only supports "legacy grapheme clusters". - // Use this for general text processing, e.g. string truncation. - TextBreakIterator* characterBreakIterator(const UChar*, int length); - // This is similar to character break iterator in most cases, but is subject to // platform UI conventions. One notable example where this can be different // from character break iterator is Thai prepend characters, see bug 24342. @@ -104,6 +98,23 @@ private: TextBreakIterator* m_iterator; }; +// Iterates over "extended grapheme clusters", as defined in UAX #29. +// Note that platform implementations may be less sophisticated - e.g. ICU prior to +// version 4.0 only supports "legacy grapheme clusters". +// Use this for general text processing, e.g. string truncation. + +class NonSharedCharacterBreakIterator { + WTF_MAKE_NONCOPYABLE(NonSharedCharacterBreakIterator); +public: + NonSharedCharacterBreakIterator(const UChar*, int length); + ~NonSharedCharacterBreakIterator(); + + operator TextBreakIterator*() const { return m_iterator; } + +private: + TextBreakIterator* m_iterator; +}; + } #endif diff --git a/Source/WebCore/platform/text/TextBreakIteratorICU.cpp b/Source/WebCore/platform/text/TextBreakIteratorICU.cpp index 5c8ffbcc4..29b1580d6 100644 --- a/Source/WebCore/platform/text/TextBreakIteratorICU.cpp +++ b/Source/WebCore/platform/text/TextBreakIteratorICU.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Lars Knoll <lars@trolltech.com> - * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2011, 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 @@ -24,7 +24,9 @@ #include "LineBreakIteratorPoolICU.h" #include "PlatformString.h" +#include <wtf/Atomics.h> +using namespace WTF; using namespace std; namespace WebCore { @@ -52,14 +54,6 @@ static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator return iterator; } -TextBreakIterator* characterBreakIterator(const UChar* string, int length) -{ - static bool createdCharacterBreakIterator = false; - static TextBreakIterator* staticCharacterBreakIterator; - return setUpIterator(createdCharacterBreakIterator, - staticCharacterBreakIterator, UBRK_CHARACTER, string, length); -} - TextBreakIterator* wordBreakIterator(const UChar* string, int length) { static bool createdWordBreakIterator = false; @@ -91,6 +85,35 @@ void releaseLineBreakIterator(TextBreakIterator* iterator) LineBreakIteratorPool::sharedPool().put(reinterpret_cast<UBreakIterator*>(iterator)); } +static TextBreakIterator* nonSharedCharacterBreakIterator; + +static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterator* expected, TextBreakIterator* newValue) +{ +#if ENABLE(COMPARE_AND_SWAP) + return weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), expected, newValue); +#else + DEFINE_STATIC_LOCAL(Mutex, nonSharedCharacterBreakIteratorMutex, ()); + MutexLocker locker(nonSharedCharacterBreakIteratorMutex); + if (nonSharedCharacterBreakIterator != expected) + return false; + nonSharedCharacterBreakIterator = newValue; + return true; +#endif +} + +NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length) +{ + m_iterator = nonSharedCharacterBreakIterator; + bool createdIterator = m_iterator && compareAndSwapNonSharedCharacterBreakIterator(m_iterator, 0); + m_iterator = setUpIterator(createdIterator, m_iterator, UBRK_CHARACTER, buffer, length); +} + +NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() +{ + if (!compareAndSwapNonSharedCharacterBreakIterator(0, m_iterator)) + ubrk_close(reinterpret_cast<UBreakIterator*>(m_iterator)); +} + TextBreakIterator* sentenceBreakIterator(const UChar* string, int length) { static bool createdSentenceBreakIterator = false; diff --git a/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp b/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp index b49c115d8..733d75982 100644 --- a/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp +++ b/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp @@ -23,11 +23,13 @@ */ #include "config.h" - #include "TextBreakIterator.h" +#include <wtf/Atomics.h> #include <wtf/gobject/GOwnPtr.h> #include <pango/pango.h> + +using namespace WTF; using namespace std; #define UTF8_IS_SURROGATE(character) (character >= 0x10000 && character <= 0x10FFFF) @@ -219,17 +221,27 @@ static TextBreakIterator* setUpIterator(bool& createdIterator, TextBreakIterator return iterator; } -TextBreakIterator* characterBreakIterator(const UChar* string, int length) +static TextBreakIterator* nonSharedCharacterBreakIterator; + +NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length) +{ + m_iterator = nonSharedCharacterBreakIterator; + bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0); + m_iterator = setUpIterator(createdIterator, m_iterator, UBRK_CHARACTER, buffer, length); +} + +NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() { - static bool createdCharacterBreakIterator = false; - static TextBreakIterator* staticCharacterBreakIterator; - return setUpIterator(createdCharacterBreakIterator, staticCharacterBreakIterator, UBRK_CHARACTER, string, length); + if (!weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), 0, m_iterator)) + ubrk_close(m_iterator); } TextBreakIterator* cursorMovementIterator(const UChar* string, int length) { // FIXME: This needs closer inspection to achieve behaviour identical to the ICU version. - return characterBreakIterator(string, length); + static bool createdCursorMovementIterator = false; + static TextBreakIterator* staticCursorMovementIterator; + return setUpIterator(createdCursorMovementIterator, staticCursorMovementIterator, UBRK_CHARACTER, string, length); } TextBreakIterator* wordBreakIterator(const UChar* string, int length) diff --git a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp index 8ac1538d2..ca75f1b0d 100644 --- a/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp +++ b/Source/WebCore/platform/text/qt/TextBreakIteratorQt.cpp @@ -24,6 +24,7 @@ #include <QtCore/qtextboundaryfinder.h> #include <algorithm> #include <qdebug.h> +#include <wtf/Atomics.h> // #define DEBUG_TEXT_ITERATORS #ifdef DEBUG_TEXT_ITERATORS @@ -32,6 +33,7 @@ #define DEBUG if (1) {} else qDebug #endif +using namespace WTF; using namespace std; namespace WebCore { @@ -66,15 +68,27 @@ namespace WebCore { return setUpIterator(staticWordBreakIterator, QTextBoundaryFinder::Word, string, length); } - TextBreakIterator* characterBreakIterator(const UChar* string, int length) + static TextBreakIterator* nonSharedCharacterBreakIterator; + + NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length) + { + m_iterator = nonSharedCharacterBreakIterator; + bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0); + if (!createdIterator) + m_iterator = new TextBreakIterator(); + setUpIterator(*m_iterator, QTextBoundaryFinder::Grapheme, buffer, length); + } + + NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() { - static TextBreakIterator staticCharacterBreakIterator; - return setUpIterator(staticCharacterBreakIterator, QTextBoundaryFinder::Grapheme, string, length); + if (!weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), 0, m_iterator)) + delete m_iterator; } TextBreakIterator* cursorMovementIterator(const UChar* string, int length) { - return characterBreakIterator(string, length); + static TextBreakIterator staticCursorMovementIterator; + return setUpIterator(staticCursorMovementIterator, QTextBoundaryFinder::Grapheme, string, length); } static TextBreakIterator* staticLineBreakIterator; diff --git a/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp b/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp index 468544ccb..5be1ee903 100644 --- a/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp +++ b/Source/WebCore/platform/text/wince/TextBreakIteratorWinCE.cpp @@ -23,11 +23,13 @@ #include "TextBreakIterator.h" #include "PlatformString.h" +#include <wtf/Atomics.h> #include <wtf/StdLibExtras.h> #include <wtf/unicode/Unicode.h> -using namespace std; +using namespace WTF; using namespace WTF::Unicode; +using namespace std; namespace WebCore { @@ -235,11 +237,21 @@ TextBreakIterator* wordBreakIterator(const UChar* string, int length) return &iterator; } -TextBreakIterator* characterBreakIterator(const UChar* string, int length) +static CharBreakIterator* nonSharedCharacterBreakIterator; + +NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length) { - DEFINE_STATIC_LOCAL(CharBreakIterator, iterator, ()); - iterator.reset(string, length); - return &iterator; + m_iterator = nonSharedCharacterBreakIterator; + bool createdIterator = m_iterator && weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), m_iterator, 0); + if (!createdIterator) + m_iterator = new CharBreakIterator; + m_iterator.reset(string, length); +} + +NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator() +{ + if (!weakCompareAndSwap(reinterpret_cast<void**>(&nonSharedCharacterBreakIterator), 0, m_iterator)) + delete m_iterator; } static TextBreakIterator* staticLineBreakIterator; @@ -324,7 +336,9 @@ bool isWordTextBreak(TextBreakIterator*) TextBreakIterator* cursorMovementIterator(const UChar* string, int length) { - return characterBreakIterator(string, length); + DEFINE_STATIC_LOCAL(CharBreakIterator, iterator, ()); + iterator.reset(string, length); + return &iterator; } } // namespace WebCore diff --git a/Source/WebCore/plugins/PluginData.cpp b/Source/WebCore/plugins/PluginData.cpp index bd4da9e06..fea5f8091 100644 --- a/Source/WebCore/plugins/PluginData.cpp +++ b/Source/WebCore/plugins/PluginData.cpp @@ -78,6 +78,8 @@ void PluginData::initPlugins(const Page* page) ASSERT(m_plugins.isEmpty()); platformStrategies()->pluginStrategy()->getPluginInfo(page, m_plugins); +#else + UNUSED_PARAM(page); #endif } #endif diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 15867e1c6..e6a73d9a4 100755 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -2015,16 +2015,6 @@ LayoutUnit RenderBlock::collapseMargins(RenderBox* child, MarginInfo& marginInfo logicalTop = min(logicalTop, nextPageLogicalTop(beforeCollapseLogicalTop)); setLogicalHeight(logicalHeight() + (logicalTop - oldLogicalTop)); } - - // If we have collapsed into a previous sibling and so reduced the height of the parent, ensure any floats that now - // overhang from the previous sibling are added to our parent - RenderObject* prev = child->previousSibling(); - if (prev && prev->isRenderBlock()) { - RenderBlock* block = toRenderBlock(prev); - if (block->m_floatingObjects && block->lowestFloatLogicalBottom() > logicalTop) - addOverhangingFloats(block, false); - } - return logicalTop; } diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 565e3c96b..04ff3dbe3 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -44,6 +44,7 @@ #include "RenderBoxRegionInfo.h" #include "RenderFlexibleBox.h" #include "RenderFlowThread.h" +#include "RenderGeometryMap.h" #include "RenderInline.h" #include "RenderLayer.h" #include "RenderPart.h" @@ -437,6 +438,7 @@ void RenderBox::updateLayerTransform() IntRect RenderBox::absoluteContentBox() const { + // This is wrong with transforms and flipped writing modes. IntRect rect = pixelSnappedIntRect(contentBoxRect()); FloatPoint absPos = localToAbsolute(FloatPoint()); rect.move(absPos.x(), absPos.y()); @@ -1315,6 +1317,46 @@ void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed); } +const RenderObject* RenderBox::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + ASSERT(ancestorToStopAt != this); + + bool ancestorSkipped; + RenderObject* container = this->container(ancestorToStopAt, &ancestorSkipped); + if (!container) + return 0; + + bool isFixedPos = style()->position() == FixedPosition; + bool hasTransform = hasLayer() && layer()->transform(); + + LayoutSize adjustmentForSkippedAncestor; + if (ancestorSkipped) { + // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe + // to just subtract the delta between the ancestor and o. + adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorContainer(container); + } + + bool offsetDependsOnPoint = false; + LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), &offsetDependsOnPoint); + + if (container->isRenderFlowThread()) + offsetDependsOnPoint = true; + + bool preserve3D = container->style()->preserves3D() || style()->preserves3D(); + if (shouldUseTransformFromContainer(container)) { + TransformationMatrix t; + getTransformFromContainer(container, containerOffset, t); + t.translateRight(adjustmentForSkippedAncestor.width(), adjustmentForSkippedAncestor.height()); + + geometryMap.push(this, t, preserve3D, offsetDependsOnPoint, isFixedPos, hasTransform); + } else { + containerOffset += adjustmentForSkippedAncestor; + geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint, isFixedPos, hasTransform); + } + + return ancestorSkipped ? ancestorToStopAt : container; +} + void RenderBox::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const { // We don't expect absoluteToLocal() to be called during layout (yet) @@ -1332,7 +1374,7 @@ void RenderBox::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, Transfor RenderBoxModelObject::mapAbsoluteToLocalPoint(fixed, useTransforms, transformState); } -LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const +LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const { ASSERT(o == container()); @@ -1350,6 +1392,9 @@ LayoutSize RenderBox::offsetFromContainer(RenderObject* o, const LayoutPoint& po offset = toLayoutSize(block->flipForWritingModeIncludingColumns(toLayoutPoint(offset))); o->adjustForColumns(offset, columnPoint); offset = block->flipForWritingMode(offset); + + if (offsetDependsOnPoint) + *offsetDependsOnPoint = true; } else offset += topLeftLocationOffset(); } @@ -3766,7 +3811,7 @@ LayoutRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) rect = layer()->currentTransform().mapRect(rect); if (isRelPositioned()) - rect.move(relativePositionOffsetX(), relativePositionOffsetY()); + rect.move(relativePositionOffset()); // Now we need to flip back. flipForWritingMode(rect); diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h index 9ff60e672..c3696ab8d 100644 --- a/Source/WebCore/rendering/RenderBox.h +++ b/Source/WebCore/rendering/RenderBox.h @@ -276,7 +276,7 @@ public: void setOverrideWidth(LayoutUnit); void clearOverrideSize(); - virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; + virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const; LayoutUnit computeBorderBoxLogicalWidth(LayoutUnit width) const; LayoutUnit computeBorderBoxLogicalHeight(LayoutUnit height) const; @@ -519,6 +519,7 @@ protected: virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); } virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject*, RenderGeometryMap&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; void paintRootBoxFillLayers(const PaintInfo&); diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp index f5b6500e5..1625f075b 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.cpp +++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp @@ -345,10 +345,6 @@ void RenderBoxModelObject::destroyLayer() void RenderBoxModelObject::willBeDestroyed() { - // This must be done before we destroy the RenderObject. - if (m_layer) - m_layer->clearClipRects(); - // A continuation of this RenderObject should be destroyed at subclasses. ASSERT(!continuation()); @@ -463,48 +459,41 @@ void RenderBoxModelObject::updateBoxModelInfoFromStyle() setHorizontalWritingMode(styleToUse->isHorizontalWritingMode()); } -enum RelPosAxis { RelPosX, RelPosY }; - -static LayoutUnit accumulateRelativePositionOffsets(const RenderObject* child, RelPosAxis axis) +static LayoutSize accumulateRelativePositionOffsets(const RenderObject* child) { if (!child->isAnonymousBlock() || !child->isRelPositioned()) - return 0; - LayoutUnit offset = ZERO_LAYOUT_UNIT; + return LayoutSize(); + LayoutSize offset; RenderObject* p = toRenderBlock(child)->inlineElementContinuation(); while (p && p->isRenderInline()) { - if (p->isRelPositioned()) - offset += (axis == RelPosX) ? toRenderInline(p)->relativePositionOffsetX() : toRenderInline(p)->relativePositionOffsetY(); + if (p->isRelPositioned()) { + RenderInline* renderInline = toRenderInline(p); + offset += renderInline->relativePositionOffset(); + } p = p->parent(); } return offset; } -LayoutUnit RenderBoxModelObject::relativePositionOffsetX() const +LayoutSize RenderBoxModelObject::relativePositionOffset() const { - LayoutUnit offset = accumulateRelativePositionOffsets(this, RelPosX); + LayoutSize offset = accumulateRelativePositionOffsets(this); + + RenderBlock* containingBlock = this->containingBlock(); // Objects that shrink to avoid floats normally use available line width when computing containing block width. However // in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the // available width of the containing block. Therefore we don't use containingBlockLogicalWidthForContent() here, but instead explicitly // call availableWidth on our containing block. if (!style()->left().isAuto()) { - RenderBlock* cb = containingBlock(); - if (!style()->right().isAuto() && !cb->style()->isLeftToRightDirection()) - return -valueForLength(style()->right(), cb->availableWidth(), view()); - return offset + valueForLength(style()->left(), cb->availableWidth(), view()); - } - if (!style()->right().isAuto()) { - RenderBlock* cb = containingBlock(); - return offset + -valueForLength(style()->right(), cb->availableWidth(), view()); + if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRightDirection()) + offset.setWidth(-valueForLength(style()->right(), containingBlock->availableWidth(), view())); + else + offset.expand(valueForLength(style()->left(), containingBlock->availableWidth(), view()), 0); + } else if (!style()->right().isAuto()) { + offset.expand(-valueForLength(style()->right(), containingBlock->availableWidth(), view()), 0); } - return offset; -} -LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const -{ - LayoutUnit offset = accumulateRelativePositionOffsets(this, RelPosY); - - RenderBlock* containingBlock = this->containingBlock(); // If the containing block of a relatively positioned element does not // specify a height, a percentage top or bottom offset should be resolved as // auto. An exception to this is if the containing block has the WinIE quirk @@ -515,13 +504,13 @@ LayoutUnit RenderBoxModelObject::relativePositionOffsetY() const && (!containingBlock->style()->height().isAuto() || !style()->top().isPercent() || containingBlock->stretchesToViewport())) - return offset + valueForLength(style()->top(), containingBlock->availableHeight(), view()); + offset.expand(0, valueForLength(style()->top(), containingBlock->availableHeight(), view())); - if (!style()->bottom().isAuto() + else if (!style()->bottom().isAuto() && (!containingBlock->style()->height().isAuto() || !style()->bottom().isPercent() || containingBlock->stretchesToViewport())) - return offset + -valueForLength(style()->bottom(), containingBlock->availableHeight(), view()); + offset.expand(0, -valueForLength(style()->bottom(), containingBlock->availableHeight(), view())); return offset; } diff --git a/Source/WebCore/rendering/RenderBoxModelObject.h b/Source/WebCore/rendering/RenderBoxModelObject.h index b145e6f71..5e2f26b5b 100644 --- a/Source/WebCore/rendering/RenderBoxModelObject.h +++ b/Source/WebCore/rendering/RenderBoxModelObject.h @@ -58,9 +58,7 @@ public: RenderBoxModelObject(Node*); virtual ~RenderBoxModelObject(); - LayoutUnit relativePositionOffsetX() const; - LayoutUnit relativePositionOffsetY() const; - LayoutSize relativePositionOffset() const { return LayoutSize(relativePositionOffsetX(), relativePositionOffsetY()); } + LayoutSize relativePositionOffset() const; LayoutSize relativePositionLogicalOffset() const { return style()->isHorizontalWritingMode() ? relativePositionOffset() : relativePositionOffset().transposedSize(); } // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlines (RenderFlow) diff --git a/Source/WebCore/rendering/RenderFlexibleBox.cpp b/Source/WebCore/rendering/RenderFlexibleBox.cpp index 2feab4f75..8f0997b85 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderFlexibleBox.cpp @@ -35,6 +35,7 @@ #include "RenderLayer.h" #include "RenderView.h" #include <limits> +#include <wtf/MathExtras.h> namespace WebCore { @@ -593,7 +594,7 @@ LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* LayoutUnit mainAxisExtent = hasOrthogonalFlow(child) ? child->logicalHeight() : child->maxPreferredLogicalWidth(); return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); } - return minimumValueForLength(mainAxisLength, mainAxisContentExtent(), view()); + return std::max(LayoutUnit(0), minimumValueForLength(mainAxisLength, mainAxisContentExtent(), view())); } LayoutUnit RenderFlexibleBox::computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent) @@ -624,17 +625,17 @@ void RenderFlexibleBox::layoutFlexItems(FlexOrderIterator& iterator, WTF::Vector OrderedFlexItemList orderedChildren; LayoutUnit preferredMainAxisExtent; float totalPositiveFlexibility; - float totalNegativeFlexibility; + float totalWeightedNegativeFlexibility; LayoutUnit minMaxAppliedMainAxisExtent; LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore(); - while (computeNextFlexLine(iterator, orderedChildren, preferredMainAxisExtent, totalPositiveFlexibility, totalNegativeFlexibility, minMaxAppliedMainAxisExtent)) { + while (computeNextFlexLine(iterator, orderedChildren, preferredMainAxisExtent, totalPositiveFlexibility, totalWeightedNegativeFlexibility, minMaxAppliedMainAxisExtent)) { LayoutUnit availableFreeSpace = computeAvailableFreeSpace(preferredMainAxisExtent); FlexSign flexSign = (minMaxAppliedMainAxisExtent < preferredMainAxisExtent + availableFreeSpace) ? PositiveFlexibility : NegativeFlexibility; InflexibleFlexItemSize inflexibleItems; WTF::Vector<LayoutUnit> childSizes; - while (!resolveFlexibleLengths(flexSign, orderedChildren, availableFreeSpace, totalPositiveFlexibility, totalNegativeFlexibility, inflexibleItems, childSizes)) { - ASSERT(totalPositiveFlexibility >= 0 && totalNegativeFlexibility >= 0); + while (!resolveFlexibleLengths(flexSign, orderedChildren, availableFreeSpace, totalPositiveFlexibility, totalWeightedNegativeFlexibility, inflexibleItems, childSizes)) { + ASSERT(totalPositiveFlexibility >= 0 && totalWeightedNegativeFlexibility >= 0); ASSERT(inflexibleItems.size() > 0); } @@ -800,11 +801,11 @@ LayoutUnit RenderFlexibleBox::adjustChildSizeForMinAndMax(RenderBox* child, Layo return childSize; } -bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility, LayoutUnit& minMaxAppliedMainAxisExtent) +bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, LayoutUnit& minMaxAppliedMainAxisExtent) { orderedChildren.clear(); preferredMainAxisExtent = 0; - totalPositiveFlexibility = totalNegativeFlexibility = 0; + totalPositiveFlexibility = totalWeightedNegativeFlexibility = 0; minMaxAppliedMainAxisExtent = 0; if (!iterator.currentChild()) @@ -828,7 +829,7 @@ bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, Ordered orderedChildren.append(child); preferredMainAxisExtent += childMainAxisMarginBoxExtent; totalPositiveFlexibility += child->style()->positiveFlex(); - totalNegativeFlexibility += child->style()->negativeFlex(); + totalWeightedNegativeFlexibility += child->style()->negativeFlex() * childMainAxisExtent; LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(child, childMainAxisExtent, flexboxAvailableContentExtent); minMaxAppliedMainAxisExtent += childMinMaxAppliedMainAxisExtent - childMainAxisExtent + childMainAxisMarginBoxExtent; @@ -836,20 +837,21 @@ bool RenderFlexibleBox::computeNextFlexLine(FlexOrderIterator& iterator, Ordered return true; } -void RenderFlexibleBox::freezeViolations(const WTF::Vector<Violation>& violations, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize& inflexibleItems) +void RenderFlexibleBox::freezeViolations(const WTF::Vector<Violation>& violations, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize& inflexibleItems) { for (size_t i = 0; i < violations.size(); ++i) { RenderBox* child = violations[i].child; LayoutUnit childSize = violations[i].childSize; - availableFreeSpace -= childSize - preferredMainAxisContentExtentForChild(child); + LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child); + availableFreeSpace -= childSize - preferredChildSize; totalPositiveFlexibility -= child->style()->positiveFlex(); - totalNegativeFlexibility -= child->style()->negativeFlex(); + totalWeightedNegativeFlexibility -= child->style()->negativeFlex() * preferredChildSize; inflexibleItems.set(child, childSize); } } // Returns true if we successfully ran the algorithm and sized the flex items. -bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedFlexItemList& children, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize& inflexibleItems, WTF::Vector<LayoutUnit>& childSizes) +bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedFlexItemList& children, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize& inflexibleItems, WTF::Vector<LayoutUnit>& childSizes) { childSizes.clear(); LayoutUnit flexboxAvailableContentExtent = mainAxisContentExtent(); @@ -869,10 +871,10 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF else { LayoutUnit preferredChildSize = preferredMainAxisContentExtentForChild(child); LayoutUnit childSize = preferredChildSize; - if (availableFreeSpace > 0 && totalPositiveFlexibility > 0 && flexSign == PositiveFlexibility) + if (availableFreeSpace > 0 && totalPositiveFlexibility > 0 && flexSign == PositiveFlexibility && isfinite(totalPositiveFlexibility)) childSize += lroundf(availableFreeSpace * child->style()->positiveFlex() / totalPositiveFlexibility); - else if (availableFreeSpace < 0 && totalNegativeFlexibility > 0 && flexSign == NegativeFlexibility) - childSize += lroundf(availableFreeSpace * child->style()->negativeFlex() / totalNegativeFlexibility); + else if (availableFreeSpace < 0 && totalWeightedNegativeFlexibility > 0 && flexSign == NegativeFlexibility && isfinite(totalWeightedNegativeFlexibility)) + childSize += lroundf(availableFreeSpace * child->style()->negativeFlex() * preferredChildSize / totalWeightedNegativeFlexibility); LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(child, childSize, flexboxAvailableContentExtent); childSizes.append(adjustedChildSize); @@ -888,7 +890,7 @@ bool RenderFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF } if (totalViolation) - freezeViolations(totalViolation < 0 ? maxViolations : minViolations, availableFreeSpace, totalPositiveFlexibility, totalNegativeFlexibility, inflexibleItems); + freezeViolations(totalViolation < 0 ? maxViolations : minViolations, availableFreeSpace, totalPositiveFlexibility, totalWeightedNegativeFlexibility, inflexibleItems); else availableFreeSpace -= usedFreeSpace; diff --git a/Source/WebCore/rendering/RenderFlexibleBox.h b/Source/WebCore/rendering/RenderFlexibleBox.h index 8383a46b8..ae61d631f 100644 --- a/Source/WebCore/rendering/RenderFlexibleBox.h +++ b/Source/WebCore/rendering/RenderFlexibleBox.h @@ -113,11 +113,11 @@ private: void computeMainAxisPreferredSizes(bool relayoutChildren, FlexOrderHashSet&); LayoutUnit lineBreakLength(); LayoutUnit adjustChildSizeForMinAndMax(RenderBox*, LayoutUnit childSize, LayoutUnit flexboxAvailableContentExtent); - bool computeNextFlexLine(FlexOrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalNegativeFlexibility, LayoutUnit& minMaxAppliedMainAxisExtent); + bool computeNextFlexLine(FlexOrderIterator&, OrderedFlexItemList& orderedChildren, LayoutUnit& preferredMainAxisExtent, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, LayoutUnit& minMaxAppliedMainAxisExtent); LayoutUnit computeAvailableFreeSpace(LayoutUnit preferredMainAxisExtent); - bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); - void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalNegativeFlexibility, InflexibleFlexItemSize&); + bool resolveFlexibleLengths(FlexSign, const OrderedFlexItemList&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize&, WTF::Vector<LayoutUnit>& childSizes); + void freezeViolations(const WTF::Vector<Violation>&, LayoutUnit& availableFreeSpace, float& totalPositiveFlexibility, float& totalWeightedNegativeFlexibility, InflexibleFlexItemSize&); void setLogicalOverrideSize(RenderBox* child, LayoutUnit childPreferredSize); void prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset); diff --git a/Source/WebCore/rendering/RenderGeometryMap.cpp b/Source/WebCore/rendering/RenderGeometryMap.cpp new file mode 100644 index 000000000..65f189bb1 --- /dev/null +++ b/Source/WebCore/rendering/RenderGeometryMap.cpp @@ -0,0 +1,270 @@ +/* + * 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. + */ + +#include "config.h" +#include "RenderGeometryMap.h" + +#include "RenderView.h" +#include "TransformState.h" + +namespace WebCore { + + +// Stores data about how to map from one renderer to its container. +class RenderGeometryMapStep { + WTF_MAKE_NONCOPYABLE(RenderGeometryMapStep); +public: + RenderGeometryMapStep(const RenderObject* renderer, bool accumulatingTransform, bool isNonUniform, bool isFixedPosition, bool hasTransform) + : m_renderer(renderer) + , m_accumulatingTransform(accumulatingTransform) + , m_isNonUniform(isNonUniform) + , m_isFixedPosition(isFixedPosition) + , m_hasTransform(hasTransform) + { + } + + FloatPoint mapPoint(const FloatPoint& p) const + { + if (!m_transform) + return p + m_offset; + + return m_transform->mapPoint(p); + } + + FloatQuad mapQuad(const FloatQuad& quad) const + { + if (!m_transform) { + FloatQuad q = quad; + q.move(m_offset); + return q; + } + + return m_transform->mapQuad(quad); + } + + const RenderObject* m_renderer; + LayoutSize m_offset; + OwnPtr<TransformationMatrix> m_transform; // Includes offset if non-null. + bool m_accumulatingTransform; + bool m_isNonUniform; // Mapping depends on the input point, e.g. because of CSS columns. + bool m_isFixedPosition; + bool m_hasTransform; +}; + + +RenderGeometryMap::RenderGeometryMap() + : m_insertionPosition(notFound) + , m_nonUniformStepsCount(0) + , m_transformedStepsCount(0) + , m_fixedStepsCount(0) +{ +} + +RenderGeometryMap::~RenderGeometryMap() +{ +} + +FloatPoint RenderGeometryMap::absolutePoint(const FloatPoint& p) const +{ + FloatPoint result; + + if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep()) + result = p + m_accumulatedOffset; + else { + TransformState transformState(TransformState::ApplyTransformDirection, p); + mapToAbsolute(transformState); + result = transformState.lastPlanarPoint(); + } + +#if !ASSERT_DISABLED + FloatPoint rendererMappedResult = m_mapping.last()->m_renderer->localToAbsolute(p, false, true); + ASSERT(rendererMappedResult == result); +#endif + + return result; +} + +FloatRect RenderGeometryMap::absoluteRect(const FloatRect& rect) const +{ + FloatRect result; + + if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep()) { + result = rect; + result.move(m_accumulatedOffset); + } else { + TransformState transformState(TransformState::ApplyTransformDirection, rect.center(), rect); + mapToAbsolute(transformState); + result = transformState.lastPlanarQuad().boundingBox(); + } + +#if !ASSERT_DISABLED + FloatRect rendererMappedResult = m_mapping.last()->m_renderer->localToAbsoluteQuad(rect).boundingBox(); + // Inspector creates renderers with negative width <https://bugs.webkit.org/show_bug.cgi?id=87194>. + // Taking FloatQuad bounds avoids spurious assertions because of that. + ASSERT(enclosingIntRect(rendererMappedResult) == enclosingIntRect(FloatQuad(result).boundingBox())); +#endif + + return result; +} + +void RenderGeometryMap::mapToAbsolute(TransformState& transformState) const +{ + // If the mapping includes something like columns, we have to go via renderers. + if (hasNonUniformStep()) { + bool fixed = false; + m_mapping.last()->m_renderer->mapLocalToContainer(0, fixed, true, transformState, RenderObject::ApplyContainerFlip); + return; + } + + bool inFixed = false; + + for (int i = m_mapping.size() - 1; i >= 0; --i) { + const RenderGeometryMapStep* currStep = m_mapping[i].get(); + + if (currStep->m_hasTransform) { + // If this box has a transform, it acts as a fixed position container for fixed descendants, + // and may itself also be fixed position. So propagate 'fixed' up only if this box is fixed position. + inFixed &= currStep->m_isFixedPosition; + } else + inFixed |= currStep->m_isFixedPosition; + + if (!i) { + if (currStep->m_transform) + transformState.applyTransform(*currStep->m_transform.get()); + + // The root gets special treatment for fixed position + if (inFixed) + transformState.move(currStep->m_offset.width(), currStep->m_offset.height()); + } else { + TransformState::TransformAccumulation accumulate = currStep->m_accumulatingTransform ? TransformState::AccumulateTransform : TransformState::FlattenTransform; + if (currStep->m_transform) + transformState.applyTransform(*currStep->m_transform.get(), accumulate); + else + transformState.move(currStep->m_offset.width(), currStep->m_offset.height(), accumulate); + } + } + + transformState.flatten(); +} + +void RenderGeometryMap::pushMappingsToAncestor(const RenderObject* renderer, const RenderBoxModelObject* ancestor) +{ + const RenderObject* currRenderer = renderer; + + // We need to push mappings in reverse order here, so do insertions rather than appends. + m_insertionPosition = m_mapping.size(); + + do { + currRenderer = currRenderer->pushMappingToContainer(ancestor, *this); + } while (currRenderer && currRenderer != ancestor); + + m_insertionPosition = notFound; +} + +void RenderGeometryMap::push(const RenderObject* renderer, const LayoutSize& offsetFromContainer, bool accumulatingTransform, bool isNonUniform, bool isFixedPosition, bool hasTransform) +{ + ASSERT(m_insertionPosition != notFound); + + OwnPtr<RenderGeometryMapStep> step = adoptPtr(new RenderGeometryMapStep(renderer, accumulatingTransform, isNonUniform, isFixedPosition, hasTransform)); + step->m_offset = offsetFromContainer; + + stepInserted(*step.get()); + m_mapping.insert(m_insertionPosition, step.release()); +} + +void RenderGeometryMap::push(const RenderObject* renderer, const TransformationMatrix& t, bool accumulatingTransform, bool isNonUniform, bool isFixedPosition, bool hasTransform) +{ + ASSERT(m_insertionPosition != notFound); + + OwnPtr<RenderGeometryMapStep> step = adoptPtr(new RenderGeometryMapStep(renderer, accumulatingTransform, isNonUniform, isFixedPosition, hasTransform)); + step->m_transform = adoptPtr(new TransformationMatrix(t)); + + stepInserted(*step.get()); + m_mapping.insert(m_insertionPosition, step.release()); +} + +void RenderGeometryMap::pushView(const RenderView* view, const LayoutSize& scrollOffset, const TransformationMatrix* t) +{ + ASSERT(m_insertionPosition != notFound); + + OwnPtr<RenderGeometryMapStep> step = adoptPtr(new RenderGeometryMapStep(view, false, false, false, t)); + step->m_offset = scrollOffset; + if (t) + step->m_transform = adoptPtr(new TransformationMatrix(*t)); + + ASSERT(!m_mapping.size()); // The view should always be the first thing pushed. + stepInserted(*step.get()); + m_mapping.insert(m_insertionPosition, step.release()); +} + +void RenderGeometryMap::popMappingsToAncestor(const RenderBoxModelObject* ancestor) +{ + ASSERT(m_mapping.size()); + + while (m_mapping.size() && m_mapping.last()->m_renderer != ancestor) { + stepRemoved(*m_mapping.last().get()); + m_mapping.removeLast(); + } +} + +void RenderGeometryMap::stepInserted(const RenderGeometryMapStep& step) +{ + // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s + if (m_mapping.size()) + m_accumulatedOffset += step.m_offset; + + if (step.m_isNonUniform) + ++m_nonUniformStepsCount; + + if (step.m_transform) + ++m_transformedStepsCount; + + if (step.m_isFixedPosition) + ++m_fixedStepsCount; +} + +void RenderGeometryMap::stepRemoved(const RenderGeometryMapStep& step) +{ + // Offset on the first step is the RenderView's offset, which is only applied when we have fixed-position.s + if (m_mapping.size() > 1) + m_accumulatedOffset -= step.m_offset; + + if (step.m_isNonUniform) { + ASSERT(m_nonUniformStepsCount); + --m_nonUniformStepsCount; + } + + if (step.m_transform) { + ASSERT(m_transformedStepsCount); + --m_transformedStepsCount; + } + + if (step.m_isFixedPosition) { + ASSERT(m_fixedStepsCount); + --m_fixedStepsCount; + } +} + +} // namespace WebCore diff --git a/Source/WebCore/rendering/RenderGeometryMap.h b/Source/WebCore/rendering/RenderGeometryMap.h new file mode 100644 index 000000000..6a6120333 --- /dev/null +++ b/Source/WebCore/rendering/RenderGeometryMap.h @@ -0,0 +1,85 @@ +/* + * 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 RenderGeometryMap_h +#define RenderGeometryMap_h + +#include "FloatPoint.h" +#include "FloatQuad.h" +#include "IntSize.h" +#include "RenderObject.h" +#include "TransformationMatrix.h" +#include <wtf/OwnPtr.h> + +namespace WebCore { + +class RenderGeometryMapStep; + +// Can be used while walking the Renderer tree to cache data about offsets and transforms. +class RenderGeometryMap { +public: + RenderGeometryMap(); + ~RenderGeometryMap(); + + FloatPoint absolutePoint(const FloatPoint&) const; + FloatRect absoluteRect(const FloatRect&) const; + + // Called by code walking the renderer or layer trees. + void pushMappingsToAncestor(const RenderObject*, const RenderBoxModelObject* ancestor); + void popMappingsToAncestor(const RenderBoxModelObject*); + + // The following methods should only be called by renderers inside a call to pushMappingsToAncestor(). + + // Push geometry info between this renderer and some ancestor. The ancestor must be its container() or some + // stacking context between the renderer and its container. + void push(const RenderObject*, const LayoutSize&, bool accumulatingTransform = false, bool isNonUniform = false, bool isFixedPosition = false, bool hasTransform = false); + void push(const RenderObject*, const TransformationMatrix&, bool accumulatingTransform = false, bool isNonUniform = false, bool isFixedPosition = false, bool hasTransform = false); + + // RenderView gets special treatment, because it applies the scroll offset only for elements inside in fixed position. + void pushView(const RenderView*, const LayoutSize& scrollOffset, const TransformationMatrix* = 0); + +private: + void mapToAbsolute(TransformState&) const; + + void stepInserted(const RenderGeometryMapStep&); + void stepRemoved(const RenderGeometryMapStep&); + + bool hasNonUniformStep() const { return m_nonUniformStepsCount; } + bool hasTransformStep() const { return m_transformedStepsCount; } + bool hasFixedPositionStep() const { return m_fixedStepsCount; } + + typedef Vector<OwnPtr<RenderGeometryMapStep> > RenderGeometryMapSteps; // FIXME: inline capacity? + + size_t m_insertionPosition; + int m_nonUniformStepsCount; + int m_transformedStepsCount; + int m_fixedStepsCount; + RenderGeometryMapSteps m_mapping; + LayoutSize m_accumulatedOffset; +}; + +} // namespace WebCore + +#endif // RenderGeometryMap_h diff --git a/Source/WebCore/rendering/RenderInline.cpp b/Source/WebCore/rendering/RenderInline.cpp index 0c88749f7..b8928161e 100644 --- a/Source/WebCore/rendering/RenderInline.cpp +++ b/Source/WebCore/rendering/RenderInline.cpp @@ -32,6 +32,7 @@ #include "RenderArena.h" #include "RenderBlock.h" #include "RenderFlowThread.h" +#include "RenderGeometryMap.h" #include "RenderLayer.h" #include "RenderTheme.h" #include "RenderView.h" @@ -1065,7 +1066,7 @@ void RenderInline::computeRectForRepaint(RenderBoxModelObject* repaintContainer, o->computeRectForRepaint(repaintContainer, rect, fixed); } -LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const LayoutPoint& point) const +LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const LayoutPoint& point, bool* offsetDependsOnPoint) const { ASSERT(container == this->container()); @@ -1078,6 +1079,9 @@ LayoutSize RenderInline::offsetFromContainer(RenderObject* container, const Layo if (container->hasOverflowClip()) offset -= toRenderBox(container)->scrolledContentOffset(); + if (offsetDependsOnPoint) + *offsetDependsOnPoint = container->hasColumns() || (container->isBox() && container->style()->isFlippedBlocksWritingMode()); + return offset; } @@ -1129,6 +1133,39 @@ void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed); } +const RenderObject* RenderInline::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + ASSERT(ancestorToStopAt != this); + + bool ancestorSkipped; + RenderObject* container = this->container(ancestorToStopAt, &ancestorSkipped); + if (!container) + return 0; + + LayoutSize adjustmentForSkippedAncestor; + if (ancestorSkipped) { + // There can't be a transform between repaintContainer and o, because transforms create containers, so it should be safe + // to just subtract the delta between the ancestor and o. + adjustmentForSkippedAncestor = -ancestorToStopAt->offsetFromAncestorContainer(container); + } + + bool offsetDependsOnPoint = false; + LayoutSize containerOffset = offsetFromContainer(container, LayoutPoint(), &offsetDependsOnPoint); + + bool preserve3D = container->style()->preserves3D() || style()->preserves3D(); + if (shouldUseTransformFromContainer(container)) { + TransformationMatrix t; + getTransformFromContainer(container, containerOffset, t); + t.translateRight(adjustmentForSkippedAncestor.width(), adjustmentForSkippedAncestor.height()); // FIXME: right? + geometryMap.push(this, t, preserve3D, offsetDependsOnPoint); + } else { + containerOffset += adjustmentForSkippedAncestor; + geometryMap.push(this, containerOffset, preserve3D, offsetDependsOnPoint); + } + + return ancestorSkipped ? ancestorToStopAt : container; +} + void RenderInline::updateDragState(bool dragOn) { RenderBoxModelObject::updateDragState(dragOn); diff --git a/Source/WebCore/rendering/RenderInline.h b/Source/WebCore/rendering/RenderInline.h index 2363f0b0a..4187f3187 100644 --- a/Source/WebCore/rendering/RenderInline.h +++ b/Source/WebCore/rendering/RenderInline.h @@ -49,7 +49,7 @@ public: virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const; virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; - virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; + virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const; IntRect linesBoundingBox() const; LayoutRect linesVisualOverflowBoundingBox() const; @@ -134,6 +134,7 @@ private: virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed) const; virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual VisiblePosition positionForPoint(const LayoutPoint&); diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp index 39afa3053..e0b56e7e5 100644 --- a/Source/WebCore/rendering/RenderLayer.cpp +++ b/Source/WebCore/rendering/RenderLayer.cpp @@ -125,25 +125,6 @@ using namespace HTMLNames; const int MinimumWidthWhileResizing = 100; const int MinimumHeightWhileResizing = 40; -void* ClipRects::operator new(size_t sz, RenderArena* renderArena) -{ - return renderArena->allocate(sz); -} - -void ClipRects::operator delete(void* ptr, size_t sz) -{ - // Stash size where destroy can find it. - *(size_t *)ptr = sz; -} - -void ClipRects::destroy(RenderArena* renderArena) -{ - delete this; - - // Recover the size left there for us by operator delete and free the memory. - renderArena->free(*(size_t *)this, this); -} - RenderLayer::RenderLayer(RenderBoxModelObject* renderer) : m_inResizeMode(false) , m_scrollDimensionsDirty(true) @@ -180,10 +161,6 @@ RenderLayer::RenderLayer(RenderBoxModelObject* renderer) , m_posZOrderList(0) , m_negZOrderList(0) , m_normalFlowList(0) - , m_clipRects(0) -#ifndef NDEBUG - , m_clipRectsRoot(0) -#endif , m_marquee(0) , m_staticInlinePosition(0) , m_staticBlockPosition(0) @@ -252,9 +229,6 @@ RenderLayer::~RenderLayer() clearBacking(true); #endif - // Make sure we have no lingering clip rects. - ASSERT(!m_clipRects); - if (m_scrollCorner) m_scrollCorner->destroy(); if (m_resizer) @@ -534,6 +508,9 @@ void RenderLayer::updateTransform() m_transform = adoptPtr(new TransformationMatrix); else m_transform.clear(); + + // Layers with transforms act as clip rects roots, so clear the cached clip rects here. + clearClipRectsIncludingDescendants(); } if (hasTransform) { @@ -1070,7 +1047,7 @@ void RenderLayer::setFilterBackendNeedsRepaintingInRect(const LayoutRect& rect, } #endif -RenderLayer* RenderLayer::clippingRoot() const +RenderLayer* RenderLayer::clippingRootForPainting() const { #if USE(ACCELERATED_COMPOSITING) if (isComposited()) @@ -2935,7 +2912,7 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* context, // Make sure the parent's clip rects have been calculated. ClipRect clipRect = paintDirtyRect; if (parent()) { - clipRect = backgroundClipRect(rootLayer, region, paintFlags & PaintLayerTemporaryClipRects); + clipRect = backgroundClipRect(rootLayer, region, (paintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects); clipRect.intersect(paintDirtyRect); // Push the parent coordinate space's clip. @@ -3044,7 +3021,7 @@ void RenderLayer::paintLayerContents(RenderLayer* rootLayer, GraphicsContext* co #endif if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) { - calculateRects(rootLayer, region, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, localPaintFlags & PaintLayerTemporaryClipRects); + calculateRects(rootLayer, region, (localPaintFlags & PaintLayerTemporaryClipRects) ? TemporaryClipRects : PaintingClipRects, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); paintOffset = toPoint(layerBounds.location() - renderBoxLocation()); } @@ -3452,11 +3429,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont { // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate. - bool useTemporaryClipRects = false; -#if USE(ACCELERATED_COMPOSITING) - useTemporaryClipRects = compositor()->inCompositingMode(); -#endif - useTemporaryClipRects |= renderer()->view()->frameView()->containsScrollableAreaWithOverlayScrollbars(); + bool useTemporaryClipRects = renderer()->view()->frameView()->containsScrollableAreaWithOverlayScrollbars(); LayoutRect hitTestArea = result.rectForPoint(hitTestPoint); @@ -3464,7 +3437,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont if (transform() && !appliedTransform) { // Make sure the parent's clip rects have been calculated. if (parent()) { - ClipRect clipRect = backgroundClipRect(rootLayer, result.region(), useTemporaryClipRects, IncludeOverlayScrollbarSize); + ClipRect clipRect = backgroundClipRect(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, IncludeOverlayScrollbarSize); // Go ahead and test the enclosing clip now. if (!clipRect.intersects(hitTestArea)) return 0; @@ -3525,7 +3498,7 @@ RenderLayer* RenderLayer::hitTestLayer(RenderLayer* rootLayer, RenderLayer* cont ClipRect bgRect; ClipRect fgRect; ClipRect outlineRect; - calculateRects(rootLayer, result.region(), hitTestRect, layerBounds, bgRect, fgRect, outlineRect, useTemporaryClipRects, IncludeOverlayScrollbarSize); + calculateRects(rootLayer, result.region(), useTemporaryClipRects ? TemporaryClipRects : RootRelativeClipRects, hitTestRect, layerBounds, bgRect, fgRect, outlineRect, IncludeOverlayScrollbarSize); // The following are used for keeping track of the z-depth of the hit point of 3d-transformed // descendants. @@ -3796,10 +3769,11 @@ RenderLayer* RenderLayer::hitTestChildLayerColumns(RenderLayer* childLayer, Rend return 0; } -void RenderLayer::updateClipRects(const RenderLayer* rootLayer, RenderRegion* region, OverlayScrollbarSizeRelevancy relevancy) +void RenderLayer::updateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy) { - if (m_clipRects) { - ASSERT(rootLayer == m_clipRectsRoot); + ASSERT(clipRectsType < NumCachedClipRectsTypes); + if (m_clipRectsCache && m_clipRectsCache->m_clipRects[clipRectsType]) { + ASSERT(rootLayer == m_clipRectsCache->m_clipRectsRoot[clipRectsType]); return; // We have the correct cached value. } @@ -3807,29 +3781,34 @@ void RenderLayer::updateClipRects(const RenderLayer* rootLayer, RenderRegion* re // examine the parent. We want to cache clip rects with us as the root. RenderLayer* parentLayer = rootLayer != this ? parent() : 0; if (parentLayer) - parentLayer->updateClipRects(rootLayer, region, relevancy); + parentLayer->updateClipRects(rootLayer, region, clipRectsType, relevancy); ClipRects clipRects; - calculateClipRects(rootLayer, region, clipRects, true, relevancy); + calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy); - if (parentLayer && parentLayer->clipRects() && clipRects == *parentLayer->clipRects()) - m_clipRects = parentLayer->clipRects(); + if (!m_clipRectsCache) + m_clipRectsCache = adoptPtr(new ClipRectsCache); + + if (parentLayer && parentLayer->clipRects(clipRectsType) && clipRects == *parentLayer->clipRects(clipRectsType)) + m_clipRectsCache->m_clipRects[clipRectsType] = parentLayer->clipRects(clipRectsType); else - m_clipRects = new (renderer()->renderArena()) ClipRects(clipRects); - m_clipRects->ref(); + m_clipRectsCache->m_clipRects[clipRectsType] = ClipRects::create(clipRects); + + m_clipRectsCache->m_clipRects[clipRectsType]->ref(); #ifndef NDEBUG - m_clipRectsRoot = rootLayer; + m_clipRectsCache->m_clipRectsRoot[clipRectsType] = rootLayer; #endif } -void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRects& clipRects, - bool useCached, OverlayScrollbarSizeRelevancy relevancy) const +void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy) const { if (!parent()) { // The root layer's clip rect is always infinite. clipRects.reset(PaintInfo::infiniteRect()); return; } + + bool useCached = clipRectsType != TemporaryClipRects; // For transformed layers, the root layer was shifted to be us, so there is no need to // examine the parent. We want to cache clip rects with us as the root. @@ -3837,10 +3816,10 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* // Ensure that our parent's clip has been calculated so that we can examine the values. if (parentLayer) { - if (useCached && parentLayer->clipRects()) - clipRects = *parentLayer->clipRects(); + if (useCached && parentLayer->clipRects(clipRectsType)) + clipRects = *parentLayer->clipRects(clipRectsType); else - parentLayer->calculateClipRects(rootLayer, region, clipRects); + parentLayer->calculateClipRects(rootLayer, region, clipRectsType, clipRects); } else clipRects.reset(PaintInfo::infiniteRect()); @@ -3888,16 +3867,16 @@ void RenderLayer::calculateClipRects(const RenderLayer* rootLayer, RenderRegion* } } -void RenderLayer::parentClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRects& clipRects, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const +void RenderLayer::parentClipRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, ClipRects& clipRects, OverlayScrollbarSizeRelevancy relevancy) const { ASSERT(parent()); - if (temporaryClipRects) { - parent()->calculateClipRects(rootLayer, region, clipRects, false, relevancy); + if (clipRectsType == TemporaryClipRects) { + parent()->calculateClipRects(rootLayer, region, clipRectsType, clipRects, relevancy); return; } - parent()->updateClipRects(rootLayer, region, relevancy); - clipRects = *parent()->clipRects(); + parent()->updateClipRects(rootLayer, region, clipRectsType, relevancy); + clipRects = *parent()->clipRects(clipRectsType); } static inline ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPosition position) @@ -3911,11 +3890,11 @@ static inline ClipRect backgroundClipRectForPosition(const ClipRects& parentRect return parentRects.overflowClipRect(); } -ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, RenderRegion* region, bool temporaryClipRects, OverlayScrollbarSizeRelevancy relevancy) const +ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, OverlayScrollbarSizeRelevancy relevancy) const { ASSERT(parent()); ClipRects parentRects; - parentClipRects(rootLayer, region, parentRects, temporaryClipRects, relevancy); + parentClipRects(rootLayer, region, clipRectsType, parentRects, relevancy); ClipRect backgroundClipRect = backgroundClipRectForPosition(parentRects, renderer()->style()->position()); RenderView* view = renderer()->view(); ASSERT(view); @@ -3927,12 +3906,11 @@ ClipRect RenderLayer::backgroundClipRect(const RenderLayer* rootLayer, RenderReg return backgroundClipRect; } -void RenderLayer::calculateRects(const RenderLayer* rootLayer, RenderRegion* region, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, - ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, bool temporaryClipRects, - OverlayScrollbarSizeRelevancy relevancy) const +void RenderLayer::calculateRects(const RenderLayer* rootLayer, RenderRegion* region, ClipRectsType clipRectsType, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, + ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, OverlayScrollbarSizeRelevancy relevancy) const { if (rootLayer != this && parent()) { - backgroundRect = backgroundClipRect(rootLayer, region, temporaryClipRects, relevancy); + backgroundRect = backgroundClipRect(rootLayer, region, clipRectsType, relevancy); backgroundRect.intersect(paintDirtyRect); } else backgroundRect = paintDirtyRect; @@ -3985,10 +3963,10 @@ LayoutRect RenderLayer::childrenClipRect() const // FIXME: border-radius not accounted for. // FIXME: Regions not accounted for. RenderView* renderView = renderer()->view(); - RenderLayer* clippingRootLayer = clippingRoot(); + RenderLayer* clippingRootLayer = clippingRootForPainting(); LayoutRect layerBounds; ClipRect backgroundRect, foregroundRect, outlineRect; - calculateRects(clippingRootLayer, 0, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); + calculateRects(clippingRootLayer, 0, PaintingClipRects, renderView->unscaledDocumentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregroundRect.rect())).enclosingBoundingBox(); } @@ -3997,10 +3975,10 @@ LayoutRect RenderLayer::selfClipRect() const // FIXME: border-radius not accounted for. // FIXME: Regions not accounted for. RenderView* renderView = renderer()->view(); - RenderLayer* clippingRootLayer = clippingRoot(); + RenderLayer* clippingRootLayer = clippingRootForPainting(); LayoutRect layerBounds; ClipRect backgroundRect, foregroundRect, outlineRect; - calculateRects(clippingRootLayer, 0, renderView->documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); + calculateRects(clippingRootLayer, 0, PaintingClipRects, renderView->documentRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(backgroundRect.rect())).enclosingBoundingBox(); } @@ -4008,10 +3986,10 @@ LayoutRect RenderLayer::localClipRect() const { // FIXME: border-radius not accounted for. // FIXME: Regions not accounted for. - RenderLayer* clippingRootLayer = clippingRoot(); + RenderLayer* clippingRootLayer = clippingRootForPainting(); LayoutRect layerBounds; ClipRect backgroundRect, foregroundRect, outlineRect; - calculateRects(clippingRootLayer, 0, PaintInfo::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); + calculateRects(clippingRootLayer, 0, PaintingClipRects, PaintInfo::infiniteRect(), layerBounds, backgroundRect, foregroundRect, outlineRect); LayoutRect clipRect = backgroundRect.rect(); if (clipRect == PaintInfo::infiniteRect()) @@ -4259,25 +4237,25 @@ IntRect RenderLayer::calculateLayerBounds(const RenderLayer* layer, const Render return pixelSnappedIntRect(unionBounds); } -void RenderLayer::clearClipRectsIncludingDescendants() +void RenderLayer::clearClipRectsIncludingDescendants(ClipRectsType typeToClear) { - if (!m_clipRects) + // FIXME: it's not clear how this layer not having clip rects guarantees that no descendants have any. + if (!m_clipRectsCache) return; - clearClipRects(); + clearClipRects(typeToClear); for (RenderLayer* l = firstChild(); l; l = l->nextSibling()) - l->clearClipRectsIncludingDescendants(); + l->clearClipRectsIncludingDescendants(typeToClear); } -void RenderLayer::clearClipRects() +void RenderLayer::clearClipRects(ClipRectsType typeToClear) { - if (m_clipRects) { - m_clipRects->deref(renderer()->renderArena()); - m_clipRects = 0; -#ifndef NDEBUG - m_clipRectsRoot = 0; -#endif + if (typeToClear == AllClipRectTypes) + m_clipRectsCache = nullptr; + else { + ASSERT(typeToClear < NumCachedClipRectsTypes); + m_clipRectsCache->m_clipRects[typeToClear] = nullptr; } } diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h index 860a37290..ad23af708 100644 --- a/Source/WebCore/rendering/RenderLayer.h +++ b/Source/WebCore/rendering/RenderLayer.h @@ -129,27 +129,19 @@ inline ClipRect intersection(const ClipRect& a, const ClipRect& b) class ClipRects { public: - ClipRects() - : m_refCnt(0) - , m_fixed(false) + static PassRefPtr<ClipRects> create() { + return adoptRef(new ClipRects); } - ClipRects(const LayoutRect& r) - : m_overflowClipRect(r) - , m_fixedClipRect(r) - , m_posClipRect(r) - , m_refCnt(0) - , m_fixed(false) + static PassRefPtr<ClipRects> create(const ClipRects& other) { + return adoptRef(new ClipRects(other)); } - ClipRects(const ClipRects& other) - : m_overflowClipRect(other.overflowClipRect()) - , m_fixedClipRect(other.fixedClipRect()) - , m_posClipRect(other.posClipRect()) - , m_refCnt(0) - , m_fixed(other.fixed()) + ClipRects() + : m_refCnt(0) + , m_fixed(false) { } @@ -174,15 +166,11 @@ public: void setFixed(bool fixed) { m_fixed = fixed; } void ref() { m_refCnt++; } - void deref(RenderArena* renderArena) { if (--m_refCnt == 0) destroy(renderArena); } - - void destroy(RenderArena*); - - // Overloaded new operator. - void* operator new(size_t, RenderArena*); - - // Overridden to prevent the normal delete from being called. - void operator delete(void*, size_t); + void deref() + { + if (!--m_refCnt) + delete this; + } bool operator==(const ClipRects& other) const { @@ -202,10 +190,24 @@ public: } private: - // The normal operator new is disallowed on all render objects. - void* operator new(size_t) throw(); + ClipRects(const LayoutRect& r) + : m_overflowClipRect(r) + , m_fixedClipRect(r) + , m_posClipRect(r) + , m_refCnt(0) + , m_fixed(false) + { + } + + ClipRects(const ClipRects& other) + : m_overflowClipRect(other.overflowClipRect()) + , m_fixedClipRect(other.fixedClipRect()) + , m_posClipRect(other.posClipRect()) + , m_refCnt(0) + , m_fixed(other.fixed()) + { + } -private: ClipRect m_overflowClipRect; ClipRect m_fixedClipRect; ClipRect m_posClipRect; @@ -213,6 +215,30 @@ private: bool m_fixed : 1; }; +enum ClipRectsType { + PaintingClipRects, // Relative to painting ancestor. Used for painting. + RootRelativeClipRects, // Relative to the ancestor treated as the root (e.g. transformed layer). Used for hit testing. + AbsoluteClipRects, // Relative to the RenderView's layer. Used for compositing overlap testing. + NumCachedClipRectsTypes, + AllClipRectTypes, + TemporaryClipRects +}; + +struct ClipRectsCache { + ClipRectsCache() + { +#ifndef NDEBUG + for (int i = 0; i < NumCachedClipRectsTypes; ++i) + m_clipRectsRoot[i] = 0; +#endif + } + + RefPtr<ClipRects> m_clipRects[NumCachedClipRectsTypes]; +#ifndef NDEBUG + const RenderLayer* m_clipRectsRoot[NumCachedClipRectsTypes]; +#endif +}; + class RenderLayer : public ScrollableArea { public: friend class RenderReplica; @@ -371,8 +397,8 @@ public: const LayoutSize& relativePositionOffset() const { return m_relativeOffset; } - void clearClipRectsIncludingDescendants(); - void clearClipRects(); + void clearClipRectsIncludingDescendants(ClipRectsType typeToClear = AllClipRectTypes); + void clearClipRects(ClipRectsType typeToClear = AllClipRectTypes); void addBlockSelectionGapsBounds(const LayoutRect&); void clearBlockSelectionGapsBounds(); @@ -423,7 +449,7 @@ public: RenderLayer* enclosingScrollableLayer() const; // The layer relative to which clipping rects for this layer are computed. - RenderLayer* clippingRoot() const; + RenderLayer* clippingRootForPainting() const; #if USE(ACCELERATED_COMPOSITING) // Enclosing compositing layer; if includeSelf is true, may return this. @@ -472,16 +498,17 @@ public: // This method figures out our layerBounds in coordinates relative to // |rootLayer}. It also computes our background and foreground clip rects // for painting/event handling. - void calculateRects(const RenderLayer* rootLayer, RenderRegion*, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, + void calculateRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds, ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, - bool temporaryClipRects = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; + OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; // Compute and cache clip rects computed with the given layer as the root - void updateClipRects(const RenderLayer* rootLayer, RenderRegion*, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize); + void updateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize); // Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors // (rather than computing them all from scratch up the parent chain). - void calculateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRects&, bool useCached = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; - ClipRects* clipRects() const { return m_clipRects; } + void calculateClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; + + ClipRects* clipRects(ClipRectsType type) const { ASSERT(type < NumCachedClipRectsTypes); return m_clipRectsCache ? m_clipRectsCache->m_clipRects[type].get() : 0; } LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space. LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space. @@ -767,8 +794,8 @@ private: void updateOrRemoveFilterEffect(); #endif - void parentClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRects&, bool temporaryClipRects = false, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; - ClipRect backgroundClipRect(const RenderLayer* rootLayer, RenderRegion*, bool temporaryClipRects, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; + void parentClipRects(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, ClipRects&, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; + ClipRect backgroundClipRect(const RenderLayer* rootLayer, RenderRegion*, ClipRectsType, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const; LayoutRect paintingExtent(const RenderLayer* rootLayer, const LayoutRect& paintDirtyRect, PaintBehavior); RenderLayer* enclosingTransformedAncestor() const; @@ -905,11 +932,8 @@ protected: // overflow layers, but that may change in the future. Vector<RenderLayer*>* m_normalFlowList; - ClipRects* m_clipRects; // Cached clip rects used when painting and hit testing. -#ifndef NDEBUG - const RenderLayer* m_clipRectsRoot; // Root layer used to compute clip rects. -#endif - + OwnPtr<ClipRectsCache> m_clipRectsCache; + IntPoint m_cachedOverlayScrollbarOffset; RenderMarquee* m_marquee; // Used by layers with overflow:marquee diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp index ee39912a9..1085eabc0 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.cpp +++ b/Source/WebCore/rendering/RenderLayerBacking.cpp @@ -267,7 +267,7 @@ void RenderLayerBacking::updateCompositedBounds() LayoutRect clippingBounds = view->unscaledDocumentRect(); if (m_owningLayer != rootLayer) - clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, 0, true).rect()); // FIXME: Incorrect for CSS regions. + clippingBounds.intersect(m_owningLayer->backgroundClipRect(rootLayer, 0, AbsoluteClipRects).rect()); // FIXME: Incorrect for CSS regions. LayoutPoint delta; m_owningLayer->convertToLayerCoords(rootLayer, delta); @@ -465,7 +465,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry() // Call calculateRects to get the backgroundRect which is what is used to clip the contents of this // layer. Note that we call it with temporaryClipRects = true because normally when computing clip rects // for a compositing layer, rootLayer is the layer itself. - IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(compAncestor, 0, true).rect()); // FIXME: Incorrect for CSS regions. + IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer->backgroundClipRect(compAncestor, 0, TemporaryClipRects).rect()); // FIXME: Incorrect for CSS regions. ASSERT(parentClipRect != PaintInfo::infiniteRect()); m_ancestorClippingLayer->setPosition(FloatPoint() + (parentClipRect.location() - graphicsLayerParentLocation)); m_ancestorClippingLayer->setSize(parentClipRect.size()); @@ -1112,6 +1112,17 @@ bool RenderLayerBacking::paintsIntoWindow() const return false; } +void RenderLayerBacking::setRequiresOwnBackingStore(bool flag) +{ + if (flag == m_requiresOwnBackingStore) + return; + + // This affects the answer to paintsIntoCompositedAncestor(), which in turn affects + // cached clip rects, so when it changes we have to clear clip rects on descendants. + m_owningLayer->clearClipRectsIncludingDescendants(PaintingClipRects); + m_requiresOwnBackingStore = flag; +} + void RenderLayerBacking::setContentsNeedDisplay() { ASSERT(!paintsIntoCompositedAncestor()); diff --git a/Source/WebCore/rendering/RenderLayerBacking.h b/Source/WebCore/rendering/RenderLayerBacking.h index a6a03ac77..d8718858e 100644 --- a/Source/WebCore/rendering/RenderLayerBacking.h +++ b/Source/WebCore/rendering/RenderLayerBacking.h @@ -101,7 +101,7 @@ public: // paints into some ancestor layer. bool paintsIntoCompositedAncestor() const { return !m_requiresOwnBackingStore; } - void setRequiresOwnBackingStore(bool flag) { m_requiresOwnBackingStore = flag; } + void setRequiresOwnBackingStore(bool); void setContentsNeedDisplay(); // r is in the coordinate space of the layer's render object diff --git a/Source/WebCore/rendering/RenderLayerCompositor.cpp b/Source/WebCore/rendering/RenderLayerCompositor.cpp index c402b593d..2a9d2ab07 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.cpp +++ b/Source/WebCore/rendering/RenderLayerCompositor.cpp @@ -45,6 +45,7 @@ #include "RenderApplet.h" #include "RenderEmbeddedObject.h" #include "RenderFullScreen.h" +#include "RenderGeometryMap.h" #include "RenderIFrame.h" #include "RenderLayerBacking.h" #include "RenderReplica.h" @@ -54,6 +55,7 @@ #include "ScrollingCoordinator.h" #include "Settings.h" #include "TiledBacking.h" +#include "TransformState.h" #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) #include "HTMLMediaElement.h" @@ -398,9 +400,10 @@ void RenderLayerCompositor::updateCompositingLayers(CompositingUpdateType update bool layersChanged = false; if (m_compositingConsultsOverlap) { OverlapMap overlapTestRequestMap; - computeCompositingRequirements(updateRoot, &overlapTestRequestMap, compState, layersChanged); + RenderGeometryMap geometryMap; + computeCompositingRequirements(0, updateRoot, &geometryMap, &overlapTestRequestMap, compState, layersChanged); } else - computeCompositingRequirements(updateRoot, 0, compState, layersChanged); + computeCompositingRequirements(0, updateRoot, 0, 0, compState, layersChanged); needHierarchyUpdate |= layersChanged; } @@ -537,6 +540,9 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR if (innerCompositor && innerCompositor->inCompositingMode()) innerCompositor->updateRootLayerAttachment(); } + + if (layerChanged) + layer->clearClipRectsIncludingDescendants(PaintingClipRects); return layerChanged; } @@ -624,33 +630,37 @@ RenderLayer* RenderLayerCompositor::enclosingNonStackingClippingLayer(const Rend return 0; } -void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) +void RenderLayerCompositor::addToOverlapMap(RenderGeometryMap& geometryMap, OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) { if (layer->isRootLayer()) return; if (!boundsComputed) { - layerBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox(); + layerBounds = enclosingIntRect(geometryMap.absoluteRect(layer->localBoundingBox())); // Empty rects never intersect, but we need them to for the purposes of overlap testing. if (layerBounds.isEmpty()) layerBounds.setSize(IntSize(1, 1)); boundsComputed = true; } - IntRect clipRect = pixelSnappedIntRect(layer->backgroundClipRect(rootRenderLayer(), 0, true).rect()); // FIXME: Incorrect for CSS regions. + IntRect clipRect = pixelSnappedIntRect(layer->backgroundClipRect(rootRenderLayer(), 0, AbsoluteClipRects).rect()); // FIXME: Incorrect for CSS regions. clipRect.scale(pageScaleFactor()); clipRect.intersect(layerBounds); overlapMap.add(layer, clipRect); } -void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, RenderLayer* layer) +void RenderLayerCompositor::addToOverlapMapRecursive(RenderGeometryMap& geometryMap, OverlapMap& overlapMap, RenderLayer* layer, RenderLayer* ancestorLayer) { if (!canBeComposited(layer) || overlapMap.contains(layer)) return; + // A null ancestorLayer is an indication that 'layer' has already been pushed. + if (ancestorLayer) + geometryMap.pushMappingsToAncestor(layer->renderer(), ancestorLayer->renderer()); + IntRect bounds; bool haveComputedBounds = false; - addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); + addToOverlapMap(geometryMap, overlapMap, layer, bounds, haveComputedBounds); #if !ASSERT_DISABLED LayerListMutationDetector mutationChecker(layer); @@ -661,7 +671,7 @@ void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, Ren size_t listSize = negZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); - addToOverlapMapRecursive(overlapMap, curLayer); + addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); } } } @@ -670,7 +680,7 @@ void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, Ren size_t listSize = normalFlowList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); - addToOverlapMapRecursive(overlapMap, curLayer); + addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); } } @@ -679,10 +689,13 @@ void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, Ren size_t listSize = posZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); - addToOverlapMapRecursive(overlapMap, curLayer); + addToOverlapMapRecursive(geometryMap, overlapMap, curLayer, layer); } } } + + if (ancestorLayer) + geometryMap.popMappingsToAncestor(ancestorLayer->renderer()); } // Recurse through the layers in z-index and overflow order (which is equivalent to painting order) @@ -694,11 +707,14 @@ void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, Ren // must be compositing so that its contents render over that child. // This implies that its positive z-index children must also be compositing. // -void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged) +void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, RenderGeometryMap* geometryMap, OverlapMap* overlapMap, CompositingState& compositingState, bool& layersChanged) { - layer->updateLayerPosition(); layer->updateLayerListsIfNeeded(); - + + // Should geometryMap be part of the overlap map? + if (geometryMap) + geometryMap->pushMappingsToAncestor(layer->renderer(), ancestorLayer ? ancestorLayer->renderer() : 0); + // Clear the flag layer->setHasCompositingDescendant(false); @@ -708,7 +724,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O IntRect absBounds; if (overlapMap && !overlapMap->isEmpty() && compositingState.m_testingOverlap) { // If we're testing for overlap, we only need to composite if we overlap something that is already composited. - absBounds = layer->renderer()->localToAbsoluteQuad(FloatRect(layer->localBoundingBox())).enclosingBoundingBox(); + absBounds = enclosingIntRect(geometryMap->absoluteRect(layer->localBoundingBox())); + // Empty rects never intersect, but we need them to for the purposes of overlap testing. if (absBounds.isEmpty()) absBounds.setSize(IntSize(1, 1)); @@ -757,7 +774,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O size_t listSize = negZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = negZOrderList->at(i); - computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); // If we have to make a layer for this child, make one now so we can have a contents layer // (since we need to ensure that the -ve z-order child renders underneath our contents). @@ -777,7 +794,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O size_t listSize = normalFlowList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = normalFlowList->at(i); - computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); } } @@ -786,7 +803,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O size_t listSize = posZOrderList->size(); for (size_t i = 0; i < listSize; ++i) { RenderLayer* curLayer = posZOrderList->at(i); - computeCompositingRequirements(curLayer, overlapMap, childState, layersChanged); + computeCompositingRequirements(layer, curLayer, geometryMap, overlapMap, childState, layersChanged); } } } @@ -803,7 +820,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O // the overlap map. Layers that do not composite will draw into their // compositing ancestor's backing, and so are still considered for overlap. if (overlapMap && childState.m_compositingAncestor && !childState.m_compositingAncestor->isRootLayer()) - addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); + addToOverlapMap(*geometryMap, *overlapMap, layer, absBounds, haveComputedBounds); // If we have a software transform, and we have layers under us, we need to also // be composited. Also, if we have opacity < 1, then we need to be a layer so that @@ -813,7 +830,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O childState.m_compositingAncestor = layer; if (overlapMap) { overlapMap->pushCompositingContainer(); - addToOverlapMapRecursive(*overlapMap, layer); + addToOverlapMapRecursive(*geometryMap, *overlapMap, layer); } willBeComposited = true; } @@ -842,7 +859,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O childState.m_compositingAncestor = layer; if (overlapMap) { overlapMap->pushCompositingContainer(); - addToOverlapMapRecursive(*overlapMap, layer); + addToOverlapMapRecursive(*geometryMap, *overlapMap, layer); } willBeComposited = true; } @@ -873,6 +890,9 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* layer, O if (layer->reflectionLayer() && updateLayerCompositingState(layer->reflectionLayer(), CompositingChangeRepaintNow)) layersChanged = true; + + if (geometryMap) + geometryMap->popMappingsToAncestor(ancestorLayer ? ancestorLayer->renderer() : 0); } void RenderLayerCompositor::setCompositingParent(RenderLayer* childLayer, RenderLayer* parentLayer) @@ -1536,7 +1556,7 @@ bool RenderLayerCompositor::clippedByAncestor(RenderLayer* layer) const if (!computeClipRoot || computeClipRoot == layer) return false; - return layer->backgroundClipRect(computeClipRoot, 0, true).rect() != PaintInfo::infiniteRect(); // FIXME: Incorrect for CSS regions. + return layer->backgroundClipRect(computeClipRoot, 0, TemporaryClipRects).rect() != PaintInfo::infiniteRect(); // FIXME: Incorrect for CSS regions. } // Return true if the given layer is a stacking context and has compositing child diff --git a/Source/WebCore/rendering/RenderLayerCompositor.h b/Source/WebCore/rendering/RenderLayerCompositor.h index e294b5866..273849352 100644 --- a/Source/WebCore/rendering/RenderLayerCompositor.h +++ b/Source/WebCore/rendering/RenderLayerCompositor.h @@ -34,6 +34,7 @@ namespace WebCore { class GraphicsLayer; class RenderEmbeddedObject; +class RenderGeometryMap; class RenderPart; class ScrollingCoordinator; #if ENABLE(VIDEO) @@ -238,13 +239,13 @@ private: // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect. void recursiveRepaintLayerRect(RenderLayer*, const IntRect&); - void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed); - void addToOverlapMapRecursive(OverlapMap&, RenderLayer*); + void addToOverlapMap(RenderGeometryMap&, OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed); + void addToOverlapMapRecursive(RenderGeometryMap&, OverlapMap&, RenderLayer*, RenderLayer* ancestorLayer = 0); void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*); // Returns true if any layer's compositing changed - void computeCompositingRequirements(RenderLayer*, OverlapMap*, struct CompositingState&, bool& layersChanged); + void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, RenderGeometryMap*, OverlapMap*, struct CompositingState&, bool& layersChanged); // Recurses down the tree, parenting descendant compositing layers and collecting an array of child layers for the current compositing layer. void rebuildCompositingLayerTree(RenderLayer*, Vector<GraphicsLayer*>& childGraphicsLayersOfEnclosingLayer, int depth); diff --git a/Source/WebCore/rendering/RenderMediaControlsChromium.cpp b/Source/WebCore/rendering/RenderMediaControlsChromium.cpp index c28049c2b..72e12c881 100644 --- a/Source/WebCore/rendering/RenderMediaControlsChromium.cpp +++ b/Source/WebCore/rendering/RenderMediaControlsChromium.cpp @@ -127,37 +127,37 @@ static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c context->drawRect(rect); context->restore(); - // Draw the buffered ranges. - // FIXME: Draw multiple ranges if there are multiple buffered ranges. http://webkit.org/b/85925 + // Draw the buffered range. Since the element may have multiple buffered ranges and it'd be + // distracting/'busy' to show all of them, show only the buffered range containing the current play head. IntRect bufferedRect = rect; bufferedRect.inflate(-style->borderLeftWidth()); - double bufferedWidth = 0.0; RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered(); - if (bufferedTimeRanges->length() > 0) { - // Account for the width of the slider thumb. - Image* mediaSliderThumb = getMediaSliderThumb(); - double thumbWidth = mediaSliderThumb->width() / 2.0 + 1.0; - double rectWidth = bufferedRect.width() - thumbWidth; - if (rectWidth < 0.0) - rectWidth = 0.0; - // Preserve old behavior pending resolution of UI design of multiple ranges (see FIXME above). - // http://webkit.org/b/85926 - double fakePercentLoaded = 0; - float duration = mediaElement->duration(); - if (duration && !isinf(duration)) - fakePercentLoaded = bufferedTimeRanges->end(bufferedTimeRanges->length() - 1, ASSERT_NO_EXCEPTION) / duration; - bufferedWidth = rectWidth * fakePercentLoaded + thumbWidth; - } - bufferedRect.setWidth(bufferedWidth); + float duration = mediaElement->duration(); + float currentTime = mediaElement->currentTime(); + if (isnan(duration) || isinf(duration) || !duration || isnan(currentTime)) + return true; + + for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) { + float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION); + float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION); + if (isnan(start) || isnan(end) || start > currentTime || end < currentTime) + continue; + float startFraction = start / duration; + float endFraction = end / duration; + float widthFraction = endFraction - startFraction; + bufferedRect.move(startFraction * bufferedRect.width(), 0); + bufferedRect.setWidth(widthFraction * bufferedRect.width()); + + // Don't bother drawing an empty area. + if (bufferedRect.isEmpty()) + return true; - // Don't bother drawing an empty area. - if (!bufferedRect.isEmpty()) { IntPoint sliderTopLeft = bufferedRect.location(); - IntPoint sliderTopRight = sliderTopLeft; - sliderTopRight.move(0, bufferedRect.height()); + IntPoint sliderBottomLeft = sliderTopLeft; + sliderBottomLeft.move(0, bufferedRect.height()); - RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight); + RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft); Color startColor = object->style()->visitedDependentColor(CSSPropertyColor); gradient->addColorStop(0.0, startColor); gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha())); @@ -167,6 +167,7 @@ static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c context->setFillGradient(gradient); context->fillRect(bufferedRect); context->restore(); + return true; } return true; diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp index d29055e68..d7f43ff50 100644 --- a/Source/WebCore/rendering/RenderMultiColumnBlock.cpp +++ b/Source/WebCore/rendering/RenderMultiColumnBlock.cpp @@ -25,6 +25,7 @@ #include "config.h" #include "RenderMultiColumnBlock.h" +#include "RenderMultiColumnFlowThread.h" using namespace std; @@ -32,6 +33,7 @@ namespace WebCore { RenderMultiColumnBlock::RenderMultiColumnBlock(Node* node) : RenderBlock(node) + , m_flowThread(0) , m_columnCount(1) , m_columnWidth(0) { @@ -73,6 +75,22 @@ bool RenderMultiColumnBlock::recomputeLogicalWidth() return relayoutChildren; } +void RenderMultiColumnBlock::addChild(RenderObject* newChild, RenderObject* beforeChild) +{ + if (!m_flowThread) { + m_flowThread = new (renderArena()) RenderMultiColumnFlowThread(document()); + m_flowThread->setStyle(RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK)); + RenderBlock::addChild(m_flowThread); // Always put the flow thread at the end. + } + + // Column sets are siblings of the flow thread. All children designed to be in the columns, however, are part + // of the flow thread itself. + if (newChild->isRenderMultiColumnSet()) + RenderBlock::addChild(newChild, beforeChild); + else + m_flowThread->addChild(newChild, beforeChild); +} + const char* RenderMultiColumnBlock::renderName() const { if (isFloating()) diff --git a/Source/WebCore/rendering/RenderMultiColumnBlock.h b/Source/WebCore/rendering/RenderMultiColumnBlock.h index 2ab642146..833c9bf71 100644 --- a/Source/WebCore/rendering/RenderMultiColumnBlock.h +++ b/Source/WebCore/rendering/RenderMultiColumnBlock.h @@ -31,6 +31,8 @@ namespace WebCore { +class RenderMultiColumnFlowThread; + class RenderMultiColumnBlock : public RenderBlock { public: RenderMultiColumnBlock(Node*); @@ -41,7 +43,13 @@ private: virtual bool recomputeLogicalWidth(); void computeColumnCountAndWidth(); + virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) OVERRIDE; + + RenderMultiColumnFlowThread* flowThread() const { return m_flowThread; } + private: + RenderMultiColumnFlowThread* m_flowThread; + unsigned m_columnCount; // The default column count/width that are based off our containing block width. These values represent only the default, LayoutUnit m_columnWidth; // since a multi-column block that is split across variable width pages or regions will have different column counts and widths in each. // These values will be cached (eventually) for multi-column blocks. diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp index e90ef4e3c..e553c5401 100644 --- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp +++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp @@ -33,6 +33,10 @@ RenderMultiColumnFlowThread::RenderMultiColumnFlowThread(Node* node) { } +RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread() +{ +} + const char* RenderMultiColumnFlowThread::renderName() const { return "RenderMultiColumnFlowThread"; diff --git a/Source/WebCore/rendering/RenderMultiColumnFlowThread.h b/Source/WebCore/rendering/RenderMultiColumnFlowThread.h index f4a0a0420..6f236d1f4 100644 --- a/Source/WebCore/rendering/RenderMultiColumnFlowThread.h +++ b/Source/WebCore/rendering/RenderMultiColumnFlowThread.h @@ -34,7 +34,8 @@ namespace WebCore { class RenderMultiColumnFlowThread : public RenderFlowThread { public: RenderMultiColumnFlowThread(Node*); - + ~RenderMultiColumnFlowThread(); + private: virtual const char* renderName() const OVERRIDE; }; diff --git a/Source/WebCore/rendering/RenderMultiColumnSet.h b/Source/WebCore/rendering/RenderMultiColumnSet.h index c5794c8df..f345a8ed3 100644 --- a/Source/WebCore/rendering/RenderMultiColumnSet.h +++ b/Source/WebCore/rendering/RenderMultiColumnSet.h @@ -45,6 +45,8 @@ class RenderMultiColumnSet : public RenderRegionSet { public: RenderMultiColumnSet(Node*, RenderFlowThread*); + virtual bool isRenderMultiColumnSet() const OVERRIDE { return true; } + private: virtual const char* renderName() const; }; diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 4eb16b835..1cd6d36dc 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -46,6 +46,7 @@ #include "RenderCounter.h" #include "RenderDeprecatedFlexibleBox.h" #include "RenderFlexibleBox.h" +#include "RenderGeometryMap.h" #include "RenderImage.h" #include "RenderImageResourceStyleImage.h" #include "RenderInline.h" @@ -188,9 +189,11 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style) case BOX: case INLINE_BOX: return new (arena) RenderDeprecatedFlexibleBox(node); +#if ENABLE(CSS3_FLEXBOX) case FLEX: case INLINE_FLEX: return new (arena) RenderFlexibleBox(node); +#endif } return 0; @@ -219,7 +222,6 @@ RenderObject::RenderObject(Node* node) RenderObject::~RenderObject() { - ASSERT(!node() || documentBeingDestroyed() || !frame()->view() || frame()->view()->layoutRoot() != this); #ifndef NDEBUG ASSERT(!m_hasAXObject); renderObjectCounter.decrement(); @@ -593,14 +595,26 @@ RenderBlock* RenderObject::firstLineBlock() const static inline bool objectIsRelayoutBoundary(const RenderObject* object) { - // FIXME: In future it may be possible to broaden this condition in order to improve performance. - // Table cells are excluded because even when their CSS height is fixed, their height() - // may depend on their contents. - return object->isTextControl() + // FIXME: In future it may be possible to broaden these conditions in order to improve performance. + if (object->isTextControl()) + return true; + #if ENABLE(SVG) - || object->isSVGRoot() + if (object->isSVGRoot()) + return true; #endif - || (object->hasOverflowClip() && !object->style()->width().isIntrinsicOrAuto() && !object->style()->height().isIntrinsicOrAuto() && !object->style()->height().isPercent() && !object->isTableCell()); + + if (!object->hasOverflowClip()) + return false; + + if (object->style()->width().isIntrinsicOrAuto() || object->style()->height().isIntrinsicOrAuto() || object->style()->height().isPercent()) + return false; + + // Table parts can't be relayout roots since the table is responsible for layouting all the parts. + if (object->isTablePart()) + return false; + + return true; } void RenderObject::markContainingBlocksForLayout(bool scheduleRelayout, RenderObject* newRoot) @@ -2031,6 +2045,7 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (!o) return; + // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); if (o->isBox() && o->style()->isFlippedBlocksWritingMode()) transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); @@ -2046,6 +2061,24 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed); } +const RenderObject* RenderObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != this); + + RenderObject* container = parent(); + if (!container) + return 0; + + // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. + LayoutSize offset; + if (container->hasOverflowClip()) + offset = -toRenderBox(container)->scrolledContentOffset(); + + geometryMap.push(this, offset, hasColumns()); + + return container; +} + void RenderObject::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const { RenderObject* o = parent(); @@ -2114,7 +2147,7 @@ FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, Ren return transformState.lastPlanarPoint(); } -LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const +LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const { ASSERT(o == container()); @@ -2125,6 +2158,9 @@ LayoutSize RenderObject::offsetFromContainer(RenderObject* o, const LayoutPoint& if (o->hasOverflowClip()) offset -= toRenderBox(o)->scrolledContentOffset(); + if (offsetDependsOnPoint) + *offsetDependsOnPoint = hasColumns(); + return offset; } @@ -2200,7 +2236,7 @@ bool RenderObject::hasOutlineAnnotation() const return node() && node()->isLink() && document()->printing(); } -RenderObject* RenderObject::container(RenderBoxModelObject* repaintContainer, bool* repaintContainerSkipped) const +RenderObject* RenderObject::container(const RenderBoxModelObject* repaintContainer, bool* repaintContainerSkipped) const { if (repaintContainerSkipped) *repaintContainerSkipped = false; @@ -2260,7 +2296,7 @@ bool RenderObject::isSelectionBorder() const inline void RenderObject::clearLayoutRootIfNeeded() const { - if (node() && !documentBeingDestroyed() && frame()) { + if (!documentBeingDestroyed() && frame()) { if (FrameView* view = frame()->view()) { if (view->layoutRoot() == this) { ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h index f1032a534..ed90aac22 100644 --- a/Source/WebCore/rendering/RenderObject.h +++ b/Source/WebCore/rendering/RenderObject.h @@ -60,6 +60,7 @@ class RenderBoxModelObject; class RenderInline; class RenderBlock; class RenderFlowThread; +class RenderGeometryMap; class RenderLayer; class RenderTable; class RenderTheme; @@ -360,6 +361,9 @@ public: virtual bool isRenderFlowThread() const { return false; } virtual bool isRenderNamedFlowThread() const { return false; } + + virtual bool isRenderMultiColumnSet() const { return false; } + virtual bool isRenderScrollbarPart() const { return false; } bool canHaveRegionStyle() const { return isRenderBlock() && !isAnonymous() && !isRenderFlowThread(); } @@ -583,7 +587,7 @@ public: // Returns the object containing this one. Can be different from parent for positioned elements. // If repaintContainer and repaintContainerSkipped are not null, on return *repaintContainerSkipped // is true if the renderer returned is an ancestor of repaintContainer. - RenderObject* container(RenderBoxModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const; + RenderObject* container(const RenderBoxModelObject* repaintContainer = 0, bool* repaintContainerSkipped = 0) const; virtual RenderObject* hoverAncestor() const { return parent(); } @@ -684,7 +688,7 @@ public: // Return the offset from the container() renderer (excluding transforms). In multi-column layout, // different offsets apply at different points, so return the offset that applies to the given point. - virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; + virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const; // Return the offset from an object up the container() chain. Asserts that none of the intermediate objects have transforms. LayoutSize offsetFromAncestorContainer(RenderObject*) const; @@ -881,6 +885,10 @@ public: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; + // Pushes state onto RenderGeometryMap about how to map coordinates from this renderer to its container, or ancestorToStopAt (whichever is encountered first). + // Returns the renderer which was mapped to (container or ancestorToStopAt). + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + bool shouldUseTransformFromContainer(const RenderObject* container) const; void getTransformFromContainer(const RenderObject* container, const LayoutSize& offsetInContainer, TransformationMatrix&) const; diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp index 10720c2b8..99ec92d7d 100644 --- a/Source/WebCore/rendering/RenderTableCell.cpp +++ b/Source/WebCore/rendering/RenderTableCell.cpp @@ -240,11 +240,11 @@ void RenderTableCell::setOverrideHeightFromRowHeight(LayoutUnit rowHeight) RenderBlock::setOverrideHeight(max<LayoutUnit>(0, rowHeight - borderBefore() - paddingBefore() - borderAfter() - paddingAfter())); } -LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point) const +LayoutSize RenderTableCell::offsetFromContainer(RenderObject* o, const LayoutPoint& point, bool* offsetDependsOnPoint) const { ASSERT(o == container()); - LayoutSize offset = RenderBlock::offsetFromContainer(o, point); + LayoutSize offset = RenderBlock::offsetFromContainer(o, point, offsetDependsOnPoint); if (parent()) offset.expand(-parentBox()->x(), -parentBox()->y()); diff --git a/Source/WebCore/rendering/RenderTableCell.h b/Source/WebCore/rendering/RenderTableCell.h index dac8a7606..2a5820e9e 100644 --- a/Source/WebCore/rendering/RenderTableCell.h +++ b/Source/WebCore/rendering/RenderTableCell.h @@ -152,7 +152,7 @@ private: virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFlowBox*) const OVERRIDE; - virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&) const; + virtual LayoutSize offsetFromContainer(RenderObject*, const LayoutPoint&, bool* offsetDependsOnPoint = 0) const; virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const; diff --git a/Source/WebCore/rendering/RenderTableSection.cpp b/Source/WebCore/rendering/RenderTableSection.cpp index 7f44a75a0..db25e8149 100644 --- a/Source/WebCore/rendering/RenderTableSection.cpp +++ b/Source/WebCore/rendering/RenderTableSection.cpp @@ -403,6 +403,8 @@ int RenderTableSection::calcRowLogicalHeight() void RenderTableSection::layout() { ASSERT(needsLayout()); + ASSERT(!needsCellRecalc()); + ASSERT(!table()->needsSectionRecalc()); LayoutStateMaintainer statePusher(view(), this, locationOffset(), style()->isFlippedBlocksWritingMode()); for (RenderObject* child = children()->firstChild(); child; child = child->nextSibling()) { diff --git a/Source/WebCore/rendering/RenderTreeAsText.cpp b/Source/WebCore/rendering/RenderTreeAsText.cpp index 51fc41745..39319ca1f 100644 --- a/Source/WebCore/rendering/RenderTreeAsText.cpp +++ b/Source/WebCore/rendering/RenderTreeAsText.cpp @@ -718,7 +718,7 @@ static void writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLaye // Calculate the clip rects we should use. LayoutRect layerBounds; ClipRect damageRect, clipRectToApply, outlineRect; - l->calculateRects(rootLayer, 0, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect, true); + l->calculateRects(rootLayer, 0, TemporaryClipRects, paintDirtyRect, layerBounds, damageRect, clipRectToApply, outlineRect); // Ensure our lists are up-to-date. l->updateLayerListsIfNeeded(); diff --git a/Source/WebCore/rendering/RenderView.cpp b/Source/WebCore/rendering/RenderView.cpp index 8633104e3..aadb9b9b5 100644 --- a/Source/WebCore/rendering/RenderView.cpp +++ b/Source/WebCore/rendering/RenderView.cpp @@ -32,6 +32,7 @@ #include "HTMLFrameOwnerElement.h" #include "HitTestResult.h" #include "Page.h" +#include "RenderGeometryMap.h" #include "RenderLayer.h" #include "RenderNamedFlowThread.h" #include "RenderSelectionInfo.h" @@ -167,6 +168,27 @@ void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, boo transformState.move(m_frameView->scrollOffsetForFixedPosition()); } +const RenderObject* RenderView::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + // If a container was specified, and was not 0 or the RenderView, + // then we should have found it by now. + ASSERT_ARG(ancestorToStopAt, !ancestorToStopAt || ancestorToStopAt == this); + + LayoutSize scrollOffset; + + if (m_frameView) + scrollOffset = m_frameView->scrollOffsetForFixedPosition(); + + if (!ancestorToStopAt && shouldUseTransformFromContainer(0)) { + TransformationMatrix t; + getTransformFromContainer(0, LayoutSize(), t); + geometryMap.pushView(this, scrollOffset, &t); + } else + geometryMap.pushView(this, scrollOffset); + + return 0; +} + void RenderView::mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState& transformState) const { if (fixed && m_frameView) @@ -733,10 +755,10 @@ LayoutRect RenderView::backgroundRect(RenderBox* backgroundRenderer) const IntRect RenderView::documentRect() const { - IntRect overflowRect(unscaledDocumentRect()); + FloatRect overflowRect(unscaledDocumentRect()); if (hasTransform()) overflowRect = layer()->currentTransform().mapRect(overflowRect); - return overflowRect; + return IntRect(overflowRect); } int RenderView::viewHeight() const diff --git a/Source/WebCore/rendering/RenderView.h b/Source/WebCore/rendering/RenderView.h index 4ac061f72..e6a5722d8 100644 --- a/Source/WebCore/rendering/RenderView.h +++ b/Source/WebCore/rendering/RenderView.h @@ -188,6 +188,7 @@ public: protected: virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const; virtual bool requiresColumns(int desiredColumnCount) const OVERRIDE; diff --git a/Source/WebCore/rendering/RenderingAllInOne.cpp b/Source/WebCore/rendering/RenderingAllInOne.cpp index ff8e0731e..d17bd313a 100644 --- a/Source/WebCore/rendering/RenderingAllInOne.cpp +++ b/Source/WebCore/rendering/RenderingAllInOne.cpp @@ -75,6 +75,8 @@ #include "RenderMenuList.cpp" #include "RenderMeter.cpp" #include "RenderMultiColumnBlock.cpp" +#include "RenderMultiColumnFlowThread.cpp" +#include "RenderMultiColumnSet.cpp" #include "RenderObject.cpp" #include "RenderObjectChildList.cpp" #include "RenderPart.cpp" diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index ba7677b10..55c739a07 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -409,8 +409,10 @@ enum EDisplay { TABLE, INLINE_TABLE, TABLE_ROW_GROUP, TABLE_HEADER_GROUP, TABLE_FOOTER_GROUP, TABLE_ROW, TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL, - TABLE_CAPTION, BOX, INLINE_BOX, + TABLE_CAPTION, BOX, INLINE_BOX, +#if ENABLE(CSS3_FLEXBOX) FLEX, INLINE_FLEX, +#endif GRID, INLINE_GRID, NONE }; diff --git a/Source/WebCore/rendering/svg/RenderSVGBlock.cpp b/Source/WebCore/rendering/svg/RenderSVGBlock.cpp index cf44efff1..c4f9a284d 100644 --- a/Source/WebCore/rendering/svg/RenderSVGBlock.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGBlock.cpp @@ -104,12 +104,6 @@ void RenderSVGBlock::styleDidChange(StyleDifference diff, const RenderStyle* old SVGResourcesCache::clientStyleChanged(this, diff, style()); } -void RenderSVGBlock::updateFromElement() -{ - RenderBlock::updateFromElement(); - SVGResourcesCache::clientUpdatedFromElement(this, style()); -} - } #endif diff --git a/Source/WebCore/rendering/svg/RenderSVGBlock.h b/Source/WebCore/rendering/svg/RenderSVGBlock.h index 9ef55a919..7f5b78532 100644 --- a/Source/WebCore/rendering/svg/RenderSVGBlock.h +++ b/Source/WebCore/rendering/svg/RenderSVGBlock.h @@ -45,7 +45,6 @@ private: virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - virtual void updateFromElement(); }; } diff --git a/Source/WebCore/rendering/svg/RenderSVGContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGContainer.cpp index a1fd8321d..7b2866113 100644 --- a/Source/WebCore/rendering/svg/RenderSVGContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGContainer.cpp @@ -87,6 +87,19 @@ void RenderSVGContainer::layout() setNeedsLayout(false); } +void RenderSVGContainer::addChild(RenderObject* child, RenderObject* beforeChild) +{ + RenderSVGModelObject::addChild(child, beforeChild); + SVGResourcesCache::clientWasAddedToTree(child, child->style()); +} + +void RenderSVGContainer::removeChild(RenderObject* child) +{ + SVGResourcesCache::clientWillBeRemovedFromTree(child); + RenderSVGModelObject::removeChild(child); +} + + bool RenderSVGContainer::selfWillPaint() { SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this); diff --git a/Source/WebCore/rendering/svg/RenderSVGContainer.h b/Source/WebCore/rendering/svg/RenderSVGContainer.h index 5be036638..335732b84 100644 --- a/Source/WebCore/rendering/svg/RenderSVGContainer.h +++ b/Source/WebCore/rendering/svg/RenderSVGContainer.h @@ -53,6 +53,8 @@ protected: virtual void layout(); + virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE; + virtual void removeChild(RenderObject*) OVERRIDE; virtual void addFocusRingRects(Vector<IntRect>&, const LayoutPoint&); virtual FloatRect objectBoundingBox() const { return m_objectBoundingBox; } diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp index 2918fe3a9..074944066 100644 --- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp @@ -193,6 +193,11 @@ void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintCo SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed); } +const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); +} + } #endif diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h index 4a1a8ac25..8fe0864c1 100644 --- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h +++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h @@ -55,6 +55,7 @@ public: virtual bool isSVGForeignObject() const { return true; } virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } private: diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.cpp b/Source/WebCore/rendering/svg/RenderSVGInline.cpp index bb1a367ac..057bfda00 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInline.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGInline.cpp @@ -84,6 +84,11 @@ void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed); } +const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); +} + void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const { const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this); @@ -114,21 +119,19 @@ void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* ol SVGResourcesCache::clientStyleChanged(this, diff, style()); } -void RenderSVGInline::updateFromElement() -{ - RenderInline::updateFromElement(); - SVGResourcesCache::clientUpdatedFromElement(this, style()); -} - void RenderSVGInline::addChild(RenderObject* child, RenderObject* beforeChild) { RenderInline::addChild(child, beforeChild); + SVGResourcesCache::clientWasAddedToTree(child, child->style()); + if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this)) textRenderer->subtreeChildWasAdded(child); } void RenderSVGInline::removeChild(RenderObject* child) { + SVGResourcesCache::clientWillBeRemovedFromTree(child); + RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this); if (!textRenderer) { RenderInline::removeChild(child); diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.h b/Source/WebCore/rendering/svg/RenderSVGInline.h index 172062196..533a99aa6 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInline.h +++ b/Source/WebCore/rendering/svg/RenderSVGInline.h @@ -48,6 +48,7 @@ public: virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; private: @@ -56,9 +57,8 @@ private: virtual void willBeDestroyed(); virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - virtual void updateFromElement(); - virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); + virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE; virtual void removeChild(RenderObject*) OVERRIDE; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp index 48fd7d879..c1c27b09a 100644 --- a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp @@ -60,6 +60,11 @@ void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintCont SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed); } +const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); +} + // Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content. // FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends // on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement. @@ -106,12 +111,6 @@ void RenderSVGModelObject::styleDidChange(StyleDifference diff, const RenderStyl SVGResourcesCache::clientStyleChanged(this, diff, style()); } -void RenderSVGModelObject::updateFromElement() -{ - RenderObject::updateFromElement(); - SVGResourcesCache::clientUpdatedFromElement(this, style()); -} - bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint&, const LayoutPoint&, HitTestAction) { ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.h b/Source/WebCore/rendering/svg/RenderSVGModelObject.h index b9692fe1d..d82600f57 100644 --- a/Source/WebCore/rendering/svg/RenderSVGModelObject.h +++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.h @@ -59,9 +59,9 @@ public: virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - virtual void updateFromElement(); static bool checkIntersection(RenderObject*, const FloatRect&); static bool checkEnclosure(RenderObject*, const FloatRect&); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp index 3dba672dd..80760fd48 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp @@ -165,7 +165,7 @@ void RenderSVGResourceContainer::registerResource() RenderObject* renderer = (*it)->renderer(); if (!renderer) continue; - SVGResourcesCache::clientUpdatedFromElement(renderer, renderer->style()); + SVGResourcesCache::clientStyleChanged(renderer, StyleDifferenceLayout, renderer->style()); renderer->setNeedsLayout(true); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index 941185f55..663245333 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -326,10 +326,16 @@ void RenderSVGRoot::styleDidChange(StyleDifference diff, const RenderStyle* oldS SVGResourcesCache::clientStyleChanged(this, diff, style()); } -void RenderSVGRoot::updateFromElement() +void RenderSVGRoot::addChild(RenderObject* child, RenderObject* beforeChild) { - RenderReplaced::updateFromElement(); - SVGResourcesCache::clientUpdatedFromElement(this, style()); + RenderReplaced::addChild(child, beforeChild); + SVGResourcesCache::clientWasAddedToTree(child, child->style()); +} + +void RenderSVGRoot::removeChild(RenderObject* child) +{ + SVGResourcesCache::clientWillBeRemovedFromTree(child); + RenderReplaced::removeChild(child); } // RenderBox methods will expect coordinates w/o any transforms in coordinates @@ -391,6 +397,11 @@ void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, RenderReplaced::mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, ApplyContainerFlip, wasFixed); } +const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap); +} + void RenderSVGRoot::updateCachedBoundaries() { m_objectBoundingBox = FloatRect(); diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.h b/Source/WebCore/rendering/svg/RenderSVGRoot.h index c334afbe6..6fb569468 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.h +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.h @@ -78,7 +78,8 @@ private: virtual void willBeDestroyed(); virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); - virtual void updateFromElement(); + virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE; + virtual void removeChild(RenderObject*) OVERRIDE; virtual const AffineTransform& localToParentTransform() const; @@ -95,6 +96,8 @@ private: virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const; virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual bool canBeSelectionLeaf() const { return false; } virtual bool canHaveChildren() const { return true; } diff --git a/Source/WebCore/rendering/svg/RenderSVGText.cpp b/Source/WebCore/rendering/svg/RenderSVGText.cpp index d918453c5..a2cae7dbb 100644 --- a/Source/WebCore/rendering/svg/RenderSVGText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGText.cpp @@ -115,6 +115,11 @@ void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed); } +const RenderObject* RenderSVGText::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +{ + return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); +} + static inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes) { for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) { @@ -524,11 +529,15 @@ FloatRect RenderSVGText::repaintRectInLocalCoordinates() const void RenderSVGText::addChild(RenderObject* child, RenderObject* beforeChild) { RenderSVGBlock::addChild(child, beforeChild); + + SVGResourcesCache::clientWasAddedToTree(child, child->style()); subtreeChildWasAdded(child); } void RenderSVGText::removeChild(RenderObject* child) { + SVGResourcesCache::clientWillBeRemovedFromTree(child); + Vector<SVGTextLayoutAttributes*, 2> affectedAttributes; FontCachePurgePreventer fontCachePurgePreventer; subtreeChildWillBeRemoved(child, affectedAttributes); diff --git a/Source/WebCore/rendering/svg/RenderSVGText.h b/Source/WebCore/rendering/svg/RenderSVGText.h index 56723f6c1..af950c341 100644 --- a/Source/WebCore/rendering/svg/RenderSVGText.h +++ b/Source/WebCore/rendering/svg/RenderSVGText.h @@ -76,6 +76,7 @@ private: virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const; + virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual void removeChild(RenderObject*) OVERRIDE; virtual void willBeDestroyed() OVERRIDE; diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp index ddc7c9155..177ce9c44 100644 --- a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp @@ -28,6 +28,7 @@ #include "SVGRenderSupport.h" #include "NodeRenderStyle.h" +#include "RenderGeometryMap.h" #include "RenderLayer.h" #include "RenderSVGResource.h" #include "RenderSVGResourceClipper.h" @@ -85,6 +86,23 @@ void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBox parent->mapLocalToContainer(repaintContainer, false, true, transformState, RenderObject::DoNotApplyContainerFlip, wasFixed); } +const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject* object, const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) +{ + ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object); + + RenderObject* parent = object->parent(); + + // At the SVG/HTML boundary (aka RenderSVGRoot), we apply the localToBorderBoxTransform + // to map an element from SVG viewport coordinates to CSS box coordinates. + // RenderSVGRoot's mapLocalToContainer method expects CSS box coordinates. + if (parent->isSVGRoot()) + geometryMap.push(object, TransformationMatrix(toRenderSVGRoot(parent)->localToBorderBoxTransform())); + else + geometryMap.push(object, LayoutSize()); + + return parent; +} + // Update a bounding box taking into account the validity of the other bounding box. static inline void updateObjectBoundingBox(FloatRect& objectBoundingBox, bool& objectBoundingBoxValid, RenderObject* other, FloatRect otherBoundingBox) { diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.h b/Source/WebCore/rendering/svg/SVGRenderSupport.h index e25b12f06..fa960f05e 100644 --- a/Source/WebCore/rendering/svg/SVGRenderSupport.h +++ b/Source/WebCore/rendering/svg/SVGRenderSupport.h @@ -34,6 +34,7 @@ class FloatPoint; class FloatRect; class ImageBuffer; class RenderBoxModelObject; +class RenderGeometryMap; class RenderObject; class RenderStyle; class RenderSVGRoot; @@ -64,6 +65,7 @@ public: static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer); static void computeFloatRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed); static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, TransformState&, bool* wasFixed = 0); + static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&); // Shared between SVG renderers and resources. static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); diff --git a/Source/WebCore/rendering/svg/SVGResourcesCache.cpp b/Source/WebCore/rendering/svg/SVGResourcesCache.cpp index 1715f6c04..87531ed3e 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCache.cpp +++ b/Source/WebCore/rendering/svg/SVGResourcesCache.cpp @@ -128,24 +128,44 @@ void SVGResourcesCache::clientLayoutChanged(RenderObject* object) void SVGResourcesCache::clientStyleChanged(RenderObject* renderer, StyleDifference diff, const RenderStyle* newStyle) { ASSERT(renderer); - if (diff == StyleDifferenceEqual) + if (diff == StyleDifferenceEqual || !renderer->parent()) return; // In this case the proper SVGFE*Element will decide whether the modified CSS properties require a relayout or repaint. if (renderer->isSVGResourceFilterPrimitive() && diff == StyleDifferenceRepaint) return; - clientUpdatedFromElement(renderer, newStyle); + // Dynamic changes of CSS properties like 'clip-path' may require us to recompute the associated resources for a renderer. + // FIXME: Avoid passing in a useless StyleDifference, but instead compare oldStyle/newStyle to see which resources changed + // to be able to selectively rebuild individual resources, instead of all of them. + SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer); + cache->removeResourcesFromRenderObject(renderer); + cache->addResourcesFromRenderObject(renderer, newStyle); + + RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false); } -void SVGResourcesCache::clientUpdatedFromElement(RenderObject* renderer, const RenderStyle* newStyle) +static inline bool rendererCanHaveResources(RenderObject* renderer) { ASSERT(renderer); ASSERT(renderer->parent()); + return renderer->node() && !renderer->isSVGInlineText(); +} +void SVGResourcesCache::clientWasAddedToTree(RenderObject* renderer, const RenderStyle* newStyle) +{ + if (!rendererCanHaveResources(renderer)) + return; SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer); - cache->removeResourcesFromRenderObject(renderer); cache->addResourcesFromRenderObject(renderer, newStyle); +} + +void SVGResourcesCache::clientWillBeRemovedFromTree(RenderObject* renderer) +{ + if (!rendererCanHaveResources(renderer)) + return; + SVGResourcesCache* cache = resourcesCacheFromRenderObject(renderer); + cache->removeResourcesFromRenderObject(renderer); RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer, false); } diff --git a/Source/WebCore/rendering/svg/SVGResourcesCache.h b/Source/WebCore/rendering/svg/SVGResourcesCache.h index 72e526a67..633fcd73d 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCache.h +++ b/Source/WebCore/rendering/svg/SVGResourcesCache.h @@ -37,10 +37,14 @@ public: SVGResourcesCache(); ~SVGResourcesCache(); - void addResourcesFromRenderObject(RenderObject*, const RenderStyle*); - void removeResourcesFromRenderObject(RenderObject*); static SVGResources* cachedResourcesForRenderObject(const RenderObject*); + // Called from all SVG renderers addChild() methods. + static void clientWasAddedToTree(RenderObject*, const RenderStyle* newStyle); + + // Called from all SVG renderers removeChild() methods. + static void clientWillBeRemovedFromTree(RenderObject*); + // Called from all SVG renderers destroy() methods - except for RenderSVGResourceContainer. static void clientDestroyed(RenderObject*); @@ -50,13 +54,13 @@ public: // Called from all SVG renderers styleDidChange() methods. static void clientStyleChanged(RenderObject*, StyleDifference, const RenderStyle* newStyle); - // Called from all SVG renderers updateFromElement() methods. - static void clientUpdatedFromElement(RenderObject*, const RenderStyle* newStyle); - // Called from RenderSVGResourceContainer::willBeDestroyed(). static void resourceDestroyed(RenderSVGResourceContainer*); private: + void addResourcesFromRenderObject(RenderObject*, const RenderStyle*); + void removeResourcesFromRenderObject(RenderObject*); + HashMap<const RenderObject*, SVGResources*> m_cache; }; diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp index f32e66a7d..9e0472be1 100644 --- a/Source/WebCore/svg/SVGStyledElement.cpp +++ b/Source/WebCore/svg/SVGStyledElement.cpp @@ -350,14 +350,6 @@ void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName) } } -void SVGStyledElement::attach() -{ - SVGElement::attach(); - - if (RenderObject* object = renderer()) - object->updateFromElement(); -} - Node::InsertionNotificationRequest SVGStyledElement::insertedInto(ContainerNode* rootParent) { SVGElement::insertedInto(rootParent); diff --git a/Source/WebCore/svg/SVGStyledElement.h b/Source/WebCore/svg/SVGStyledElement.h index be9bf24c3..037d22da6 100644 --- a/Source/WebCore/svg/SVGStyledElement.h +++ b/Source/WebCore/svg/SVGStyledElement.h @@ -71,7 +71,6 @@ protected: virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); - virtual void attach(); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp index 542d1a9ff..b42de2886 100644 --- a/Source/WebCore/svg/SVGTextPathElement.cpp +++ b/Source/WebCore/svg/SVGTextPathElement.cpp @@ -61,6 +61,17 @@ PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& t return adoptRef(new SVGTextPathElement(tagName, document)); } +SVGTextPathElement::~SVGTextPathElement() +{ + clearResourceReferences(); +} + +void SVGTextPathElement::clearResourceReferences() +{ + ASSERT(document()); + document()->accessSVGExtensions()->removeAllTargetReferencesForElement(this); +} + bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); @@ -106,6 +117,11 @@ void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); + if (SVGURIReference::isKnownAttribute(attrName)) { + buildPendingResource(); + return; + } + if (attrName == SVGNames::startOffsetAttr) updateRelativeLengthsInformation(); @@ -139,26 +155,41 @@ bool SVGTextPathElement::rendererIsNeeded(const NodeRenderingContext& context) return false; } -Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNode* rootParent) +void SVGTextPathElement::buildPendingResource() { - SVGStyledElement::insertedInto(rootParent); - if (!rootParent->inDocument()) - return InsertionDone; + clearResourceReferences(); + if (!inDocument()) + return; String id; - Element* targetElement = SVGURIReference::targetElementFromIRIString(href(), document(), &id); - if (!targetElement) { + Element* target = SVGURIReference::targetElementFromIRIString(href(), document(), &id); + if (!target) { if (hasPendingResources() || id.isEmpty()) - return InsertionDone; + return; - ASSERT(!hasPendingResources()); 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)); } +} +Node::InsertionNotificationRequest SVGTextPathElement::insertedInto(ContainerNode* rootParent) +{ + SVGTextContentElement::insertedInto(rootParent); + buildPendingResource(); return InsertionDone; } +void SVGTextPathElement::removedFrom(ContainerNode* rootParent) +{ + SVGTextContentElement::removedFrom(rootParent); + if (rootParent->inDocument()) + clearResourceReferences(); +} + bool SVGTextPathElement::selfHasRelativeLengths() const { return startOffset().isRelative() diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h index 7baf0f4de..d9950dba3 100644 --- a/Source/WebCore/svg/SVGTextPathElement.h +++ b/Source/WebCore/svg/SVGTextPathElement.h @@ -115,7 +115,13 @@ public: private: SVGTextPathElement(const QualifiedName&, Document*); + virtual ~SVGTextPathElement(); + + void clearResourceReferences(); + + virtual void buildPendingResource(); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; + virtual void removedFrom(ContainerNode*) OVERRIDE; bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const Attribute&) OVERRIDE; diff --git a/Source/WebCore/testing/InternalSettings.cpp b/Source/WebCore/testing/InternalSettings.cpp index 8594b704d..d99335b91 100644 --- a/Source/WebCore/testing/InternalSettings.cpp +++ b/Source/WebCore/testing/InternalSettings.cpp @@ -100,6 +100,7 @@ InternalSettings::InternalSettings(Frame* frame) #endif , m_originalEditingBehavior(settings()->editingBehaviorType()) , m_originalFixedPositionCreatesStackingContext(settings()->fixedPositionCreatesStackingContext()) + , m_originalSyncXHRInDocumentsEnabled(settings()->syncXHRInDocumentsEnabled()) { } @@ -113,6 +114,7 @@ void InternalSettings::restoreTo(Settings* settings) #endif settings->setEditingBehaviorType(m_originalEditingBehavior); settings->setFixedPositionCreatesStackingContext(m_originalFixedPositionCreatesStackingContext); + settings->setSyncXHRInDocumentsEnabled(m_originalSyncXHRInDocumentsEnabled); } Settings* InternalSettings::settings() const @@ -352,4 +354,10 @@ void InternalSettings::setFixedPositionCreatesStackingContext(bool creates, Exce settings()->setFixedPositionCreatesStackingContext(creates); } +void InternalSettings::setSyncXHRInDocumentsEnabled(bool creates, ExceptionCode& ec) +{ + InternalSettingsGuardForFrameView(); + settings()->setSyncXHRInDocumentsEnabled(creates); +} + } diff --git a/Source/WebCore/testing/InternalSettings.h b/Source/WebCore/testing/InternalSettings.h index 7fea75dfb..92b1bdfeb 100644 --- a/Source/WebCore/testing/InternalSettings.h +++ b/Source/WebCore/testing/InternalSettings.h @@ -77,6 +77,7 @@ public: void setMediaPlaybackRequiresUserGesture(bool, ExceptionCode&); void setEditingBehavior(const String&, ExceptionCode&); void setFixedPositionCreatesStackingContext(bool, ExceptionCode&); + void setSyncXHRInDocumentsEnabled(bool, ExceptionCode&); void restoreTo(Settings*); @@ -95,6 +96,7 @@ private: #endif EditingBehaviorType m_originalEditingBehavior; bool m_originalFixedPositionCreatesStackingContext; + bool m_originalSyncXHRInDocumentsEnabled; }; } // namespace WebCore diff --git a/Source/WebCore/testing/InternalSettings.idl b/Source/WebCore/testing/InternalSettings.idl index 7b30179bd..2ef35f2ab 100644 --- a/Source/WebCore/testing/InternalSettings.idl +++ b/Source/WebCore/testing/InternalSettings.idl @@ -55,6 +55,7 @@ module window { void setMediaPlaybackRequiresUserGesture(in boolean enabled) raises(DOMException); void setEditingBehavior(in DOMString behavior) raises(DOMException); void setFixedPositionCreatesStackingContext(in boolean creates) raises(DOMException); + void setSyncXHRInDocumentsEnabled(in boolean enabled) raises(DOMException); }; } diff --git a/Source/WebCore/xml/XMLHttpRequest.cpp b/Source/WebCore/xml/XMLHttpRequest.cpp index 0e9e0ab4b..be6b4c698 100644 --- a/Source/WebCore/xml/XMLHttpRequest.cpp +++ b/Source/WebCore/xml/XMLHttpRequest.cpp @@ -484,14 +484,22 @@ void XMLHttpRequest::open(const String& method, const KURL& url, bool async, Exc return; } - // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated - // attempt to discourage synchronous XHR use. responseType is one such piece of functionality. - // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols - // such as file: and data: still make sense to allow. - if (!async && scriptExecutionContext()->isDocument() && url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) { - logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set."); - ec = INVALID_ACCESS_ERR; - return; + if (!async && scriptExecutionContext()->isDocument()) { + if (!document()->settings()->syncXHRInDocumentsEnabled()) { + logConsoleError(scriptExecutionContext(), "Synchronous XMLHttpRequests cannot be made in the current window context."); + ec = INVALID_ACCESS_ERR; + return; + } + + // Newer functionality is not available to synchronous requests in window contexts, as a spec-mandated + // attempt to discourage synchronous XHR use. responseType is one such piece of functionality. + // We'll only disable this functionality for HTTP(S) requests since sync requests for local protocols + // such as file: and data: still make sense to allow. + if (url.protocolIsInHTTPFamily() && m_responseTypeCode != ResponseTypeDefault) { + logConsoleError(scriptExecutionContext(), "Synchronous HTTP(S) requests made from the window context cannot have XMLHttpRequest.responseType set."); + ec = INVALID_ACCESS_ERR; + return; + } } m_method = uppercaseKnownHTTPMethod(method); diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index 092fe4c78..929cd9921 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -1011,6 +1011,12 @@ bool BackingStorePrivate::render(const Platform::IntRect& rect) if (shouldDirectRenderingToWindow()) return renderDirectToWindow(rect); + // If direct rendering is off, even though we're not active, someone else + // has to render the root layer. There are no tiles available for us to + // draw to. + if (!isActive()) + return false; + TileRectList tileRectList = mapFromTransformedContentsToTiles(rect); if (tileRectList.isEmpty()) return false; diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 5f8894548..684279e30 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -638,7 +638,13 @@ void WebPage::loadFile(const char* path, const char* overrideContentType) void WebPage::download(const Platform::NetworkRequest& request) { - d->load(request.getUrlRef().c_str(), 0, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, "", request.getSuggestedSaveName().c_str()); + vector<const char*> headers; + Platform::NetworkRequest::HeaderList& list = request.getHeaderListRef(); + for (unsigned i = 0; i < list.size(); i++) { + headers.push_back(list[i].first.c_str()); + headers.push_back(list[i].second.c_str()); + } + d->load(request.getUrlRef().c_str(), 0, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, true, "", request.getSuggestedSaveName().c_str()); } void WebPagePrivate::loadString(const char* string, const char* baseURL, const char* contentType, const char* failingURL) @@ -892,11 +898,17 @@ void WebPagePrivate::setLoadState(LoadState state) m_virtualViewportHeight = m_defaultLayoutSize.height(); } // Check if we have already process the meta viewport tag, this only happens on history navigation. + // For back/forward history navigation, we should only keep these previous values if the document + // has the meta viewport tag when the state is Committed in setLoadState. // Refreshing should keep these previous values as well. + static ViewportArguments defaultViewportArguments; + bool documentHasViewportArguments = false; FrameLoadType frameLoadType = FrameLoadTypeStandard; + if (m_mainFrame && m_mainFrame->document() && !(m_mainFrame->document()->viewportArguments() == defaultViewportArguments)) + documentHasViewportArguments = true; if (m_mainFrame && m_mainFrame->loader()) frameLoadType = m_mainFrame->loader()->loadType(); - if (!m_didRestoreFromPageCache && !(frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin)) { + if (!((m_didRestoreFromPageCache && documentHasViewportArguments) || (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin))) { m_viewportArguments = ViewportArguments(); // At the moment we commit a new load, set the viewport arguments @@ -5618,6 +5630,8 @@ void WebPagePrivate::setCompositor(PassRefPtr<WebPageCompositorPrivate> composit } m_compositor = compositor; + if (m_compositor) + m_compositor->setPage(this); // The previous compositor, if any, has now released it's OpenGL resources, // so we can safely free the owned context, if any. @@ -5850,6 +5864,9 @@ void WebPagePrivate::destroyCompositor() if (!m_ownedContext) return; + // m_compositor is a RefPtr, so it may live on beyond this point. + // Disconnect the compositor from us + m_compositor->setPage(0); m_compositor.clear(); m_ownedContext.clear(); } diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp index 8e4c17778..da629adae 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor.cpp +++ b/Source/WebKit/blackberry/Api/WebPageCompositor.cpp @@ -109,7 +109,7 @@ void WebPageCompositorPrivate::render(const IntRect& dstRect, const IntRect& tra bool WebPageCompositorPrivate::drawsRootLayer() const { - return m_drawsRootLayer; + return m_rootLayer && m_drawsRootLayer; } bool WebPageCompositorPrivate::drawLayers(const IntRect& dstRect, const FloatRect& contents) @@ -190,14 +190,16 @@ WebPageCompositor::~WebPageCompositor() { using namespace BlackBerry::Platform; - webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0))); + // If we're being destroyed before the page, send a message to disconnect us + if (d->page()) + webKitThreadMessageClient()->dispatchMessage(createMethodCallMessage(&WebPagePrivate::setCompositor, d->page(), PassRefPtr<WebPageCompositorPrivate>(0))); d->compositorDestroyed(); d->deref(); } WebPageCompositorClient* WebPageCompositor::client() const { - return 0; + return d->client(); } void WebPageCompositor::prepareFrame(Platform::Graphics::GLES2Context* context, double timestamp) diff --git a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h index 4bd06c404..cb41e1164 100644 --- a/Source/WebKit/blackberry/Api/WebPageCompositor_p.h +++ b/Source/WebKit/blackberry/Api/WebPageCompositor_p.h @@ -82,6 +82,7 @@ public: void releaseLayerResources(); WebPagePrivate* page() const { return m_webPage; } + void setPage(WebPagePrivate* page) { m_webPage = page; } WebPageCompositorClient* client() const { return m_client; } void compositorDestroyed(); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index b77cf99ae..93583a78a 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,137 @@ +2012-05-27 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Crash when deleting WebPageCompositor + https://bugs.webkit.org/show_bug.cgi?id=87589 + + Reviewed by Rob Buis. + + The WebPageCompositorPrivate is reference counted, so it may outlive + either the WebPage or the WebPageCompositor, depending on who releases + its reference first. + + Fixed by disconnecting the objects properly, regardless of who goes + away first. + + Reviewed internally by Mike Lattanzio. + + PR #156444 + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setCompositor): + (BlackBerry::WebKit::WebPagePrivate::destroyCompositor): + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositor::~WebPageCompositor): + (BlackBerry::WebKit::WebPageCompositor::client): + * Api/WebPageCompositor_p.h: + (BlackBerry::WebKit::WebPageCompositorPrivate::setPage): + +2012-05-27 Arvid Nilsson <anilsson@rim.com> + + 2012-04-18 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] BackingStore accesses tiles even though it's not active + https://bugs.webkit.org/show_bug.cgi?id=87563 + + Reviewed by Antonio Gomes. + + There are many scenarios that can call render and cause tile access, + and they used to be rerouted to the direct rendering code when the + backing store was not active. This was thanks to an implicit check for + isActive() by virtue of calling shouldDirectRenderingToWindow() from + render(). + + If we're using OpenGL for compositing the backing store contents + however, direct rendering is always disabled and we jump right into the + tile based rendering code. + + Fixed by adding an explicit check for isActive() in render(), now that + the implicit check in shouldDirectRenderingToWindow() is conditional on + having raster usage. + + Since PR136381/bug83131, when OpenGL compositing is used, and the + backing store is not active, it is not in charge of drawing the root + layer. Instead, we switch off the paintingGoesToWindow flag on the root + RenderLayer so no invalidates will reach the ChromeClient or the + BackingStore any more. Instead, invalidations will cause the root + accelerated compositing layer to be repainted. Any BackingStore render + calls while in this state are pointless, and can safely do an early + return. + + Reviewed internally by Jakob Petsovits. + + PR #150403 + + * Api/BackingStore.cpp: + (BlackBerry::WebKit::BackingStorePrivate::render): + +2012-05-27 Arvid Nilsson <anilsson@rim.com> + + 2012-04-12 Arvid Nilsson <anilsson@rim.com> + + [BlackBerry] Web page fails to render after clicking link with target=_blank + https://bugs.webkit.org/show_bug.cgi?id=87562 + + Reviewed by Antonio Gomes. + + Clicking such a link opens a new tab. The compositor was briefly in + charge of drawing the root layer while the backing store was inactive + and the user was looking at the other tab. The problem was that the + compositor believed it was still painting the root layer even after the + backing store became active again. The flag was not properly cleared + when turning off compositing. + + Fixed by returning false from drawsRootLayer() if we don't have a root + layer. + + Reviewed internally by Filip Spacek. + + PR #149342 + + * Api/WebPageCompositor.cpp: + (BlackBerry::WebKit::WebPageCompositorPrivate::drawsRootLayer): + +2012-05-24 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] History navigation caused google.com scale not kept + https://bugs.webkit.org/show_bug.cgi?id=87438 + + Reviewed by Antonio Gomes. + Patch by Jacky Jiang <zhajiang@rim.com> + + PR: 159923 + For back/forward history navigation, we were trying to keep the values + set by dispatchViewportDataDidChange. However, when we went back from + the previous page, if the current page didn't contain the meta viewport + tag, then those values set by previous page would never be reset. + Although the current page could get correct saved scale when restoring + view state, the scale would still be clamped by zoomToFitScale which + was based on the virtual viewport of the previous page which could make + the scale incorrect. + Since we know the viewport arguments of the current document before + setLoadState on back/forward history navigation, we can reset these + previous values if the document doesn't have viewport arguments during + setLoadState. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + +2012-05-25 Mary Wu <mary.wu@torchmobile.com.cn> + + [BlackBerry] Pass http headers to loader in download request + https://bugs.webkit.org/show_bug.cgi?id=87449 + + Reviewed by Rob Buis. + + PR# 149283 + + This is to support byte-range download and we could pass http headers like + "Range" in download request to loader. + + Reviewed internally by Lyon Chen. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::download): + 2012-05-24 Mike Fenton <mifenton@rim.com> [BlackBerry] InputHandler can hold a ref on an object when document is cleared. diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index 8f2e70401..2baa8ecc1 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,165 @@ +2012-05-25 Ryosuke Niwa <rniwa@webkit.org> + + Roll chromium DEPS from r139156 to r139184. + + * DEPS: + +2012-05-25 Garrett Casto <gcasto@chromium.org> + + Allow WebTextFieldDecoratorClient to see applied decorations. + https://bugs.webkit.org/show_bug.cgi?id=86557 + + Reviewed by Kent Tamura. + + * WebKit.gyp: Added new files. + * public/WebInputElement.h: + (WebKit::WebInputElement::decorationElementFor): Returns the + WebElement attached to the WebInputElement by the given + WebTextFieldDecoratorClient, if one exists. + * src/TextFieldDecoratorImpl.cpp: + (WebKit): + * src/TextFieldDecoratorImpl.h: + (TextFieldDecoratorImpl::decoratorClient): Get the + WebTextFieldDecoratorClient owned by this object. + +2012-05-25 Mihai Parparita <mihaip@chromium.org> + + Allow synchronous XHRs to be disabled in documents + https://bugs.webkit.org/show_bug.cgi?id=87540 + + Reviewed by Eric Seidel. + + Synchronous XMLHttpRequests are a problematic API, since they result + in blocked UI threads. Some clients may wish to always disable them; + give them a setting to do so (see also r103629 for other cases where + synchronous XHRs are disabled). + + * public/WebSettings.h: + * src/WebSettingsImpl.cpp: + (WebKit::WebSettingsImpl::setSyncXHRInDocumentsEnabled): + (WebKit): + * src/WebSettingsImpl.h: + (WebSettingsImpl): + +2012-05-25 Kinuko Yasuda <kinuko@chromium.org> + + [chromium] Deprecate FileUtilities::getFileSize and getFileModifiedTime in favor of getFileMetadata + https://bugs.webkit.org/show_bug.cgi?id=87492 + + Reviewed by Adam Barth. + + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::getFileMetadata): + +2012-05-25 Ryosuke Niwa <rniwa@webkit.org> + + Roll Chromium DEPS from r139024 to r139156 in an attempt to fix Chromium Win builds. + + * DEPS: + +2012-05-25 Mark Pilgrim <pilgrim@chromium.org> + + [Chomium] Move sandboxSupport to Platform.h + https://bugs.webkit.org/show_bug.cgi?id=87518 + + Reviewed by Adam Barth. + + Part of a refactoring series. See tracking bug 82948. + + * WebKit.gyp: + * public/platform/WebKitPlatformSupport.h: + (WebKit): + (WebKitPlatformSupport): + * public/platform/android/WebSandboxSupport.h: + * public/platform/linux/WebFontFamily.h: + * public/platform/linux/WebSandboxSupport.h: + * public/platform/mac/WebSandboxSupport.h: + * public/platform/win/WebSandboxSupport.h: + * src/PlatformSupport.cpp: + (WebCore::PlatformSupport::ensureFontLoaded): + (WebCore::PlatformSupport::loadFont): + (WebCore::PlatformSupport::getFontFamilyForCharacters): + (WebCore::PlatformSupport::getRenderStyleForStrike): + +2012-05-25 Dana Jansens <danakj@chromium.org> + + [chromium] WebLayerTreeViewImpl should not hide methods in CCLayerTreeHost with signatures that match the Client interface + https://bugs.webkit.org/show_bug.cgi?id=87301 + + Reviewed by James Robinson. + + Most methods in the CCLayerTreeHostClient interface have a matching + method signature on CCLayerTreeHost that simply calls the client, if + one exists at all. However, CCLayerTreeHost::updateAnimations() does + important work in addition to calling the client. + + Currently WebLayerTreeViewImpl itself implements the interface for + CCLayerTreeHostClient as well as CCLayerTreeHost, and simply forwards + any call to a method in the client interface to its own client. This + blocks WebViewImpl from calling CCLayerTreeHost::updateAnimations, since + the method is also in the client interface. + + We change WebLayerTreeViewImpl to own a CCLayerTreeHost and a + WebLayerTreeHostClientAdapter. This fixes the shadowing by making + the two interfaces separate, and resolves lifetime issues by + ensuring that the CCLayerTreeHost is destroyed before its client. + + * src/WebLayerTreeView.cpp: + (WebKit::WebLayerTreeView::setSurfaceReady): + (WebKit::WebLayerTreeView::setRootLayer): + (WebKit::WebLayerTreeView::compositorIdentifier): + (WebKit::WebLayerTreeView::setViewportSize): + (WebKit::WebLayerTreeView::viewportSize): + (WebKit::WebLayerTreeView::setBackgroundColor): + (WebKit::WebLayerTreeView::setVisible): + (WebKit::WebLayerTreeView::setPageScaleFactorAndLimits): + (WebKit::WebLayerTreeView::startPageScaleAnimation): + (WebKit::WebLayerTreeView::setNeedsAnimate): + (WebKit::WebLayerTreeView::setNeedsRedraw): + (WebKit::WebLayerTreeView::commitRequested): + (WebKit::WebLayerTreeView::composite): + (WebKit::WebLayerTreeView::updateAnimations): + (WebKit::WebLayerTreeView::compositeAndReadback): + (WebKit::WebLayerTreeView::finishAllRendering): + (WebKit::WebLayerTreeView::context): + (WebKit::WebLayerTreeView::loseCompositorContext): + * src/WebLayerTreeViewImpl.cpp: + (WebKit): + (WebLayerTreeViewClientAdapter): + (WebKit::WebLayerTreeViewClientAdapter::WebLayerTreeViewClientAdapter): + (WebKit::WebLayerTreeViewClientAdapter::~WebLayerTreeViewClientAdapter): + (WebKit::WebLayerTreeViewImpl::create): + (WebKit::WebLayerTreeViewImpl::WebLayerTreeViewImpl): + (WebKit::WebLayerTreeViewImpl::~WebLayerTreeViewImpl): + * src/WebLayerTreeViewImpl.h: + (WebCore): + (WebKit): + (WebKit::WebLayerTreeViewImpl::layerTreeHost): + (WebLayerTreeViewImpl): + +2012-05-25 Kinuko Yasuda <kinuko@chromium.org> + + Unreviewed; rolling chromium deps. + + * DEPS: + +2012-05-25 W. James MacLean <wjmaclean@chromium.org> + + [chromium] LayerChromium should recognise existing layer active animations when the layer is added. + https://bugs.webkit.org/show_bug.cgi?id=87166 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostTest.cpp: + (WTF::MockLayerTreeHost::didAddAnimationWasCalled): + (MockLayerTreeHost): + (WTF::MockLayerTreeHost::MockLayerTreeHost): + (WTF): + (CCLayerTreeHostTestLayerAddedWithAnimation): + (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::CCLayerTreeHostTestLayerAddedWithAnimation): + (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::beginTest): + (WTF::CCLayerTreeHostTestLayerAddedWithAnimation::afterTest): + 2012-05-17 Andrey Kosyakov <caseq@chromium.org> [chromium] add instrumentation for compositing diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 27037d819..e12c78f59 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': '138307' + 'chromium_rev': '139184' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index b657c2589..dc155c9a6 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -339,9 +339,6 @@ 'public/platform/WebURLRequest.h', 'public/platform/WebURLResponse.h', 'public/platform/WebVector.h', - 'public/platform/android/WebSandboxSupport.h', - 'public/platform/mac/WebSandboxSupport.h', - 'public/platform/win/WebSandboxSupport.h', 'public/win/WebInputEventFactory.h', 'public/win/WebSandboxSupport.h', 'public/win/WebScreenInfoFactory.h', @@ -652,6 +649,7 @@ 'src/WebTextRun.cpp', 'src/WebURLLoadTiming.cpp', 'src/WebScopedUserGesture.cpp', + 'src/WebTextFieldDecoratorClient.cpp', 'src/WebUserMediaRequest.cpp', 'src/WebVideoLayer.cpp', 'src/WebViewImpl.cpp', diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h index 23e85aa73..913740d66 100644 --- a/Source/WebKit/chromium/public/WebInputElement.h +++ b/Source/WebKit/chromium/public/WebInputElement.h @@ -40,6 +40,7 @@ namespace WebCore { class HTMLInputElement; } namespace WebKit { class WebNodeCollection; + class WebTextFieldDecoratorClient; // Provides readonly access to some properties of a DOM input element node. class WebInputElement : public WebFormControlElement { @@ -103,6 +104,9 @@ namespace WebKit { // Exposes the default value of the maxLength attribute. WEBKIT_EXPORT static int defaultMaxLength(); + // Return the decoration added by the specified decorator if one exists. + WEBKIT_EXPORT WebElement decorationElementFor(WebTextFieldDecoratorClient*); + #if WEBKIT_IMPLEMENTATION WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 3089b0bdc..d9016847a 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -153,7 +153,7 @@ public: virtual void setDefaultTileSize(WebSize) = 0; virtual void setMaxUntiledLayerSize(WebSize) = 0; virtual void setFixedPositionCreatesStackingContext(bool) = 0; - + virtual void setSyncXHRInDocumentsEnabled(bool) = 0; protected: ~WebSettings() { } diff --git a/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h b/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h index a8d29f93e..772e1216b 100644 --- a/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h +++ b/Source/WebKit/chromium/public/WebTextFieldDecoratorClient.h @@ -33,6 +33,10 @@ #include "platform/WebCString.h" +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class TextFieldDecorator; } +#endif + namespace WebKit { class WebInputElement; @@ -43,6 +47,8 @@ public: // have a decoration icon. This function is called whenever a text field is // created, and should not take much time. virtual bool shouldAddDecorationTo(const WebInputElement&) = 0; + // Returns true if the decoration should be visible when it's created. + virtual bool visibleByDefault() = 0; // Image resource name for the normal state. The image is stretched to // font-size x font-size square. The function must return an existing @@ -63,6 +69,10 @@ public: // state of WebKit objects. virtual void willDetach(const WebInputElement&) = 0; +#if WEBKIT_IMPLEMENTATION + bool isClientFor(WebCore::TextFieldDecorator*); +#endif + virtual ~WebTextFieldDecoratorClient() { } }; diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h index 3e916d373..908152149 100644 --- a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -53,16 +53,12 @@ class WebIDBKey; // FIXME: Does this belong in platform? class WebIDBKeyPath; // FIXME: Does this belong in platform? class WebMessagePortChannel; // FIXME: Does this belong in platform? class WebPluginListBuilder; // FIXME: Does this belong in platform? -class WebSandboxSupport; class WebSharedWorkerRepository; // FIXME: Does this belong in platform? class WebStorageNamespace; // FIXME: Does this belong in platform? // FIXME: Eventually all these API will need to move to WebKit::Platform. class WebKitPlatformSupport : public Platform { public: - // May return null if sandbox support is not necessary - virtual WebSandboxSupport* sandboxSupport() { return 0; } - // DOM Storage -------------------------------------------------- // Return a LocalStorage namespace that corresponds to the following path. diff --git a/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h index 3f39f195d..ab984e1b5 100644 --- a/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h +++ b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h @@ -28,16 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSandboxSupport_h -#define WebSandboxSupport_h - -namespace WebKit { - -// Empty class, as we need it to compile. -class WebSandboxSupport { -public: -}; - -} // namespace WebKit - -#endif +#include "../../../../../Platform/chromium/public/android/WebSandboxSupport.h" diff --git a/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h index 47f037882..a37750bfd 100644 --- a/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h +++ b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h @@ -28,20 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebFontFamily_h -#define WebFontFamily_h - -#include "../WebCString.h" -#include "../WebCommon.h" - -namespace WebKit { - -struct WebFontFamily { - WebCString name; - bool isBold; - bool isItalic; -}; - -} // namespace WebKit - -#endif // WebFontFamily_h +#include "../../../../../Platform/chromium/public/linux/WebFontFamily.h" diff --git a/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h index 154505662..23f4319df 100644 --- a/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h +++ b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h @@ -28,38 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSandboxSupport_h -#define WebSandboxSupport_h - -#include "../WebCommon.h" -#include "../WebString.h" -#include "WebFontFamily.h" - -namespace WebKit { - -struct WebFontRenderStyle; - -// Put methods here that are required due to sandbox restrictions. -class WebSandboxSupport { -public: - // Fonts --------------------------------------------------------------- - - // Get a font family which contains glyphs for the given Unicode - // code-points. - // characters: a UTF-16 encoded string - // numCharacters: the number of 16-bit words in |characters| - // preferredLocale: preferred locale identifier for the |characters| - // (e.g. "en", "ja", "zh-CN") - // - // Returns a string with the font family on an empty string if the - // request cannot be satisfied. - // Returns a WebFontFamily instance with the font name. The instance has empty font name if the request cannot be satisfied. - // FIXME: Make this to be a pure virtual function after transition. - virtual void getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*) = 0; - - virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0; -}; - -} // namespace WebKit - -#endif +#include "../../../../../Platform/chromium/public/linux/WebSandboxSupport.h" diff --git a/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h index 34280c6eb..d01ccf6b6 100644 --- a/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h +++ b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h @@ -28,34 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSandboxSupport_h -#define WebSandboxSupport_h - -typedef struct CGFont* CGFontRef; - -#ifdef __OBJC__ -@class NSFont; -#else -class NSFont; -#endif - -namespace WebKit { - -// Put methods here that are required due to sandbox restrictions. -class WebSandboxSupport { -public: - // Given an input font - |srcFont| [which can't be loaded due to sandbox - // restrictions]. Return a font belonging to an equivalent font file - // that can be used to access the font and a unique identifier corresponding - // to the on-disk font file. - // - // If this function succeeds, the caller assumes ownership of the |out| - // parameter and must call CGFontRelease() to unload it when done. - // - // Returns: true on success, false on error. - virtual bool loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID) = 0; -}; - -} // namespace WebKit - -#endif +#include "../../../../../Platform/chromium/public/mac/WebSandboxSupport.h" diff --git a/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h index 3522c7284..20d957770 100644 --- a/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h +++ b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h @@ -28,25 +28,4 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebSandboxSupport_h -#define WebSandboxSupport_h - -typedef struct HFONT__* HFONT; - -namespace WebKit { - -// Put methods here that are required due to sandbox restrictions. -class WebSandboxSupport { -public: - // Sometimes a Win32 API call will fail because a font is not loaded, - // and due to sandbox restrictions, the current process may be unable - // to access the filesystem to load the font. So, this call serves as - // a failover to ask the embedder to try some other way to load the - // font (usually by delegating to an empowered process to have it load - // the font). Returns true if the font was successfully loaded. - virtual bool ensureFontLoaded(HFONT) = 0; -}; - -} // namespace WebKit - -#endif +#include "../../../../../Platform/chromium/public/win/WebSandboxSupport.h" diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index bc3061fb8..467d6389d 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -1037,7 +1037,7 @@ void ChromeClientImpl::addTextFieldDecorationsTo(HTMLInputElement* input) if (!decorators[i]->willAddDecorationTo(input)) continue; RefPtr<TextFieldDecorationElement> decoration = TextFieldDecorationElement::create(input->document(), decorators[i].get()); - decoration->decorate(input); + decoration->decorate(input, decorators[i]->visibleByDefault()); } } diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index fb06ccdf4..7cc7f5a6e 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -317,20 +317,6 @@ bool PlatformSupport::deleteEmptyDirectory(const String& path) return WebKit::Platform::current()->fileUtilities()->deleteEmptyDirectory(path); } -bool PlatformSupport::getFileSize(const String& path, long long& result) -{ - return WebKit::Platform::current()->fileUtilities()->getFileSize(path, result); -} - -bool PlatformSupport::getFileModificationTime(const String& path, time_t& result) -{ - double modificationTime; - if (!WebKit::Platform::current()->fileUtilities()->getFileModificationTime(path, modificationTime)) - return false; - result = static_cast<time_t>(modificationTime); - return true; -} - bool PlatformSupport::getFileMetadata(const String& path, FileMetadata& result) { WebFileInfo webFileInfo; @@ -414,7 +400,7 @@ PassOwnPtr<AsyncFileSystem> PlatformSupport::createAsyncFileSystem() #if OS(WINDOWS) bool PlatformSupport::ensureFontLoaded(HFONT font) { - WebSandboxSupport* ss = webKitPlatformSupport()->sandboxSupport(); + WebSandboxSupport* ss = WebKit::Platform::current()->sandboxSupport(); // if there is no sandbox, then we can assume the font // was able to be loaded successfully already @@ -425,7 +411,7 @@ bool PlatformSupport::ensureFontLoaded(HFONT font) #if OS(DARWIN) bool PlatformSupport::loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID) { - WebSandboxSupport* ss = webKitPlatformSupport()->sandboxSupport(); + WebSandboxSupport* ss = WebKit::Platform::current()->sandboxSupport(); if (ss) return ss->loadFont(srcFont, out, fontID); @@ -448,8 +434,8 @@ void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t family->isItalic = false; #else WebFontFamily webFamily; - if (webKitPlatformSupport()->sandboxSupport()) - webKitPlatformSupport()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale, &webFamily); + if (WebKit::Platform::current()->sandboxSupport()) + WebKit::Platform::current()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters, preferredLocale, &webFamily); else WebFontInfo::familyForChars(characters, numCharacters, preferredLocale, &webFamily); family->name = String::fromUTF8(webFamily.name.data(), webFamily.name.length()); @@ -463,8 +449,8 @@ void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle #if !OS(ANDROID) WebFontRenderStyle style; - if (webKitPlatformSupport()->sandboxSupport()) - webKitPlatformSupport()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); + if (WebKit::Platform::current()->sandboxSupport()) + WebKit::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); else WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); diff --git a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp index e58c022ee..a74aa825a 100644 --- a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp +++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp @@ -56,12 +56,22 @@ TextFieldDecoratorImpl::~TextFieldDecoratorImpl() { } +WebTextFieldDecoratorClient* TextFieldDecoratorImpl::decoratorClient() +{ + return m_client; +} + bool TextFieldDecoratorImpl::willAddDecorationTo(HTMLInputElement* input) { ASSERT(input); return m_client->shouldAddDecorationTo(WebInputElement(input)); } +bool TextFieldDecoratorImpl::visibleByDefault() +{ + return m_client->visibleByDefault(); +} + CachedImage* TextFieldDecoratorImpl::imageForNormalState() { if (!m_cachedImageForNormalState) { diff --git a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h index 667475282..8f52069ba 100644 --- a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h +++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h @@ -43,8 +43,11 @@ public: static PassOwnPtr<TextFieldDecoratorImpl> create(WebTextFieldDecoratorClient*); virtual ~TextFieldDecoratorImpl(); + WebTextFieldDecoratorClient* decoratorClient(); + private: virtual bool willAddDecorationTo(WebCore::HTMLInputElement*) OVERRIDE; + virtual bool visibleByDefault() OVERRIDE; virtual WebCore::CachedImage* imageForNormalState() OVERRIDE; virtual WebCore::CachedImage* imageForDisabledState() OVERRIDE; virtual WebCore::CachedImage* imageForReadonlyState() OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index adae9dac8..c58e90704 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -31,11 +31,16 @@ #include "config.h" #include "WebInputElement.h" +#include "ElementShadow.h" #include "HTMLDataListElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" +#include "ShadowRoot.h" #include "TextControlInnerElements.h" +#include "TextFieldDecorationElement.h" +#include "TextFieldDecoratorImpl.h" #include "WebNodeCollection.h" +#include "WebTextFieldDecoratorClient.h" #include "platform/WebString.h" #include <wtf/PassRefPtr.h> @@ -221,6 +226,18 @@ int WebInputElement::defaultMaxLength() return HTMLInputElement::maximumLength; } +WebElement WebInputElement::decorationElementFor(WebTextFieldDecoratorClient* decoratorClient) +{ + ShadowRoot* shadowRoot = unwrap<HTMLInputElement>()->youngestShadowRoot(); + while (shadowRoot) { + TextFieldDecorationElement* decoration = TextFieldDecorationElement::fromShadowRoot(shadowRoot); + if (decoration && decoratorClient->isClientFor(decoration->textFieldDecorator())) + return WebElement(decoration); + shadowRoot = shadowRoot->olderShadowRoot(); + } + return WebElement(); +} + WebInputElement::WebInputElement(const PassRefPtr<HTMLInputElement>& elem) : WebFormControlElement(elem) { diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp index a4d7d918a..65a2a63b1 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeView.cpp @@ -75,98 +75,98 @@ bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer void WebLayerTreeView::setSurfaceReady() { - m_private->setSurfaceReady(); + m_private->layerTreeHost()->setSurfaceReady(); } void WebLayerTreeView::setRootLayer(WebLayer *root) { if (root) - m_private->setRootLayer(*root); + m_private->layerTreeHost()->setRootLayer(*root); else - m_private->setRootLayer(PassRefPtr<LayerChromium>()); + m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>()); } int WebLayerTreeView::compositorIdentifier() { - return m_private->compositorIdentifier(); + return m_private->layerTreeHost()->compositorIdentifier(); } void WebLayerTreeView::setViewportSize(const WebSize& viewportSize) { - m_private->setViewportSize(viewportSize); + m_private->layerTreeHost()->setViewportSize(viewportSize); } WebSize WebLayerTreeView::viewportSize() const { - return WebSize(m_private->viewportSize()); + return WebSize(m_private->layerTreeHost()->viewportSize()); } void WebLayerTreeView::setBackgroundColor(WebColor color) { - m_private->setBackgroundColor(color); + m_private->layerTreeHost()->setBackgroundColor(color); } void WebLayerTreeView::setVisible(bool visible) { - m_private->setVisible(visible); + m_private->layerTreeHost()->setVisible(visible); } void WebLayerTreeView::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) { - m_private->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); + m_private->layerTreeHost()->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); } void WebLayerTreeView::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) { - m_private->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); + m_private->layerTreeHost()->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); } void WebLayerTreeView::setNeedsAnimate() { - m_private->setNeedsAnimate(); + m_private->layerTreeHost()->setNeedsAnimate(); } void WebLayerTreeView::setNeedsRedraw() { - m_private->setNeedsRedraw(); + m_private->layerTreeHost()->setNeedsRedraw(); } bool WebLayerTreeView::commitRequested() const { - return m_private->commitRequested(); + return m_private->layerTreeHost()->commitRequested(); } void WebLayerTreeView::composite() { if (CCProxy::hasImplThread()) - m_private->setNeedsCommit(); + m_private->layerTreeHost()->setNeedsCommit(); else - m_private->composite(); + m_private->layerTreeHost()->composite(); } void WebLayerTreeView::updateAnimations(double frameBeginTime) { - m_private->updateAnimations(frameBeginTime); + m_private->layerTreeHost()->updateAnimations(frameBeginTime); } bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect) { - return m_private->compositeAndReadback(pixels, rect); + return m_private->layerTreeHost()->compositeAndReadback(pixels, rect); } void WebLayerTreeView::finishAllRendering() { - m_private->finishAllRendering(); + m_private->layerTreeHost()->finishAllRendering(); } WebGraphicsContext3D* WebLayerTreeView::context() { - return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->context()); + return GraphicsContext3DPrivate::extractWebGraphicsContext3D(m_private->layerTreeHost()->context()); } void WebLayerTreeView::loseCompositorContext(int numTimes) { - m_private->loseContext(numTimes); + m_private->layerTreeHost()->loseContext(numTimes); } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 1c0a0e816..45a99603c 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -29,6 +29,7 @@ #include "CCThreadImpl.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" +#include "cc/CCLayerTreeHost.h" #include "cc/CCThreadProxy.h" #include "platform/WebGraphicsContext3D.h" #include "platform/WebLayer.h" @@ -41,18 +42,48 @@ using namespace WebCore; namespace WebKit { +// Converts messages from CCLayerTreeHostClient to WebLayerTreeViewClient. +class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient { +public: + WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) : m_client(client) { } + virtual ~WebLayerTreeViewClientAdapter() { } + + // CCLayerTreeHostClient implementation + virtual void willBeginFrame() OVERRIDE { m_client->willBeginFrame(); } + virtual void didBeginFrame() OVERRIDE { m_client->didBeginFrame(); } + virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); } + virtual void layout() OVERRIDE { m_client->layout(); } + virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } + virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE + { + OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D()); + if (!webContext) + return 0; + return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ ); + } + virtual void didRecreateContext(bool success) OVERRIDE { m_client->didRebindGraphicsContext(success); } + virtual void willCommit() OVERRIDE { m_client->willCommit(); } + virtual void didCommit() OVERRIDE { m_client->didCommit(); } + virtual void didCommitAndDrawFrame() OVERRIDE { m_client->didCommitAndDrawFrame(); } + virtual void didCompleteSwapBuffers() OVERRIDE { m_client->didCompleteSwapBuffers(); } + virtual void scheduleComposite() OVERRIDE { m_client->scheduleComposite(); } + +private: + WebLayerTreeViewClient* m_client; +}; + PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) { - OwnPtr<WebLayerTreeViewImpl> host = adoptPtr(new WebLayerTreeViewImpl(client, settings)); - if (!host->initialize()) + OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings)); + if (!impl->layerTreeHost()) return nullptr; - host->setRootLayer(root); - return host.release(); + impl->layerTreeHost()->setRootLayer(root); + return impl.release(); } WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings) - : CCLayerTreeHost(this, settings) - , m_client(client) + : m_clientAdapter(adoptPtr(new WebLayerTreeViewClientAdapter(client))) + , m_layerTreeHost(CCLayerTreeHost::create(m_clientAdapter.get(), settings)) { } @@ -60,68 +91,4 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { } -void WebLayerTreeViewImpl::willBeginFrame() -{ - m_client->willBeginFrame(); -} - -void WebLayerTreeViewImpl::didBeginFrame() -{ - m_client->didBeginFrame(); -} - -void WebLayerTreeViewImpl::updateAnimations(double monotonicFrameBeginTime) -{ - m_client->updateAnimations(monotonicFrameBeginTime); -} - -void WebLayerTreeViewImpl::layout() -{ - m_client->layout(); -} - -void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) -{ - m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale); -} - -PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext() -{ - OwnPtr<WebGraphicsContext3D> webContext = adoptPtr(m_client->createContext3D()); - if (!webContext) - return 0; - - return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ ); -} - -void WebLayerTreeViewImpl::didRecreateContext(bool success) -{ - m_client->didRebindGraphicsContext(success); -} - -void WebLayerTreeViewImpl::willCommit() -{ - m_client->willCommit(); -} - -void WebLayerTreeViewImpl::didCommit() -{ - m_client->didCommit(); -} - -void WebLayerTreeViewImpl::didCommitAndDrawFrame() -{ - m_client->didCommitAndDrawFrame(); -} - -void WebLayerTreeViewImpl::didCompleteSwapBuffers() -{ - m_client->didCompleteSwapBuffers(); -} - -void WebLayerTreeViewImpl::scheduleComposite() -{ - m_client->scheduleComposite(); -} - } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index f854b7e60..1184342e8 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -27,37 +27,30 @@ #define WebLayerTreeViewImpl_h #include "platform/WebLayerTreeView.h" -#include "cc/CCLayerTreeHost.h" +#include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +namespace WebCore { +class CCLayerTreeHost; +} + namespace WebKit { class WebLayer; class WebLayerTreeViewClient; +class WebLayerTreeViewClientAdapter; -class WebLayerTreeViewImpl : public WebCore::CCLayerTreeHost, public WebCore::CCLayerTreeHostClient { +class WebLayerTreeViewImpl { public: static PassOwnPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&); virtual ~WebLayerTreeViewImpl(); - virtual void willBeginFrame() OVERRIDE; - virtual void didBeginFrame() OVERRIDE; - virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE; - virtual void layout() OVERRIDE; - virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE; - virtual PassRefPtr<WebCore::GraphicsContext3D> createContext() OVERRIDE; - virtual void didRecreateContext(bool success) OVERRIDE; - virtual void willCommit() OVERRIDE; - virtual void didCommit() OVERRIDE; - virtual void didCommitAndDrawFrame() OVERRIDE; - virtual void didCompleteSwapBuffers() OVERRIDE; - - // Only used in the single threaded path. - virtual void scheduleComposite() OVERRIDE; + WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } private: WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&); - WebLayerTreeViewClient* m_client; + OwnPtr<WebLayerTreeViewClientAdapter> m_clientAdapter; + OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 78770a95c..ffb8c9bfe 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -611,4 +611,10 @@ void WebSettingsImpl::setMaxUntiledLayerSize(WebSize size) m_maxUntiledLayerSize = size; } +void WebSettingsImpl::setSyncXHRInDocumentsEnabled(bool enabled) +{ + m_settings->setSyncXHRInDocumentsEnabled(enabled); +} + + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 1c3b0e7e2..033784039 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -147,6 +147,7 @@ public: virtual void setViewportEnabled(bool); virtual void setMediaPlaybackRequiresUserGesture(bool); virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setSyncXHRInDocumentsEnabled(bool); bool showFPSCounter() const { return m_showFPSCounter; } bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } diff --git a/Source/WebKit/chromium/src/WebTextFieldDecoratorClient.cpp b/Source/WebKit/chromium/src/WebTextFieldDecoratorClient.cpp new file mode 100644 index 000000000..4d5b16174 --- /dev/null +++ b/Source/WebKit/chromium/src/WebTextFieldDecoratorClient.cpp @@ -0,0 +1,46 @@ +/* + * 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 "WebTextFieldDecoratorClient.h" + +#include "TextFieldDecorationElement.h" +#include "TextFieldDecoratorImpl.h" + +using namespace WebCore; + +namespace WebKit { + +bool WebTextFieldDecoratorClient::isClientFor(TextFieldDecorator* decorator) +{ + return static_cast<TextFieldDecoratorImpl*>(decorator)->decoratorClient() == this; +} + +} // namespace WebKit diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp index 9e28a5b82..1275ec854 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp @@ -26,6 +26,7 @@ #include "cc/CCLayerTreeHost.h" +#include "AnimationIdVendor.h" #include "CCAnimationTestCommon.h" #include "CCOcclusionTrackerTestCommon.h" #include "CCTiledLayerTestCommon.h" @@ -44,6 +45,7 @@ #include "cc/CCScopedThreadProxy.h" #include "cc/CCTextureUpdater.h" #include "cc/CCThreadTask.h" +#include "cc/CCTimingFunction.h" #include "platform/WebThread.h" #include <gmock/gmock.h> #include <gtest/gtest.h> @@ -181,14 +183,27 @@ public: return MockLayerTreeHostImpl::create(m_testHooks, copySettings, client); } + virtual void didAddAnimation() OVERRIDE + { + m_didAddAnimationWasCalled = true; + CCLayerTreeHost::didAddAnimation(); + } + + bool didAddAnimationWasCalled() + { + return m_didAddAnimationWasCalled; + } + private: MockLayerTreeHost(TestHooks* testHooks, CCLayerTreeHostClient* client, const CCSettings& settings) : CCLayerTreeHost(client, settings) , m_testHooks(testHooks) + , m_didAddAnimationWasCalled(false) { } TestHooks* m_testHooks; + bool m_didAddAnimationWasCalled; }; class CompositorFakeWebGraphicsContext3DWithTextureTracking : public CompositorFakeWebGraphicsContext3D { @@ -2814,4 +2829,37 @@ private: SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestFinishAllRendering) +// Layers added to tree with existing active animations should have the animation +// correctly recognized. +class CCLayerTreeHostTestLayerAddedWithAnimation : public CCLayerTreeHostTest { +public: + CCLayerTreeHostTestLayerAddedWithAnimation() { } + + virtual void beginTest() + { + EXPECT_FALSE(static_cast<MockLayerTreeHost*>(layerTreeHost())->didAddAnimationWasCalled()); + + RefPtr<LayerChromium> layer = LayerChromium::create(); + layer->setLayerAnimationDelegate(&m_animationDelegate); + + // Any valid CCAnimationCurve will do here. + OwnPtr<CCAnimationCurve> curve(CCEaseTimingFunction::create()); + OwnPtr<CCActiveAnimation> animation(CCActiveAnimation::create(curve.release(), AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), CCActiveAnimation::Opacity)); + layer->layerAnimationController()->add(animation.release()); + + // We add the animation *before* attaching the layer to the tree. + m_layerTreeHost->rootLayer()->addChild(layer); + EXPECT_TRUE(static_cast<MockLayerTreeHost*>(layerTreeHost())->didAddAnimationWasCalled()); + + endTest(); + } + + virtual void afterTest() { } + +private: + ::TestHooks m_animationDelegate; +}; + +SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLayerAddedWithAnimation) + } // namespace diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index 406c4c3dc..71935613b 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1 +1,17 @@ +2012-05-25 Lu Guanqun <guanqun.lu@intel.com> + + [GTK] fix compilation for webkitwebview.cpp + https://bugs.webkit.org/show_bug.cgi?id=87473 + + Reviewed by Martin Robinson. + + When ACCELERATED_COMPOSITING and TEXTURE_MAPPER_GL is not set, + the local variable 'priv' won't be used. Therefore the following warning: + + ../../../Source/WebKit/gtk/webkit/webkitwebview.cpp: In function ‘void webkit_web_view_realize(GtkWidget*)’: + ../../../Source/WebKit/gtk/webkit/webkitwebview.cpp:971:27: warning: unused variable ‘priv’ [-Wunused-variable] + + * webkit/webkitwebview.cpp: + (webkit_web_view_realize): + == Rolled over to ChangeLog-2012-05-22 == diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 300ea8c99..1a54ea877 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -968,8 +968,6 @@ 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; @@ -1010,6 +1008,7 @@ static void webkit_web_view_realize(GtkWidget* widget) GdkWindow* window = gdk_window_new(gtk_widget_get_parent_window(widget), &attributes, attributes_mask); #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER_GL) + WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW(widget)->priv; priv->hasNativeWindow = gdk_window_ensure_native(window); #endif gtk_widget_set_window(widget, window); diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 1d020e11c..bdf204b14 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -1011,9 +1011,9 @@ void QWebElement::appendInside(const QString &markup) if (!m_element->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent); - ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception); + m_element->appendChild(fragment, exception); } @@ -1056,9 +1056,8 @@ void QWebElement::prependInside(const QString &markup) if (!m_element->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent); - ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception); if (m_element->hasChildNodes()) m_element->insertBefore(fragment, m_element->firstChild(), exception); @@ -1108,9 +1107,9 @@ void QWebElement::prependOutside(const QString &markup) if (!parent->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent); - ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception); + parent->insertBefore(fragment, m_element, exception); } @@ -1158,9 +1157,9 @@ void QWebElement::appendOutside(const QString &markup) if (!parent->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent); - ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception); + if (!m_element->nextSibling()) parent->appendChild(fragment, exception); else @@ -1304,7 +1303,8 @@ void QWebElement::encloseContentsWith(const QString &markup) if (!m_element->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent); + ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(m_element), AllowScriptingContent, exception); if (!fragment || !fragment->firstChild()) return; @@ -1314,8 +1314,6 @@ void QWebElement::encloseContentsWith(const QString &markup) if (!insertionPoint) return; - ExceptionCode exception = 0; - // reparent children for (RefPtr<Node> child = m_element->firstChild(); child;) { RefPtr<Node> next = child->nextSibling(); @@ -1379,7 +1377,8 @@ void QWebElement::encloseWith(const QString &markup) if (!parent->isHTMLElement()) return; - RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent); + ExceptionCode exception = 0; + RefPtr<DocumentFragment> fragment = createContextualFragment(markup, toHTMLElement(parent), AllowScriptingContent, exception); if (!fragment || !fragment->firstChild()) return; @@ -1395,7 +1394,6 @@ void QWebElement::encloseWith(const QString &markup) // we no longer have access to the nodes it contained. Node* siblingNode = m_element->nextSibling(); - ExceptionCode exception = 0; insertionPoint->appendChild(m_element, exception); if (!siblingNode) diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 9e84eeeab..d9b00773b 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -2143,7 +2143,7 @@ bool QWebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg, const QStr // double the &'s because single & will underline the following character // (Accelerator mnemonics) QString escMsg(msg); - escMsg.replace(QChar::fromAscii('&'), QString::fromAscii("&&")); + escMsg.replace(QChar::fromLatin1('&'), QLatin1String("&&")); dlg.setLabelText(escMsg); dlg.setTextEchoMode(QLineEdit::Normal); diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index e823f86e5..bf8496bbb 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,27 @@ +2012-05-27 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] Trivial unreviewed build fix with newer Qt + + * Api/qwebpage.cpp: + (QWebPage::javaScriptPrompt): Don't use deprecated QString/QChar functions. + +2012-05-24 Ryosuke Niwa <rniwa@webkit.org> + + createContextualFragment and insertAdjacentHTML should throw syntax error + https://bugs.webkit.org/show_bug.cgi?id=87454 + + Reviewed by Darin Adler. + + Pass an ExceptionCode to createContextualFragment. + + * Api/qwebelement.cpp: + (QWebElement::appendInside): + (QWebElement::prependInside): + (QWebElement::prependOutside): + (QWebElement::appendOutside): + (QWebElement::encloseContentsWith): + (QWebElement::encloseWith): + 2012-05-25 Csaba Osztrogonác <ossy@webkit.org> [Qt] Buildfix for newer Qt5 diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 471fef3de..8e6d35209 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,20 @@ +2012-05-25 Lynn Neir <lynn.neir@skype.net> + + Added methods needed to implement backend for DRT's TextInputController on windows, https://bugs.webkit.org/show_bug.cgi?id=32021 + + Reviewed by Eric Seidel. + + * Interfaces/IWebViewPrivate.idl: + * WebView.cpp: + (WebView::setCompositionForTesting): + (WebView::hasCompositionForTesting): + (WebView::confirmCompositionForTesting): + (WebView::compositionRangeForTesting): + (WebView::firstRectForCharacterRangeForTesting): + (WebView::selectedRangeForTesting): + * WebView.h: + (WebView): + 2012-05-21 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Move setEditingBehavior() from layoutTestController to window.internals diff --git a/Source/WebKit/win/Interfaces/IWebViewPrivate.idl b/Source/WebKit/win/Interfaces/IWebViewPrivate.idl index b4619494f..6b51cb3e5 100644 --- a/Source/WebKit/win/Interfaces/IWebViewPrivate.idl +++ b/Source/WebKit/win/Interfaces/IWebViewPrivate.idl @@ -277,4 +277,17 @@ interface IWebViewPrivate : IUnknown HRESULT registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing([in] BSTR scheme); HRESULT registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing([in] BSTR scheme); + // Used by TextInputController in DumpRenderTree + + HRESULT setCompositionForTesting([in] BSTR composition,[in] UINT from,[in] UINT length); + + HRESULT hasCompositionForTesting([out, retval] BOOL* result); + + HRESULT confirmCompositionForTesting([in] BSTR composition); + + HRESULT compositionRangeForTesting([out] UINT* startPosition, [out] UINT* length); + + HRESULT firstRectForCharacterRangeForTesting([in] UINT location, [in] UINT length, [out, retval] RECT* resultRect); + + HRESULT selectedRangeForTesting([out] UINT* location, [out] UINT* length); } diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index faebc7533..cc2df329b 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -33,6 +33,7 @@ #include "FullscreenVideoController.h" #include "MarshallingHelpers.h" #include "SoftLinking.h" +#include "TextIterator.h" #include "WebBackForwardList.h" #include "WebChromeClient.h" #include "WebContextMenuClient.h" @@ -6883,3 +6884,140 @@ void WebView::fullScreenClientForceRepaint() } #endif +// Used by TextInputController in DumpRenderTree + +HRESULT STDMETHODCALLTYPE WebView::setCompositionForTesting( + /* [in] */ BSTR composition, + /* [in] */ UINT from, + /* [in] */ UINT length) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return E_FAIL; + + String compositionStr(composition, SysStringLen(composition)); + + Vector<CompositionUnderline> underlines; + underlines.append(CompositionUnderline(0, compositionStr.length(), Color(Color::black), false)); + frame->editor()->setComposition(compositionStr, underlines, from, from + length); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::hasCompositionForTesting(/* [out, retval] */ BOOL* result) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return E_FAIL; + + *result = frame && frame->editor()->hasComposition(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::confirmCompositionForTesting(/* [in] */ BSTR composition) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return E_FAIL; + + String compositionStr(composition, SysStringLen(composition)); + + if (compositionStr.isNull()) + frame->editor()->confirmComposition(); + + frame->editor()->confirmComposition(compositionStr); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::compositionRangeForTesting(/* [out] */ UINT* startPosition, /* [out] */ UINT* length) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame || !frame->editor()->canEdit()) + return E_FAIL; + + RefPtr<Range> range = frame->editor()->compositionRange(); + + if (!range) + return E_FAIL; + + *startPosition = range->startOffset(); + *length = range->startOffset() + range->endOffset(); + + return S_OK; +} + + +HRESULT STDMETHODCALLTYPE WebView::firstRectForCharacterRangeForTesting( + /* [in] */ UINT location, + /* [in] */ UINT length, + /* [out, retval] */ RECT* resultRect) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return E_FAIL; + + IntRect resultIntRect; + resultIntRect.setLocation(IntPoint(0, 0)); + resultIntRect.setSize(IntSize(0, 0)); + + if (location > INT_MAX) + return E_FAIL; + if (length > INT_MAX || location + length > INT_MAX) + length = INT_MAX - location; + + RefPtr<Range> range = TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length); + + if (!range) + return E_FAIL; + + ASSERT(range->startContainer()); + ASSERT(range->endContainer()); + + IntRect rect = frame->editor()->firstRectForRange(range.get()); + resultIntRect = frame->view()->contentsToWindow(rect); + + resultRect->left = resultIntRect.x(); + resultRect->top = resultIntRect.y(); + resultRect->right = resultIntRect.x() + resultIntRect.width(); + resultRect->bottom = resultIntRect.y() + resultIntRect.height(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::selectedRangeForTesting(/* [out] */ UINT* location, /* [out] */ UINT* length) +{ + if (!m_page) + return E_FAIL; + + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return E_FAIL; + + RefPtr<Range> range = frame->editor()->selectedRange(); + + size_t locationSize; + size_t lengthSize; + if (range && TextIterator::getLocationAndLengthFromRange(frame->selection()->rootEditableElementOrDocumentElement(), range.get(), locationSize, lengthSize)) { + *location = static_cast<UINT>(locationSize); + *length = static_cast<UINT>(lengthSize); + } + + return S_OK; +} diff --git a/Source/WebKit/win/WebView.h b/Source/WebKit/win/WebView.h index 3a0f95aff..821c7e9f4 100644 --- a/Source/WebKit/win/WebView.h +++ b/Source/WebKit/win/WebView.h @@ -962,6 +962,25 @@ public: WebCore::Element* fullScreenElement() const { return m_fullScreenElement.get(); } #endif + // Used by TextInputController in DumpRenderTree + + HRESULT STDMETHODCALLTYPE setCompositionForTesting( + /* [in] */ BSTR composition, + /* [in] */ UINT from, + /* [in] */ UINT length); + + HRESULT STDMETHODCALLTYPE hasCompositionForTesting(/* [out, retval] */ BOOL* result); + + HRESULT STDMETHODCALLTYPE confirmCompositionForTesting(/* [in] */ BSTR composition); + + HRESULT STDMETHODCALLTYPE compositionRangeForTesting(/* [out] */ UINT* startPosition, /* [out] */ UINT* length); + + HRESULT STDMETHODCALLTYPE firstRectForCharacterRangeForTesting( + /* [in] */ UINT location, + /* [in] */ UINT length, + /* [out, retval] */ RECT* resultRect); + + HRESULT STDMETHODCALLTYPE selectedRangeForTesting(/* [out] */ UINT* location, /* [out] */ UINT* length); private: void setZoomMultiplier(float multiplier, bool isTextOnly); float zoomMultiplier(bool isTextOnly); diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index f59a69da0..9c8efa89e 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,125 @@ +2012-05-26 Geoffrey Garen <ggaren@apple.com> + + WebKit should be lazy-finalization-safe (esp. the DOM) v2 + https://bugs.webkit.org/show_bug.cgi?id=87581 + + Reviewed by Oliver Hunt. + + * WebProcess/Plugins/Netscape/JSNPObject.cpp: + (WebKit::JSNPObject::destroy): + (WebKit::JSNPObject::leakNPObject): + * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp: + (WebKit::NPRuntimeObjectMap::finalize): Use static_cast instead of jsCast because + jsCast does Structure-based validation, and our Structure is not guaranteed + to be alive when we get finalized. + +2012-05-25 Maciej Stachowiak <mjs@apple.com> + + REGRESSION (r116720): Subframe PDF scrolls extremely slowly + https://bugs.webkit.org/show_bug.cgi?id=87557 + <rdar://problem/11499408> + + Reviewed by Anders Carlsson. + + It's not possible to make an automated test for this. + + * WebProcess/Plugins/PDF/BuiltInPDFView.mm: + (WebKit::BuiltInPDFView::wantsWheelEvents): Return true instead of false and delete + misleading comment. While the built-in PDF view would get added to the set of scrollable + areas anyway, there are some code paths that check wantsWheelEvents explicitly, so it seems + necessary to reutrn true. + +2012-05-25 Brady Eidson <beidson@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87418 + WebBackForwardList should separate "has no current index" from the integer value of the current index + + This patch also renames "m_current" to "m_currentIndex" for clarity and symmetry with + other variable names that reference "index", + + It also removes the m_closed and m_enabled flags which were never actually used. + + Reviewed by Darin Adler. + + * UIProcess/WebBackForwardList.cpp: + (WebKit::WebBackForwardList::WebBackForwardList): + (WebKit::WebBackForwardList::addItem): + (WebKit::WebBackForwardList::goToItem): + (WebKit::WebBackForwardList::currentItem): + (WebKit::WebBackForwardList::backItem): + (WebKit::WebBackForwardList::forwardItem): + (WebKit::WebBackForwardList::itemAtIndex): + (WebKit::WebBackForwardList::backListCount): + (WebKit::WebBackForwardList::forwardListCount): + (WebKit::WebBackForwardList::backListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::forwardListAsImmutableArrayWithLimit): + (WebKit::WebBackForwardList::clear): + + * UIProcess/WebBackForwardList.h: + (WebKit::WebBackForwardList::currentIndex): + (WebBackForwardList): + + * UIProcess/cf/WebBackForwardListCF.cpp: + (WebKit::WebBackForwardList::createCFDictionaryRepresentation): + (WebKit::WebBackForwardList::restoreFromCFDictionaryRepresentation): + +2012-05-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=87529 + Background tabs hosted in window server flash before painting + when they first become active + + Reviewed by Anders Carlsson. + + Initialize to LayerHostingModeInWindowServer if that is + available to avoid having to re-make the context and re-set + everything later on. + * UIProcess/WebPageProxy.cpp: + (WebKit::WebPageProxy::WebPageProxy): + +2012-05-25 Mario Sanchez Prada <msanchez@igalia.com> + + [GTK][WK2] Implement API for generic permission requests + https://bugs.webkit.org/show_bug.cgi?id=84018 + + Reviewed by Martin Robinson. + + Added new 'permission-request' signal to WebKitWebView, to be + fired when WebKit needs confirmation from the user on whether to + allow or deny certain operations, such as sharing the user's + location with web site through the Geolocation API. + + New WebKitPermissionRequest interface, providing allow() and + deny() operations, to be called over the objects implementing it + when emitted along with the new 'permission-request' signal. + + * UIProcess/API/gtk/WebKitPermissionRequest.cpp: Added. + (webkit_permission_request_default_init): + (webkit_permission_request_allow): + (webkit_permission_request_deny): + * UIProcess/API/gtk/WebKitPermissionRequest.h: Added. + (_WebKitPermissionRequestIface): + * GNUmakefile.am: Added new files. + + Added the new signal to WebKitWebView, providing a default handler + that will just deny the request when the signal is not handled. + + * UIProcess/API/gtk/WebKitWebView.cpp: + (webkitWebViewDecidePermissionRequest): Default handler. + (webkit_web_view_class_init): Declare the new signal and connect + to the default handler. + (webkitWebViewMakePermissionRequest): Helper function to create a + make a new permission request and emit the new signal signal. + * UIProcess/API/gtk/WebKitWebView.h: + (_WebKitWebViewClass): + * UIProcess/API/gtk/WebKitWebViewPrivate.h: Declare the creational + function webkitWebViewMakePermissionRequest for internal use only. + + Updated documentation files. + + * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml: + * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: + 2012-05-25 Grzegorz Czajkowski <g.czajkowski@samsung.com> [WK2] Fix client interface size for WKPageContextMenuClient. diff --git a/Source/WebKit2/GNUmakefile.list.am b/Source/WebKit2/GNUmakefile.list.am index a19d4a02e..35d22fad0 100644 --- a/Source/WebKit2/GNUmakefile.list.am +++ b/Source/WebKit2/GNUmakefile.list.am @@ -99,6 +99,7 @@ webkit2gtk_h_api += \ $(WebKit2)/UIProcess/API/gtk/WebKitJavascriptResult.h \ $(WebKit2)/UIProcess/API/gtk/WebKitMimeInfo.h \ $(WebKit2)/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \ + $(WebKit2)/UIProcess/API/gtk/WebKitPermissionRequest.h \ $(WebKit2)/UIProcess/API/gtk/WebKitPlugin.h \ $(WebKit2)/UIProcess/API/gtk/WebKitPolicyDecision.h \ $(WebKit2)/UIProcess/API/gtk/WebKitPrintOperation.h \ @@ -596,6 +597,8 @@ webkit2_sources += \ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecision.h \ Source/WebKit2/UIProcess/API/gtk/WebKitNavigationPolicyDecisionPrivate.h \ + Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp \ + Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h \ Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.cpp \ Source/WebKit2/UIProcess/API/gtk/WebKitPlugin.h \ Source/WebKit2/UIProcess/API/gtk/WebKitPluginPrivate.h \ diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp new file mode 100644 index 000000000..92235cef1 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.cpp @@ -0,0 +1,72 @@ +/* + * 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 "WebKitPermissionRequest.h" + +/** + * SECTION: WebKitPermissionRequest + * @Short_description: A permission request + * @Title: WebKitPermissionRequest + * @See_also: #WebKitWebView + * + * There are situations where an embedder would need to ask the user + * for permission to do certain types of operations, such as switching + * to fullscreen mode or reporting the user's location through the + * standard Geolocation API. In those cases, WebKit will emit a + * #WebKitWebView::permission-request signal with a + * #WebKitPermissionRequest object attached to it. + */ + +typedef WebKitPermissionRequestIface WebKitPermissionRequestInterface; +G_DEFINE_INTERFACE(WebKitPermissionRequest, webkit_permission_request, G_TYPE_OBJECT) + +static void webkit_permission_request_default_init(WebKitPermissionRequestIface*) +{ +} + +/** + * webkit_permission_request_allow: + * @request: a #WebKitPermissionRequest + * + * Allow the action which triggered this request. + */ +void webkit_permission_request_allow(WebKitPermissionRequest* request) +{ + g_return_if_fail(WEBKIT_IS_PERMISSION_REQUEST(request)); + + WebKitPermissionRequestIface* iface = WEBKIT_PERMISSION_REQUEST_GET_IFACE(request); + if (iface->allow) + iface->allow(request); +} + +/** + * webkit_permission_request_deny: + * @request: a #WebKitPermissionRequest + * + * Deny the action which triggered this request. + */ +void webkit_permission_request_deny(WebKitPermissionRequest* request) +{ + g_return_if_fail(WEBKIT_IS_PERMISSION_REQUEST(request)); + + WebKitPermissionRequestIface* iface = WEBKIT_PERMISSION_REQUEST_GET_IFACE(request); + if (iface->deny) + iface->deny(request); +} diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h new file mode 100644 index 000000000..a62f1f1a5 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitPermissionRequest.h @@ -0,0 +1,58 @@ +/* + * 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 WebKitPermissionRequest_h +#define WebKitPermissionRequest_h + +#include <glib-object.h> +#include <webkit2/WebKitDefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_PERMISSION_REQUEST (webkit_permission_request_get_type()) +#define WEBKIT_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_PERMISSION_REQUEST, WebKitPermissionRequest)) +#define WEBKIT_IS_PERMISSION_REQUEST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_PERMISSION_REQUEST)) +#define WEBKIT_PERMISSION_REQUEST_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE((obj), WEBKIT_TYPE_PERMISSION_REQUEST, WebKitPermissionRequestIface)) + +typedef struct _WebKitPermissionRequest WebKitPermissionRequest; +typedef struct _WebKitPermissionRequestIface WebKitPermissionRequestIface; + +struct _WebKitPermissionRequestIface { + GTypeInterface parent_interface; + + void (* allow) (WebKitPermissionRequest *request); + void (* deny) (WebKitPermissionRequest *request); +}; + +WEBKIT_API GType +webkit_permission_request_get_type (void); + +WEBKIT_API void +webkit_permission_request_allow (WebKitPermissionRequest *request); + +WEBKIT_API void +webkit_permission_request_deny (WebKitPermissionRequest *request); + +G_END_DECLS + +#endif diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp index 65dab6ec2..77ef6c1de 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp @@ -65,6 +65,7 @@ enum { SCRIPT_DIALOG, DECIDE_POLICY, + PERMISSION_REQUEST, MOUSE_TARGET_CHANGED, @@ -195,6 +196,12 @@ static gboolean webkitWebViewDecidePolicy(WebKitWebView*, WebKitPolicyDecision* return TRUE; } +static gboolean webkitWebViewPermissionRequest(WebKitWebView*, WebKitPermissionRequest* request) +{ + webkit_permission_request_deny(request); + return TRUE; +} + static void zoomTextOnlyChanged(WebKitSettings* settings, GParamSpec*, WebKitWebView* webView) { WKPageRef wkPage = toAPI(webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(webView))); @@ -361,6 +368,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) webViewClass->create = webkitWebViewCreate; webViewClass->script_dialog = webkitWebViewScriptDialog; webViewClass->decide_policy = webkitWebViewDecidePolicy; + webViewClass->permission_request = webkitWebViewPermissionRequest; webViewClass->run_file_chooser = webkitWebViewRunFileChooser; g_type_class_add_private(webViewClass, sizeof(WebKitWebViewPrivate)); @@ -687,6 +695,70 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass) WEBKIT_TYPE_POLICY_DECISION_TYPE); /** + * WebKitWebView::permission-request: + * @web_view: the #WebKitWebView on which the signal is emitted + * @request: the #WebKitPermissionRequest + * + * This signal is emitted when WebKit is requesting the client to + * decide about a permission request, such as allowing the browser + * to switch to fullscreen mode, sharing its location or similar + * operations. + * + * A possible way to use this signal could be through a dialog + * allowing the user decide what to do with the request: + * + * <informalexample><programlisting> + * static gboolean permission_request_cb (WebKitWebView *web_view, + * WebKitPermissionRequest *request, + * GtkWindow *parent_window) + * { + * GtkWidget *dialog = gtk_message_dialog_new (parent_window, + * GTK_DIALOG_MODAL, + * GTK_MESSAGE_QUESTION, + * GTK_BUTTONS_YES_NO, + * "Allow Permission Request?"); + * gtk_widget_show (dialog); + * gint result = gtk_dialog_run (GTK_DIALOG (dialog)); + * + * switch (result) { + * case GTK_RESPONSE_YES: + * webkit_permission_request_allow (request); + * break; + * default: + * webkit_permission_request_deny (request); + * break; + * } + * gtk_widget_destroy (dialog); + * + * return TRUE; + * } + * </programlisting></informalexample> + * + * It is possible to handle permission requests asynchronously, by + * simply calling g_object_ref() on the @request argument and + * returning %TRUE to block the default signal handler. If the + * last reference is removed on a #WebKitPermissionRequest and the + * request has not been handled, webkit_permission_request_deny() + * will be the default action. + * + * By default, if the signal is not handled, + * webkit_permission_request_deny() will be called over the + * #WebKitPermissionRequest. + * + * Returns: %TRUE to stop other handlers from being invoked for the event. + * %FALSE to propagate the event further. + * + */ + signals[PERMISSION_REQUEST] = + g_signal_new("permission-request", + G_TYPE_FROM_CLASS(webViewClass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(WebKitWebViewClass, permission_request), + g_signal_accumulator_true_handled, 0 /* accumulator data */, + webkit_marshal_BOOLEAN__OBJECT, + G_TYPE_BOOLEAN, 1, /* number of parameters */ + WEBKIT_TYPE_PERMISSION_REQUEST); + /** * WebKitWebView::mouse-target-changed: * @web_view: the #WebKitWebView on which the signal is emitted * @hit_test_result: a #WebKitHitTestResult @@ -971,6 +1043,12 @@ void webkitWebViewMakePolicyDecision(WebKitWebView* webView, WebKitPolicyDecisio g_signal_emit(webView, signals[DECIDE_POLICY], 0, decision, type, &returnValue); } +void webkitWebViewMakePermissionRequest(WebKitWebView* webView, WebKitPermissionRequest* request) +{ + gboolean returnValue; + g_signal_emit(webView, signals[PERMISSION_REQUEST], 0, request, &returnValue); +} + void webkitWebViewMouseTargetChanged(WebKitWebView* webView, WKHitTestResultRef wkHitTestResult, unsigned modifiers) { WebKitWebViewPrivate* priv = webView->priv; diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h index 4f5fe1869..7f9fb9e36 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.h @@ -35,6 +35,7 @@ #include <webkit2/WebKitFindController.h> #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> +#include <webkit2/WebKitPermissionRequest.h> #include <webkit2/WebKitPolicyDecision.h> #include <webkit2/WebKitScriptDialog.h> #include <webkit2/WebKitSettings.h> @@ -143,6 +144,8 @@ struct _WebKitWebViewClass { gboolean (* decide_policy) (WebKitWebView *web_view, WebKitPolicyDecision *decision, WebKitPolicyDecisionType type); + gboolean (* permission_request) (WebKitWebView *web_view, + WebKitPermissionRequest *permission_request); void (* mouse_target_changed) (WebKitWebView *web_view, WebKitHitTestResult *hit_test_result, guint modifiers); diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h index 717d2c344..6ab374551 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewPrivate.h @@ -42,6 +42,7 @@ void webkitWebViewClosePage(WebKitWebView*); void webkitWebViewRunJavaScriptAlert(WebKitWebView*, const CString& message); bool webkitWebViewRunJavaScriptConfirm(WebKitWebView*, const CString& message); WKStringRef webkitWebViewRunJavaScriptPrompt(WebKitWebView*, const CString& message, const CString& defaultText); +void webkitWebViewMakePermissionRequest(WebKitWebView*, WebKitPermissionRequest*); void webkitWebViewMakePolicyDecision(WebKitWebView*, WebKitPolicyDecisionType, WebKitPolicyDecision*); void webkitWebViewMouseTargetChanged(WebKitWebView*, WKHitTestResultRef, unsigned modifiers); void webkitWebViewPrintFrame(WebKitWebView*, WKFrameRef); diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml index b6b9aa0b1..90005acb2 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml @@ -21,6 +21,7 @@ <xi:include href="xml/WebKitURIResponse.xml"/> <xi:include href="xml/WebKitWindowProperties.xml"/> <xi:include href="xml/WebKitDownload.xml"/> + <xi:include href="xml/WebKitPermissionRequest.xml"/> <xi:include href="xml/WebKitPolicyDecision.xml"/> <xi:include href="xml/WebKitNavigationPolicyDecision.xml"/> <xi:include href="xml/WebKitResponsePolicyDecision.xml"/> diff --git a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt index 05bdeeb51..4251cc4a6 100644 --- a/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt +++ b/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt @@ -368,6 +368,23 @@ webkit_download_get_type </SECTION> <SECTION> +<FILE>WebKitPermissionRequest</FILE> +WebKitPermissionRequest +webkit_permission_request_allow +webkit_permission_request_deny + +<SUBSECTION Standard> +WebKitPermissionRequestIface +WEBKIT_TYPE_PERMISSION_REQUEST +WEBKIT_PERMISSION_REQUEST +WEBKIT_IS_PERMISSION_REQUEST +WEBKIT_PERMISSION_REQUEST_GET_IFACE + +<SUBSECTION Private> +webkit_permission_request_get_type +</SECTION> + +<SECTION> <FILE>WebKitPolicyDecision</FILE> WebKitPolicyDecision webkit_policy_decision_download diff --git a/Source/WebKit2/UIProcess/API/gtk/webkit2.h b/Source/WebKit2/UIProcess/API/gtk/webkit2.h index 23dbd9903..b58210a80 100644 --- a/Source/WebKit2/UIProcess/API/gtk/webkit2.h +++ b/Source/WebKit2/UIProcess/API/gtk/webkit2.h @@ -36,6 +36,7 @@ #include <webkit2/WebKitHitTestResult.h> #include <webkit2/WebKitJavascriptResult.h> #include <webkit2/WebKitMimeInfo.h> +#include <webkit2/WebKitPermissionRequest.h> #include <webkit2/WebKitPlugin.h> #include <webkit2/WebKitPrintOperation.h> #include <webkit2/WebKitScriptDialog.h> diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.cpp b/Source/WebKit2/UIProcess/WebBackForwardList.cpp index 9ffc9a2c9..4a81a8765 100644 --- a/Source/WebKit2/UIProcess/WebBackForwardList.cpp +++ b/Source/WebKit2/UIProcess/WebBackForwardList.cpp @@ -34,10 +34,9 @@ static const unsigned DefaultCapacity = 100; WebBackForwardList::WebBackForwardList(WebPageProxy* page) : m_page(page) - , m_current(NoCurrentItemIndex) + , m_hasCurrentIndex(false) + , m_currentIndex(0) , m_capacity(DefaultCapacity) - , m_closed(true) - , m_enabled(true) { ASSERT(m_page); } @@ -59,16 +58,16 @@ void WebBackForwardList::pageClosed() void WebBackForwardList::addItem(WebBackForwardListItem* newItem) { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - if (!m_capacity || !m_enabled || !newItem || !m_page) + if (!m_capacity || !newItem || !m_page) return; Vector<RefPtr<APIObject> > removedItems; - if (m_current != NoCurrentItemIndex) { + if (m_hasCurrentIndex) { // Toss everything in the forward list. - unsigned targetSize = m_current + 1; + unsigned targetSize = m_currentIndex + 1; removedItems.reserveCapacity(m_entries.size() - targetSize); while (m_entries.size() > targetSize) { m_page->backForwardRemovedItem(m_entries.last()->itemID()); @@ -78,11 +77,14 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem) // Toss the first item if the list is getting too big, as long as we're not using it // (or even if we are, if we only want 1 entry). - if (m_entries.size() == m_capacity && (m_current || m_capacity == 1)) { + if (m_entries.size() == m_capacity && (m_currentIndex || m_capacity == 1)) { m_page->backForwardRemovedItem(m_entries[0]->itemID()); removedItems.append(m_entries[0].release()); m_entries.remove(0); - m_current--; + if (m_entries.isEmpty()) + m_hasCurrentIndex = false; + else + m_currentIndex--; } } else { // If we have no current item index, we should have no other entries before adding this new item. @@ -94,23 +96,24 @@ void WebBackForwardList::addItem(WebBackForwardListItem* newItem) m_entries.clear(); } - if (m_current == NoCurrentItemIndex) - m_current = 0; - else - m_current++; + if (!m_hasCurrentIndex) { + m_currentIndex = 0; + m_hasCurrentIndex = true; + } else + m_currentIndex++; // m_current never be pointing more than 1 past the end of the entries Vector. // If it is, something has gone wrong and we should not try to insert the new item. - ASSERT(m_current <= m_entries.size()); - if (m_current <= m_entries.size()) - m_entries.insert(m_current, newItem); + ASSERT(m_currentIndex <= m_entries.size()); + if (m_currentIndex <= m_entries.size()) + m_entries.insert(m_currentIndex, newItem); m_page->didChangeBackForwardList(newItem, &removedItems); } void WebBackForwardList::goToItem(WebBackForwardListItem* item) { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); if (!m_entries.size() || !item) return; @@ -121,7 +124,7 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item) break; } if (index < m_entries.size()) { - m_current = index; + m_currentIndex = index; if (m_page) m_page->didChangeBackForwardList(0, 0); } @@ -129,36 +132,30 @@ void WebBackForwardList::goToItem(WebBackForwardListItem* item) WebBackForwardListItem* WebBackForwardList::currentItem() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - if (m_current != NoCurrentItemIndex) - return m_entries[m_current].get(); - return 0; + return m_hasCurrentIndex ? m_entries[m_currentIndex].get() : 0; } WebBackForwardListItem* WebBackForwardList::backItem() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - if (m_current && m_current != NoCurrentItemIndex) - return m_entries[m_current - 1].get(); - return 0; + return m_hasCurrentIndex && m_currentIndex ? m_entries[m_currentIndex - 1].get() : 0; } WebBackForwardListItem* WebBackForwardList::forwardItem() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - if (m_entries.size() && m_current < m_entries.size() - 1) - return m_entries[m_current + 1].get(); - return 0; + return m_hasCurrentIndex && m_entries.size() && m_currentIndex < m_entries.size() - 1 ? m_entries[m_currentIndex + 1].get() : 0; } WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index) { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - if (m_current == NoCurrentItemIndex) + if (!m_hasCurrentIndex) return 0; // Do range checks without doing math on index to avoid overflow. @@ -168,26 +165,26 @@ WebBackForwardListItem* WebBackForwardList::itemAtIndex(int index) if (index > forwardListCount()) return 0; - return m_entries[index + m_current].get(); + return m_entries[index + m_currentIndex].get(); } int WebBackForwardList::backListCount() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - return m_current == NoCurrentItemIndex ? 0 : m_current; + return !m_hasCurrentIndex ? 0 : m_currentIndex; } int WebBackForwardList::forwardListCount() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); - return m_current == NoCurrentItemIndex ? 0 : static_cast<int>(m_entries.size()) - (m_current + 1); + return !m_hasCurrentIndex ? 0 : static_cast<int>(m_entries.size()) - (m_currentIndex + 1); } PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit(unsigned limit) { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); unsigned backListSize = static_cast<unsigned>(backListCount()); unsigned size = std::min(backListSize, limit); @@ -206,7 +203,7 @@ PassRefPtr<ImmutableArray> WebBackForwardList::backListAsImmutableArrayWithLimit PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLimit(unsigned limit) { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); unsigned size = std::min(static_cast<unsigned>(forwardListCount()), limit); if (!size) @@ -215,9 +212,9 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi Vector<RefPtr<APIObject> > vector; vector.reserveInitialCapacity(size); - unsigned last = m_current + size; + unsigned last = m_currentIndex + size; ASSERT(last < m_entries.size()); - for (unsigned i = m_current + 1; i <= last; ++i) + for (unsigned i = m_currentIndex + 1; i <= last; ++i) vector.uncheckedAppend(m_entries[i].get()); return ImmutableArray::adopt(vector); @@ -225,7 +222,7 @@ PassRefPtr<ImmutableArray> WebBackForwardList::forwardListAsImmutableArrayWithLi void WebBackForwardList::clear() { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); size_t size = m_entries.size(); if (size <= 1) @@ -243,18 +240,18 @@ void WebBackForwardList::clear() Vector<RefPtr<APIObject> > removedItems; removedItems.reserveCapacity(m_entries.size() - 1); for (size_t i = 0; i < m_entries.size(); ++i) { - if (i != m_current) + if (i != m_currentIndex) removedItems.append(m_entries[i].release()); } - m_current = 0; + m_currentIndex = 0; if (currentItem) { m_entries.shrink(1); m_entries[0] = currentItem.release(); } else { m_entries.clear(); - m_current = NoCurrentItemIndex; + m_hasCurrentIndex = false; } if (m_page) diff --git a/Source/WebKit2/UIProcess/WebBackForwardList.h b/Source/WebKit2/UIProcess/WebBackForwardList.h index ead0fca06..97bd2a32f 100644 --- a/Source/WebKit2/UIProcess/WebBackForwardList.h +++ b/Source/WebKit2/UIProcess/WebBackForwardList.h @@ -70,7 +70,7 @@ public: const BackForwardListItemVector& entries() const { return m_entries; } - uint32_t currentIndex() { return m_current; } + uint32_t currentIndex() { return m_currentIndex; } int backListCount(); int forwardListCount(); @@ -83,18 +83,16 @@ public: #endif private: - static const unsigned NoCurrentItemIndex = UINT_MAX; - WebBackForwardList(WebPageProxy*); virtual Type type() const { return APIType; } WebPageProxy* m_page; BackForwardListItemVector m_entries; - uint32_t m_current; - uint32_t m_capacity; - bool m_closed; - bool m_enabled; + + bool m_hasCurrentIndex; + unsigned m_currentIndex; + unsigned m_capacity; }; } // namespace WebKit diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 930e79598..2b538e5d8 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -164,7 +164,11 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p , m_pageScaleFactor(1) , m_intrinsicDeviceScaleFactor(1) , m_customDeviceScaleFactor(0) +#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER) + , m_layerHostingMode(LayerHostingModeInWindowServer) +#else , m_layerHostingMode(LayerHostingModeDefault) +#endif , m_drawsBackground(true) , m_drawsTransparentBackground(false) , m_areMemoryCacheClientCallsEnabled(true) diff --git a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp index f5ec6a312..b4885220f 100644 --- a/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp +++ b/Source/WebKit2/UIProcess/cf/WebBackForwardListCF.cpp @@ -53,12 +53,12 @@ DEFINE_STATIC_GETTER(CFStringRef, SessionHistoryEntryDataKey, (CFSTR("SessionHis CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProxy::WebPageProxySessionStateFilterCallback filter, void* context) const { - ASSERT(m_current == NoCurrentItemIndex || m_current < m_entries.size()); + ASSERT(!m_hasCurrentIndex || m_currentIndex < m_entries.size()); RetainPtr<CFMutableArrayRef> entries(AdoptCF, CFArrayCreateMutable(0, m_entries.size(), &kCFTypeArrayCallBacks)); // We may need to update the current index to account for entries that are filtered by the callback. - CFIndex currentIndex = m_current; + CFIndex currentIndex = m_currentIndex; for (size_t i = 0; i < m_entries.size(); ++i) { // If we somehow ended up with a null entry then we should consider the data invalid and not save session history at all. @@ -67,7 +67,7 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx return 0; if (filter && !filter(toAPI(m_page), WKPageGetSessionHistoryURLValueType(), toURLRef(m_entries[i]->originalURL().impl()), context)) { - if (i <= static_cast<size_t>(m_current)) + if (i <= static_cast<size_t>(m_currentIndex)) currentIndex--; continue; } @@ -89,12 +89,12 @@ CFDictionaryRef WebBackForwardList::createCFDictionaryRepresentation(WebPageProx // If all items before and including the current item were filtered then currentIndex will be -1. // Assuming we didn't start out with NoCurrentItemIndex, we should store "current" to point at the first item. - if (currentIndex == -1 && m_current != NoCurrentItemIndex && CFArrayGetCount(entries.get())) + if (currentIndex == -1 && m_hasCurrentIndex && CFArrayGetCount(entries.get())) currentIndex = 0; // FIXME: We're relying on currentIndex == -1 to mean the exact same thing as NoCurrentItemIndex (UINT_MAX) in unsigned form. // That seems implicit and fragile and we should find a better way of representing the NoCurrentItemIndex case. - if (m_current == NoCurrentItemIndex || !CFArrayGetCount(entries.get())) + if (!m_hasCurrentIndex || !CFArrayGetCount(entries.get())) currentIndex = -1; RetainPtr<CFNumberRef> currentIndexNumber(AdoptCF, CFNumberCreate(0, kCFNumberCFIndexType, ¤tIndex)); @@ -138,9 +138,10 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d // FIXME: We're relying on currentIndex == -1 to mean the exact same thing as NoCurrentItemIndex (UINT_MAX) in unsigned form. // That seems implicit and fragile and we should find a better way of representing the NoCurrentItemIndex case. - uint32_t currentIndex = currentCFIndex == -1 ? NoCurrentItemIndex : static_cast<uint32_t>(currentCFIndex); + bool hasCurrentIndex = currentCFIndex > -1; + unsigned currentIndex = hasCurrentIndex ? static_cast<unsigned>(currentCFIndex) : 0; - if (currentIndex == NoCurrentItemIndex && size) { + if (!hasCurrentIndex && size) { LOG(SessionState, "WebBackForwardList dictionary representation says there is no current item index, but there is a list of %ld entries - this is bogus", size); return false; } @@ -182,10 +183,8 @@ bool WebBackForwardList::restoreFromCFDictionaryRepresentation(CFDictionaryRef d } m_entries = newEntries; - m_current = currentIndex; - // Perform a sanity check: in case we're out of range, we reset. - if (m_current != NoCurrentItemIndex && m_current >= newEntries.size()) - m_current = NoCurrentItemIndex; + m_hasCurrentIndex = hasCurrentIndex; + m_currentIndex = currentIndex; return true; } diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp index d8c874621..dc597c63c 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/JSNPObject.cpp @@ -81,7 +81,7 @@ JSNPObject::~JSNPObject() void JSNPObject::destroy(JSCell* cell) { - jsCast<JSNPObject*>(cell)->JSNPObject::~JSNPObject(); + static_cast<JSNPObject*>(cell)->JSNPObject::~JSNPObject(); } void JSNPObject::invalidate() @@ -96,7 +96,6 @@ void JSNPObject::invalidate() NPObject* JSNPObject::leakNPObject() { ASSERT(m_npObject); - ASSERT_GC_OBJECT_INHERITS(this, &s_info); NPObject* object = m_npObject; m_npObject = 0; diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp index 1a22d3837..8f037aeab 100644 --- a/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp +++ b/Source/WebKit2/WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp @@ -295,7 +295,7 @@ void NPRuntimeObjectMap::addToInvalidationQueue(NPObject* npObject) void NPRuntimeObjectMap::finalize(JSC::Handle<JSC::Unknown> handle, void* context) { - JSNPObject* object = jsCast<JSNPObject*>(asObject(handle.get())); + JSNPObject* object = static_cast<JSNPObject*>(handle.get().asCell()); weakRemove(m_jsNPObjects, static_cast<NPObject*>(context), object); addToInvalidationQueue(object->leakNPObject()); } diff --git a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm index c4ee69330..61db553fc 100644 --- a/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm +++ b/Source/WebKit2/WebProcess/Plugins/PDF/BuiltInPDFView.mm @@ -473,8 +473,7 @@ bool BuiltInPDFView::isTransparent() bool BuiltInPDFView::wantsWheelEvents() { - // We return false here even though we do want wheel events, because we add ourselves to the scrollable area set in updateScrollbars(). - return false; + return true; } void BuiltInPDFView::geometryDidChange(const IntSize& pluginSize, const IntRect& clipRect, const AffineTransform& pluginToRootViewTransform) diff --git a/Tools/ChangeLog b/Tools/ChangeLog index acadd9760..e86900fe5 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,155 @@ +2012-05-27 David Barton <dbarton@mathscribe.com> + + [watchlist] Improve MathML rule + https://bugs.webkit.org/show_bug.cgi?id=87592 + + Reviewed by Adam Barth. + + The old rule "filename": r".*mathml" works fine because "filename" is a prefix match, + but if this changed the rule would be slow. We protect against this, clarify the rule, + and make it more similar to existing rules. + + * Scripts/webkitpy/common/config/watchlist: + +2012-05-27 David Barton <dbarton@mathscribe.com> + + [watchlist] Add myself & a rule for MathML + https://bugs.webkit.org/show_bug.cgi?id=87586 + + Reviewed by Adam Barth. + + * Scripts/webkitpy/common/config/watchlist: + +2012-05-26 David Kilzer <ddkilzer@apple.com> + + Use xcrun to find path to nm for Mac port + <http://webkit.org/b/87588> + + Reviewed by Dan Bernstein. + + * Scripts/webkitpy/layout_tests/port/mac.py: + (MacPort.nm_command): Add. Tries to find a path for the nm + command using xcrun. Falls back to returning 'nm'. + * Scripts/webkitpy/layout_tests/port/webkit.py: + (WebKitPort.nm_command): Add. Returns 'nm'. + (WebKitPort._webcore_symbols_string): Call self.nm_command(). + +2012-05-25 Lynn Neir <lynn.neir@skype.net> + + Added windows implementation in DRT for TextInputController, https://bugs.webkit.org/show_bug.cgi?id=32021 + + Reviewed by Eric Seidel. + + * DumpRenderTree/win/DumpRenderTree.vcproj: + * DumpRenderTree/win/FrameLoadDelegate.cpp: + (FrameLoadDelegate::FrameLoadDelegate): + (FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld): + * DumpRenderTree/win/FrameLoadDelegate.h: + (FrameLoadDelegate): + * DumpRenderTree/win/TextInputController.cpp: Added. + (setMarkedTextCallback): + (hasMarkedTextCallback): + (unmarkTextCallback): + (markedRangeCallback): + (insertTextCallback): + (firstRectForCharacterRangeCallback): + (selectedRangeCallback): + (TextInputController::makeWindowObject): + (TextInputController::getJSClass): + (TextInputController::staticValues): + (TextInputController::staticFunctions): + * DumpRenderTree/win/TextInputController.h: Added. + (TextInputController): + * DumpRenderTree/win/TextInputControllerWin.cpp: Added. + (TextInputController::setMarkedText): + (TextInputController::hasMarkedText): + (TextInputController::unmarkText): + (TextInputController::markedRange): + (TextInputController::insertText): + (TextInputController::firstRectForCharacterRange): + (TextInputController::selectedRange): + +2012-05-25 Dirk Pranke <dpranke@chromium.org> + + webkitpy: change scm.add(), scm.delete() to accept multiple paths + https://bugs.webkit.org/show_bug.cgi?id=87528 + + Reviewed by Ojan Vafai. + + launching git or svn for individual files can be slow; this + change will hand multiple paths at once to git and svn so they + can be added in a batch. + + * Scripts/webkitpy/common/checkout/scm/git.py: + (Git.add_list): + (Git.delete_list): + * Scripts/webkitpy/common/checkout/scm/scm.py: + (SCM.add): + (SCM): + (SCM.add_list): + (SCM.delete): + (SCM.delete_list): + * Scripts/webkitpy/common/checkout/scm/scm_mock.py: + (MockSCM.add): + (MockSCM): + (MockSCM.add_list): + (MockSCM.delete): + (MockSCM.delete_list): + * Scripts/webkitpy/common/checkout/scm/scm_unittest.py: + (_shared_test_exists): + (_shared_test_added_files): + (_test_delete_list): + * Scripts/webkitpy/common/checkout/scm/svn.py: + (SVN.add_list): + (SVN.delete_list): + +2012-05-25 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [NRWT] Add unit testing for perf tests on locked shards + https://bugs.webkit.org/show_bug.cgi?id=87489 + + Reviewed by Dirk Pranke. + + Adding utests that makes sure that perf tests are running in locked + shards and by passing --no-http won't break NRWT (r118421). + + * Scripts/webkitpy/layout_tests/controllers/manager_unittest.py: + (ShardingTests): + (ShardingTests.test_shard_by_dir): + (ShardingTests.test_shard_every_file): + (ShardingTests.test_shard_in_two): + (ShardingTests.test_multiple_locked_shards): + (LockCheckingManager): + (LockCheckingManager.__init__): + (LockCheckingManager.handle_finished_list): + (ManagerTest.test_http_locking): + (ManagerTest): + (ManagerTest.test_perf_locking): + * Scripts/webkitpy/layout_tests/port/test.py: + +2012-05-25 Jessie Berlin <jberlin@apple.com> + + [Win] fast/events/keydown-leftright-keys.html failing since introduction in r118001 + https://bugs.webkit.org/show_bug.cgi?id=87511 + + Reviewed by Alexey Proskuryakov. + + Update the Windows implementation of keyDown to match the Mac one changed in r118001. + + * DumpRenderTree/win/EventSender.cpp: + (keyDownCallback): + +2012-05-25 Ken Buchanan <kenrb@chromium.org> + + Adding Ken Buchanan to committers.py + https://bugs.webkit.org/show_bug.cgi?id=87443 + + Unreviewed. + + Adding self to committers.py as a Committer. + + * Scripts/webkitpy/common/config/committers.py: + 2012-05-25 Csaba Osztrogonác <ossy@webkit.org> [Qt] Buildfix for newer Qt5 diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj index d22ddfa7d..18137a242 100644 --- a/Tools/DumpRenderTree/win/DumpRenderTree.vcproj +++ b/Tools/DumpRenderTree/win/DumpRenderTree.vcproj @@ -433,6 +433,18 @@ RelativePath=".\LayoutTestControllerWin.cpp" > </File> + <File + RelativePath=".\TextInputController.cpp" + > + </File> + <File + RelativePath=".\TextInputController.h" + > + </File> + <File + RelativePath=".\TextInputControllerWin.cpp" + > + </File> </Filter> <Filter Name="Delegates" diff --git a/Tools/DumpRenderTree/win/EventSender.cpp b/Tools/DumpRenderTree/win/EventSender.cpp index 376c07686..5c0993689 100644 --- a/Tools/DumpRenderTree/win/EventSender.cpp +++ b/Tools/DumpRenderTree/win/EventSender.cpp @@ -475,6 +475,18 @@ static JSValueRef keyDownCallback(JSContextRef context, JSObjectRef function, JS virtualKeyCode = VK_SNAPSHOT; else if (JSStringIsEqualToUTF8CString(character, "menu")) virtualKeyCode = VK_APPS; + else if (JSStringIsEqualToUTF8CString(character, "leftControl")) + virtualKeyCode = VK_LCONTROL; + else if (JSStringIsEqualToUTF8CString(character, "leftShift")) + virtualKeyCode = VK_LSHIFT; + else if (JSStringIsEqualToUTF8CString(character, "leftAlt")) + virtualKeyCode = VK_LMENU; + else if (JSStringIsEqualToUTF8CString(character, "rightControl")) + virtualKeyCode = VK_RCONTROL; + else if (JSStringIsEqualToUTF8CString(character, "rightShift")) + virtualKeyCode = VK_RSHIFT; + else if (JSStringIsEqualToUTF8CString(character, "rightAlt")) + virtualKeyCode = VK_RMENU; else { charCode = JSStringGetCharactersPtr(character)[0]; virtualKeyCode = LOBYTE(VkKeyScan(charCode)); diff --git a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp b/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp index afc4e5185..dcf5da18c 100644 --- a/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp +++ b/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp @@ -35,6 +35,7 @@ #include "EventSender.h" #include "GCController.h" #include "LayoutTestController.h" +#include "TextInputController.h" #include "WebCoreTestSupport.h" #include "WorkQueueItem.h" #include "WorkQueue.h" @@ -76,6 +77,7 @@ FrameLoadDelegate::FrameLoadDelegate() : m_refCount(1) , m_gcController(adoptPtr(new GCController)) , m_accessibilityController(adoptPtr(new AccessibilityController)) + , m_textInputController(adoptPtr(new TextInputController)) { } @@ -367,6 +369,9 @@ void FrameLoadDelegate::didClearWindowObjectForFrameInStandardWorld(IWebFrame* f m_accessibilityController->makeWindowObject(context, windowObject, &exception); ASSERT(!exception); + m_textInputController->makeWindowObject(context, windowObject, &exception); + ASSERT(!exception); + JSStringRef eventSenderStr = JSStringCreateWithUTF8CString("eventSender"); JSValueRef eventSender = makeEventSender(context, !parentFrame); JSObjectSetProperty(context, windowObject, eventSenderStr, eventSender, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, 0); diff --git a/Tools/DumpRenderTree/win/FrameLoadDelegate.h b/Tools/DumpRenderTree/win/FrameLoadDelegate.h index 4cd5e1148..c842579f1 100644 --- a/Tools/DumpRenderTree/win/FrameLoadDelegate.h +++ b/Tools/DumpRenderTree/win/FrameLoadDelegate.h @@ -33,6 +33,7 @@ #include <wtf/OwnPtr.h> class AccessibilityController; +class TextInputController; class GCController; class FrameLoadDelegate : public IWebFrameLoadDelegate, public IWebFrameLoadDelegatePrivate2 { @@ -170,6 +171,7 @@ private: ULONG m_refCount; OwnPtr<GCController> m_gcController; OwnPtr<AccessibilityController> m_accessibilityController; + OwnPtr<TextInputController> m_textInputController; }; #endif // FrameLoadDelegate_h diff --git a/Tools/DumpRenderTree/win/TextInputController.cpp b/Tools/DumpRenderTree/win/TextInputController.cpp new file mode 100755 index 000000000..c54dd17de --- /dev/null +++ b/Tools/DumpRenderTree/win/TextInputController.cpp @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2007, 2008, 2009, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2010 Joone Hur <joone@kldp.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TextInputController.h" + +#include <JavaScriptCore/JSRetainPtr.h> +#include <wtf/RefPtr.h> + +// Static Functions + +static JSValueRef setMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 3) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> str(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + double from = JSValueToNumber(context, arguments[1], exception); + ASSERT(!*exception); + + double length = JSValueToNumber(context, arguments[2], exception); + ASSERT(!*exception); + + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + + if (controller) + controller->setMarkedText(str.get(), from, length); + + return JSValueMakeUndefined(context); +} + +static JSValueRef hasMarkedTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + + if (controller) + return JSValueMakeBoolean(context, controller->hasMarkedText()); + + return JSValueMakeUndefined(context); +} + +static JSValueRef unmarkTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + if (controller) + controller->unmarkText(); + + return JSValueMakeUndefined(context); +} + +static JSValueRef markedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + if (controller) { + vector<int> range = controller->markedRange(); + if (range.size() == 2) { + JSValueRef argumentsArrayValues[] = { JSValueMakeNumber(context, range[0]), JSValueMakeNumber(context, range[1]) }; + JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); + ASSERT(!*exception); + return result; + } + } + + return JSValueMakeUndefined(context); +} + +static JSValueRef insertTextCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 1) + return JSValueMakeUndefined(context); + + JSRetainPtr<JSStringRef> str(Adopt, JSValueToStringCopy(context, arguments[0], exception)); + ASSERT(!*exception); + + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + + if (controller) + controller->insertText(str.get()); + + return JSValueMakeUndefined(context); +} + +static JSValueRef firstRectForCharacterRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + if (argumentCount < 2) + return JSValueMakeUndefined(context); + + double start = JSValueToNumber(context, arguments[0], exception); + ASSERT(!*exception); + + double length = JSValueToNumber(context, arguments[1], exception); + ASSERT(!*exception); + + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + + if (controller) { + vector<int> rect = controller->firstRectForCharacterRange(start, length); + if (rect.size() == 4) { + JSValueRef argumentsArrayValues[] = + { + JSValueMakeNumber(context, rect[0]), + JSValueMakeNumber(context, rect[1]), + JSValueMakeNumber(context, rect[2]), + JSValueMakeNumber(context, rect[3]), + }; + JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); + ASSERT(!*exception); + return result; + } + } + + return JSValueMakeUndefined(context); +} + +static JSValueRef selectedRangeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) +{ + TextInputController* controller = static_cast<TextInputController*>(JSObjectGetPrivate(thisObject)); + + if (controller) { + vector<int> rect = controller->selectedRange(); + if (rect.size() == 2) { + JSValueRef argumentsArrayValues[] = { + JSValueMakeNumber(context, rect[0]), + JSValueMakeNumber(context, rect[1]), + }; + JSObjectRef result = JSObjectMakeArray(context, sizeof(argumentsArrayValues) / sizeof(JSValueRef), argumentsArrayValues, exception); + ASSERT(!*exception); + return result; + } + } + + return JSValueMakeUndefined(context); +} + +// Object Creation + +void TextInputController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception) +{ + JSRetainPtr<JSStringRef> textInputContollerStr(Adopt, JSStringCreateWithUTF8CString("textInputController")); + + JSClassRef classRef = getJSClass(); + JSValueRef textInputContollerObject = JSObjectMake(context, classRef, this); + JSClassRelease(classRef); + + JSObjectSetProperty(context, windowObject, textInputContollerStr.get(), textInputContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception); +} + +JSClassRef TextInputController::getJSClass() +{ + static JSStaticValue* staticValues = TextInputController::staticValues(); + static JSStaticFunction* staticFunctions = TextInputController::staticFunctions(); + static JSClassDefinition classDefinition = + { + 0, kJSClassAttributeNone, "TextInputController", 0, staticValues, staticFunctions, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + + return JSClassCreate(&classDefinition); +} + +JSStaticValue* TextInputController::staticValues() +{ + static JSStaticValue staticValues[] = + { + { 0, 0, 0, 0 } + }; + return staticValues; +} + +JSStaticFunction* TextInputController::staticFunctions() +{ + static JSStaticFunction staticFunctions[] = { + { "setMarkedText", setMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "hasMarkedText", hasMarkedTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "unmarkText", unmarkTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "markedRange", markedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "insertText", insertTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "firstRectForCharacterRange", firstRectForCharacterRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { "selectedRange", selectedRangeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete }, + { 0, 0, 0 } + }; + + return staticFunctions; +} diff --git a/Tools/DumpRenderTree/win/TextInputController.h b/Tools/DumpRenderTree/win/TextInputController.h new file mode 100755 index 000000000..1c28e60ce --- /dev/null +++ b/Tools/DumpRenderTree/win/TextInputController.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef TextInputController_h +#define TextInputController_h + +#include <JavaScriptCore/JSContextRef.h> +#include <JavaScriptCore/JSObjectRef.h> +#include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSValueRef.h> +#include <vector> +#include <wtf/PassRefPtr.h> + +using namespace std; + +class TextInputController { +public: + void makeWindowObject(JSContextRef, JSObjectRef windowObject, JSValueRef* exception); + + void setMarkedText(JSStringRef text, unsigned int from, unsigned int length); + bool hasMarkedText(); + void unmarkText(); + vector<int> markedRange(); + void insertText(JSStringRef text); + vector<int> firstRectForCharacterRange(unsigned int start, unsigned int length); + vector<int> selectedRange(); + +private: + static JSClassRef getJSClass(); + static JSStaticValue* staticValues(); + static JSStaticFunction* staticFunctions(); +}; + +#endif // TextInputController_h diff --git a/Tools/DumpRenderTree/win/TextInputControllerWin.cpp b/Tools/DumpRenderTree/win/TextInputControllerWin.cpp new file mode 100755 index 000000000..f4674e5dd --- /dev/null +++ b/Tools/DumpRenderTree/win/TextInputControllerWin.cpp @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "TextInputController.h" + +#include "DumpRenderTree.h" +#include <WebCore/COMPtr.h> +#include <WebKit/WebKit.h> +#include <comutil.h> +#include <string> + +using namespace std; + +void TextInputController::setMarkedText(JSStringRef text, unsigned int from, unsigned int length) +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return; + + _bstr_t bstr(wstring(JSStringGetCharactersPtr(text), JSStringGetLength(text)).data()); + + viewPrivate->setCompositionForTesting(bstr, from, length); +} + +bool TextInputController::hasMarkedText() +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return false; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return false; + + BOOL result; + viewPrivate->hasCompositionForTesting(&result); + return result; +} + +void TextInputController::unmarkText() +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return; + + _bstr_t empty; + viewPrivate->confirmCompositionForTesting(empty); +} + +vector<int> TextInputController::markedRange() +{ + // empty vector + vector<int> result; + + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return result; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return result; + + unsigned int startPos; + unsigned int length; + if (SUCCEEDED(viewPrivate->compositionRangeForTesting(&startPos, &length))) { + result.resize(2); + result[0] = startPos; + result[1] = length; + } + + return result; +} + +void TextInputController::insertText(JSStringRef text) +{ + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return; + + _bstr_t bstr(wstring(JSStringGetCharactersPtr(text), JSStringGetLength(text)).data()); + + viewPrivate->confirmCompositionForTesting(bstr); +} + +vector<int> TextInputController::firstRectForCharacterRange(unsigned int start, unsigned int length) +{ + // empty vector + vector<int> result; + + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return result; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return result; + + RECT resultRECT; + if SUCCEEDED(viewPrivate->firstRectForCharacterRangeForTesting(start, length, &resultRECT)) { + result.resize(4); + result[0] = resultRECT.left; + result[1] = resultRECT.top; + result[2] = resultRECT.right - resultRECT.left; + result[3] = resultRECT.bottom - resultRECT.top; + } + + return result; +} + +vector<int> TextInputController::selectedRange() +{ + // empty vector + vector<int> result; + + COMPtr<IWebView> webView; + if (FAILED(frame->webView(&webView))) + return result; + + COMPtr<IWebViewPrivate> viewPrivate; + if (FAILED(webView->QueryInterface(&viewPrivate))) + return result; + + unsigned int startPos; + unsigned int length; + if (SUCCEEDED(viewPrivate->selectedRangeForTesting(&startPos, &length))) { + result.resize(2); + result[0] = startPos; + result[1] = length; + } + + return result; +} diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/Tools/Scripts/webkitpy/common/checkout/scm/git.py index c7dbd7ca1..43fdb9c00 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/git.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/git.py @@ -160,11 +160,11 @@ class Git(SCM, SVNRepository): def _status_regexp(self, expected_types): return '^(?P<status>[%s])\t(?P<filename>.+)$' % expected_types - def add(self, path, return_exit_code=False): - return self.run(["git", "add", path], return_exit_code=return_exit_code) + def add_list(self, paths, return_exit_code=False): + return self.run(["git", "add"] + paths, return_exit_code=return_exit_code) - def delete(self, path): - return self.run(["git", "rm", "-f", path]) + def delete_list(self, paths): + return self.run(["git", "rm", "-f"] + paths) def exists(self, path): return_code = self.run(["git", "show", "HEAD:%s" % path], return_exit_code=True, decode_output=False) diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py index 9ff9e5f77..6b6e6fcf0 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm.py @@ -154,9 +154,15 @@ class SCM: self._subclass_must_implement() def add(self, path, return_exit_code=False): + self.add_list([path], return_exit_code) + + def add_list(self, paths, return_exit_code=False): self._subclass_must_implement() def delete(self, path): + self.delete_list([path]) + + def delete_list(self, paths): self._subclass_must_implement() def exists(self, path): diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py index f203cfa1a..8b6c76499 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py @@ -38,7 +38,10 @@ class MockSCM(object): self._executive = executive or MockExecutive() def add(self, destination_path, return_exit_code=False): - self.added_paths.add(destination_path) + self.add_list([destination_path], return_exit_code) + + def add_list(self, destination_paths, return_exit_code=False): + self.added_paths.update(set(destination_paths)) if return_exit_code: return 0 @@ -111,7 +114,11 @@ class MockSCM(object): return "49824" def delete(self, path): + return self.delete_list([path]) + + def delete_list(self, paths): if not self._filesystem: return - if self._filesystem.exists(path): - self._filesystem.remove(path) + for path in paths: + if self._filesystem.exists(path): + self._filesystem.remove(path) diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py index 7ce714a19..802fe2cee 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py @@ -315,6 +315,10 @@ class SCMTest(unittest.TestCase): write_into_file_at_path("added_file", "new stuff") self.scm.add("added_file") + write_into_file_at_path("added_file3", "more new stuff") + write_into_file_at_path("added_file4", "more new stuff") + self.scm.add_list(["added_file3", "added_file4"]) + os.mkdir("added_dir") write_into_file_at_path("added_dir/added_file2", "new stuff") self.scm.add("added_dir") @@ -323,12 +327,14 @@ class SCMTest(unittest.TestCase): added_files = self.scm.added_files() if "added_dir" in added_files: added_files.remove("added_dir") - self.assertEqual(added_files, ["added_dir/added_file2", "added_file"]) + self.assertEqual(added_files, ["added_dir/added_file2", "added_file", "added_file3", "added_file4"]) # Test also to make sure clean_working_directory removes added files self.scm.clean_working_directory() self.assertEqual(self.scm.added_files(), []) self.assertFalse(os.path.exists("added_file")) + self.assertFalse(os.path.exists("added_file3")) + self.assertFalse(os.path.exists("added_file4")) self.assertFalse(os.path.exists("added_dir")) def _shared_test_changed_files_for_revision(self): @@ -820,6 +826,12 @@ END self.scm.delete("test_file") self.assertTrue("test_file" in self.scm.deleted_files()) + def test_delete_list(self): + os.chdir(self.svn_checkout_path) + self.scm.delete_list(["test_file", "test_file2"]) + self.assertTrue("test_file" in self.scm.deleted_files()) + self.assertTrue("test_file2" in self.scm.deleted_files()) + def test_delete_recursively(self): self._shared_test_delete_recursively() @@ -1172,7 +1184,7 @@ class GitSVNTest(SCMTest): def _two_local_commits(self): self._one_local_commit() - self._second_local_commt() + self._second_local_commit() def _three_local_commits(self): self._local_commit('test_file_commit0', 'more test content', 'another test commit') @@ -1517,6 +1529,12 @@ class GitSVNTest(SCMTest): self.scm.delete('test_file_commit1') self.assertTrue("test_file_commit1" in self.scm.deleted_files()) + def test_delete_list(self): + self._two_local_commits() + self.scm.delete_list(["test_file_commit1", "test_file_commit2"]) + self.assertTrue("test_file_commit1" in self.scm.deleted_files()) + self.assertTrue("test_file_commit2" in self.scm.deleted_files()) + def test_delete_recursively(self): self._shared_test_delete_recursively() diff --git a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py index 6a2e1319b..3c269175c 100644 --- a/Tools/Scripts/webkitpy/common/checkout/scm/svn.py +++ b/Tools/Scripts/webkitpy/common/checkout/scm/svn.py @@ -178,9 +178,10 @@ class SVN(SCM, SVNRepository): self._add_parent_directories(dirname) self.add(path) - def add(self, path, return_exit_code=False): - self._add_parent_directories(os.path.dirname(os.path.abspath(path))) - return self._run_svn(["add", path], return_exit_code=return_exit_code) + def add_list(self, paths, return_exit_code=False): + for path in paths: + self._add_parent_directories(os.path.dirname(os.path.abspath(path))) + return self._run_svn(["add"] + paths, return_exit_code=return_exit_code) def _delete_parent_directories(self, path): if not self.in_working_directory(path): @@ -192,11 +193,12 @@ class SVN(SCM, SVNRepository): if dirname != path: self._delete_parent_directories(dirname) - def delete(self, path): - abs_path = os.path.abspath(path) - parent, base = os.path.split(abs_path) - result = self._run_svn(["delete", "--force", base], cwd=parent) - self._delete_parent_directories(os.path.dirname(abs_path)) + def delete_list(self, paths): + for path in paths: + abs_path = os.path.abspath(path) + parent, base = os.path.split(abs_path) + result = self._run_svn(["delete", "--force", base], cwd=parent) + self._delete_parent_directories(os.path.dirname(abs_path)) return result def exists(self, path): diff --git a/Tools/Scripts/webkitpy/common/config/committers.py b/Tools/Scripts/webkitpy/common/config/committers.py index 5a3656482..3f99eaddc 100644 --- a/Tools/Scripts/webkitpy/common/config/committers.py +++ b/Tools/Scripts/webkitpy/common/config/committers.py @@ -122,7 +122,6 @@ contributors_who_are_not_committers = [ Contributor("Brian Salomon", "bsalomon@google.com"), Contributor("Commit Queue", "commit-queue@webkit.org"), Contributor("Daniel Sievers", "sievers@chromium.org"), - Contributor("Dave Barton", "dbarton@mathscribe.com"), Contributor("Dave Tharp", "dtharp@codeaurora.org", "dtharp"), Contributor("David Barr", "davidbarr@chromium.org", "barrbrain"), Contributor("David Dorwin", "ddorwin@chromium.org", "ddorwin"), @@ -222,6 +221,7 @@ committers_unable_to_review = [ Committer("Dan Winship", "danw@gnome.org", "danw"), Committer("Dana Jansens", "danakj@chromium.org", "danakj"), Committer("Daniel Cheng", "dcheng@chromium.org", "dcheng"), + Committer("Dave Barton", "dbarton@mathscribe.com", "dbarton"), Committer("David Grogan", ["dgrogan@chromium.org", "dgrogan@google.com"], "dgrogan"), Committer("David Smith", ["catfish.man@gmail.com", "dsmith@webkit.org"], "catfishman"), Committer("Diego Gonzalez", ["diegohcg@webkit.org", "diego.gonzalez@openbossa.org"], "diegohcg"), @@ -287,6 +287,7 @@ committers_unable_to_review = [ Committer("Kaustubh Atrawalkar", ["kaustubh@motorola.com"], "silverroots"), Committer("Keishi Hattori", "keishi@webkit.org", "keishi"), Committer("Kelly Norton", "knorton@google.com"), + Committer("Ken Buchanan", "kenrb@chromium.org", "kenrb"), Committer("Kenichi Ishibashi", "bashi@chromium.org", "bashi"), Committer("Kenji Imasaki", "imasaki@chromium.org", "imasaki"), Committer("Kent Hansen", "kent.hansen@nokia.com", "khansen"), diff --git a/Tools/Scripts/webkitpy/common/config/watchlist b/Tools/Scripts/webkitpy/common/config/watchlist index bd26b2787..ca7b72578 100755 --- a/Tools/Scripts/webkitpy/common/config/watchlist +++ b/Tools/Scripts/webkitpy/common/config/watchlist @@ -154,6 +154,9 @@ }, "Media": { "filename": r"(Source|LayoutTests)/.*([Mm]edia|[Aa]udio|[Vv]ideo)", + }, + "MathML": { + "filename": r"(Source|LayoutTests|Websites)/.*mathml", } }, "CC_RULES": { @@ -173,6 +176,7 @@ "GStreamerGraphics": [ "alexis.menard@openbossa.org", "pnormand@igalia.com", "gns@gnome.org", "mrobinson@webkit.org" ], "GtkWebKit2PublicAPI": [ "cgarcia@igalia.com", "gns@gnome.org", "mrobinson@webkit.org" ], "Loader": [ "japhet@chromium.org" ], + "MathML": [ "dbarton@mathscribe.com" ], "Media": [ "feature-media-reviews@chromium.org", "eric.carlson@apple.com" ], "QtBuildSystem" : [ "vestbo@webkit.org", ], "QtWebKit2PlatformSpecific": [ "alexis.menard@openbossa.org", "zoltan@webkit.org", "cmarcelo@webkit.org" ], diff --git a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py index a58aac940..63e18ac8a 100644 --- a/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py +++ b/Tools/Scripts/webkitpy/layout_tests/controllers/manager_unittest.py @@ -73,6 +73,7 @@ class ShardingTests(unittest.TestCase): "dom/html/level2/html/HTMLAnchorElement03.html", "ietestcenter/Javascript/11.1.5_4-4-c-1.html", "dom/html/level2/html/HTMLAnchorElement06.html", + "perf/object-keys.html", ] def get_shards(self, num_workers, fully_parallel, test_list=None, max_locked_shards=None): @@ -95,7 +96,8 @@ class ShardingTests(unittest.TestCase): ['http/tests/security/view-source-no-refresh.html', 'http/tests/websocket/tests/unicode.htm', 'http/tests/websocket/tests/websocket-protocol-ignored.html', - 'http/tests/xmlhttprequest/supported-xml-content-types.html'])]) + 'http/tests/xmlhttprequest/supported-xml-content-types.html', + 'perf/object-keys.html'])]) self.assertEquals(unlocked, [TestShard('animations', ['animations/keyframes.html']), @@ -113,7 +115,8 @@ class ShardingTests(unittest.TestCase): [TestShard('.', ['http/tests/websocket/tests/unicode.htm']), TestShard('.', ['http/tests/security/view-source-no-refresh.html']), TestShard('.', ['http/tests/websocket/tests/websocket-protocol-ignored.html']), - TestShard('.', ['http/tests/xmlhttprequest/supported-xml-content-types.html'])]) + TestShard('.', ['http/tests/xmlhttprequest/supported-xml-content-types.html']), + TestShard('.', ['perf/object-keys.html'])]), self.assertEquals(unlocked, [TestShard('.', ['animations/keyframes.html']), TestShard('.', ['fast/css/display-none-inline-style-change-crash.html']), @@ -128,7 +131,8 @@ class ShardingTests(unittest.TestCase): ['http/tests/websocket/tests/unicode.htm', 'http/tests/security/view-source-no-refresh.html', 'http/tests/websocket/tests/websocket-protocol-ignored.html', - 'http/tests/xmlhttprequest/supported-xml-content-types.html'])]) + 'http/tests/xmlhttprequest/supported-xml-content-types.html', + 'perf/object-keys.html'])]) self.assertEquals(unlocked, [TestShard('unlocked_tests', ['animations/keyframes.html', @@ -157,7 +161,8 @@ class ShardingTests(unittest.TestCase): 'http/tests/websocket/tests/unicode.htm', 'http/tests/websocket/tests/websocket-protocol-ignored.html']), TestShard('locked_shard_2', - ['http/tests/xmlhttprequest/supported-xml-content-types.html'])]) + ['http/tests/xmlhttprequest/supported-xml-content-types.html', + 'perf/object-keys.html'])]) locked, unlocked = self.get_shards(num_workers=4, fully_parallel=False) self.assertEquals(locked, @@ -165,7 +170,29 @@ class ShardingTests(unittest.TestCase): ['http/tests/security/view-source-no-refresh.html', 'http/tests/websocket/tests/unicode.htm', 'http/tests/websocket/tests/websocket-protocol-ignored.html', - 'http/tests/xmlhttprequest/supported-xml-content-types.html'])]) + 'http/tests/xmlhttprequest/supported-xml-content-types.html', + 'perf/object-keys.html'])]) + + +class LockCheckingManager(Manager): + def __init__(self, port, options, printer, tester, http_lock): + super(LockCheckingManager, self).__init__(port, options, printer) + self._finished_list_called = False + self._tester = tester + self._should_have_http_lock = http_lock + + def handle_finished_list(self, source, list_name, num_tests, elapsed_time): + if not self._finished_list_called: + self._tester.assertEquals(list_name, 'locked_tests') + self._tester.assertTrue(self._remaining_locked_shards) + self._tester.assertTrue(self._has_http_lock is self._should_have_http_lock) + + super(LockCheckingManager, self).handle_finished_list(source, list_name, num_tests, elapsed_time) + + if not self._finished_list_called: + self._tester.assertEquals(self._remaining_locked_shards, []) + self._tester.assertFalse(self._has_http_lock) + self._finished_list_called = True class ManagerTest(unittest.TestCase): @@ -192,30 +219,25 @@ class ManagerTest(unittest.TestCase): self.assertTrue('Baseline search path: test-mac-leopard -> test-mac-snowleopard -> generic' in printer.output) def test_http_locking(tester): - class LockCheckingManager(Manager): - def __init__(self, port, options, printer): - super(LockCheckingManager, self).__init__(port, options, printer) - self._finished_list_called = False - - def handle_finished_list(self, source, list_name, num_tests, elapsed_time): - if not self._finished_list_called: - tester.assertEquals(list_name, 'locked_tests') - tester.assertTrue(self._remaining_locked_shards) - tester.assertTrue(self._has_http_lock) - - super(LockCheckingManager, self).handle_finished_list(source, list_name, num_tests, elapsed_time) - - if not self._finished_list_called: - tester.assertEquals(self._remaining_locked_shards, []) - tester.assertFalse(self._has_http_lock) - self._finished_list_called = True - options, args = run_webkit_tests.parse_args(['--platform=test', '--print=nothing', 'http/tests/passes', 'passes']) host = MockHost() port = host.port_factory.get(port_name=options.platform, options=options) run_webkit_tests._set_up_derived_options(port, options) printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO()) - manager = LockCheckingManager(port, options, printer) + manager = LockCheckingManager(port, options, printer, tester, True) + manager.collect_tests(args) + manager.parse_expectations() + num_unexpected_results = manager.run() + printer.cleanup() + tester.assertEquals(num_unexpected_results, 0) + + def test_perf_locking(tester): + options, args = run_webkit_tests.parse_args(['--platform=test', '--print=nothing', '--no-http', 'passes', 'perf/']) + host = MockHost() + port = host.port_factory.get(port_name=options.platform, options=options) + run_webkit_tests._set_up_derived_options(port, options) + printer = printing.Printer(port, options, StringIO.StringIO(), StringIO.StringIO()) + manager = LockCheckingManager(port, options, printer, tester, False) manager.collect_tests(args) manager.parse_expectations() num_unexpected_results = manager.run() diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mac.py b/Tools/Scripts/webkitpy/layout_tests/port/mac.py index 9513ae5bd..855217682 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/mac.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/mac.py @@ -1,4 +1,5 @@ # Copyright (C) 2011 Google Inc. All rights reserved. +# 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 @@ -239,3 +240,10 @@ class MacPort(ApplePort): _log.debug("IOError raised while stopping helper: %s" % str(e)) pass self._helper = None + + def nm_command(self): + try: + return self._executive.run_command(['xcrun', '-find', 'nm']).rstrip() + except ScriptError, e: + _log.warn("xcrun failed; falling back to 'nm'.") + return 'nm' diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py index d2e64b6db..8abd81235 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/test.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py @@ -222,6 +222,10 @@ layer at (0,0) size 800x34 tests.add('platform/test-snow-leopard/http/test.html') tests.add('platform/test-snow-leopard/websocket/test.html') + # For testing if perf tests are running in a locked shard. + tests.add('perf/foo/test.html') + tests.add('perf/foo/test-ref.html') + return tests diff --git a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py index 0965b44a4..d798039ac 100644 --- a/Tools/Scripts/webkitpy/layout_tests/port/webkit.py +++ b/Tools/Scripts/webkitpy/layout_tests/port/webkit.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # Copyright (C) 2010 Google Inc. All rights reserved. # Copyright (C) 2010 Gabor Rapcsanyi <rgabor@inf.u-szeged.hu>, University of Szeged -# Copyright (C) 2011 Apple Inc. All rights reserved. +# Copyright (C) 2011, 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 @@ -262,12 +262,15 @@ class WebKitPort(Port): """If a port makes certain features available only through runtime flags, it can override this routine to indicate which ones are available.""" return None + def nm_command(self): + return 'nm' + def _webcore_symbols_string(self): webcore_library_path = self._path_to_webcore_library() if not webcore_library_path: return None try: - return self._executive.run_command(['nm', webcore_library_path], error_handler=Executive.ignore_error) + return self._executive.run_command([self.nm_command(), webcore_library_path], error_handler=Executive.ignore_error) except OSError, e: _log.warn("Failed to run nm: %s. Can't determine WebCore supported features." % e) return None diff --git a/configure.ac b/configure.ac index 895dfc5b1..6282b16d7 100644 --- a/configure.ac +++ b/configure.ac @@ -629,14 +629,6 @@ AC_ARG_ENABLE(gamepad, [],[enable_gamepad="no"]) AC_MSG_RESULT([$enable_gamepad]) -# check whether to build with datagrid support -AC_MSG_CHECKING([whether to enable HTML5 datagrid support]) -AC_ARG_ENABLE(datagrid, - AC_HELP_STRING([--enable-datagrid], - [enable HTML5 datagrid support [default=no]]), - [],[enable_datagrid="no"]) -AC_MSG_RESULT([$enable_datagrid]) - # check whether to build with data transfer items support AC_MSG_CHECKING([whether to enable HTML5 data transfer items support]) AC_ARG_ENABLE(data_transfer_items, @@ -653,14 +645,6 @@ AC_ARG_ENABLE(mutation_observers, [],[enable_mutation_observers="no"]) AC_MSG_RESULT([$enable_mutation_observers]) -# check whether to enable HTML5 client-side session and persitent storage support -AC_MSG_CHECKING([whether to enable HTML5 client-side session and persistent storage support]) -AC_ARG_ENABLE(dom_storage, - AC_HELP_STRING([--enable-dom-storage], - [enable HTML5 client-side session and persistent storage support [default=yes]]), - [],[enable_dom_storage="yes"]) -AC_MSG_RESULT([$enable_dom_storage]) - # check whether to enable the indexed database API AC_MSG_CHECKING([whether to enable the indexed database API]) AC_ARG_ENABLE(indexed_database, @@ -709,14 +693,6 @@ AC_ARG_ENABLE(icon_database, [],[enable_icon_database="yes"]) AC_MSG_RESULT([$enable_icon_database]) -# check whether to build with image resizer API support -AC_MSG_CHECKING([whether to enable image resizer API support]) -AC_ARG_ENABLE(image_resizer, - AC_HELP_STRING([--enable-image-resizer], - [enable image resizer [default=no]]), - [],[enable_image_resizer="no"]) -AC_MSG_RESULT([$enable_image_resizer]) - # check whether to enable HTML5 datalist support AC_MSG_CHECKING([whether to enable HTML5 datalist support]) AC_ARG_ENABLE(datalist, @@ -725,21 +701,13 @@ AC_ARG_ENABLE(datalist, [],[enable_datalist="yes"]) AC_MSG_RESULT([$enable_datalist]) -# check whether to enable HTML5 sandbox iframe support -AC_MSG_CHECKING([whether to enable HTML5 sandboxed iframe support]) -AC_ARG_ENABLE(sandbox, - AC_HELP_STRING([--enable-sandbox], - [enable HTML5 sandboxed iframe support [default=yes]]), - [],[enable_sandbox="yes"]) -AC_MSG_RESULT([$enable_sandbox]) - # check whether to enable HTML5 iframe seamless attribute support AC_MSG_CHECKING([whether to enable HTML5 iframe seamless attribute support]) AC_ARG_ENABLE(iframe-seamless, AC_HELP_STRING([--enable-iframe-seamless], [enable HTML5 iframe seamless attribute support [default=yes]]), [],[enable_iframe_seamless="yes"]) -AC_MSG_RESULT([$enable_sandbox]) +AC_MSG_RESULT([$enable_iframe_seamless]) # check whether to enable HTML5 audio/video support AC_MSG_CHECKING([whether to enable HTML5 video support]) @@ -1388,7 +1356,6 @@ AM_CONDITIONAL([ENABLE_CHANNEL_MESSAGING],[test "$enable_channel_messaging" = "y AM_CONDITIONAL([ENABLE_JAVASCRIPT_DEBUGGER],[test "$enable_javascript_debugger" = "yes"]) AM_CONDITIONAL([ENABLE_GAMEPAD],[test "$enable_gamepad" = "yes"]) AM_CONDITIONAL([ENABLE_DIRECTORY_UPLOAD],[test "$enable_directory_upload" = "yes"]) -AM_CONDITIONAL([ENABLE_DATAGRID],[test "$enable_datagrid" = "yes"]) AM_CONDITIONAL([ENABLE_DATA_TRANSFER_ITEMS],[test "$enable_data_transfer_items" = "yes"]) AM_CONDITIONAL([ENABLE_SQL_DATABASE],[test "$enable_sql_database" = "yes"]) AM_CONDITIONAL([ENABLE_DATALIST],[test "$enable_datalist" = "yes"]) @@ -1398,7 +1365,6 @@ AM_CONDITIONAL([ENABLE_FILE_SYSTEM],[test "$enable_file_system" = "yes"]) AM_CONDITIONAL([ENABLE_STYLE_SCOPED],[test "$enable_style_scoped" = "yes"]) AM_CONDITIONAL([ENABLE_QUOTA],[test "$enable_quota" = "yes"]) AM_CONDITIONAL([ENABLE_ICONDATABASE],[test "$enable_icon_database" = "yes"]) -AM_CONDITIONAL([ENABLE_IMAGE_RESIZER],[test "$enable_image_resizer" = "yes"]) AM_CONDITIONAL([ENABLE_INPUT_TYPE_COLOR],[test "$enable_input_type_color" = "yes"]) AM_CONDITIONAL([ENABLE_INPUT_SPEECH],[test "$enable_input_speech" = "yes"]) AM_CONDITIONAL([ENABLE_SCRIPTED_SPEECH],[test "$enable_scripted_speech" = "yes"]) @@ -1515,20 +1481,16 @@ Features: HTML5 microdata support : $enable_microdata Page Visibility API support : $enable_page_visibility_api HTML5 progress element support : $enable_progress_tag - HTML5 client-side session and persistent storage support : $enable_dom_storage SQL client-side database storage support : $enable_sql_database - HTML5 datagrid support : $enable_datagrid HTML5 data transfer items support : $enable_data_transfer_items HTML5 FileSystem API support : $enable_file_system Quota API support : $enable_quota - HTML5 sandboxed iframe support : $enable_sandbox HTML5 iframe seamless attribute support : $enable_iframe_seamless HTML5 video element support : $enable_video HTML5 track element support : $enable_video_track Fullscreen API support : $enable_fullscreen_api Media stream support : $enable_media_stream Icon database support : $enable_icon_database - Image resizer support : $enable_image_resizer Link prefetch support : $enable_link_prefetch Opcode stats : $enable_opcode_stats Shadow DOM support : $enable_shadow_dom |